usb_config.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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_USBFS1
  17. #define USE_OTG_DEVICE_MODE
  18. #endif
  19. #if defined BSP_USING_HOST_USBFS1
  20. #define USE_OTG_HOST_MODE
  21. #endif
  22. /* usbfs irqhandler */
  23. #define OTGFS1_IRQHandler OTGFS1_IRQHandler
  24. /**
  25. * @brief usb device mode config
  26. */
  27. #define USB_EPT_MAX_NUM 4
  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 8
  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_USBFS1)
  59. #undef BSP_USING_DEVICE_USBFS1
  60. #define USBFS1_CONFIG \
  61. { \
  62. .name = "usbh", \
  63. .id = USB_OTG1_ID, \
  64. .irqn = OTGFS1_IRQn, \
  65. }
  66. #endif /* BSP_USING_HOST_USBFS1 */
  67. #if defined(BSP_USING_DEVICE_USBFS1)
  68. #define USBFS1_CONFIG \
  69. { \
  70. .name = "usbd", \
  71. .id = USB_OTG1_ID, \
  72. .irqn = OTGFS1_IRQn, \
  73. }
  74. #endif /* BSP_USING_DEVICE_USBFS1 */
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #endif