Mouse code for the MacroRat
mbed-dev/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF51822_UNIFIED/sdk/softdevice/s130/headers/nrf_sdm.h@18:6a4db94011d3, 2017-05-14 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sun May 14 23:18:57 2017 +0000
- Revision:
- 18:6a4db94011d3
Publishing again
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /* |
sahilmgandhi | 18:6a4db94011d3 | 2 | * Copyright (c) 2000 Nordic Semiconductor ASA |
sahilmgandhi | 18:6a4db94011d3 | 3 | * All rights reserved. |
sahilmgandhi | 18:6a4db94011d3 | 4 | * |
sahilmgandhi | 18:6a4db94011d3 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
sahilmgandhi | 18:6a4db94011d3 | 6 | * are permitted provided that the following conditions are met: |
sahilmgandhi | 18:6a4db94011d3 | 7 | * |
sahilmgandhi | 18:6a4db94011d3 | 8 | * 1. Redistributions of source code must retain the above copyright notice, this list |
sahilmgandhi | 18:6a4db94011d3 | 9 | * of conditions and the following disclaimer. |
sahilmgandhi | 18:6a4db94011d3 | 10 | * |
sahilmgandhi | 18:6a4db94011d3 | 11 | * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA |
sahilmgandhi | 18:6a4db94011d3 | 12 | * integrated circuit in a product or a software update for such product, must reproduce |
sahilmgandhi | 18:6a4db94011d3 | 13 | * the above copyright notice, this list of conditions and the following disclaimer in |
sahilmgandhi | 18:6a4db94011d3 | 14 | * the documentation and/or other materials provided with the distribution. |
sahilmgandhi | 18:6a4db94011d3 | 15 | * |
sahilmgandhi | 18:6a4db94011d3 | 16 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be |
sahilmgandhi | 18:6a4db94011d3 | 17 | * used to endorse or promote products derived from this software without specific prior |
sahilmgandhi | 18:6a4db94011d3 | 18 | * written permission. |
sahilmgandhi | 18:6a4db94011d3 | 19 | * |
sahilmgandhi | 18:6a4db94011d3 | 20 | * 4. This software, with or without modification, must only be used with a |
sahilmgandhi | 18:6a4db94011d3 | 21 | * Nordic Semiconductor ASA integrated circuit. |
sahilmgandhi | 18:6a4db94011d3 | 22 | * |
sahilmgandhi | 18:6a4db94011d3 | 23 | * 5. Any software provided in binary or object form under this license must not be reverse |
sahilmgandhi | 18:6a4db94011d3 | 24 | * engineered, decompiled, modified and/or disassembled. |
sahilmgandhi | 18:6a4db94011d3 | 25 | * |
sahilmgandhi | 18:6a4db94011d3 | 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
sahilmgandhi | 18:6a4db94011d3 | 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
sahilmgandhi | 18:6a4db94011d3 | 28 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
sahilmgandhi | 18:6a4db94011d3 | 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
sahilmgandhi | 18:6a4db94011d3 | 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
sahilmgandhi | 18:6a4db94011d3 | 31 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
sahilmgandhi | 18:6a4db94011d3 | 32 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
sahilmgandhi | 18:6a4db94011d3 | 33 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
sahilmgandhi | 18:6a4db94011d3 | 34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
sahilmgandhi | 18:6a4db94011d3 | 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
sahilmgandhi | 18:6a4db94011d3 | 36 | * |
sahilmgandhi | 18:6a4db94011d3 | 37 | */ |
sahilmgandhi | 18:6a4db94011d3 | 38 | |
sahilmgandhi | 18:6a4db94011d3 | 39 | /** |
sahilmgandhi | 18:6a4db94011d3 | 40 | @defgroup nrf_sdm_api SoftDevice Manager API |
sahilmgandhi | 18:6a4db94011d3 | 41 | @{ |
sahilmgandhi | 18:6a4db94011d3 | 42 | |
sahilmgandhi | 18:6a4db94011d3 | 43 | @brief APIs for SoftDevice management. |
sahilmgandhi | 18:6a4db94011d3 | 44 | |
sahilmgandhi | 18:6a4db94011d3 | 45 | */ |
sahilmgandhi | 18:6a4db94011d3 | 46 | |
sahilmgandhi | 18:6a4db94011d3 | 47 | /* Header guard */ |
sahilmgandhi | 18:6a4db94011d3 | 48 | #ifndef NRF_SDM_H__ |
sahilmgandhi | 18:6a4db94011d3 | 49 | #define NRF_SDM_H__ |
sahilmgandhi | 18:6a4db94011d3 | 50 | |
sahilmgandhi | 18:6a4db94011d3 | 51 | #include "nrf_svc.h" |
sahilmgandhi | 18:6a4db94011d3 | 52 | #include "nrf.h" |
sahilmgandhi | 18:6a4db94011d3 | 53 | #include "nrf_soc.h" |
sahilmgandhi | 18:6a4db94011d3 | 54 | #include "nrf_error_sdm.h" |
sahilmgandhi | 18:6a4db94011d3 | 55 | |
sahilmgandhi | 18:6a4db94011d3 | 56 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 57 | extern "C" { |
sahilmgandhi | 18:6a4db94011d3 | 58 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 59 | |
sahilmgandhi | 18:6a4db94011d3 | 60 | /** @addtogroup NRF_SDM_DEFINES Defines |
sahilmgandhi | 18:6a4db94011d3 | 61 | * @{ */ |
sahilmgandhi | 18:6a4db94011d3 | 62 | #ifdef NRFSOC_DOXYGEN |
sahilmgandhi | 18:6a4db94011d3 | 63 | //Stuff defined elsewere, to satisfy doxygen |
sahilmgandhi | 18:6a4db94011d3 | 64 | #define MBR_SIZE 0 |
sahilmgandhi | 18:6a4db94011d3 | 65 | #warning test |
sahilmgandhi | 18:6a4db94011d3 | 66 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 67 | |
sahilmgandhi | 18:6a4db94011d3 | 68 | /** @brief SoftDevice Manager SVC Base number. */ |
sahilmgandhi | 18:6a4db94011d3 | 69 | #define SDM_SVC_BASE 0x10 |
sahilmgandhi | 18:6a4db94011d3 | 70 | |
sahilmgandhi | 18:6a4db94011d3 | 71 | /** @brief Defines the SoftDevice Information Structure location (address) as an offset from |
sahilmgandhi | 18:6a4db94011d3 | 72 | the start of the softdevice (without MBR)*/ |
sahilmgandhi | 18:6a4db94011d3 | 73 | #define SOFTDEVICE_INFO_STRUCT_OFFSET (0x2000) |
sahilmgandhi | 18:6a4db94011d3 | 74 | |
sahilmgandhi | 18:6a4db94011d3 | 75 | /** @brief Defines the absolute Softdevice information structure location (address)*/ |
sahilmgandhi | 18:6a4db94011d3 | 76 | #define SOFTDEVICE_INFO_STRUCT_ADDRESS (SOFTDEVICE_INFO_STRUCT_OFFSET + MBR_SIZE) |
sahilmgandhi | 18:6a4db94011d3 | 77 | |
sahilmgandhi | 18:6a4db94011d3 | 78 | /** @brief Defines the offset for Softdevice size value relative to Softdevice base address*/ |
sahilmgandhi | 18:6a4db94011d3 | 79 | #define SD_SIZE_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x08) |
sahilmgandhi | 18:6a4db94011d3 | 80 | |
sahilmgandhi | 18:6a4db94011d3 | 81 | /** @brief Defines the offset for FWID value relative to Softdevice base address*/ |
sahilmgandhi | 18:6a4db94011d3 | 82 | #define SD_FWID_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x0C) |
sahilmgandhi | 18:6a4db94011d3 | 83 | |
sahilmgandhi | 18:6a4db94011d3 | 84 | /** @brief Defines a macro for retreiving the actual Softdevice size value from a given base address |
sahilmgandhi | 18:6a4db94011d3 | 85 | use @ref MBR_SIZE when Softdevice is installed just above the MBR (the usual case)*/ |
sahilmgandhi | 18:6a4db94011d3 | 86 | #define SD_SIZE_GET(baseaddr) (*((uint32_t *) ((baseaddr) + SD_SIZE_OFFSET))) |
sahilmgandhi | 18:6a4db94011d3 | 87 | |
sahilmgandhi | 18:6a4db94011d3 | 88 | /** @brief Defines a macro for retreiving the actual FWID value from a given base address |
sahilmgandhi | 18:6a4db94011d3 | 89 | use @ref MBR_SIZE when Softdevice is installed just above the MBR (the usual case)*/ |
sahilmgandhi | 18:6a4db94011d3 | 90 | #define SD_FWID_GET(baseaddr) ((*((uint32_t *) ((baseaddr) + SD_FWID_OFFSET))) & 0xFFFF) |
sahilmgandhi | 18:6a4db94011d3 | 91 | |
sahilmgandhi | 18:6a4db94011d3 | 92 | /**@defgroup NRF_FAULT_ID_RANGES Fault ID ranges |
sahilmgandhi | 18:6a4db94011d3 | 93 | * @{ */ |
sahilmgandhi | 18:6a4db94011d3 | 94 | #define NRF_FAULT_ID_SD_RANGE_START 0x00000000 /**< SoftDevice ID range start. */ |
sahilmgandhi | 18:6a4db94011d3 | 95 | #define NRF_FAULT_ID_APP_RANGE_START 0x00001000 /**< Application ID range start. */ |
sahilmgandhi | 18:6a4db94011d3 | 96 | /**@} */ |
sahilmgandhi | 18:6a4db94011d3 | 97 | |
sahilmgandhi | 18:6a4db94011d3 | 98 | /**@defgroup NRF_FAULT_IDS Fault ID types |
sahilmgandhi | 18:6a4db94011d3 | 99 | * @{ */ |
sahilmgandhi | 18:6a4db94011d3 | 100 | #define NRF_FAULT_ID_SD_ASSERT (NRF_FAULT_ID_SD_RANGE_START + 1) /**< SoftDevice assertion. The info parameter will be set to 0x00000000. */ |
sahilmgandhi | 18:6a4db94011d3 | 101 | #define NRF_FAULT_ID_APP_MEMACC (NRF_FAULT_ID_APP_RANGE_START + 1) /**< Application invalid memory access. The info parameter will contain the address in memory that was accessed. */ |
sahilmgandhi | 18:6a4db94011d3 | 102 | /**@} */ |
sahilmgandhi | 18:6a4db94011d3 | 103 | |
sahilmgandhi | 18:6a4db94011d3 | 104 | /** @} */ |
sahilmgandhi | 18:6a4db94011d3 | 105 | |
sahilmgandhi | 18:6a4db94011d3 | 106 | /** @addtogroup NRF_SDM_ENUMS Enumerations |
sahilmgandhi | 18:6a4db94011d3 | 107 | * @{ */ |
sahilmgandhi | 18:6a4db94011d3 | 108 | |
sahilmgandhi | 18:6a4db94011d3 | 109 | /**@brief nRF SoftDevice Manager API SVC numbers. */ |
sahilmgandhi | 18:6a4db94011d3 | 110 | enum NRF_SD_SVCS |
sahilmgandhi | 18:6a4db94011d3 | 111 | { |
sahilmgandhi | 18:6a4db94011d3 | 112 | SD_SOFTDEVICE_ENABLE = SDM_SVC_BASE, /**< ::sd_softdevice_enable */ |
sahilmgandhi | 18:6a4db94011d3 | 113 | SD_SOFTDEVICE_DISABLE, /**< ::sd_softdevice_disable */ |
sahilmgandhi | 18:6a4db94011d3 | 114 | SD_SOFTDEVICE_IS_ENABLED, /**< ::sd_softdevice_is_enabled */ |
sahilmgandhi | 18:6a4db94011d3 | 115 | SD_SOFTDEVICE_VECTOR_TABLE_BASE_SET, /**< ::sd_softdevice_vector_table_base_set */ |
sahilmgandhi | 18:6a4db94011d3 | 116 | SVC_SDM_LAST /**< Placeholder for last SDM SVC */ |
sahilmgandhi | 18:6a4db94011d3 | 117 | }; |
sahilmgandhi | 18:6a4db94011d3 | 118 | |
sahilmgandhi | 18:6a4db94011d3 | 119 | /** @} */ |
sahilmgandhi | 18:6a4db94011d3 | 120 | |
sahilmgandhi | 18:6a4db94011d3 | 121 | /** @addtogroup NRF_SDM_DEFINES Defines |
sahilmgandhi | 18:6a4db94011d3 | 122 | * @{ */ |
sahilmgandhi | 18:6a4db94011d3 | 123 | |
sahilmgandhi | 18:6a4db94011d3 | 124 | /**@defgroup NRF_CLOCK_LF_XTAL_ACCURACY Clock accuracy * @{ */ |
sahilmgandhi | 18:6a4db94011d3 | 125 | |
sahilmgandhi | 18:6a4db94011d3 | 126 | #define NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM (0) /* Default */ |
sahilmgandhi | 18:6a4db94011d3 | 127 | #define NRF_CLOCK_LF_XTAL_ACCURACY_500_PPM (1) |
sahilmgandhi | 18:6a4db94011d3 | 128 | #define NRF_CLOCK_LF_XTAL_ACCURACY_150_PPM (2) |
sahilmgandhi | 18:6a4db94011d3 | 129 | #define NRF_CLOCK_LF_XTAL_ACCURACY_100_PPM (3) |
sahilmgandhi | 18:6a4db94011d3 | 130 | #define NRF_CLOCK_LF_XTAL_ACCURACY_75_PPM (4) |
sahilmgandhi | 18:6a4db94011d3 | 131 | #define NRF_CLOCK_LF_XTAL_ACCURACY_50_PPM (5) |
sahilmgandhi | 18:6a4db94011d3 | 132 | #define NRF_CLOCK_LF_XTAL_ACCURACY_30_PPM (6) |
sahilmgandhi | 18:6a4db94011d3 | 133 | #define NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM (7) |
sahilmgandhi | 18:6a4db94011d3 | 134 | |
sahilmgandhi | 18:6a4db94011d3 | 135 | /** @} */ |
sahilmgandhi | 18:6a4db94011d3 | 136 | |
sahilmgandhi | 18:6a4db94011d3 | 137 | /**@defgroup NRF_CLOCK_LF_SRC Possible lfclk oscillator sources * @{ */ |
sahilmgandhi | 18:6a4db94011d3 | 138 | |
sahilmgandhi | 18:6a4db94011d3 | 139 | #define NRF_CLOCK_LF_SRC_RC (0) /**< LFCLK RC oscillator. */ |
sahilmgandhi | 18:6a4db94011d3 | 140 | #define NRF_CLOCK_LF_SRC_XTAL (1) /**< LFCLK crystal oscillator. */ |
sahilmgandhi | 18:6a4db94011d3 | 141 | #define NRF_CLOCK_LF_SRC_SYNTH (2) /**< LFCLK Synthesized from HFCLK. */ |
sahilmgandhi | 18:6a4db94011d3 | 142 | |
sahilmgandhi | 18:6a4db94011d3 | 143 | /** @} */ |
sahilmgandhi | 18:6a4db94011d3 | 144 | /** @} */ |
sahilmgandhi | 18:6a4db94011d3 | 145 | |
sahilmgandhi | 18:6a4db94011d3 | 146 | /** @addtogroup NRF_SDM_TYPES Types |
sahilmgandhi | 18:6a4db94011d3 | 147 | * @{ */ |
sahilmgandhi | 18:6a4db94011d3 | 148 | |
sahilmgandhi | 18:6a4db94011d3 | 149 | /**@brief Type representing lfclk oscillator source. */ |
sahilmgandhi | 18:6a4db94011d3 | 150 | typedef struct |
sahilmgandhi | 18:6a4db94011d3 | 151 | { |
sahilmgandhi | 18:6a4db94011d3 | 152 | uint8_t source; /**< LF oscillator clock source, see @ref NRF_CLOCK_LF_SRC. */ |
sahilmgandhi | 18:6a4db94011d3 | 153 | uint8_t rc_ctiv; /**< Only for NRF_CLOCK_LF_SRC_RC: Calibration timer interval in 1/4 second |
sahilmgandhi | 18:6a4db94011d3 | 154 | units (nRF51: 1-64, nRF52: 1-32). |
sahilmgandhi | 18:6a4db94011d3 | 155 | @note To avoid excessive clock drift, 0.5 degrees Celsius is the |
sahilmgandhi | 18:6a4db94011d3 | 156 | maximum temperature change allowed in one calibration timer |
sahilmgandhi | 18:6a4db94011d3 | 157 | interval. The interval should be selected to ensure this. |
sahilmgandhi | 18:6a4db94011d3 | 158 | |
sahilmgandhi | 18:6a4db94011d3 | 159 | @note Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. */ |
sahilmgandhi | 18:6a4db94011d3 | 160 | uint8_t rc_temp_ctiv; /**< Only for NRF_CLOCK_LF_SRC_RC: How often (in number of calibration |
sahilmgandhi | 18:6a4db94011d3 | 161 | intervals) the RC oscillator shall be calibrated if the temperature |
sahilmgandhi | 18:6a4db94011d3 | 162 | hasn't changed. |
sahilmgandhi | 18:6a4db94011d3 | 163 | 0: Always calibrate even if the temperature hasn't changed. |
sahilmgandhi | 18:6a4db94011d3 | 164 | 1: Only calibrate if the temperature has changed (nRF51 only). |
sahilmgandhi | 18:6a4db94011d3 | 165 | 2-33: Check the temperature and only calibrate if it has changed, |
sahilmgandhi | 18:6a4db94011d3 | 166 | however calibration will take place every rc_temp_ctiv |
sahilmgandhi | 18:6a4db94011d3 | 167 | intervals in any case. |
sahilmgandhi | 18:6a4db94011d3 | 168 | |
sahilmgandhi | 18:6a4db94011d3 | 169 | @note Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. |
sahilmgandhi | 18:6a4db94011d3 | 170 | |
sahilmgandhi | 18:6a4db94011d3 | 171 | @note For nRF52, the application must ensure calibration at least once |
sahilmgandhi | 18:6a4db94011d3 | 172 | every 8 seconds to ensure +/-250ppm clock stability. The |
sahilmgandhi | 18:6a4db94011d3 | 173 | recommended configuration for NRF_CLOCK_LF_SRC_RC on nRF52 is |
sahilmgandhi | 18:6a4db94011d3 | 174 | rc_ctiv=16 and rc_temp_ctiv=2. This will ensure calibration at |
sahilmgandhi | 18:6a4db94011d3 | 175 | least once every 8 seconds and for temperature changes of 0.5 |
sahilmgandhi | 18:6a4db94011d3 | 176 | degrees Celsius every 4 seconds. See the Product Specification |
sahilmgandhi | 18:6a4db94011d3 | 177 | for the nRF52 device being used for more information.*/ |
sahilmgandhi | 18:6a4db94011d3 | 178 | uint8_t xtal_accuracy; /**< External crystal clock accuracy used in the LL to compute timing windows. |
sahilmgandhi | 18:6a4db94011d3 | 179 | |
sahilmgandhi | 18:6a4db94011d3 | 180 | @note For the NRF_CLOCK_LF_SRC_RC clock source this parameter is ignored. */ |
sahilmgandhi | 18:6a4db94011d3 | 181 | } nrf_clock_lf_cfg_t; |
sahilmgandhi | 18:6a4db94011d3 | 182 | |
sahilmgandhi | 18:6a4db94011d3 | 183 | /**@brief Fault Handler type. |
sahilmgandhi | 18:6a4db94011d3 | 184 | * |
sahilmgandhi | 18:6a4db94011d3 | 185 | * When certain unrecoverable errors occur within the application or SoftDevice the fault handler will be called back. |
sahilmgandhi | 18:6a4db94011d3 | 186 | * The protocol stack will be in an undefined state when this happens and the only way to recover will be to |
sahilmgandhi | 18:6a4db94011d3 | 187 | * perform a reset, using e.g. CMSIS NVIC_SystemReset(). |
sahilmgandhi | 18:6a4db94011d3 | 188 | * |
sahilmgandhi | 18:6a4db94011d3 | 189 | * @note This callback is executed in HardFault context, thus SVC functions cannot be called from the fault callback. |
sahilmgandhi | 18:6a4db94011d3 | 190 | * |
sahilmgandhi | 18:6a4db94011d3 | 191 | * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. |
sahilmgandhi | 18:6a4db94011d3 | 192 | * @param[in] pc The program counter of the instruction that triggered the fault. |
sahilmgandhi | 18:6a4db94011d3 | 193 | * @param[in] info Optional additional information regarding the fault. Refer to each Fault identifier for details. |
sahilmgandhi | 18:6a4db94011d3 | 194 | */ |
sahilmgandhi | 18:6a4db94011d3 | 195 | typedef void (*nrf_fault_handler_t)(uint32_t id, uint32_t pc, uint32_t info); |
sahilmgandhi | 18:6a4db94011d3 | 196 | |
sahilmgandhi | 18:6a4db94011d3 | 197 | /** @} */ |
sahilmgandhi | 18:6a4db94011d3 | 198 | |
sahilmgandhi | 18:6a4db94011d3 | 199 | /** @addtogroup NRF_SDM_FUNCTIONS Functions |
sahilmgandhi | 18:6a4db94011d3 | 200 | * @{ */ |
sahilmgandhi | 18:6a4db94011d3 | 201 | |
sahilmgandhi | 18:6a4db94011d3 | 202 | /**@brief Enables the SoftDevice and by extension the protocol stack. |
sahilmgandhi | 18:6a4db94011d3 | 203 | * |
sahilmgandhi | 18:6a4db94011d3 | 204 | * @note Some care must be taken if a low frequency clock source is already running when calling this function: |
sahilmgandhi | 18:6a4db94011d3 | 205 | * If the LF clock has a different source then the one currently running, it will be stopped. Then, the new |
sahilmgandhi | 18:6a4db94011d3 | 206 | * clock source will be started. |
sahilmgandhi | 18:6a4db94011d3 | 207 | * |
sahilmgandhi | 18:6a4db94011d3 | 208 | * @note This function has no effect when returning with an error. |
sahilmgandhi | 18:6a4db94011d3 | 209 | * |
sahilmgandhi | 18:6a4db94011d3 | 210 | * @post If return code is ::NRF_SUCCESS |
sahilmgandhi | 18:6a4db94011d3 | 211 | * - SoC library and protocol stack APIs are made available. |
sahilmgandhi | 18:6a4db94011d3 | 212 | * - A portion of RAM will be unavailable (see relevant SDS documentation). |
sahilmgandhi | 18:6a4db94011d3 | 213 | * - Some peripherals will be unavailable or available only through the SoC API (see relevant SDS documentation). |
sahilmgandhi | 18:6a4db94011d3 | 214 | * - Interrupts will not arrive from protected peripherals or interrupts. |
sahilmgandhi | 18:6a4db94011d3 | 215 | * - nrf_nvic_ functions must be used instead of CMSIS NVIC_ functions for reliable usage of the SoftDevice. |
sahilmgandhi | 18:6a4db94011d3 | 216 | * - Interrupt latency may be affected by the SoftDevice (see relevant SDS documentation). |
sahilmgandhi | 18:6a4db94011d3 | 217 | * - Chosen low frequency clock source will be running. |
sahilmgandhi | 18:6a4db94011d3 | 218 | * |
sahilmgandhi | 18:6a4db94011d3 | 219 | * @param p_clock_lf_cfg Low frequency clock source and accuracy. |
sahilmgandhi | 18:6a4db94011d3 | 220 | If NULL the clock will be configured as an rc source with rc_ctiv = 16 and .rc_temp_ctiv = 2 |
sahilmgandhi | 18:6a4db94011d3 | 221 | In the case of XTAL source, the PPM accuracy of the chosen clock source must be greater than or equal to the actual characteristics of your XTAL clock. |
sahilmgandhi | 18:6a4db94011d3 | 222 | * @param fault_handler Callback to be invoked in case of fault. |
sahilmgandhi | 18:6a4db94011d3 | 223 | * |
sahilmgandhi | 18:6a4db94011d3 | 224 | * @retval ::NRF_SUCCESS |
sahilmgandhi | 18:6a4db94011d3 | 225 | * @retval ::NRF_ERROR_INVALID_STATE SoftDevice is already enabled, and the clock source and fault handler cannot be updated. |
sahilmgandhi | 18:6a4db94011d3 | 226 | * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDevice interrupt is already enabled, or an enabled interrupt has an illegal priority level. |
sahilmgandhi | 18:6a4db94011d3 | 227 | * @retval ::NRF_ERROR_SDM_LFCLK_SOURCE_UNKNOWN Unknown low frequency clock source selected. |
sahilmgandhi | 18:6a4db94011d3 | 228 | */ |
sahilmgandhi | 18:6a4db94011d3 | 229 | SVCALL(SD_SOFTDEVICE_ENABLE, uint32_t, sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg, nrf_fault_handler_t fault_handler)); |
sahilmgandhi | 18:6a4db94011d3 | 230 | |
sahilmgandhi | 18:6a4db94011d3 | 231 | |
sahilmgandhi | 18:6a4db94011d3 | 232 | /**@brief Disables the SoftDevice and by extension the protocol stack. |
sahilmgandhi | 18:6a4db94011d3 | 233 | * |
sahilmgandhi | 18:6a4db94011d3 | 234 | * Idempotent function to disable the SoftDevice. |
sahilmgandhi | 18:6a4db94011d3 | 235 | * |
sahilmgandhi | 18:6a4db94011d3 | 236 | * @post SoC library and protocol stack APIs are made unavailable. |
sahilmgandhi | 18:6a4db94011d3 | 237 | * @post All interrupts that was protected by the SoftDevice will be disabled and initialized to priority 0 (highest). |
sahilmgandhi | 18:6a4db94011d3 | 238 | * @post All peripherals used by the SoftDevice will be reset to default values. |
sahilmgandhi | 18:6a4db94011d3 | 239 | * @post All of RAM become available. |
sahilmgandhi | 18:6a4db94011d3 | 240 | * @post All interrupts are forwarded to the application. |
sahilmgandhi | 18:6a4db94011d3 | 241 | * @post LFCLK source chosen in ::sd_softdevice_enable will be left running. |
sahilmgandhi | 18:6a4db94011d3 | 242 | * |
sahilmgandhi | 18:6a4db94011d3 | 243 | * @retval ::NRF_SUCCESS |
sahilmgandhi | 18:6a4db94011d3 | 244 | */ |
sahilmgandhi | 18:6a4db94011d3 | 245 | SVCALL(SD_SOFTDEVICE_DISABLE, uint32_t, sd_softdevice_disable(void)); |
sahilmgandhi | 18:6a4db94011d3 | 246 | |
sahilmgandhi | 18:6a4db94011d3 | 247 | /**@brief Check if the SoftDevice is enabled. |
sahilmgandhi | 18:6a4db94011d3 | 248 | * |
sahilmgandhi | 18:6a4db94011d3 | 249 | * @param[out] p_softdevice_enabled If the SoftDevice is enabled: 1 else 0. |
sahilmgandhi | 18:6a4db94011d3 | 250 | * |
sahilmgandhi | 18:6a4db94011d3 | 251 | * @retval ::NRF_SUCCESS |
sahilmgandhi | 18:6a4db94011d3 | 252 | */ |
sahilmgandhi | 18:6a4db94011d3 | 253 | SVCALL(SD_SOFTDEVICE_IS_ENABLED, uint32_t, sd_softdevice_is_enabled(uint8_t * p_softdevice_enabled)); |
sahilmgandhi | 18:6a4db94011d3 | 254 | |
sahilmgandhi | 18:6a4db94011d3 | 255 | /**@brief Sets the base address of the interrupt vector table for interrupts forwarded from the SoftDevice |
sahilmgandhi | 18:6a4db94011d3 | 256 | * |
sahilmgandhi | 18:6a4db94011d3 | 257 | * This function is only intended to be called when a bootloader is enabled. |
sahilmgandhi | 18:6a4db94011d3 | 258 | * |
sahilmgandhi | 18:6a4db94011d3 | 259 | * @param[in] address The base address of the interrupt vector table for forwarded interrupts. |
sahilmgandhi | 18:6a4db94011d3 | 260 | |
sahilmgandhi | 18:6a4db94011d3 | 261 | * @retval ::NRF_SUCCESS |
sahilmgandhi | 18:6a4db94011d3 | 262 | */ |
sahilmgandhi | 18:6a4db94011d3 | 263 | SVCALL(SD_SOFTDEVICE_VECTOR_TABLE_BASE_SET, uint32_t, sd_softdevice_vector_table_base_set(uint32_t address)); |
sahilmgandhi | 18:6a4db94011d3 | 264 | |
sahilmgandhi | 18:6a4db94011d3 | 265 | /** @} */ |
sahilmgandhi | 18:6a4db94011d3 | 266 | |
sahilmgandhi | 18:6a4db94011d3 | 267 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 268 | } |
sahilmgandhi | 18:6a4db94011d3 | 269 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 270 | #endif // NRF_SDM_H__ |
sahilmgandhi | 18:6a4db94011d3 | 271 | |
sahilmgandhi | 18:6a4db94011d3 | 272 | /** |
sahilmgandhi | 18:6a4db94011d3 | 273 | @} |
sahilmgandhi | 18:6a4db94011d3 | 274 | */ |