usb_conf.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. #ifdef PRINTF_STDLIB
  35. #include <stdio.h>
  36. #endif
  37. #ifdef PRINTF_CUSTOM
  38. #include "tinystdio.h"
  39. #endif
  40. /** @addtogroup AT32F407_periph_examples
  41. * @{
  42. */
  43. /** @addtogroup 407_USB_device_vcp_loopback
  44. * @{
  45. */
  46. /**
  47. * @brief usb endpoint max num define
  48. */
  49. #ifndef USB_EPT_MAX_NUM
  50. #define USB_EPT_MAX_NUM 8 /*!< usb device support endpoint number */
  51. #endif
  52. /**
  53. * @brief usb buffer extend to 768-1280 bytes
  54. */
  55. //#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
  56. /**
  57. * @brief auto malloc usb endpoint buffer
  58. */
  59. //#define USB_EPT_AUTO_MALLOC_BUFFER /*!< usb auto malloc endpoint tx and rx buffer */
  60. #ifndef USB_EPT_AUTO_MALLOC_BUFFER
  61. /**
  62. * @brief user custom endpoint buffer
  63. * EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
  64. */
  65. /* ept0 tx start address 0x40, size 0x40,
  66. so rx start address is 0x40 + 0x40 = 0x80 */
  67. #define EPT0_TX_ADDR 0x40 /*!< usb endpoint 0 tx buffer address offset */
  68. #define EPT0_RX_ADDR 0x80 /*!< usb endpoint 0 rx buffer address offset */
  69. #define EPT1_TX_ADDR 0xC0 /*!< usb endpoint 1 tx buffer address offset */
  70. #define EPT1_RX_ADDR 0x100 /*!< usb endpoint 1 rx buffer address offset */
  71. #define EPT2_TX_ADDR 0x140 /*!< usb endpoint 2 tx buffer address offset */
  72. #define EPT2_RX_ADDR 0x180 /*!< usb endpoint 2 rx buffer address offset */
  73. #define EPT3_TX_ADDR 0x00 /*!< usb endpoint 3 tx buffer address offset */
  74. #define EPT3_RX_ADDR 0x00 /*!< usb endpoint 3 rx buffer address offset */
  75. #define EPT4_TX_ADDR 0x00 /*!< usb endpoint 4 tx buffer address offset */
  76. #define EPT4_RX_ADDR 0x00 /*!< usb endpoint 4 rx buffer address offset */
  77. #define EPT5_TX_ADDR 0x00 /*!< usb endpoint 5 tx buffer address offset */
  78. #define EPT5_RX_ADDR 0x00 /*!< usb endpoint 5 rx buffer address offset */
  79. #define EPT6_TX_ADDR 0x00 /*!< usb endpoint 6 tx buffer address offset */
  80. #define EPT6_RX_ADDR 0x00 /*!< usb endpoint 6 rx buffer address offset */
  81. #define EPT7_TX_ADDR 0x00 /*!< usb endpoint 7 tx buffer address offset */
  82. #define EPT7_RX_ADDR 0x00 /*!< usb endpoint 7 rx buffer address offset */
  83. #endif
  84. void usb_delay_ms(uint32_t ms);
  85. void usb_delay_us(uint32_t us);
  86. /**
  87. * @}
  88. */
  89. /**
  90. * @}
  91. */
  92. #ifdef __cplusplus
  93. }
  94. #endif
  95. #endif