MG32F10x Standard Peripherals Firmware Library

USB_Mass_Storage_SRAM/usb_msc_def.h
1 /* Define to prevent recursive inclusion -------------------------------------*/
2 #ifndef __USB_MSC_DEF_H
3 #define __USB_MSC_DEF_H
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 /* Includes ------------------------------------------------------------------*/
10 #include "mg32f10x.h"
11
12 /* Exported types ------------------------------------------------------------*/
13 /* Bulk-only Command Block Wrapper */
14 typedef __PACKED_STRUCT _USB_MSC_CBW
15 {
16 uint32_t dSignature;
17 uint32_t dTag;
18 uint32_t dDataLength;
19 uint8_t bmFlags;
20 uint8_t bLUN;
21 uint8_t bCBLength;
22 uint8_t CB[16];
23 } USB_MSC_CBW;
24
25 /* Bulk-only Command Status Wrapper */
26 typedef __PACKED_STRUCT _USB_MSC_CSW
27 {
28 uint32_t dSignature;
29 uint32_t dTag;
30 uint32_t dDataResidue;
31 uint8_t bStatus;
32 } USB_MSC_CSW;
33
34 /* Exported constants --------------------------------------------------------*/
35
36 /* MSC Subclass Codes */
37 #define MSC_SUBCLASS_SCSI 0x06
38
39 /* MSC Protocol Codes */
40 #define MSC_PROTOCOL_BULK_ONLY 0x50
41
42 /* MSC class-specific request */
43 #define MSC_REQUEST_MASS_STORAGE_RESET 0xFF
44 #define MSC_REQUEST_GET_MAX_LUN 0xFE
45
46
47 #define MSC_CBW_SIGNATURE 0x43425355
48 #define MSC_CSW_SIGNATURE 0x53425355
49
50 /* CSW Status Definitions */
51 #define CSW_CMD_PASSED 0x00
52 #define CSW_CMD_FAILED 0x01
53 #define CSW_PHASE_ERROR 0x02
54
55
56
57 /* SCSI Commands */
58 #define SCSI_TEST_UNIT_READY 0x00
59 #define SCSI_REQUEST_SENSE 0x03
60 #define SCSI_FORMAT_UNIT 0x04
61 #define SCSI_INQUIRY 0x12
62 #define SCSI_MODE_SELECT6 0x15
63 #define SCSI_MODE_SENSE6 0x1A
64 #define SCSI_START_STOP_UNIT 0x1B
65 #define SCSI_SEND_DIAGNOSTIC 0x1D
66 #define SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E
67 #define SCSI_READ_FORMAT_CAPACITIES 0x23
68 #define SCSI_READ_CAPACITY10 0x25
69 #define SCSI_READ_CAPACITY 0x25
70 #define SCSI_READ10 0x28
71 #define SCSI_WRITE10 0x2A
72 #define SCSI_VERIFY10 0x2F
73 #define SCSI_SYNCHRONIZE_CACHE10 0x35
74 #define SCSI_READ12 0xA8
75 #define SCSI_WRITE12 0xAA
76 #define SCSI_MODE_SELECT10 0x55
77 #define SCSI_MODE_SENSE10 0x5A
78 #define SCSI_SYNCHRONIZE_CACHE16 0x91
79 #define SCSI_ATA_COMMAND_PASS_THROUGH12 0xA1
80 #define SCSI_ATA_COMMAND_PASS_THROUGH16 0x85
81 #define SCSI_SERVICE_ACTION_IN12 0xAB
82 #define SCSI_SERVICE_ACTION_IN16 0x9E
83 #define SCSI_SERVICE_ACTION_OUT12 0xA9
84 #define SCSI_SERVICE_ACTION_OUT16 0x9F
85
86
87 #define SCSI_SENSE_KEY_NO_SENSE 0x00
88 #define SCSI_SENSE_KEY_RECOVERED_ERROR 0x01
89 #define SCSI_SENSE_KEY_NOT_READY 0x02
90 #define SCSI_SENSE_KEY_MEDIUM_ERROR 0x03
91 #define SCSI_SENSE_KEY_HARDWARE_ERROR 0x04
92 #define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x05
93 #define SCSI_SENSE_KEY_UNIT_ATTENTION 0x06
94 #define SCSI_SENSE_KEY_DATA_PROTECT 0x07
95 #define SCSI_SENSE_KEY_BLANK_CHECK 0x08
96 #define SCSI_SENSE_KEY_VENDOR_SPECIFIC 0x09
97 #define SCSI_SENSE_KEY_COPY_ABORTED 0x0A
98 #define SCSI_SENSE_KEY_ABORTED_COMMAND 0x0B
99 #define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0x0D
100 #define SCSI_SENSE_KEY_MISCOMPARE 0x0E
101
102 #define SCSI_ASC_NO_ADDITIONAL_SENSE_INFO 0x00
103 #define SCSI_ASC_INVALID_FIELD_IN_CDB 0x24
104
105
106 /* Exported macro ------------------------------------------------------------*/
107 /* Exported functions --------------------------------------------------------*/
108
109 #ifdef __cplusplus
110 }
111 #endif
112
113 #endif /* __USB_MSC_DEF_H */