GD32F1x0: USB/GD32_USB_Device_Library/Class/msc/inc/usbd_msc_scsi.h Source File

GD32F1x0

usbd_msc_scsi.h
Go to the documentation of this file.
1 
11 /* Define to prevent recursive inclusion -------------------------------------*/
12 #ifndef __GD32F1X0_USBD_MSC_SCSI_H
13 #define __GD32F1X0_USBD_MSC_SCSI_H
14 
15 /* Includes ------------------------------------------------------------------*/
16 #include "usbd_msc_data.h"
17 #include "usbd_msc_bot.h"
18 
19 /* Exported defines ----------------------------------------------------------*/
20 #define SENSE_LIST_DEEPTH 4
21 
22 /* SCSI Commands */
23 #define SCSI_FORMAT_UNIT 0x04
24 #define SCSI_INQUIRY 0x12
25 #define SCSI_MODE_SELECT6 0x15
26 #define SCSI_MODE_SELECT10 0x55
27 #define SCSI_MODE_SENSE6 0x1A
28 #define SCSI_MODE_SENSE10 0x5A
29 #define SCSI_ALLOW_MEDIUM_REMOVAL 0x1E
30 #define SCSI_READ6 0x08
31 #define SCSI_READ10 0x28
32 #define SCSI_READ12 0xA8
33 #define SCSI_READ16 0x88
34 
35 #define SCSI_READ_CAPACITY10 0x25
36 #define SCSI_READ_CAPACITY16 0x9E
37 
38 #define SCSI_REQUEST_SENSE 0x03
39 #define SCSI_START_STOP_UNIT 0x1B
40 #define SCSI_TEST_UNIT_READY 0x00
41 #define SCSI_WRITE6 0x0A
42 #define SCSI_WRITE10 0x2A
43 #define SCSI_WRITE12 0xAA
44 #define SCSI_WRITE16 0x8A
45 
46 #define SCSI_VERIFY10 0x2F
47 #define SCSI_VERIFY12 0xAF
48 #define SCSI_VERIFY16 0x8F
49 
50 #define SCSI_SEND_DIAGNOSTIC 0x1D
51 #define SCSI_READ_FORMAT_CAPACITIES 0x23
52 
53 #define NO_SENSE 0
54 #define RECOVERED_ERROR 1
55 #define NOT_READY 2
56 #define MEDIUM_ERROR 3
57 #define HARDWARE_ERROR 4
58 #define ILLEGAL_REQUEST 5
59 #define UNIT_ATTENTION 6
60 #define DATA_PROTECT 7
61 #define BLANK_CHECK 8
62 #define VENDOR_SPECIFIC 9
63 #define COPY_ABORTED 10
64 #define ABORTED_COMMAND 11
65 #define VOLUME_OVERFLOW 13
66 #define MISCOMPARE 14
67 
68 
69 #define INVALID_CDB 0x20
70 #define INVALID_FIELED_IN_COMMAND 0x24
71 #define PARAMETER_LIST_LENGTH_ERROR 0x1A
72 #define INVALID_FIELD_IN_PARAMETER_LIST 0x26
73 #define ADDRESS_OUT_OF_RANGE 0x21
74 #define MEDIUM_NOT_PRESENT 0x3A
75 #define MEDIUM_HAVE_CHANGED 0x28
76 #define WRITE_PROTECTED 0x27
77 #define UNRECOVERED_READ_ERROR 0x11
78 #define WRITE_FAULT 0x03
79 
80 #define READ_FORMAT_CAPACITY_DATA_LEN 0x0C
81 #define READ_CAPACITY10_DATA_LEN 0x08
82 #define MODE_SENSE10_DATA_LEN 0x08
83 #define MODE_SENSE6_DATA_LEN 0x04
84 #define REQUEST_SENSE_DATA_LEN 0x12
85 #define STANDARD_INQUIRY_DATA_LEN 0x24
86 #define BLKVFY 0x04
87 
88 /* Exported types ------------------------------------------------------------*/
89 typedef struct _SENSE_ITEM
90 {
91  uint8_t SenseKey;
92  uint32_t Information;
93  uint8_t ASC;
94  uint8_t ASCQ;
96 
97 /* Exported variables --------------------------------------------------------*/
98 extern uint8_t Page00_Inquiry_Data[];
99 extern uint8_t Standard_Inquiry_Data[];
100 extern uint8_t Standard_Inquiry_Data2[];
101 extern uint8_t Mode_Sense6_data[];
102 extern uint8_t Mode_Sense10_data[];
103 extern uint8_t Scsi_Sense_Data[];
104 extern uint8_t ReadCapacity10_Data[];
105 extern uint8_t ReadFormatCapacity_Data[];
106 
107 extern SCSI_Sense_TypeDef SCSI_Sense[SENSE_LIST_DEEPTH];
108 extern uint8_t SCSI_Sense_Head;
109 extern uint8_t SCSI_Sense_Tail;
110 
111 /* Exported functions ------------------------------------------------------- */
112 int8_t SCSI_ProcessCmd (USB_DEVICE_HANDLE *pudev,
113  uint8_t Lun,
114  uint8_t *cmd);
115 
116 void SCSI_SenseCode (uint8_t Lun,
117  uint8_t SKey,
118  uint8_t ASC);
119 
120 int8_t SCSI_ProcessRead (uint8_t Lun);
121 int8_t SCSI_ProcessWrite (uint8_t Lun);
122 
123 #endif /* __GD32F1X0_USBD_MSC_SCSI_H */
124 
125 /************************ (C) COPYRIGHT 2014 GIGADEVICE *****END OF FILE****/
126 
int8_t SCSI_ProcessWrite(uint8_t Lun)
Handle write process.
void SCSI_SenseCode(uint8_t Lun, uint8_t SKey, uint8_t ASC)
Load the last error code in the error list.
int8_t SCSI_ProcessRead(uint8_t Lun)
Handle Read Process.
Header file for the usbd_msc_data.c file.
int8_t SCSI_ProcessCmd(USB_DEVICE_HANDLE *pudev, uint8_t Lun, uint8_t *cmd)
Process SCSI commands.
Definition: usbd_msc_scsi.c:57
Header file for the usbd_msc_bot.c file.
Generated by   doxygen 1.8.10