33 static uint8_t USBD_MSC_Init (
void *pudev, uint8_t cfgidx);
34 static uint8_t USBD_MSC_DeInit (
void *pudev, uint8_t cfgidx);
35 static uint8_t USBD_MSC_GetClassDescriptor (
void *pudev,
USB_DEVICE_REQ *req);
36 static uint8_t USBD_MSC_ClassReqHandle (
void *pudev,
USB_DEVICE_REQ *req);
37 static uint8_t USBD_MSC_GetInterface (
void *pudev,
USB_DEVICE_REQ *req);
38 static uint8_t USBD_MSC_SetInterface (
void *pudev,
USB_DEVICE_REQ *req);
39 static uint8_t USBD_MSC_DataIn (
void *pudev, uint8_t EpID);
40 static uint8_t USBD_MSC_DataOut (
void *pudev, uint8_t EpID);
41 static uint8_t *USBD_MSC_GetCfgDesc (uint8_t USBSpeed, uint16_t *len);
42 static uint8_t USBD_MSC_ClearFeature (
void *pudev,
USB_DEVICE_REQ *req);
48 USBD_MSC_GetClassDescriptor,
49 USBD_MSC_ClassReqHandle,
50 USBD_MSC_GetInterface,
51 USBD_MSC_SetInterface,
62 const uint8_t USBD_MSC_CfgDesc[USB_MSC_CONFIG_DESC_SIZE] =
65 USB_DESCTYPE_CONFIGURATION,
66 USB_MSC_CONFIG_DESC_SIZE,
76 USB_DESCTYPE_INTERFACE,
87 USB_DESCTYPE_ENDPOINT,
90 LOWBYTE(MSC_DATA_PACKET_SIZE),
91 HIGHBYTE(MSC_DATA_PACKET_SIZE),
95 USB_DESCTYPE_ENDPOINT,
98 LOWBYTE(MSC_DATA_PACKET_SIZE),
99 HIGHBYTE(MSC_DATA_PACKET_SIZE),
103 static uint8_t USBD_MSC_MaxLun = 0;
104 static uint8_t USBD_MSC_AltSet = 0;
120 static uint8_t USBD_MSC_Init (
void *pudev, uint8_t cfgidx)
149 static uint8_t USBD_MSC_DeInit (
void *pudev, uint8_t cfgidx)
167 static uint8_t USBD_MSC_ClassReqHandle (
void *pudev,
USB_DEVICE_REQ *req)
169 switch (req->bRequest)
171 case BBB_GET_MAX_LUN :
172 if((req->wValue == 0) &&
173 (req->wLength == 1) &&
174 ((req->bmRequestType & 0x80) == 0x80))
176 USBD_MSC_MaxLun = USBD_STORAGE_fops->GetMaxLun();
177 if(USBD_MSC_MaxLun > 0)
195 if((req->wValue == 0) &&
196 (req->wLength == 0) &&
197 ((req->bmRequestType & 0x80) != 0x80))
222 static uint8_t USBD_MSC_GetClassDescriptor (
void *pudev,
USB_DEVICE_REQ *req)
233 static uint8_t USBD_MSC_GetInterface (
void *pudev,
USB_DEVICE_REQ *req)
235 USB_CtlTx (pudev, (uint8_t *)&USBD_MSC_AltSet, 1);
246 static uint8_t USBD_MSC_SetInterface (
void *pudev,
USB_DEVICE_REQ *req)
248 USBD_MSC_AltSet = (uint8_t)(req->wValue);
259 static uint8_t USBD_MSC_ClearFeature (
void *pudev,
USB_DEVICE_REQ *req)
272 static uint8_t USBD_MSC_DataIn (
void *pudev, uint8_t EpID)
285 static uint8_t USBD_MSC_DataOut (
void *pudev, uint8_t EpID)
298 static uint8_t *USBD_MSC_GetCfgDesc (uint8_t speed, uint16_t *len)
300 *len =
sizeof (USBD_MSC_CfgDesc);
302 return (uint8_t *)USBD_MSC_CfgDesc;
USB device class callback type define.
void MSC_BBB_DeInit(USB_DEVICE_HANDLE *pudev)
De-Initialize the BBB Machine.
Header file for the usbd_msc_core.c file.
void MSC_BBB_Init(USB_DEVICE_HANDLE *pudev)
Initialize the BBB process.
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_Reset(USB_DEVICE_HANDLE *pudev)
Reset the BBB machine.
void MSC_BBB_DataOut(USB_DEVICE_HANDLE *pudev, uint8_t EpID)
Handle BBB OUT data stage.
uint8_t USB_CtlTx(USB_CORE_HANDLE *pudev, uint8_t *pbuf, uint16_t Len)
Transmit data on the control pipe.
void MSC_BBB_DataIn(USB_DEVICE_HANDLE *pudev, uint8_t EpID)
Handle BBB IN data stage.
#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.