usb_conf.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Copyright (c) 2006-2020, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023-09-25 XYZboom fix usb_conf.h not found in nuclei-sdk after 0.3.8
  9. */
  10. #ifndef __USB_CONF_H__
  11. #define __USB_CONF_H__
  12. #include <stddef.h>
  13. #include "gd32vf103.h"
  14. #define USE_USB_FS
  15. #ifdef USE_USB_FS
  16. #define USB_FS_CORE
  17. #endif
  18. #ifdef USE_USB_HS
  19. #define USB_HS_CORE
  20. #endif
  21. #ifdef USB_FS_CORE
  22. #define RX_FIFO_FS_SIZE 128
  23. #define TX0_FIFO_FS_SIZE 64
  24. #define TX1_FIFO_FS_SIZE 128
  25. #define TX2_FIFO_FS_SIZE 0
  26. #define TX3_FIFO_FS_SIZE 0
  27. #define USB_RX_FIFO_FS_SIZE 128
  28. #define USB_HTX_NPFIFO_FS_SIZE 96
  29. #define USB_HTX_PFIFO_FS_SIZE 96
  30. #endif /* USB_FS_CORE */
  31. #ifdef USB_HS_CORE
  32. #define RX_FIFO_HS_SIZE 512
  33. #define TX0_FIFO_HS_SIZE 128
  34. #define TX1_FIFO_HS_SIZE 372
  35. #define TX2_FIFO_HS_SIZE 0
  36. #define TX3_FIFO_HS_SIZE 0
  37. #define TX4_FIFO_HS_SIZE 0
  38. #define TX5_FIFO_HS_SIZE 0
  39. #ifdef USE_ULPI_PHY
  40. #define USB_OTG_ULPI_PHY_ENABLED
  41. #endif
  42. #ifdef USE_EMBEDDED_PHY
  43. #define USB_OTG_EMBEDDED_PHY_ENABLED
  44. #endif
  45. #define USB_OTG_HS_INTERNAL_DMA_ENABLED
  46. #define USB_OTG_HS_DEDICATED_EP1_ENABLED
  47. #endif /* USB_HS_CORE */
  48. #ifndef USB_SOF_OUTPUT
  49. #define USB_SOF_OUTPUT 0
  50. #endif
  51. #ifndef USB_LOW_POWER
  52. #define USB_LOW_POWER 0
  53. #endif
  54. #ifndef USE_HOST_MODE
  55. #define USE_DEVICE_MODE
  56. #endif
  57. #ifndef USB_FS_CORE
  58. #ifndef USB_HS_CORE
  59. #error "USB_HS_CORE or USB_FS_CORE should be defined"
  60. #endif
  61. #endif
  62. #ifndef USE_DEVICE_MODE
  63. #ifndef USE_HOST_MODE
  64. #error "USE_DEVICE_MODE or USE_HOST_MODE should be defined"
  65. #endif
  66. #endif
  67. #ifndef USE_USB_HS
  68. #ifndef USE_USB_FS
  69. #error "USE_USB_HS or USE_USB_FS should be defined"
  70. #endif
  71. #endif
  72. /****************** C Compilers dependant keywords ****************************/
  73. /* In HS mode and when the DMA is used, all variables and data structures dealing
  74. with the DMA during the transaction process should be 4-bytes aligned */
  75. #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
  76. #if defined (__GNUC__) /* GNU Compiler */
  77. #define __ALIGN_END __attribute__ ((aligned(4)))
  78. #define __ALIGN_BEGIN
  79. #endif /* __GNUC__ */
  80. #else
  81. #define __ALIGN_BEGIN
  82. #define __ALIGN_END
  83. #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
  84. #endif /* __USB_CONF_H__ */