VxWorks Reference Manual : Libraries
ncr810Lib - NCR 53C8xx PCI SCSI I/O Processor (SIOP) library (SCSI-2)
ncr810CtrlCreate( ) - create a control structure for the NCR 53C8xx SIOP
ncr810CtrlInit( ) - initialize a control structure for the NCR 53C8xx SIOP
ncr810SetHwRegister( ) - set hardware-dependent registers for the NCR 53C8xx SIOP
ncr810Show( ) - display values of all readable NCR 53C8xx SIOP registers
This is the I/O driver for the NCR 53C8xx PCI SCSI I/O Processors (SIOP), supporting the NCR 53C810 and the NCR 53C825 SCSI controllers. It is designed to work with scsiLib and scsi2Lib. This driver runs in conjunction with a script program for the NCR 53C8xx controllers. These scripts use DMA transfers for all data, messages, and status. This driver supports cache functions through cacheLib.
Most of the routines in this driver are accessible only through the I/O system. Three routines, however, must be called directly. ncr810CtrlCreate( ) creates a controller structure and ncr810CtrlInit( ) initializes it. The NCR 53C8xx hardware registers need to be configured according to the hardware implementation. If the default configuration is not correct, the routine ncr810SetHwRegister( ) must be used to properly configure the registers.
The global variable ncr810PciMemOffset was created to provide the BSP with a means of changing the VIRT_TO_PHYS mapping without changing the functions in the cacheFuncs structures. In generating physical addresses for DMA on the PCI bus, local addresses are passed through the function CACHE_DMA_VIRT_TO_PHYS and then the value of ncr810PciMemOffset is added. For backward compatibility, the initial value of ncr810PciMemOffset comes from the macro PCI_TO_MEM_OFFSET defined in ncr810.h.
I/O MACROS All device access for input and output is done via macros which can be customized for each BSP. These routines are NCR810_IN_BYTE, NCR810_OUT_BYTE, NCR810_IN_16, NCR810_OUT_16, NCR810_IN_32 and NCR810_OUT_32. By default, these are defined as generic memory references.
ncr810.h, ncr810Script.h and scsiLib.h
ncr810Lib, scsiLib, scsi2Lib, cacheLib, SYM53C825 PCI-SCSI I/O Processor Data Manual, SYM53C810 PCI-SCSI I/O Processor Data Manual, NCR 53C8XX Family PCI-SCSI I/O Processors Programming Guide, VxWorks Programmer's Guide: I/O System
ncr810CtrlCreate( ) - create a control structure for the NCR 53C8xx SIOP
NCR_810_SCSI_CTRL *ncr810CtrlCreate ( UINT8 * baseAdrs, /* base address of the SIOP */ UINT clkPeriod, /* clock controller period (nsec* 100) */ UINT16 devType /* NCR8XX SCSI device type */ )
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 ncr810Lib, it must be called before any other routines in the library. After calling this routine, ncr810CtrlInit( ) 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 ncr810.h as follows:
NCR810_1667MHZ 6000 /* 16.67Mhz chip */ NCR810_20MHZ 5000 /* 20Mhz chip */ NCR810_25MHZ 4000 /* 25Mhz chip */ NCR810_3750MHZ 2667 /* 37.50Mhz chip */ NCR810_40MHZ 2500 /* 40Mhz chip */ NCR810_50MHZ 2000 /* 50Mhz chip */ NCR810_66MHZ 1515 /* 66Mhz chip */ NCR810_6666MHZ 1500 /* 66.66Mhz chip */- devType
- the specific NCR 8xx device type. Current device types are defined in the header file ncr810.h.
A pointer to the NCR_810_SCSI_CTRL structure, or NULL if memory is unavailable or there are invalid parameters.
ncr810CtrlInit( ) - initialize a control structure for the NCR 53C8xx SIOP
STATUS ncr810CtrlInit ( NCR_810_SCSI_CTRL * pSiop, /* ptr to SIOP struct */ int scsiCtrlBusId /* SCSI bus ID of this SIOP */ )
This routine initializes an SIOP structure, after the structure is created with ncr810CtrlCreate( ). 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_810_SCSI_CTRL structure created with ncr810CtrlCreate( ).
- 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.
OK, or ERROR if parameters are out of range.
ncr810SetHwRegister( ) - set hardware-dependent registers for the NCR 53C8xx SIOP
STATUS ncr810SetHwRegister ( SIOP * pSiop, /* pointer to SIOP info */ NCR810_HW_REGS * pHwRegs /* pointer to a NCR810_HW_REGS info */ )
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_810_SCSI_CTRL structure created with ncr810CtrlCreate( ).
- pHwRegs
- a pointer to a NCR810_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 ncr810CtlrCreate( ) and ncr810CrtlInit( ) is {0,0,0,0,0,1,0,0,0,0,0}.
typedef struct { int stest1Bit7; /* Disable external SCSI clock */ int stest2Bit7; /* SCSI control enable */ int stest2Bit5; /* Enable differential SCSI bus */ int stest2Bit2; /* Always WIDE SCSI */ int stest2Bit1; /* Extend SREQ/SACK filtering */ int stest3Bit7; /* TolerANT enable */ int dmodeBit7; /* Burst Length transfer bit 1 */ int dmodeBit6; /* Burst Length transfer bit 0 */ int dmodeBit5; /* Source I/O memory enable */ int dmodeBit4; /* Destination I/O memory enable*/ int scntl1Bit7; /* Slow cable mode */ } NCR810_HW_REGS;For a more detailed explanation of the register bits, see the appropriate NCR 53C8xx data manuals.
* Because this routine writes to the NCR 53C8xx chip registers, it cannot be used when there is any SCSI bus activity.
OK, or ERROR if any input parameter is NULL
ncr810Lib, ncr810.h, ncr810CtlrCreate( )
ncr810Show( ) - display values of all readable NCR 53C8xx SIOP registers
STATUS ncr810Show ( SCSI_CTRL * pScsiCtrl /* ptr to SCSI controller info */ )
This routine displays the state of the SIOP registers in a user-friendly way. It is useful primarily for debugging. The input parameter is the pointer to the SIOP information structure returned by the ncr810CtrlCreate( ) call.
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.
-> ncr810Show NCR810 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
OK, or ERROR if pScsiCtrl and pSysScsiCtrl are both NULL.