usbd_cdc_core.c
Go to the documentation of this file.
1 
66 /* Includes ------------------------------------------------------------------*/
67 #include "usbd_cdc_core.h"
68 #include "usbd_desc.h"
69 #include "usbd_req.h"
70 
71 
94 #define USB_CDC_IDLE 0
95 #define USB_CDC_BUSY 1
96 #define USB_CDC_ZLP 2
97 
115 /*********************************************
116  CDC Device library callbacks
117  *********************************************/
118 uint8_t usbd_cdc_Init (void *pdev, uint8_t cfgidx);
119 uint8_t usbd_cdc_DeInit (void *pdev, uint8_t cfgidx);
120 uint8_t usbd_cdc_Setup (void *pdev, USB_SETUP_REQ *req);
121 uint8_t usbd_cdc_EP0_RxReady (void *pdev);
122 uint8_t usbd_cdc_DataIn (void *pdev, uint8_t epnum);
123 uint8_t usbd_cdc_DataOut (void *pdev, uint8_t epnum);
124 uint8_t usbd_cdc_SOF (void *pdev);
125 
126 /*********************************************
127  CDC specific management functions
128  *********************************************/
129 static void Handle_USBAsynchXfer (void *pdev);
130 static uint8_t *USBD_cdc_GetCfgDesc (uint8_t speed, uint16_t *length);
131 #ifdef USE_USB_OTG_HS
132 static uint8_t *USBD_cdc_GetOtherCfgDesc (uint8_t speed, uint16_t *length);
133 #endif
134 
142 extern uint8_t USBD_DeviceDesc [USB_SIZ_DEVICE_DESC];
143 
144 #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
145  #if defined ( __ICCARM__ )
146  #pragma data_alignment=4
147  #endif
148 #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
150 
151 #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
152  #if defined ( __ICCARM__ )
153  #pragma data_alignment=4
154  #endif
155 #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
156 __ALIGN_BEGIN uint8_t usbd_cdc_OtherCfgDesc [USB_CDC_CONFIG_DESC_SIZ] __ALIGN_END ;
157 
158 #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
159  #if defined ( __ICCARM__ )
160  #pragma data_alignment=4
161  #endif
162 #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
163 __ALIGN_BEGIN static __IO uint32_t usbd_cdc_AltSet __ALIGN_END = 0;
164 
165 #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
166  #if defined ( __ICCARM__ )
167  #pragma data_alignment=4
168  #endif
169 #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
170 __ALIGN_BEGIN uint8_t USB_Rx_Buffer [CDC_DATA_MAX_PACKET_SIZE] __ALIGN_END ;
171 
172 #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
173  #if defined ( __ICCARM__ )
174  #pragma data_alignment=4
175  #endif
176 #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
178 
179 
180 #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
181  #if defined ( __ICCARM__ )
182  #pragma data_alignment=4
183  #endif
184 #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
186 
187 uint32_t APP_Rx_ptr_in = 0;
188 uint32_t APP_Rx_ptr_out = 0;
189 uint32_t APP_Rx_length = 0;
190 
192 
193 static uint32_t cdcCmd = 0xFF;
194 static uint32_t cdcLen = 0;
195 
196 /* CDC interface class callbacks structure */
198 {
202  NULL, /* EP0_TxSent, */
206  usbd_cdc_SOF,
207  NULL,
208  NULL,
210 #ifdef USE_USB_OTG_HS
211  USBD_cdc_GetOtherCfgDesc, /* use same cobfig as per FS */
212 #endif /* USE_USB_OTG_HS */
213 };
214 
215 #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
216  #if defined ( __ICCARM__ )
217  #pragma data_alignment=4
218  #endif
219 #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
220 /* USB CDC device Configuration Descriptor */
221 __ALIGN_BEGIN uint8_t usbd_cdc_CfgDesc[USB_CDC_CONFIG_DESC_SIZ] __ALIGN_END =
222 {
223  /*Configuration Descriptor*/
224  0x09, /* bLength: Configuration Descriptor size */
225  USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */
226  USB_CDC_CONFIG_DESC_SIZ, /* wTotalLength:no of returned bytes */
227  0x00,
228  0x02, /* bNumInterfaces: 2 interface */
229  0x01, /* bConfigurationValue: Configuration value */
230  0x00, /* iConfiguration: Index of string descriptor describing the configuration */
231  0xC0, /* bmAttributes: self powered */
232  0x32, /* MaxPower 0 mA */
233 
234  /*---------------------------------------------------------------------------*/
235 
236  /*Interface Descriptor */
237  0x09, /* bLength: Interface Descriptor size */
238  USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: Interface */
239  /* Interface descriptor type */
240  0x00, /* bInterfaceNumber: Number of Interface */
241  0x00, /* bAlternateSetting: Alternate setting */
242  0x01, /* bNumEndpoints: One endpoints used */
243  0x02, /* bInterfaceClass: Communication Interface Class */
244  0x02, /* bInterfaceSubClass: Abstract Control Model */
245  0x01, /* bInterfaceProtocol: Common AT commands */
246  0x00, /* iInterface: */
247 
248  /*Header Functional Descriptor*/
249  0x05, /* bLength: Endpoint Descriptor size */
250  0x24, /* bDescriptorType: CS_INTERFACE */
251  0x00, /* bDescriptorSubtype: Header Func Desc */
252  0x10, /* bcdCDC: spec release number */
253  0x01,
254 
255  /*Call Management Functional Descriptor*/
256  0x05, /* bFunctionLength */
257  0x24, /* bDescriptorType: CS_INTERFACE */
258  0x01, /* bDescriptorSubtype: Call Management Func Desc */
259  0x00, /* bmCapabilities: D0+D1 */
260  0x01, /* bDataInterface: 1 */
261 
262  /*ACM Functional Descriptor*/
263  0x04, /* bFunctionLength */
264  0x24, /* bDescriptorType: CS_INTERFACE */
265  0x02, /* bDescriptorSubtype: Abstract Control Management desc */
266  0x02, /* bmCapabilities */
267 
268  /*Union Functional Descriptor*/
269  0x05, /* bFunctionLength */
270  0x24, /* bDescriptorType: CS_INTERFACE */
271  0x06, /* bDescriptorSubtype: Union func desc */
272  0x00, /* bMasterInterface: Communication class interface */
273  0x01, /* bSlaveInterface0: Data Class Interface */
274 
275  /*Endpoint 2 Descriptor*/
276  0x07, /* bLength: Endpoint Descriptor size */
277  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
278  CDC_CMD_EP, /* bEndpointAddress */
279  0x03, /* bmAttributes: Interrupt */
280  LOBYTE(CDC_CMD_PACKET_SZE), /* wMaxPacketSize: */
282 #ifdef USE_USB_OTG_HS
283  0x10, /* bInterval: */
284 #else
285  0xFF, /* bInterval: */
286 #endif /* USE_USB_OTG_HS */
287 
288  /*---------------------------------------------------------------------------*/
289 
290  /*Data class interface descriptor*/
291  0x09, /* bLength: Endpoint Descriptor size */
292  USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: */
293  0x01, /* bInterfaceNumber: Number of Interface */
294  0x00, /* bAlternateSetting: Alternate setting */
295  0x02, /* bNumEndpoints: Two endpoints used */
296  0x0A, /* bInterfaceClass: CDC */
297  0x00, /* bInterfaceSubClass: */
298  0x00, /* bInterfaceProtocol: */
299  0x00, /* iInterface: */
300 
301  /*Endpoint OUT Descriptor*/
302  0x07, /* bLength: Endpoint Descriptor size */
303  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
304  CDC_OUT_EP, /* bEndpointAddress */
305  0x02, /* bmAttributes: Bulk */
306  LOBYTE(CDC_DATA_MAX_PACKET_SIZE), /* wMaxPacketSize: */
308  0x00, /* bInterval: ignore for Bulk transfer */
309 
310  /*Endpoint IN Descriptor*/
311  0x07, /* bLength: Endpoint Descriptor size */
312  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
313  CDC_IN_EP, /* bEndpointAddress */
314  0x02, /* bmAttributes: Bulk */
315  LOBYTE(CDC_DATA_MAX_PACKET_SIZE), /* wMaxPacketSize: */
317  0x00 /* bInterval: ignore for Bulk transfer */
318 } ;
319 
320 #ifdef USE_USB_OTG_HS
321 #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
322  #if defined ( __ICCARM__ )
323  #pragma data_alignment=4
324  #endif
325 #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
326 __ALIGN_BEGIN uint8_t usbd_cdc_OtherCfgDesc[USB_CDC_CONFIG_DESC_SIZ] __ALIGN_END =
327 {
328  0x09, /* bLength: Configuration Descriptor size */
331  0x00,
332  0x02, /* bNumInterfaces: 2 interfaces */
333  0x01, /* bConfigurationValue: */
334  0x04, /* iConfiguration: */
335  0xC0, /* bmAttributes: */
336  0x32, /* MaxPower 100 mA */
337 
338  /*Interface Descriptor */
339  0x09, /* bLength: Interface Descriptor size */
340  USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: Interface */
341  /* Interface descriptor type */
342  0x00, /* bInterfaceNumber: Number of Interface */
343  0x00, /* bAlternateSetting: Alternate setting */
344  0x01, /* bNumEndpoints: One endpoints used */
345  0x02, /* bInterfaceClass: Communication Interface Class */
346  0x02, /* bInterfaceSubClass: Abstract Control Model */
347  0x01, /* bInterfaceProtocol: Common AT commands */
348  0x00, /* iInterface: */
349 
350  /*Header Functional Descriptor*/
351  0x05, /* bLength: Endpoint Descriptor size */
352  0x24, /* bDescriptorType: CS_INTERFACE */
353  0x00, /* bDescriptorSubtype: Header Func Desc */
354  0x10, /* bcdCDC: spec release number */
355  0x01,
356 
357  /*Call Management Functional Descriptor*/
358  0x05, /* bFunctionLength */
359  0x24, /* bDescriptorType: CS_INTERFACE */
360  0x01, /* bDescriptorSubtype: Call Management Func Desc */
361  0x00, /* bmCapabilities: D0+D1 */
362  0x01, /* bDataInterface: 1 */
363 
364  /*ACM Functional Descriptor*/
365  0x04, /* bFunctionLength */
366  0x24, /* bDescriptorType: CS_INTERFACE */
367  0x02, /* bDescriptorSubtype: Abstract Control Management desc */
368  0x02, /* bmCapabilities */
369 
370  /*Union Functional Descriptor*/
371  0x05, /* bFunctionLength */
372  0x24, /* bDescriptorType: CS_INTERFACE */
373  0x06, /* bDescriptorSubtype: Union func desc */
374  0x00, /* bMasterInterface: Communication class interface */
375  0x01, /* bSlaveInterface0: Data Class Interface */
376 
377  /*Endpoint 2 Descriptor*/
378  0x07, /* bLength: Endpoint Descriptor size */
379  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
380  CDC_CMD_EP, /* bEndpointAddress */
381  0x03, /* bmAttributes: Interrupt */
382  LOBYTE(CDC_CMD_PACKET_SZE), /* wMaxPacketSize: */
384  0xFF, /* bInterval: */
385 
386  /*---------------------------------------------------------------------------*/
387 
388  /*Data class interface descriptor*/
389  0x09, /* bLength: Endpoint Descriptor size */
390  USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: */
391  0x01, /* bInterfaceNumber: Number of Interface */
392  0x00, /* bAlternateSetting: Alternate setting */
393  0x02, /* bNumEndpoints: Two endpoints used */
394  0x0A, /* bInterfaceClass: CDC */
395  0x00, /* bInterfaceSubClass: */
396  0x00, /* bInterfaceProtocol: */
397  0x00, /* iInterface: */
398 
399  /*Endpoint OUT Descriptor*/
400  0x07, /* bLength: Endpoint Descriptor size */
401  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
402  CDC_OUT_EP, /* bEndpointAddress */
403  0x02, /* bmAttributes: Bulk */
404  0x40, /* wMaxPacketSize: */
405  0x00,
406  0x00, /* bInterval: ignore for Bulk transfer */
407 
408  /*Endpoint IN Descriptor*/
409  0x07, /* bLength: Endpoint Descriptor size */
410  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
411  CDC_IN_EP, /* bEndpointAddress */
412  0x02, /* bmAttributes: Bulk */
413  0x40, /* wMaxPacketSize: */
414  0x00,
415  0x00 /* bInterval */
416 };
417 #endif /* USE_USB_OTG_HS */
418 
434 uint8_t usbd_cdc_Init (void *pdev,
435  uint8_t cfgidx)
436 {
437  uint8_t *pbuf;
438 
439  (void)pdev;
440  (void)cfgidx;
441  /* Open EP IN */
442  DCD_EP_Open(pdev,
443  CDC_IN_EP,
446 
447  /* Open EP OUT */
448  DCD_EP_Open(pdev,
449  CDC_OUT_EP,
452 
453  /* Open Command IN EP */
454  DCD_EP_Open(pdev,
455  CDC_CMD_EP,
458 
459  pbuf = (uint8_t *)USBD_DeviceDesc;
460  pbuf[4] = DEVICE_CLASS_CDC;
461  pbuf[5] = DEVICE_SUBCLASS_CDC;
462 
463  /* Initialize the Interface physical components */
464  APP_FOPS.pIf_Init();
465 
466  /* Prepare Out endpoint to receive next packet */
467  DCD_EP_PrepareRx(pdev,
468  CDC_OUT_EP,
469  (uint8_t*)(USB_Rx_Buffer),
471 
472  return USBD_OK;
473 }
474 
482 uint8_t usbd_cdc_DeInit (void *pdev,
483  uint8_t cfgidx)
484 {
485  (void)pdev;
486  (void)cfgidx;
487  /* Open EP IN */
488  DCD_EP_Close(pdev,
489  CDC_IN_EP);
490 
491  /* Open EP OUT */
492  DCD_EP_Close(pdev,
493  CDC_OUT_EP);
494 
495  /* Open Command IN EP */
496  DCD_EP_Close(pdev,
497  CDC_CMD_EP);
498 
499  /* Restore default state of the Interface physical components */
500  APP_FOPS.pIf_DeInit();
501 
502  return USBD_OK;
503 }
504 
512 uint8_t usbd_cdc_Setup (void *pdev,
513  USB_SETUP_REQ *req)
514 {
515  switch (req->bmRequest & USB_REQ_TYPE_MASK)
516  {
517  /* CDC Class Requests -------------------------------*/
518  case USB_REQ_TYPE_CLASS :
519  /* Check if the request is a data setup packet */
520  if (req->wLength)
521  {
522  /* Check if the request is Device-to-Host */
523  if (req->bmRequest & 0x80)
524  {
525  /* Get the data to be sent to Host from interface layer */
526  APP_FOPS.pIf_Ctrl(req->bRequest, CmdBuff, req->wLength);
527 
528  /* Send the data to the host */
529  USBD_CtlSendData (pdev,
530  CmdBuff,
531  req->wLength);
532  }
533  else /* Host-to-Device request */
534  {
535  /* Set the value of the current command to be processed */
536  cdcCmd = req->bRequest;
537  cdcLen = req->wLength;
538 
539  /* Prepare the reception of the buffer over EP0
540  Next step: the received data will be managed in usbd_cdc_EP0_TxSent()
541  function. */
542  USBD_CtlPrepareRx (pdev,
543  CmdBuff,
544  req->wLength);
545  }
546  }
547  else /* No Data request */
548  {
549  /* Transfer the command to the interface layer */
550  APP_FOPS.pIf_Ctrl(req->bRequest, (uint8_t *)&req->wValue, sizeof(req->wValue));
551  }
552 
553  return USBD_OK;
554 
555  default:
556  USBD_CtlError (pdev, req);
557  return USBD_FAIL;
558 
559  /* Standard Requests -------------------------------*/
561  switch (req->bRequest)
562  {
564  USBD_CtlError (pdev, req);
565  return USBD_FAIL;
566 
567  case USB_REQ_GET_INTERFACE :
568  USBD_CtlSendData (pdev,
569  (uint8_t *)&usbd_cdc_AltSet,
570  1);
571  break;
572 
573  case USB_REQ_SET_INTERFACE :
574  if ((uint8_t)(req->wValue) < USBD_ITF_MAX_NUM)
575  {
576  usbd_cdc_AltSet = (uint8_t)(req->wValue);
577  }
578  else
579  {
580  /* Call the error management function (command will be nacked */
581  USBD_CtlError (pdev, req);
582  }
583  break;
584  }
585  }
586  return USBD_OK;
587 }
588 
595 uint8_t usbd_cdc_EP0_RxReady (void *pdev)
596 {
597  (void)pdev;
598  if (cdcCmd != NO_CMD)
599  {
600  /* Process the data */
601  APP_FOPS.pIf_Ctrl(cdcCmd, CmdBuff, cdcLen);
602 
603  /* Reset the command variable to default value */
604  cdcCmd = NO_CMD;
605  }
606 
607  return USBD_OK;
608 }
609 
610 
618 uint8_t usbd_cdc_DataIn (void *pdev, uint8_t epnum)
619 {
620  (void)pdev;
621  (void)epnum;
622  uint16_t USB_Tx_ptr;
623  uint16_t USB_Tx_length;
624 
625  if (USB_Tx_State == USB_CDC_BUSY)
626  {
627  if (APP_Rx_length == 0)
628  {
630  }
631  else
632  {
634  USB_Tx_ptr = APP_Rx_ptr_out;
635  USB_Tx_length = CDC_DATA_IN_PACKET_SIZE;
636 
639  }
640  else
641  {
642  USB_Tx_ptr = APP_Rx_ptr_out;
643  USB_Tx_length = APP_Rx_length;
644 
646  APP_Rx_length = 0;
647  if(USB_Tx_length == CDC_DATA_IN_PACKET_SIZE)
648  {
650  }
651  }
652 
653  /* Prepare the available data buffer to be sent on IN endpoint */
654  DCD_EP_Tx (pdev,
655  CDC_IN_EP,
656  (uint8_t*)&APP_Rx_Buffer[USB_Tx_ptr],
657  USB_Tx_length);
658  return USBD_OK;
659  }
660  }
661 
662  /* Avoid any asynchronous transfer during ZLP */
663  if (USB_Tx_State == USB_CDC_ZLP)
664  {
665  /*Send ZLP to indicate the end of the current transfer */
666  DCD_EP_Tx (pdev,
667  CDC_IN_EP,
668  NULL,
669  0);
670 
672  }
673  return USBD_OK;
674 }
675 
683 uint8_t usbd_cdc_DataOut (void *pdev, uint8_t epnum)
684 {
685  uint16_t USB_Rx_Cnt;
686 
687  /* Get the received data buffer and update the counter */
688  USB_Rx_Cnt = ((USB_OTG_CORE_HANDLE*)pdev)->dev.out_ep[epnum].xfer_count;
689 
690  /* USB data will be immediately processed, this allow next USB traffic being
691  NAKed till the end of the application Xfer */
692  APP_FOPS.pIf_DataRx(USB_Rx_Buffer, USB_Rx_Cnt);
693 
694  /* Prepare Out endpoint to receive next packet */
695  DCD_EP_PrepareRx(pdev,
696  CDC_OUT_EP,
697  (uint8_t*)(USB_Rx_Buffer),
699 
700  return USBD_OK;
701 }
702 
710 uint8_t usbd_cdc_SOF (void *pdev)
711 {
712  static uint32_t FrameCount = 0;
713 
714  if (FrameCount++ == CDC_IN_FRAME_INTERVAL)
715  {
716  /* Reset the frame counter */
717  FrameCount = 0;
718 
719  /* Check the data to be sent through IN pipe */
720  Handle_USBAsynchXfer(pdev);
721  }
722 
723  return USBD_OK;
724 }
725 
732 static void Handle_USBAsynchXfer (void *pdev)
733 {
734  uint16_t USB_Tx_ptr;
735  uint16_t USB_Tx_length;
736 
738  {
740  {
741  APP_Rx_ptr_out = 0;
742  }
743 
745  {
747  return;
748  }
749 
750  if(APP_Rx_ptr_out > APP_Rx_ptr_in) /* rollback */
751  {
753 
754  }
755  else
756  {
758 
759  }
760 #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
761  APP_Rx_length &= ~0x03;
762 #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
763 
765  {
766  USB_Tx_ptr = APP_Rx_ptr_out;
767  USB_Tx_length = CDC_DATA_IN_PACKET_SIZE;
768 
772  }
773  else
774  {
775  USB_Tx_ptr = APP_Rx_ptr_out;
776  USB_Tx_length = APP_Rx_length;
777 
779  APP_Rx_length = 0;
780  if(USB_Tx_length == CDC_DATA_IN_PACKET_SIZE)
781  {
783  }
784  else
785  {
787  }
788  }
789 
790  DCD_EP_Tx (pdev,
791  CDC_IN_EP,
792  (uint8_t*)&APP_Rx_Buffer[USB_Tx_ptr],
793  USB_Tx_length);
794  }
795 }
796 
804 static uint8_t *USBD_cdc_GetCfgDesc (uint8_t speed, uint16_t *length)
805 {
806  (void)speed;
807  *length = sizeof (usbd_cdc_CfgDesc);
808  return usbd_cdc_CfgDesc;
809 }
810 
818 #ifdef USE_USB_OTG_HS
819 static uint8_t *USBD_cdc_GetOtherCfgDesc (uint8_t speed, uint16_t *length)
820 {
821  *length = sizeof (usbd_cdc_OtherCfgDesc);
822  return usbd_cdc_OtherCfgDesc;
823 }
824 #endif
825 
837 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#define DEVICE_SUBCLASS_CDC
Definition: usbd_cdc_core.h:52
uint8_t usbd_cdc_DataOut(void *pdev, uint8_t epnum)
usbd_cdc_DataOut Data received on non-control Out endpoint
void USBD_CtlError(USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req)
USBD_CtlError Handle USB low level Error.
Definition: usbd_req.c:813
#define USB_REQ_TYPE_STANDARD
Definition: usbd_def.h:67
header file for the usbd_req.c file
uint32_t DCD_EP_Tx(USB_OTG_CORE_HANDLE *pdev, uint8_t ep_addr, uint8_t *pbuf, uint32_t buf_len)
Transmit data over USB.
Definition: usb_dcd.c:271
uint32_t DCD_EP_Close(USB_OTG_CORE_HANDLE *pdev, uint8_t ep_addr)
called when an EP is disabled
Definition: usb_dcd.c:204
#define USB_CDC_IDLE
Definition: usbd_cdc_core.c:94
uint16_t(* pIf_DeInit)(void)
Definition: usbd_cdc_core.h:96
uint8_t USBD_DeviceDesc[USB_SIZ_DEVICE_DESC]
#define CDC_IN_EP
Definition: usbd_conf.h:39
#define USB_REQ_TYPE_CLASS
Definition: usbd_def.h:68
USBD_Status USBD_CtlSendData(USB_OTG_CORE_HANDLE *pdev, uint8_t *buf, uint16_t len)
USBD_CtlSendData send data on the ctl pipe.
Definition: usbd_ioreq.c:95
uint8_t usbd_cdc_DataIn(void *pdev, uint8_t epnum)
usbd_audio_DataIn Data sent on non-control IN endpoint
#define USB_REQ_SET_INTERFACE
Definition: usbd_def.h:86
#define USB_REQ_GET_INTERFACE
Definition: usbd_def.h:85
uint16_t(* pIf_DataRx)(uint8_t *Buf, uint32_t Len)
Definition: usbd_cdc_core.h:99
#define USB_OTG_EP_INT
Definition: usb_dcd.h:52
uint8_t usbd_cdc_DeInit(void *pdev, uint8_t cfgidx)
usbd_cdc_Init DeInitialize the CDC layer
#define USBD_ITF_MAX_NUM
Definition: usbd_conf.h:33
static uint32_t cdcCmd
#define CDC_IN_FRAME_INTERVAL
Definition: usbd_conf.h:59
static uint8_t * USBD_cdc_GetCfgDesc(uint8_t speed, uint16_t *length)
USBD_cdc_GetCfgDesc Return configuration descriptor.
header file for the usbd_cdc_core.c file.
#define USB_CDC_ZLP
Definition: usbd_cdc_core.c:96
#define CDC_DATA_OUT_PACKET_SIZE
Definition: usbd_cdc_core.h:65
#define USB_CONFIGURATION_DESCRIPTOR_TYPE
Definition: usbd_cdc_core.h:56
USBD_Class_cb_TypeDef USBD_CDC_cb
#define CDC_CMD_EP
Definition: usbd_conf.h:41
#define USB_CDC_BUSY
Definition: usbd_cdc_core.c:95
#define __IO
Definition: core_cm0.h:198
#define CDC_DATA_MAX_PACKET_SIZE
Definition: usbd_conf.h:56
#define USB_CDC_CONFIG_DESC_SIZ
Definition: usbd_cdc_core.h:48
uint32_t DCD_EP_Open(USB_OTG_CORE_HANDLE *pdev, uint8_t ep_addr, uint16_t ep_mps, uint8_t ep_type)
Configure an EP.
Definition: usb_dcd.c:165
USBD_Status USBD_CtlPrepareRx(USB_OTG_CORE_HANDLE *pdev, uint8_t *pbuf, uint16_t len)
USBD_CtlPrepareRx receive data on the ctl pipe.
Definition: usbd_ioreq.c:138
uint16_t(* pIf_Ctrl)(uint32_t Cmd, uint8_t *Buf, uint32_t Len)
Definition: usbd_cdc_core.h:97
#define __ALIGN_BEGIN
uint32_t APP_Rx_length
#define APP_RX_DATA_SIZE
Definition: usbd_conf.h:60
CDC_IF_Prop_TypeDef APP_FOPS
uint8_t APP_Rx_Buffer[]
static uint32_t cdcLen
#define USB_SIZ_DEVICE_DESC
Definition: usbd_desc.h:47
#define USB_INTERFACE_DESCRIPTOR_TYPE
Definition: usbd_cdc_core.h:58
#define USB_REQ_GET_DESCRIPTOR
Definition: usbd_def.h:81
uint8_t bmRequest
Definition: usb_core.h:182
uint8_t usbd_cdc_EP0_RxReady(void *pdev)
usbd_cdc_EP0_RxReady Data received on control endpoint
#define CDC_OUT_EP
Definition: usbd_conf.h:40
#define USB_OTG_EP_BULK
Definition: usb_dcd.h:51
uint32_t DCD_EP_PrepareRx(USB_OTG_CORE_HANDLE *pdev, uint8_t ep_addr, uint8_t *pbuf, uint16_t buf_len)
DCD_EP_PrepareRx.
Definition: usb_dcd.c:231
#define CDC_DATA_IN_PACKET_SIZE
Definition: usbd_cdc_core.h:63
#define DEVICE_CLASS_CDC
Definition: usbd_cdc_core.h:51
static void Handle_USBAsynchXfer(void *pdev)
Handle_USBAsynchXfer Send data to USB.
#define CDC_CMD_PACKET_SZE
Definition: usbd_conf.h:57
uint8_t USB_Tx_State
uint16_t wLength
Definition: usb_core.h:186
uint8_t bRequest
Definition: usb_core.h:183
#define NULL
Definition: usbd_def.h:50
#define HIBYTE(x)
Definition: usbd_def.h:126
#define LOBYTE(x)
Definition: usbd_def.h:125
uint8_t usbd_cdc_SOF(void *pdev)
usbd_audio_SOF Start Of Frame event management
uint32_t APP_Rx_ptr_in
uint8_t usbd_cdc_Setup(void *pdev, USB_SETUP_REQ *req)
usbd_cdc_Setup Handle the CDC specific requests
#define USB_ENDPOINT_DESCRIPTOR_TYPE
Definition: usbd_cdc_core.h:59
#define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION
Definition: usbd_def.h:95
#define NO_CMD
Definition: usbd_cdc_core.h:83
#define USB_REQ_TYPE_MASK
Definition: usbd_def.h:70
uint16_t(* pIf_Init)(void)
Definition: usbd_cdc_core.h:95
uint32_t APP_Rx_ptr_out
uint16_t wValue
Definition: usb_core.h:184
uint8_t usbd_cdc_Init(void *pdev, uint8_t cfgidx)
usbd_cdc_Init Initialize the CDC interface
__ALIGN_BEGIN uint8_t usbd_cdc_CfgDesc[USB_CDC_CONFIG_DESC_SIZ] __ALIGN_END
header file for the usbd_desc.c file


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:50