15 static uint8_t USBD_MSC_Init (
void *pudev, uint8_t cfgidx);
16 static uint8_t USBD_MSC_DeInit (
void *pudev, uint8_t cfgidx);
17 static uint8_t USBD_MSC_GetClassDescriptor (
void *pudev,
USB_DEVICE_REQ *req);
18 static uint8_t USBD_MSC_ClassReqHandle (
void *pudev,
USB_DEVICE_REQ *req);
19 static uint8_t USBD_MSC_GetInterface (
void *pudev,
USB_DEVICE_REQ *req);
20 static uint8_t USBD_MSC_SetInterface (
void *pudev,
USB_DEVICE_REQ *req);
21 static uint8_t USBD_MSC_DataIn (
void *pudev, uint8_t EpID);
22 static uint8_t USBD_MSC_DataOut (
void *pudev, uint8_t EpID);
23 static uint8_t *USBD_MSC_GetCfgDesc (uint8_t USBSpeed, uint16_t *len);
24 static uint8_t USBD_MSC_ClearFeature (
void *pudev,
USB_DEVICE_REQ *req);
30 USBD_MSC_GetClassDescriptor,
31 USBD_MSC_ClassReqHandle,
32 USBD_MSC_GetInterface,
33 USBD_MSC_SetInterface,
44 const uint8_t USBD_MSC_CfgDesc[USB_MSC_CONFIG_DESC_SIZE] =
47 USB_DESCTYPE_CONFIGURATION,
48 USB_MSC_CONFIG_DESC_SIZE,
58 USB_DESCTYPE_INTERFACE,
69 USB_DESCTYPE_ENDPOINT,
72 LOWBYTE(MSC_DATA_PACKET_SIZE),
73 HIGHBYTE(MSC_DATA_PACKET_SIZE),
77 USB_DESCTYPE_ENDPOINT,
80 LOWBYTE(MSC_DATA_PACKET_SIZE),
81 HIGHBYTE(MSC_DATA_PACKET_SIZE),
85 static uint8_t USBD_MSC_MaxLun = 0;
86 static uint8_t USBD_MSC_AltSet = 0;
95 static uint8_t USBD_MSC_Init (
void *pudev, uint8_t cfgidx)
97 #ifdef DOUBLE_BUFFER_TX
103 #ifdef DOUBLE_BUFFER_RX
133 static uint8_t USBD_MSC_DeInit (
void *pudev, uint8_t cfgidx)
151 static uint8_t USBD_MSC_ClassReqHandle (
void *pudev,
USB_DEVICE_REQ *req)
153 switch (req->bRequest)
155 case BBB_GET_MAX_LUN :
156 if((req->wValue == 0) &&
157 (req->wLength == 1) &&
158 ((req->bmRequestType & 0x80) == 0x80))
160 USBD_MSC_MaxLun = USBD_STORAGE_fops->GetMaxLun();
161 if(USBD_MSC_MaxLun > 0)
179 if((req->wValue == 0) &&
180 (req->wLength == 0) &&
181 ((req->bmRequestType & 0x80) != 0x80))
206 static uint8_t USBD_MSC_GetClassDescriptor (
void *pudev,
USB_DEVICE_REQ *req)
217 static uint8_t USBD_MSC_GetInterface (
void *pudev,
USB_DEVICE_REQ *req)
219 USB_CtlTx (pudev, (uint8_t *)&USBD_MSC_AltSet, 1);
230 static uint8_t USBD_MSC_SetInterface (
void *pudev,
USB_DEVICE_REQ *req)
232 USBD_MSC_AltSet = (uint8_t)(req->wValue);
243 static uint8_t USBD_MSC_ClearFeature (
void *pudev,
USB_DEVICE_REQ *req)
256 static uint8_t USBD_MSC_DataIn (
void *pudev, uint8_t EpID)
269 static uint8_t USBD_MSC_DataOut (
void *pudev, uint8_t EpID)
282 static uint8_t *USBD_MSC_GetCfgDesc (uint8_t speed, uint16_t *len)
284 *len =
sizeof (USBD_MSC_CfgDesc);
286 return (uint8_t *)USBD_MSC_CfgDesc;
USB device class callback type define.
void MSC_BBB_DataOut(USB_DEVICE_HANDLE *pudev, uint8_t EpID)
Handle BBB OUT data stage.
Header file for the usbd_msc_core.c file.
void MSC_BBB_DataIn(USB_DEVICE_HANDLE *pudev, uint8_t EpID)
Handle BBB IN data stage.
void MSC_BBB_CplClrFeature(USB_DEVICE_HANDLE *pudev, uint8_t EpID)
Complete the clear feature request.
void USB_EP_DeInit(USB_CORE_HANDLE *pudev, uint8_t EpAddr)
Configure the endpoint when it is disabled.
void USB_EP_Init(USB_CORE_HANDLE *pudev, uint8_t EpAddr, uint8_t EpType, uint16_t EpMps)
Endpoint initialization.
void MSC_BBB_Init(USB_DEVICE_HANDLE *pudev)
Initialize the BBB process.
uint8_t USB_CtlTx(USB_CORE_HANDLE *pudev, uint8_t *pbuf, uint16_t Len)
Transmit data on the control pipe.
void MSC_BBB_DeInit(USB_DEVICE_HANDLE *pudev)
De-Initialize the BBB Machine.
void MSC_BBB_Reset(USB_DEVICE_HANDLE *pudev)
Reset the BBB machine.
#define USB_SNG_BUFTYPE
USB endpoint kind.
void USB_EP_BufConfig(USB_CORE_HANDLE *pudev, uint8_t EpAddr, uint8_t EpKind, uint32_t BufAddr)
Configure buffer for endpoint.
void USBD_EnumError(USB_DEVICE_HANDLE *pudev, USB_DEVICE_REQ *req)
Handle usb enumeration error event.
USB standard device request struct.