mirror of
https://github.com/Fishwaldo/bl_mcu_sdk.git
synced 2025-07-10 06:48:51 +00:00
[refactor][usb_stack] refactor scsi driver,add sense code for requestsense cmd
This commit is contained in:
parent
3ce09ee61b
commit
b51bfd7b14
3 changed files with 722 additions and 561 deletions
File diff suppressed because it is too large
Load diff
|
@ -43,25 +43,6 @@ extern "C" {
|
||||||
#define CSW_STATUS_CMD_FAILED 0x01
|
#define CSW_STATUS_CMD_FAILED 0x01
|
||||||
#define CSW_STATUS_PHASE_ERROR 0x02
|
#define CSW_STATUS_PHASE_ERROR 0x02
|
||||||
|
|
||||||
/** MSC Bulk-Only Command Block Wrapper (CBW) */
|
|
||||||
struct CBW {
|
|
||||||
uint32_t Signature;
|
|
||||||
uint32_t Tag;
|
|
||||||
uint32_t DataLength;
|
|
||||||
uint8_t Flags;
|
|
||||||
uint8_t LUN;
|
|
||||||
uint8_t CBLength;
|
|
||||||
uint8_t CB[16];
|
|
||||||
} __packed;
|
|
||||||
|
|
||||||
/** MSC Bulk-Only Command Status Wrapper (CSW) */
|
|
||||||
struct CSW {
|
|
||||||
uint32_t Signature;
|
|
||||||
uint32_t Tag;
|
|
||||||
uint32_t DataResidue;
|
|
||||||
uint8_t Status;
|
|
||||||
} __packed;
|
|
||||||
|
|
||||||
/*Length of template descriptor: 23 bytes*/
|
/*Length of template descriptor: 23 bytes*/
|
||||||
#define MSC_DESCRIPTOR_LEN (9 + 7 + 7)
|
#define MSC_DESCRIPTOR_LEN (9 + 7 + 7)
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
#define SCSI_MODE_SENSE6 0x1A
|
#define SCSI_MODE_SENSE6 0x1A
|
||||||
#define SCSI_START_STOP_UNIT 0x1B
|
#define SCSI_START_STOP_UNIT 0x1B
|
||||||
#define SCSI_SEND_DIAGNOSTIC 0x1D
|
#define SCSI_SEND_DIAGNOSTIC 0x1D
|
||||||
#define SCSI_MEDIA_REMOVAL 0x1E
|
#define SCSI_PREVENT_ALLOW_MEDIA_REMOVAL 0x1E
|
||||||
#define SCSI_READ_FORMAT_CAPACITIES 0x23
|
#define SCSI_READ_FORMAT_CAPACITIES 0x23
|
||||||
#define SCSI_READ_CAPACITY 0x25
|
#define SCSI_READ_CAPACITY10 0x25
|
||||||
#define SCSI_READ10 0x28
|
#define SCSI_READ10 0x28
|
||||||
#define SCSI_WRITE10 0x2A
|
#define SCSI_WRITE10 0x2A
|
||||||
#define SCSI_VERIFY10 0x2F
|
#define SCSI_VERIFY10 0x2F
|
||||||
|
@ -62,6 +62,29 @@
|
||||||
#define SCSI_SENSE_VOLUME_OVERFLOW 0x0d
|
#define SCSI_SENSE_VOLUME_OVERFLOW 0x0d
|
||||||
#define SCSI_SENSE_MISCOMPARE 0x0e
|
#define SCSI_SENSE_MISCOMPARE 0x0e
|
||||||
|
|
||||||
|
/* Additional Sense Code */
|
||||||
|
#define SCSI_ASC_INVALID_CDB 0x20U
|
||||||
|
#define SCSI_ASC_INVALID_FIELED_IN_COMMAND 0x24U
|
||||||
|
#define SCSI_ASC_PARAMETER_LIST_LENGTH_ERROR 0x1AU
|
||||||
|
#define SCSI_ASC_INVALID_FIELD_IN_PARAMETER_LIST 0x26U
|
||||||
|
#define SCSI_ASC_ADDRESS_OUT_OF_RANGE 0x21U
|
||||||
|
#define SCSI_ASC_MEDIUM_NOT_PRESENT 0x3AU
|
||||||
|
#define SCSI_ASC_MEDIUM_HAVE_CHANGED 0x28U
|
||||||
|
#define SCSI_ASC_WRITE_PROTECTED 0x27U
|
||||||
|
#define SCSI_ASC_UNRECOVERED_READ_ERROR 0x11U
|
||||||
|
#define SCSI_ASC_WRITE_FAULT 0x03U
|
||||||
|
|
||||||
|
#define READ_FORMAT_CAPACITY_DATA_LEN 0x0CU
|
||||||
|
#define READ_CAPACITY10_DATA_LEN 0x08U
|
||||||
|
#define REQUEST_SENSE_DATA_LEN 0x12U
|
||||||
|
#define STANDARD_INQUIRY_DATA_LEN 0x24U
|
||||||
|
#define MODE_SENSE6_DATA_LEN 0x17U
|
||||||
|
#define MODE_SENSE10_DATA_LEN 0x1BU
|
||||||
|
|
||||||
|
#define SCSI_MEDIUM_STATUS_UNLOCKED 0x00U
|
||||||
|
#define SCSI_MEDIUM_STATUS_LOCKED 0x01U
|
||||||
|
#define SCSI_MEDIUM_STATUS_EJECTED 0x02U
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// SCSI Primary Command (SPC-4)
|
// SCSI Primary Command (SPC-4)
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue