rusEFI
The most advanced open source ECU
Functions
usbconfig.cpp File Reference

Functions

static void UsbConfig_UsbDeviceClassesInitCallback0 (stc_usbn_t *pstcUSB)
 
static void UsbConfig_UsbDeviceClassesInitCallback1 (stc_usbn_t *pstcUSB)
 
static boolean_t UsbConfig_Device0Vbus (en_usb_extint_param_t enType)
 Device 0 VBUS GPIO / external interrupt callback. More...
 
static boolean_t UsbConfig_Device1Vbus (en_usb_extint_param_t enType)
 Device 1 VBUS GPIO / external interrupt callback. More...
 
boolean_t UsbConfig_Host0Overcurrent (en_usb_extint_param_t enType)
 Host 0 Overcurrent GPIO / external interrupt callback. More...
 
boolean_t UsbConfig_Host0Vbus (en_usb_gpio_param_t enType)
 Host 0 VBUS GPIO / external interrupt callback. More...
 
boolean_t UsbConfig_Host0PulldownHostEnable (en_usb_gpio_param_t enType)
 Host 0 pull-down GPIO / external interrupt callback. More...
 
boolean_t UsbConfig_Host1Overcurrent (en_usb_extint_param_t enType)
 Host 1 Overcurrent GPIO / external interrupt callback. More...
 
boolean_t UsbConfig_Host1Vbus (en_usb_gpio_param_t enType)
 Host 1 VBUS GPIO / external interrupt callback. More...
 
boolean_t UsbConfig_Host1PulldownHostEnable (en_usb_gpio_param_t enType)
 Host 1 pull-down GPIO / external interrupt callback. More...
 
void UsbConfig_UsbInit (void)
 Initialize USB. More...
 
void UsbConfig_SwitchMode (void)
 Switch USB mode (dummy if USB is disabled) More...
 
void UsbDevice_Usb0ExintCallback (void)
 
void UsbDevice_Usb1ExintCallback (void)
 
void INT8_31_Handler (void)
 
void INT8_15_Handler (void)
 
void INT0_7_Handler (void)
 

Function Documentation

◆ INT0_7_Handler()

void INT0_7_Handler ( void  )

Definition at line 855 of file usbconfig.cpp.

856 {
857  #if FM_PERIPHERAL_ENABLE_USB0 == ON
858  if (DEVICE0VBUS_ISRISSET)
859  {
860  DEVICE0VBUS_CLEARISRFLAG;
862  }
863  #endif
864  #if FM_PERIPHERAL_ENABLE_USB1 == ON
865  if (DEVICE1VBUS_ISRISSET)
866  {
867  DEVICE1VBUS_CLEARISRFLAG;
869  }
870  #endif
871 }
void UsbDevice_Usb0ExintCallback(void)
Definition: usbconfig.cpp:780
void UsbDevice_Usb1ExintCallback(void)
Definition: usbconfig.cpp:798
Here is the call graph for this function:

◆ INT8_15_Handler()

void INT8_15_Handler ( void  )

Definition at line 837 of file usbconfig.cpp.

838 {
839  #if FM_PERIPHERAL_ENABLE_USB0 == ON
840  if (DEVICE0VBUS_ISRISSET)
841  {
842  DEVICE0VBUS_CLEARISRFLAG;
844  }
845  #endif
846  #if FM_PERIPHERAL_ENABLE_USB1 == ON
847  if (DEVICE1VBUS_ISRISSET)
848  {
849  DEVICE1VBUS_CLEARISRFLAG;
851  }
852  #endif
853 }
Here is the call graph for this function:

◆ INT8_31_Handler()

void INT8_31_Handler ( void  )

Definition at line 819 of file usbconfig.cpp.

820 {
821  #if FM_PERIPHERAL_ENABLE_USB0 == ON
822  if (DEVICE0VBUS_ISRISSET)
823  {
824  DEVICE0VBUS_CLEARISRFLAG;
826  }
827  #endif
828  #if FM_PERIPHERAL_ENABLE_USB1 == ON
829  if (DEVICE1VBUS_ISRISSET)
830  {
831  DEVICE1VBUS_CLEARISRFLAG;
833  }
834  #endif
835 }
Here is the call graph for this function:

◆ UsbConfig_Device0Vbus()

static boolean_t UsbConfig_Device0Vbus ( en_usb_extint_param_t  enType)
static

Device 0 VBUS GPIO / external interrupt callback.

Parameters
enType
Returns
Depending on enType

Definition at line 448 of file usbconfig.cpp.

449 {
450  switch(enType)
451  {
452  case UsbExtIntDeinit:
453  DEVICE0VBUS_DEINIT;
454  break;
455  case UsbExtIntInit:
456  DEVICE0VBUS_INIT;
457  break;
458  case UsbExtIntDisableIsr:
459  DEVICE0VBUS_DISABLEISR;
460  break;
461  case UsbExtIntEnableIsr:
462  DEVICE0VBUS_ENABLEISR;
463  break;
464  case UsbExtIntClearIsrFlag:
465  DEVICE0VBUS_CLEARISRFLAG;
466  break;
467  case UsbExtIntIsSetIsrFlag:
468  return DEVICE0VBUS_ISRISSET;
469  case UsbExtIntSetLowDetect:
470  DEVICE0VBUS_SETLOWDETECT;
471  break;
472  case UsbExtIntSetHighDetect:
473  DEVICE0VBUS_SETHIGHDETECT;
474  break;
475  case UsbExtIntGetLevel:
476  return DEVICE0VBUS_HIGHDETECT;
477  }
478  return FALSE;
479 }

Referenced by UsbConfig_UsbInit().

Here is the caller graph for this function:

◆ UsbConfig_Device1Vbus()

static boolean_t UsbConfig_Device1Vbus ( en_usb_extint_param_t  enType)
static

Device 1 VBUS GPIO / external interrupt callback.

Parameters
enType
Returns
Depending on enType

Definition at line 492 of file usbconfig.cpp.

493 {
494  switch(enType)
495  {
496  case UsbExtIntDeinit:
497  DEVICE1VBUS_DEINIT;
498  break;
499  case UsbExtIntInit:
500  DEVICE1VBUS_INIT;
501  break;
502  case UsbExtIntDisableIsr:
503  DEVICE1VBUS_DISABLEISR;
504  break;
505  case UsbExtIntEnableIsr:
506  DEVICE1VBUS_ENABLEISR;
507  break;
508  case UsbExtIntClearIsrFlag:
509  DEVICE1VBUS_CLEARISRFLAG;
510  break;
511  case UsbExtIntIsSetIsrFlag:
512  return DEVICE1VBUS_ISRISSET;
513  break;
514  case UsbExtIntSetLowDetect:
515  DEVICE1VBUS_SETLOWDETECT;
516  break;
517  case UsbExtIntSetHighDetect:
518  DEVICE1VBUS_SETHIGHDETECT;
519  break;
520  case UsbExtIntGetLevel:
521  return DEVICE1VBUS_HIGHDETECT;
522  break;
523  }
524  return FALSE;
525 }

Referenced by UsbConfig_UsbInit().

Here is the caller graph for this function:

◆ UsbConfig_Host0Overcurrent()

boolean_t UsbConfig_Host0Overcurrent ( en_usb_extint_param_t  enType)

Host 0 Overcurrent GPIO / external interrupt callback.

Parameters
enType
Returns
Depending on enType

Definition at line 542 of file usbconfig.cpp.

543 {
544  switch(enType)
545  {
546  case UsbExtIntDeinit:
547  HOST0OVERCURRENT_DEINIT;
548  break;
549  case UsbExtIntInit:
550  HOST0OVERCURRENT_INIT;
551  break;
552  case UsbExtIntDisableIsr:
553  HOST0OVERCURRENT_DISABLEISR;
554  break;
555  case UsbExtIntEnableIsr:
556  HOST0OVERCURRENT_ENABLEISR;
557  break;
558  case UsbExtIntClearIsrFlag:
559  HOST0OVERCURRENT_CLEARISRFLAG;
560  break;
561  case UsbExtIntIsSetIsrFlag:
562  return HOST0OVERCURRENT_ISRISSET;
563  case UsbExtIntSetLowDetect:
564  HOST0OVERCURRENT_SETLOWDETECT;
565  break;
566  case UsbExtIntSetHighDetect:
567  HOST0OVERCURRENT_SETHIGHDETECT;
568  break;
569  case UsbExtIntGetLevel:
570  return HOST0OVERCURRENT_HIGHDETECT;
571  default:
572  return FALSE;
573  }
574  return TRUE;
575 }

Referenced by UsbConfig_UsbInit().

Here is the caller graph for this function:

◆ UsbConfig_Host0PulldownHostEnable()

boolean_t UsbConfig_Host0PulldownHostEnable ( en_usb_gpio_param_t  enType)

Host 0 pull-down GPIO / external interrupt callback.

Parameters
enType
Returns
Depending on enType

Definition at line 617 of file usbconfig.cpp.

618 {
619  switch(enType)
620  {
621  case UsbGpioDeinit:
622  HOST0OTGPULLDOWN_DEINIT;
623  break;
624  case UsbGpioInit:
625  HOST0OTGPULLDOWN_INIT;
626  break;
627  case UsbGpioSet:
628  HOST0OTGPULLDOWN_SET;
629  break;
630  case UsbGpioClear:
631  HOST0OTGPULLDOWN_CLEAR;
632  break;
633  default:
634  return FALSE;
635  }
636  return TRUE;
637 }

Referenced by UsbConfig_UsbInit().

Here is the caller graph for this function:

◆ UsbConfig_Host0Vbus()

boolean_t UsbConfig_Host0Vbus ( en_usb_gpio_param_t  enType)

Host 0 VBUS GPIO / external interrupt callback.

Parameters
enType
Returns
Depending on enType

Definition at line 586 of file usbconfig.cpp.

587 {
588  switch(enType)
589  {
590  case UsbGpioDeinit:
591  HOST0VBUS_DEINIT;
592  break;
593  case UsbGpioInit:
594  HOST0VBUS_INIT;
595  break;
596  case UsbGpioSet:
597  HOST0VBUS_SET;
598  break;
599  case UsbGpioClear:
600  HOST0VBUS_CLEAR;
601  break;
602  default:
603  return FALSE;
604  }
605  return TRUE;
606 }

Referenced by UsbConfig_UsbInit().

Here is the caller graph for this function:

◆ UsbConfig_Host1Overcurrent()

boolean_t UsbConfig_Host1Overcurrent ( en_usb_extint_param_t  enType)

Host 1 Overcurrent GPIO / external interrupt callback.

Parameters
enType
Returns
Depending on enType

Definition at line 650 of file usbconfig.cpp.

651 {
652  switch(enType)
653  {
654  case UsbExtIntDeinit:
655  HOST1OVERCURRENT_DEINIT;
656  break;
657  case UsbExtIntInit:
658  HOST1OVERCURRENT_INIT;
659  break;
660  case UsbExtIntDisableIsr:
661  HOST1OVERCURRENT_DISABLEISR;
662  break;
663  case UsbExtIntEnableIsr:
664  HOST1OVERCURRENT_ENABLEISR;
665  break;
666  case UsbExtIntClearIsrFlag:
667  HOST1OVERCURRENT_CLEARISRFLAG;
668  break;
669  case UsbExtIntIsSetIsrFlag:
670  return HOST1OVERCURRENT_ISRISSET;
671  case UsbExtIntSetLowDetect:
672  HOST1OVERCURRENT_SETLOWDETECT;
673  break;
674  case UsbExtIntSetHighDetect:
675  HOST1OVERCURRENT_SETHIGHDETECT;
676  break;
677  case UsbExtIntGetLevel:
678  return HOST1OVERCURRENT_HIGHDETECT;
679  default:
680  return FALSE;
681  }
682  return TRUE;
683 }

Referenced by UsbConfig_UsbInit().

Here is the caller graph for this function:

◆ UsbConfig_Host1PulldownHostEnable()

boolean_t UsbConfig_Host1PulldownHostEnable ( en_usb_gpio_param_t  enType)

Host 1 pull-down GPIO / external interrupt callback.

Parameters
enType
Returns
Depending on enType

Definition at line 725 of file usbconfig.cpp.

726 {
727  switch(enType)
728  {
729  case UsbGpioDeinit:
730  HOST1OTGPULLDOWN_DEINIT;
731  break;
732  case UsbGpioInit:
733  HOST1OTGPULLDOWN_INIT;
734  break;
735  case UsbGpioSet:
736  HOST1OTGPULLDOWN_SET;
737  break;
738  case UsbGpioClear:
739  HOST1OTGPULLDOWN_CLEAR;
740  break;
741  default:
742  return FALSE;
743  }
744  return TRUE;
745 }

Referenced by UsbConfig_UsbInit().

Here is the caller graph for this function:

◆ UsbConfig_Host1Vbus()

boolean_t UsbConfig_Host1Vbus ( en_usb_gpio_param_t  enType)

Host 1 VBUS GPIO / external interrupt callback.

Parameters
enType
Returns
Depending on enType

Definition at line 694 of file usbconfig.cpp.

695 {
696  switch(enType)
697  {
698  case UsbGpioDeinit:
699  HOST1VBUS_DEINIT;
700  break;
701  case UsbGpioInit:
702  HOST1VBUS_INIT;
703  break;
704  case UsbGpioSet:
705  HOST1VBUS_SET;
706  break;
707  case UsbGpioClear:
708  HOST1VBUS_CLEAR;
709  break;
710  default:
711  return FALSE;
712  }
713  return TRUE;
714 }

Referenced by UsbConfig_UsbInit().

Here is the caller graph for this function:

◆ UsbConfig_SwitchMode()

void UsbConfig_SwitchMode ( void  )

Switch USB mode (dummy if USB is disabled)

Definition at line 750 of file usbconfig.cpp.

751 {
752  #if FM_PERIPHERAL_ENABLE_USB0 == ON
753  #if ((FM_PERIPHERAL_ENABLE_USB0_HOST == ON) && (FM_PERIPHERAL_ENABLE_USB0_DEVICE == OFF))
754  Usb_SwitchUsb((stc_usbn_t*)&USB0,UsbSwitchToHost,0);
755  #endif
756  #if ((FM_PERIPHERAL_ENABLE_USB0_HOST == OFF) && (FM_PERIPHERAL_ENABLE_USB0_DEVICE == ON))
757  Usb_SwitchUsb((stc_usbn_t*)&USB0,UsbSwitchDependingDeviceVbus,0);
758  #endif
759  #if ((FM_PERIPHERAL_ENABLE_USB0_HOST == ON) && (FM_PERIPHERAL_ENABLE_USB0_DEVICE == ON))
760  Usb_SwitchUsb((stc_usbn_t*)&USB0,UsbSwitchDependingDeviceVbus,0);
761  #endif
762  #endif
763 
764  #if FM_PERIPHERAL_ENABLE_USB1 == ON
765  #if ((FM_PERIPHERAL_ENABLE_USB1_HOST == ON) && (FM_PERIPHERAL_ENABLE_USB1_DEVICE == OFF))
766 
767  Usb_SwitchUsb((stc_usbn_t*)&USB1,UsbSwitchToHost,0);
768  #endif
769  #if ((FM_PERIPHERAL_ENABLE_USB1_HOST == OFF) && (FM_PERIPHERAL_ENABLE_USB1_DEVICE == ON))
770  Usb_SwitchUsb((stc_usbn_t*)&USB1,UsbSwitchDependingDeviceVbus,0);
771  #endif
772  #if ((FM_PERIPHERAL_ENABLE_USB1_HOST == ON) && (FM_PERIPHERAL_ENABLE_USB1_DEVICE == ON))
773  Usb_SwitchUsb((stc_usbn_t*)&USB1,UsbSwitchDependingDeviceVbus,0);
774  #endif
775  #endif
776 }

Referenced by usb_serial_start(), and usb_VBus_handler().

Here is the caller graph for this function:

◆ UsbConfig_UsbDeviceClassesInitCallback0()

static void UsbConfig_UsbDeviceClassesInitCallback0 ( stc_usbn_t *  pstcUSB)
static

Definition at line 233 of file usbconfig.cpp.

234 {
235  #if (USBDEVICECDCCOM_ENABLED == ON)
236  UsbDeviceCdcCom_Init((stc_usbn_t*)&USB0);
237  #endif
238  #if (USBDEVICEHIDCOM_ENABLED == ON)
239  UsbDeviceHidCom_Init((stc_usbn_t*)&USB0);
240  #endif
241  #if (USBDEVICEHIDJOYSTICK_ENABLED == ON)
242  UsbDeviceHidJoystick_Init((stc_usbn_t*)&USB0);
243  #endif
244  #if (USBDEVICEHIDKEYBOARD_ENABLED == ON)
245  UsbDeviceHidKeyboard_Init((stc_usbn_t*)&USB0);
246  #endif
247  #if (USBDEVICEHIDMOUSE_ENABLED == ON)
248  UsbDeviceHidMouse_Init((stc_usbn_t*)&USB0);
249  #endif
250  #if (USBDEVICELIBUSB_ENABLED == ON)
251  UsbDeviceLibUsb_Init((stc_usbn_t*)&USB0);
252  #endif
253  #if (USBDEVICEPRINTER_ENABLED == ON)
254  UsbDevicePrinter_Init((stc_usbn_t*)&USB0);
255  #endif
256  #if (USBDEVICEMASSSTORAGE_ENABLED == ON)
257  UsbDeviceMassStorage_Init((stc_usbn_t*)&USB0);
258  #endif
259  /* USB0 WIZARD DEVICECLASSINIT */
260 }

Referenced by UsbConfig_UsbInit().

Here is the caller graph for this function:

◆ UsbConfig_UsbDeviceClassesInitCallback1()

static void UsbConfig_UsbDeviceClassesInitCallback1 ( stc_usbn_t *  pstcUSB)
static

Definition at line 264 of file usbconfig.cpp.

265 {
266  #if (USBDEVICECDCCOM_ENABLED == ON)
267  UsbDeviceCdcCom_Init((stc_usbn_t*)&USB1);
268  #endif
269  #if (USBDEVICEHIDCOM_ENABLED == ON)
270  UsbDeviceHidCom_Init((stc_usbn_t*)&USB1);
271  #endif
272  #if (USBDEVICEHIDJOYSTICK_ENABLED == ON)
273  UsbDeviceHidJoystick_Init((stc_usbn_t*)&USB1);
274  #endif
275  #if (USBDEVICEHIDKEYBOARD_ENABLED == ON)
276  UsbDeviceHidKeyboard_Init((stc_usbn_t*)&USB1);
277  #endif
278  #if (USBDEVICEHIDMOUSE_ENABLED == ON)
279  UsbDeviceHidMouse_Init((stc_usbn_t*)&USB1);
280  #endif
281  #if (USBDEVICELIBUSB_ENABLED == ON)
282  UsbDeviceLibUsb_Init((stc_usbn_t*)&USB1);
283  #endif
284  #if (USBDEVICEPRINTER_ENABLED == ON)
285  UsbDevicePrinter_Init((stc_usbn_t*)&USB1);
286  #endif
287  #if (USBDEVICEMASSSTORAGE_ENABLED == ON)
288  UsbDeviceMassStorage_Init((stc_usbn_t*)&USB1);
289  #endif
290  /* USB1 WIZARD DEVICECLASSINIT */
291 }

Referenced by UsbConfig_UsbInit().

Here is the caller graph for this function:

◆ UsbConfig_UsbInit()

void UsbConfig_UsbInit ( void  )

Initialize USB.

Initialize USB (dummy if USB is disabled)

Definition at line 310 of file usbconfig.cpp.

311 {
312  stc_usb_config_t stcUsbConfig;
313  #if (!defined(USB_DISBALE_DEVICE_FUNCTIONALITY))
314  stc_usbdevice_config_t stcUsbDeviceConfig;
315  #endif
316 
317  Usb_Init();
318 
319 
320  /* Setup USB 0 */
321  USB_ZERO_STRUCT(stcUsbConfig);
322 
323  #if (FM_PERIPHERAL_USB_DEVICE_ENABLED)
324  USB_ZERO_STRUCT(stcUsbDeviceConfig);
325  #endif /* (FM_PERIPHERAL_USB_DEVICE_ENABLED) */
326 
327  #if ((FM_PERIPHERAL_ENABLE_USB0_HOST == ON) && (FM_PERIPHERAL_ENABLE_USB0_DEVICE == ON))
328  stcUsbConfig.enMode = UsbHostDeviceEnabled;
329  #elif ((FM_PERIPHERAL_ENABLE_USB0_HOST == ON) && (FM_PERIPHERAL_ENABLE_USB0_DEVICE == OFF))
330  stcUsbConfig.enMode = UsbHostEnabled;
331  #elif ((FM_PERIPHERAL_ENABLE_USB0_HOST == OFF) && (FM_PERIPHERAL_ENABLE_USB0_DEVICE == ON))
332  stcUsbConfig.enMode = UsbDeviceEnabled;
333  #endif
334 
335  #if (FM_PERIPHERAL_USB_DEVICE_ENABLED)
336  #if ((USE_USBDESCRIPTORS_H == 1) || (USB_USE_PDL == 1))
337  stcUsbDeviceConfig.pu8DeviceDescriptor = (uint8_t*)au8DeviceDescriptor;
338  stcUsbDeviceConfig.pu8ConfigDescriptor = (uint8_t*)au8ConfigDescriptor;
339  stcUsbDeviceConfig.astcReportDescriptors = (stc_usbdevice_reportdescriptor_t*)astcReportDescriptors;
340  stcUsbDeviceConfig.pstcStringDescriptors = (stc_usbdevice_stringdescriptor_t*)pstcStringDescriptors;
341  stcUsbDeviceConfig.u8StringDescriptorCount = USBDESCRIPTORS_STRINGDESCRIPTOR_COUNT;
342  #endif /* ((USE_USBDESCRIPTORS_H == 1) || (USB_USE_PDL == 1)) */
343  #endif /* (FM_PERIPHERAL_USB_DEVICE_ENABLED) */
344 
345  stcUsbConfig.bUseInterrupts = TRUE;
346 
347  #if (FM_PERIPHERAL_USB_DEVICE_ENABLED)
348  #if ((FM_PERIPHERAL_ENABLE_USB0 == ON) && ((USE_USBDEVICEHW_H == 1) || (USB_USE_PDL == 1)))
349  stcUsbConfig.pfnDeviceVbus = UsbConfig_Device0Vbus;
350  #endif
351  #endif /* (FM_PERIPHERAL_USB_DEVICE_ENABLED) */
352 
353  #if ((FM_PERIPHERAL_USB_HOST_ENABLED))
354  #if ((FM_PERIPHERAL_ENABLE_USB0 == ON) && ((USE_USBHOSTHW_H == 1) || (USB_USE_PDL == 1)))
355  stcUsbConfig.pfnHostVbus = UsbConfig_Host0Vbus;
356  stcUsbConfig.pfnHostPullDownHostEnable = UsbConfig_Host0PulldownHostEnable;
357  stcUsbConfig.pfnHostOvercurrent = UsbConfig_Host0Overcurrent;
358  #endif
359  #endif /* ((FM_PERIPHERAL_USB_HOST_ENABLED)) */
360 
361  #if FM_PERIPHERAL_ENABLE_USB0_DEVICE == ON
362  stcUsbDeviceConfig.pfnInitClassesCallback = UsbConfig_UsbDeviceClassesInitCallback0;
363  #endif
364 
365  #if FM_PERIPHERAL_ENABLE_USB0_DEVICE == ON
366  UsbDevice_Init((stc_usbn_t*)&USB0,&stcUsbConfig,&stcUsbDeviceConfig);
367  #endif
368 
369  #if FM_PERIPHERAL_ENABLE_USB0 == ON
370  #if FM_PERIPHERAL_ENABLE_USB0_HOST == ON
371  UsbHost_Init((stc_usbn_t*)&USB0,&stcUsbConfig);
372  #endif
373  Usb_Configure((stc_usbn_t*)&USB0,&stcUsbConfig);
374  #endif
375 
376 
377 
378 
379  /* Setup USB 1 */
380  USB_ZERO_STRUCT(stcUsbConfig);
381 
382  #if (FM_PERIPHERAL_USB_DEVICE_ENABLED)
383  USB_ZERO_STRUCT(stcUsbDeviceConfig);
384  #endif
385 
386  #if ((FM_PERIPHERAL_ENABLE_USB1_HOST == ON) && (FM_PERIPHERAL_ENABLE_USB1_DEVICE == ON))
387  stcUsbConfig.enMode = UsbHostDeviceEnabled;
388  #elif ((FM_PERIPHERAL_ENABLE_USB1_HOST == ON) && (FM_PERIPHERAL_ENABLE_USB1_DEVICE == OFF))
389  stcUsbConfig.enMode = UsbHostEnabled;
390  #elif ((FM_PERIPHERAL_ENABLE_USB1_HOST == OFF) && (FM_PERIPHERAL_ENABLE_USB1_DEVICE == ON))
391  stcUsbConfig.enMode = UsbDeviceEnabled;
392  #endif
393 
394  #if (FM_PERIPHERAL_USB_DEVICE_ENABLED)
395  #if ((USE_USBDESCRIPTORS_H == 1) || (USB_USE_PDL == 1))
396  stcUsbDeviceConfig.pu8DeviceDescriptor = (uint8_t*)au8DeviceDescriptor;
397  stcUsbDeviceConfig.pu8ConfigDescriptor = (uint8_t*)au8ConfigDescriptor;
398  stcUsbDeviceConfig.astcReportDescriptors = (stc_usbdevice_reportdescriptor_t*)astcReportDescriptors;
399  stcUsbDeviceConfig.pstcStringDescriptors = (stc_usbdevice_stringdescriptor_t*)pstcStringDescriptors;
400  stcUsbDeviceConfig.u8StringDescriptorCount = USBDESCRIPTORS_STRINGDESCRIPTOR_COUNT;
401  #endif
402  #endif /* (FM_PERIPHERAL_USB_DEVICE_ENABLED) */
403 
404  stcUsbConfig.bUseInterrupts = TRUE;
405 
406  #if (FM_PERIPHERAL_USB_DEVICE_ENABLED)
407  #if ((FM_PERIPHERAL_ENABLE_USB1 == ON) && ((USE_USBDEVICEHW_H == 1) || (USB_USE_PDL == 1)))
408  stcUsbConfig.pfnDeviceVbus = UsbConfig_Device1Vbus;
409  #endif
410  #endif /* (FM_PERIPHERAL_USB_DEVICE_ENABLED) */
411 
412  #if (FM_PERIPHERAL_USB_HOST_ENABLED)
413  #if ((FM_PERIPHERAL_ENABLE_USB1 == ON) && ((USE_USBHOSTHW_H == 1) || (USB_USE_PDL == 1)))
414  stcUsbConfig.pfnHostVbus = UsbConfig_Host1Vbus;
415  stcUsbConfig.pfnHostPullDownHostEnable = UsbConfig_Host1PulldownHostEnable;
416  stcUsbConfig.pfnHostOvercurrent = UsbConfig_Host1Overcurrent;
417  #endif
418  #endif /* (FM_PERIPHERAL_USB_HOST_ENABLED) */
419 
420  #if FM_PERIPHERAL_ENABLE_USB1_DEVICE == ON
421  stcUsbDeviceConfig.pfnInitClassesCallback = UsbConfig_UsbDeviceClassesInitCallback1;
422  #endif
423 
424  #if FM_PERIPHERAL_ENABLE_USB1_DEVICE == ON
425  UsbDevice_Init((stc_usbn_t*)&USB1,&stcUsbConfig,&stcUsbDeviceConfig);
426  #endif
427 
428  #if FM_PERIPHERAL_ENABLE_USB1 == ON
429  #if FM_PERIPHERAL_ENABLE_USB1_HOST == ON
430  UsbHost_Init((stc_usbn_t*)&USB1,&stcUsbConfig);
431  #endif
432  Usb_Configure((stc_usbn_t*)&USB1,&stcUsbConfig);
433  #endif
434 }
static void UsbConfig_UsbDeviceClassesInitCallback0(stc_usbn_t *pstcUSB)
Definition: usbconfig.cpp:233
boolean_t UsbConfig_Host1PulldownHostEnable(en_usb_gpio_param_t enType)
Host 1 pull-down GPIO / external interrupt callback.
Definition: usbconfig.cpp:725
static void UsbConfig_UsbDeviceClassesInitCallback1(stc_usbn_t *pstcUSB)
Definition: usbconfig.cpp:264
boolean_t UsbConfig_Host0Overcurrent(en_usb_extint_param_t enType)
Host 0 Overcurrent GPIO / external interrupt callback.
Definition: usbconfig.cpp:542
boolean_t UsbConfig_Host1Overcurrent(en_usb_extint_param_t enType)
Host 1 Overcurrent GPIO / external interrupt callback.
Definition: usbconfig.cpp:650
boolean_t UsbConfig_Host0PulldownHostEnable(en_usb_gpio_param_t enType)
Host 0 pull-down GPIO / external interrupt callback.
Definition: usbconfig.cpp:617
static boolean_t UsbConfig_Device1Vbus(en_usb_extint_param_t enType)
Device 1 VBUS GPIO / external interrupt callback.
Definition: usbconfig.cpp:492
boolean_t UsbConfig_Host1Vbus(en_usb_gpio_param_t enType)
Host 1 VBUS GPIO / external interrupt callback.
Definition: usbconfig.cpp:694
boolean_t UsbConfig_Host0Vbus(en_usb_gpio_param_t enType)
Host 0 VBUS GPIO / external interrupt callback.
Definition: usbconfig.cpp:586
static boolean_t UsbConfig_Device0Vbus(en_usb_extint_param_t enType)
Device 0 VBUS GPIO / external interrupt callback.
Definition: usbconfig.cpp:448
const uint8_t au8ConfigDescriptor[53]
const stc_usbdevice_stringdescriptor_t pstcStringDescriptors[]
const stc_usbdevice_reportdescriptor_t astcReportDescriptors[3]
const uint8_t au8DeviceDescriptor[18]

Referenced by usb_serial_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UsbDevice_Usb0ExintCallback()

void UsbDevice_Usb0ExintCallback ( void  )

Definition at line 780 of file usbconfig.cpp.

781 {
782  if (Usb_SwitchUsb((stc_usbn_t*)&USB0,UsbSwitchDependingDeviceVbus,0) == Ok)
783  {
784  if (DEVICE0VBUS_HIGHDETECT)
785  {
786  DEVICE0VBUS_SETLOWDETECT;
787  }
788  else
789  {
790  DEVICE0VBUS_SETHIGHDETECT;
791  }
792  }
793 
794 }

Referenced by INT0_7_Handler(), INT8_15_Handler(), and INT8_31_Handler().

Here is the caller graph for this function:

◆ UsbDevice_Usb1ExintCallback()

void UsbDevice_Usb1ExintCallback ( void  )

Definition at line 798 of file usbconfig.cpp.

799 {
800  if (Usb_SwitchUsb((stc_usbn_t*)&USB1,UsbSwitchDependingDeviceVbus,0) == Ok)
801  {
802  if (DEVICE1VBUS_HIGHDETECT)
803  {
804  DEVICE1VBUS_SETLOWDETECT;
805  }
806  else
807  {
808  DEVICE1VBUS_SETHIGHDETECT;
809  }
810  }
811 }

Referenced by INT0_7_Handler(), INT8_15_Handler(), and INT8_31_Handler().

Here is the caller graph for this function:

Go to the source code of this file.