nrfx_glue.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. /**
  2. * Copyright (c) 2017 - 2019, 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 NRFX_GLUE_H__
  41. #define NRFX_GLUE_H__
  42. // THIS IS A TEMPLATE FILE.
  43. // It should be copied to a suitable location within the host environment into
  44. // which nrfx is integrated, and the following macros should be provided with
  45. // appropriate implementations.
  46. // And this comment should be removed from the customized file.
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50. /**
  51. * @defgroup nrfx_glue nrfx_glue.h
  52. * @{
  53. * @ingroup nrfx
  54. *
  55. * @brief This file contains macros that should be implemented according to
  56. * the needs of the host environment into which @em nrfx is integrated.
  57. */
  58. // Uncomment this line to use the standard MDK way of binding IRQ handlers
  59. // at linking time.
  60. //#include <soc/nrfx_irqs.h>
  61. //------------------------------------------------------------------------------
  62. /**
  63. * @brief Macro for placing a runtime assertion.
  64. *
  65. * @param expression Expression to evaluate.
  66. */
  67. #define NRFX_ASSERT(expression)
  68. /**
  69. * @brief Macro for placing a compile time assertion.
  70. *
  71. * @param expression Expression to evaluate.
  72. */
  73. #define NRFX_STATIC_ASSERT(expression)
  74. //------------------------------------------------------------------------------
  75. /**
  76. * @brief Macro for setting the priority of a specific IRQ.
  77. *
  78. * @param irq_number IRQ number.
  79. * @param priority Priority to set.
  80. */
  81. #define NRFX_IRQ_PRIORITY_SET(irq_number, priority)
  82. /**
  83. * @brief Macro for enabling a specific IRQ.
  84. *
  85. * @param irq_number IRQ number.
  86. */
  87. #define NRFX_IRQ_ENABLE(irq_number)
  88. /**
  89. * @brief Macro for checking if a specific IRQ is enabled.
  90. *
  91. * @param irq_number IRQ number.
  92. *
  93. * @retval true If the IRQ is enabled.
  94. * @retval false Otherwise.
  95. */
  96. #define NRFX_IRQ_IS_ENABLED(irq_number)
  97. /**
  98. * @brief Macro for disabling a specific IRQ.
  99. *
  100. * @param irq_number IRQ number.
  101. */
  102. #define NRFX_IRQ_DISABLE(irq_number)
  103. /**
  104. * @brief Macro for setting a specific IRQ as pending.
  105. *
  106. * @param irq_number IRQ number.
  107. */
  108. #define NRFX_IRQ_PENDING_SET(irq_number)
  109. /**
  110. * @brief Macro for clearing the pending status of a specific IRQ.
  111. *
  112. * @param irq_number IRQ number.
  113. */
  114. #define NRFX_IRQ_PENDING_CLEAR(irq_number)
  115. /**
  116. * @brief Macro for checking the pending status of a specific IRQ.
  117. *
  118. * @retval true If the IRQ is pending.
  119. * @retval false Otherwise.
  120. */
  121. #define NRFX_IRQ_IS_PENDING(irq_number)
  122. /**
  123. * @brief Macro for entering into a critical section.
  124. */
  125. #define NRFX_CRITICAL_SECTION_ENTER()
  126. /**
  127. * @brief Macro for exiting from a critical section.
  128. */
  129. #define NRFX_CRITICAL_SECTION_EXIT()
  130. //------------------------------------------------------------------------------
  131. /**
  132. * @brief When set to a non-zero value, this macro specifies that
  133. * @ref nrfx_coredep_delay_us uses a precise DWT-based solution.
  134. * A compilation error is generated if the DWT unit is not present
  135. * in the SoC used.
  136. */
  137. #define NRFX_DELAY_DWT_BASED 0
  138. /**
  139. * @brief Macro for delaying the code execution for at least the specified time.
  140. *
  141. * @param us_time Number of microseconds to wait.
  142. */
  143. #define NRFX_DELAY_US(us_time)
  144. //------------------------------------------------------------------------------
  145. /**
  146. * @brief Atomic 32-bit unsigned type.
  147. */
  148. #define nrfx_atomic_t
  149. /**
  150. * @brief Macro for storing a value to an atomic object and returning its previous value.
  151. *
  152. * @param[in] p_data Atomic memory pointer.
  153. * @param[in] value Value to store.
  154. *
  155. * @return Previous value of the atomic object.
  156. */
  157. #define NRFX_ATOMIC_FETCH_STORE(p_data, value)
  158. /**
  159. * @brief Macro for running a bitwise OR operation on an atomic object and returning its previous value.
  160. *
  161. * @param[in] p_data Atomic memory pointer.
  162. * @param[in] value Value of the second operand in the OR operation.
  163. *
  164. * @return Previous value of the atomic object.
  165. */
  166. #define NRFX_ATOMIC_FETCH_OR(p_data, value)
  167. /**
  168. * @brief Macro for running a bitwise AND operation on an atomic object
  169. * and returning its previous value.
  170. *
  171. * @param[in] p_data Atomic memory pointer.
  172. * @param[in] value Value of the second operand in the AND operation.
  173. *
  174. * @return Previous value of the atomic object.
  175. */
  176. #define NRFX_ATOMIC_FETCH_AND(p_data, value)
  177. /**
  178. * @brief Macro for running a bitwise XOR operation on an atomic object
  179. * and returning its previous value.
  180. *
  181. * @param[in] p_data Atomic memory pointer.
  182. * @param[in] value Value of the second operand in the XOR operation.
  183. *
  184. * @return Previous value of the atomic object.
  185. */
  186. #define NRFX_ATOMIC_FETCH_XOR(p_data, value)
  187. /**
  188. * @brief Macro for running an addition operation on an atomic object
  189. * and returning its previous value.
  190. *
  191. * @param[in] p_data Atomic memory pointer.
  192. * @param[in] value Value of the second operand in the ADD operation.
  193. *
  194. * @return Previous value of the atomic object.
  195. */
  196. #define NRFX_ATOMIC_FETCH_ADD(p_data, value)
  197. /**
  198. * @brief Macro for running a subtraction operation on an atomic object
  199. * and returning its previous value.
  200. *
  201. * @param[in] p_data Atomic memory pointer.
  202. * @param[in] value Value of the second operand in the SUB operation.
  203. *
  204. * @return Previous value of the atomic object.
  205. */
  206. #define NRFX_ATOMIC_FETCH_SUB(p_data, value)
  207. //------------------------------------------------------------------------------
  208. /**
  209. * @brief When set to a non-zero value, this macro specifies that the
  210. * @ref nrfx_error_codes and the @ref nrfx_err_t type itself are defined
  211. * in a customized way and the default definitions from @c <nrfx_error.h>
  212. * should not be used.
  213. */
  214. #define NRFX_CUSTOM_ERROR_CODES 0
  215. //------------------------------------------------------------------------------
  216. /**
  217. * @brief Bitmask defining DPPI channels reserved to be used outside of nrfx.
  218. */
  219. #define NRFX_DPPI_CHANNELS_USED 0
  220. /**
  221. * @brief Bitmask defining DPPI groups reserved to be used outside of nrfx.
  222. */
  223. #define NRFX_DPPI_GROUPS_USED 0
  224. /**
  225. * @brief Bitmask defining PPI channels reserved to be used outside of nrfx.
  226. */
  227. #define NRFX_PPI_CHANNELS_USED 0
  228. /**
  229. * @brief Bitmask defining PPI groups reserved to be used outside of nrfx.
  230. */
  231. #define NRFX_PPI_GROUPS_USED 0
  232. /**
  233. * @brief Bitmask defining SWI instances reserved to be used outside of nrfx.
  234. */
  235. #define NRFX_SWI_USED 0
  236. /**
  237. * @brief Bitmask defining TIMER instances reserved to be used outside of nrfx.
  238. */
  239. #define NRFX_TIMERS_USED 0
  240. /** @} */
  241. #ifdef __cplusplus
  242. }
  243. #endif
  244. #endif // NRFX_GLUE_H__