1 /* 2 * Copyright (c) 2017 - 2018, Nordic Semiconductor ASA 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, this 9 * list of conditions and the following disclaimer. 10 * 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * 3. 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" 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 #ifndef NRFX_GLUE_H__ 33 #define NRFX_GLUE_H__ 34 35 // THIS IS A TEMPLATE FILE. 36 // It should be copied to a suitable location within the host environment into 37 // which nrfx is integrated, and the following macros should be provided with 38 // appropriate implementations. 39 // And this comment should be removed from the customized file. 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 /** 46 * @defgroup nrfx_glue nrfx_glue.h 47 * @{ 48 * @ingroup nrfx 49 * 50 * @brief This file contains macros that should be implemented according to 51 * the needs of the host environment into which @em nrfx is integrated. 52 */ 53 54 // Uncomment this line to use the standard MDK way of binding IRQ handlers 55 // at linking time. 56 //#include <soc/nrfx_irqs.h> 57 58 //------------------------------------------------------------------------------ 59 60 /** 61 * @brief Macro for placing a runtime assertion. 62 * 63 * @param expression Expression to evaluate. 64 */ 65 #define NRFX_ASSERT(expression) 66 67 /** 68 * @brief Macro for placing a compile time assertion. 69 * 70 * @param expression Expression to evaluate. 71 */ 72 #define NRFX_STATIC_ASSERT(expression) 73 74 //------------------------------------------------------------------------------ 75 76 /** 77 * @brief Macro for setting the priority of a specific IRQ. 78 * 79 * @param irq_number IRQ number. 80 * @param priority Priority to set. 81 */ 82 #define NRFX_IRQ_PRIORITY_SET(irq_number, priority) 83 84 /** 85 * @brief Macro for enabling a specific IRQ. 86 * 87 * @param irq_number IRQ number. 88 */ 89 #define NRFX_IRQ_ENABLE(irq_number) 90 91 /** 92 * @brief Macro for checking if a specific IRQ is enabled. 93 * 94 * @param irq_number IRQ number. 95 * 96 * @retval true If the IRQ is enabled. 97 * @retval false Otherwise. 98 */ 99 #define NRFX_IRQ_IS_ENABLED(irq_number) 100 101 /** 102 * @brief Macro for disabling a specific IRQ. 103 * 104 * @param irq_number IRQ number. 105 */ 106 #define NRFX_IRQ_DISABLE(irq_number) 107 108 /** 109 * @brief Macro for setting a specific IRQ as pending. 110 * 111 * @param irq_number IRQ number. 112 */ 113 #define NRFX_IRQ_PENDING_SET(irq_number) 114 115 /** 116 * @brief Macro for clearing the pending status of a specific IRQ. 117 * 118 * @param irq_number IRQ number. 119 */ 120 #define NRFX_IRQ_PENDING_CLEAR(irq_number) 121 122 /** 123 * @brief Macro for checking the pending status of a specific IRQ. 124 * 125 * @retval true If the IRQ is pending. 126 * @retval false Otherwise. 127 */ 128 #define NRFX_IRQ_IS_PENDING(irq_number) 129 130 /** 131 * @brief Macro for entering into a critical section. 132 */ 133 #define NRFX_CRITICAL_SECTION_ENTER() 134 135 /** 136 * @brief Macro for exiting from a critical section. 137 */ 138 #define NRFX_CRITICAL_SECTION_EXIT() 139 140 //------------------------------------------------------------------------------ 141 142 /** 143 * @brief When set to a non-zero value, this macro specifies that 144 * @ref nrfx_coredep_delay_us uses a precise DWT-based solution. 145 * A compilation error is generated if the DWT unit is not present 146 * in the SoC used. 147 */ 148 #define NRFX_DELAY_DWT_BASED 0 149 150 /** 151 * @brief Macro for delaying the code execution for at least the specified time. 152 * 153 * @param us_time Number of microseconds to wait. 154 */ 155 #define NRFX_DELAY_US(us_time) 156 157 //------------------------------------------------------------------------------ 158 159 /** 160 * @brief When set to a non-zero value, this macro specifies that the 161 * @ref nrfx_error_codes and the @ref nrfx_err_t type itself are defined 162 * in a customized way and the default definitions from @c <nrfx_error.h> 163 * should not be used. 164 */ 165 #define NRFX_CUSTOM_ERROR_CODES 0 166 167 //------------------------------------------------------------------------------ 168 169 /** 170 * @brief Bitmask defining PPI channels reserved to be used outside of nrfx. 171 */ 172 #define NRFX_PPI_CHANNELS_USED 0 173 174 /** 175 * @brief Bitmask defining PPI groups reserved to be used outside of nrfx. 176 */ 177 #define NRFX_PPI_GROUPS_USED 0 178 179 /** 180 * @brief Bitmask defining SWI instances reserved to be used outside of nrfx. 181 */ 182 #define NRFX_SWI_USED 0 183 184 /** 185 * @brief Bitmask defining TIMER instances reserved to be used outside of nrfx. 186 */ 187 #define NRFX_TIMERS_USED 0 188 189 /** @} */ 190 191 #ifdef __cplusplus 192 } 193 #endif 194 195 #endif // NRFX_GLUE_H__ 196