dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_usbhook.c
Go to the documentation of this file.
1 
16 /*
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation; either version 3 of the License, or
20  * (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful, but
23  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25  * for more details.
26  *
27  * You should have received a copy of the GNU General Public License along
28  * with this program; if not, see <http://www.gnu.org/licenses/>
29  */
30 
31 #include "pios.h"
32 #include "pios_usb.h" /* PIOS_USB_* */
33 #include "pios_usbhook.h"
34 #include "pios_usb_defs.h" /* struct usb_* */
35 #include "pios_usb_cdc_priv.h" /* PIOS_USB_CDC_* */
36 #include "pios_usb_board_data.h" /* PIOS_USB_BOARD_* */
37 
38 
39 /* STM32 USB Library Definitions */
40 #include "usb_core.h" /* USBD_Class_cb_TypeDef */
41 #include "usbd_core.h" /* USBD_Init USBD_OK*/
42 #include "usbd_ioreq.h" /* USBD_CtlPrepareRx, USBD_CtlSendData */
43 #include "usbd_req.h" /* USBD_CtlError */
44 #include "usb_dcd_int.h" /* USBD_OTG_ISR_Handler */
45 
46 /*
47  * External API
48  */
50 
51 void PIOS_USBHOOK_RegisterDevice(const uint8_t * desc, uint16_t length)
52 {
55 }
56 
58 
59 void PIOS_USBHOOK_RegisterString(enum usb_string_desc string_id, const uint8_t * desc, uint16_t desc_size)
60 {
61  if (string_id < NELEMENTS(String_Descriptor)) {
62  String_Descriptor[string_id].descriptor = desc;
63  String_Descriptor[string_id].length = desc_size;
64  }
65 }
66 
68 
69 void PIOS_USBHOOK_RegisterConfig(uint8_t config_id, const uint8_t * desc, uint16_t desc_size)
70 {
73 }
74 
75 static USB_OTG_CORE_HANDLE pios_usb_otg_core_handle;
76 static USBD_Class_cb_TypeDef class_callbacks;
77 static USBD_DEVICE device_callbacks;
78 static USBD_Usr_cb_TypeDef user_callbacks;
79 
81 {
82  USBD_Init(&pios_usb_otg_core_handle,
83  USB_OTG_FS_CORE_ID,
84  &device_callbacks,
85  &class_callbacks,
86  &user_callbacks);
87 }
88 
89 void PIOS_USBHOOK_Deactivate(void)
90 {
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);
94 }
95 
97 {
99 
100  if(!USBD_OTG_ISR_Handler(&pios_usb_otg_core_handle)) {
101  /* spurious interrupt, disable IRQ */
102 
103  }
104 
106 }
107 
108 struct usb_if_entry {
110  uintptr_t context;
111 };
112 static struct usb_if_entry usb_if_table[3];
113 void PIOS_USBHOOK_RegisterIfOps(uint8_t ifnum, struct pios_usb_ifops * ifops, uintptr_t context)
114 {
116  PIOS_Assert(ifops);
117 
118  usb_if_table[ifnum].ifops = ifops;
119  usb_if_table[ifnum].context = context;
120 }
121 
122 struct usb_ep_entry {
124  uintptr_t context;
125  uint16_t max_len;
126 };
127 static struct usb_ep_entry usb_epin_table[6];
128 void PIOS_USBHOOK_RegisterEpInCallback(uint8_t epnum, uint16_t max_len, pios_usbhook_epcb cb, uintptr_t context)
129 {
131  PIOS_Assert(cb);
132 
133  usb_epin_table[epnum].cb = cb;
134  usb_epin_table[epnum].context = context;
135  usb_epin_table[epnum].max_len = max_len;
136 
137  DCD_EP_Open(&pios_usb_otg_core_handle,
138  epnum | 0x80,
139  max_len,
140  USB_OTG_EP_INT);
141  /*
142  * FIXME do not hardcode endpoint type
143  */
144 }
145 
146 extern void PIOS_USBHOOK_DeRegisterEpInCallback(uint8_t epnum)
147 {
149 
150  usb_epin_table[epnum].cb = NULL;
151 
152  DCD_EP_Close(&pios_usb_otg_core_handle, epnum | 0x80);
153 }
154 
155 static struct usb_ep_entry usb_epout_table[6];
156 void PIOS_USBHOOK_RegisterEpOutCallback(uint8_t epnum, uint16_t max_len, pios_usbhook_epcb cb, uintptr_t context)
157 {
159  PIOS_Assert(cb);
160 
161  usb_epout_table[epnum].cb = cb;
164 
165  DCD_EP_Open(&pios_usb_otg_core_handle,
166  epnum,
167  max_len,
168  USB_OTG_EP_INT);
169  /*
170  * FIXME do not hardcode endpoint type
171  */
172 
173  /*
174  * Make sure we refuse OUT transactions until we explicitly
175  * connect a receive buffer with PIOS_USBHOOK_EndpointRx().
176  *
177  * Without this, the ST USB code will receive on this endpoint
178  * and blindly write the data to a NULL pointer which will
179  * have the side effect of placing the internal flash into an
180  * errored state. Address 0x0000_0000 is aliased into internal
181  * flash via the "Section 2.4 Boot configuration" BOOT0/1 pins.
182  */
183  DCD_SetEPStatus(&pios_usb_otg_core_handle,
184  epnum,
185  USB_OTG_EP_RX_NAK);
186 }
187 
188 extern void PIOS_USBHOOK_DeRegisterEpOutCallback(uint8_t epnum)
189 {
191 
192  usb_epout_table[epnum].cb = NULL;
193 
194  DCD_EP_Close(&pios_usb_otg_core_handle, epnum);
195 }
196 
197 void PIOS_USBHOOK_CtrlTx(const uint8_t *buf, uint16_t len)
198 {
199  USBD_CtlSendData(&pios_usb_otg_core_handle, buf, len);
200 }
201 
202 void PIOS_USBHOOK_CtrlRx(uint8_t *buf, uint16_t len)
203 {
204  USBD_CtlPrepareRx(&pios_usb_otg_core_handle, buf, len);
205 }
206 
207 void PIOS_USBHOOK_EndpointTx(uint8_t epnum, const uint8_t *buf, uint16_t len)
208 {
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);
211  }
212 }
213 
214 void PIOS_USBHOOK_EndpointRx(uint8_t epnum, uint8_t *buf, uint16_t len)
215 {
216  DCD_EP_PrepareRx(&pios_usb_otg_core_handle, epnum, buf, len);
217 }
218 
219 /*
220  * Device level hooks into STM USB library
221  */
222 
223 static const uint8_t * PIOS_USBHOOK_DEV_GetDeviceDescriptor(uint8_t speed, uint16_t *length)
224 {
225  *length = Device_Descriptor.length;
227 }
228 
229 static const uint8_t * PIOS_USBHOOK_DEV_GetLangIDStrDescriptor(uint8_t speed, uint16_t *length)
230 {
233 }
234 
235 static const uint8_t * PIOS_USBHOOK_DEV_GetManufacturerStrDescriptor(uint8_t speed, uint16_t *length)
236 {
239 }
240 
241 static const uint8_t * PIOS_USBHOOK_DEV_GetProductStrDescriptor(uint8_t speed, uint16_t *length)
242 {
245 }
246 
247 static const uint8_t * PIOS_USBHOOK_DEV_GetSerialStrDescriptor(uint8_t speed, uint16_t *length)
248 {
251 }
252 
253 static const uint8_t * PIOS_USBHOOK_DEV_GetConfigurationStrDescriptor(uint8_t speed, uint16_t *length)
254 {
255  return NULL;
256 }
257 
258 static const uint8_t * PIOS_USBHOOK_DEV_GetInterfaceStrDescriptor(uint8_t speed, uint16_t *length)
259 {
260  return NULL;
261 }
262 
263 static USBD_DEVICE device_callbacks = {
264  .GetDeviceDescriptor = PIOS_USBHOOK_DEV_GetDeviceDescriptor,
265  .GetLangIDStrDescriptor = PIOS_USBHOOK_DEV_GetLangIDStrDescriptor,
266  .GetManufacturerStrDescriptor = PIOS_USBHOOK_DEV_GetManufacturerStrDescriptor,
267  .GetProductStrDescriptor = PIOS_USBHOOK_DEV_GetProductStrDescriptor,
268  .GetSerialStrDescriptor = PIOS_USBHOOK_DEV_GetSerialStrDescriptor,
269  .GetConfigurationStrDescriptor = PIOS_USBHOOK_DEV_GetConfigurationStrDescriptor,
270  .GetInterfaceStrDescriptor = PIOS_USBHOOK_DEV_GetInterfaceStrDescriptor,
271 };
272 
273 static void PIOS_USBHOOK_USR_Init(void)
274 {
276 
277 #if 1
278  /* Force a physical disconnect/reconnect */
279  DCD_DevDisconnect(&pios_usb_otg_core_handle);
280  DCD_DevConnect(&pios_usb_otg_core_handle);
281 #endif
282 }
283 
285 {
287 }
288 
290 {
292 }
293 
295 {
296  /* Unhandled */
297 }
298 
300 {
301  /* Unhandled */
302 }
303 
305 {
306  /* NOP */
307 }
308 
310 {
312 }
313 
314 static USBD_Usr_cb_TypeDef user_callbacks = {
315  .Init = PIOS_USBHOOK_USR_Init,
316  .DeviceReset = PIOS_USBHOOK_USR_DeviceReset,
317  .DeviceConfigured = PIOS_USBHOOK_USR_DeviceConfigured,
318  .DeviceSuspended = PIOS_USBHOOK_USR_DeviceSuspended,
319  .DeviceResumed = PIOS_USBHOOK_USR_DeviceResumed,
320  .DeviceConnected = PIOS_USBHOOK_USR_DeviceConnected,
321  .DeviceDisconnected = PIOS_USBHOOK_USR_DeviceDisconnected,
322 };
323 
324 static uint8_t PIOS_USBHOOK_CLASS_Init(void *pdev, uint8_t cfgidx)
325 {
326  /* Call all of the registered init callbacks */
327  for (uint8_t i = 0; i < NELEMENTS(usb_if_table); i++) {
328  struct usb_if_entry * usb_if = &(usb_if_table[i]);
329  if (usb_if->ifops && usb_if->ifops->init) {
330  usb_if->ifops->init(usb_if->context);
331  }
332  }
333  return USBD_OK;
334 }
335 
336 static uint8_t PIOS_USBHOOK_CLASS_DeInit(void *pdev, uint8_t cfgidx)
337 {
338  /* Call all of the registered deinit callbacks */
339  for (uint8_t i = 0; i < NELEMENTS(usb_if_table); i++) {
340  struct usb_if_entry * usb_if = &(usb_if_table[i]);
341  if (usb_if->ifops && usb_if->ifops->deinit) {
342  usb_if->ifops->deinit(usb_if->context);
343  }
344  }
345  return USBD_OK;
346 }
347 
349 static uint8_t PIOS_USBHOOK_CLASS_Setup(void *pdev, USB_SETUP_REQ *req)
350 {
351  switch (req->bmRequest & (USB_REQ_TYPE_MASK | USB_REQ_RECIPIENT_MASK)) {
354  {
355  uint8_t ifnum = LOBYTE(req->wIndex);
356  if ((ifnum < NELEMENTS(usb_if_table)) &&
357  (usb_if_table[ifnum].ifops && usb_if_table[ifnum].ifops->setup)) {
358  usb_if_table[ifnum].ifops->setup(usb_if_table[ifnum].context,
359  (struct usb_setup_request *)req);
360  if (!(req->bmRequest & 0x80) && req->wLength > 0) {
361  /* Request is a host-to-device data setup packet, keep track of the request details for the EP0_RxReady call */
362  usb_ep0_active_req.bmRequestType = req->bmRequest;
363  usb_ep0_active_req.bRequest = req->bRequest;
364  usb_ep0_active_req.wValue = req->wValue;
365  usb_ep0_active_req.wIndex = req->wIndex;
366  usb_ep0_active_req.wLength = req->wLength;
367  }
368  } else {
369  /* No Setup handler or Setup handler failed */
370  USBD_CtlError (&pios_usb_otg_core_handle, req);
371  }
372  break;
373  }
374  default:
375  /* Unhandled Setup */
376  USBD_CtlError (&pios_usb_otg_core_handle, req);
377  break;
378  }
379 
380  return USBD_OK;
381 }
382 
383 static uint8_t PIOS_USBHOOK_CLASS_EP0_TxSent(void *pdev)
384 {
385  return USBD_OK;
386 }
387 
388 static uint8_t PIOS_USBHOOK_CLASS_EP0_RxReady(void *pdev)
389 {
390  uint8_t ifnum = LOBYTE(usb_ep0_active_req.wIndex);
391 
392  if ((ifnum < NELEMENTS(usb_if_table)) &&
393  (usb_if_table[ifnum].ifops && usb_if_table[ifnum].ifops->ctrl_data_out)) {
394  usb_if_table[ifnum].ifops->ctrl_data_out(usb_if_table[ifnum].context,
396  }
397 
398  return USBD_OK;
399 }
400 
401 static uint8_t PIOS_USBHOOK_CLASS_DataIn(void *pdev, uint8_t epnum)
402 {
403  /* Remove the direction bit so we can use this as an index */
404  uint8_t epnum_idx = epnum & 0x7F;
405 
406  if ((epnum_idx < NELEMENTS(usb_epin_table)) && usb_epin_table[epnum_idx].cb) {
407  struct usb_ep_entry *ep = &(usb_epin_table[epnum_idx]);
408  if (!ep->cb(ep->context, epnum_idx, ep->max_len)) {
409  /* NOTE: use real endpoint number including direction bit */
410  DCD_SetEPStatus(pdev, epnum, USB_OTG_EP_TX_NAK);
411  }
412  }
413 
414  return USBD_OK;
415 }
416 
417 static uint8_t PIOS_USBHOOK_CLASS_DataOut(void *pdev, uint8_t epnum)
418 {
419  /* Remove the direction bit so we can use this as an index */
420  uint8_t epnum_idx = epnum & 0x7F;
421 
422  if ((epnum_idx < NELEMENTS(usb_epout_table)) && usb_epout_table[epnum_idx].cb) {
423  struct usb_ep_entry *ep = &(usb_epout_table[epnum_idx]);
424  if (!ep->cb(ep->context, epnum_idx, USBD_GetRxCount(pdev, epnum))) {
425  /* NOTE: use real endpoint number including direction bit */
426  DCD_SetEPStatus(pdev, epnum, USB_OTG_EP_RX_NAK);
427  }
428  }
429 
430  return USBD_OK;
431 }
432 
433 static uint8_t PIOS_USBHOOK_CLASS_SOF(void *pdev)
434 {
435  return USBD_OK;
436 }
437 
438 static uint8_t PIOS_USBHOOK_CLASS_IsoINIncomplete(void *pdev)
439 {
440  return USBD_OK;
441 }
442 
443 static uint8_t PIOS_USBHOOK_CLASS_IsoOUTIncomplete(void *pdev)
444 {
445  return USBD_OK;
446 }
447 
448 static const uint8_t * PIOS_USBHOOK_CLASS_GetConfigDescriptor(uint8_t speed, uint16_t *length)
449 {
450  *length = Config_Descriptor.length;
452 }
453 
454 #ifdef USB_OTG_HS_CORE
455 static const uint8_t * PIOS_USBHOOK_CLASS_GetOtherConfigDescriptor(uint8_t speed, uint16_t *length)
456 {
457  return PIOS_USBHOOK_CLASS_GetConfigDescriptor(speed, length);
458 }
459 #endif /* USB_OTG_HS_CORE */
460 
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)
463 {
464  return NULL;
465 }
466 #endif /* USB_SUPPORT_USER_STRING_DESC */
467 
468 static USBD_Class_cb_TypeDef class_callbacks = {
469  .Init = PIOS_USBHOOK_CLASS_Init,
470  .DeInit = PIOS_USBHOOK_CLASS_DeInit,
471  .Setup = PIOS_USBHOOK_CLASS_Setup,
472  .EP0_TxSent = PIOS_USBHOOK_CLASS_EP0_TxSent,
473  .EP0_RxReady = PIOS_USBHOOK_CLASS_EP0_RxReady,
474  .DataIn = PIOS_USBHOOK_CLASS_DataIn,
475  .DataOut = PIOS_USBHOOK_CLASS_DataOut,
476  .SOF = PIOS_USBHOOK_CLASS_SOF,
477  .IsoINIncomplete = PIOS_USBHOOK_CLASS_IsoINIncomplete,
478  .IsoOUTIncomplete = PIOS_USBHOOK_CLASS_IsoOUTIncomplete,
479  .GetConfigDescriptor = PIOS_USBHOOK_CLASS_GetConfigDescriptor,
480 #ifdef USB_OTG_HS_CORE
481  .GetOtherConfigDescriptor = PIOS_USBHOOK_CLASS_GetOtherConfigDescriptor,
482 #endif /* USB_OTG_HS_CORE */
483 #ifdef USB_SUPPORT_USER_STRING_DESC
484  .GetUsrStrDescriptor = PIOS_USBHOOK_CLASS_GetUsrStrDescriptor,
485 #endif /* USB_SUPPORT_USER_STRING_DESC */
486 };
487 
uint16_t speed
Definition: msp_messages.h:101
static uint8_t PIOS_USBHOOK_CLASS_DataIn(void *pdev, uint8_t epnum)
Definition: pios_usbhook.c:401
void PIOS_USBHOOK_CtrlTx(const uint8_t *buf, uint16_t len)
Definition: pios_usbhook.c:197
uint16_t max_len
Definition: pios_usbhook.c:125
static const uint8_t * PIOS_USBHOOK_DEV_GetManufacturerStrDescriptor(uint8_t speed, uint16_t *length)
Definition: pios_usbhook.c:235
static void PIOS_USBHOOK_USR_DeviceConnected(void)
Definition: pios_usbhook.c:304
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)
Definition: pios_usbhook.c:229
static void PIOS_USBHOOK_USR_Init(void)
Definition: pios_usbhook.c:273
#define USB_REQ_TYPE_CLASS
#define NELEMENTS(x)
Definition: pios.h:192
static USB_OTG_CORE_HANDLE pios_usb_otg_core_handle
Definition: pios_usbhook.c:75
static uint8_t PIOS_USBHOOK_CLASS_DataOut(void *pdev, uint8_t epnum)
Definition: pios_usbhook.c:417
uint32_t desc_size
APIs for PIOS_USBHOOK layer.
static USBD_Usr_cb_TypeDef user_callbacks
Definition: pios_usbhook.c:78
static struct pios_usbhook_descriptor String_Descriptor[4]
Definition: pios_usbhook.c:57
void PIOS_USBHOOK_CtrlRx(uint8_t *buf, uint16_t len)
Definition: pios_usbhook.c:202
static const uint8_t * PIOS_USBHOOK_DEV_GetSerialStrDescriptor(uint8_t speed, uint16_t *length)
Definition: pios_usbhook.c:247
#define PIOS_IRQ_Epilogue()
Definition: pios_irq.h:46
#define USB_REQ_TYPE_MASK
#define USB_REQ_TYPE_STANDARD
void PIOS_USBHOOK_Deactivate(void)
Definition: pios_usbhook.c:84
tuple desc
Definition: px_mkfw.py:82
static struct pios_usbhook_descriptor Device_Descriptor
Definition: pios_usbhook.c:49
static uint8_t PIOS_USBHOOK_CLASS_Init(void *pdev, uint8_t cfgidx)
Definition: pios_usbhook.c:324
static void PIOS_USBHOOK_USR_DeviceConfigured(void)
Definition: pios_usbhook.c:289
static const uint8_t * PIOS_USBHOOK_CLASS_GetConfigDescriptor(uint8_t speed, uint16_t *length)
Definition: pios_usbhook.c:448
#define USB_REQ_RECIPIENT_MASK
static uint8_t PIOS_USBHOOK_CLASS_IsoINIncomplete(void *pdev)
Definition: pios_usbhook.c:438
static void PIOS_USBHOOK_USR_DeviceReset(uint8_t speed)
Definition: pios_usbhook.c:284
static void PIOS_USBHOOK_USR_DeviceDisconnected(void)
Definition: pios_usbhook.c:309
USB_STRING_DESC_VENDOR
Definition: pios_usbhook.h:37
USB_STRING_DESC_SERIAL
Definition: pios_usbhook.h:39
void OTG_FS_IRQHandler(void)
Definition: pios_usbhook.c:96
static const uint8_t * PIOS_USBHOOK_DEV_GetConfigurationStrDescriptor(uint8_t speed, uint16_t *length)
Definition: pios_usbhook.c:253
void(* init)(uintptr_t context)
Definition: pios_usbhook.h:55
uint8_t length
void(* deinit)(uintptr_t context)
Definition: pios_usbhook.h:56
bool(* pios_usbhook_epcb)(uintptr_t context, uint8_t epnum, uint16_t len)
Definition: pios_usbhook.h:63
static USBD_DEVICE device_callbacks
Definition: pios_usbhook.c:77
static uint8_t PIOS_USBHOOK_CLASS_EP0_TxSent(void *pdev)
Definition: pios_usbhook.c:383
USB_STRING_DESC_LANG
Definition: pios_usbhook.h:36
void(* ctrl_data_out)(uintptr_t context, const struct usb_setup_request *req)
Definition: pios_usbhook.h:58
void PIOS_USBHOOK_EndpointRx(uint8_t epnum, uint8_t *buf, uint16_t len)
Definition: pios_usbhook.c:214
pios_usbhook_epcb cb
Definition: pios_usbhook.c:123
#define USB_REQ_RECIPIENT_INTERFACE
uintptr_t context
Definition: pios_usbhook.c:110
static const uint8_t * PIOS_USBHOOK_DEV_GetDeviceDescriptor(uint8_t speed, uint16_t *length)
Definition: pios_usbhook.c:223
static struct usb_setup_request usb_ep0_active_req
Definition: pios_usbhook.c:348
usb_string_desc
Definition: pios_usbhook.h:43
void PIOS_USBHOOK_RegisterEpInCallback(uint8_t epnum, uint16_t max_len, pios_usbhook_epcb cb, uintptr_t context)
Definition: pios_usbhook.c:128
uint8_t i
Definition: msp_messages.h:97
int32_t PIOS_USB_ChangeConnectionState(bool connected)
Definition: pios_usbhook.c:108
static struct usb_ep_entry usb_epin_table[6]
Definition: pios_usbhook.c:127
void PIOS_USBHOOK_RegisterConfig(uint8_t config_id, const uint8_t *desc, uint16_t desc_size)
Definition: pios_usbhook.c:52
static const uint8_t * PIOS_USBHOOK_DEV_GetInterfaceStrDescriptor(uint8_t speed, uint16_t *length)
Definition: pios_usbhook.c:258
USB HID layer functions header.
USB_STRING_DESC_PRODUCT
Definition: pios_usbhook.h:38
void PIOS_USBHOOK_RegisterString(enum usb_string_desc string_id, const uint8_t *desc, uint16_t desc_size)
Definition: pios_usbhook.c:60
static void PIOS_USBHOOK_USR_DeviceResumed(void)
Definition: pios_usbhook.c:299
const uint8_t * descriptor
Definition: pios_usbhook.h:39
static struct usb_if_entry usb_if_table[3]
Definition: pios_usbhook.c:112
void PIOS_USBHOOK_RegisterDevice(const uint8_t *desc, uint16_t desc_size)
Definition: pios_usbhook.c:44
static void PIOS_USBHOOK_USR_DeviceSuspended(void)
Definition: pios_usbhook.c:294
static struct pios_usbhook_descriptor Config_Descriptor
Definition: pios_usbhook.c:67
static uint8_t PIOS_USBHOOK_CLASS_DeInit(void *pdev, uint8_t cfgidx)
Definition: pios_usbhook.c:336
void PIOS_USBHOOK_Activate(void)
Definition: pios_usbhook.c:80
void PIOS_USBHOOK_EndpointTx(uint8_t epnum, const uint8_t *buf, uint16_t len)
Definition: pios_usbhook.c:207
void PIOS_USBHOOK_DeRegisterEpInCallback(uint8_t epnum)
Definition: pios_usbhook.c:146
void PIOS_USBHOOK_RegisterEpOutCallback(uint8_t epnum, uint16_t max_len, pios_usbhook_epcb cb, uintptr_t context)
Definition: pios_usbhook.c:156
#define PIOS_IRQ_Prologue()
Definition: pios_irq.h:45
static struct usb_ep_entry usb_epout_table[6]
Definition: pios_usbhook.c:155
struct pios_usb_ifops * ifops
Definition: pios_usbhook.c:109
USB COM CDC private definitions.
Definition: pios_usbhook.c:122
static USBD_Class_cb_TypeDef class_callbacks
Definition: pios_usbhook.c:76
static uint8_t PIOS_USBHOOK_CLASS_Setup(void *pdev, USB_SETUP_REQ *req)
Definition: pios_usbhook.c:349
void PIOS_USBHOOK_DeRegisterEpOutCallback(uint8_t epnum)
Definition: pios_usbhook.c:188
#define PIOS_Assert(test)
Definition: pios_debug.h:52
static const uint8_t * PIOS_USBHOOK_DEV_GetProductStrDescriptor(uint8_t speed, uint16_t *length)
Definition: pios_usbhook.c:241
void PIOS_USBHOOK_RegisterIfOps(uint8_t ifnum, struct pios_usb_ifops *ifops, uintptr_t context)
Definition: pios_usbhook.c:113
static uint8_t PIOS_USBHOOK_CLASS_IsoOUTIncomplete(void *pdev)
Definition: pios_usbhook.c:443
bool(* setup)(uintptr_t context, struct usb_setup_request *req)
Definition: pios_usbhook.h:57
static uint8_t PIOS_USBHOOK_CLASS_SOF(void *pdev)
Definition: pios_usbhook.c:433
static uint8_t PIOS_USBHOOK_CLASS_EP0_RxReady(void *pdev)
Definition: pios_usbhook.c:388
uintptr_t context
Definition: pios_usbhook.c:124