STM32L4xx_HAL_Driver  1.14.0
Input and Output operation functions

HCD IO operation functions. More...

Functions

HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest (HCD_HandleTypeDef *hhcd, uint8_t ch_num, uint8_t direction, uint8_t ep_type, uint8_t token, uint8_t *pbuff, uint16_t length, uint8_t do_ping)
 Submit a new URB for processing. More...
 
void HAL_HCD_IRQHandler (HCD_HandleTypeDef *hhcd)
 Handle HCD interrupt request. More...
 
void HAL_HCD_SOF_Callback (HCD_HandleTypeDef *hhcd)
 SOF callback. More...
 
void HAL_HCD_Connect_Callback (HCD_HandleTypeDef *hhcd)
 Connection Event callback. More...
 
void HAL_HCD_Disconnect_Callback (HCD_HandleTypeDef *hhcd)
 Disconnection Event callback. More...
 
void HAL_HCD_PortEnabled_Callback (HCD_HandleTypeDef *hhcd)
 Port Enabled Event callback. More...
 
void HAL_HCD_PortDisabled_Callback (HCD_HandleTypeDef *hhcd)
 Port Disabled Event callback. More...
 
void HAL_HCD_HC_NotifyURBChange_Callback (HCD_HandleTypeDef *hhcd, uint8_t chnum, HCD_URBStateTypeDef urb_state)
 Notify URB state change callback. More...
 
HAL_StatusTypeDef HAL_HCD_RegisterCallback (HCD_HandleTypeDef *hhcd, HAL_HCD_CallbackIDTypeDef CallbackID, pHCD_CallbackTypeDef pCallback)
 Register a User USB HCD Callback To be used instead of the weak predefined callback. More...
 
HAL_StatusTypeDef HAL_HCD_UnRegisterCallback (HCD_HandleTypeDef *hhcd, HAL_HCD_CallbackIDTypeDef CallbackID)
 Unregister an USB HCD Callback USB HCD callabck is redirected to the weak predefined callback. More...
 
HAL_StatusTypeDef HAL_HCD_RegisterHC_NotifyURBChangeCallback (HCD_HandleTypeDef *hhcd, pHCD_HC_NotifyURBChangeCallbackTypeDef pCallback)
 Register USB HCD Host Channel Notify URB Change Callback To be used instead of the weak HAL_HCD_HC_NotifyURBChange_Callback() predefined callback. More...
 
HAL_StatusTypeDef HAL_HCD_UnRegisterHC_NotifyURBChangeCallback (HCD_HandleTypeDef *hhcd)
 UnRegister the USB HCD Host Channel Notify URB Change Callback USB HCD Host Channel Notify URB Change Callback is redirected to the weak HAL_HCD_HC_NotifyURBChange_Callback() predefined callback. More...
 

Detailed Description

HCD IO operation functions.

 ===============================================================================
                      ##### IO operation functions #####
 ===============================================================================
 [..] This subsection provides a set of functions allowing to manage the USB Host Data
    Transfer

Function Documentation

◆ HAL_HCD_Connect_Callback()

__weak void HAL_HCD_Connect_Callback ( HCD_HandleTypeDef hhcd)

Connection Event callback.

Parameters
hhcdHCD handle
Return values
None

Definition at line 620 of file stm32l4xx_hal_hcd.c.

621 {
622  /* Prevent unused argument(s) compilation warning */
623  UNUSED(hhcd);
624 
625  /* NOTE : This function should not be modified, when the callback is needed,
626  the HAL_HCD_Connect_Callback could be implemented in the user file
627  */
628 }

◆ HAL_HCD_Disconnect_Callback()

__weak void HAL_HCD_Disconnect_Callback ( HCD_HandleTypeDef hhcd)

Disconnection Event callback.

Parameters
hhcdHCD handle
Return values
None

Definition at line 635 of file stm32l4xx_hal_hcd.c.

636 {
637  /* Prevent unused argument(s) compilation warning */
638  UNUSED(hhcd);
639 
640  /* NOTE : This function should not be modified, when the callback is needed,
641  the HAL_HCD_Disconnect_Callback could be implemented in the user file
642  */
643 }

◆ HAL_HCD_HC_NotifyURBChange_Callback()

__weak void HAL_HCD_HC_NotifyURBChange_Callback ( HCD_HandleTypeDef hhcd,
uint8_t  chnum,
HCD_URBStateTypeDef  urb_state 
)

Notify URB state change callback.

Parameters
hhcdHCD handle
chnumChannel number. This parameter can be a value from 1 to 15
urb_stateThis parameter can be one of these values: URB_IDLE/ URB_DONE/ URB_NOTREADY/ URB_NYET/ URB_ERROR/ URB_STALL/
Return values
None

Definition at line 690 of file stm32l4xx_hal_hcd.c.

691 {
692  /* Prevent unused argument(s) compilation warning */
693  UNUSED(hhcd);
694  UNUSED(chnum);
695  UNUSED(urb_state);
696 
697  /* NOTE : This function should not be modified, when the callback is needed,
698  the HAL_HCD_HC_NotifyURBChange_Callback could be implemented in the user file
699  */
700 }

◆ HAL_HCD_HC_SubmitRequest()

HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest ( HCD_HandleTypeDef hhcd,
uint8_t  ch_num,
uint8_t  direction,
uint8_t  ep_type,
uint8_t  token,
uint8_t *  pbuff,
uint16_t  length,
uint8_t  do_ping 
)

Submit a new URB for processing.

Parameters
hhcdHCD handle
ch_numChannel number. This parameter can be a value from 1 to 15
directionChannel number. This parameter can be one of these values: 0 : Output / 1 : Input
ep_typeEndpoint Type. This parameter can be one of these values: EP_TYPE_CTRL: Control type/ EP_TYPE_ISOC: Isochronous type/ EP_TYPE_BULK: Bulk type/ EP_TYPE_INTR: Interrupt type/
tokenEndpoint Type. This parameter can be one of these values: 0: HC_PID_SETUP / 1: HC_PID_DATA1
pbuffpointer to URB data
lengthLength of URB data
do_pingactivate do ping protocol (for high speed only). This parameter can be one of these values: 0 : do ping inactive / 1 : do ping active
Return values
HALstatus

Definition at line 363 of file stm32l4xx_hal_hcd.c.

371 {
372  UNUSED(do_ping);
373 
374  hhcd->hc[ch_num].ep_is_in = direction;
375  hhcd->hc[ch_num].ep_type = ep_type;
376 
377  if (token == 0U)
378  {
379  hhcd->hc[ch_num].data_pid = HC_PID_SETUP;
380  }
381  else
382  {
383  hhcd->hc[ch_num].data_pid = HC_PID_DATA1;
384  }
385 
386  /* Manage Data Toggle */
387  switch (ep_type)
388  {
389  case EP_TYPE_CTRL:
390  if ((token == 1U) && (direction == 0U)) /*send data */
391  {
392  if (length == 0U)
393  {
394  /* For Status OUT stage, Length==0, Status Out PID = 1 */
395  hhcd->hc[ch_num].toggle_out = 1U;
396  }
397 
398  /* Set the Data Toggle bit as per the Flag */
399  if (hhcd->hc[ch_num].toggle_out == 0U)
400  {
401  /* Put the PID 0 */
402  hhcd->hc[ch_num].data_pid = HC_PID_DATA0;
403  }
404  else
405  {
406  /* Put the PID 1 */
407  hhcd->hc[ch_num].data_pid = HC_PID_DATA1;
408  }
409  }
410  break;
411 
412  case EP_TYPE_BULK:
413  if (direction == 0U)
414  {
415  /* Set the Data Toggle bit as per the Flag */
416  if (hhcd->hc[ch_num].toggle_out == 0U)
417  {
418  /* Put the PID 0 */
419  hhcd->hc[ch_num].data_pid = HC_PID_DATA0;
420  }
421  else
422  {
423  /* Put the PID 1 */
424  hhcd->hc[ch_num].data_pid = HC_PID_DATA1;
425  }
426  }
427  else
428  {
429  if (hhcd->hc[ch_num].toggle_in == 0U)
430  {
431  hhcd->hc[ch_num].data_pid = HC_PID_DATA0;
432  }
433  else
434  {
435  hhcd->hc[ch_num].data_pid = HC_PID_DATA1;
436  }
437  }
438 
439  break;
440  case EP_TYPE_INTR:
441  if (direction == 0U)
442  {
443  /* Set the Data Toggle bit as per the Flag */
444  if (hhcd->hc[ch_num].toggle_out == 0U)
445  {
446  /* Put the PID 0 */
447  hhcd->hc[ch_num].data_pid = HC_PID_DATA0;
448  }
449  else
450  {
451  /* Put the PID 1 */
452  hhcd->hc[ch_num].data_pid = HC_PID_DATA1;
453  }
454  }
455  else
456  {
457  if (hhcd->hc[ch_num].toggle_in == 0U)
458  {
459  hhcd->hc[ch_num].data_pid = HC_PID_DATA0;
460  }
461  else
462  {
463  hhcd->hc[ch_num].data_pid = HC_PID_DATA1;
464  }
465  }
466  break;
467 
468  case EP_TYPE_ISOC:
469  hhcd->hc[ch_num].data_pid = HC_PID_DATA0;
470  break;
471 
472  default:
473  break;
474  }
475 
476  hhcd->hc[ch_num].xfer_buff = pbuff;
477  hhcd->hc[ch_num].xfer_len = length;
478  hhcd->hc[ch_num].urb_state = URB_IDLE;
479  hhcd->hc[ch_num].xfer_count = 0U;
480  hhcd->hc[ch_num].ch_num = ch_num;
481  hhcd->hc[ch_num].state = HC_IDLE;
482 
483  return USB_HC_StartXfer(hhcd->Instance, &hhcd->hc[ch_num]);
484 }
HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_HCTypeDef *hc)
Start a transfer over a host channel.

◆ HAL_HCD_IRQHandler()

void HAL_HCD_IRQHandler ( HCD_HandleTypeDef hhcd)

Handle HCD interrupt request.

Parameters
hhcdHCD handle
Return values
None

Definition at line 491 of file stm32l4xx_hal_hcd.c.

492 {
493  USB_OTG_GlobalTypeDef *USBx = hhcd->Instance;
494  uint32_t USBx_BASE = (uint32_t)USBx;
495  uint32_t i, interrupt;
496 
497  /* Ensure that we are in device mode */
498  if (USB_GetMode(hhcd->Instance) == USB_OTG_MODE_HOST)
499  {
500  /* Avoid spurious interrupt */
501  if (__HAL_HCD_IS_INVALID_INTERRUPT(hhcd))
502  {
503  return;
504  }
505 
506  if (__HAL_HCD_GET_FLAG(hhcd, USB_OTG_GINTSTS_PXFR_INCOMPISOOUT))
507  {
508  /* Incorrect mode, acknowledge the interrupt */
509  __HAL_HCD_CLEAR_FLAG(hhcd, USB_OTG_GINTSTS_PXFR_INCOMPISOOUT);
510  }
511 
512  if (__HAL_HCD_GET_FLAG(hhcd, USB_OTG_GINTSTS_IISOIXFR))
513  {
514  /* Incorrect mode, acknowledge the interrupt */
515  __HAL_HCD_CLEAR_FLAG(hhcd, USB_OTG_GINTSTS_IISOIXFR);
516  }
517 
518  if (__HAL_HCD_GET_FLAG(hhcd, USB_OTG_GINTSTS_PTXFE))
519  {
520  /* Incorrect mode, acknowledge the interrupt */
521  __HAL_HCD_CLEAR_FLAG(hhcd, USB_OTG_GINTSTS_PTXFE);
522  }
523 
524  if (__HAL_HCD_GET_FLAG(hhcd, USB_OTG_GINTSTS_MMIS))
525  {
526  /* Incorrect mode, acknowledge the interrupt */
527  __HAL_HCD_CLEAR_FLAG(hhcd, USB_OTG_GINTSTS_MMIS);
528  }
529 
530  /* Handle Host Disconnect Interrupts */
531  if (__HAL_HCD_GET_FLAG(hhcd, USB_OTG_GINTSTS_DISCINT))
532  {
533 
534  /* Cleanup HPRT */
535  USBx_HPRT0 &= ~(USB_OTG_HPRT_PENA | USB_OTG_HPRT_PCDET | \
536  USB_OTG_HPRT_PENCHNG | USB_OTG_HPRT_POCCHNG);
537 
538  /* Handle Host Port Disconnect Interrupt */
539 #if (USE_HAL_HCD_REGISTER_CALLBACKS == 1U)
540  hhcd->DisconnectCallback(hhcd);
541 #else
543 #endif /* USE_HAL_HCD_REGISTER_CALLBACKS */
544 
545  (void)USB_InitFSLSPClkSel(hhcd->Instance, HCFG_48_MHZ);
546  __HAL_HCD_CLEAR_FLAG(hhcd, USB_OTG_GINTSTS_DISCINT);
547  }
548 
549  /* Handle Host Port Interrupts */
550  if (__HAL_HCD_GET_FLAG(hhcd, USB_OTG_GINTSTS_HPRTINT))
551  {
552  HCD_Port_IRQHandler(hhcd);
553  }
554 
555  /* Handle Host SOF Interrupt */
556  if (__HAL_HCD_GET_FLAG(hhcd, USB_OTG_GINTSTS_SOF))
557  {
558 #if (USE_HAL_HCD_REGISTER_CALLBACKS == 1U)
559  hhcd->SOFCallback(hhcd);
560 #else
561  HAL_HCD_SOF_Callback(hhcd);
562 #endif /* USE_HAL_HCD_REGISTER_CALLBACKS */
563 
564  __HAL_HCD_CLEAR_FLAG(hhcd, USB_OTG_GINTSTS_SOF);
565  }
566 
567  /* Handle Host channel Interrupt */
568  if (__HAL_HCD_GET_FLAG(hhcd, USB_OTG_GINTSTS_HCINT))
569  {
570  interrupt = USB_HC_ReadInterrupt(hhcd->Instance);
571  for (i = 0U; i < hhcd->Init.Host_channels; i++)
572  {
573  if ((interrupt & (1UL << (i & 0xFU))) != 0U)
574  {
575  if ((USBx_HC(i)->HCCHAR & USB_OTG_HCCHAR_EPDIR) == USB_OTG_HCCHAR_EPDIR)
576  {
577  HCD_HC_IN_IRQHandler(hhcd, (uint8_t)i);
578  }
579  else
580  {
581  HCD_HC_OUT_IRQHandler(hhcd, (uint8_t)i);
582  }
583  }
584  }
585  __HAL_HCD_CLEAR_FLAG(hhcd, USB_OTG_GINTSTS_HCINT);
586  }
587 
588  /* Handle Rx Queue Level Interrupts */
589  if ((__HAL_HCD_GET_FLAG(hhcd, USB_OTG_GINTSTS_RXFLVL)) != 0U)
590  {
591  USB_MASK_INTERRUPT(hhcd->Instance, USB_OTG_GINTSTS_RXFLVL);
592 
593  HCD_RXQLVL_IRQHandler(hhcd);
594 
595  USB_UNMASK_INTERRUPT(hhcd->Instance, USB_OTG_GINTSTS_RXFLVL);
596  }
597  }
598 }
uint32_t USB_HC_ReadInterrupt(USB_OTG_GlobalTypeDef *USBx)
Read all host channel interrupts status.
static void HCD_RXQLVL_IRQHandler(HCD_HandleTypeDef *hhcd)
Handle Rx Queue Level interrupt requests.
HAL_StatusTypeDef USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef *USBx, uint8_t freq)
USB_InitFSLSPClkSel : Initializes the FSLSPClkSel field of the HCFG register on the PHY type and set ...
void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd)
Disconnection Event callback.
static void HCD_Port_IRQHandler(HCD_HandleTypeDef *hhcd)
Handle Host Port interrupt requests.
void HAL_HCD_SOF_Callback(HCD_HandleTypeDef *hhcd)
SOF callback.
static void HCD_HC_IN_IRQHandler(HCD_HandleTypeDef *hhcd, uint8_t chnum)
Handle Host Channel IN interrupt requests.
static void HCD_HC_OUT_IRQHandler(HCD_HandleTypeDef *hhcd, uint8_t chnum)
Handle Host Channel OUT interrupt requests.
uint32_t USB_GetMode(USB_OTG_GlobalTypeDef *USBx)
Returns USB core mode.

◆ HAL_HCD_PortDisabled_Callback()

__weak void HAL_HCD_PortDisabled_Callback ( HCD_HandleTypeDef hhcd)

Port Disabled Event callback.

Parameters
hhcdHCD handle
Return values
None

Definition at line 665 of file stm32l4xx_hal_hcd.c.

666 {
667  /* Prevent unused argument(s) compilation warning */
668  UNUSED(hhcd);
669 
670  /* NOTE : This function should not be modified, when the callback is needed,
671  the HAL_HCD_Disconnect_Callback could be implemented in the user file
672  */
673 }

◆ HAL_HCD_PortEnabled_Callback()

__weak void HAL_HCD_PortEnabled_Callback ( HCD_HandleTypeDef hhcd)

Port Enabled Event callback.

Parameters
hhcdHCD handle
Return values
None

Definition at line 650 of file stm32l4xx_hal_hcd.c.

651 {
652  /* Prevent unused argument(s) compilation warning */
653  UNUSED(hhcd);
654 
655  /* NOTE : This function should not be modified, when the callback is needed,
656  the HAL_HCD_Disconnect_Callback could be implemented in the user file
657  */
658 }

◆ HAL_HCD_RegisterCallback()

HAL_StatusTypeDef HAL_HCD_RegisterCallback ( HCD_HandleTypeDef hhcd,
HAL_HCD_CallbackIDTypeDef  CallbackID,
pHCD_CallbackTypeDef  pCallback 
)

Register a User USB HCD Callback To be used instead of the weak predefined callback.

Parameters
hhcdUSB HCD handle
CallbackIDID of the callback to be registered This parameter can be one of the following values:
pCallbackpointer to the Callback function
Return values
HALstatus

Definition at line 719 of file stm32l4xx_hal_hcd.c.

720 {
721  HAL_StatusTypeDef status = HAL_OK;
722 
723  if (pCallback == NULL)
724  {
725  /* Update the error code */
726  hhcd->ErrorCode |= HAL_HCD_ERROR_INVALID_CALLBACK;
727  return HAL_ERROR;
728  }
729  /* Process locked */
730  __HAL_LOCK(hhcd);
731 
732  if (hhcd->State == HAL_HCD_STATE_READY)
733  {
734  switch (CallbackID)
735  {
736  case HAL_HCD_SOF_CB_ID :
737  hhcd->SOFCallback = pCallback;
738  break;
739 
740  case HAL_HCD_CONNECT_CB_ID :
741  hhcd->ConnectCallback = pCallback;
742  break;
743 
745  hhcd->DisconnectCallback = pCallback;
746  break;
747 
749  hhcd->PortEnabledCallback = pCallback;
750  break;
751 
753  hhcd->PortDisabledCallback = pCallback;
754  break;
755 
756  case HAL_HCD_MSPINIT_CB_ID :
757  hhcd->MspInitCallback = pCallback;
758  break;
759 
761  hhcd->MspDeInitCallback = pCallback;
762  break;
763 
764  default :
765  /* Update the error code */
766  hhcd->ErrorCode |= HAL_HCD_ERROR_INVALID_CALLBACK;
767  /* Return error status */
768  status = HAL_ERROR;
769  break;
770  }
771  }
772  else if (hhcd->State == HAL_HCD_STATE_RESET)
773  {
774  switch (CallbackID)
775  {
776  case HAL_HCD_MSPINIT_CB_ID :
777  hhcd->MspInitCallback = pCallback;
778  break;
779 
781  hhcd->MspDeInitCallback = pCallback;
782  break;
783 
784  default :
785  /* Update the error code */
786  hhcd->ErrorCode |= HAL_HCD_ERROR_INVALID_CALLBACK;
787  /* Return error status */
788  status = HAL_ERROR;
789  break;
790  }
791  }
792  else
793  {
794  /* Update the error code */
795  hhcd->ErrorCode |= HAL_HCD_ERROR_INVALID_CALLBACK;
796  /* Return error status */
797  status = HAL_ERROR;
798  }
799 
800  /* Release Lock */
801  __HAL_UNLOCK(hhcd);
802  return status;
803 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_HCD_RegisterHC_NotifyURBChangeCallback()

HAL_StatusTypeDef HAL_HCD_RegisterHC_NotifyURBChangeCallback ( HCD_HandleTypeDef hhcd,
pHCD_HC_NotifyURBChangeCallbackTypeDef  pCallback 
)

Register USB HCD Host Channel Notify URB Change Callback To be used instead of the weak HAL_HCD_HC_NotifyURBChange_Callback() predefined callback.

Parameters
hhcdHCD handle
pCallbackpointer to the USB HCD Host Channel Notify URB Change Callback function
Return values
HALstatus

Definition at line 911 of file stm32l4xx_hal_hcd.c.

912 {
913  HAL_StatusTypeDef status = HAL_OK;
914 
915  if (pCallback == NULL)
916  {
917  /* Update the error code */
918  hhcd->ErrorCode |= HAL_HCD_ERROR_INVALID_CALLBACK;
919 
920  return HAL_ERROR;
921  }
922 
923  /* Process locked */
924  __HAL_LOCK(hhcd);
925 
926  if (hhcd->State == HAL_HCD_STATE_READY)
927  {
928  hhcd->HC_NotifyURBChangeCallback = pCallback;
929  }
930  else
931  {
932  /* Update the error code */
933  hhcd->ErrorCode |= HAL_HCD_ERROR_INVALID_CALLBACK;
934 
935  /* Return error status */
936  status = HAL_ERROR;
937  }
938 
939  /* Release Lock */
940  __HAL_UNLOCK(hhcd);
941 
942  return status;
943 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_HCD_SOF_Callback()

__weak void HAL_HCD_SOF_Callback ( HCD_HandleTypeDef hhcd)

SOF callback.

Parameters
hhcdHCD handle
Return values
None

Definition at line 605 of file stm32l4xx_hal_hcd.c.

606 {
607  /* Prevent unused argument(s) compilation warning */
608  UNUSED(hhcd);
609 
610  /* NOTE : This function should not be modified, when the callback is needed,
611  the HAL_HCD_SOF_Callback could be implemented in the user file
612  */
613 }

◆ HAL_HCD_UnRegisterCallback()

HAL_StatusTypeDef HAL_HCD_UnRegisterCallback ( HCD_HandleTypeDef hhcd,
HAL_HCD_CallbackIDTypeDef  CallbackID 
)

Unregister an USB HCD Callback USB HCD callabck is redirected to the weak predefined callback.

Parameters
hhcdUSB HCD handle
CallbackIDID of the callback to be unregistered This parameter can be one of the following values:
Return values
HALstatus

Definition at line 820 of file stm32l4xx_hal_hcd.c.

821 {
822  HAL_StatusTypeDef status = HAL_OK;
823 
824  /* Process locked */
825  __HAL_LOCK(hhcd);
826 
827  /* Setup Legacy weak Callbacks */
828  if (hhcd->State == HAL_HCD_STATE_READY)
829  {
830  switch (CallbackID)
831  {
832  case HAL_HCD_SOF_CB_ID :
833  hhcd->SOFCallback = HAL_HCD_SOF_Callback;
834  break;
835 
836  case HAL_HCD_CONNECT_CB_ID :
837  hhcd->ConnectCallback = HAL_HCD_Connect_Callback;
838  break;
839 
841  hhcd->DisconnectCallback = HAL_HCD_Disconnect_Callback;
842  break;
843 
845  hhcd->PortEnabledCallback = HAL_HCD_PortEnabled_Callback;
846  break;
847 
849  hhcd->PortDisabledCallback = HAL_HCD_PortDisabled_Callback;
850  break;
851 
852  case HAL_HCD_MSPINIT_CB_ID :
853  hhcd->MspInitCallback = HAL_HCD_MspInit;
854  break;
855 
857  hhcd->MspDeInitCallback = HAL_HCD_MspDeInit;
858  break;
859 
860  default :
861  /* Update the error code */
862  hhcd->ErrorCode |= HAL_HCD_ERROR_INVALID_CALLBACK;
863 
864  /* Return error status */
865  status = HAL_ERROR;
866  break;
867  }
868  }
869  else if (hhcd->State == HAL_HCD_STATE_RESET)
870  {
871  switch (CallbackID)
872  {
873  case HAL_HCD_MSPINIT_CB_ID :
874  hhcd->MspInitCallback = HAL_HCD_MspInit;
875  break;
876 
878  hhcd->MspDeInitCallback = HAL_HCD_MspDeInit;
879  break;
880 
881  default :
882  /* Update the error code */
883  hhcd->ErrorCode |= HAL_HCD_ERROR_INVALID_CALLBACK;
884 
885  /* Return error status */
886  status = HAL_ERROR;
887  break;
888  }
889  }
890  else
891  {
892  /* Update the error code */
893  hhcd->ErrorCode |= HAL_HCD_ERROR_INVALID_CALLBACK;
894 
895  /* Return error status */
896  status = HAL_ERROR;
897  }
898 
899  /* Release Lock */
900  __HAL_UNLOCK(hhcd);
901  return status;
902 }
void HAL_HCD_PortDisabled_Callback(HCD_HandleTypeDef *hhcd)
Port Disabled Event callback.
void HAL_HCD_MspDeInit(HCD_HandleTypeDef *hhcd)
DeInitialize the HCD MSP.
__HAL_UNLOCK(hrtc)
void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd)
Disconnection Event callback.
__HAL_LOCK(hrtc)
return HAL_OK
void HAL_HCD_PortEnabled_Callback(HCD_HandleTypeDef *hhcd)
Port Enabled Event callback.
void HAL_HCD_MspInit(HCD_HandleTypeDef *hhcd)
Initialize the HCD MSP.
void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd)
Connection Event callback.
void HAL_HCD_SOF_Callback(HCD_HandleTypeDef *hhcd)
SOF callback.

◆ HAL_HCD_UnRegisterHC_NotifyURBChangeCallback()

HAL_StatusTypeDef HAL_HCD_UnRegisterHC_NotifyURBChangeCallback ( HCD_HandleTypeDef hhcd)

UnRegister the USB HCD Host Channel Notify URB Change Callback USB HCD Host Channel Notify URB Change Callback is redirected to the weak HAL_HCD_HC_NotifyURBChange_Callback() predefined callback.

Parameters
hhcdHCD handle
Return values
HALstatus

Definition at line 951 of file stm32l4xx_hal_hcd.c.

952 {
953  HAL_StatusTypeDef status = HAL_OK;
954 
955  /* Process locked */
956  __HAL_LOCK(hhcd);
957 
958  if (hhcd->State == HAL_HCD_STATE_READY)
959  {
960  hhcd->HC_NotifyURBChangeCallback = HAL_HCD_HC_NotifyURBChange_Callback; /* Legacy weak DataOutStageCallback */
961  }
962  else
963  {
964  /* Update the error code */
965  hhcd->ErrorCode |= HAL_HCD_ERROR_INVALID_CALLBACK;
966 
967  /* Return error status */
968  status = HAL_ERROR;
969  }
970 
971  /* Release Lock */
972  __HAL_UNLOCK(hhcd);
973 
974  return status;
975 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd, uint8_t chnum, HCD_URBStateTypeDef urb_state)
Notify URB state change callback.
return HAL_OK