usb_host_config.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. /*
  2. * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc.
  3. * Copyright 2016 - 2019 NXP
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. */
  8. #ifndef _USB_HOST_CONFIG_H_
  9. #define _USB_HOST_CONFIG_H_
  10. /* Host Controller Enable */
  11. /*!
  12. * @brief host khci instance count, meantime it indicates khci enable or disable.
  13. * - if 0, host khci driver is disable.
  14. * - if greater than 0, host khci driver is enable.
  15. */
  16. #define USB_HOST_CONFIG_KHCI (0U)
  17. /*!
  18. * @brief host ehci instance count, meantime it indicates ehci enable or disable.
  19. * - if 0, host ehci driver is disable.
  20. * - if greater than 0, host ehci driver is enable.
  21. */
  22. #define USB_HOST_CONFIG_EHCI (1U)
  23. /*!
  24. * @brief host ohci instance count, meantime it indicates ohci enable or disable.
  25. * - if 0, host ohci driver is disable.
  26. * - if greater than 0, host ohci driver is enable.
  27. */
  28. #define USB_HOST_CONFIG_OHCI (0U)
  29. /*!
  30. * @brief host ip3516hs instance count, meantime it indicates ohci enable or disable.
  31. * - if 0, host ip3516hs driver is disable.
  32. * - if greater than 0, host ip3516hs driver is enable.
  33. */
  34. #define USB_HOST_CONFIG_IP3516HS (0U)
  35. /* Common configuration macros for all controllers */
  36. /*!
  37. * @brief host driver instance max count.
  38. * for example: 2 - one for khci, one for ehci.
  39. */
  40. #define USB_HOST_CONFIG_MAX_HOST \
  41. (USB_HOST_CONFIG_KHCI + USB_HOST_CONFIG_EHCI + USB_HOST_CONFIG_OHCI + USB_HOST_CONFIG_IP3516HS)
  42. /*!
  43. * @brief host pipe max count.
  44. * pipe is the host driver resource for device endpoint, one endpoint need one pipe.
  45. */
  46. #define USB_HOST_CONFIG_MAX_PIPES (16U)
  47. /*!
  48. * @brief host transfer max count.
  49. * transfer is the host driver resource for data transmission mission, one transmission mission need one transfer.
  50. */
  51. #define USB_HOST_CONFIG_MAX_TRANSFERS (16U)
  52. /*!
  53. * @brief the max endpoint for one interface.
  54. * the max endpoint descriptor number that one interface descriptor contain.
  55. */
  56. #define USB_HOST_CONFIG_INTERFACE_MAX_EP (4U)
  57. /*!
  58. * @brief the max interface for one configuration.
  59. * the max interface descriptor number that one configuration descriptor can contain.
  60. */
  61. #define USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE (5U)
  62. /*!
  63. * @brief the max power for one device.
  64. * the max power the host can provide for one device.
  65. */
  66. #define USB_HOST_CONFIG_MAX_POWER (250U)
  67. /*!
  68. * @brief the max retries for enumeration.
  69. * retry time when enumeration fail.
  70. */
  71. #define USB_HOST_CONFIG_ENUMERATION_MAX_RETRIES (3U)
  72. /*!
  73. * @brief the max retries for enumeration setup stall.
  74. * the max times for one transfer can stall.
  75. */
  76. #define USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES (1U)
  77. /*!
  78. * @brief the max NAK count for one transaction.
  79. * when nak count reach to the value, the transaction fail.
  80. */
  81. #define USB_HOST_CONFIG_MAX_NAK (3000U)
  82. /*! @brief Whether the transfer buffer is cache-enabled or not. */
  83. #ifndef USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE
  84. #define USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE (0U)
  85. #endif
  86. /*! @brief if 1, enable usb compliance test codes; if 0, disable usb compliance test codes. */
  87. #ifndef USB_HOST_CONFIG_COMPLIANCE_TEST
  88. #define USB_HOST_CONFIG_COMPLIANCE_TEST (0U)
  89. #endif
  90. /*! @brief if 1, class driver clear stall automatically; if 0, class driver don't clear stall. */
  91. #define USB_HOST_CONFIG_CLASS_AUTO_CLEAR_STALL (0U)
  92. /* KHCI configuration */
  93. #if ((defined USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI))
  94. /*!
  95. * @brief khci dma align fix buffer size.
  96. */
  97. #define USB_HOST_CONFIG_KHCI_DMA_ALIGN_BUFFER (64U)
  98. #endif
  99. /* EHCI configuration */
  100. #if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI))
  101. /*!
  102. * @brief ehci periodic frame list size.
  103. * the value can be 1024, 512, 256, 128, 64, 32, 16 or 8.
  104. */
  105. #define USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE (1024U)
  106. /*!
  107. * @brief ehci QH max count.
  108. */
  109. #define USB_HOST_CONFIG_EHCI_MAX_QH (8U)
  110. /*!
  111. * @brief ehci QTD max count.
  112. */
  113. #define USB_HOST_CONFIG_EHCI_MAX_QTD (8U)
  114. /*!
  115. * @brief ehci ITD max count.
  116. */
  117. #define USB_HOST_CONFIG_EHCI_MAX_ITD (0U)
  118. /*!
  119. * @brief ehci SITD max count.
  120. */
  121. #define USB_HOST_CONFIG_EHCI_MAX_SITD (0U)
  122. #endif
  123. /* OHCI configuration */
  124. #if ((defined USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI))
  125. /*!
  126. * @brief ohci ED max count.
  127. */
  128. #define USB_HOST_CONFIG_OHCI_MAX_ED (16U)
  129. /*!
  130. * @brief ohci GTD max count.
  131. */
  132. #define USB_HOST_CONFIG_OHCI_MAX_GTD (16U)
  133. /*!
  134. * @brief ohci ITD max count.
  135. */
  136. #define USB_HOST_CONFIG_OHCI_MAX_ITD (8U)
  137. #endif
  138. /* OHCI configuration */
  139. #if ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS))
  140. #define USB_HOST_CONFIG_IP3516HS_MAX_PIPE (32U)
  141. /*!
  142. * @brief ohci ED max count.
  143. */
  144. #define USB_HOST_CONFIG_IP3516HS_MAX_ATL (32U)
  145. /*!
  146. * @brief ohci GTD max count.
  147. */
  148. #define USB_HOST_CONFIG_IP3516HS_MAX_INT (32U)
  149. /*!
  150. * @brief ohci ITD max count.
  151. */
  152. #define USB_HOST_CONFIG_IP3516HS_MAX_ISO (0U)
  153. #endif
  154. /*!
  155. * @brief host HUB class instance count, meantime it indicates HUB class enable or disable.
  156. * - if 0, host HUB class driver is disable.
  157. * - if greater than 0, host HUB class driver is enable.
  158. */
  159. #define USB_HOST_CONFIG_HUB (0U)
  160. /*!
  161. * @brief host HID class instance count, meantime it indicates HID class enable or disable.
  162. * - if 0, host HID class driver is disable.
  163. * - if greater than 0, host HID class driver is enable.
  164. */
  165. #define USB_HOST_CONFIG_HID (0U)
  166. /*!
  167. * @brief host MSD class instance count, meantime it indicates MSD class enable or disable.
  168. * - if 0, host MSD class driver is disable.
  169. * - if greater than 0, host MSD class driver is enable.
  170. */
  171. #define USB_HOST_CONFIG_MSD (0U)
  172. /*!
  173. * @brief host CDC class instance count, meantime it indicates CDC class enable or disable.
  174. * - if 0, host CDC class driver is disable.
  175. * - if greater than 0, host CDC class driver is enable.
  176. */
  177. #define USB_HOST_CONFIG_CDC (0U)
  178. /*!
  179. * @brief host AUDIO class instance count, meantime it indicates AUDIO class enable or disable.
  180. * - if 0, host AUDIO class driver is disable.
  181. * - if greater than 0, host AUDIO class driver is enable.
  182. */
  183. #define USB_HOST_CONFIG_AUDIO (0U)
  184. /*!
  185. * @brief host PHDC class instance count, meantime it indicates PHDC class enable or disable.
  186. * - if 0, host PHDC class driver is disable.
  187. * - if greater than 0, host PHDC class driver is enable.
  188. */
  189. #define USB_HOST_CONFIG_PHDC (0U)
  190. /*!
  191. * @brief host printer class instance count, meantime it indicates printer class enable or disable.
  192. * - if 0, host printer class driver is disable.
  193. * - if greater than 0, host printer class driver is enable.
  194. */
  195. #define USB_HOST_CONFIG_PRINTER (0U)
  196. /*!
  197. * @brief host charger detect enable or disable. It is only supported on RT600 currently.
  198. * - if 0, host charger detect is disable.
  199. * - if greater than 0, host charger detect is enable.
  200. */
  201. #define USB_HOST_CONFIG_BATTERY_CHARGER (0U)
  202. #endif /* _USB_HOST_CONFIG_H_ */