msdbot.h
Go to the documentation of this file.00001
00018 #ifndef __MSDBOT_H
00019 #define __MSDBOT_H
00020
00021
00026
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034
00037 #define CBW_LEN 31
00038 #define CSW_LEN 13
00039
00040 #define BOT_DIR_IN 0x80
00041 #define BOT_DIR_OUT 0x00
00042
00043 #define CSW_SIGNATURE 0x53425355
00044 #define CBW_SIGNATURE 0x43425355
00045
00048
00051 EFM32_PACK_START(1)
00052 typedef struct
00053 {
00054 uint32_t dCBWSignature;
00055 uint32_t dCBWTag;
00056 uint32_t dCBWDataTransferLength;
00057 union
00058 {
00059 struct
00060 {
00061 uint8_t Reserved1 : 6;
00062 uint8_t Obsolete : 1;
00063 uint8_t Direction : 1;
00064 };
00065 uint8_t bmCBWFlags;
00066 };
00067 union
00068 {
00069 struct
00070 {
00071 uint8_t Lun : 4;
00072 uint8_t Reserved2 : 4;
00073 };
00074 uint8_t bCBWLUN;
00075 };
00076 union
00077 {
00078 struct
00079 {
00080 uint8_t CBLength : 5;
00081 uint8_t Reserved3 : 3;
00082 };
00083 uint8_t bCBWCBLength;
00084 };
00085 uint8_t CBWCB[ 16 ];
00086 } __attribute__ ((packed)) MSDBOT_CBW_TypeDef;
00087 EFM32_PACK_END()
00088
00089
00092 EFM32_PACK_START(1)
00093 typedef struct
00094 {
00095 uint32_t dCSWSignature;
00096 uint32_t dCSWTag;
00097 uint32_t dCSWDataResidue;
00098 uint8_t bCSWStatus;
00099 } __attribute__ ((packed)) MSDBOT_CSW_TypeDef;
00100 EFM32_PACK_END()
00101
00103 typedef enum
00104 {
00105 MSDBOT_STATUS_OK = 0,
00106 MSDBOT_INIT_ERROR = -1,
00107 MSDBOT_CMD_FAILED = -2,
00108 MSDBOT_XFER_ERROR = -3,
00109 } MSDBOT_Status_TypeDef;
00110
00111
00112
00113 #if defined(USB_HOST)
00114
00115 int MSDBOT_Init(USBH_Ep_TypeDef *out, USBH_Ep_TypeDef *in);
00116 int MSDBOT_Xfer(void* cbw, void* data);
00117
00118 #endif
00119
00120 #ifdef __cplusplus
00121 }
00122 #endif
00123
00127 #endif