11 #include "usbd_hid_msc_wrapper.h"
17 static uint8_t USBD_HID_MSC_Init (
void *pudev, uint8_t cfgidx);
18 static uint8_t USBD_HID_MSC_DeInit (
void *pudev, uint8_t cfgidx);
19 static uint8_t USBD_HID_MSC_GetClassDescriptor (
void *pudev,
USB_DEVICE_REQ *req);
20 static uint8_t USBD_HID_MSC_ClassReqHandle (
void *pudev,
USB_DEVICE_REQ *req);
21 static uint8_t USBD_HID_MSC_GetInterface (
void *pudev,
USB_DEVICE_REQ *req);
22 static uint8_t USBD_HID_MSC_SetInterface (
void *pudev,
USB_DEVICE_REQ *req);
23 static uint8_t USBD_HID_MSC_EP0_RxReady (
void *pudev);
24 static uint8_t USBD_HID_MSC_DataIn (
void *pudev, uint8_t EpID);
25 static uint8_t USBD_HID_MSC_DataOut (
void *pudev, uint8_t EpID);
26 static uint8_t* USBD_HID_MSC_GetCfgDesc (uint8_t USBSpeed, uint16_t *len);
32 USBD_HID_MSC_GetClassDescriptor,
33 USBD_HID_MSC_ClassReqHandle,
34 USBD_HID_MSC_GetInterface,
35 USBD_HID_MSC_SetInterface,
37 USBD_HID_MSC_EP0_RxReady,
41 USBD_HID_MSC_GetCfgDesc,
46 const uint8_t USBD_HID_MSC_CfgDesc[USB_HID_MSC_CONFIG_DESC_SIZE] =
49 USB_DESCTYPE_CONFIGURATION,
50 USB_HID_MSC_CONFIG_DESC_SIZE,
60 USB_DESCTYPE_INTERFACE,
77 CUSTOMHID_REPORT_DESC_SIZE,
82 USB_DESCTYPE_ENDPOINT,
90 USB_DESCTYPE_ENDPOINT,
113 LOWBYTE(MSC_DATA_PACKET_SIZE),
114 HIGHBYTE(MSC_DATA_PACKET_SIZE),
121 LOWBYTE(MSC_DATA_PACKET_SIZE),
122 HIGHBYTE(MSC_DATA_PACKET_SIZE),
138 static uint8_t USBD_HID_MSC_Init (
void *pudev, uint8_t cfgidx)
141 USBD_CUSTOMHID_cb.Init(pudev, cfgidx);
144 USBD_MSC_cb.Init(pudev, cfgidx);
156 static uint8_t USBD_HID_MSC_DeInit (
void *pudev, uint8_t cfgidx)
159 USBD_CUSTOMHID_cb.DeInit(pudev, cfgidx);
162 USBD_MSC_cb.DeInit(pudev, cfgidx);
173 static uint8_t USBD_HID_MSC_GetClassDescriptor (
void *pudev,
USB_DEVICE_REQ *req)
175 if (req->wIndex == HID_INTERFACE)
177 return USBD_CUSTOMHID_cb.GetClassDescriptor(pudev, req);
181 return USBD_MSC_cb.GetClassDescriptor(pudev, req);
191 static uint8_t USBD_HID_MSC_ClassReqHandle (
void *pudev,
USB_DEVICE_REQ *req)
193 if (req->wIndex == HID_INTERFACE)
195 return USBD_CUSTOMHID_cb.ClassReqHandle(pudev, req);
199 return USBD_MSC_cb.ClassReqHandle(pudev, req);
209 static uint8_t USBD_HID_MSC_GetInterface (
void *pudev,
USB_DEVICE_REQ *req)
211 if (req->wIndex == HID_INTERFACE)
213 return USBD_CUSTOMHID_cb.GetInterface(pudev, req);
217 return USBD_MSC_cb.GetInterface(pudev, req);
227 static uint8_t USBD_HID_MSC_SetInterface (
void *pudev,
USB_DEVICE_REQ *req)
229 if (req->wIndex == HID_INTERFACE)
231 return USBD_CUSTOMHID_cb.SetInterface(pudev, req);
235 return USBD_MSC_cb.SetInterface(pudev, req);
245 static uint8_t* USBD_HID_MSC_GetCfgDesc (uint8_t USBSpeed, uint16_t *len)
247 *len =
sizeof (USBD_HID_MSC_CfgDesc);
249 return (uint8_t*)USBD_HID_MSC_CfgDesc;
258 static uint8_t USBD_HID_MSC_DataIn (
void *pudev, uint8_t EpID)
261 if (EpID == (MSC_IN_EP & ~0x80))
263 return USBD_MSC_cb.DataIn(pudev, EpID);
267 return USBD_CUSTOMHID_cb.DataIn(pudev, EpID);
277 static uint8_t USBD_HID_MSC_DataOut(
void *pudev , uint8_t EpID)
280 if (EpID == (MSC_OUT_EP & ~0x80))
282 return USBD_MSC_cb.DataOut(pudev, EpID);
286 return USBD_CUSTOMHID_cb.DataOut(pudev, EpID);
295 static uint8_t USBD_HID_MSC_EP0_RxReady (
void *pudev)
298 return USBD_CUSTOMHID_cb.EP0_RxReady(pudev);
USB device class callback type define.
Header file for the usbd_msc_core.c file.
USB standard device request struct.
Custom HID device class core defines.
USB descriptor defines and function prototype.