usb_config.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023-02-28 leo first version
  9. */
  10. #ifndef __USB_CONFIG_H__
  11. #define __USB_CONFIG_H__
  12. #include <rtthread.h>
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #if defined BSP_USING_DEVICE_USBOTG1
  17. #define USE_OTG_DEVICE_MODE
  18. #endif
  19. #if defined BSP_USING_HOST_USBOTG1
  20. #define USE_OTG_HOST_MODE
  21. #endif
  22. /* usb irqhandler */
  23. #define OTGFS1_IRQHandler OTGFS1_IRQHandler
  24. /**
  25. * @brief usb device mode config
  26. */
  27. #define USB_EPT_MAX_NUM 8
  28. /* otg1 device fifo */
  29. #define USBD_RX_SIZE 128
  30. #define USBD_EP0_TX_SIZE 24
  31. #define USBD_EP1_TX_SIZE 20
  32. #define USBD_EP2_TX_SIZE 20
  33. #define USBD_EP3_TX_SIZE 20
  34. #define USBD_EP4_TX_SIZE 20
  35. #define USBD_EP5_TX_SIZE 20
  36. #define USBD_EP6_TX_SIZE 20
  37. #define USBD_EP7_TX_SIZE 20
  38. /**
  39. * @brief usb host mode config
  40. */
  41. #define USB_HOST_CHANNEL_NUM 16
  42. /* otg1 host fifo */
  43. #define USBH_RX_FIFO_SIZE 128
  44. #define USBH_NP_TX_FIFO_SIZE 96
  45. #define USBH_P_TX_FIFO_SIZE 96
  46. /**
  47. * @brief usb sof output enable
  48. */
  49. // #define USB_SOF_OUTPUT_ENABLE
  50. /**
  51. * @brief usb vbus ignore, not use vbus pin
  52. */
  53. #define USB_VBUS_IGNORE
  54. /**
  55. * @brief usb low power wakeup handler enable
  56. */
  57. // #define USB_LOW_POWER_WAKUP
  58. #if defined(BSP_USING_HOST_USBOTG1)
  59. #undef BSP_USING_DEVICE_USBOTG1
  60. #define USBOTG1_CONFIG \
  61. { \
  62. .name = "usbh", \
  63. .id = USB_OTG1_ID, \
  64. .dev_spd = USB_FULL_SPEED_CORE_ID, \
  65. .irqn = OTGFS1_IRQn, \
  66. }
  67. #endif /* BSP_USING_HOST_USBOTG1 */
  68. #if defined(BSP_USING_DEVICE_USBOTG1)
  69. #define USBOTG1_CONFIG \
  70. { \
  71. .name = "usbd", \
  72. .id = USB_OTG1_ID, \
  73. .dev_spd = USB_FULL_SPEED_CORE_ID, \
  74. .irqn = OTGFS1_IRQn, \
  75. }
  76. #endif /* BSP_USING_DEVICE_USBOTG1 */
  77. #ifdef __cplusplus
  78. }
  79. #endif
  80. #endif