VxWorks Reference Manual : Libraries

scsiLib

NAME

scsiLib - Small Computer System Interface (SCSI) library

ROUTINES

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

DESCRIPTION

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.

INCLUDE FILES

scsiLib.h, scsi1Lib.h, scsi2Lib.h

SEE ALSO

scsiLib, dosFsLib, rt11FsLib, rawFsLib, scsi1Lib, scsi2Lib, VxWorks Programmer's Guide: I/O System, Local File Systems


Libraries : Routines

scsiPhysDevDelete( )

NAME

scsiPhysDevDelete( ) - delete a SCSI physical-device structure

SYNOPSIS

STATUS scsiPhysDevDelete
    (
    SCSI_PHYS_DEV * pScsiPhysDev /* ptr to SCSI physical device info */
    )

DESCRIPTION

This routine deletes a specified SCSI physical-device structure.

RETURNS

OK, or ERROR if pScsiPhysDev is NULL or SCSI_BLK_DEVs have been created on the device.

SEE ALSO

scsiLib


Libraries : Routines

scsiPhysDevCreate( )

NAME

scsiPhysDevCreate( ) - create a SCSI physical device structure

SYNOPSIS

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 */
    )

DESCRIPTION

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.

RETURNS

A pointer to the created SCSI_PHYS_DEV structure, or NULL if the routine is unable to create the physical-device structure.

SEE ALSO

scsiLib


Libraries : Routines

scsiPhysDevIdGet( )

NAME

scsiPhysDevIdGet( ) - return a pointer to a SCSI_PHYS_DEV structure

SYNOPSIS

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 */
    )

DESCRIPTION

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).

RETURNS

A pointer to the specified SCSI_PHYS_DEV structure, or NULL if the structure does not exist.

SEE ALSO

scsiLib


Libraries : Routines

scsiAutoConfig( )

NAME

scsiAutoConfig( ) - configure all devices connected to a SCSI controller

SYNOPSIS

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

DESCRIPTION

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.

RETURNS

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

SEE ALSO

scsiLib


Libraries : Routines

scsiShow( )

NAME

scsiShow( ) - list the physical devices attached to a SCSI controller

SYNOPSIS

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

DESCRIPTION

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.

NOTE

If pScsiCtrl is NULL, the value of the global variable pSysScsiCtrl is used, unless it is also NULL.

RETURNS

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

SEE ALSO

scsiLib


Libraries : Routines

scsiBlkDevCreate( )

NAME

scsiBlkDevCreate( ) - define a logical partition on a SCSI block device

SYNOPSIS

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 */
    )

DESCRIPTION

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.

NOTE

If numBlocks is 0, the rest of device is used.

RETURNS

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.

SEE ALSO

scsiLib


Libraries : Routines

scsiBlkDevInit( )

NAME

scsiBlkDevInit( ) - initialize fields in a SCSI logical partition

SYNOPSIS

void scsiBlkDevInit
    (
    SCSI_BLK_DEV *                                                        pScsiBlkDev, /* ptr */
                                                                                       /* to */
                                                                                       /* SCSI */
                                                                                       /* block */
                                                                                       /* dev. */
                                                                                       /* struct */
    int blksPerTrack,/* blocks per track */ int nHeads /* number of heads */
    )

DESCRIPTION

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.

RETURNS

N/A

SEE ALSO

scsiLib


Libraries : Routines

scsiBlkDevShow( )

NAME

scsiBlkDevShow( ) - show the BLK_DEV structures on a specified physical device

SYNOPSIS

void scsiBlkDevShow
    (
    SCSI_PHYS_DEV * pScsiPhysDev /* ptr to SCSI physical device info */
    )

DESCRIPTION

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.

RETURNS

N/A

SEE ALSO

scsiLib, scsiShow( )


Libraries : Routines

scsiBusReset( )

NAME

scsiBusReset( ) - pulse the reset signal on the SCSI bus

SYNOPSIS

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

DESCRIPTION

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.

RETURNS

OK, or ERROR if there is no controller or controller-specific routine.

SEE ALSO

scsiLib


Libraries : Routines

scsiIoctl( )

NAME

scsiIoctl( ) - perform a device-specific I/O control function

SYNOPSIS

STATUS scsiIoctl
    (
    SCSI_PHYS_DEV * pScsiPhysDev,/* ptr to SCSI block device info */ int function, /* function code */ int arg /* argument to pass called function */
    )

DESCRIPTION

This routine performs a specified ioctl function using a specified SCSI block device.

RETURNS

The status of the request, or ERROR if the request is unsupported.

SEE ALSO

scsiLib


Libraries : Routines

scsiFormatUnit( )

NAME

scsiFormatUnit( ) - issue a FORMAT_UNIT command to a SCSI device

SYNOPSIS

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 */
    )

DESCRIPTION

This routine issues a FORMAT_UNIT command to a specified SCSI device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiLib


Libraries : Routines

scsiModeSelect( )

NAME

scsiModeSelect( ) - issue a MODE_SELECT command to a SCSI device

SYNOPSIS

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 */
    )

DESCRIPTION

This routine issues a MODE_SELECT command to a specified SCSI device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiLib


Libraries : Routines

scsiModeSense( )

NAME

scsiModeSense( ) - issue a MODE_SENSE command to a SCSI device

SYNOPSIS

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 */
    )

DESCRIPTION

This routine issues a MODE_SENSE command to a specified SCSI device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiLib


Libraries : Routines

scsiReadCapacity( )

NAME

scsiReadCapacity( ) - issue a READ_CAPACITY command to a SCSI device

SYNOPSIS

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 */
    )

DESCRIPTION

This routine issues a READ_CAPACITY command to a specified SCSI device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiLib


Libraries : Routines

scsiRdSecs( )

NAME

scsiRdSecs( ) - read sector(s) from a SCSI block device

SYNOPSIS

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 */
    )

DESCRIPTION

This routine reads the specified physical sector(s) from a specified physical device.

RETURNS

OK, or ERROR if the sector(s) cannot be read.

SEE ALSO

scsiLib


Libraries : Routines

scsiWrtSecs( )

NAME

scsiWrtSecs( ) - write sector(s) to a SCSI block device

SYNOPSIS

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 */
    )

DESCRIPTION

This routine writes the specified physical sector(s) to a specified physical device.

RETURNS

OK, or ERROR if the sector(s) cannot be written.

SEE ALSO

scsiLib


Libraries : Routines

scsiTestUnitRdy( )

NAME

scsiTestUnitRdy( ) - issue a TEST_UNIT_READY command to a SCSI device

SYNOPSIS

STATUS scsiTestUnitRdy
    (
    SCSI_PHYS_DEV * pScsiPhysDev /* ptr to SCSI physical device */
    )

DESCRIPTION

This routine issues a TEST_UNIT_READY command to a specified SCSI device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiLib


Libraries : Routines

scsiInquiry( )

NAME

scsiInquiry( ) - issue an INQUIRY command to a SCSI device

SYNOPSIS

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 */
    )

DESCRIPTION

This routine issues an INQUIRY command to a specified SCSI device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiLib


Libraries : Routines

scsiReqSense( )

NAME

scsiReqSense( ) - issue a REQUEST_SENSE command to a SCSI device and read results

SYNOPSIS

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 */
    )

DESCRIPTION

This routine issues a REQUEST_SENSE command to a specified SCSI device and reads the results.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiLib