]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/LPCOpen/LPCUSBLib/Drivers/USB/Core/DCD/USBRom/usbd_msc.h
Update LPC18xx FreeRTOS+UDP demo to use LPCOpen USB and Ethernet drivers.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / LPCOpen / LPCUSBLib / Drivers / USB / Core / DCD / USBRom / usbd_msc.h
1 /*\r
2  * @brief Definition of USB ROM based MSC class descriptors and their bit defines\r
3  *\r
4  * @note\r
5  * Copyright(C) NXP Semiconductors, 2012\r
6   * All rights reserved.\r
7  *\r
8  * @par\r
9  * Software that is described herein is for illustrative purposes only\r
10  * which provides customers with programming information regarding the\r
11  * LPC products.  This software is supplied "AS IS" without any warranties of\r
12  * any kind, and NXP Semiconductors and its licensor disclaim any and\r
13  * all warranties, express or implied, including all implied warranties of\r
14  * merchantability, fitness for a particular purpose and non-infringement of\r
15  * intellectual property rights.  NXP Semiconductors assumes no responsibility\r
16  * or liability for the use of the software, conveys no license or rights under any\r
17  * patent, copyright, mask work right, or any other intellectual property rights in\r
18  * or to any products. NXP Semiconductors reserves the right to make changes\r
19  * in the software without notification. NXP Semiconductors also makes no\r
20  * representation or warranty that such application will be suitable for the\r
21  * specified use without further testing or modification.\r
22  *\r
23  * @par\r
24  * Permission to use, copy, modify, and distribute this software and its\r
25  * documentation is hereby granted, under NXP Semiconductors' and its\r
26  * licensor's relevant copyrights in the software, without fee, provided that it\r
27  * is used in conjunction with NXP Semiconductors microcontrollers.  This\r
28  * copyright, permission, and disclaimer notice must appear in all copies of\r
29  * this code.\r
30  */\r
31 \r
32 #ifndef __MSC_H__\r
33 #define __MSC_H__\r
34 \r
35 #include "usbd.h"\r
36 \r
37  /*\r
38  *  Definition of MSC class descriptors and their bit defines.\r
39  *\r
40  */\r
41 /* MSC Subclass Codes */\r
42 #define MSC_SUBCLASS_RBC                0x01\r
43 #define MSC_SUBCLASS_SFF8020I_MMC2      0x02\r
44 #define MSC_SUBCLASS_QIC157             0x03\r
45 #define MSC_SUBCLASS_UFI                0x04\r
46 #define MSC_SUBCLASS_SFF8070I           0x05\r
47 #define MSC_SUBCLASS_SCSI               0x06\r
48 \r
49 /* MSC Protocol Codes */\r
50 #define MSC_PROTOCOL_CBI_INT            0x00\r
51 #define MSC_PROTOCOL_CBI_NOINT          0x01\r
52 #define MSC_PROTOCOL_BULK_ONLY          0x50\r
53 \r
54 \r
55 /* MSC Request Codes */\r
56 #define MSC_REQUEST_RESET               0xFF\r
57 #define MSC_REQUEST_GET_MAX_LUN         0xFE\r
58 \r
59 \r
60 /* MSC Bulk-only Stage */\r
61 #define MSC_BS_CBW                      0       /* Command Block Wrapper */\r
62 #define MSC_BS_DATA_OUT                 1       /* Data Out Phase */\r
63 #define MSC_BS_DATA_IN                  2       /* Data In Phase */\r
64 #define MSC_BS_DATA_IN_LAST             3       /* Data In Last Phase */\r
65 #define MSC_BS_DATA_IN_LAST_STALL       4       /* Data In Last Phase with Stall */\r
66 #define MSC_BS_CSW                      5       /* Command Status Wrapper */\r
67 #define MSC_BS_ERROR                    6       /* Error */\r
68 \r
69 \r
70 /* Bulk-only Command Block Wrapper */\r
71 PRE_PACK struct POST_PACK _MSC_CBW\r
72 {\r
73   uint32_t dSignature;\r
74   uint32_t dTag;\r
75   uint32_t dDataLength;\r
76   uint8_t  bmFlags;\r
77   uint8_t  bLUN;\r
78   uint8_t  bCBLength;\r
79   uint8_t  CB[16];\r
80 } ;\r
81 typedef struct _MSC_CBW MSC_CBW;\r
82 \r
83 /* Bulk-only Command Status Wrapper */\r
84 PRE_PACK struct POST_PACK _MSC_CSW\r
85 {\r
86   uint32_t dSignature;\r
87   uint32_t dTag;\r
88   uint32_t dDataResidue;\r
89   uint8_t  bStatus;\r
90 } ;\r
91 typedef struct _MSC_CSW MSC_CSW;\r
92 \r
93 #define MSC_CBW_Signature               0x43425355\r
94 #define MSC_CSW_Signature               0x53425355\r
95 \r
96 \r
97 /* CSW Status Definitions */\r
98 #define CSW_CMD_PASSED                  0x00\r
99 #define CSW_CMD_FAILED                  0x01\r
100 #define CSW_PHASE_ERROR                 0x02\r
101 \r
102 \r
103 /* SCSI Commands */\r
104 #define SCSI_TEST_UNIT_READY            0x00\r
105 #define SCSI_REQUEST_SENSE              0x03\r
106 #define SCSI_FORMAT_UNIT                0x04\r
107 #define SCSI_INQUIRY                    0x12\r
108 #define SCSI_MODE_SELECT6               0x15\r
109 #define SCSI_MODE_SENSE6                0x1A\r
110 #define SCSI_START_STOP_UNIT            0x1B\r
111 #define SCSI_MEDIA_REMOVAL              0x1E\r
112 #define SCSI_READ_FORMAT_CAPACITIES     0x23\r
113 #define SCSI_READ_CAPACITY              0x25\r
114 #define SCSI_READ10                     0x28\r
115 #define SCSI_WRITE10                    0x2A\r
116 #define SCSI_VERIFY10                   0x2F\r
117 #define SCSI_READ12                     0xA8\r
118 #define SCSI_WRITE12                    0xAA\r
119 #define SCSI_MODE_SELECT10              0x55\r
120 #define SCSI_MODE_SENSE10               0x5A\r
121 \r
122 uint32_t CALLBACK_UsbdMsc_Register_InquiryData(void);\r
123 uint32_t CALLBACK_UsbdMsc_Register_BlockCount(void);\r
124 uint32_t CALLBACK_UsbdMsc_Register_BlockSize(void);\r
125 uint32_t CALLBACK_UsbdMsc_Register_MemorySize(void);\r
126 uint32_t CALLBACK_UsbdMsc_Register_InterfaceDescriptor(void);\r
127 uint32_t CALLBACK_UsbdMsc_Register_MSCWrite(void);\r
128 uint32_t CALLBACK_UsbdMsc_Register_MSCRead(void);\r
129 uint32_t CALLBACK_UsbdMsc_Register_MSCVerify(void);\r
130 uint32_t CALLBACK_UsbdMsc_Register_MSCGetWriteBuf(void);\r
131 \r
132 #endif  /* __MSC_H__ */\r