usb_device_config.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. * Copyright (c) 2015, Freescale Semiconductor, Inc.
  3. * Copyright 2016 - 2017 NXP
  4. *
  5. * Redistribution and use in source and binary forms, with or without modification,
  6. * are permitted provided that the following conditions are met:
  7. *
  8. * o Redistributions of source code must retain the above copyright notice, this list
  9. * of conditions and the following disclaimer.
  10. *
  11. * o Redistributions in binary form must reproduce the above copyright notice, this
  12. * list of conditions and the following disclaimer in the documentation and/or
  13. * other materials provided with the distribution.
  14. *
  15. * o Neither the name of the copyright holder nor the names of its
  16. * contributors may be used to endorse or promote products derived from this
  17. * software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  23. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  26. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #ifndef _USB_DEVICE_CONFIG_H_
  31. #define _USB_DEVICE_CONFIG_H_
  32. /*******************************************************************************
  33. * Definitions
  34. ******************************************************************************/
  35. /*!
  36. * @addtogroup usb_device_configuration
  37. * @{
  38. */
  39. /*!
  40. * @name Hardware instance define
  41. * @{
  42. */
  43. /*! @brief KHCI instance count */
  44. #define USB_DEVICE_CONFIG_KHCI (0U)
  45. /*! @brief EHCI instance count */
  46. #define USB_DEVICE_CONFIG_EHCI (2U)
  47. /*! @brief LPC USB IP3511 FS instance count */
  48. #define USB_DEVICE_CONFIG_LPCIP3511FS (0U)
  49. /*! @brief LPC USB IP3511 HS instance count */
  50. #define USB_DEVICE_CONFIG_LPCIP3511HS (0U)
  51. /*! @brief Device instance count, the sum of KHCI and EHCI instance counts*/
  52. #define USB_DEVICE_CONFIG_NUM \
  53. (USB_DEVICE_CONFIG_KHCI + USB_DEVICE_CONFIG_EHCI + USB_DEVICE_CONFIG_LPCIP3511FS + USB_DEVICE_CONFIG_LPCIP3511HS)
  54. /* @} */
  55. /*!
  56. * @name class instance define
  57. * @{
  58. */
  59. /*! @brief HID instance count */
  60. #define USB_DEVICE_CONFIG_HID (0U)
  61. /*! @brief CDC ACM instance count */
  62. #define USB_DEVICE_CONFIG_CDC_ACM (1U)
  63. /*! @brief MSC instance count */
  64. #define USB_DEVICE_CONFIG_MSC (0U)
  65. /*! @brief Audio instance count */
  66. #define USB_DEVICE_CONFIG_AUDIO (0U)
  67. /*! @brief PHDC instance count */
  68. #define USB_DEVICE_CONFIG_PHDC (0U)
  69. /*! @brief Video instance count */
  70. #define USB_DEVICE_CONFIG_VIDEO (0U)
  71. /*! @brief CCID instance count */
  72. #define USB_DEVICE_CONFIG_CCID (0U)
  73. /*! @brief Printer instance count */
  74. #define USB_DEVICE_CONFIG_PRINTER (0U)
  75. /*! @brief DFU instance count */
  76. #define USB_DEVICE_CONFIG_DFU (0U)
  77. /* @} */
  78. /*! @brief Whether device is self power. 1U supported, 0U not supported */
  79. #define USB_DEVICE_CONFIG_SELF_POWER (1U)
  80. /*! @brief How many endpoints are supported in the stack. */
  81. #define USB_DEVICE_CONFIG_ENDPOINTS (4U)
  82. /*! @brief Whether the device task is enabled. */
  83. #define USB_DEVICE_CONFIG_USE_TASK (0U)
  84. /*! @brief How many the notification message are supported when the device task is enabled. */
  85. #define USB_DEVICE_CONFIG_MAX_MESSAGES (8U)
  86. /*! @brief Whether test mode enabled. */
  87. #define USB_DEVICE_CONFIG_USB20_TEST_MODE (0U)
  88. /*! @brief Whether device CV test is enabled. */
  89. #define USB_DEVICE_CONFIG_CV_TEST (0U)
  90. /*! @brief Whether device compliance test is enabled. If the macro is enabled,
  91. the test mode and CV test macroes will be set.*/
  92. #define USB_DEVICE_CONFIG_COMPLIANCE_TEST (0U)
  93. #if ((defined(USB_DEVICE_CONFIG_COMPLIANCE_TEST)) && (USB_DEVICE_CONFIG_COMPLIANCE_TEST > 0U))
  94. /*! @brief Undefine the marco USB_DEVICE_CONFIG_USB20_TEST_MODE. */
  95. #undef USB_DEVICE_CONFIG_USB20_TEST_MODE
  96. /*! @brief Undefine the marco USB_DEVICE_CONFIG_CV_TEST. */
  97. #undef USB_DEVICE_CONFIG_CV_TEST
  98. /*! @brief enable the test mode. */
  99. #define USB_DEVICE_CONFIG_USB20_TEST_MODE (1U)
  100. /*! @brief enable the CV test */
  101. #define USB_DEVICE_CONFIG_CV_TEST (1U)
  102. #endif
  103. #if ((defined(USB_DEVICE_CONFIG_KHCI)) && (USB_DEVICE_CONFIG_KHCI > 0U))
  104. /*! @brief The MAX buffer length for the KHCI DMA workaround.*/
  105. #define USB_DEVICE_CONFIG_KHCI_DMA_ALIGN_BUFFER_LENGTH (64U)
  106. #endif
  107. #if ((defined(USB_DEVICE_CONFIG_EHCI)) && (USB_DEVICE_CONFIG_EHCI > 0U))
  108. /*! @brief How many the DTD are supported. */
  109. #define USB_DEVICE_CONFIG_EHCI_MAX_DTD (16U)
  110. /*! @brief Whether the EHCI ID pin detect feature enabled. */
  111. #define USB_DEVICE_CONFIG_EHCI_ID_PIN_DETECT (0U)
  112. #endif
  113. /*! @brief Whether the keep alive feature enabled. */
  114. #define USB_DEVICE_CONFIG_KEEP_ALIVE_MODE (0U)
  115. /*! @brief Whether the transfer buffer is cache-enabled or not. */
  116. #define USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE (1U)
  117. /*! @brief Whether the low power mode is enabled or not. */
  118. #define USB_DEVICE_CONFIG_LOW_POWER_MODE (0U)
  119. #if ((defined(USB_DEVICE_CONFIG_LOW_POWER_MODE)) && (USB_DEVICE_CONFIG_LOW_POWER_MODE > 0U))
  120. /*! @brief Whether device remote wakeup supported. 1U supported, 0U not supported */
  121. #define USB_DEVICE_CONFIG_REMOTE_WAKEUP (0U)
  122. /*! @brief Whether LPM is supported. 1U supported, 0U not supported */
  123. #define USB_DEVICE_CONFIG_LPM_L1 (0U)
  124. #else
  125. /*! @brief The device remote wakeup is unsupported. */
  126. #define USB_DEVICE_CONFIG_REMOTE_WAKEUP (0U)
  127. #endif
  128. /*! @brief Whether the device detached feature is enabled or not. */
  129. #define USB_DEVICE_CONFIG_DETACH_ENABLE (0U)
  130. /*! @brief Whether handle the USB bus error. */
  131. #define USB_DEVICE_CONFIG_ERROR_HANDLING (0U)
  132. /* @} */
  133. /*! @brief rt-thread port alloc */
  134. #include <rtthread.h>
  135. #define USB_OSA_SR_ALLOC(...)
  136. /*! @brief rt-thread port enter critical */
  137. #define USB_OSA_ENTER_CRITICAL rt_enter_critical
  138. /*! @brief rt-thread port exit critical */
  139. #define USB_OSA_EXIT_CRITICAL rt_exit_critical
  140. #endif /* _USB_DEVICE_CONFIG_H_ */