41 #include "usbd_core.h"
42 #include "usbd_ioreq.h"
44 #include "usb_dcd_int.h"
82 USBD_Init(&pios_usb_otg_core_handle,
91 DCD_DevDisconnect(&pios_usb_otg_core_handle);
92 USBD_DeInit(&pios_usb_otg_core_handle);
93 USB_OTG_StopDevice(&pios_usb_otg_core_handle);
100 if(!USBD_OTG_ISR_Handler(&pios_usb_otg_core_handle)) {
137 DCD_EP_Open(&pios_usb_otg_core_handle,
152 DCD_EP_Close(&pios_usb_otg_core_handle, epnum | 0x80);
165 DCD_EP_Open(&pios_usb_otg_core_handle,
183 DCD_SetEPStatus(&pios_usb_otg_core_handle,
194 DCD_EP_Close(&pios_usb_otg_core_handle, epnum);
199 USBD_CtlSendData(&pios_usb_otg_core_handle, buf, len);
204 USBD_CtlPrepareRx(&pios_usb_otg_core_handle, buf, len);
209 if (pios_usb_otg_core_handle.dev.device_status == USB_OTG_CONFIGURED) {
210 DCD_EP_Tx(&pios_usb_otg_core_handle, epnum, buf, len);
216 DCD_EP_PrepareRx(&pios_usb_otg_core_handle, epnum, buf, len);
263 static USBD_DEVICE device_callbacks = {
279 DCD_DevDisconnect(&pios_usb_otg_core_handle);
280 DCD_DevConnect(&pios_usb_otg_core_handle);
314 static USBD_Usr_cb_TypeDef user_callbacks = {
355 uint8_t ifnum = LOBYTE(req->wIndex);
360 if (!(req->bmRequest & 0x80) && req->wLength > 0) {
370 USBD_CtlError (&pios_usb_otg_core_handle, req);
376 USBD_CtlError (&pios_usb_otg_core_handle, req);
404 uint8_t epnum_idx = epnum & 0x7F;
410 DCD_SetEPStatus(pdev, epnum, USB_OTG_EP_TX_NAK);
420 uint8_t epnum_idx = epnum & 0x7F;
424 if (!ep->
cb(ep->
context, epnum_idx, USBD_GetRxCount(pdev, epnum))) {
426 DCD_SetEPStatus(pdev, epnum, USB_OTG_EP_RX_NAK);
454 #ifdef USB_OTG_HS_CORE
455 static const uint8_t * PIOS_USBHOOK_CLASS_GetOtherConfigDescriptor(uint8_t
speed, uint16_t *
length)
461 #ifdef USB_SUPPORT_USER_STRING_DESC
462 static const uint8_t * PIOS_USBHOOK_CLASS_GetUsrStrDescriptor(uint8_t
speed, uint8_t index, uint16_t *
length)
468 static USBD_Class_cb_TypeDef class_callbacks = {
480 #ifdef USB_OTG_HS_CORE
481 .GetOtherConfigDescriptor = PIOS_USBHOOK_CLASS_GetOtherConfigDescriptor,
483 #ifdef USB_SUPPORT_USER_STRING_DESC
484 .GetUsrStrDescriptor = PIOS_USBHOOK_CLASS_GetUsrStrDescriptor,
static uint8_t PIOS_USBHOOK_CLASS_DataIn(void *pdev, uint8_t epnum)
void PIOS_USBHOOK_CtrlTx(const uint8_t *buf, uint16_t len)
static const uint8_t * PIOS_USBHOOK_DEV_GetManufacturerStrDescriptor(uint8_t speed, uint16_t *length)
static void PIOS_USBHOOK_USR_DeviceConnected(void)
Main PiOS header to include all the compiled in PiOS options.
static const uint8_t * PIOS_USBHOOK_DEV_GetLangIDStrDescriptor(uint8_t speed, uint16_t *length)
static void PIOS_USBHOOK_USR_Init(void)
#define USB_REQ_TYPE_CLASS
static USB_OTG_CORE_HANDLE pios_usb_otg_core_handle
static uint8_t PIOS_USBHOOK_CLASS_DataOut(void *pdev, uint8_t epnum)
APIs for PIOS_USBHOOK layer.
static USBD_Usr_cb_TypeDef user_callbacks
static struct pios_usbhook_descriptor String_Descriptor[4]
void PIOS_USBHOOK_CtrlRx(uint8_t *buf, uint16_t len)
static const uint8_t * PIOS_USBHOOK_DEV_GetSerialStrDescriptor(uint8_t speed, uint16_t *length)
#define PIOS_IRQ_Epilogue()
#define USB_REQ_TYPE_MASK
#define USB_REQ_TYPE_STANDARD
void PIOS_USBHOOK_Deactivate(void)
static struct pios_usbhook_descriptor Device_Descriptor
static uint8_t PIOS_USBHOOK_CLASS_Init(void *pdev, uint8_t cfgidx)
static void PIOS_USBHOOK_USR_DeviceConfigured(void)
static const uint8_t * PIOS_USBHOOK_CLASS_GetConfigDescriptor(uint8_t speed, uint16_t *length)
#define USB_REQ_RECIPIENT_MASK
static uint8_t PIOS_USBHOOK_CLASS_IsoINIncomplete(void *pdev)
static void PIOS_USBHOOK_USR_DeviceReset(uint8_t speed)
static void PIOS_USBHOOK_USR_DeviceDisconnected(void)
void OTG_FS_IRQHandler(void)
static const uint8_t * PIOS_USBHOOK_DEV_GetConfigurationStrDescriptor(uint8_t speed, uint16_t *length)
void(* init)(uintptr_t context)
void(* deinit)(uintptr_t context)
bool(* pios_usbhook_epcb)(uintptr_t context, uint8_t epnum, uint16_t len)
static USBD_DEVICE device_callbacks
static uint8_t PIOS_USBHOOK_CLASS_EP0_TxSent(void *pdev)
void(* ctrl_data_out)(uintptr_t context, const struct usb_setup_request *req)
void PIOS_USBHOOK_EndpointRx(uint8_t epnum, uint8_t *buf, uint16_t len)
#define USB_REQ_RECIPIENT_INTERFACE
static const uint8_t * PIOS_USBHOOK_DEV_GetDeviceDescriptor(uint8_t speed, uint16_t *length)
static struct usb_setup_request usb_ep0_active_req
void PIOS_USBHOOK_RegisterEpInCallback(uint8_t epnum, uint16_t max_len, pios_usbhook_epcb cb, uintptr_t context)
int32_t PIOS_USB_ChangeConnectionState(bool connected)
static struct usb_ep_entry usb_epin_table[6]
void PIOS_USBHOOK_RegisterConfig(uint8_t config_id, const uint8_t *desc, uint16_t desc_size)
static const uint8_t * PIOS_USBHOOK_DEV_GetInterfaceStrDescriptor(uint8_t speed, uint16_t *length)
USB HID layer functions header.
void PIOS_USBHOOK_RegisterString(enum usb_string_desc string_id, const uint8_t *desc, uint16_t desc_size)
static void PIOS_USBHOOK_USR_DeviceResumed(void)
const uint8_t * descriptor
static struct usb_if_entry usb_if_table[3]
void PIOS_USBHOOK_RegisterDevice(const uint8_t *desc, uint16_t desc_size)
static void PIOS_USBHOOK_USR_DeviceSuspended(void)
static struct pios_usbhook_descriptor Config_Descriptor
static uint8_t PIOS_USBHOOK_CLASS_DeInit(void *pdev, uint8_t cfgidx)
void PIOS_USBHOOK_Activate(void)
void PIOS_USBHOOK_EndpointTx(uint8_t epnum, const uint8_t *buf, uint16_t len)
void PIOS_USBHOOK_DeRegisterEpInCallback(uint8_t epnum)
void PIOS_USBHOOK_RegisterEpOutCallback(uint8_t epnum, uint16_t max_len, pios_usbhook_epcb cb, uintptr_t context)
#define PIOS_IRQ_Prologue()
static struct usb_ep_entry usb_epout_table[6]
struct pios_usb_ifops * ifops
USB COM CDC private definitions.
static USBD_Class_cb_TypeDef class_callbacks
static uint8_t PIOS_USBHOOK_CLASS_Setup(void *pdev, USB_SETUP_REQ *req)
void PIOS_USBHOOK_DeRegisterEpOutCallback(uint8_t epnum)
#define PIOS_Assert(test)
static const uint8_t * PIOS_USBHOOK_DEV_GetProductStrDescriptor(uint8_t speed, uint16_t *length)
void PIOS_USBHOOK_RegisterIfOps(uint8_t ifnum, struct pios_usb_ifops *ifops, uintptr_t context)
static uint8_t PIOS_USBHOOK_CLASS_IsoOUTIncomplete(void *pdev)
bool(* setup)(uintptr_t context, struct usb_setup_request *req)
static uint8_t PIOS_USBHOOK_CLASS_SOF(void *pdev)
static uint8_t PIOS_USBHOOK_CLASS_EP0_RxReady(void *pdev)