STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
usbh_cdc.c
Go to the documentation of this file.
1 
48 /* Includes ------------------------------------------------------------------*/
49 #include "usbh_cdc.h"
50 
79 #define USBH_CDC_BUFFER_SIZE 1024
80 
105 static USBH_StatusTypeDef USBH_CDC_InterfaceInit (USBH_HandleTypeDef *phost);
106 
107 static USBH_StatusTypeDef USBH_CDC_InterfaceDeInit (USBH_HandleTypeDef *phost);
108 
109 static USBH_StatusTypeDef USBH_CDC_Process(USBH_HandleTypeDef *phost);
110 
111 static USBH_StatusTypeDef USBH_CDC_SOFProcess(USBH_HandleTypeDef *phost);
112 
113 static USBH_StatusTypeDef USBH_CDC_ClassRequest (USBH_HandleTypeDef *phost);
114 
115 static USBH_StatusTypeDef GetLineCoding(USBH_HandleTypeDef *phost,
117 
118 static USBH_StatusTypeDef SetLineCoding(USBH_HandleTypeDef *phost,
120 
121 static void CDC_ProcessTransmission(USBH_HandleTypeDef *phost);
122 
123 static void CDC_ProcessReception(USBH_HandleTypeDef *phost);
124 
126 {
127  "CDC",
129  USBH_CDC_InterfaceInit,
130  USBH_CDC_InterfaceDeInit,
131  USBH_CDC_ClassRequest,
132  USBH_CDC_Process,
133  USBH_CDC_SOFProcess,
134  NULL,
135 };
151 static USBH_StatusTypeDef USBH_CDC_InterfaceInit (USBH_HandleTypeDef *phost)
152 {
153 
154  USBH_StatusTypeDef status = USBH_FAIL ;
155  uint8_t interface;
156  CDC_HandleTypeDef *CDC_Handle;
157 
158  interface = USBH_FindInterface(phost,
159  COMMUNICATION_INTERFACE_CLASS_CODE,
160  ABSTRACT_CONTROL_MODEL,
161  COMMON_AT_COMMAND);
162 
163  if(interface == 0xFF) /* No Valid Interface */
164  {
165  USBH_DbgLog ("Cannot Find the interface for Communication Interface Class.", phost->pActiveClass->Name);
166  }
167  else
168  {
169  USBH_SelectInterface (phost, interface);
170  phost->pActiveClass->pData = (CDC_HandleTypeDef *)USBH_malloc (sizeof(CDC_HandleTypeDef));
171  CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData;
172 
173  /*Collect the notification endpoint address and length*/
174  if(phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[0].bEndpointAddress & 0x80)
175  {
176  CDC_Handle->CommItf.NotifEp = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[0].bEndpointAddress;
177  CDC_Handle->CommItf.NotifEpSize = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[0].wMaxPacketSize;
178  }
179 
180  /*Allocate the length for host channel number in*/
181  CDC_Handle->CommItf.NotifPipe = USBH_AllocPipe(phost, CDC_Handle->CommItf.NotifEp);
182 
183  /* Open pipe for Notification endpoint */
184  USBH_OpenPipe (phost,
185  CDC_Handle->CommItf.NotifPipe,
186  CDC_Handle->CommItf.NotifEp,
187  phost->device.address,
188  phost->device.speed,
190  CDC_Handle->CommItf.NotifEpSize);
191 
192  USBH_LL_SetToggle (phost, CDC_Handle->CommItf.NotifPipe, 0);
193 
194  interface = USBH_FindInterface(phost,
195  DATA_INTERFACE_CLASS_CODE,
196  RESERVED,
197  NO_CLASS_SPECIFIC_PROTOCOL_CODE);
198 
199  if(interface == 0xFF) /* No Valid Interface */
200  {
201  USBH_DbgLog ("Cannot Find the interface for Data Interface Class.", phost->pActiveClass->Name);
202  }
203  else
204  {
205  /*Collect the class specific endpoint address and length*/
206  if(phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[0].bEndpointAddress & 0x80)
207  {
208  CDC_Handle->DataItf.InEp = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[0].bEndpointAddress;
209  CDC_Handle->DataItf.InEpSize = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[0].wMaxPacketSize;
210  }
211  else
212  {
213  CDC_Handle->DataItf.OutEp = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[0].bEndpointAddress;
214  CDC_Handle->DataItf.OutEpSize = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[0].wMaxPacketSize;
215  }
216 
217  if(phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[1].bEndpointAddress & 0x80)
218  {
219  CDC_Handle->DataItf.InEp = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[1].bEndpointAddress;
220  CDC_Handle->DataItf.InEpSize = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[1].wMaxPacketSize;
221  }
222  else
223  {
224  CDC_Handle->DataItf.OutEp = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[1].bEndpointAddress;
225  CDC_Handle->DataItf.OutEpSize = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[1].wMaxPacketSize;
226  }
227 
228  /*Allocate the length for host channel number out*/
229  CDC_Handle->DataItf.OutPipe = USBH_AllocPipe(phost, CDC_Handle->DataItf.OutEp);
230 
231  /*Allocate the length for host channel number in*/
232  CDC_Handle->DataItf.InPipe = USBH_AllocPipe(phost, CDC_Handle->DataItf.InEp);
233 
234  /* Open channel for OUT endpoint */
235  USBH_OpenPipe (phost,
236  CDC_Handle->DataItf.OutPipe,
237  CDC_Handle->DataItf.OutEp,
238  phost->device.address,
239  phost->device.speed,
241  CDC_Handle->DataItf.OutEpSize);
242  /* Open channel for IN endpoint */
243  USBH_OpenPipe (phost,
244  CDC_Handle->DataItf.InPipe,
245  CDC_Handle->DataItf.InEp,
246  phost->device.address,
247  phost->device.speed,
249  CDC_Handle->DataItf.InEpSize);
250 
251  CDC_Handle->state = CDC_IDLE_STATE;
252 
253  USBH_LL_SetToggle (phost, CDC_Handle->DataItf.OutPipe,0);
254  USBH_LL_SetToggle (phost, CDC_Handle->DataItf.InPipe,0);
255  status = USBH_OK;
256  }
257  }
258  return status;
259 }
260 
261 
262 
269 USBH_StatusTypeDef USBH_CDC_InterfaceDeInit (USBH_HandleTypeDef *phost)
270 {
271  CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData;
272 
273  if ( CDC_Handle->CommItf.NotifPipe)
274  {
275  USBH_ClosePipe(phost, CDC_Handle->CommItf.NotifPipe);
276  USBH_FreePipe (phost, CDC_Handle->CommItf.NotifPipe);
277  CDC_Handle->CommItf.NotifPipe = 0; /* Reset the Channel as Free */
278  }
279 
280  if ( CDC_Handle->DataItf.InPipe)
281  {
282  USBH_ClosePipe(phost, CDC_Handle->DataItf.InPipe);
283  USBH_FreePipe (phost, CDC_Handle->DataItf.InPipe);
284  CDC_Handle->DataItf.InPipe = 0; /* Reset the Channel as Free */
285  }
286 
287  if ( CDC_Handle->DataItf.OutPipe)
288  {
289  USBH_ClosePipe(phost, CDC_Handle->DataItf.OutPipe);
290  USBH_FreePipe (phost, CDC_Handle->DataItf.OutPipe);
291  CDC_Handle->DataItf.OutPipe = 0; /* Reset the Channel as Free */
292  }
293 
294  if(phost->pActiveClass->pData)
295  {
296  USBH_free (phost->pActiveClass->pData);
297  phost->pActiveClass->pData = 0;
298  }
299 
300  return USBH_OK;
301 }
302 
310 static USBH_StatusTypeDef USBH_CDC_ClassRequest (USBH_HandleTypeDef *phost)
311 {
312  USBH_StatusTypeDef status = USBH_FAIL ;
313  CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData;
314 
315  /*Issue the get line coding request*/
316  status = GetLineCoding(phost, &CDC_Handle->LineCoding);
317  if(status == USBH_OK)
318  {
319  phost->pUser(phost, HOST_USER_CLASS_ACTIVE);
320  }
321  return status;
322 }
323 
324 
331 static USBH_StatusTypeDef USBH_CDC_Process (USBH_HandleTypeDef *phost)
332 {
333  USBH_StatusTypeDef status = USBH_BUSY;
334  USBH_StatusTypeDef req_status = USBH_OK;
335  CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData;
336 
337  switch(CDC_Handle->state)
338  {
339 
340  case CDC_IDLE_STATE:
341  status = USBH_OK;
342  break;
343 
345  req_status = SetLineCoding(phost, CDC_Handle->pUserLineCoding);
346 
347  if(req_status == USBH_OK)
348  {
349  CDC_Handle->state = CDC_GET_LAST_LINE_CODING_STATE;
350  }
351 
352  else if(req_status != USBH_BUSY)
353  {
354  CDC_Handle->state = CDC_ERROR_STATE;
355  }
356  break;
357 
358 
360  req_status = GetLineCoding(phost, &(CDC_Handle->LineCoding));
361 
362  if(req_status == USBH_OK)
363  {
364  CDC_Handle->state = CDC_IDLE_STATE;
365 
366  if((CDC_Handle->LineCoding.b.bCharFormat == CDC_Handle->pUserLineCoding->b.bCharFormat) &&
367  (CDC_Handle->LineCoding.b.bDataBits == CDC_Handle->pUserLineCoding->b.bDataBits) &&
368  (CDC_Handle->LineCoding.b.bParityType == CDC_Handle->pUserLineCoding->b.bParityType) &&
369  (CDC_Handle->LineCoding.b.dwDTERate == CDC_Handle->pUserLineCoding->b.dwDTERate))
370  {
372  }
373  }
374 
375  else if(req_status != USBH_BUSY)
376  {
377  CDC_Handle->state = CDC_ERROR_STATE;
378  }
379 
380  break;
381 
382  case CDC_TRANSFER_DATA:
383  CDC_ProcessTransmission(phost);
384  CDC_ProcessReception(phost);
385  break;
386 
387  case CDC_ERROR_STATE:
388  req_status = USBH_ClrFeature(phost, 0x00);
389 
390  if(req_status == USBH_OK )
391  {
392  /*Change the state to waiting*/
393  CDC_Handle->state = CDC_IDLE_STATE ;
394  }
395  break;
396 
397  default:
398  break;
399 
400  }
401 
402  return status;
403 }
404 
411 static USBH_StatusTypeDef USBH_CDC_SOFProcess (USBH_HandleTypeDef *phost)
412 {
413  return USBH_OK;
414 }
415 
416 
424 {
425  CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData;
426 
427  if(phost->gState == HOST_CLASS)
428  {
429  CDC_Handle->state = CDC_IDLE_STATE;
430 
431  USBH_ClosePipe(phost, CDC_Handle->CommItf.NotifPipe);
432  USBH_ClosePipe(phost, CDC_Handle->DataItf.InPipe);
433  USBH_ClosePipe(phost, CDC_Handle->DataItf.OutPipe);
434  }
435  return USBH_OK;
436 }
444 {
445 
447  USB_REQ_RECIPIENT_INTERFACE;
448 
450  phost->Control.setup.b.wValue.w = 0;
451  phost->Control.setup.b.wIndex.w = 0;
453 
454  return USBH_CtlReq(phost, linecoding->Array, LINE_CODING_STRUCTURE_SIZE);
455 }
456 
457 
466 static USBH_StatusTypeDef SetLineCoding(USBH_HandleTypeDef *phost, CDC_LineCodingTypeDef *linecodin)
467 {
469  USB_REQ_RECIPIENT_INTERFACE;
470 
472  phost->Control.setup.b.wValue.w = 0;
473 
474  phost->Control.setup.b.wIndex.w = 0;
475 
477 
478  return USBH_CtlReq(phost, linecodin->Array , LINE_CODING_STRUCTURE_SIZE );
479 }
480 
487 {
488  CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData;
489  if(phost->gState == HOST_CLASS)
490  {
491  CDC_Handle->state = CDC_SET_LINE_CODING_STATE;
492  CDC_Handle->pUserLineCoding = linecodin;
493 
494 #if (USBH_USE_OS == 1)
495  osMessagePut ( phost->os_event, USBH_CLASS_EVENT, 0);
496 #endif
497  }
498  return USBH_OK;
499 }
500 
507 {
508  CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData;
509 
510  if((phost->gState == HOST_CLASS) ||(phost->gState == HOST_CLASS_REQUEST))
511  {
512  *linecodin = CDC_Handle->LineCoding;
513  return USBH_OK;
514  }
515  else
516  {
517  return USBH_FAIL;
518  }
519 }
520 
527 {
528  CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData;
529 
530  if(phost->gState == HOST_CLASS)
531  {
532  return USBH_LL_GetLastXferSize(phost, CDC_Handle->DataItf.InPipe);;
533  }
534  else
535  {
536  return 0;
537  }
538 }
539 
545 USBH_StatusTypeDef USBH_CDC_Transmit(USBH_HandleTypeDef *phost, uint8_t *pbuff, uint32_t length)
546 {
548  CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData;
549 
550  if((CDC_Handle->state == CDC_IDLE_STATE) || (CDC_Handle->state == CDC_TRANSFER_DATA))
551  {
552  CDC_Handle->pTxData = pbuff;
553  CDC_Handle->TxDataLength = length;
554  CDC_Handle->state = CDC_TRANSFER_DATA;
555  CDC_Handle->data_tx_state = CDC_SEND_DATA;
556  Status = USBH_OK;
557 #if (USBH_USE_OS == 1)
558  osMessagePut ( phost->os_event, USBH_CLASS_EVENT, 0);
559 #endif
560  }
561  return Status;
562 }
563 
564 
570 USBH_StatusTypeDef USBH_CDC_Receive(USBH_HandleTypeDef *phost, uint8_t *pbuff, uint32_t length)
571 {
573  CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData;
574 
575  if((CDC_Handle->state == CDC_IDLE_STATE) || (CDC_Handle->state == CDC_TRANSFER_DATA))
576  {
577  CDC_Handle->pRxData = pbuff;
578  CDC_Handle->RxDataLength = length;
579  CDC_Handle->state = CDC_TRANSFER_DATA;
580  CDC_Handle->data_rx_state = CDC_RECEIVE_DATA;
581  Status = USBH_OK;
582 #if (USBH_USE_OS == 1)
583  osMessagePut ( phost->os_event, USBH_CLASS_EVENT, 0);
584 #endif
585  }
586  return Status;
587 }
588 
594 static void CDC_ProcessTransmission(USBH_HandleTypeDef *phost)
595 {
596  CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData;
597  USBH_URBStateTypeDef URB_Status = USBH_URB_IDLE;
598 
599  switch(CDC_Handle->data_tx_state)
600  {
601 
602  case CDC_SEND_DATA:
603  if(CDC_Handle->TxDataLength > CDC_Handle->DataItf.OutEpSize)
604  {
605  USBH_BulkSendData (phost,
606  CDC_Handle->pTxData,
607  CDC_Handle->DataItf.OutEpSize,
608  CDC_Handle->DataItf.OutPipe,
609  1);
610  }
611  else
612  {
613  USBH_BulkSendData (phost,
614  CDC_Handle->pTxData,
615  CDC_Handle->TxDataLength,
616  CDC_Handle->DataItf.OutPipe,
617  1);
618  }
619 
620  CDC_Handle->data_tx_state = CDC_SEND_DATA_WAIT;
621 
622  break;
623 
624  case CDC_SEND_DATA_WAIT:
625 
626  URB_Status = USBH_LL_GetURBState(phost, CDC_Handle->DataItf.OutPipe);
627 
628  /*Check the status done for transmission*/
629  if(URB_Status == USBH_URB_DONE )
630  {
631  if(CDC_Handle->TxDataLength > CDC_Handle->DataItf.OutEpSize)
632  {
633  CDC_Handle->TxDataLength -= CDC_Handle->DataItf.OutEpSize ;
634  CDC_Handle->pTxData += CDC_Handle->DataItf.OutEpSize;
635  }
636  else
637  {
638  CDC_Handle->TxDataLength = 0;
639  }
640 
641  if( CDC_Handle->TxDataLength > 0)
642  {
643  CDC_Handle->data_tx_state = CDC_SEND_DATA;
644  }
645  else
646  {
647  CDC_Handle->data_tx_state = CDC_IDLE;
649  }
650 #if (USBH_USE_OS == 1)
651  osMessagePut ( phost->os_event, USBH_CLASS_EVENT, 0);
652 #endif
653  }
654  else if( URB_Status == USBH_URB_NOTREADY )
655  {
656  CDC_Handle->data_tx_state = CDC_SEND_DATA;
657 #if (USBH_USE_OS == 1)
658  osMessagePut ( phost->os_event, USBH_CLASS_EVENT, 0);
659 #endif
660  }
661  break;
662  default:
663  break;
664  }
665 }
672 static void CDC_ProcessReception(USBH_HandleTypeDef *phost)
673 {
674  CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData;
675  USBH_URBStateTypeDef URB_Status = USBH_URB_IDLE;
676  uint16_t length;
677 
678  switch(CDC_Handle->data_rx_state)
679  {
680 
681  case CDC_RECEIVE_DATA:
682 
683  USBH_BulkReceiveData (phost,
684  CDC_Handle->pRxData,
685  CDC_Handle->DataItf.InEpSize,
686  CDC_Handle->DataItf.InPipe);
687 
688  CDC_Handle->data_rx_state = CDC_RECEIVE_DATA_WAIT;
689 
690  break;
691 
693 
694  URB_Status = USBH_LL_GetURBState(phost, CDC_Handle->DataItf.InPipe);
695 
696  /*Check the status done for reception*/
697  if(URB_Status == USBH_URB_DONE )
698  {
699  length = USBH_LL_GetLastXferSize(phost, CDC_Handle->DataItf.InPipe);
700 
701  if(((CDC_Handle->RxDataLength - length) > 0) && (length > CDC_Handle->DataItf.InEpSize))
702  {
703  CDC_Handle->RxDataLength -= length ;
704  CDC_Handle->pRxData += length;
705  CDC_Handle->data_rx_state = CDC_RECEIVE_DATA;
706  }
707  else
708  {
709  CDC_Handle->data_rx_state = CDC_IDLE;
711  }
712 #if (USBH_USE_OS == 1)
713  osMessagePut ( phost->os_event, USBH_CLASS_EVENT, 0);
714 #endif
715  }
716  break;
717 
718  default:
719  break;
720  }
721 }
722 
729 {
730 
731 }
732 
739 {
740 
741 }
742 
749 {
750 
751 }
752 
775 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#define USB_H2D
Definition: usbh_def.h:108
USB_Setup_TypeDef setup
Definition: usbh_def.h:412
USBH_StatusTypeDef USBH_OpenPipe(USBH_HandleTypeDef *phost, uint8_t ch_num, uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps)
USBH_Open_Pipe Open a pipe.
Definition: usbh_pipes.c:93
#define USB_D2H
Definition: usbh_def.h:109
USBH_StatusTypeDef USBH_SelectInterface(USBH_HandleTypeDef *phost, uint8_t interface)
USBH_SelectInterface Select current interface.
Definition: usbh_core.c:233
__weak void USBH_CDC_TransmitCallback(USBH_HandleTypeDef *phost)
The function informs user that data have been received.
Definition: usbh_cdc.c:728
USBD_CDC_LineCodingTypeDef linecoding
uint8_t USBH_AllocPipe(USBH_HandleTypeDef *phost, uint8_t ep_addr)
USBH_Alloc_Pipe Allocate a new Pipe.
Definition: usbh_pipes.c:138
uint16_t_uint8_t wValue
Definition: usbh_def.h:223
#define USB_EP_TYPE_INTR
Definition: usbh_def.h:173
USBH_StatusTypeDef USBH_BulkReceiveData(USBH_HandleTypeDef *phost, uint8_t *buff, uint16_t length, uint8_t hc_num)
USBH_BulkReceiveData Receives IN bulk packet from device.
Definition: usbh_ioreq.c:218
#define HOST_USER_CLASS_ACTIVE
Definition: usbh_core.h:65
if(LCD_Lock==DISABLE)
Definition: lcd_log.c:249
uint16_t InEpSize
Definition: usbh_cdc.h:349
USBH_StatusTypeDef USBH_FreePipe(USBH_HandleTypeDef *phost, uint8_t idx)
USBH_Free_Pipe Free the USB Pipe.
Definition: usbh_pipes.c:158
uint8_t USBH_FindInterface(USBH_HandleTypeDef *phost, uint8_t Class, uint8_t SubClass, uint8_t Protocol)
USBH_FindInterface Find the interface index for a specific class.
Definition: usbh_core.c:274
USBH_StatusTypeDef USBH_ClrFeature(USBH_HandleTypeDef *phost, uint8_t ep_num)
USBH_ClrFeature This request is used to clear or disable a specific feature.
Definition: usbh_ctlreq.c:308
USBH_StatusTypeDef USBH_BulkSendData(USBH_HandleTypeDef *phost, uint8_t *buff, uint16_t length, uint8_t hc_num, uint8_t do_ping)
USBH_BulkSendData Sends the Bulk Packet to the device.
Definition: usbh_ioreq.c:186
void(* pUser)(struct _USBH_HandleTypeDef *pHandle, uint8_t id)
Definition: usbh_def.h:464
uint8_t NotifPipe
Definition: usbh_cdc.h:334
uint16_t_uint8_t wLength
Definition: usbh_def.h:225
uint8_t * pRxData
Definition: usbh_cdc.h:359
uint32_t USBH_LL_GetLastXferSize(USBH_HandleTypeDef *phost, uint8_t)
USBH_LL_GetLastXferSize Return the last transferred packet size.
__weak void USBH_CDC_LineCodingChanged(USBH_HandleTypeDef *phost)
The function informs user that Settings have been changed.
Definition: usbh_cdc.c:748
#define USB_EP_TYPE_BULK
Definition: usbh_def.h:172
#define NULL
Definition: usbd_def.h:53
USBH_CtrlTypeDef Control
Definition: usbh_def.h:455
USBH_StatusTypeDef USBH_CDC_Receive(USBH_HandleTypeDef *phost, uint8_t *pbuff, uint32_t length)
This function prepares the state before issuing the class specific commands.
Definition: usbh_cdc.c:570
USBH_StatusTypeDef USBH_CtlReq(USBH_HandleTypeDef *phost, uint8_t *buff, uint16_t length)
USBH_CtlReq USBH_CtlReq sends a control request and provide the status after completion of the reques...
Definition: usbh_ctlreq.c:531
#define USB_CDC_CLASS
Definition: usbh_cdc.h:61
#define USBH_malloc
#define USB_REQ_TYPE_CLASS
Definition: usbd_def.h:74
CDC_CommItfTypedef CommItf
Definition: usbh_cdc.h:356
USBH_ClassTypeDef CDC_Class
Definition: usbh_cdc.c:125
USBH_StatusTypeDef USBH_CDC_Stop(USBH_HandleTypeDef *phost)
USBH_CDC_Stop Stop current CDC Transmission.
Definition: usbh_cdc.c:423
#define LINE_CODING_STRUCTURE_SIZE
Definition: usbh_cdc.h:136
USBH_StatusTypeDef USBH_CDC_Transmit(USBH_HandleTypeDef *phost, uint8_t *pbuff, uint32_t length)
This function prepares the state before issuing the class specific commands.
Definition: usbh_cdc.c:545
CDC_DataItfTypedef DataItf
Definition: usbh_cdc.h:357
uint16_t USBH_CDC_GetLastReceivedDataSize(USBH_HandleTypeDef *phost)
This function return last received data size.
Definition: usbh_cdc.c:526
USBH_URBStateTypeDef
Definition: usbh_def.h:384
uint16_t w
Definition: usbh_def.h:204
USBH_StatusTypeDef USBH_LL_SetToggle(USBH_HandleTypeDef *phost, uint8_t, uint8_t)
USBH_LL_SetToggle Set toggle for a pipe.
USBH_URBStateTypeDef USBH_LL_GetURBState(USBH_HandleTypeDef *phost, uint8_t)
USBH_LL_GetURBState Get a URB state from the low level driver.
uint32_t TxDataLength
Definition: usbh_cdc.h:360
CDC_StateTypeDef state
Definition: usbh_cdc.h:365
USBH_StatusTypeDef USBH_CDC_GetLineCoding(USBH_HandleTypeDef *phost, CDC_LineCodingTypeDef *linecodin)
This function prepares the state before issuing the class specific commands.
Definition: usbh_cdc.c:506
USBH_StatusTypeDef
Definition: usbh_def.h:302
#define USBH_DbgLog(...)
__IO HOST_StateTypeDef gState
Definition: usbh_def.h:452
uint8_t * pTxData
Definition: usbh_cdc.h:358
#define CDC_GET_LINE_CODING
Definition: usbd_cdc.h:77
uint16_t NotifEpSize
Definition: usbh_cdc.h:337
struct _CDC_LineCodingStructure::@36 b
CDC_DataStateTypeDef data_tx_state
Definition: usbh_cdc.h:366
__weak void USBH_CDC_ReceiveCallback(USBH_HandleTypeDef *phost)
The function informs user that data have been sent.
Definition: usbh_cdc.c:738
CDC_LineCodingTypeDef LineCoding
Definition: usbh_cdc.h:363
osStatus osMessagePut(osMessageQId queue_id, uint32_t info, uint32_t millisec)
Put a Message to a Queue.
Definition: cmsis_os.c:951
This file contains all the prototypes for the usbh_cdc.c.
uint16_t OutEpSize
Definition: usbh_cdc.h:348
uint8_t Array[LINE_CODING_STRUCTURE_SIZE]
Definition: usbh_cdc.h:170
CDC_DataStateTypeDef data_rx_state
Definition: usbh_cdc.h:367
USBH_ClassTypeDef * pActiveClass
Definition: usbh_def.h:458
#define USBH_free
USBH_StatusTypeDef USBH_CDC_SetLineCoding(USBH_HandleTypeDef *phost, CDC_LineCodingTypeDef *linecodin)
This function prepares the state before issuing the class specific commands.
Definition: usbh_cdc.c:486
uint16_t_uint8_t wIndex
Definition: usbh_def.h:224
struct _USB_Setup::_SetupPkt_Struc b
CDC_LineCodingTypeDef * pUserLineCoding
Definition: usbh_cdc.h:364
uint32_t RxDataLength
Definition: usbh_cdc.h:361
#define CDC_SET_LINE_CODING
Definition: usbd_cdc.h:76
USBH_StatusTypeDef USBH_ClosePipe(USBH_HandleTypeDef *phost, uint8_t pipe_num)
USBH_ClosePipe Close a pipe.
Definition: usbh_pipes.c:121