VxWorks Reference Manual : Libraries
scsiLib - Small Computer System Interface (SCSI) library
scsiPhysDevDelete( ) - delete a SCSI physical-device structure
scsiPhysDevCreate( ) - create a SCSI physical device structure
scsiPhysDevIdGet( ) - return a pointer to a SCSI_PHYS_DEV structure
scsiAutoConfig( ) - configure all devices connected to a SCSI controller
scsiShow( ) - list the physical devices attached to a SCSI controller
scsiBlkDevCreate( ) - define a logical partition on a SCSI block device
scsiBlkDevInit( ) - initialize fields in a SCSI logical partition
scsiBlkDevShow( ) - show the BLK_DEV structures on a specified physical device
scsiBusReset( ) - pulse the reset signal on the SCSI bus
scsiIoctl( ) - perform a device-specific I/O control function
scsiFormatUnit( ) - issue a FORMAT_UNIT command to a SCSI device
scsiModeSelect( ) - issue a MODE_SELECT command to a SCSI device
scsiModeSense( ) - issue a MODE_SENSE command to a SCSI device
scsiReadCapacity( ) - issue a READ_CAPACITY command to a SCSI device
scsiRdSecs( ) - read sector(s) from a SCSI block device
scsiWrtSecs( ) - write sector(s) to a SCSI block device
scsiTestUnitRdy( ) - issue a TEST_UNIT_READY command to a SCSI device
scsiInquiry( ) - issue an INQUIRY command to a SCSI device
scsiReqSense( ) - issue a REQUEST_SENSE command to a SCSI device and read results
The purpose of this library is to switch SCSI function calls (the common SCSI-1 and SCSI-2 calls listed above) to either scsi1Lib or scsi2Lib, depending upon the SCSI configuration in the Board Support Package (BSP). The normal usage is to configure SCSI-2. However, SCSI-1 is configured when device incompatibilities exist. VxWorks can be configured with either SCSI-1 or SCSI-2, but not both SCSI-1 and SCSI-2 simultaneously.
For more information about SCSI-1 functionality, refer to scsi1Lib. For more information about SCSI-2, refer to scsi2Lib.
scsiLib.h, scsi1Lib.h, scsi2Lib.h
scsiLib, dosFsLib, rt11FsLib, rawFsLib, scsi1Lib, scsi2Lib, VxWorks Programmer's Guide: I/O System, Local File Systems
scsiPhysDevDelete( ) - delete a SCSI physical-device structure
STATUS scsiPhysDevDelete ( SCSI_PHYS_DEV * pScsiPhysDev /* ptr to SCSI physical device info */ )
This routine deletes a specified SCSI physical-device structure.
OK, or ERROR if pScsiPhysDev is NULL or SCSI_BLK_DEVs have been created on the device.
scsiPhysDevCreate( ) - create a SCSI physical device structure
SCSI_PHYS_DEV * scsiPhysDevCreate ( SCSI_CTRL * pScsiCtrl, /* ptr to SCSI controller info */ int devBusId, /* device's SCSI bus ID */ int devLUN, /* device's logical unit number */ int reqSenseLength, /* length of REQUEST SENSE data dev returns */ int devType, /* type of SCSI device */ BOOL removable, /* whether medium is removable */ int numBlocks, /* number of blocks on device */ int blockSize /* size of a block in bytes */ )
This routine enables access to a SCSI device and must be the first routine invoked. It must be called once for each physical device on the SCSI bus.
If reqSenseLength is NULL (0), one or more REQUEST_SENSE commands are issued to the device to determine the number of bytes of sense data it typically returns. Note that if the device returns variable amounts of sense data depending on its state, you must consult the device manual to determine the maximum amount of sense data that can be returned.
If devType is NONE (-1), an INQUIRY command is issued to determine the device type; as an added benefit, it acquires the device's make and model number. The scsiShow( ) routine displays this information. Common values of devType can be found in scsiLib.h or in the SCSI specification.
If numBlocks or blockSize are specified as NULL (0), a READ_CAPACITY command is issued to determine those values. This occurs only for device types that support READ_CAPACITY.
A pointer to the created SCSI_PHYS_DEV structure, or NULL if the routine is unable to create the physical-device structure.
scsiPhysDevIdGet( ) - return a pointer to a SCSI_PHYS_DEV structure
SCSI_PHYS_DEV * scsiPhysDevIdGet ( SCSI_CTRL * pScsiCtrl, /* ptr to SCSI controller info */ int devBusId, /* device's SCSI bus ID */ int devLUN /* device's logical unit number */ )
This routine returns a pointer to the SCSI_PHYS_DEV structure of the SCSI physical device located at a specified bus ID (devBusId) and logical unit number (devLUN) and attached to a specified SCSI controller (pScsiCtrl).
A pointer to the specified SCSI_PHYS_DEV structure, or NULL if the structure does not exist.
scsiAutoConfig( ) - configure all devices connected to a SCSI controller
STATUS scsiAutoConfig ( SCSI_CTRL * pScsiCtrl /* ptr to SCSI controller info */ )
This routine cycles through all valid SCSI bus IDs and logical unit numbers (LUNs), attempting a scsiPhysDevCreate( ) with default parameters on each. All devices which support the INQUIRY command are configured. The scsiShow( ) routine can be used to find the system table of SCSI physical devices attached to a specified SCSI controller. In addition, scsiPhysDevIdGet( ) can be used programmatically to get a pointer to the SCSI_PHYS_DEV structure associated with the device at a specified SCSI bus ID and LUN.
OK, or ERROR if pScsiCtrl and the global variable pSysScsiCtrl are both NULL.
scsiShow( ) - list the physical devices attached to a SCSI controller
STATUS scsiShow ( SCSI_CTRL * pScsiCtrl /* ptr to SCSI controller info */ )
This routine displays the SCSI bus ID, logical unit number (LUN), vendor ID, product ID, firmware revision (rev.), device type, number of blocks, block size in bytes, and a pointer to the associated SCSI_PHYS_DEV structure for each physical SCSI device known to be attached to a specified SCSI controller.
If pScsiCtrl is NULL, the value of the global variable pSysScsiCtrl is used, unless it is also NULL.
OK, or ERROR if both pScsiCtrl and pSysScsiCtrl are NULL.
scsiBlkDevCreate( ) - define a logical partition on a SCSI block device
BLK_DEV * scsiBlkDevCreate ( SCSI_PHYS_DEV * pScsiPhysDev,/* ptr to SCSI physical device info */ int numBlocks, /* number of blocks in block device */ int blockOffset /* address of first block in volume */ )
This routine creates and initializes a BLK_DEV structure, which describes a logical partition on a SCSI physical-block device. A logical partition is an array of contiguously addressed blocks; it can be completely described by the number of blocks and the address of the first block in the partition. In normal configurations partitions do not overlap, although such a condition is not an error.
If numBlocks is 0, the rest of device is used.
A pointer to the created BLK_DEV, or NULL if parameters exceed physical device boundaries, if the physical device is not a block device, or if memory is insufficient for the structures.
scsiBlkDevInit( ) - initialize fields in a SCSI logical partition
void scsiBlkDevInit ( SCSI_BLK_DEV * pScsiBlkDev, /* ptr */ /* to */ /* SCSI */ /* block */ /* dev. */ /* struct */ int blksPerTrack,/* blocks per track */ int nHeads /* number of heads */ )
This routine specifies the disk-geometry parameters required by certain file systems (for example, dosFs). It is called after a SCSI_BLK_DEV structure is created with scsiBlkDevCreate( ), but before calling a file system initialization routine. It is generally required only for removable-media devices.
N/A
scsiBlkDevShow( ) - show the BLK_DEV structures on a specified physical device
void scsiBlkDevShow ( SCSI_PHYS_DEV * pScsiPhysDev /* ptr to SCSI physical device info */ )
This routine displays all of the BLK_DEV structures created on a specified physical device. This routine is called by scsiShow( ) but may also be invoked directly, usually from the shell.
N/A
scsiBusReset( ) - pulse the reset signal on the SCSI bus
STATUS scsiBusReset ( SCSI_CTRL * pScsiCtrl /* ptr to SCSI controller info */ )
This routine calls a controller-specific routine to reset a specified controller's SCSI bus. If no controller is specified (pScsiCtrl is 0), the value in the global variable pSysScsiCtrl is used.
OK, or ERROR if there is no controller or controller-specific routine.
scsiIoctl( ) - perform a device-specific I/O control function
STATUS scsiIoctl ( SCSI_PHYS_DEV * pScsiPhysDev,/* ptr to SCSI block device info */ int function, /* function code */ int arg /* argument to pass called function */ )
This routine performs a specified ioctl function using a specified SCSI block device.
The status of the request, or ERROR if the request is unsupported.
scsiFormatUnit( ) - issue a FORMAT_UNIT command to a SCSI device
STATUS scsiFormatUnit ( SCSI_PHYS_DEV * pScsiPhysDev, /* ptr to SCSI physical device */ BOOL cmpDefectList, /* whether defect list is complete */ int defListFormat, /* defect list format */ int vendorUnique, /* vendor unique byte */ int interleave, /* interleave factor */ char * buffer, /* ptr to input data buffer */ int bufLength /* length of buffer in bytes */ )
This routine issues a FORMAT_UNIT command to a specified SCSI device.
OK, or ERROR if the command fails.
scsiModeSelect( ) - issue a MODE_SELECT command to a SCSI device
STATUS scsiModeSelect ( 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.
scsiModeSense( ) - issue a MODE_SENSE command to a SCSI device
STATUS scsiModeSense ( 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 device.
OK, or ERROR if the command fails.
scsiReadCapacity( ) - issue a READ_CAPACITY command to a SCSI device
STATUS scsiReadCapacity ( SCSI_PHYS_DEV * pScsiPhysDev, /* ptr to SCSI physical device */ int * pLastLBA, /* where to return last logical block */ int * pBlkLength /* where to return block length */ )
This routine issues a READ_CAPACITY command to a specified SCSI device.
OK, or ERROR if the command fails.
scsiRdSecs( ) - read sector(s) from a SCSI block device
STATUS scsiRdSecs ( SCSI_BLK_DEV * pScsiBlkDev, /* ptr to SCSI block device info */ int sector, /* sector number to be read */ int numSecs, /* total sectors to be read */ char * buffer /* ptr to input data buffer */ )
This routine reads the specified physical sector(s) from a specified physical device.
OK, or ERROR if the sector(s) cannot be read.
scsiWrtSecs( ) - write sector(s) to a SCSI block device
STATUS scsiWrtSecs ( SCSI_BLK_DEV * pScsiBlkDev, /* ptr to SCSI block device info */ int sector, /* sector number to be written */ int numSecs, /* total sectors to be written */ char * buffer /* ptr to input data buffer */ )
This routine writes the specified physical sector(s) to a specified physical device.
OK, or ERROR if the sector(s) cannot be written.
scsiTestUnitRdy( ) - issue a TEST_UNIT_READY command to a SCSI device
STATUS scsiTestUnitRdy ( SCSI_PHYS_DEV * pScsiPhysDev /* ptr to SCSI physical device */ )
This routine issues a TEST_UNIT_READY command to a specified SCSI device.
OK, or ERROR if the command fails.
scsiInquiry( ) - issue an INQUIRY command to a SCSI device
STATUS scsiInquiry ( SCSI_PHYS_DEV * pScsiPhysDev, /* ptr to SCSI physical device */ char * buffer, /* ptr to input data buffer */ int bufLength /* length of buffer in bytes */ )
This routine issues an INQUIRY command to a specified SCSI device.
OK, or ERROR if the command fails.
scsiReqSense( ) - issue a REQUEST_SENSE command to a SCSI device and read results
STATUS scsiReqSense ( SCSI_PHYS_DEV * pScsiPhysDev, /* ptr to SCSI physical device */ char * buffer, /* ptr to input data buffer */ int bufLength /* length of buffer in bytes */ )
This routine issues a REQUEST_SENSE command to a specified SCSI device and reads the results.
OK, or ERROR if the command fails.