usb_config.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. * 2024-12-18 shelton 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. /* otg2 device fifo */
  39. #define USBD2_RX_SIZE 256
  40. #define USBD2_EP0_TX_SIZE 64
  41. #define USBD2_EP1_TX_SIZE 256
  42. #define USBD2_EP2_TX_SIZE 256
  43. #define USBD2_EP3_TX_SIZE 20
  44. #define USBD2_EP4_TX_SIZE 20
  45. #define USBD2_EP5_TX_SIZE 20
  46. #define USBD2_EP6_TX_SIZE 20
  47. #define USBD2_EP7_TX_SIZE 20
  48. /**
  49. * @brief usb host mode config
  50. */
  51. #define USB_HOST_CHANNEL_NUM 16
  52. /* otg1 host fifo */
  53. #define USBH_RX_FIFO_SIZE 128
  54. #define USBH_NP_TX_FIFO_SIZE 96
  55. #define USBH_P_TX_FIFO_SIZE 96
  56. /* otg2 host fifo */
  57. #define USBH2_RX_FIFO_SIZE 256
  58. #define USBH2_NP_TX_FIFO_SIZE 256
  59. #define USBH2_P_TX_FIFO_SIZE 256
  60. /**
  61. * @brief usb sof output enable
  62. */
  63. // #define USB_SOF_OUTPUT_ENABLE
  64. /**
  65. * @brief usb vbus ignore, not use vbus pin
  66. */
  67. #define USB_VBUS_IGNORE
  68. /**
  69. * @brief usb high speed support dma mode
  70. */
  71. // #define OTG_USE_DMA
  72. /**
  73. * @brief usb low power wakeup handler enable
  74. */
  75. // #define USB_LOW_POWER_WAKUP
  76. #if defined(BSP_USING_HOST_USBOTG1)
  77. #undef BSP_USING_DEVICE_USBOTG1
  78. #define USBOTG1_CONFIG \
  79. { \
  80. .name = "usbh1", \
  81. .id = USB_OTG1_ID, \
  82. .dev_spd = USB_FULL_SPEED_CORE_ID, \
  83. .irqn = OTGFS1_IRQn, \
  84. }
  85. #endif /* BSP_USING_HOST_USBOTG1 */
  86. #if defined(BSP_USING_DEVICE_USBOTG1)
  87. #define USBOTG1_CONFIG \
  88. { \
  89. .name = "usbd", \
  90. .id = USB_OTG1_ID, \
  91. .dev_spd = USB_FULL_SPEED_CORE_ID, \
  92. .irqn = OTGFS1_IRQn, \
  93. }
  94. #endif /* BSP_USING_DEVICE_USBOTG1 */
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98. #endif