Next | Prev | Up | Top | Contents | Index
SCSI Function-Building Routines - Group 1
The next five routines, doscsireq(), filldsreq(), fillg0cmd(), fillg1cmd(), vtostr() are utility routines used to construct your own SCSI functions. If the provided SCSI routines are sufficient, you will not need these routines.
doscsireq - Send a Command to the SCSI Device
The doscsireq() routine is used to send a command to the SCSI device or to make some other request of the SCSI bus. All data structures must have been set up before you can use this routine.
Synopsis
doscsireq(int fd, struct dsreq *dsp);
Arguments
- fd
- Expects the file descriptor for the special file opened by dsopen(). This file descriptor is stored in the context type structure pointed to by the ds_private member of the dsreq type structure allocated by the call to dsopen(). Use the getfd(dsp) macro to get fd.
- dsp
- A pointer to the dsreq type structure that you allocated for the SCSI device through a call to dsopen(). You control the behavior of doscsireq() by how you set the bits of the value stored in the ds_flags member of the dsreq type structure pointed to by this parameter. For more information, see the description given in "dsreq - User-level Driver Communication Structure."
filldsreq - set Members of a dsreq Type Structure
The filldsreq() routine is used to set the ds_flags, ds_databuf, and ds_datalen members of a dsreq type structure.
Synopsis
filldsreq(struct dsreq *dsp, uchar_t data,
long datalen, long flags)
Arguments
- dsp
- A pointer to the dsreq type structure that you allocated for the SCSI device through a call to dsopen(). The following parameters are then used to set the values of some of the members of this structure.
- data
- A pointer to the start of a data buffer. The value of this parameter is written to the ds_databuf member of the dsreq type structure pointed to by the dsp parameter.
- datalen
- The length of the data pointed to by the data parameter. The value of this parameter is written to the ds_datalen member of the dsreq type structure pointed to by the dsp parameter.
- flags
- The value to which you want to set the ds_flags member of the dsreq type structure pointed to by the dsp parameter. See the description of the ds_flags member given in "dsreq - User-level Driver Communication Structure."
fillg0cmd - Set Up the dsreq Structure
The fillg0cmd() routine is used to set up the dsreq structure to send a group 0 (6-byte) SCSI command to the SCSI device. To actually send the command, you must call the routine doscsireq().
Synopsis
fillg0cmd(struct dsreq *dsp, uchar_t *cmdbuf, b0, ..., b5)
Arguments
- dsp
- A pointer to the dsreq type structure that you allocated for the SCSI device through a call to dsopen(). The following parameters are then used to set the values of some of the members of this structure.
- cmdbuf
- A pointer to a SCSI command. The value of this parameter (the pointer) is written to the ds_cmdbuf member of the dsreq type structure pointed to by the dsp parameter.
- b0, b1, b2, b3, b4, b5
-
The values of the individual bytes of the group 0 SCSI command to be written to the string pointed to by cmdbuf.
fillg1cmd - Send a Group 1 SCSI Command
The fillg1cmd() routine is used to set up the dsreq structure to send a group 1 (10-byte) SCSI command to the SCSI device. To actually send the command, you must call the routine doscsireq().
Synopsis
fillg1cmd(struct dsreq *dsp, uchar_t *cmdbuf, b0, ..., b9)
Arguments
- dsp
- A pointer to the dsreq type structure that you allocated for the SCSI device through a call to dsopen(). The following parameters are then used to set the values of some of the members of this structure.
- cmdbuf
- A pointer to a SCSI command. The value of this parameter (the pointer) is written to the ds_cmdbuf member of the dsreq type structure pointed to by the dsp parameter.
- b0, b1, b2, b3, b4, b5, b6, b7, b8, b9
-
The values of the individual bytes of the ten-byte group 1 SCSI command that you want to write to the string pointed to by cmdbuf.
vtostr - Return a Pointer to a String Describing Table Entry
The vtostr() routine is used to look up a value in a table and return a pointer to a string describing the table entry for that value. It is normally used to print debugging information, such as when the global variable dsdebug is set to a nonzero value.
Synopsis
vtostr(long value, struct vtab *table);
Arguments
- value
- Expects the value you want to look up in the table named by the table parameter.
- table
- A pointer to the name of the table in which you want to look up the value specified as the value parameter. You have a choice of four tables are provided with the library:
dsrqnametab - describes the DSRQ_* flags.
dsrtnametab - describes the DSRT_* flags.
cmdstatustab - describes the values returned in the ds_status member of the dsreq type structure.
cmdnametab - describes the values used for the SCSI commands.
Note: The tables are provided in source form in the same directory as dslib.c in the dstab.c file.
Next | Prev | Up | Top | Contents | Index