api_config.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. USB CONFIG Description
  2. =======================================
  3. General CONFIG
  4. ---------------------
  5. CONFIG_USB_PRINTF
  6. ^^^^^^^^^^^^^^^^^^^^
  7. USB log functionality, defaults to redirect to printf. Note that USB log will be used in interrupts, so the redirected API must not block. For example, if using RT-Thread, please change to rt-kprintf
  8. CONFIG_USB_DBG_LEVEL
  9. ^^^^^^^^^^^^^^^^^^^^^^
  10. Controls the log print level
  11. CONFIG_USB_PRINTF_COLOR_ENABLE
  12. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  13. Controls log color printing, enabled by default
  14. CONFIG_USB_DCACHE_ENABLE
  15. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  16. When not using nocache RAM, enable this macro to ensure data consistency. **When using EHCI, nocache RAM is still required internally**.
  17. CONFIG_USB_ALIGN_SIZE
  18. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  19. USB buffer alignment size, default is 4. IP in DMA mode may have alignment requirements for input buffers, typically 4. If other alignment is needed, please modify this value.
  20. USB_NOCACHE_RAM_SECTION
  21. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  22. If the chip doesn't have cache functionality, this macro is ineffective. If it does, USB input/output buffers must be placed in nocache RAM to ensure data consistency.
  23. Device Protocol Stack CONFIG
  24. ------------------------------
  25. CONFIG_USBDEV_REQUEST_BUFFER_LEN
  26. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  27. Controls the maximum length of control transfer receive and send buffer, default is 512.
  28. CONFIG_USBDEV_SETUP_LOG_PRINT
  29. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  30. Enable or disable setup packet dump information, disabled by default.
  31. CONFIG_USBDEV_DESC_CHECK
  32. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  33. Not implemented yet
  34. CONFIG_USBDEV_TEST_MODE
  35. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  36. Enable or disable USB test mode
  37. CONFIG_USBDEV_MSC_MAX_BUFSIZE
  38. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  39. Maximum length of MSC cache. Larger cache results in higher USB speed because storage media typically has much higher multi-block read/write speeds than single block, such as SD cards.
  40. Default 512. For flash, needs to be changed to 4K. Cache size must be a multiple of the storage media's block size.
  41. CONFIG_USBDEV_MSC_MANUFACTURER_STRING
  42. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  43. CONFIG_USBDEV_MSC_PRODUCT_STRING
  44. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  45. CONFIG_USBDEV_MSC_VERSION_STRING
  46. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  47. CONFIG_USBDEV_MSC_POLLING
  48. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  49. Run usbd_msc_sector_read and usbd_msc_sector_write operations in while1, used in bare-metal systems.
  50. CONFIG_USBDEV_MSC_THREAD
  51. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  52. Enable or disable MSC thread, disabled by default. usbd_msc_sector_read and usbd_msc_sector_write are executed in interrupts by default, so if OS is enabled, it's recommended to enable this macro, then usbd_msc_sector_read and usbd_msc_sector_write will execute in threads.
  53. CONFIG_USBDEV_MSC_PRIO
  54. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  55. Priority of MSC read/write thread, default is 4. Lower values mean higher priority.
  56. CONFIG_USBDEV_MSC_STACKSIZE
  57. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  58. Stack size of MSC read/write thread, default 2K bytes
  59. CONFIG_USBDEV_RNDIS_RESP_BUFFER_SIZE
  60. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  61. Maximum receive and send length for RNDIS control transfers. Minimum length determined by RNDIS options list, default should be greater than or equal to 156.
  62. CONFIG_USBDEV_RNDIS_ETH_MAX_FRAME_SIZE
  63. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  64. Maximum length of RNDIS Ethernet frame, default 1580
  65. CONFIG_USBDEV_RNDIS_VENDOR_ID
  66. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  67. CONFIG_USBDEV_RNDIS_VENDOR_DESC
  68. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  69. CONFIG_USBDEV_RNDIS_USING_LWIP
  70. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  71. RNDIS interface with LWIP
  72. Host Protocol Stack CONFIG
  73. ----------------------------
  74. The following parameters determine the maximum number of supported external hubs, interfaces, endpoints per interface, and altsetting counts. Changing these values affects RAM size, it's recommended to adjust according to actual requirements.
  75. .. code-block:: C
  76. #define CONFIG_USBHOST_MAX_RHPORTS 1
  77. #define CONFIG_USBHOST_MAX_EXTHUBS 1
  78. #define CONFIG_USBHOST_MAX_EHPORTS 4
  79. #define CONFIG_USBHOST_MAX_INTERFACES 6
  80. #define CONFIG_USBHOST_MAX_INTF_ALTSETTINGS 1
  81. #define CONFIG_USBHOST_MAX_ENDPOINTS 4
  82. The following parameters determine the maximum number of supported class drivers. Changing these values affects RAM size, it's recommended to adjust according to actual requirements.
  83. .. code-block:: C
  84. #define CONFIG_USBHOST_MAX_SERIAL_CLASS 4
  85. #define CONFIG_USBHOST_MAX_HID_CLASS 4
  86. #define CONFIG_USBHOST_MAX_MSC_CLASS 2
  87. #define CONFIG_USBHOST_MAX_AUDIO_CLASS 1
  88. #define CONFIG_USBHOST_MAX_VIDEO_CLASS 1
  89. CONFIG_USBHOST_PSC_PRIO
  90. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  91. Priority of host plug/unplug thread, default is 0. Lower values mean higher priority.
  92. CONFIG_USBHOST_PSC_STACKSIZE
  93. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  94. Stack size of host plug/unplug thread, default 2K bytes
  95. CONFIG_USBHOST_REQUEST_BUFFER_LEN
  96. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  97. Maximum length for control transfer receive or send
  98. CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT
  99. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  100. Timeout for control transfer send or receive, default 500 ms
  101. CONFIG_USBHOST_MSC_TIMEOUT
  102. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  103. Timeout for MSC read/write transfers, default 5s