usb_conf.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /**
  2. **************************************************************************
  3. * @file usb_conf.h
  4. * @version v2.0.6
  5. * @date 2021-12-31
  6. * @brief usb config header file
  7. **************************************************************************
  8. * Copyright notice & Disclaimer
  9. *
  10. * The software Board Support Package (BSP) that is made available to
  11. * download from Artery official website is the copyrighted work of Artery.
  12. * Artery authorizes customers to use, copy, and distribute the BSP
  13. * software and its related documentation for the purpose of design and
  14. * development in conjunction with Artery microcontrollers. Use of the
  15. * software is governed by this copyright notice and the following disclaimer.
  16. *
  17. * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
  18. * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
  19. * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
  20. * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
  21. * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  22. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
  23. *
  24. **************************************************************************
  25. */
  26. /* define to prevent recursive inclusion -------------------------------------*/
  27. #ifndef __USB_CONF_H
  28. #define __USB_CONF_H
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. #include "at32f403a_407.h"
  33. #include "at32f403a_407_board.h"
  34. #include "stdio.h"
  35. /** @addtogroup AT32F407_periph_examples
  36. * @{
  37. */
  38. /** @addtogroup 407_USB_device_vcp_loopback
  39. * @{
  40. */
  41. /**
  42. * @brief usb endpoint max num define
  43. */
  44. #ifndef USB_EPT_MAX_NUM
  45. #define USB_EPT_MAX_NUM 8 /*!< usb device support endpoint number */
  46. #endif
  47. /**
  48. * @brief usb buffer extend to 768-1280 bytes
  49. */
  50. //#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
  51. /**
  52. * @brief auto malloc usb endpoint buffer
  53. */
  54. //#define USB_EPT_AUTO_MALLOC_BUFFER /*!< usb auto malloc endpoint tx and rx buffer */
  55. #ifndef USB_EPT_AUTO_MALLOC_BUFFER
  56. /**
  57. * @brief user custom endpoint buffer
  58. * EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
  59. */
  60. /* ept0 tx start address 0x40, size 0x40,
  61. so rx start address is 0x40 + 0x40 = 0x80 */
  62. #define EPT0_TX_ADDR 0x40 /*!< usb endpoint 0 tx buffer address offset */
  63. #define EPT0_RX_ADDR 0x80 /*!< usb endpoint 0 rx buffer address offset */
  64. #define EPT1_TX_ADDR 0xC0 /*!< usb endpoint 1 tx buffer address offset */
  65. #define EPT1_RX_ADDR 0x100 /*!< usb endpoint 1 rx buffer address offset */
  66. #define EPT2_TX_ADDR 0x140 /*!< usb endpoint 2 tx buffer address offset */
  67. #define EPT2_RX_ADDR 0x180 /*!< usb endpoint 2 rx buffer address offset */
  68. #define EPT3_TX_ADDR 0x00 /*!< usb endpoint 3 tx buffer address offset */
  69. #define EPT3_RX_ADDR 0x00 /*!< usb endpoint 3 rx buffer address offset */
  70. #define EPT4_TX_ADDR 0x00 /*!< usb endpoint 4 tx buffer address offset */
  71. #define EPT4_RX_ADDR 0x00 /*!< usb endpoint 4 rx buffer address offset */
  72. #define EPT5_TX_ADDR 0x00 /*!< usb endpoint 5 tx buffer address offset */
  73. #define EPT5_RX_ADDR 0x00 /*!< usb endpoint 5 rx buffer address offset */
  74. #define EPT6_TX_ADDR 0x00 /*!< usb endpoint 6 tx buffer address offset */
  75. #define EPT6_RX_ADDR 0x00 /*!< usb endpoint 6 rx buffer address offset */
  76. #define EPT7_TX_ADDR 0x00 /*!< usb endpoint 7 tx buffer address offset */
  77. #define EPT7_RX_ADDR 0x00 /*!< usb endpoint 7 rx buffer address offset */
  78. #endif
  79. void usb_delay_ms(uint32_t ms);
  80. void usb_delay_us(uint32_t us);
  81. /**
  82. * @}
  83. */
  84. /**
  85. * @}
  86. */
  87. #ifdef __cplusplus
  88. }
  89. #endif
  90. #endif