USBD ROM Stack  2.0
ROM based USB device stack
mw_usbd_msc.h
Go to the documentation of this file.
1 /***********************************************************************
2  * $Id:: mw_usbd_msc.h 331 2012-08-09 18:54:34Z usb10131 $
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 "mw_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 /* MSC Request Codes */
51 #define MSC_REQUEST_RESET 0xFF
52 #define MSC_REQUEST_GET_MAX_LUN 0xFE
53 
54 /* MSC Bulk-only Stage */
55 #define MSC_BS_CBW 0 /* Command Block Wrapper */
56 #define MSC_BS_DATA_OUT 1 /* Data Out Phase */
57 #define MSC_BS_DATA_IN 2 /* Data In Phase */
58 #define MSC_BS_DATA_IN_LAST 3 /* Data In Last Phase */
59 #define MSC_BS_DATA_IN_LAST_STALL 4 /* Data In Last Phase with Stall */
60 #define MSC_BS_CSW 5 /* Command Status Wrapper */
61 #define MSC_BS_ERROR 6 /* Error */
62 
63 /* Bulk-only Command Block Wrapper */
64 PRE_PACK struct POST_PACK _MSC_CBW {
65  uint32_t dSignature;
66 
67  uint32_t dTag;
68  uint32_t dDataLength;
69  uint8_t bmFlags;
70  uint8_t bLUN;
71  uint8_t bCBLength;
72  uint8_t CB[16];
73 };
74 typedef struct _MSC_CBW MSC_CBW;
75 
76 /* Bulk-only Command Status Wrapper */
77 PRE_PACK struct POST_PACK _MSC_CSW {
78  uint32_t dSignature;
79 
80  uint32_t dTag;
81  uint32_t dDataResidue;
82  uint8_t bStatus;
83 };
84 typedef struct _MSC_CSW MSC_CSW;
85 
86 #define MSC_CBW_Signature 0x43425355
87 #define MSC_CSW_Signature 0x53425355
88 
89 /* CSW Status Definitions */
90 #define CSW_CMD_PASSED 0x00
91 #define CSW_CMD_FAILED 0x01
92 #define CSW_PHASE_ERROR 0x02
93 
94 /* SCSI Commands */
95 #define SCSI_TEST_UNIT_READY 0x00
96 #define SCSI_REQUEST_SENSE 0x03
97 #define SCSI_FORMAT_UNIT 0x04
98 #define SCSI_INQUIRY 0x12
99 #define SCSI_MODE_SELECT6 0x15
100 #define SCSI_MODE_SENSE6 0x1A
101 #define SCSI_START_STOP_UNIT 0x1B
102 #define SCSI_MEDIA_REMOVAL 0x1E
103 #define SCSI_READ_FORMAT_CAPACITIES 0x23
104 #define SCSI_READ_CAPACITY 0x25
105 #define SCSI_READ10 0x28
106 #define SCSI_WRITE10 0x2A
107 #define SCSI_VERIFY10 0x2F
108 #define SCSI_READ12 0xA8
109 #define SCSI_WRITE12 0xAA
110 #define SCSI_MODE_SELECT10 0x55
111 #define SCSI_MODE_SENSE10 0x5A
112 
113 #endif /* __MSC_H__ */
Definition: mw_usbd_msc.h:77
Definition: mw_usbd_msc.h:64
Common definitions and declarations for the USB stack.