nrfx_glue.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /**
  2. * Copyright (c) 2017 - 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 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 be evaluated.
  66. */
  67. #define NRFX_ASSERT(expression)
  68. /**
  69. * @brief Macro for placing a compile time assertion.
  70. *
  71. * @param expression Expression to be evaluated.
  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 be 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. /** @brief Macro for entering into a critical section. */
  123. #define NRFX_CRITICAL_SECTION_ENTER()
  124. /** @brief Macro for exiting from a critical section. */
  125. #define NRFX_CRITICAL_SECTION_EXIT()
  126. //------------------------------------------------------------------------------
  127. /**
  128. * @brief When set to a non-zero value, this macro specifies that
  129. * @ref nrfx_coredep_delay_us uses a precise DWT-based solution.
  130. * A compilation error is generated if the DWT unit is not present
  131. * in the SoC used.
  132. */
  133. #define NRFX_DELAY_DWT_BASED 0
  134. /**
  135. * @brief Macro for delaying the code execution for at least the specified time.
  136. *
  137. * @param us_time Number of microseconds to wait.
  138. */
  139. #define NRFX_DELAY_US(us_time)
  140. //------------------------------------------------------------------------------
  141. /** @brief Atomic 32-bit unsigned type. */
  142. #define nrfx_atomic_t
  143. /**
  144. * @brief Macro for storing a value to an atomic object and returning its previous value.
  145. *
  146. * @param[in] p_data Atomic memory pointer.
  147. * @param[in] value Value to store.
  148. *
  149. * @return Previous value of the atomic object.
  150. */
  151. #define NRFX_ATOMIC_FETCH_STORE(p_data, value)
  152. /**
  153. * @brief Macro for running a bitwise OR operation on an atomic object and returning its previous value.
  154. *
  155. * @param[in] p_data Atomic memory pointer.
  156. * @param[in] value Value of the second operand in the OR operation.
  157. *
  158. * @return Previous value of the atomic object.
  159. */
  160. #define NRFX_ATOMIC_FETCH_OR(p_data, value)
  161. /**
  162. * @brief Macro for running a bitwise AND operation on an atomic object
  163. * and returning its previous value.
  164. *
  165. * @param[in] p_data Atomic memory pointer.
  166. * @param[in] value Value of the second operand in the AND operation.
  167. *
  168. * @return Previous value of the atomic object.
  169. */
  170. #define NRFX_ATOMIC_FETCH_AND(p_data, value)
  171. /**
  172. * @brief Macro for running a bitwise XOR operation on an atomic object
  173. * and returning its previous value.
  174. *
  175. * @param[in] p_data Atomic memory pointer.
  176. * @param[in] value Value of the second operand in the XOR operation.
  177. *
  178. * @return Previous value of the atomic object.
  179. */
  180. #define NRFX_ATOMIC_FETCH_XOR(p_data, value)
  181. /**
  182. * @brief Macro for running an addition operation on an atomic object
  183. * and returning its previous value.
  184. *
  185. * @param[in] p_data Atomic memory pointer.
  186. * @param[in] value Value of the second operand in the ADD operation.
  187. *
  188. * @return Previous value of the atomic object.
  189. */
  190. #define NRFX_ATOMIC_FETCH_ADD(p_data, value)
  191. /**
  192. * @brief Macro for running a subtraction operation on an atomic object
  193. * and returning its previous value.
  194. *
  195. * @param[in] p_data Atomic memory pointer.
  196. * @param[in] value Value of the second operand in the SUB operation.
  197. *
  198. * @return Previous value of the atomic object.
  199. */
  200. #define NRFX_ATOMIC_FETCH_SUB(p_data, value)
  201. //------------------------------------------------------------------------------
  202. /**
  203. * @brief When set to a non-zero value, this macro specifies that the
  204. * @ref nrfx_error_codes and the @ref nrfx_err_t type itself are defined
  205. * in a customized way and the default definitions from @c <nrfx_error.h>
  206. * should not be used.
  207. */
  208. #define NRFX_CUSTOM_ERROR_CODES 0
  209. //------------------------------------------------------------------------------
  210. /** @brief Bitmask that defines DPPI channels that are reserved for use outside of the nrfx library. */
  211. #define NRFX_DPPI_CHANNELS_USED 0
  212. /** @brief Bitmask that defines DPPI groups that are reserved for use outside of the nrfx library. */
  213. #define NRFX_DPPI_GROUPS_USED 0
  214. /** @brief Bitmask that defines PPI channels that are reserved for use outside of the nrfx library. */
  215. #define NRFX_PPI_CHANNELS_USED 0
  216. /** @brief Bitmask that defines PPI groups that are reserved for use outside of the nrfx library. */
  217. #define NRFX_PPI_GROUPS_USED 0
  218. /** @brief Bitmask that defines SWI instances that are reserved for use outside of the nrfx library. */
  219. #define NRFX_SWI_USED 0
  220. /** @brief Bitmask that defines TIMER instances that are reserved for use outside of the nrfx library. */
  221. #define NRFX_TIMERS_USED 0
  222. /** @} */
  223. #ifdef __cplusplus
  224. }
  225. #endif
  226. #endif // NRFX_GLUE_H__