Data Structures | |
struct | s_scsi_sense |
Sense data. More... | |
struct | sbc_st_std_inquiry_data |
INQUIRY data. More... | |
Functions | |
bool | sbc_inquiry (void) |
Manages the INQUIRY command. More... | |
void | sbc_lun_status_is_busy_or_change (void) |
Sends the status "busy or changed". More... | |
void | sbc_lun_status_is_cdb_field (void) |
Sends the status "FAIL because CDB field is invalid". More... | |
void | sbc_lun_status_is_fail (void) |
Sends the status "FAILED". More... | |
void | sbc_lun_status_is_good (void) |
Sends the status "GOOD". More... | |
void | sbc_lun_status_is_not_present (void) |
Sends the status "LUN not present". More... | |
void | sbc_lun_status_is_protected (void) |
Sends the status "FAILED because of write protection". More... | |
bool | sbc_mode_sense (bool b_sense_10) |
Manages the MODE SENSE (6) and (10) commands. More... | |
bool | sbc_prevent_allow_medium_removal (void) |
Manages the PREVENT ALLOW MEDIUM REMOVAL command. More... | |
bool | sbc_read_10 (void) |
Manages the READ (10) command. More... | |
bool | sbc_read_capacity (void) |
Manages the READ CAPACITY (10) command. More... | |
bool | sbc_request_sense (void) |
Manages the REQUEST SENSE command. More... | |
bool | sbc_test_unit_ready (void) |
Manages the TEST UNIT READY command. More... | |
bool | sbc_write_10 (void) |
Manages the WRITE (10) command. More... | |
bool | scsi_decode_command (void) |
Decodes and launches the execution of SCSI commands. More... | |
Variables | |
uint8_t | g_scsi_command [16] |
SCSI command buffer. More... | |
uint32_t | g_scsi_data_remaining |
Remaining data transfer length. More... | |
uint8_t | g_scsi_ep_ms_in |
USB mass-storage IN endpoint. More... | |
uint8_t | g_scsi_ep_ms_out |
USB mass-storage OUT endpoint. More... | |
s_scsi_sense | g_scsi_sense |
Sense data. More... | |
uint8_t | g_scsi_status |
SCSI status. More... | |
#define CHECK_CONDITION 0x02 |
#define COMMAND_FAILED 0x01 |
#define COMMAND_PASSED 0x00 |
#define SBC_ADDITIONAL_SENSE_LENGTH 0x0A |
Referenced by sbc_request_sense().
#define SBC_ASC_FORMAT_ERROR 0x31 |
#define SBC_ASC_INVALID_COMMAND_OPERATION_CODE 0x20 |
Referenced by scsi_decode_command().
#define SBC_ASC_INVALID_FIELD_IN_CDB 0x24 |
Referenced by sbc_lun_status_is_cdb_field().
#define SBC_ASC_LOGICAL_UNIT_NOT_READY 0x04 |
#define SBC_ASC_MEDIUM_NOT_PRESENT 0x3A |
Referenced by host_ms_request_sense(), and sbc_lun_status_is_not_present().
#define SBC_ASC_NO_ADDITIONAL_SENSE_INFORMATION 0x00 |
Referenced by sbc_lun_status_is_fail(), and sbc_lun_status_is_good().
#define SBC_ASC_NOT_READY_TO_READY_CHANGE 0x28 |
Referenced by host_ms_request_sense(), and sbc_lun_status_is_busy_or_change().
#define SBC_ASC_WRITE_PROTECTED 0x27 |
Referenced by sbc_lun_status_is_protected().
#define SBC_ASCQ_FORMAT_COMMAND_FAILED 0x01 |
#define SBC_ASCQ_INITIALIZING_COMMAND_REQUIRED 0x02 |
#define SBC_ASCQ_OPERATION_IN_PROGRESS 0x07 |
#define SBC_BLOCK_DESCRIPTOR_LENGTH 0x00 |
MODE SENSE BLOCK DESCRIPTOR LENGTH
.
Referenced by sbc_header_mode_sense().
#define Sbc_build_sense | ( | skey, | |
sasc, | |||
sascq | |||
) |
Builds sense data.
skey | SENSE KEY . |
sasc | ADDITIONAL SENSE CODE . |
sascq | ADDITIONAL SENSE CODE QUALIFIER . |
Referenced by sbc_lun_status_is_busy_or_change(), sbc_lun_status_is_cdb_field(), sbc_lun_status_is_fail(), sbc_lun_status_is_good(), sbc_lun_status_is_not_present(), sbc_lun_status_is_protected(), and scsi_decode_command().
#define SBC_CMD_ACCESS_CONTROL_IN 0x86 |
Referenced by scsi_decode_command().
#define SBC_CMD_ACCESS_CONTROL_OUT 0x87 |
Referenced by scsi_decode_command().
#define SBC_CMD_DIR_IN 0x80 |
Referenced by host_ms_inquiry(), host_ms_request_sense(), host_read_10_extram(), host_read_10_ram(), host_read_capacity(), and host_wr_protect().
#define SBC_CMD_DIR_OUT 0x00 |
Referenced by host_test_unit_ready(), and host_write_10_extram().
#define SBC_CMD_EXTENDED_COPY 0x83 |
Referenced by scsi_decode_command().
#define SBC_CMD_FORMAT_UNIT 0x04 |
Referenced by scsi_decode_command().
#define SBC_CMD_INQUIRY 0x12 |
Referenced by host_ms_inquiry(), and scsi_decode_command().
#define SBC_CMD_LOG_SELECT 0x4C |
Referenced by scsi_decode_command().
#define SBC_CMD_LOG_SENSE 0x4D |
Referenced by scsi_decode_command().
#define SBC_CMD_MODE_SELECT_10 0x55 |
Referenced by scsi_decode_command().
#define SBC_CMD_MODE_SELECT_6 0x15 |
Referenced by scsi_decode_command().
#define SBC_CMD_MODE_SENSE_10 0x5A |
Referenced by scsi_decode_command().
#define SBC_CMD_MODE_SENSE_6 0x1A |
Referenced by host_wr_protect(), and scsi_decode_command().
#define SBC_CMD_PERSISTENT_RESERVE_IN 0x5E |
Referenced by scsi_decode_command().
#define SBC_CMD_PERSISTENT_RESERVE_OUT 0x5F |
Referenced by scsi_decode_command().
#define SBC_CMD_PREFETCH_10 0x34 |
Referenced by scsi_decode_command().
#define SBC_CMD_PREFETCH_16 0x90 |
Referenced by scsi_decode_command().
#define SBC_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E |
Referenced by scsi_decode_command().
#define SBC_CMD_READ_10 0x28 |
Referenced by host_read_10_extram(), host_read_10_ram(), and scsi_decode_command().
#define SBC_CMD_READ_12 0xA8 |
Referenced by scsi_decode_command().
#define SBC_CMD_READ_16 0x88 |
Referenced by scsi_decode_command().
#define SBC_CMD_READ_6 0x08 |
Referenced by scsi_decode_command().
#define SBC_CMD_READ_ATTRIBUTE 0x8C |
Referenced by scsi_decode_command().
#define SBC_CMD_READ_BUFFER 0x3C |
Referenced by scsi_decode_command().
#define SBC_CMD_READ_CAPACITY_10 0x25 |
Referenced by host_read_capacity(), and scsi_decode_command().
#define SBC_CMD_READ_DEFECT_DATA_10 0x37 |
Referenced by scsi_decode_command().
#define SBC_CMD_READ_DEFECT_DATA_12 0xB7 |
Referenced by scsi_decode_command().
#define SBC_CMD_READ_LONG_10 0x3E |
Referenced by scsi_decode_command().
#define SBC_CMD_REASSIGN_BLOCKS 0x07 |
Referenced by scsi_decode_command().
#define SBC_CMD_RECEIVE_COPY_RESULTS 0x84 |
Referenced by scsi_decode_command().
#define SBC_CMD_RECEIVE_DIAGNOSTIC_RESULTS 0x1C |
Referenced by scsi_decode_command().
#define SBC_CMD_REPORT_LUNS 0xA0 |
Referenced by scsi_decode_command().
#define SBC_CMD_REQUEST_SENSE 0x03 |
Referenced by host_ms_request_sense(), and scsi_decode_command().
#define SBC_CMD_SEND_DIAGNOSTIC 0x1D |
Referenced by scsi_decode_command().
#define SBC_CMD_START_STOP_UNIT 0x1B |
Referenced by scsi_decode_command().
#define SBC_CMD_SYNCHRONIZE_CACHE_10 0x35 |
Referenced by scsi_decode_command().
#define SBC_CMD_SYNCHRONIZE_CACHE_16 0x91 |
Referenced by scsi_decode_command().
#define SBC_CMD_TEST_UNIT_READY 0x00 |
Referenced by host_test_unit_ready(), and scsi_decode_command().
#define SBC_CMD_VERIFY_10 0x2F |
Referenced by scsi_decode_command().
#define SBC_CMD_VERIFY_12 0xAF |
Referenced by scsi_decode_command().
#define SBC_CMD_VERIFY_16 0x8F |
Referenced by scsi_decode_command().
#define SBC_CMD_WRITE_10 0x2A |
Referenced by host_write_10_extram(), and scsi_decode_command().
#define SBC_CMD_WRITE_12 0xAA |
Referenced by scsi_decode_command().
#define SBC_CMD_WRITE_16 0x8A |
Referenced by scsi_decode_command().
#define SBC_CMD_WRITE_6 0x0A |
Referenced by scsi_decode_command().
#define SBC_CMD_WRITE_AND_VERIFY_10 0x2E |
Referenced by scsi_decode_command().
#define SBC_CMD_WRITE_AND_VERIFY_12 0xAE |
Referenced by scsi_decode_command().
#define SBC_CMD_WRITE_AND_VERIFY_16 0x8E |
Referenced by scsi_decode_command().
#define SBC_CMD_WRITE_ATTRIBUTE 0x8D |
Referenced by scsi_decode_command().
#define SBC_CMD_WRITE_BUFFER 0x3B |
Referenced by scsi_decode_command().
#define SBC_CMD_WRITE_LONG_10 0x3F |
Referenced by scsi_decode_command().
#define SBC_CMD_WRITE_SAME_10 0x41 |
Referenced by scsi_decode_command().
#define SBC_CMD_WRITE_SAME_16 0x93 |
Referenced by scsi_decode_command().
#define SBC_CMD_XDREAD_10 0x52 |
Referenced by scsi_decode_command().
#define SBC_CMD_XDWRITE_10 0x50 |
Referenced by scsi_decode_command().
#define SBC_CMD_XDWRITEREAD_10 0x53 |
Referenced by scsi_decode_command().
#define SBC_CMD_XPWRITE_10 0x51 |
Referenced by scsi_decode_command().
#define SBC_COMMAND_SPECIFIC_INFORMATION_0 0x00 |
Referenced by sbc_request_sense().
#define SBC_COMMAND_SPECIFIC_INFORMATION_1 0x00 |
Referenced by sbc_request_sense().
#define SBC_COMMAND_SPECIFIC_INFORMATION_2 0x00 |
Referenced by sbc_request_sense().
#define SBC_COMMAND_SPECIFIC_INFORMATION_3 0x00 |
Referenced by sbc_request_sense().
#define SBC_DEV_SPEC_PARAM_WR_ENABLE 0x00 |
Referenced by sbc_header_mode_sense().
#define SBC_DEV_SPEC_PARAM_WR_PROTECT 0x80 |
Referenced by sbc_header_mode_sense().
#define SBC_FIELD_REPLACEABLE_UNIT_CODE 0x00 |
Referenced by sbc_request_sense().
#define Sbc_format_mcu_to_scsi_data | ( | width, | |
data | |||
) | ((TPASTE2(U, width))(data)) |
Converts 16-, 32- or 64-bit data from MCU to SCSI endianism.
Depending on MCU endianism, swaps or not data bytes.
width | Data width in bits: 16, 32 or 64. |
data | 16-, 32- or 64-bit data to format. |
Referenced by sbc_read_capacity(), send_informational_exceptions_page(), and send_read_write_error_recovery_page().
#define sbc_format_mcu_to_scsi_data | ( | width, | |
data | |||
) | ((TPASTE2(U, width))(data)) |
Converts 16-, 32- or 64-bit data from MCU to SCSI endianism.
Depending on MCU endianism, swaps or not data bytes.
width | Data width in bits: 16, 32 or 64. |
data | 16-, 32- or 64-bit data to format. |
Referenced by sbc_read_capacity().
#define Sbc_format_scsi_to_mcu_data | ( | width, | |
data | |||
) | ((TPASTE2(U, width))(data)) |
Converts 16-, 32- or 64-bit data from SCSI to MCU endianism.
Depending on MCU endianism, swaps or not data bytes.
width | Data width in bits: 16, 32 or 64. |
data | 16-, 32- or 64-bit data to format. |
#define sbc_format_scsi_to_mcu_data | ( | width, | |
data | |||
) | ((TPASTE2(U, width))(data)) |
Converts 16-, 32- or 64-bit data from SCSI to MCU endianism.
Depending on MCU endianism, swaps or not data bytes.
width | Data width in bits: 16, 32 or 64. |
data | 16-, 32- or 64-bit data to format. |
Referenced by host_read_capacity().
#define SBC_MEDIUM_TYPE 0x00 |
MEDIUM TYPE
for direct-access block devices.
Referenced by sbc_header_mode_sense().
#define SBC_MODE_DATA_LENGTH_CODE_ALL |
Referenced by sbc_mode_sense().
#define SBC_MODE_DATA_LENGTH_INFORMATIONAL_EXCEPTIONS (SBC_PAGE_LENGTH_INFORMATIONAL_EXCEPTIONS + 2 + 3) |
Referenced by sbc_mode_sense().
#define SBC_MODE_DATA_LENGTH_READ_WRITE_ERROR_RECOVERY (SBC_PAGE_LENGTH_READ_WRITE_ERROR_RECOVERY + 2 + 3) |
Referenced by sbc_mode_sense().
#define SBC_MRIE_GENERATE_NO_SENSE 0x05 |
Method of reporting informational exceptions (MRIE
).
Referenced by send_informational_exceptions_page().
#define SBC_MSK_DBD 0x08 |
#define SBC_MSK_PAGE_CODE 0x3F |
Referenced by sbc_mode_sense().
#define SBC_MSK_PAGE_CONTROL 0xC0 |
#define SBC_PAGE_CODE_ALL 0x3F |
Referenced by sbc_mode_sense().
#define SBC_PAGE_CODE_INFORMATIONAL_EXCEPTIONS 0x1C |
Referenced by sbc_mode_sense(), and send_informational_exceptions_page().
#define SBC_PAGE_CODE_READ_WRITE_ERROR_RECOVERY 0x01 |
Referenced by sbc_mode_sense(), and send_read_write_error_recovery_page().
#define SBC_PAGE_LENGTH_INFORMATIONAL_EXCEPTIONS 0x0A |
Referenced by send_informational_exceptions_page().
#define SBC_PAGE_LENGTH_READ_WRITE_ERROR_RECOVERY 0x0A |
Referenced by send_read_write_error_recovery_page().
#define SBC_READ_CAPACITY_LENGTH 0x08 |
READ CAPACITY (10) parameter data length.
Referenced by sbc_read_capacity().
#define SBC_READ_RETRY_COUNT 0x03 |
Referenced by send_read_write_error_recovery_page().
#define SBC_RECOVERY_TIME_LIMIT 0x0000 |
Referenced by send_read_write_error_recovery_page().
#define SBC_RESPONSE_CODE_SENSE 0x70 |
Referenced by sbc_request_sense().
#define Sbc_send_check_condition | ( | ) | (g_scsi_status = CHECK_CONDITION) |
Sets status to CHECK CONDITION.
#define Sbc_send_failed | ( | ) | (g_scsi_status = COMMAND_FAILED ) |
Sets status to FAILED.
Referenced by sbc_lun_status_is_busy_or_change(), sbc_lun_status_is_cdb_field(), sbc_lun_status_is_fail(), sbc_lun_status_is_not_present(), sbc_lun_status_is_protected(), and scsi_decode_command().
#define Sbc_send_good | ( | ) | (g_scsi_status = COMMAND_PASSED ) |
Sets status to GOOD.
Referenced by sbc_lun_status_is_good().
#define SBC_SENSE_KEY_ABORTED_COMMAND 0x0B |
#define SBC_SENSE_KEY_BLANK_CHECK 0x08 |
#define SBC_SENSE_KEY_COPY_ABORTED 0x0A |
#define SBC_SENSE_KEY_DATA_PROTECT 0x07 |
Referenced by host_ms_request_sense(), and sbc_lun_status_is_protected().
#define SBC_SENSE_KEY_HARDWARE_ERROR 0x04 |
Referenced by host_ms_request_sense(), and sbc_lun_status_is_fail().
#define SBC_SENSE_KEY_ILLEGAL_REQUEST 0x05 |
Referenced by sbc_lun_status_is_cdb_field(), and scsi_decode_command().
#define SBC_SENSE_KEY_MEDIUM_ERROR 0x03 |
Referenced by host_ms_request_sense().
#define SBC_SENSE_KEY_MISCOMPARE 0x0E |
#define SBC_SENSE_KEY_NO_SENSE 0x00 |
Referenced by host_ms_request_sense(), and sbc_lun_status_is_good().
#define SBC_SENSE_KEY_NOT_READY 0x02 |
Referenced by host_ms_request_sense(), and sbc_lun_status_is_not_present().
#define SBC_SENSE_KEY_RECOVERED_ERROR 0x01 |
#define SBC_SENSE_KEY_SPECIFIC_0 0x00 |
Referenced by sbc_request_sense().
#define SBC_SENSE_KEY_SPECIFIC_1 0x00 |
Referenced by sbc_request_sense().
#define SBC_SENSE_KEY_SPECIFIC_2 0x00 |
Referenced by sbc_request_sense().
#define SBC_SENSE_KEY_UNIT_ATTENTION 0x06 |
Referenced by host_ms_request_sense(), and sbc_lun_status_is_busy_or_change().
#define SBC_SENSE_KEY_VENDOR_SPECIFIC 0x09 |
#define SBC_SENSE_KEY_VOLUME_OVERFLOW 0x0D |
#define Sbc_valid_write_usb | ( | length | ) |
Sends the USB mass-storage endpoint FIFO and updates g_scsi_data_remaining accordingly.
length | Number of bytes sent. |
Referenced by sbc_inquiry(), sbc_mode_sense(), sbc_read_capacity(), and sbc_request_sense().
#define SBC_WRITE_RETRY_COUNT 0x80 |
Referenced by send_read_write_error_recovery_page().
Manages the INQUIRY command.
The INQUIRY command requests that information regarding the logical unit and SCSI target device be sent to the application client.
References EP_MS_IN, g_scsi_command, g_scsi_ep_ms_in, Is_usb_endpoint_enabled, Is_usb_in_ready, min, NULL, sbc_lun_status_is_cdb_field(), sbc_lun_status_is_good(), Sbc_valid_write_usb, Usb_nb_busy_bank, Usb_reset_endpoint_fifo_access, and usb_write_ep_txpacket().
Referenced by scsi_decode_command().
Sends the status "busy or changed".
References SBC_ASC_NOT_READY_TO_READY_CHANGE, Sbc_build_sense, Sbc_send_failed, and SBC_SENSE_KEY_UNIT_ATTENTION.
Referenced by sbc_read_10(), sbc_read_capacity(), sbc_test_unit_ready(), and sbc_write_10().
Sends the status "FAIL because CDB field is invalid".
References SBC_ASC_INVALID_FIELD_IN_CDB, Sbc_build_sense, Sbc_send_failed, and SBC_SENSE_KEY_ILLEGAL_REQUEST.
Referenced by sbc_inquiry(), sbc_mode_sense(), sbc_read_10(), and sbc_write_10().
Sends the status "FAILED".
References SBC_ASC_NO_ADDITIONAL_SENSE_INFORMATION, Sbc_build_sense, Sbc_send_failed, and SBC_SENSE_KEY_HARDWARE_ERROR.
Referenced by sbc_read_10(), sbc_read_capacity(), sbc_test_unit_ready(), and sbc_write_10().
Sends the status "GOOD".
References SBC_ASC_NO_ADDITIONAL_SENSE_INFORMATION, Sbc_build_sense, Sbc_send_good, and SBC_SENSE_KEY_NO_SENSE.
Referenced by sbc_inquiry(), sbc_mode_sense(), sbc_prevent_allow_medium_removal(), sbc_read_10(), sbc_read_capacity(), sbc_request_sense(), sbc_test_unit_ready(), sbc_write_10(), and scsi_decode_command().
Sends the status "LUN not present".
References SBC_ASC_MEDIUM_NOT_PRESENT, Sbc_build_sense, Sbc_send_failed, and SBC_SENSE_KEY_NOT_READY.
Referenced by sbc_read_10(), sbc_read_capacity(), sbc_test_unit_ready(), and sbc_write_10().
Sends the status "FAILED because of write protection".
References SBC_ASC_WRITE_PROTECTED, Sbc_build_sense, Sbc_send_failed, and SBC_SENSE_KEY_DATA_PROTECT.
Referenced by sbc_write_10().
Manages the MODE SENSE (6) and (10) commands.
The MODE SENSE (6/10) commands provide a means for a device server to report parameters to an application client. They are complementary commands to the MODE SELECT (6/10) commands. Device servers that implement the MODE SENSE (6/10) commands shall also implement the MODE SELECT (6/10) commands.
b_sense_10 | Boolean indicating whether the (10) version of the command is requested:
|
References g_scsi_command, sbc_header_mode_sense(), sbc_lun_status_is_cdb_field(), sbc_lun_status_is_good(), SBC_MODE_DATA_LENGTH_CODE_ALL, SBC_MODE_DATA_LENGTH_INFORMATIONAL_EXCEPTIONS, SBC_MODE_DATA_LENGTH_READ_WRITE_ERROR_RECOVERY, SBC_MSK_PAGE_CODE, SBC_PAGE_CODE_ALL, SBC_PAGE_CODE_INFORMATIONAL_EXCEPTIONS, SBC_PAGE_CODE_READ_WRITE_ERROR_RECOVERY, Sbc_valid_write_usb, send_informational_exceptions_page(), and send_read_write_error_recovery_page().
Referenced by scsi_decode_command().
Manages the PREVENT ALLOW MEDIUM REMOVAL command.
The PREVENT ALLOW MEDIUM REMOVAL command requests that the logical unit enable or disable the removal of the medium. The logical unit shall not allow medium removal if any initiator port currently has medium removal prevented.
References sbc_lun_status_is_good().
Referenced by scsi_decode_command().
Manages the READ (10) command.
The READ (10) command requests that the device server read the specified logical block(s) and transfer them to the data-in buffer. Each logical block read includes user data and, if the medium is formatted with protection information enabled, protection information. Each logical block transferred includes user data and may include protection information, based on the RDPROTECT
field and the medium format. The most recent data value written in the addressed logical block shall be returned.
References CTRL_BUSY, CTRL_FAIL, CTRL_GOOD, CTRL_NO_PRESENT, EP_MS_OUT, g_scsi_command, g_scsi_data_remaining, LSB, memory_2_usb(), ms_endpoint, MSB, MSB0W, MSB1W, MSB2W, MSB3W, sbc_lun_status_is_busy_or_change(), sbc_lun_status_is_cdb_field(), sbc_lun_status_is_fail(), sbc_lun_status_is_good(), sbc_lun_status_is_not_present(), and usb_LUN.
Referenced by scsi_decode_command().
Manages the READ CAPACITY (10) command.
The READ CAPACITY (10) command requests that the device server transfer 8 bytes of parameter data describing the capacity and medium format of the direct-access block device to the data-in buffer. This command may be processed as if it has a HEAD OF QUEUE task attribute. If the logical unit supports protection information, the application client should use the READ CAPACITY (16) command instead of the READ CAPACITY (10) command.
References CTRL_BUSY, CTRL_FAIL, CTRL_GOOD, CTRL_NO_PRESENT, g_scsi_ep_ms_in, mem_read_capacity(), Sbc_format_mcu_to_scsi_data, sbc_format_mcu_to_scsi_data, sbc_lun_status_is_busy_or_change(), sbc_lun_status_is_fail(), sbc_lun_status_is_good(), sbc_lun_status_is_not_present(), SBC_READ_CAPACITY_LENGTH, Sbc_valid_write_usb, usb_LUN, Usb_reset_endpoint_fifo_access, and Usb_write_endpoint_data.
Referenced by scsi_decode_command().
Manages the REQUEST SENSE command.
The REQUEST SENSE command requests that the device server transfer sense data to the application client.
See s_scsi_sense.
References s_scsi_sense::asc, s_scsi_sense::ascq, EP_MS_IN, g_scsi_command, g_scsi_ep_ms_in, s_scsi_sense::key, min, NULL, SBC_ADDITIONAL_SENSE_LENGTH, SBC_COMMAND_SPECIFIC_INFORMATION_0, SBC_COMMAND_SPECIFIC_INFORMATION_1, SBC_COMMAND_SPECIFIC_INFORMATION_2, SBC_COMMAND_SPECIFIC_INFORMATION_3, SBC_FIELD_REPLACEABLE_UNIT_CODE, sbc_lun_status_is_good(), SBC_RESPONSE_CODE_SENSE, SBC_SENSE_KEY_SPECIFIC_0, SBC_SENSE_KEY_SPECIFIC_1, SBC_SENSE_KEY_SPECIFIC_2, Sbc_valid_write_usb, Usb_nb_busy_bank, Usb_reset_endpoint_fifo_access, and usb_write_ep_txpacket().
Referenced by scsi_decode_command().
Manages the TEST UNIT READY command.
The TEST UNIT READY command provides a means to check if the logical unit is ready. This is not a request for a self-test. If the logical unit is able to accept an appropriate medium-access command without returning CHECK CONDITION status, this command shall return a GOOD status. If the logical unit is unable to become operational or is in a state such that an application client action (e.g., START UNIT command) is required to make the logical unit ready, the command shall be terminated with CHECK CONDITION status, with the sense key set to NOT READY.
References CTRL_BUSY, CTRL_FAIL, CTRL_GOOD, CTRL_NO_PRESENT, mem_test_unit_ready(), sbc_lun_status_is_busy_or_change(), sbc_lun_status_is_fail(), sbc_lun_status_is_good(), sbc_lun_status_is_not_present(), and usb_LUN.
Referenced by scsi_decode_command().
Manages the WRITE (10) command.
The WRITE (10) command requests that the device server transfer the specified logical block(s) from the data-out buffer and write them. Each logical block transferred includes user data and may include protection information, based on the WRPROTECT
field and the medium format. Each logical block written includes user data and, if the medium is formatted with protection information enabled, protection information.
References CTRL_BUSY, CTRL_FAIL, CTRL_GOOD, CTRL_NO_PRESENT, EP_MS_IN, g_scsi_command, g_scsi_data_remaining, LSB, mem_wr_protect(), ms_endpoint, MSB, MSB0W, MSB1W, MSB2W, MSB3W, sbc_lun_status_is_busy_or_change(), sbc_lun_status_is_cdb_field(), sbc_lun_status_is_fail(), sbc_lun_status_is_good(), sbc_lun_status_is_not_present(), sbc_lun_status_is_protected(), usb_2_memory(), and usb_LUN.
Referenced by scsi_decode_command().
Decodes and launches the execution of SCSI commands.
References g_scsi_command, SBC_ASC_INVALID_COMMAND_OPERATION_CODE, Sbc_build_sense, SBC_CMD_ACCESS_CONTROL_IN, SBC_CMD_ACCESS_CONTROL_OUT, SBC_CMD_EXTENDED_COPY, SBC_CMD_FORMAT_UNIT, SBC_CMD_INQUIRY, SBC_CMD_LOG_SELECT, SBC_CMD_LOG_SENSE, SBC_CMD_MODE_SELECT_10, SBC_CMD_MODE_SELECT_6, SBC_CMD_MODE_SENSE_10, SBC_CMD_MODE_SENSE_6, SBC_CMD_PERSISTENT_RESERVE_IN, SBC_CMD_PERSISTENT_RESERVE_OUT, SBC_CMD_PREFETCH_10, SBC_CMD_PREFETCH_16, SBC_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL, SBC_CMD_READ_10, SBC_CMD_READ_12, SBC_CMD_READ_16, SBC_CMD_READ_6, SBC_CMD_READ_ATTRIBUTE, SBC_CMD_READ_BUFFER, SBC_CMD_READ_CAPACITY_10, SBC_CMD_READ_DEFECT_DATA_10, SBC_CMD_READ_DEFECT_DATA_12, SBC_CMD_READ_LONG_10, SBC_CMD_REASSIGN_BLOCKS, SBC_CMD_RECEIVE_COPY_RESULTS, SBC_CMD_RECEIVE_DIAGNOSTIC_RESULTS, SBC_CMD_REPORT_LUNS, SBC_CMD_REQUEST_SENSE, SBC_CMD_SEND_DIAGNOSTIC, SBC_CMD_START_STOP_UNIT, SBC_CMD_SYNCHRONIZE_CACHE_10, SBC_CMD_SYNCHRONIZE_CACHE_16, SBC_CMD_TEST_UNIT_READY, SBC_CMD_VERIFY_10, SBC_CMD_VERIFY_12, SBC_CMD_VERIFY_16, SBC_CMD_WRITE_10, SBC_CMD_WRITE_12, SBC_CMD_WRITE_16, SBC_CMD_WRITE_6, SBC_CMD_WRITE_AND_VERIFY_10, SBC_CMD_WRITE_AND_VERIFY_12, SBC_CMD_WRITE_AND_VERIFY_16, SBC_CMD_WRITE_ATTRIBUTE, SBC_CMD_WRITE_BUFFER, SBC_CMD_WRITE_LONG_10, SBC_CMD_WRITE_SAME_10, SBC_CMD_WRITE_SAME_16, SBC_CMD_XDREAD_10, SBC_CMD_XDWRITE_10, SBC_CMD_XDWRITEREAD_10, SBC_CMD_XPWRITE_10, sbc_inquiry(), sbc_lun_status_is_good(), sbc_mode_sense(), sbc_prevent_allow_medium_removal(), sbc_read_10(), sbc_read_capacity(), sbc_request_sense(), Sbc_send_failed, SBC_SENSE_KEY_ILLEGAL_REQUEST, sbc_test_unit_ready(), sbc_write_10(), Scsi_start_read_action, Scsi_start_write_action, Scsi_stop_read_action, and Scsi_stop_write_action.
Referenced by usb_mass_storage_cbw().
uint8_t g_scsi_command[16] |
SCSI command buffer.
Referenced by sbc_inquiry(), sbc_mode_sense(), sbc_read_10(), sbc_request_sense(), sbc_write_10(), scsi_decode_command(), and usb_mass_storage_cbw().
uint32_t g_scsi_data_remaining |
Remaining data transfer length.
Referenced by sbc_read_10(), sbc_write_10(), usb_mass_storage_cbw(), and usb_mass_storage_csw().
uint8_t g_scsi_ep_ms_in |
USB mass-storage IN endpoint.
Referenced by at45dbx_read_multiple_sector_callback(), device_mass_storage_task_init(), sbc_header_mode_sense(), sbc_inquiry(), sbc_read_capacity(), sbc_request_sense(), sd_mmc_spi_read_multiple_sector_callback(), send_informational_exceptions_page(), and send_read_write_error_recovery_page().
uint8_t g_scsi_ep_ms_out |
USB mass-storage OUT endpoint.
Referenced by at45dbx_write_multiple_sector_callback(), device_mass_storage_task_init(), and sd_mmc_spi_write_multiple_sector_callback().
s_scsi_sense g_scsi_sense |
Sense data.
uint8_t g_scsi_status |
SCSI status.
Referenced by usb_mass_storage_csw().