VxWorks Reference Manual : Libraries

ncr710Lib2

NAME

ncr710Lib2 - NCR 53C710 SCSI I/O Processor (SIOP) library (SCSI-2)

ROUTINES

ncr710CtrlCreateScsi2( ) - create a control structure for the NCR 53C710 SIOP
ncr710CtrlInitScsi2( ) - initialize a control structure for the NCR 53C710 SIOP
ncr710SetHwRegisterScsi2( ) - set hardware-dependent registers for the NCR 53C710
ncr710ShowScsi2( ) - display the values of all readable NCR 53C710 SIOP registers

DESCRIPTION

This is the I/O driver for the NCR 53C710 SCSI I/O Processor (SIOP). It is designed to work with scsi2Lib. This driver runs in conjunction with a script program for the NCR 53C710 chip. The script uses the NCR 53C710 DMA function for data transfers. This driver supports cache functions through cacheLib.

USER-CALLABLE ROUTINES

Most of the routines in this driver are accessible only through the I/O system. Three routines, however, must be called directly. ncr710CtrlCreateScsi2( ) creates a controller structure and ncr710CtrlInitScsi2( ) initializes it. The NCR 53C710 hardware registers need to be configured according to the hardware implementation. If the default configuration is not correct, the routine ncr710SetHwRegisterScsi2( ) must be used to properly configure the registers.

INCLUDE FILES

ncr710.h, ncr710_2.h, ncr710Script.h, ncr710Script2.h

SEE ALSO

ncr710Lib2, scsiLib, scsi2Lib, cacheLib, VxWorks Programmer's Guide: I/O System


Libraries : Routines

ncr710CtrlCreateScsi2( )

NAME

ncr710CtrlCreateScsi2( ) - create a control structure for the NCR 53C710 SIOP

SYNOPSIS

NCR_710_SCSI_CTRL *ncr710CtrlCreateScsi2
    (
    UINT8 * baseAdrs, /* base address of the SIOP */
    UINT    clkPeriod /* clock controller period (nsec* 100) */
    )

DESCRIPTION

This routine creates an SIOP data structure and must be called before using an SIOP chip. It must be called exactly once for a specified SIOP controller. Since it allocates memory for a structure needed by all routines in ncr710Lib, it must be called before any other routines in the library. After calling this routine, ncr710CtrlInitScsi2( ) must be called at least once before any SCSI transactions are initiated using the SIOP.

A detailed description of the input parameters follows:

baseAdrs
the address at which the CPU accesses the lowest (SCNTL0/SIEN) register of the SIOP.

clkPeriod
the period of the SIOP SCSI clock input, in nanoseconds, multiplied by 100. This is used to determine the clock period for the SCSI core of the chip and affects the timing of both asynchronous and synchronous transfers. Several commonly used values are defined in ncr710.h as follows:
      NCR710_1667MHZ  6000    /* 16.67Mhz chip */
      NCR710_20MHZ    5000    /* 20Mhz chip    */
      NCR710_25MHZ    4000    /* 25Mhz chip    */
      NCR710_3750MHZ  2667    /* 37.50Mhz chip */
      NCR710_40MHZ    2500    /* 40Mhz chip    */
      NCR710_50MHZ    2000    /* 50Mhz chip    */
      NCR710_66MHZ    1515    /* 66Mhz chip    */
      NCR710_6666MHZ  1500    /* 66.66Mhz chip */

RETURNS

 A pointer to the NCR_710_SCSI_CTRL structure, or NULL if memory  is unavailable or there are invalid parameters.

SEE ALSO

ncr710Lib2


Libraries : Routines

ncr710CtrlInitScsi2( )

NAME

ncr710CtrlInitScsi2( ) - initialize a control structure for the NCR 53C710 SIOP

SYNOPSIS

STATUS ncr710CtrlInitScsi2
    (
    NCR_710_SCSI_CTRL * pSiop,         /* ptr to SIOP struct */
    int                 scsiCtrlBusId, /* SCSI bus ID of this SIOP */
    int                 scsiPriority   /* task priority when doing SCSI I/O */
    )

DESCRIPTION

This routine initializes an SIOP structure after the structure is created with ncr710CtrlCreateScsi2( ). This structure must be initialized before the SIOP can be used. It may be called more than once if needed; however, it must only be called while there is no activity on the SCSI interface.

A detailed description of the input parameters follows:

pSiop
a pointer to the NCR_710_SCSI_CTRL structure created with ncr710CtrlCreateScsi2( ).

scsiCtrlBusId
the SCSI bus ID of the SIOP. Its value is somewhat arbitrary: seven (7), or highest priority, is conventional. The value must be in the range 0 - 7.

scsiPriority
this parameter is ignored. All SCSI I/O is now done in the context of the SCSI manager task; if necessary, the priority of the manager task may be changed using taskPrioritySet( ) or by setting the value of the global variable ncr710ScsiTaskPriority before calling ncr710CtrlCreateScsi2( ).

RETURNS

OK, or ERROR if the parameters are out of range.

SEE ALSO

ncr710Lib2, ncr710CtrlCreateScsi2( )


Libraries : Routines

ncr710SetHwRegisterScsi2( )

NAME

ncr710SetHwRegisterScsi2( ) - set hardware-dependent registers for the NCR 53C710

SYNOPSIS

STATUS ncr710SetHwRegisterScsi2
    (
    SIOP *           pSiop,  /* pointer to SIOP info */
    NCR710_HW_REGS * pHwRegs /* pointer to a NCR710_HW_REGS info */
    )

DESCRIPTION

This routine sets up the registers used in the hardware implementation of the chip. Typically, this routine is called by the sysScsiInit( ) routine from the BSP.

The input parameters are as follows:

pSiop
a pointer to the NCR_710_SCSI_CTRL structure created with ncr710CtrlCreateScsi2( ).

pHwRegs
a pointer to a NCR710_HW_REGS structure that is filled with the logical values 0 or 1 for each bit of each register described below.

This routine includes only the bit registers that can be used to modify the behavior of the chip. The default configuration used during ncr710CtlrCreateScsi2( ) and ncr710CrtlInitScsi2( ) is {0,0,0,0,1,0,0,0,0,0,0,0,0,1,0}.

   typedef struct
       {
       int ctest4Bit7;   /* Host bus multiplex mode */
       int ctest7Bit7;   /* Disable/enable burst cache capability */
       int ctest7Bit6;   /* Snoop control bit1 */
       int ctest7Bit5;   /* Snoop control bit0 */
       int ctest7Bit1;   /* invert tt1 pin (sync bus host mode only)*/
       int ctest7Bit0;   /* enable differential scsi bus capability*/
       int ctest8Bit0;   /* Set snoop pins mode */
       int dmodeBit7;    /* Burst Length transfer bit 1 */
       int dmodeBit6;    /* Burst Length transfer bit 0 */
       int dmodeBit5;    /* Function code bit FC2 */
       int dmodeBit4;    /* Function code bit FC1 */
       int dmodeBit3;    /* Program data bit (FC0) */
       int dmodeBit1;    /* user  programmable transfer type */
       int dcntlBit5;    /* Enable Ack pin */
       int dcntlBit1;    /* Enable fast arbitration on host port */
       } NCR710_HW_REGS;

For a more detailed explanation of the register bits, refer to the NCR 53C710 SCSI I/O Processor Programming Guide.

NOTE

* Because this routine writes to the chip registers you cannot use it if there is any SCSI bus activity.

RETURNS

OK, or ERROR if any input parameter is NULL.

SEE ALSO

ncr710Lib2, ncr710CtrlCreateScsi2( ), NCR 53C710 SCSI I/O Processor Programming Guide


Libraries : Routines

ncr710ShowScsi2( )

NAME

ncr710ShowScsi2( ) - display the values of all readable NCR 53C710 SIOP registers

SYNOPSIS

STATUS ncr710ShowScsi2
    (
    SCSI_CTRL * pScsiCtrl /* ptr to SCSI controller info */
    )

DESCRIPTION

This routine displays the state of the NCR 53C710 SIOP registers in a user-friendly way. It is primarily used for debugging. The input parameter is the pointer to the SIOP information structure returned by the ncr710CtrlCreateScsi2( ) call.

NOTE

The only readable register during a script execution is the Istat register. If you use this routine during the execution of a SCSI command, the result could be unpredictable.

EXAMPLE

-> ncr710Show
NCR710 Registers 
---------------- 
0xfff47000: Sien    = 0xa5 Sdid    = 0x00 Scntl1  = 0x00 Scntl0  = 0x04
0xfff47004: Socl    = 0x00 Sodl    = 0x00 Sxfer   = 0x80 Scid    = 0x80
0xfff47008: Sbcl    = 0x00 Sbdl    = 0x00 Sidl    = 0x00 Sfbr    = 0x00
0xfff4700c: Sstat2  = 0x00 Sstat1  = 0x00 Sstat0  = 0x00 Dstat   = 0x80
0xfff47010: Dsa     = 0x00000000
0xfff47014: Ctest3  = ???? Ctest2  = 0x21 Ctest1  = 0xf0 Ctest0  = 0x00
0xfff47018: Ctest7  = 0x32 Ctest6  = ???? Ctest5  = 0x00 Ctest4  = 0x00
0xfff4701c: Temp    = 0x00000000
0xfff47020: Lcrc    = 0x00 Ctest8  = 0x00 Istat   = 0x00 Dfifo   = 0x00
0xfff47024: Dcmd/Ddc= 0x50000000
0xfff47028: Dnad    = 0x00066144
0xfff4702c: Dsp     = 0x00066144
0xfff47030: Dsps    = 0x00066174
0xfff47037: Scratch3= 0x00 Scratch2= 0x00 Scratch1= 0x00 Scratch0= 0x0a
0xfff47038: Dcntl   = 0x21 Dwt     = 0x00 Dien    = 0x37 Dmode   = 0x01
0xfff4703c: Adder   = 0x000cc2b8
value = 0 = 0x0

RETURNS

OK, or ERROR if pScsiCtrl and pSysScsiCtrl are both NULL.

SEE ALSO

ncr710Lib2, ncr710CtrlCreateScsi2( )