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