]> git.sur5r.net Git - armstart-ibdap/blob - inc/usbd/usbd_msc.h
initial commit
[armstart-ibdap] / inc / usbd / usbd_msc.h
1 /***********************************************************************\r
2 * $Id:: mw_usbd_msc.h 331 2012-08-09 18:54:34Z usb10131                       $\r
3 *\r
4 * Project: USB device ROM Stack\r
5 *\r
6 * Description:\r
7 *     Mass Storage Class definitions.\r
8 *\r
9 ***********************************************************************\r
10 *   Copyright(C) 2011, NXP Semiconductor\r
11 *   All rights reserved.\r
12 *\r
13 * Software that is described herein is for illustrative purposes only\r
14 * which provides customers with programming information regarding the\r
15 * products. This software is supplied "AS IS" without any warranties.\r
16 * NXP Semiconductors assumes no responsibility or liability for the\r
17 * use of the software, conveys no license or title under any patent,\r
18 * copyright, or mask work right to the product. NXP Semiconductors\r
19 * reserves the right to make changes in the software without\r
20 * notification. NXP Semiconductors also make no representation or\r
21 * warranty that such application will be suitable for the specified\r
22 * use without further testing or modification.\r
23 **********************************************************************/\r
24 \r
25 #ifndef __MSC_H__\r
26 #define __MSC_H__\r
27 \r
28 #include "usbd.h"\r
29 \r
30 /** \file\r
31  *  \brief Mass Storage class (MSC) descriptors.\r
32  *\r
33  *  Definition of MSC class descriptors and their bit defines.\r
34  *\r
35  */\r
36 \r
37 /* MSC Subclass Codes */\r
38 #define MSC_SUBCLASS_RBC                0x01\r
39 #define MSC_SUBCLASS_SFF8020I_MMC2      0x02\r
40 #define MSC_SUBCLASS_QIC157             0x03\r
41 #define MSC_SUBCLASS_UFI                0x04\r
42 #define MSC_SUBCLASS_SFF8070I           0x05\r
43 #define MSC_SUBCLASS_SCSI               0x06\r
44 \r
45 /* MSC Protocol Codes */\r
46 #define MSC_PROTOCOL_CBI_INT            0x00\r
47 #define MSC_PROTOCOL_CBI_NOINT          0x01\r
48 #define MSC_PROTOCOL_BULK_ONLY          0x50\r
49 \r
50 \r
51 /* MSC Request Codes */\r
52 #define MSC_REQUEST_RESET               0xFF\r
53 #define MSC_REQUEST_GET_MAX_LUN         0xFE\r
54 \r
55 \r
56 /* MSC Bulk-only Stage */\r
57 #define MSC_BS_CBW                      0       /* Command Block Wrapper */\r
58 #define MSC_BS_DATA_OUT                 1       /* Data Out Phase */\r
59 #define MSC_BS_DATA_IN                  2       /* Data In Phase */\r
60 #define MSC_BS_DATA_IN_LAST             3       /* Data In Last Phase */\r
61 #define MSC_BS_DATA_IN_LAST_STALL       4       /* Data In Last Phase with Stall */\r
62 #define MSC_BS_CSW                      5       /* Command Status Wrapper */\r
63 #define MSC_BS_ERROR                    6       /* Error */\r
64 \r
65 \r
66 /* Bulk-only Command Block Wrapper */\r
67 PRE_PACK struct POST_PACK _MSC_CBW\r
68 {\r
69   uint32_t dSignature;\r
70   uint32_t dTag;\r
71   uint32_t dDataLength;\r
72   uint8_t  bmFlags;\r
73   uint8_t  bLUN;\r
74   uint8_t  bCBLength;\r
75   uint8_t  CB[16];\r
76 } ;\r
77 typedef struct _MSC_CBW MSC_CBW;\r
78 \r
79 /* Bulk-only Command Status Wrapper */\r
80 PRE_PACK struct POST_PACK _MSC_CSW\r
81 {\r
82   uint32_t dSignature;\r
83   uint32_t dTag;\r
84   uint32_t dDataResidue;\r
85   uint8_t  bStatus;\r
86 } ;\r
87 typedef struct _MSC_CSW MSC_CSW;\r
88 \r
89 #define MSC_CBW_Signature               0x43425355\r
90 #define MSC_CSW_Signature               0x53425355\r
91 \r
92 \r
93 /* CSW Status Definitions */\r
94 #define CSW_CMD_PASSED                  0x00\r
95 #define CSW_CMD_FAILED                  0x01\r
96 #define CSW_PHASE_ERROR                 0x02\r
97 \r
98 \r
99 /* SCSI Commands */\r
100 #define SCSI_TEST_UNIT_READY            0x00\r
101 #define SCSI_REQUEST_SENSE              0x03\r
102 #define SCSI_FORMAT_UNIT                0x04\r
103 #define SCSI_INQUIRY                    0x12\r
104 #define SCSI_MODE_SELECT6               0x15\r
105 #define SCSI_MODE_SENSE6                0x1A\r
106 #define SCSI_START_STOP_UNIT            0x1B\r
107 #define SCSI_MEDIA_REMOVAL              0x1E\r
108 #define SCSI_READ_FORMAT_CAPACITIES     0x23\r
109 #define SCSI_READ_CAPACITY              0x25\r
110 #define SCSI_READ10                     0x28\r
111 #define SCSI_WRITE10                    0x2A\r
112 #define SCSI_VERIFY10                   0x2F\r
113 #define SCSI_READ12                     0xA8\r
114 #define SCSI_WRITE12                    0xAA\r
115 #define SCSI_MODE_SELECT10              0x55\r
116 #define SCSI_MODE_SENSE10               0x5A\r
117 \r
118 \r
119 #endif  /* __MSC_H__ */\r