usb_conf.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*!
  2. \file usb_conf.h
  3. \brief USBFS driver basic configuration
  4. */
  5. /*
  6. Copyright (C) 2017 GigaDevice
  7. 2017-06-06, V1.0.0, firmware for GD32F3x0
  8. */
  9. #ifndef USB_CONF_H
  10. #define USB_CONF_H
  11. #include "gd32f3x0.h"
  12. #include "gd32f3x0_eval.h"
  13. #ifdef USE_USBFS
  14. #define USBFS_CORE
  15. #endif /* USE_USBFS */
  16. #ifdef USE_USBHS
  17. #define USBHS_CORE
  18. #endif /* USE_USBHS */
  19. #ifdef USBFS_CORE
  20. #define RX_FIFO_FS_SIZE 128
  21. #define TX0_FIFO_FS_SIZE 64
  22. #define TX1_FIFO_FS_SIZE 128
  23. #define TX2_FIFO_FS_SIZE 0
  24. #define TX3_FIFO_FS_SIZE 0
  25. // #define USBFS_LOW_PWR_MGMT_SUPPORT
  26. // #define USBFS_SOF_OUTPUT_ENABLED
  27. #endif /* USBFS_CORE */
  28. #ifdef USBHS_CORE
  29. #define RX_FIFO_HS_SIZE 512
  30. #define TX0_FIFO_HS_SIZE 128
  31. #define TX1_FIFO_HS_SIZE 372
  32. #define TX2_FIFO_HS_SIZE 0
  33. #define TX3_FIFO_HS_SIZE 0
  34. #define TX4_FIFO_HS_SIZE 0
  35. #define TX5_FIFO_HS_SIZE 0
  36. #ifdef USE_ULPI_PHY
  37. #define USB_ULPI_PHY_ENABLED
  38. #endif
  39. #ifdef USE_EMBEDDED_PHY
  40. #define USB_EMBEDDED_PHY_ENABLED
  41. #endif
  42. // #define USBHS_INTERNAL_DMA_ENABLED
  43. #define USBHS_DEDICATED_EP1_ENABLED
  44. #define USBHS_LOW_PWR_MGMT_SUPPORT
  45. #define USBHS_SOF_OUTPUT_ENABLED
  46. #endif /* USBHS_CORE */
  47. //#define VBUS_SENSING_ENABLED
  48. //#define USE_HOST_MODE
  49. #define USE_DEVICE_MODE
  50. //#define USE_OTG_MODE
  51. /* In HS mode and when the DMA is used, all variables and data structures dealing
  52. with the DMA during the transaction process should be 4-bytes aligned */
  53. #ifdef USBHS_INTERNAL_DMA_ENABLED
  54. #if defined (__GNUC__) /* GNU Compiler */
  55. #define __ALIGN_END __attribute__ ((aligned (4)))
  56. #define __ALIGN_BEGIN
  57. #else
  58. #define __ALIGN_END
  59. #if defined (__CC_ARM) /* ARM Compiler */
  60. #define __ALIGN_BEGIN __align(4)
  61. #elif defined (__ICCARM__) /* IAR Compiler */
  62. #define __ALIGN_BEGIN
  63. #elif defined (__TASKING__) /* TASKING Compiler */
  64. #define __ALIGN_BEGIN __align(4)
  65. #endif /* __CC_ARM */
  66. #endif /* __GNUC__ */
  67. #else
  68. #define __ALIGN_BEGIN
  69. #define __ALIGN_END
  70. #endif /* USBHS_INTERNAL_DMA_ENABLED */
  71. #endif /* USB_CONF_H */