nrf_drv_usbd.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. /**
  2. * Copyright (c) 2016 - 2020, Nordic Semiconductor ASA
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice, this
  10. * list of conditions and the following disclaimer.
  11. *
  12. * 2. Redistributions in binary form, except as embedded into a Nordic
  13. * Semiconductor ASA integrated circuit in a product or a software update for
  14. * such product, must reproduce the above copyright notice, this list of
  15. * conditions and the following disclaimer in the documentation and/or other
  16. * materials provided with the distribution.
  17. *
  18. * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * 4. This software, with or without modification, must only be used with a
  23. * Nordic Semiconductor ASA integrated circuit.
  24. *
  25. * 5. Any software provided in binary form under this license must not be reverse
  26. * engineered, decompiled, modified and/or disassembled.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  29. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30. * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  31. * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  32. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  37. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. */
  40. #ifndef NRF_DRV_USBD_H__
  41. #define NRF_DRV_USBD_H__
  42. #include "nrfx.h"
  43. #include "nrfx_usbd.h"
  44. #include "nrf_drv_usbd_errata.h"
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48. /**
  49. * @defgroup nrf_drv_usbd USBD driver - legacy layer
  50. * @{
  51. * @ingroup nrf_usbd
  52. *
  53. * @brief @tagAPI52 Layer providing compatibility with the former API.
  54. */
  55. /** @brief Type definition for forwarding the new implementation. */
  56. #define NRF_DRV_USBD_DMASCHEDULER_PRIORITIZED NRFX_USBD_DMASCHEDULER_PRIORITIZED
  57. /** @brief Type definition for forwarding the new implementation. */
  58. #define NRF_DRV_USBD_DMASCHEDULER_ROUNDROBIN NRFX_USBD_DMASCHEDULER_ROUNDROBIN
  59. /** @brief Type definition for forwarding the new implementation. */
  60. #define NRF_DRV_USBD_EPSIZE NRFX_USBD_EPSIZE
  61. /** @brief Type definition for forwarding the new implementation. */
  62. #define NRF_DRV_USBD_ISOSIZE NRFX_USBD_ISOSIZE
  63. /** @brief Type definition for forwarding the new implementation. */
  64. #define NRF_DRV_USBD_FEEDER_BUFFER_SIZE NRFX_USBD_EPSIZE
  65. /** @brief Type definition for forwarding the new implementation. */
  66. #define NRF_DRV_USBD_EPIN NRFX_USBD_EPIN
  67. /** @brief Type definition for forwarding the new implementation. */
  68. #define NRF_DRV_USBD_EPOUT NRFX_USBD_EPOUT
  69. /** @brief Type definition for forwarding the new implementation. */
  70. typedef nrfx_usbd_ep_t nrf_drv_usbd_ep_t;
  71. /** @brief Type definition for forwarding the new implementation. */
  72. #define NRF_DRV_USBD_EPOUT0 NRFX_USBD_EPOUT0
  73. /** @brief Type definition for forwarding the new implementation. */
  74. #define NRF_DRV_USBD_EPOUT1 NRFX_USBD_EPOUT1
  75. /** @brief Type definition for forwarding the new implementation. */
  76. #define NRF_DRV_USBD_EPOUT2 NRFX_USBD_EPOUT2
  77. /** @brief Type definition for forwarding the new implementation. */
  78. #define NRF_DRV_USBD_EPOUT3 NRFX_USBD_EPOUT3
  79. /** @brief Type definition for forwarding the new implementation. */
  80. #define NRF_DRV_USBD_EPOUT4 NRFX_USBD_EPOUT4
  81. /** @brief Type definition for forwarding the new implementation. */
  82. #define NRF_DRV_USBD_EPOUT5 NRFX_USBD_EPOUT5
  83. /** @brief Type definition for forwarding the new implementation. */
  84. #define NRF_DRV_USBD_EPOUT6 NRFX_USBD_EPOUT6
  85. /** @brief Type definition for forwarding the new implementation. */
  86. #define NRF_DRV_USBD_EPOUT7 NRFX_USBD_EPOUT7
  87. /** @brief Type definition for forwarding the new implementation. */
  88. #define NRF_DRV_USBD_EPOUT8 NRFX_USBD_EPOUT8
  89. /** @brief Type definition for forwarding the new implementation. */
  90. #define NRF_DRV_USBD_EPIN0 NRFX_USBD_EPIN0
  91. /** @brief Type definition for forwarding the new implementation. */
  92. #define NRF_DRV_USBD_EPIN1 NRFX_USBD_EPIN1
  93. /** @brief Type definition for forwarding the new implementation. */
  94. #define NRF_DRV_USBD_EPIN2 NRFX_USBD_EPIN2
  95. /** @brief Type definition for forwarding the new implementation. */
  96. #define NRF_DRV_USBD_EPIN3 NRFX_USBD_EPIN3
  97. /** @brief Type definition for forwarding the new implementation. */
  98. #define NRF_DRV_USBD_EPIN4 NRFX_USBD_EPIN4
  99. /** @brief Type definition for forwarding the new implementation. */
  100. #define NRF_DRV_USBD_EPIN5 NRFX_USBD_EPIN5
  101. /** @brief Type definition for forwarding the new implementation. */
  102. #define NRF_DRV_USBD_EPIN6 NRFX_USBD_EPIN6
  103. /** @brief Type definition for forwarding the new implementation. */
  104. #define NRF_DRV_USBD_EPIN7 NRFX_USBD_EPIN7
  105. /** @brief Type definition for forwarding the new implementation. */
  106. #define NRF_DRV_USBD_EPIN8 NRFX_USBD_EPIN8
  107. /** @brief Type definition for forwarding the new implementation. */
  108. typedef nrfx_usbd_event_type_t nrf_drv_usbd_event_type_t;
  109. /** @brief Type definition for forwarding the new implementation. */
  110. #define NRF_DRV_USBD_EVT_SOF NRFX_USBD_EVT_SOF
  111. /** @brief Type definition for forwarding the new implementation. */
  112. #define NRF_DRV_USBD_EVT_RESET NRFX_USBD_EVT_RESET
  113. /** @brief Type definition for forwarding the new implementation. */
  114. #define NRF_DRV_USBD_EVT_SUSPEND NRFX_USBD_EVT_SUSPEND
  115. /** @brief Type definition for forwarding the new implementation. */
  116. #define NRF_DRV_USBD_EVT_RESUME NRFX_USBD_EVT_RESUME
  117. /** @brief Type definition for forwarding the new implementation. */
  118. #define NRF_DRV_USBD_EVT_WUREQ NRFX_USBD_EVT_WUREQ
  119. /** @brief Type definition for forwarding the new implementation. */
  120. #define NRF_DRV_USBD_EVT_SETUP NRFX_USBD_EVT_SETUP
  121. /** @brief Type definition for forwarding the new implementation. */
  122. #define NRF_DRV_USBD_EVT_EPTRANSFER NRFX_USBD_EVT_EPTRANSFER
  123. /** @brief Type definition for forwarding the new implementation. */
  124. #define NRF_DRV_USBD_EVT_CNT NRFX_USBD_EVT_CNT
  125. /** @brief Type definition for forwarding the new implementation. */
  126. #define NRF_USBD_EP_OK NRFX_USBD_EP_OK
  127. /** @brief Type definition for forwarding the new implementation. */
  128. #define NRF_USBD_EP_WAITING NRFX_USBD_EP_WAITING
  129. /** @brief Type definition for forwarding the new implementation. */
  130. #define NRF_USBD_EP_OVERLOAD NRFX_USBD_EP_OVERLOAD
  131. /** @brief Type definition for forwarding the new implementation. */
  132. #define NRF_USBD_EP_ABORTED NRFX_USBD_EP_ABORTED
  133. /** @brief Type definition for forwarding the new implementation. */
  134. typedef nrfx_usbd_ep_status_t nrf_drv_usbd_ep_status_t;
  135. /** @brief Type definition for forwarding the new implementation. */
  136. typedef nrfx_usbd_evt_t nrf_drv_usbd_evt_t;
  137. /** @brief Type definition for forwarding the new implementation. */
  138. typedef nrfx_usbd_event_handler_t nrf_drv_usbd_event_handler_t;
  139. /** @brief Type definition for forwarding the new implementation. */
  140. typedef nrfx_usbd_data_ptr_t nrf_drv_usbd_data_ptr_t;
  141. /** @brief Type definition for forwarding the new implementation. */
  142. typedef nrfx_usbd_ep_transfer_t nrf_drv_usbd_ep_transfer_t;
  143. /** @brief Type definition for forwarding the new implementation. */
  144. typedef nrfx_usbd_transfer_flags_t nrf_drv_usbd_transfer_flags_t;
  145. /** @brief Type definition for forwarding the new implementation. */
  146. #define NRF_DRV_USBD_TRANSFER_ZLP_FLAG NRFX_USBD_TRANSFER_ZLP_FLAG
  147. /** @brief Type definition for forwarding the new implementation. */
  148. typedef nrfx_usbd_transfer_t nrf_drv_usbd_transfer_t;
  149. /** @brief Type definition for forwarding the new implementation. */
  150. #define NRF_DRV_USBD_TRANSFER_IN_FLAGS(name, tx_buff, tx_size, tx_flags) \
  151. NRFX_USBD_TRANSFER_IN(name, tx_buff, tx_size, tx_flags)
  152. /** @brief Type definition for forwarding the new implementation. */
  153. #define NRF_DRV_USBD_TRANSFER_IN(name, tx_buff, tx_size) \
  154. NRFX_USBD_TRANSFER_IN(name, tx_buff, tx_size, 0)
  155. /** @brief Type definition for forwarding the new implementation. */
  156. #define NRF_DRV_USBD_TRANSFER_IN_ZLP(name, tx_buff, tx_size) \
  157. NRFX_USBD_TRANSFER_IN(name, tx_buff, tx_size, NRFX_USBD_TRANSFER_ZLP_FLAG)
  158. /** @brief Type definition for forwarding the new implementation. */
  159. #define NRF_DRV_USBD_TRANSFER_OUT NRFX_USBD_TRANSFER_OUT
  160. /** @brief Type definition for forwarding the new implementation. */
  161. typedef nrfx_usbd_feeder_t nrf_drv_usbd_feeder_t;
  162. /** @brief Type definition for forwarding the new implementation. */
  163. typedef nrfx_usbd_consumer_t nrf_drv_usbd_consumer_t;
  164. /** @brief Type definition for forwarding the new implementation. */
  165. typedef nrfx_usbd_handler_t nrf_drv_usbd_handler_t;
  166. /** @brief Type definition for forwarding the new implementation. */
  167. typedef nrfx_usbd_handler_desc_t nrf_drv_usbd_handler_desc_t;
  168. /** @brief Type definition for forwarding the new implementation. */
  169. typedef nrfx_usbd_setup_t nrf_drv_usbd_setup_t;
  170. /** @brief Type definition for forwarding the new implementation. */
  171. #define nrf_drv_usbd_init nrfx_usbd_init
  172. /** @brief Type definition for forwarding the new implementation. */
  173. #define nrf_drv_usbd_enable nrfx_usbd_enable
  174. /** @brief Type definition for forwarding the new implementation. */
  175. #define nrf_drv_usbd_disable nrfx_usbd_disable
  176. /** @brief Type definition for forwarding the new implementation. */
  177. #define nrf_drv_usbd_start nrfx_usbd_start
  178. /** @brief Type definition for forwarding the new implementation. */
  179. #define nrf_drv_usbd_stop nrfx_usbd_stop
  180. /** @brief Type definition for forwarding the new implementation. */
  181. #define nrf_drv_usbd_is_initialized nrfx_usbd_is_initialized
  182. /** @brief Type definition for forwarding the new implementation. */
  183. #define nrf_drv_usbd_is_enabled nrfx_usbd_is_enabled
  184. /** @brief Type definition for forwarding the new implementation. */
  185. #define nrf_drv_usbd_is_started nrfx_usbd_is_started
  186. /** @brief Type definition for forwarding the new implementation. */
  187. #define nrf_drv_usbd_suspend nrfx_usbd_suspend
  188. /** @brief Type definition for forwarding the new implementation. */
  189. #define nrf_drv_usbd_wakeup_req nrfx_usbd_wakeup_req
  190. /** @brief Type definition for forwarding the new implementation. */
  191. #define nrf_drv_usbd_suspend_check nrfx_usbd_suspend_check
  192. /** @brief Type definition for forwarding the new implementation. */
  193. #define nrf_drv_usbd_suspend_irq_config nrfx_usbd_suspend_irq_config
  194. /** @brief Type definition for forwarding the new implementation. */
  195. #define nrf_drv_usbd_active_irq_config nrfx_usbd_active_irq_config
  196. /** @brief Type definition for forwarding the new implementation. */
  197. #define nrf_drv_usbd_force_bus_wakeup nrfx_usbd_force_bus_wakeup
  198. /** @brief Type definition for forwarding the new implementation. */
  199. #define nrf_drv_usbd_bus_suspend_check nrfx_usbd_bus_suspend_check
  200. /** @brief Type definition for forwarding the new implementation. */
  201. #define nrf_drv_usbd_ep_max_packet_size_set nrfx_usbd_ep_max_packet_size_set
  202. /** @brief Type definition for forwarding the new implementation. */
  203. #define nrf_drv_usbd_ep_max_packet_size_get nrfx_usbd_ep_max_packet_size_get
  204. /** @brief Type definition for forwarding the new implementation. */
  205. #define nrf_drv_usbd_ep_enable_check nrfx_usbd_ep_enable_check
  206. /** @brief Type definition for forwarding the new implementation. */
  207. #define nrf_drv_usbd_ep_enable nrfx_usbd_ep_enable
  208. /** @brief Type definition for forwarding the new implementation. */
  209. #define nrf_drv_usbd_ep_disable nrfx_usbd_ep_disable
  210. /** @brief Type definition for forwarding the new implementation. */
  211. #define nrf_drv_usbd_ep_default_config nrfx_usbd_ep_default_config
  212. /** @brief Type definition for forwarding the new implementation. */
  213. #define nrf_drv_usbd_ep_transfer nrfx_usbd_ep_transfer
  214. /** @brief Type definition for forwarding the new implementation. */
  215. #define nrf_drv_usbd_ep_handled_transfer nrfx_usbd_ep_handled_transfer
  216. /** @brief Type definition for forwarding the new implementation. */
  217. #define nrf_drv_usbd_feeder_buffer_get nrfx_usbd_feeder_buffer_get
  218. /** @brief Type definition for forwarding the new implementation. */
  219. #define nrf_drv_usbd_ep_status_get nrfx_usbd_ep_status_get
  220. /** @brief Type definition for forwarding the new implementation. */
  221. #define nrf_drv_usbd_epout_size_get nrfx_usbd_epout_size_get
  222. /** @brief Type definition for forwarding the new implementation. */
  223. #define nrf_drv_usbd_ep_is_busy nrfx_usbd_ep_is_busy
  224. /** @brief Type definition for forwarding the new implementation. */
  225. #define nrf_drv_usbd_ep_stall nrfx_usbd_ep_stall
  226. /** @brief Type definition for forwarding the new implementation. */
  227. #define nrf_drv_usbd_ep_stall_clear nrfx_usbd_ep_stall_clear
  228. /** @brief Type definition for forwarding the new implementation. */
  229. #define nrf_drv_usbd_ep_stall_check nrfx_usbd_ep_stall_check
  230. /** @brief Type definition for forwarding the new implementation. */
  231. #define nrf_drv_usbd_ep_dtoggle_clear nrfx_usbd_ep_dtoggle_clear
  232. /** @brief Type definition for forwarding the new implementation. */
  233. #define nrf_drv_usbd_setup_get nrfx_usbd_setup_get
  234. /** @brief Type definition for forwarding the new implementation. */
  235. #define nrf_drv_usbd_setup_data_clear nrfx_usbd_setup_data_clear
  236. /** @brief Type definition for forwarding the new implementation. */
  237. #define nrf_drv_usbd_setup_clear nrfx_usbd_setup_clear
  238. /** @brief Type definition for forwarding the new implementation. */
  239. #define nrf_drv_usbd_setup_stall nrfx_usbd_setup_stall
  240. /** @brief Type definition for forwarding the new implementation. */
  241. #define nrf_drv_usbd_ep_abort nrfx_usbd_ep_abort
  242. /** @brief Type definition for forwarding the new implementation. */
  243. #define nrf_drv_usbd_last_setup_dir_get nrfx_usbd_last_setup_dir_get
  244. /** @brief Type definition for forwarding the new implementation. */
  245. #define nrf_drv_usbd_transfer_out_drop nrfx_usbd_transfer_out_drop
  246. /** @brief Type definition for forwarding the new implementation. */
  247. static inline ret_code_t nrf_drv_usbd_uninit(void)
  248. {
  249. nrfx_usbd_uninit();
  250. return NRF_SUCCESS;
  251. }
  252. #ifdef __cplusplus
  253. }
  254. #endif
  255. /** @} */
  256. #endif /* NRF_DRV_USBD_H__ */