S&B Volcano vaporizer remote control with Pi Pico W
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

tusb_config.h 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Extended from TinyUSB example code.
  3. *
  4. * Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
  5. *
  6. * The MIT License (MIT)
  7. *
  8. * Copyright (c) 2019 Ha Thach (tinyusb.org)
  9. *
  10. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11. * of this software and associated documentation files (the "Software"), to deal
  12. * in the Software without restriction, including without limitation the rights
  13. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14. * copies of the Software, and to permit persons to whom the Software is
  15. * furnished to do so, subject to the following conditions:
  16. *
  17. * The above copyright notice and this permission notice shall be included in
  18. * all copies or substantial portions of the Software.
  19. *
  20. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  23. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  24. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  25. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  26. * THE SOFTWARE.
  27. *
  28. */
  29. #ifndef _TUSB_CONFIG_H_
  30. #define _TUSB_CONFIG_H_
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. //--------------------------------------------------------------------
  35. // COMMON CONFIGURATION
  36. //--------------------------------------------------------------------
  37. // defined by board.mk
  38. #ifndef CFG_TUSB_MCU
  39. #error CFG_TUSB_MCU must be defined
  40. #endif
  41. // RHPort number used for device can be defined by board.mk, default to port 0
  42. #ifndef BOARD_DEVICE_RHPORT_NUM
  43. #define BOARD_DEVICE_RHPORT_NUM 0
  44. #endif
  45. // RHPort max operational speed can defined by board.mk
  46. // Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed
  47. #ifndef BOARD_DEVICE_RHPORT_SPEED
  48. #if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \
  49. CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56 || CFG_TUSB_MCU == OPT_MCU_SAMX7X)
  50. #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
  51. #else
  52. #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
  53. #endif
  54. #endif
  55. // Device mode with rhport and speed defined by board.mk
  56. #if BOARD_DEVICE_RHPORT_NUM == 0
  57. #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | BOARD_DEVICE_RHPORT_SPEED)
  58. #elif BOARD_DEVICE_RHPORT_NUM == 1
  59. #define CFG_TUSB_RHPORT1_MODE (OPT_MODE_DEVICE | BOARD_DEVICE_RHPORT_SPEED)
  60. #else
  61. #error "Incorrect RHPort configuration"
  62. #endif
  63. #ifndef CFG_TUSB_OS
  64. #define CFG_TUSB_OS OPT_OS_NONE
  65. #endif
  66. // CFG_TUSB_DEBUG is defined by compiler in DEBUG build
  67. // #define CFG_TUSB_DEBUG 0
  68. /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
  69. * Tinyusb use follows macros to declare transferring memory so that they can be put
  70. * into those specific section.
  71. * e.g
  72. * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") ))
  73. * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4)))
  74. */
  75. #ifndef CFG_TUSB_MEM_SECTION
  76. #define CFG_TUSB_MEM_SECTION
  77. #endif
  78. #ifndef CFG_TUSB_MEM_ALIGN
  79. #define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4)))
  80. #endif
  81. //--------------------------------------------------------------------
  82. // DEVICE CONFIGURATION
  83. //--------------------------------------------------------------------
  84. #ifndef CFG_TUD_ENDPOINT0_SIZE
  85. #define CFG_TUD_ENDPOINT0_SIZE 64
  86. #endif
  87. //------------- CLASS -------------//
  88. #define CFG_TUD_HID 0
  89. #define CFG_TUD_CDC 1
  90. #define CFG_TUD_MSC 1
  91. #define CFG_TUD_MIDI 0
  92. #define CFG_TUD_VENDOR 0
  93. // HID buffer size Should be sufficient to hold ID (if any) + Data
  94. #define CFG_TUD_HID_EP_BUFSIZE 16
  95. // CDC FIFO size of TX and RX
  96. #define CFG_TUD_CDC_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
  97. #define CFG_TUD_CDC_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
  98. // CDC Endpoint transfer buffer size, more is faster
  99. #define CFG_TUD_CDC_EP_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
  100. // MSC Buffer size of Device Mass storage
  101. #define CFG_TUD_MSC_EP_BUFSIZE 512
  102. #ifdef __cplusplus
  103. }
  104. #endif
  105. #endif /* _TUSB_CONFIG_H_ */