VxWorks Reference Manual : Libraries

mb87030Lib

NAME

mb87030Lib - Fujitsu MB87030 SCSI Protocol Controller (SPC) library

ROUTINES

mb87030CtrlCreate( ) - create a control structure for an MB87030 SPC
mb87030CtrlInit( ) - initialize a control structure for an MB87030 SPC
mb87030Show( ) - display the values of all readable MB87030 SPC registers

DESCRIPTION

This is the I/O driver for the Fujitsu MB87030 SCSI Protocol Controller (SPC) chip. It is designed to work in conjunction with scsiLib.

USER-CALLABLE ROUTINES

Most of the routines in this driver are accessible only through the I/O system. Two routines, however, must be called directly: mb87030CtrlCreate( ) to create a controller structure, and mb87030CtrlInit( ) to initialize the controller structure.

INCLUDE FILES

mb87030.h

SEE ALSO

mb87030Lib, scsiLib, Fujitsu Small Computer Systems Interface MB87030 Synchronous/Asynchronous Protocol Controller Users Manual, VxWorks Programmer's Guide: I/O System


Libraries : Routines

mb87030CtrlCreate( )

NAME

mb87030CtrlCreate( ) - create a control structure for an MB87030 SPC

SYNOPSIS

MB_87030_SCSI_CTRL *mb87030CtrlCreate
    (
    UINT8 * spcBaseAdrs,   /* base address of SPC */
    int     regOffset,     /* addr offset between consecutive regs. */
    UINT    clkPeriod,     /* period of controller clock (nsec) */
    int     spcDataParity, /* type of input to SPC DP (data parity) */
    FUNCPTR spcDMABytesIn, /* SCSI DMA input function */
    FUNCPTR spcDMABytesOut /* SCSI DMA output function */
    )

DESCRIPTION

This routine creates a data structure that must exist before the SPC chip can be used. This routine should be called once and only once for a specified SPC. It should be the first routine called, since it allocates memory for a structure needed by all other routines in the library.

After calling this routine, at least one call to mb87030CtrlInit( ) should be made before any SCSI transaction is initiated using the SPC chip.

A detailed description of the input parameters follows:

spcBaseAdrs
the address at which the CPU would access the lowest register of the SPC.

regOffset
the address offset (bytes) to access consecutive registers. (This must be a power of 2, for example, 1, 2, 4, etc.)

clkPeriod
the period in nanoseconds of the signal to the SPC clock input (only used for select command timeouts).

spcDataParity
the parity bit must be defined by one of the following constants, according to whether the input to SPC DP is GND, +5V, or a valid parity signal, respectively:
    SPC_DATA_PARITY_LOW
    SPC_DATA_PARITY_HIGH
    SPC_DATA_PARITY_VALID

spcDmaBytesIn and spcDmaBytesOut
pointers to board-specific routines to handle DMA input and output. If these are NULL (0), SPC program transfer mode is used. DMA is possible only during SCSI data in/out phases. The interface to these DMA routines must be of the form:
    STATUS xxDmaBytes{In, Out}
        (
        SCSI_PHYS_DEV  *pScsiPhysDev,  /* ptr to phys dev info    */
        UINT8          *pBuffer,       /* ptr to the data buffer  */
        int            bufLength       /* number of bytes to xfer */
        )

RETURNS

 A pointer to the SPC control structure, or NULL if memory  is insufficient or parameters are invalid.

SEE ALSO

mb87030Lib


Libraries : Routines

mb87030CtrlInit( )

NAME

mb87030CtrlInit( ) - initialize a control structure for an MB87030 SPC

SYNOPSIS

STATUS mb87030CtrlInit
    (
    MB_87030_SCSI_CTRL * pSpc,              /* ptr to SPC struct */
    int                  scsiCtrlBusId,     /* SCSI bus ID of this SPC */
    UINT                 defaultSelTimeOut, /* default dev sel timeout */
    int                  scsiPriority       /* priority of task doing SCSI */
    )

DESCRIPTION

This routine initializes an SPC control structure created by mb87030CtrlCreate( ). It must be called before the SPC is used. This routine can be called more than once; however, it should be called only while there is no activity on the SCSI interface.

Before returning, this routine pulses RST (reset) on the SCSI bus, thus resetting all attached devices.

The input parameters are as follows:

pSpc
a pointer to the MB_87030_SCSI_CTRL structure created with mb87030CtrlCreate( ).

scsiCtrlBusId
the SCSI bus ID of the SIOP, in the range 0 - 7. The ID is somewhat arbitrary; the value 7, or highest priority, is conventional.

defaultSelTimeOut
the timeout, in microseconds, for selecting a SCSI device attached to this controller. The recommended value 0 specifies SCSI_DEF_SELECT_TIMEOUT (250 milliseconds). The maximum timeout possible is approximately 3 seconds. Values exceeding this revert to the maximum.

scsiPriority
the priority to which a task is set when performing a SCSI transaction. Valid priorities range from 0 to 255. Alternatively, the value -1 specifies that the priority should not be altered during SCSI transactions.

RETURNS

 OK, or ERROR if parameters are out of range.

SEE ALSO

mb87030Lib


Libraries : Routines

mb87030Show( )

NAME

mb87030Show( ) - display the values of all readable MB87030 SPC registers

SYNOPSIS

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

DESCRIPTION

This routine displays the state of the SPC registers in a user-friendly manner. It is useful primarily for debugging.

EXAMPLE

    -> mb87030Show
    SCSI Bus ID: 7    
    SCTL (0x01): intsEnbl  
    SCMD (0x00): busRlease 
    TMOD (0x00): asyncMode 
    INTS (0x00):            
    PSNS (0x00): req0 ack0 atn0 sel0 bsy0 msg0 c_d0 i_o0 
    SSTS (0x05): noConIdle xferCnt=0 dregEmpty 
    SERR (0x00): noParErr  
    PCTL (0x00): bfIntDsbl phDataOut 
    MBC  (0x00): 0         
    XFER COUNT : 0x000000 =         0

RETURNS

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

SEE ALSO

mb87030Lib