23 #define TIMEOUT_1SEC 1000
24 #define TIMEOUT_2SEC 2000
25 #define DEFAULT_TIMEOUT TIMEOUT_2SEC
32 static int timeoutFactor;
41 static void ResetRecovery(
void);
65 DEBUG_USB_API_PUTS(
"\nMSDBOT_Init(), typedef size error");
101 int timeout, result, direction, retVal;
105 result =
USBH_WriteB(epOut, cbw, CBW_LEN, DEFAULT_TIMEOUT);
107 if (result != CBW_LEN)
120 timeout = DEFAULT_TIMEOUT + (len / timeoutFactor);
123 result =
USBH_ReadB(epIn, data, len, timeout);
137 else if (result <= 0)
145 result =
USBH_ReadB(epIn, csw, CSW_LEN, DEFAULT_TIMEOUT);
147 if (result != CSW_LEN)
156 result =
USBH_ReadB(epIn, csw, CSW_LEN, DEFAULT_TIMEOUT);
158 if (result != CSW_LEN)
171 if (CswValid(pCbw) && CswMeaningful(pCbw))
231 static void ResetRecovery(
void)
int USBH_WriteB(USBH_Ep_TypeDef *ep, void *data, int byteCount, int timeout)
Write data to device endpoint, blocking version.
int USBH_UnStallEpB(USBH_Ep_TypeDef *ep)
Reset stall state on a stalled (halted) endpoint.
#define USB_SETUP_DIR_H2D
uint32_t dCBWDataTransferLength
#define USB_CLASS_MSD_CSW_CMDFAILED
int USBH_ReadB(USBH_Ep_TypeDef *ep, void *data, int byteCount, int timeout)
Read data from device endpoint, blocking version.
#define USB_CLASS_MSD_CSW_CMDPASSED
int USBH_ControlMsgB(USBH_Ep_TypeDef *ep, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint16_t wLength, void *data, int timeout)
Send a SETUP command to a device, blocking version.
struct USBH_Device_TypeDef * parentDevice
#define USB_SETUP_TYPE_CLASS_MASK
Definitions for the Bulk Only Transport protocol of USB Mass Storage devices.
int MSDBOT_Xfer(void *cbw, void *data)
Perform an MSD Bulk Only Transfer (BOT).
USB protocol stack library API for EFM32/EZR32.
#define USB_SETUP_RECIPIENT_INTERFACE
Bulk Only Transport (BOT) Command Block Wrapper (CBW) typedef.
Bulk Only Transport (BOT) Command Status Wrapper (CSW) typedef.
USB HOST endpoint status data.
int MSDBOT_Init(USBH_Ep_TypeDef *out, USBH_Ep_TypeDef *in)
MSDBOT module initialization.
#define STATIC_UBUF(x, y)