Prototype: DWORD SendASPI32Command(LPSRB)
Declaration: LPSRB lpSRB;
The SendASPI32Command function with command code SC_RESET_DEV is used to send a SCSI Bus Device reset to the specified target.
Parameter | Description |
lpSRB | Points to the following SCSI request block |
typedef struct { BYTE SRB_Cmd; // ASPI command code = SC_RESET_DEV BYTE SRB_Status; // ASPI command status byte BYTE SRB_HaId; // ASPI host adapter number BYTE SRB_Flags; // Reserved DWORD SRB_Hdr_Rsvd; // Reserved BYTE SRB_Target; // Target's SCSI ID BYTE SRB_Lun; // Target's LUN number BYTE SRB_Rsvd1[12]; // Reserved for Alignment BYTE SRB_HaStat; // Host Adapter Status BYTE SRB_TargStat; // Target Status void *SRB_PostProc; // Post routine void *SRB_Rsvd2; // Reserved BYTE SRB_Rsvd3[32]; // Reserved } SRB_BusDeviceReset, *PSRB_BusDeviceReset;
Table 4-10. Reset SCSI Device Command
Member | Description |
SRB_Cmd | [IN] This field must contain SC_RESET_DEV. |
SRB_Status | [OUT] This field returns one of the following status: |
SS_PENDING | SCSI request is in progress. |
SS_COMP | SCSI/ASPI request has completed without error. |
SS_ABORTED | SCSI command has been aborted. |
SS_ABORT_FAIL | SCSI command abort failed. |
SS_ERR | SCSI command completed with an error. |
SS_INVALID_SRB | One or more parameters in the SCSI Request Block (SRB) are set incorrectly. |
SS_INVALID_PATH_ID | SCSI ID and LUN are invalid. |
SRB_HaId | [IN] This field specifies which installed host adapter the request is intended for. Host adapter numbers are always assigned by the SCSI manager layer beginning with zero. |
SRB_Flags | [IN] Reserved = 0 |
SRB_Hdr_Rsvd | Reserved = 0 |
SRB_Target | [IN] SCSI ID of target device. |
SRB_Lun | [IN] Logical Unit Number (LUN) of device. This field is ignored by ASPI for Win32, since SCSI Bus Device resets are done on a per-target basis only. |
SRB_HaStat | [OUT] Upon completion of the SCSI command, the ASPI manager sets this field with the host adapter status to one of the following values: |
HASTAT_OK | Host adapter did not detect an error. |
HASTAT_TIMEOUT | The time allocated for the operation expired. |
HASTAT_COMMAND_TIMEOUT | SRB expired while waiting to be processed. |
HASTAT_SEL_TO | Selection of target timed out. |
HASTAT_MESSAGE_REJECT | While processing SRB, the adapter received a MESSAGE REJECT. |
HASTAT_BUS_RESET | A bus reset was detected. |
HASTAT_PARITY_ERROR | A parity error was detected. |
HASTAT_REQUEST_SENSE_FAILED | The adapter failed in issuing a request sense after a check condition was reported by the target device. |
HASTAT_DO_DU | Data overrun/underrun. |
HASTAT_BUS_FREE | Unexpected Bus Free. |
HASTAT_PHASE_ERR | Target Bus phase sequence failure. |
SRB_TargStat | [OUT] Upon completion of the SCSI command, the ASPI manager sets this field with the target status as follows: |
STATUS_GOOD | No target status. |
STATUS_CHKCOND | Check status (sense data is in SenseArea). |
STATUS_BUSY | Specified Target/LUN is busy. |
STATUS_RESCONF | Reservation conflict. |
SRB_PostProc | [IN] If posting is enabled, ASPI for Win32 will post completion of an ASPI request to this function pointer. |
Table 4-11. Return Values from Reset SCSI Device Command
Value | Meaning |
SS_PENDING | SCSI request is in progress. |
Example
This example issues a SCSI bus device reset to host adapter #0, target #5.
SRB_BusDeviceReset MySRB; DWORD ASPIStatus; . . MySRB.SRB_Header = SC_RESET_DEV; MySRB.SRB_HaId = 0; MySRB.SRB_Flags = 0; MySRB.SRB_Hdr_Rsvd = 0; MySRB.SRB_Target = 5; MySRB.SRB_Lun = 0; ASPIStatus = SendASPI32Command ( (LPSRB) &MySRB ); . .