VxWorks Reference Manual : Libraries
scsiSeqLib - SCSI sequential access device library (SCSI-2)
scsiSeqDevCreate( ) - create a SCSI sequential device
scsiErase( ) - issue an ERASE command to a SCSI device
scsiTapeModeSelect( ) - issue a MODE_SELECT command to a SCSI tape device
scsiTapeModeSense( ) - issue a MODE_SENSE command to a SCSI tape device
scsiSeqReadBlockLimits( ) - issue a READ_BLOCK_LIMITS command to a SCSI device
scsiRdTape( ) - read bytes or blocks from a SCSI tape device
scsiWrtTape( ) - write data to a SCSI tape device
scsiRewind( ) - issue a REWIND command to a SCSI device
scsiReserveUnit( ) - issue a RESERVE UNIT command to a SCSI device
scsiReleaseUnit( ) - issue a RELEASE UNIT command to a SCSI device
scsiLoadUnit( ) - issue a LOAD/UNLOAD command to a SCSI device
scsiWrtFileMarks( ) - write file marks to a SCSI sequential device
scsiSpace( ) - move the tape on a specified physical SCSI device
scsiSeqStatusCheck( ) - detect a change in media
scsiSeqIoctl( ) - perform an I/O control function for sequential access devices
This library contains commands common to all sequential-access SCSI devices. Sequential-access SCSI devices are usually SCSI tape devices. These routines are separated from scsi2Lib in order to create an additional layer for better support of all SCSI sequential devices.
SCSI commands in this library include:
The SCSI routines implemented here operate mostly on a SCSI_SEQ_DEV structure. This structure acts as an interface between this library and a higher-level layer. The SEQ_DEV structure is analogous to the BLK_DEV structure for block devices.
Command Op Code ERASE (0x19) MODE SELECT (6) (0x15) MODE_SENSE (6) (0x1a) READ (6) (0x08) READ BLOCK LIMITS (0x05) RELEASE UNIT (0x17) RESERVE UNIT (0x16) REWIND (0x01) SPACE (0x11) WRITE (6) (0x0a) WRITE FILEMARKS (0x10) LOAD/UNLOAD (0x1b) The scsiSeqDevCreate( ) routine creates a SCSI_SEQ_DEV structure whose first element is a SEQ_DEV, operated upon by higher layers. This routine publishes all functions to be invoked by higher layers and maintains some state information (for example, block size) for tracking SCSI-sequential-device information.
scsiLib.h, scsi2Lib.h
scsiSeqLib, tapeFsLib, scsi2Lib, VxWorks Programmer's Guide: I/O System, Local File Systems
scsiSeqDevCreate( ) - create a SCSI sequential device
SEQ_DEV *scsiSeqDevCreate ( SCSI_PHYS_DEV * pScsiPhysDev /* ptr to SCSI physical device info */ )
This routine creates a SCSI sequential device and saves a pointer to this SEQ_DEV in the SCSI physical device. The following functions are initialized in this structure:
Only one SEQ_DEV per SCSI_PHYS_DEV is allowed, unlike BLK_DEVs where an entire list is maintained. Therefore, this routine can be called only once per creation of a sequential device.
sd_seqRd - scsiRdTape( ) sd_seqWrt - scsiWrtTape( ) sd_ioctl - scsiIoctl( ) (in scsiLib) sd_seqWrtFileMarks - scsiWrtFileMarks( ) sd_statusChk - scsiSeqStatusCheck( ) sd_reset - (not used) sd_rewind - scsiRewind( ) sd_reserve - scsiReserve( ) sd_release - scsiRelease( ) sd_readBlkLim - scsiSeqReadBlockLimits( ) sd_load - scsiLoadUnit( ) sd_space - scsiSpace( ) sd_erase - scsiErase( )
A pointer to the SEQ_DEV structure, or NULL if the command fails.
scsiErase( ) - issue an ERASE command to a SCSI device
STATUS scsiErase ( SCSI_PHYS_DEV * pScsiPhysDev, /* ptr to SCSI physical device */ BOOL longErase /* TRUE for entire tape erase */ )
This routine issues an ERASE command to a specified SCSI device.
OK, or ERROR if the command fails.
scsiTapeModeSelect( ) - issue a MODE_SELECT command to a SCSI tape device
STATUS scsiTapeModeSelect ( SCSI_PHYS_DEV * pScsiPhysDev,/* ptr to SCSI physical device */ int pageFormat, /* value of the page format bit (0-1) */ int saveParams, /* value of the save parameters bit (0-1) */ char * buffer, /* ptr to output data buffer */ int bufLength /* length of buffer in bytes */ )
This routine issues a MODE_SELECT command to a specified SCSI device.
OK, or ERROR if the command fails.
scsiTapeModeSense( ) - issue a MODE_SENSE command to a SCSI tape device
STATUS scsiTapeModeSense ( SCSI_PHYS_DEV * pScsiPhysDev,/* ptr to SCSI physical device */ int pageControl, /* value of the page control field (0-3) */ int pageCode, /* value of the page code field (0-0x3f) */ char * buffer, /* ptr to input data buffer */ int bufLength /* length of buffer in bytes */ )
This routine issues a MODE_SENSE command to a specified SCSI tape device.
OK, or ERROR if the command fails.
scsiSeqReadBlockLimits( ) - issue a READ_BLOCK_LIMITS command to a SCSI device
STATUS scsiSeqReadBlockLimits ( SCSI_SEQ_DEV * pScsiSeqDev, /* ptr to SCSI sequential device */ int * pMaxBlockLength, /* where to return maximum block length */ UINT16 * pMinBlockLength /* where to return minimum block length */ )
This routine issues a READ_BLOCK_LIMITS command to a specified SCSI device.
OK, or ERROR if the command fails.
scsiRdTape( ) - read bytes or blocks from a SCSI tape device
int scsiRdTape ( SCSI_SEQ_DEV * pScsiSeqDev, /* ptr to SCSI sequential device info */ UINT count, /* total bytes or blocks to be read */ char * buffer, /* ptr to input data buffer */ BOOL fixedSize /* if variable size blocks */ )
This routine reads the specified number of bytes or blocks from a specified physical device. If the boolean fixedSize is true, then numBytes represents the number of blocks of size blockSize, defined in the pScsiPhysDev structure. If variable block sizes are used (fixedSize = FALSE), then numBytes represents the actual number of bytes to be read.
Number of bytes or blocks actually read, 0 if EOF, or ERROR.
scsiWrtTape( ) - write data to a SCSI tape device
STATUS scsiWrtTape ( SCSI_SEQ_DEV * pScsiSeqDev, /* ptr to SCSI sequential device info */ int numBytes, /* total bytes or blocks to be written */ char * buffer, /* ptr to input data buffer */ BOOL fixedSize /* if variable size blocks */ )
This routine writes data to the current block on a specified physical device. If the boolean fixedSize is true, then numBytes represents the number of blocks of size blockSize, defined in the pScsiPhysDev structure. If variable block sizes are used (fixedSize = FALSE), then numBytes represents the actual number of bytes to be written. If numBytes is greater than the maxBytesLimit field defined in the pScsiPhysDev structure, then more than one SCSI transaction is used to transfer the data.
OK, or ERROR if the data cannot be written or zero bytes are written.
scsiRewind( ) - issue a REWIND command to a SCSI device
STATUS scsiRewind ( SCSI_SEQ_DEV * pScsiSeqDev /* ptr to SCSI Sequential device */ )
This routine issues a REWIND command to a specified SCSI device.
OK, or ERROR if the command fails.
scsiReserveUnit( ) - issue a RESERVE UNIT command to a SCSI device
STATUS scsiReserveUnit ( SCSI_SEQ_DEV * pScsiSeqDev /* ptr to SCSI sequential device */ )
This routine issues a RESERVE UNIT command to a specified SCSI device.
OK, or ERROR if the command fails.
scsiReleaseUnit( ) - issue a RELEASE UNIT command to a SCSI device
STATUS scsiReleaseUnit ( SCSI_SEQ_DEV * pScsiSeqDev /* ptr to SCSI sequential device */ )
This routine issues a RELEASE UNIT command to a specified SCSI device.
OK, or ERROR if the command fails.
scsiLoadUnit( ) - issue a LOAD/UNLOAD command to a SCSI device
STATUS scsiLoadUnit ( SCSI_SEQ_DEV * pScsiSeqDev, /* ptr to SCSI physical device */ BOOL load, /* TRUE=load, FALSE=unload */ BOOL reten, /* TRUE=retention and unload */ BOOL eot /* TRUE=end of tape and unload */ )
This routine issues a LOAD/UNLOAD command to a specified SCSI device.
OK, or ERROR if the command fails.
scsiWrtFileMarks( ) - write file marks to a SCSI sequential device
STATUS scsiWrtFileMarks ( SCSI_SEQ_DEV * pScsiSeqDev, /* ptr to SCSI sequential device info */ int numMarks, /* number of file marks to write */ BOOL shortMark /* TRUE to write short file mark */ )
This routine writes file marks to a specified physical device.
OK, or ERROR if the file mark cannot be written.
scsiSpace( ) - move the tape on a specified physical SCSI device
STATUS scsiSpace ( SCSI_SEQ_DEV * pScsiSeqDev, /* ptr to SCSI sequential device info */ int count, /* count for space command */ int spaceCode /* code for the type of space command */ )
This routine moves the tape on a specified SCSI physical device. There are two types of space code that are mandatory in SCSI; currently these are the only two supported:
Code Description Support 000 Blocks Yes 001 File marks Yes 010 Sequential file marks No 011 End-of-data No 100 Set marks No 101 Sequential set marks No
OK, or ERROR if an error is returned by the device.
S_scsiLib_ILLEGAL_REQUEST
scsiSeqStatusCheck( ) - detect a change in media
STATUS scsiSeqStatusCheck ( SCSI_SEQ_DEV * pScsiSeqDev /* ptr to a sequential dev */ )
This routine issues a TEST_UNIT_READY command to a SCSI device to detect a change in media. It is called by file systems before executing open( ) or creat( ).
OK or ERROR.
scsiSeqIoctl( ) - perform an I/O control function for sequential access devices
int scsiSeqIoctl ( SCSI_SEQ_DEV * pScsiSeqDev, /* ptr to SCSI sequential device */ int function, /* ioctl function code */ int arg /* argument to pass to called function */ )
This routine issues scsiSeqLib commands to perform sequential device-specific I/O control operations.
OK or ERROR.
S_scsiLib_INVALID_BLOCK_SIZE