| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

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