EZR32 Wonder Gecko Software Documentation  ezr32wg-doc-5.1.2
msdbot.h
Go to the documentation of this file.
1 /***************************************************************************/
18 #ifndef __MSDBOT_H
19 #define __MSDBOT_H
20 
21 /***************************************************************************/
26 /***************************************************************************/
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
37 #define CBW_LEN 31
38 #define CSW_LEN 13
39 
40 #define BOT_DIR_IN 0x80 /* bmCBWFlags value for bulk IN cmds. */
41 #define BOT_DIR_OUT 0x00 /* bmCBWFlags value for bulk OUT cmds. */
42 
43 #define CSW_SIGNATURE 0x53425355 /* Ascii USBS */
44 #define CBW_SIGNATURE 0x43425355 /* Ascii USBC */
45 
48 /**************************************************************************/
52 typedef struct
53 {
54  uint32_t dCBWSignature;
55  uint32_t dCBWTag;
57  union
58  {
59  struct
60  {
61  uint8_t Reserved1 : 6;
62  uint8_t Obsolete : 1;
63  uint8_t Direction : 1;
64  };
65  uint8_t bmCBWFlags;
66  };
67  union
68  {
69  struct
70  {
71  uint8_t Lun : 4;
72  uint8_t Reserved2 : 4;
73  };
74  uint8_t bCBWLUN;
75  };
76  union
77  {
78  struct
79  {
80  uint8_t CBLength : 5;
81  uint8_t Reserved3 : 3;
82  };
83  uint8_t bCBWCBLength;
84  };
85  uint8_t CBWCB[ 16 ];
88 
89 /**************************************************************************/
93 typedef struct
94 {
95  uint32_t dCSWSignature;
96  uint32_t dCSWTag;
97  uint32_t dCSWDataResidue;
98  uint8_t bCSWStatus;
100 SL_PACK_END()
101 
102 
103 typedef enum
104 {
110 
111 /*** MSDBOT Function prototypes ***/
112 
113 #if defined(USB_HOST)
114 
116 int MSDBOT_Xfer(void* cbw, void* data);
117 
118 #endif
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
127 #endif /* __MSDBOT_H */
uint8_t bmCBWFlags
Definition: msdbot.h:65
MSDBOT_Status_TypeDef
MSDBOT status enumerator.
Definition: msdbot.h:103
#define SL_PACK_END()
Macro for handling packed structs. Use this macro after the struct definition. With GCC...
Definition: em_common.h:157
uint32_t dCBWTag
Definition: msdbot.h:55
uint32_t dCBWDataTransferLength
Definition: msdbot.h:56
#define SL_PACK_START(x)
Macro for handling packed structs. Use this macro before the struct definition. X denotes the max...
Definition: em_common.h:150
uint32_t dCBWSignature
Definition: msdbot.h:54
uint32_t dCSWDataResidue
Definition: msdbot.h:97
int MSDBOT_Xfer(void *cbw, void *data)
Perform an MSD Bulk Only Transfer (BOT).
Definition: msdbot.c:98
uint8_t bCBWCBLength
Definition: msdbot.h:83
Bulk Only Transport (BOT) Command Block Wrapper (CBW) typedef.
Definition: msdbot.h:52
#define SL_ATTRIBUTE_PACKED
GCC style macro for handling packed structs.
Definition: em_common.h:143
Bulk Only Transport (BOT) Command Status Wrapper (CSW) typedef.
Definition: msdbot.h:93
uint32_t dCSWSignature
Definition: msdbot.h:95
USB HOST endpoint status data.
Definition: em_usb.h:861
uint8_t bCSWStatus
Definition: msdbot.h:98
int MSDBOT_Init(USBH_Ep_TypeDef *out, USBH_Ep_TypeDef *in)
MSDBOT module initialization.
Definition: msdbot.c:58
uint32_t dCSWTag
Definition: msdbot.h:96