Next | Prev | Up | Top | Contents | Index
SCSI Function-Building Routines - Group 2
The next ten routines implement the most frequently used SCSI commands, other than read. There are so many variations on read that a generic version of these commands would be too clumsy, so you will have to write your own. Read and write extended are more standard, and so are provided.
inquiry12 - Issue an Inquiry Command
The inquiry12() routine is used to issue an inquiry command to a SCSI device and retrieve information from the device concerning such things as its type. Much of this is device-specific information. See vendor your documentation for more details.
Synopsis
inquiry12(struct dsreq *dsp, caddr_t data,
long datalen, char vu)
Arguments
- dsp
- A pointer to the dsreq type structure that you allocated for the SCSI device through a call to dsopen().
- data
- A pointer to a buffer. Upon successful completion, this command writes the inquiry information to the buffer pointed to by this parameter. Internally, 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 size of the buffer pointed to by the data parameter. Internally, the value of this parameter is written to the ds_datalen member of the dsreq type structure pointed to by the dsp parameter. Typically, the length must be at least 36 bytes, although 64 bytes is a more normal value for datalen.
- vu
- Not implemented.
modeselect15 - Issue a Group 0 "Mode Select" Command
The modeselect15() routine is used to issue a group 0 "mode select" command to a SCSI device. This is similar in concept to the UNIX ioctl() system call. It is used to control a large number of standard and vendor-specific device parameters. Typically, modesense1A() is used first to retrieve the current parameters; the page number(s) of interest and the length are passed in the first few bytes of the data.
Synopsis
modeselect15(struct dsreq *dsp, caddr_t data,
long datalen, int save, char vu)
Arguments
- dsp
- A pointer to the dsreq type structure that you allocated for the SCSI device through a call to dsopen().
- data
- A pointer to the buffer containing the mode select data.
- datalen
- The length of the buffer in data.
- save
- A value that indicates whether you want the device to save the "page" information. The possible values are:
0 = do not save saveable pages.
1 = save saveable pages.
- vu
- Not implemented.
modesense1a - Send a Group 0 "Mode Sense" Command
The modesense1a() routine is used to send a group 0 "mode sense" command to a SCSI device to retrieve the page information from the device.
Synopsis
modesense1a(struct dsreq *dsp, caddr_t data, long datalen,
char pgctrl, char pgcode, char vu)
Arguments
- dsp
- A pointer to the dsreq type structure that you allocated for the SCSI device through a call to dsopen().
- data
- A pointer to a buffer. Upon successful completion, this command writes the "page" information to the buffer pointed to by this parameter.
- datalen
- The size of the buffer pointed to by the data parameter.
- pgctrl
- Expects one of four values that indicate what sort of information you want to retrieve from the page:
0 = current values
1 = changeable values
2 = default values
3 = saved values
- pgcode
- Expects the value that indicates the "page" you want to see. There can be up to 0x3F pages. To return all pages, use 0x3F as the value of this parameter. The information on these pages varies from vendor to vendor. For more information, see the vendor-supplied documentation for the device.
- vu
- Not implemented.
readcapacity25 - Issue a Read Capacity Command
The readcapacity25() routine is used to issue a read capacity command to a SCSI device.
Synopsis
readcapacity25(struct dsreq *dsp, caddr_t data,
long datalen, long lba, char pmi, char vu)
Arguments
- dsp
- A pointer to the dsreq type structure that you allocated for the SCSI device through a call to dsopen().
- data
- A pointer to a buffer. Upon successful completion, this command writes the capacity information to the buffer pointed to by this parameter.
- datalen
- The size of the buffer pointed to by the data parameter.
- lba
- Unused if pmi is 0. Otherwise, it expects the logical block value of the track for which you want capacity information.
- pmi
- The value that tells the routine whether you want the capacity for the entire unit or for the current track (as specified by the logical block named in the lba parameter). When you ask for track information, the logical block returned (in the buffer pointed to by data) is the most distant logical block you can access without undue delay. The valid values for this parameter are:
0 = return last logical block in unit.
1 = return last logical block in track.
- vu
- Not implemented.
readextended28 - Issue a Read Extended Command
The readextended28() routine is used to issue a read extended command to a SCSI device. This command has enough variations that it is quite possible you will need a custom version of it for your device. Do not preempt the function name.
Synopsis
readextended28(struct dsreq *dsp, caddr_t data,
long datalen, long lba, char vu)
Arguments
- dsp
- A pointer to the dsreq type structure that you allocated for the SCSI device through a call to dsopen().
- data
- A pointer to a buffer. Upon successful completion, this command writes information from the device to the buffer pointed to by this parameter.
- datalen
- A value that specifies the size of the buffer pointed to by the data parameter.
- lba
- Expects the logical block from which you want to read.
- vu
- Not implemented.
requestsense03 - Issue a Request Sense Command
The requestsense03() routine is used to issue a request sense command to a SCSI device and test or "probe" for the device. If you set DSRQ_SENSE in the doscsireq flag argument, as the included library routines do, you don't need to use this routine.
Synopsis
requestsense03(struct dsreq *dsp, caddr_t data,
long datalen, char vu)
Arguments
- dsp
- A pointer to the dsreq type structure that you allocated for the SCSI device through a call to dsopen().
- data
- A pointer to a buffer. Upon successful completion, this command writes the "sense" information to the buffer pointed to by this parameter.
- datalen
- A value that specifies the size of the buffer pointed to by the data parameter.
- vu
- Not implemented.
senddiagnostic1d - Issue a Send Diagnostic Command
The senddiagnostic1d() routine is used to issue a send diagnostic command to a SCSI device and test whether the device is functioning correctly. Upon completion of a self-test run by the device, the ds_status member of this dsreq type structure usually describes the results. (See the description given for this member in "dsreq - User-level Driver Communication Structure.") If you request that a self-test hold the results, you must issue a read diagnostic command to get the results. The dslib does not contain a routine to issue a read diagnostic, but you can use fillg0cmd() to create one.
Synopsis
senddiagnostic1d(struct dsreq *dsp, caddr_t data, long dlen,
long self, long dofl, long uofl, chap vu)
Arguments
- dsp
- A pointer to the dsreq type structure that you allocated for the SCSI device through a call to dsopen().
- data
- Not used.
- datalen
- Not used.
- self
- A value that indicates whether you want the device to run a self test that holds the results or a self test that reports the results in ds_status. This parameter has two valid values:
0 = run a self test, hold the results
1 = run a self test, report through ds_status
- dofl
- A value that indicates whether or not you want to test if the SCSI bus is online or offline:
0 = test if bus is on-line
1 = test if bus is off-line
- uofl
- A value that indicates whether or not you want to test if the device is on-line or off-line:
0 = test if device is on-line
1 = test if device is off-line
- vu
- Not implemented.
testunitready00 - Issue a Test Unit Ready Command to a SCSI Device
The testunitready00() routine is used to issue a test unit ready command to a SCSI device.
Synopsis
testunitready00(struct dsreq *dsp);
Arguments
- dsp
- A pointer to the dsreq type structure that you allocate for the SCSI device through a call to dsopen().
Upon completion of the test, the ds_status member of this dsreq type structure describes the results. See the description given for this member in "dsreq - User-level Driver Communication Structure".
write0a - Issue a Group 0 Write Command
The write0a() routine is used to issue a group 0 write command to a SCSI device. As with readextended(), this routine tends to be device-specific, so it is quite possible you will need to make your own custom version.
Synopsis
write0a(struct dsreq *dsp, caddr_t data, long datalen,
long lba, char vu)
Arguments
- dsp
- A pointer to the dsreq type structure that you allocated for the SCSI device through a call to dsopen().
- data
- A pointer to the buffer you want to write to the device.
- datalen
- A value that specifies the size of the buffer pointed to by the data parameter.
- lba
- Expects the logical block to which you want to write. (For some devices, this may actually be a byte value.)
- vu
- Not implemented.
writeextended2a - Issue a Write Extended Command
The writeextended2a() routine is used to issue a write extended command to a SCSI device. As with readextended(), this routine tends to be device-specific, so it is quite possible you will need to make your own custom version.
Synopsis
writeextended2a(struct dsreq *dsp, caddr_t data,
long datalen, long lba, char vu)
Arguments
- dsp
- A pointer to the dsreq type structure that you allocated for the SCSI device through a call to dsopen().
- data
- A pointer to the buffer you want to write to the device.
- datalen
- A value that specifies the size of the buffer pointed to by the data parameter.
- lba
- The logical block to which you want to write.
- vu
- Not implemented.
Next | Prev | Up | Top | Contents | Index