The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 146:22da6e220af6 1 /*
AnnaBridge 146:22da6e220af6 2 * Copyright (c) 2000 Nordic Semiconductor ASA
AnnaBridge 146:22da6e220af6 3 * All rights reserved.
AnnaBridge 146:22da6e220af6 4 *
AnnaBridge 146:22da6e220af6 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 146:22da6e220af6 6 * are permitted provided that the following conditions are met:
AnnaBridge 146:22da6e220af6 7 *
AnnaBridge 146:22da6e220af6 8 * 1. Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 146:22da6e220af6 9 * of conditions and the following disclaimer.
AnnaBridge 146:22da6e220af6 10 *
AnnaBridge 146:22da6e220af6 11 * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
AnnaBridge 146:22da6e220af6 12 * integrated circuit in a product or a software update for such product, must reproduce
AnnaBridge 146:22da6e220af6 13 * the above copyright notice, this list of conditions and the following disclaimer in
AnnaBridge 146:22da6e220af6 14 * the documentation and/or other materials provided with the distribution.
AnnaBridge 146:22da6e220af6 15 *
AnnaBridge 146:22da6e220af6 16 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
AnnaBridge 146:22da6e220af6 17 * used to endorse or promote products derived from this software without specific prior
AnnaBridge 146:22da6e220af6 18 * written permission.
AnnaBridge 146:22da6e220af6 19 *
AnnaBridge 146:22da6e220af6 20 * 4. This software, with or without modification, must only be used with a
AnnaBridge 146:22da6e220af6 21 * Nordic Semiconductor ASA integrated circuit.
AnnaBridge 146:22da6e220af6 22 *
AnnaBridge 146:22da6e220af6 23 * 5. Any software provided in binary or object form under this license must not be reverse
AnnaBridge 146:22da6e220af6 24 * engineered, decompiled, modified and/or disassembled.
AnnaBridge 146:22da6e220af6 25 *
AnnaBridge 146:22da6e220af6 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 146:22da6e220af6 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 146:22da6e220af6 28 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 146:22da6e220af6 29 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 146:22da6e220af6 30 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 146:22da6e220af6 31 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 146:22da6e220af6 32 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 146:22da6e220af6 33 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 146:22da6e220af6 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 146:22da6e220af6 35 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 146:22da6e220af6 36 *
AnnaBridge 146:22da6e220af6 37 */
AnnaBridge 146:22da6e220af6 38
AnnaBridge 146:22da6e220af6 39 /**
AnnaBridge 146:22da6e220af6 40 * @defgroup nrf_soc_api SoC Library API
AnnaBridge 146:22da6e220af6 41 * @{
AnnaBridge 146:22da6e220af6 42 *
AnnaBridge 146:22da6e220af6 43 * @brief APIs for the SoC library.
AnnaBridge 146:22da6e220af6 44 *
AnnaBridge 146:22da6e220af6 45 */
AnnaBridge 146:22da6e220af6 46
AnnaBridge 146:22da6e220af6 47 #ifndef NRF_SOC_H__
AnnaBridge 146:22da6e220af6 48 #define NRF_SOC_H__
AnnaBridge 146:22da6e220af6 49
AnnaBridge 146:22da6e220af6 50 #include <stdint.h>
AnnaBridge 146:22da6e220af6 51 #include <stdbool.h>
AnnaBridge 146:22da6e220af6 52 #include "nrf_svc.h"
AnnaBridge 146:22da6e220af6 53 #include "nrf.h"
AnnaBridge 146:22da6e220af6 54
AnnaBridge 146:22da6e220af6 55 #include "nrf_error_soc.h"
AnnaBridge 146:22da6e220af6 56
AnnaBridge 146:22da6e220af6 57 #ifdef __cplusplus
AnnaBridge 146:22da6e220af6 58 extern "C" {
AnnaBridge 146:22da6e220af6 59 #endif
AnnaBridge 146:22da6e220af6 60
AnnaBridge 146:22da6e220af6 61 /**@addtogroup NRF_SOC_DEFINES Defines
AnnaBridge 146:22da6e220af6 62 * @{ */
AnnaBridge 146:22da6e220af6 63
AnnaBridge 146:22da6e220af6 64 /**@brief The number of the lowest SVC number reserved for the SoC library. */
AnnaBridge 146:22da6e220af6 65 #define SOC_SVC_BASE (0x20)
AnnaBridge 146:22da6e220af6 66 #define SOC_SVC_BASE_NOT_AVAILABLE (0x2B)
AnnaBridge 146:22da6e220af6 67
AnnaBridge 146:22da6e220af6 68 /**@brief Guranteed time for application to process radio inactive notification. */
AnnaBridge 146:22da6e220af6 69 #define NRF_RADIO_NOTIFICATION_INACTIVE_GUARANTEED_TIME_US (62)
AnnaBridge 146:22da6e220af6 70
AnnaBridge 146:22da6e220af6 71 /**@brief The minimum allowed timeslot extension time. */
AnnaBridge 146:22da6e220af6 72 #define NRF_RADIO_MINIMUM_TIMESLOT_LENGTH_EXTENSION_TIME_US (200)
AnnaBridge 146:22da6e220af6 73
AnnaBridge 146:22da6e220af6 74 #define SOC_ECB_KEY_LENGTH (16) /**< ECB key length. */
AnnaBridge 146:22da6e220af6 75 #define SOC_ECB_CLEARTEXT_LENGTH (16) /**< ECB cleartext length. */
AnnaBridge 146:22da6e220af6 76 #define SOC_ECB_CIPHERTEXT_LENGTH (SOC_ECB_CLEARTEXT_LENGTH) /**< ECB ciphertext length. */
AnnaBridge 146:22da6e220af6 77
AnnaBridge 146:22da6e220af6 78 #ifdef NRF51
AnnaBridge 146:22da6e220af6 79 #define SD_EVT_IRQn (SWI2_IRQn) /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */
AnnaBridge 146:22da6e220af6 80 #define SD_EVT_IRQHandler (SWI2_IRQHandler) /**< SoftDevice Event IRQ handler. Used for both protocol events and SoC events. */
AnnaBridge 146:22da6e220af6 81 #define RADIO_NOTIFICATION_IRQn (SWI1_IRQn) /**< The radio notification IRQ number. */
AnnaBridge 146:22da6e220af6 82 #define RADIO_NOTIFICATION_IRQHandler (SWI1_IRQHandler) /**< The radio notification IRQ handler. */
AnnaBridge 146:22da6e220af6 83 #endif
AnnaBridge 146:22da6e220af6 84 #ifdef NRF52
AnnaBridge 146:22da6e220af6 85 #define SD_EVT_IRQn (SWI2_EGU2_IRQn) /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */
AnnaBridge 146:22da6e220af6 86 #define SD_EVT_IRQHandler (SWI2_EGU2_IRQHandler) /**< SoftDevice Event IRQ handler. Used for both protocol events and SoC events. */
AnnaBridge 146:22da6e220af6 87 #define RADIO_NOTIFICATION_IRQn (SWI1_EGU1_IRQn) /**< The radio notification IRQ number. */
AnnaBridge 146:22da6e220af6 88 #define RADIO_NOTIFICATION_IRQHandler (SWI1_EGU1_IRQHandler) /**< The radio notification IRQ handler. */
AnnaBridge 146:22da6e220af6 89 #endif
AnnaBridge 146:22da6e220af6 90
AnnaBridge 146:22da6e220af6 91 #define NRF_RADIO_LENGTH_MIN_US (100) /**< The shortest allowed radio timeslot, in microseconds. */
AnnaBridge 146:22da6e220af6 92 #define NRF_RADIO_LENGTH_MAX_US (100000) /**< The longest allowed radio timeslot, in microseconds. */
AnnaBridge 146:22da6e220af6 93
AnnaBridge 146:22da6e220af6 94 #define NRF_RADIO_DISTANCE_MAX_US (128000000UL - 1UL) /**< The longest timeslot distance, in microseconds, allowed for the distance parameter (see @ref nrf_radio_request_normal_t) in the request. */
AnnaBridge 146:22da6e220af6 95
AnnaBridge 146:22da6e220af6 96 #define NRF_RADIO_EARLIEST_TIMEOUT_MAX_US (128000000UL - 1UL) /**< The longest timeout, in microseconds, allowed when requesting the earliest possible timeslot. */
AnnaBridge 146:22da6e220af6 97
AnnaBridge 146:22da6e220af6 98 #define NRF_RADIO_START_JITTER_US (2) /**< The maximum jitter in @ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START relative to the requested start time. */
AnnaBridge 146:22da6e220af6 99
AnnaBridge 146:22da6e220af6 100 /**@} */
AnnaBridge 146:22da6e220af6 101
AnnaBridge 146:22da6e220af6 102 /**@addtogroup NRF_SOC_ENUMS Enumerations
AnnaBridge 146:22da6e220af6 103 * @{ */
AnnaBridge 146:22da6e220af6 104
AnnaBridge 146:22da6e220af6 105 /**@brief The SVC numbers used by the SVC functions in the SoC library. */
AnnaBridge 146:22da6e220af6 106 enum NRF_SOC_SVCS
AnnaBridge 146:22da6e220af6 107 {
AnnaBridge 146:22da6e220af6 108 SD_PPI_CHANNEL_ENABLE_GET = SOC_SVC_BASE,
AnnaBridge 146:22da6e220af6 109 SD_PPI_CHANNEL_ENABLE_SET,
AnnaBridge 146:22da6e220af6 110 SD_PPI_CHANNEL_ENABLE_CLR,
AnnaBridge 146:22da6e220af6 111 SD_PPI_CHANNEL_ASSIGN,
AnnaBridge 146:22da6e220af6 112 SD_PPI_GROUP_TASK_ENABLE,
AnnaBridge 146:22da6e220af6 113 SD_PPI_GROUP_TASK_DISABLE,
AnnaBridge 146:22da6e220af6 114 SD_PPI_GROUP_ASSIGN,
AnnaBridge 146:22da6e220af6 115 SD_PPI_GROUP_GET,
AnnaBridge 146:22da6e220af6 116 SD_FLASH_PAGE_ERASE,
AnnaBridge 146:22da6e220af6 117 SD_FLASH_WRITE,
AnnaBridge 146:22da6e220af6 118 SD_FLASH_PROTECT,
AnnaBridge 146:22da6e220af6 119 SD_MUTEX_NEW = SOC_SVC_BASE_NOT_AVAILABLE,
AnnaBridge 146:22da6e220af6 120 SD_MUTEX_ACQUIRE,
AnnaBridge 146:22da6e220af6 121 SD_MUTEX_RELEASE,
AnnaBridge 146:22da6e220af6 122 SD_RFU_1,
AnnaBridge 146:22da6e220af6 123 SD_RFU_2,
AnnaBridge 146:22da6e220af6 124 SD_RFU_3,
AnnaBridge 146:22da6e220af6 125 SD_RFU_4,
AnnaBridge 146:22da6e220af6 126 SD_RFU_5,
AnnaBridge 146:22da6e220af6 127 SD_RFU_6,
AnnaBridge 146:22da6e220af6 128 SD_RFU_7,
AnnaBridge 146:22da6e220af6 129 SD_RFU_8,
AnnaBridge 146:22da6e220af6 130 SD_RFU_9,
AnnaBridge 146:22da6e220af6 131 SD_RFU_10,
AnnaBridge 146:22da6e220af6 132 SD_RAND_APPLICATION_POOL_CAPACITY_GET,
AnnaBridge 146:22da6e220af6 133 SD_RAND_APPLICATION_BYTES_AVAILABLE_GET,
AnnaBridge 146:22da6e220af6 134 SD_RAND_APPLICATION_VECTOR_GET,
AnnaBridge 146:22da6e220af6 135 SD_POWER_MODE_SET,
AnnaBridge 146:22da6e220af6 136 SD_POWER_SYSTEM_OFF,
AnnaBridge 146:22da6e220af6 137 SD_POWER_RESET_REASON_GET,
AnnaBridge 146:22da6e220af6 138 SD_POWER_RESET_REASON_CLR,
AnnaBridge 146:22da6e220af6 139 SD_POWER_POF_ENABLE,
AnnaBridge 146:22da6e220af6 140 SD_POWER_POF_THRESHOLD_SET,
AnnaBridge 146:22da6e220af6 141 SD_POWER_RAMON_SET,
AnnaBridge 146:22da6e220af6 142 SD_POWER_RAMON_CLR,
AnnaBridge 146:22da6e220af6 143 SD_POWER_RAMON_GET,
AnnaBridge 146:22da6e220af6 144 SD_POWER_GPREGRET_SET,
AnnaBridge 146:22da6e220af6 145 SD_POWER_GPREGRET_CLR,
AnnaBridge 146:22da6e220af6 146 SD_POWER_GPREGRET_GET,
AnnaBridge 146:22da6e220af6 147 SD_POWER_DCDC_MODE_SET,
AnnaBridge 146:22da6e220af6 148 SD_APP_EVT_WAIT,
AnnaBridge 146:22da6e220af6 149 SD_CLOCK_HFCLK_REQUEST,
AnnaBridge 146:22da6e220af6 150 SD_CLOCK_HFCLK_RELEASE,
AnnaBridge 146:22da6e220af6 151 SD_CLOCK_HFCLK_IS_RUNNING,
AnnaBridge 146:22da6e220af6 152 SD_RADIO_NOTIFICATION_CFG_SET,
AnnaBridge 146:22da6e220af6 153 SD_ECB_BLOCK_ENCRYPT,
AnnaBridge 146:22da6e220af6 154 SD_ECB_BLOCKS_ENCRYPT,
AnnaBridge 146:22da6e220af6 155 SD_RADIO_SESSION_OPEN,
AnnaBridge 146:22da6e220af6 156 SD_RADIO_SESSION_CLOSE,
AnnaBridge 146:22da6e220af6 157 SD_RADIO_REQUEST,
AnnaBridge 146:22da6e220af6 158 SD_EVT_GET,
AnnaBridge 146:22da6e220af6 159 SD_TEMP_GET,
AnnaBridge 146:22da6e220af6 160 SVC_SOC_LAST
AnnaBridge 146:22da6e220af6 161 };
AnnaBridge 146:22da6e220af6 162
AnnaBridge 146:22da6e220af6 163 /**@brief Possible values of a ::nrf_mutex_t. */
AnnaBridge 146:22da6e220af6 164 enum NRF_MUTEX_VALUES
AnnaBridge 146:22da6e220af6 165 {
AnnaBridge 146:22da6e220af6 166 NRF_MUTEX_FREE,
AnnaBridge 146:22da6e220af6 167 NRF_MUTEX_TAKEN
AnnaBridge 146:22da6e220af6 168 };
AnnaBridge 146:22da6e220af6 169
AnnaBridge 146:22da6e220af6 170 /**@brief Power modes. */
AnnaBridge 146:22da6e220af6 171 enum NRF_POWER_MODES
AnnaBridge 146:22da6e220af6 172 {
AnnaBridge 146:22da6e220af6 173 NRF_POWER_MODE_CONSTLAT, /**< Constant latency mode. See power management in the reference manual. */
AnnaBridge 146:22da6e220af6 174 NRF_POWER_MODE_LOWPWR /**< Low power mode. See power management in the reference manual. */
AnnaBridge 146:22da6e220af6 175 };
AnnaBridge 146:22da6e220af6 176
AnnaBridge 146:22da6e220af6 177
AnnaBridge 146:22da6e220af6 178 /**@brief Power failure thresholds */
AnnaBridge 146:22da6e220af6 179 enum NRF_POWER_THRESHOLDS
AnnaBridge 146:22da6e220af6 180 {
AnnaBridge 146:22da6e220af6 181 NRF_POWER_THRESHOLD_V21, /**< 2.1 Volts power failure threshold. */
AnnaBridge 146:22da6e220af6 182 NRF_POWER_THRESHOLD_V23, /**< 2.3 Volts power failure threshold. */
AnnaBridge 146:22da6e220af6 183 NRF_POWER_THRESHOLD_V25, /**< 2.5 Volts power failure threshold. */
AnnaBridge 146:22da6e220af6 184 NRF_POWER_THRESHOLD_V27 /**< 2.7 Volts power failure threshold. */
AnnaBridge 146:22da6e220af6 185 };
AnnaBridge 146:22da6e220af6 186
AnnaBridge 146:22da6e220af6 187
AnnaBridge 146:22da6e220af6 188 /**@brief DC/DC converter modes. */
AnnaBridge 146:22da6e220af6 189 enum NRF_POWER_DCDC_MODES
AnnaBridge 146:22da6e220af6 190 {
AnnaBridge 146:22da6e220af6 191 NRF_POWER_DCDC_DISABLE, /**< The DCDC is disabled. */
AnnaBridge 146:22da6e220af6 192 NRF_POWER_DCDC_ENABLE /**< The DCDC is enabled. */
AnnaBridge 146:22da6e220af6 193 };
AnnaBridge 146:22da6e220af6 194
AnnaBridge 146:22da6e220af6 195 /**@brief Radio notification distances. */
AnnaBridge 146:22da6e220af6 196 enum NRF_RADIO_NOTIFICATION_DISTANCES
AnnaBridge 146:22da6e220af6 197 {
AnnaBridge 146:22da6e220af6 198 NRF_RADIO_NOTIFICATION_DISTANCE_NONE = 0, /**< The event does not have a notification. */
AnnaBridge 146:22da6e220af6 199 NRF_RADIO_NOTIFICATION_DISTANCE_800US, /**< The distance from the active notification to start of radio activity. */
AnnaBridge 146:22da6e220af6 200 NRF_RADIO_NOTIFICATION_DISTANCE_1740US, /**< The distance from the active notification to start of radio activity. */
AnnaBridge 146:22da6e220af6 201 NRF_RADIO_NOTIFICATION_DISTANCE_2680US, /**< The distance from the active notification to start of radio activity. */
AnnaBridge 146:22da6e220af6 202 NRF_RADIO_NOTIFICATION_DISTANCE_3620US, /**< The distance from the active notification to start of radio activity. */
AnnaBridge 146:22da6e220af6 203 NRF_RADIO_NOTIFICATION_DISTANCE_4560US, /**< The distance from the active notification to start of radio activity. */
AnnaBridge 146:22da6e220af6 204 NRF_RADIO_NOTIFICATION_DISTANCE_5500US /**< The distance from the active notification to start of radio activity. */
AnnaBridge 146:22da6e220af6 205 };
AnnaBridge 146:22da6e220af6 206
AnnaBridge 146:22da6e220af6 207
AnnaBridge 146:22da6e220af6 208 /**@brief Radio notification types. */
AnnaBridge 146:22da6e220af6 209 enum NRF_RADIO_NOTIFICATION_TYPES
AnnaBridge 146:22da6e220af6 210 {
AnnaBridge 146:22da6e220af6 211 NRF_RADIO_NOTIFICATION_TYPE_NONE = 0, /**< The event does not have a radio notification signal. */
AnnaBridge 146:22da6e220af6 212 NRF_RADIO_NOTIFICATION_TYPE_INT_ON_ACTIVE, /**< Using interrupt for notification when the radio will be enabled. */
AnnaBridge 146:22da6e220af6 213 NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE, /**< Using interrupt for notification when the radio has been disabled. */
AnnaBridge 146:22da6e220af6 214 NRF_RADIO_NOTIFICATION_TYPE_INT_ON_BOTH, /**< Using interrupt for notification both when the radio will be enabled and disabled. */
AnnaBridge 146:22da6e220af6 215 };
AnnaBridge 146:22da6e220af6 216
AnnaBridge 146:22da6e220af6 217 /**@brief The Radio signal callback types. */
AnnaBridge 146:22da6e220af6 218 enum NRF_RADIO_CALLBACK_SIGNAL_TYPE
AnnaBridge 146:22da6e220af6 219 {
AnnaBridge 146:22da6e220af6 220 NRF_RADIO_CALLBACK_SIGNAL_TYPE_START, /**< This signal indicates the start of the radio timeslot. */
AnnaBridge 146:22da6e220af6 221 NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0, /**< This signal indicates the NRF_TIMER0 interrupt. */
AnnaBridge 146:22da6e220af6 222 NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO, /**< This signal indicates the NRF_RADIO interrupt. */
AnnaBridge 146:22da6e220af6 223 NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_FAILED, /**< This signal indicates extend action failed. */
AnnaBridge 146:22da6e220af6 224 NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_SUCCEEDED /**< This signal indicates extend action succeeded. */
AnnaBridge 146:22da6e220af6 225 };
AnnaBridge 146:22da6e220af6 226
AnnaBridge 146:22da6e220af6 227 /**@brief The actions requested by the signal callback.
AnnaBridge 146:22da6e220af6 228 *
AnnaBridge 146:22da6e220af6 229 * This code gives the SOC instructions about what action to take when the signal callback has
AnnaBridge 146:22da6e220af6 230 * returned.
AnnaBridge 146:22da6e220af6 231 */
AnnaBridge 146:22da6e220af6 232 enum NRF_RADIO_SIGNAL_CALLBACK_ACTION
AnnaBridge 146:22da6e220af6 233 {
AnnaBridge 146:22da6e220af6 234 NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE, /**< Return without action. */
AnnaBridge 146:22da6e220af6 235 NRF_RADIO_SIGNAL_CALLBACK_ACTION_EXTEND, /**< Request an extension of the current timeslot (maximum execution time for this action is when the extension succeeded). */
AnnaBridge 146:22da6e220af6 236 NRF_RADIO_SIGNAL_CALLBACK_ACTION_END, /**< End the current radio timeslot. */
AnnaBridge 146:22da6e220af6 237 NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END /**< Request a new radio timeslot and end the current timeslot. */
AnnaBridge 146:22da6e220af6 238 };
AnnaBridge 146:22da6e220af6 239
AnnaBridge 146:22da6e220af6 240 /**@brief Radio timeslot high frequency clock source configuration. */
AnnaBridge 146:22da6e220af6 241 enum NRF_RADIO_HFCLK_CFG
AnnaBridge 146:22da6e220af6 242 {
AnnaBridge 146:22da6e220af6 243 NRF_RADIO_HFCLK_CFG_XTAL_GUARANTEED, /**< The SoftDevice will guarantee that the high frequency clock source is the
AnnaBridge 146:22da6e220af6 244 external crystal for the whole duration of the timeslot. This should be the
AnnaBridge 146:22da6e220af6 245 preferred option for events that use the radio or require high timing accuracy. */
AnnaBridge 146:22da6e220af6 246 NRF_RADIO_HFCLK_CFG_NO_GUARANTEE /**< This configuration allows for earlier and tighter scheduling of timeslots.
AnnaBridge 146:22da6e220af6 247 The RC oscillator may be the clock source in part or for the whole duration of the timeslot.
AnnaBridge 146:22da6e220af6 248 The RC oscillator's accuracy must therefore be taken into consideration.
AnnaBridge 146:22da6e220af6 249 @note If the application will use the radio peripheral in timeslots with this configuration,
AnnaBridge 146:22da6e220af6 250 it must make sure that the crystal is running and stable before starting the radio. */
AnnaBridge 146:22da6e220af6 251 };
AnnaBridge 146:22da6e220af6 252
AnnaBridge 146:22da6e220af6 253 /**@brief Radio timeslot priorities. */
AnnaBridge 146:22da6e220af6 254 enum NRF_RADIO_PRIORITY
AnnaBridge 146:22da6e220af6 255 {
AnnaBridge 146:22da6e220af6 256 NRF_RADIO_PRIORITY_HIGH, /**< High (equal priority as the normal connection priority of the SoftDevice stack(s)). */
AnnaBridge 146:22da6e220af6 257 NRF_RADIO_PRIORITY_NORMAL, /**< Normal (equal priority as the priority of secondary activites of the SoftDevice stack(s)). */
AnnaBridge 146:22da6e220af6 258 };
AnnaBridge 146:22da6e220af6 259
AnnaBridge 146:22da6e220af6 260 /**@brief Radio timeslot request type. */
AnnaBridge 146:22da6e220af6 261 enum NRF_RADIO_REQUEST_TYPE
AnnaBridge 146:22da6e220af6 262 {
AnnaBridge 146:22da6e220af6 263 NRF_RADIO_REQ_TYPE_EARLIEST, /**< Request radio timeslot as early as possible. This should always be used for the first request in a session. */
AnnaBridge 146:22da6e220af6 264 NRF_RADIO_REQ_TYPE_NORMAL /**< Normal radio timeslot request. */
AnnaBridge 146:22da6e220af6 265 };
AnnaBridge 146:22da6e220af6 266
AnnaBridge 146:22da6e220af6 267 /**@brief SoC Events. */
AnnaBridge 146:22da6e220af6 268 enum NRF_SOC_EVTS
AnnaBridge 146:22da6e220af6 269 {
AnnaBridge 146:22da6e220af6 270 NRF_EVT_HFCLKSTARTED, /**< Event indicating that the HFCLK has started. */
AnnaBridge 146:22da6e220af6 271 NRF_EVT_POWER_FAILURE_WARNING, /**< Event indicating that a power failure warning has occurred. */
AnnaBridge 146:22da6e220af6 272 NRF_EVT_FLASH_OPERATION_SUCCESS, /**< Event indicating that the ongoing flash operation has completed successfully. */
AnnaBridge 146:22da6e220af6 273 NRF_EVT_FLASH_OPERATION_ERROR, /**< Event indicating that the ongoing flash operation has timed out with an error. */
AnnaBridge 146:22da6e220af6 274 NRF_EVT_RADIO_BLOCKED, /**< Event indicating that a radio timeslot was blocked. */
AnnaBridge 146:22da6e220af6 275 NRF_EVT_RADIO_CANCELED, /**< Event indicating that a radio timeslot was canceled by SoftDevice. */
AnnaBridge 146:22da6e220af6 276 NRF_EVT_RADIO_SIGNAL_CALLBACK_INVALID_RETURN, /**< Event indicating that a radio timeslot signal callback handler return was invalid. */
AnnaBridge 146:22da6e220af6 277 NRF_EVT_RADIO_SESSION_IDLE, /**< Event indicating that a radio timeslot session is idle. */
AnnaBridge 146:22da6e220af6 278 NRF_EVT_RADIO_SESSION_CLOSED, /**< Event indicating that a radio timeslot session is closed. */
AnnaBridge 146:22da6e220af6 279 NRF_EVT_NUMBER_OF_EVTS
AnnaBridge 146:22da6e220af6 280 };
AnnaBridge 146:22da6e220af6 281
AnnaBridge 146:22da6e220af6 282 /**@} */
AnnaBridge 146:22da6e220af6 283
AnnaBridge 146:22da6e220af6 284
AnnaBridge 146:22da6e220af6 285 /**@addtogroup NRF_SOC_STRUCTURES Structures
AnnaBridge 146:22da6e220af6 286 * @{ */
AnnaBridge 146:22da6e220af6 287
AnnaBridge 146:22da6e220af6 288 /**@brief Represents a mutex for use with the nrf_mutex functions.
AnnaBridge 146:22da6e220af6 289 * @note Accessing the value directly is not safe, use the mutex functions!
AnnaBridge 146:22da6e220af6 290 */
AnnaBridge 146:22da6e220af6 291 typedef volatile uint8_t nrf_mutex_t;
AnnaBridge 146:22da6e220af6 292
AnnaBridge 146:22da6e220af6 293 /**@brief Parameters for a request for a timeslot as early as possible. */
AnnaBridge 146:22da6e220af6 294 typedef struct
AnnaBridge 146:22da6e220af6 295 {
AnnaBridge 146:22da6e220af6 296 uint8_t hfclk; /**< High frequency clock source, see @ref NRF_RADIO_HFCLK_CFG. */
AnnaBridge 146:22da6e220af6 297 uint8_t priority; /**< The radio timeslot priority, see @ref NRF_RADIO_PRIORITY. */
AnnaBridge 146:22da6e220af6 298 uint32_t length_us; /**< The radio timeslot length (in the range 100 to 100,000] microseconds). */
AnnaBridge 146:22da6e220af6 299 uint32_t timeout_us; /**< Longest acceptable delay until the start of the requested timeslot (up to @ref NRF_RADIO_EARLIEST_TIMEOUT_MAX_US microseconds). */
AnnaBridge 146:22da6e220af6 300 } nrf_radio_request_earliest_t;
AnnaBridge 146:22da6e220af6 301
AnnaBridge 146:22da6e220af6 302 /**@brief Parameters for a normal radio timeslot request. */
AnnaBridge 146:22da6e220af6 303 typedef struct
AnnaBridge 146:22da6e220af6 304 {
AnnaBridge 146:22da6e220af6 305 uint8_t hfclk; /**< High frequency clock source, see @ref NRF_RADIO_HFCLK_CFG. */
AnnaBridge 146:22da6e220af6 306 uint8_t priority; /**< The radio timeslot priority, see @ref NRF_RADIO_PRIORITY. */
AnnaBridge 146:22da6e220af6 307 uint32_t distance_us; /**< Distance from the start of the previous radio timeslot (up to @ref NRF_RADIO_DISTANCE_MAX_US microseconds). */
AnnaBridge 146:22da6e220af6 308 uint32_t length_us; /**< The radio timeslot length (in the range [100..100,000] microseconds). */
AnnaBridge 146:22da6e220af6 309 } nrf_radio_request_normal_t;
AnnaBridge 146:22da6e220af6 310
AnnaBridge 146:22da6e220af6 311 /**@brief Radio timeslot request parameters. */
AnnaBridge 146:22da6e220af6 312 typedef struct
AnnaBridge 146:22da6e220af6 313 {
AnnaBridge 146:22da6e220af6 314 uint8_t request_type; /**< Type of request, see @ref NRF_RADIO_REQUEST_TYPE. */
AnnaBridge 146:22da6e220af6 315 union
AnnaBridge 146:22da6e220af6 316 {
AnnaBridge 146:22da6e220af6 317 nrf_radio_request_earliest_t earliest; /**< Parameters for requesting a radio timeslot as early as possible. */
AnnaBridge 146:22da6e220af6 318 nrf_radio_request_normal_t normal; /**< Parameters for requesting a normal radio timeslot. */
AnnaBridge 146:22da6e220af6 319 } params;
AnnaBridge 146:22da6e220af6 320 } nrf_radio_request_t;
AnnaBridge 146:22da6e220af6 321
AnnaBridge 146:22da6e220af6 322 /**@brief Return parameters of the radio timeslot signal callback. */
AnnaBridge 146:22da6e220af6 323 typedef struct
AnnaBridge 146:22da6e220af6 324 {
AnnaBridge 146:22da6e220af6 325 uint8_t callback_action; /**< The action requested by the application when returning from the signal callback, see @ref NRF_RADIO_SIGNAL_CALLBACK_ACTION. */
AnnaBridge 146:22da6e220af6 326 union
AnnaBridge 146:22da6e220af6 327 {
AnnaBridge 146:22da6e220af6 328 struct
AnnaBridge 146:22da6e220af6 329 {
AnnaBridge 146:22da6e220af6 330 nrf_radio_request_t * p_next; /**< The request parameters for the next radio timeslot. */
AnnaBridge 146:22da6e220af6 331 } request; /**< Additional parameters for return_code @ref NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END. */
AnnaBridge 146:22da6e220af6 332 struct
AnnaBridge 146:22da6e220af6 333 {
AnnaBridge 146:22da6e220af6 334 uint32_t length_us; /**< Requested extension of the radio timeslot duration (microseconds) (for minimum time see @ref NRF_RADIO_MINIMUM_TIMESLOT_LENGTH_EXTENSION_TIME_US). */
AnnaBridge 146:22da6e220af6 335 } extend; /**< Additional parameters for return_code @ref NRF_RADIO_SIGNAL_CALLBACK_ACTION_EXTEND. */
AnnaBridge 146:22da6e220af6 336 } params;
AnnaBridge 146:22da6e220af6 337 } nrf_radio_signal_callback_return_param_t;
AnnaBridge 146:22da6e220af6 338
AnnaBridge 146:22da6e220af6 339 /**@brief The radio timeslot signal callback type.
AnnaBridge 146:22da6e220af6 340 *
AnnaBridge 146:22da6e220af6 341 * @note In case of invalid return parameters, the radio timeslot will automatically end
AnnaBridge 146:22da6e220af6 342 * immediately after returning from the signal callback and the
AnnaBridge 146:22da6e220af6 343 * @ref NRF_EVT_RADIO_SIGNAL_CALLBACK_INVALID_RETURN event will be sent.
AnnaBridge 146:22da6e220af6 344 * @note The returned struct pointer must remain valid after the signal callback
AnnaBridge 146:22da6e220af6 345 * function returns. For instance, this means that it must not point to a stack variable.
AnnaBridge 146:22da6e220af6 346 *
AnnaBridge 146:22da6e220af6 347 * @param[in] signal_type Type of signal, see @ref NRF_RADIO_CALLBACK_SIGNAL_TYPE.
AnnaBridge 146:22da6e220af6 348 *
AnnaBridge 146:22da6e220af6 349 * @return Pointer to structure containing action requested by the application.
AnnaBridge 146:22da6e220af6 350 */
AnnaBridge 146:22da6e220af6 351 typedef nrf_radio_signal_callback_return_param_t * (*nrf_radio_signal_callback_t) (uint8_t signal_type);
AnnaBridge 146:22da6e220af6 352
AnnaBridge 146:22da6e220af6 353 /**@brief AES ECB parameter typedefs */
AnnaBridge 146:22da6e220af6 354 typedef uint8_t soc_ecb_key_t[SOC_ECB_KEY_LENGTH];
AnnaBridge 146:22da6e220af6 355 typedef uint8_t soc_ecb_cleartext_t[SOC_ECB_CLEARTEXT_LENGTH];
AnnaBridge 146:22da6e220af6 356 typedef uint8_t soc_ecb_ciphertext_t[SOC_ECB_CIPHERTEXT_LENGTH];
AnnaBridge 146:22da6e220af6 357
AnnaBridge 146:22da6e220af6 358 /**@brief AES ECB data structure */
AnnaBridge 146:22da6e220af6 359 typedef struct
AnnaBridge 146:22da6e220af6 360 {
AnnaBridge 146:22da6e220af6 361 soc_ecb_key_t key; /**< Encryption key. */
AnnaBridge 146:22da6e220af6 362 soc_ecb_cleartext_t cleartext; /**< Cleartext data. */
AnnaBridge 146:22da6e220af6 363 soc_ecb_ciphertext_t ciphertext; /**< Ciphertext data. */
AnnaBridge 146:22da6e220af6 364 } nrf_ecb_hal_data_t;
AnnaBridge 146:22da6e220af6 365
AnnaBridge 146:22da6e220af6 366 /**@brief AES ECB block. Used to provide multiple blocks in a single call
AnnaBridge 146:22da6e220af6 367 to @ref sd_ecb_blocks_encrypt.*/
AnnaBridge 146:22da6e220af6 368 typedef struct
AnnaBridge 146:22da6e220af6 369 {
AnnaBridge 146:22da6e220af6 370 soc_ecb_key_t* p_key; /**< Pointer to the Encryption key. */
AnnaBridge 146:22da6e220af6 371 soc_ecb_cleartext_t* p_cleartext; /**< Pointer to the Cleartext data. */
AnnaBridge 146:22da6e220af6 372 soc_ecb_ciphertext_t* p_ciphertext; /**< Pointer to the Ciphertext data. */
AnnaBridge 146:22da6e220af6 373 } nrf_ecb_hal_data_block_t;
AnnaBridge 146:22da6e220af6 374
AnnaBridge 146:22da6e220af6 375 /**@} */
AnnaBridge 146:22da6e220af6 376
AnnaBridge 146:22da6e220af6 377 /**@addtogroup NRF_SOC_FUNCTIONS Functions
AnnaBridge 146:22da6e220af6 378 * @{ */
AnnaBridge 146:22da6e220af6 379
AnnaBridge 146:22da6e220af6 380 /**@brief Initialize a mutex.
AnnaBridge 146:22da6e220af6 381 *
AnnaBridge 146:22da6e220af6 382 * @param[in] p_mutex Pointer to the mutex to initialize.
AnnaBridge 146:22da6e220af6 383 *
AnnaBridge 146:22da6e220af6 384 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 385 */
AnnaBridge 146:22da6e220af6 386 SVCALL(SD_MUTEX_NEW, uint32_t, sd_mutex_new(nrf_mutex_t * p_mutex));
AnnaBridge 146:22da6e220af6 387
AnnaBridge 146:22da6e220af6 388 /**@brief Attempt to acquire a mutex.
AnnaBridge 146:22da6e220af6 389 *
AnnaBridge 146:22da6e220af6 390 * @param[in] p_mutex Pointer to the mutex to acquire.
AnnaBridge 146:22da6e220af6 391 *
AnnaBridge 146:22da6e220af6 392 * @retval ::NRF_SUCCESS The mutex was successfully acquired.
AnnaBridge 146:22da6e220af6 393 * @retval ::NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN The mutex could not be acquired.
AnnaBridge 146:22da6e220af6 394 */
AnnaBridge 146:22da6e220af6 395 SVCALL(SD_MUTEX_ACQUIRE, uint32_t, sd_mutex_acquire(nrf_mutex_t * p_mutex));
AnnaBridge 146:22da6e220af6 396
AnnaBridge 146:22da6e220af6 397 /**@brief Release a mutex.
AnnaBridge 146:22da6e220af6 398 *
AnnaBridge 146:22da6e220af6 399 * @param[in] p_mutex Pointer to the mutex to release.
AnnaBridge 146:22da6e220af6 400 *
AnnaBridge 146:22da6e220af6 401 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 402 */
AnnaBridge 146:22da6e220af6 403 SVCALL(SD_MUTEX_RELEASE, uint32_t, sd_mutex_release(nrf_mutex_t * p_mutex));
AnnaBridge 146:22da6e220af6 404
AnnaBridge 146:22da6e220af6 405 /**@brief Query the capacity of the application random pool.
AnnaBridge 146:22da6e220af6 406 *
AnnaBridge 146:22da6e220af6 407 * @param[out] p_pool_capacity The capacity of the pool.
AnnaBridge 146:22da6e220af6 408 *
AnnaBridge 146:22da6e220af6 409 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 410 */
AnnaBridge 146:22da6e220af6 411 SVCALL(SD_RAND_APPLICATION_POOL_CAPACITY_GET, uint32_t, sd_rand_application_pool_capacity_get(uint8_t * p_pool_capacity));
AnnaBridge 146:22da6e220af6 412
AnnaBridge 146:22da6e220af6 413 /**@brief Get number of random bytes available to the application.
AnnaBridge 146:22da6e220af6 414 *
AnnaBridge 146:22da6e220af6 415 * @param[out] p_bytes_available The number of bytes currently available in the pool.
AnnaBridge 146:22da6e220af6 416 *
AnnaBridge 146:22da6e220af6 417 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 418 */
AnnaBridge 146:22da6e220af6 419 SVCALL(SD_RAND_APPLICATION_BYTES_AVAILABLE_GET, uint32_t, sd_rand_application_bytes_available_get(uint8_t * p_bytes_available));
AnnaBridge 146:22da6e220af6 420
AnnaBridge 146:22da6e220af6 421 /**@brief Get random bytes from the application pool.
AnnaBridge 146:22da6e220af6 422 *
AnnaBridge 146:22da6e220af6 423 * @param[out] p_buff Pointer to unit8_t buffer for storing the bytes.
AnnaBridge 146:22da6e220af6 424 * @param[in] length Number of bytes to take from pool and place in p_buff.
AnnaBridge 146:22da6e220af6 425 *
AnnaBridge 146:22da6e220af6 426 * @retval ::NRF_SUCCESS The requested bytes were written to p_buff.
AnnaBridge 146:22da6e220af6 427 * @retval ::NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES No bytes were written to the buffer, because there were not enough bytes available.
AnnaBridge 146:22da6e220af6 428 */
AnnaBridge 146:22da6e220af6 429 SVCALL(SD_RAND_APPLICATION_VECTOR_GET, uint32_t, sd_rand_application_vector_get(uint8_t * p_buff, uint8_t length));
AnnaBridge 146:22da6e220af6 430
AnnaBridge 146:22da6e220af6 431 /**@brief Gets the reset reason register.
AnnaBridge 146:22da6e220af6 432 *
AnnaBridge 146:22da6e220af6 433 * @param[out] p_reset_reason Contents of the NRF_POWER->RESETREAS register.
AnnaBridge 146:22da6e220af6 434 *
AnnaBridge 146:22da6e220af6 435 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 436 */
AnnaBridge 146:22da6e220af6 437 SVCALL(SD_POWER_RESET_REASON_GET, uint32_t, sd_power_reset_reason_get(uint32_t * p_reset_reason));
AnnaBridge 146:22da6e220af6 438
AnnaBridge 146:22da6e220af6 439 /**@brief Clears the bits of the reset reason register.
AnnaBridge 146:22da6e220af6 440 *
AnnaBridge 146:22da6e220af6 441 * @param[in] reset_reason_clr_msk Contains the bits to clear from the reset reason register.
AnnaBridge 146:22da6e220af6 442 *
AnnaBridge 146:22da6e220af6 443 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 444 */
AnnaBridge 146:22da6e220af6 445 SVCALL(SD_POWER_RESET_REASON_CLR, uint32_t, sd_power_reset_reason_clr(uint32_t reset_reason_clr_msk));
AnnaBridge 146:22da6e220af6 446
AnnaBridge 146:22da6e220af6 447 /**@brief Sets the power mode when in CPU sleep.
AnnaBridge 146:22da6e220af6 448 *
AnnaBridge 146:22da6e220af6 449 * @param[in] power_mode The power mode to use when in CPU sleep, see @ref NRF_POWER_MODES. @sa sd_app_evt_wait
AnnaBridge 146:22da6e220af6 450 *
AnnaBridge 146:22da6e220af6 451 * @retval ::NRF_SUCCESS The power mode was set.
AnnaBridge 146:22da6e220af6 452 * @retval ::NRF_ERROR_SOC_POWER_MODE_UNKNOWN The power mode was unknown.
AnnaBridge 146:22da6e220af6 453 */
AnnaBridge 146:22da6e220af6 454 SVCALL(SD_POWER_MODE_SET, uint32_t, sd_power_mode_set(uint8_t power_mode));
AnnaBridge 146:22da6e220af6 455
AnnaBridge 146:22da6e220af6 456 /**@brief Puts the chip in System OFF mode.
AnnaBridge 146:22da6e220af6 457 *
AnnaBridge 146:22da6e220af6 458 * @retval ::NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN
AnnaBridge 146:22da6e220af6 459 */
AnnaBridge 146:22da6e220af6 460 SVCALL(SD_POWER_SYSTEM_OFF, uint32_t, sd_power_system_off(void));
AnnaBridge 146:22da6e220af6 461
AnnaBridge 146:22da6e220af6 462 /**@brief Enables or disables the power-fail comparator.
AnnaBridge 146:22da6e220af6 463 *
AnnaBridge 146:22da6e220af6 464 * Enabling this will give a softdevice event (NRF_EVT_POWER_FAILURE_WARNING) when the power failure warning occurs.
AnnaBridge 146:22da6e220af6 465 * The event can be retrieved with sd_evt_get();
AnnaBridge 146:22da6e220af6 466 *
AnnaBridge 146:22da6e220af6 467 * @param[in] pof_enable True if the power-fail comparator should be enabled, false if it should be disabled.
AnnaBridge 146:22da6e220af6 468 *
AnnaBridge 146:22da6e220af6 469 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 470 */
AnnaBridge 146:22da6e220af6 471 SVCALL(SD_POWER_POF_ENABLE, uint32_t, sd_power_pof_enable(uint8_t pof_enable));
AnnaBridge 146:22da6e220af6 472
AnnaBridge 146:22da6e220af6 473 /**@brief Sets the power-fail threshold value.
AnnaBridge 146:22da6e220af6 474 *
AnnaBridge 146:22da6e220af6 475 * @param[in] threshold The power-fail threshold value to use, see @ref NRF_POWER_THRESHOLDS.
AnnaBridge 146:22da6e220af6 476 *
AnnaBridge 146:22da6e220af6 477 * @retval ::NRF_SUCCESS The power failure threshold was set.
AnnaBridge 146:22da6e220af6 478 * @retval ::NRF_ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN The power failure threshold is unknown.
AnnaBridge 146:22da6e220af6 479 */
AnnaBridge 146:22da6e220af6 480 SVCALL(SD_POWER_POF_THRESHOLD_SET, uint32_t, sd_power_pof_threshold_set(uint8_t threshold));
AnnaBridge 146:22da6e220af6 481
AnnaBridge 146:22da6e220af6 482 /**@brief Sets bits in the NRF_POWER->RAMON register.
AnnaBridge 146:22da6e220af6 483 *
AnnaBridge 146:22da6e220af6 484 * @param[in] ramon Contains the bits needed to be set in the NRF_POWER->RAMON register.
AnnaBridge 146:22da6e220af6 485 *
AnnaBridge 146:22da6e220af6 486 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 487 */
AnnaBridge 146:22da6e220af6 488 SVCALL(SD_POWER_RAMON_SET, uint32_t, sd_power_ramon_set(uint32_t ramon));
AnnaBridge 146:22da6e220af6 489
AnnaBridge 146:22da6e220af6 490 /**@brief Clears bits in the NRF_POWER->RAMON register.
AnnaBridge 146:22da6e220af6 491 *
AnnaBridge 146:22da6e220af6 492 * @param ramon Contains the bits needed to be cleared in the NRF_POWER->RAMON register.
AnnaBridge 146:22da6e220af6 493 *
AnnaBridge 146:22da6e220af6 494 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 495 */
AnnaBridge 146:22da6e220af6 496 SVCALL(SD_POWER_RAMON_CLR, uint32_t, sd_power_ramon_clr(uint32_t ramon));
AnnaBridge 146:22da6e220af6 497
AnnaBridge 146:22da6e220af6 498 /**@brief Get contents of NRF_POWER->RAMON register, indicates power status of ram blocks.
AnnaBridge 146:22da6e220af6 499 *
AnnaBridge 146:22da6e220af6 500 * @param[out] p_ramon Content of NRF_POWER->RAMON register.
AnnaBridge 146:22da6e220af6 501 *
AnnaBridge 146:22da6e220af6 502 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 503 */
AnnaBridge 146:22da6e220af6 504 SVCALL(SD_POWER_RAMON_GET, uint32_t, sd_power_ramon_get(uint32_t * p_ramon));
AnnaBridge 146:22da6e220af6 505
AnnaBridge 146:22da6e220af6 506 /**@brief Set bits in the NRF_POWER->GPREGRET register.
AnnaBridge 146:22da6e220af6 507 *
AnnaBridge 146:22da6e220af6 508 * @param[in] gpregret_msk Bits to be set in the GPREGRET register.
AnnaBridge 146:22da6e220af6 509 *
AnnaBridge 146:22da6e220af6 510 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 511 */
AnnaBridge 146:22da6e220af6 512 SVCALL(SD_POWER_GPREGRET_SET, uint32_t, sd_power_gpregret_set(uint32_t gpregret_msk));
AnnaBridge 146:22da6e220af6 513
AnnaBridge 146:22da6e220af6 514 /**@brief Clear bits in the NRF_POWER->GPREGRET register.
AnnaBridge 146:22da6e220af6 515 *
AnnaBridge 146:22da6e220af6 516 * @param[in] gpregret_msk Bits to be clear in the GPREGRET register.
AnnaBridge 146:22da6e220af6 517 *
AnnaBridge 146:22da6e220af6 518 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 519 */
AnnaBridge 146:22da6e220af6 520 SVCALL(SD_POWER_GPREGRET_CLR, uint32_t, sd_power_gpregret_clr(uint32_t gpregret_msk));
AnnaBridge 146:22da6e220af6 521
AnnaBridge 146:22da6e220af6 522 /**@brief Get contents of the NRF_POWER->GPREGRET register.
AnnaBridge 146:22da6e220af6 523 *
AnnaBridge 146:22da6e220af6 524 * @param[out] p_gpregret Contents of the GPREGRET register.
AnnaBridge 146:22da6e220af6 525 *
AnnaBridge 146:22da6e220af6 526 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 527 */
AnnaBridge 146:22da6e220af6 528 SVCALL(SD_POWER_GPREGRET_GET, uint32_t, sd_power_gpregret_get(uint32_t *p_gpregret));
AnnaBridge 146:22da6e220af6 529
AnnaBridge 146:22da6e220af6 530 /**@brief Sets the DCDC mode.
AnnaBridge 146:22da6e220af6 531 *
AnnaBridge 146:22da6e220af6 532 * Enable or disable the DCDC peripheral.
AnnaBridge 146:22da6e220af6 533 *
AnnaBridge 146:22da6e220af6 534 * @param[in] dcdc_mode The mode of the DCDC, see @ref NRF_POWER_DCDC_MODES.
AnnaBridge 146:22da6e220af6 535 *
AnnaBridge 146:22da6e220af6 536 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 537 * @retval ::NRF_ERROR_INVALID_PARAM The DCDC mode is invalid.
AnnaBridge 146:22da6e220af6 538 */
AnnaBridge 146:22da6e220af6 539 SVCALL(SD_POWER_DCDC_MODE_SET, uint32_t, sd_power_dcdc_mode_set(uint8_t dcdc_mode));
AnnaBridge 146:22da6e220af6 540
AnnaBridge 146:22da6e220af6 541 /**@brief Request the high frequency crystal oscillator.
AnnaBridge 146:22da6e220af6 542 *
AnnaBridge 146:22da6e220af6 543 * Will start the high frequency crystal oscillator, the startup time of the crystal varies
AnnaBridge 146:22da6e220af6 544 * and the ::sd_clock_hfclk_is_running function can be polled to check if it has started.
AnnaBridge 146:22da6e220af6 545 *
AnnaBridge 146:22da6e220af6 546 * @see sd_clock_hfclk_is_running
AnnaBridge 146:22da6e220af6 547 * @see sd_clock_hfclk_release
AnnaBridge 146:22da6e220af6 548 *
AnnaBridge 146:22da6e220af6 549 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 550 */
AnnaBridge 146:22da6e220af6 551 SVCALL(SD_CLOCK_HFCLK_REQUEST, uint32_t, sd_clock_hfclk_request(void));
AnnaBridge 146:22da6e220af6 552
AnnaBridge 146:22da6e220af6 553 /**@brief Releases the high frequency crystal oscillator.
AnnaBridge 146:22da6e220af6 554 *
AnnaBridge 146:22da6e220af6 555 * Will stop the high frequency crystal oscillator, this happens immediately.
AnnaBridge 146:22da6e220af6 556 *
AnnaBridge 146:22da6e220af6 557 * @see sd_clock_hfclk_is_running
AnnaBridge 146:22da6e220af6 558 * @see sd_clock_hfclk_request
AnnaBridge 146:22da6e220af6 559 *
AnnaBridge 146:22da6e220af6 560 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 561 */
AnnaBridge 146:22da6e220af6 562 SVCALL(SD_CLOCK_HFCLK_RELEASE, uint32_t, sd_clock_hfclk_release(void));
AnnaBridge 146:22da6e220af6 563
AnnaBridge 146:22da6e220af6 564 /**@brief Checks if the high frequency crystal oscillator is running.
AnnaBridge 146:22da6e220af6 565 *
AnnaBridge 146:22da6e220af6 566 * @see sd_clock_hfclk_request
AnnaBridge 146:22da6e220af6 567 * @see sd_clock_hfclk_release
AnnaBridge 146:22da6e220af6 568 *
AnnaBridge 146:22da6e220af6 569 * @param[out] p_is_running 1 if the external crystal oscillator is running, 0 if not.
AnnaBridge 146:22da6e220af6 570 *
AnnaBridge 146:22da6e220af6 571 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 572 */
AnnaBridge 146:22da6e220af6 573 SVCALL(SD_CLOCK_HFCLK_IS_RUNNING, uint32_t, sd_clock_hfclk_is_running(uint32_t * p_is_running));
AnnaBridge 146:22da6e220af6 574
AnnaBridge 146:22da6e220af6 575 /**@brief Waits for an application event.
AnnaBridge 146:22da6e220af6 576 *
AnnaBridge 146:22da6e220af6 577 * An application event is either an application interrupt or a pended interrupt when the
AnnaBridge 146:22da6e220af6 578 * interrupt is disabled. When the interrupt is enabled it will be taken immediately since
AnnaBridge 146:22da6e220af6 579 * this function will wait in thread mode, then the execution will return in the application's
AnnaBridge 146:22da6e220af6 580 * main thread. When an interrupt is disabled and gets pended it will return to the application's
AnnaBridge 146:22da6e220af6 581 * thread main. The application must ensure that the pended flag is cleared using
AnnaBridge 146:22da6e220af6 582 * ::sd_nvic_ClearPendingIRQ in order to sleep using this function. This is only necessary for
AnnaBridge 146:22da6e220af6 583 * disabled interrupts, as the interrupt handler will clear the pending flag automatically for
AnnaBridge 146:22da6e220af6 584 * enabled interrupts.
AnnaBridge 146:22da6e220af6 585 *
AnnaBridge 146:22da6e220af6 586 * In order to wake up from disabled interrupts, the SEVONPEND flag has to be set in the Cortex-M0
AnnaBridge 146:22da6e220af6 587 * System Control Register (SCR). @sa CMSIS_SCB
AnnaBridge 146:22da6e220af6 588 *
AnnaBridge 146:22da6e220af6 589 * @note If an application interrupt has happened since the last time sd_app_evt_wait was
AnnaBridge 146:22da6e220af6 590 * called this function will return immediately and not go to sleep. This is to avoid race
AnnaBridge 146:22da6e220af6 591 * conditions that can occur when a flag is updated in the interrupt handler and processed
AnnaBridge 146:22da6e220af6 592 * in the main loop.
AnnaBridge 146:22da6e220af6 593 *
AnnaBridge 146:22da6e220af6 594 * @post An application interrupt has happened or a interrupt pending flag is set.
AnnaBridge 146:22da6e220af6 595 *
AnnaBridge 146:22da6e220af6 596 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 597 */
AnnaBridge 146:22da6e220af6 598 SVCALL(SD_APP_EVT_WAIT, uint32_t, sd_app_evt_wait(void));
AnnaBridge 146:22da6e220af6 599
AnnaBridge 146:22da6e220af6 600 /**@brief Get PPI channel enable register contents.
AnnaBridge 146:22da6e220af6 601 *
AnnaBridge 146:22da6e220af6 602 * @param[out] p_channel_enable The contents of the PPI CHEN register.
AnnaBridge 146:22da6e220af6 603 *
AnnaBridge 146:22da6e220af6 604 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 605 */
AnnaBridge 146:22da6e220af6 606 SVCALL(SD_PPI_CHANNEL_ENABLE_GET, uint32_t, sd_ppi_channel_enable_get(uint32_t * p_channel_enable));
AnnaBridge 146:22da6e220af6 607
AnnaBridge 146:22da6e220af6 608 /**@brief Set PPI channel enable register.
AnnaBridge 146:22da6e220af6 609 *
AnnaBridge 146:22da6e220af6 610 * @param[in] channel_enable_set_msk Mask containing the bits to set in the PPI CHEN register.
AnnaBridge 146:22da6e220af6 611 *
AnnaBridge 146:22da6e220af6 612 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 613 */
AnnaBridge 146:22da6e220af6 614 SVCALL(SD_PPI_CHANNEL_ENABLE_SET, uint32_t, sd_ppi_channel_enable_set(uint32_t channel_enable_set_msk));
AnnaBridge 146:22da6e220af6 615
AnnaBridge 146:22da6e220af6 616 /**@brief Clear PPI channel enable register.
AnnaBridge 146:22da6e220af6 617 *
AnnaBridge 146:22da6e220af6 618 * @param[in] channel_enable_clr_msk Mask containing the bits to clear in the PPI CHEN register.
AnnaBridge 146:22da6e220af6 619 *
AnnaBridge 146:22da6e220af6 620 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 621 */
AnnaBridge 146:22da6e220af6 622 SVCALL(SD_PPI_CHANNEL_ENABLE_CLR, uint32_t, sd_ppi_channel_enable_clr(uint32_t channel_enable_clr_msk));
AnnaBridge 146:22da6e220af6 623
AnnaBridge 146:22da6e220af6 624 /**@brief Assign endpoints to a PPI channel.
AnnaBridge 146:22da6e220af6 625 *
AnnaBridge 146:22da6e220af6 626 * @param[in] channel_num Number of the PPI channel to assign.
AnnaBridge 146:22da6e220af6 627 * @param[in] evt_endpoint Event endpoint of the PPI channel.
AnnaBridge 146:22da6e220af6 628 * @param[in] task_endpoint Task endpoint of the PPI channel.
AnnaBridge 146:22da6e220af6 629 *
AnnaBridge 146:22da6e220af6 630 * @retval ::NRF_ERROR_SOC_PPI_INVALID_CHANNEL The channel number is invalid.
AnnaBridge 146:22da6e220af6 631 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 632 */
AnnaBridge 146:22da6e220af6 633 SVCALL(SD_PPI_CHANNEL_ASSIGN, uint32_t, sd_ppi_channel_assign(uint8_t channel_num, const volatile void * evt_endpoint, const volatile void * task_endpoint));
AnnaBridge 146:22da6e220af6 634
AnnaBridge 146:22da6e220af6 635 /**@brief Task to enable a channel group.
AnnaBridge 146:22da6e220af6 636 *
AnnaBridge 146:22da6e220af6 637 * @param[in] group_num Number of the channel group.
AnnaBridge 146:22da6e220af6 638 *
AnnaBridge 146:22da6e220af6 639 * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid
AnnaBridge 146:22da6e220af6 640 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 641 */
AnnaBridge 146:22da6e220af6 642 SVCALL(SD_PPI_GROUP_TASK_ENABLE, uint32_t, sd_ppi_group_task_enable(uint8_t group_num));
AnnaBridge 146:22da6e220af6 643
AnnaBridge 146:22da6e220af6 644 /**@brief Task to disable a channel group.
AnnaBridge 146:22da6e220af6 645 *
AnnaBridge 146:22da6e220af6 646 * @param[in] group_num Number of the PPI group.
AnnaBridge 146:22da6e220af6 647 *
AnnaBridge 146:22da6e220af6 648 * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid.
AnnaBridge 146:22da6e220af6 649 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 650 */
AnnaBridge 146:22da6e220af6 651 SVCALL(SD_PPI_GROUP_TASK_DISABLE, uint32_t, sd_ppi_group_task_disable(uint8_t group_num));
AnnaBridge 146:22da6e220af6 652
AnnaBridge 146:22da6e220af6 653 /**@brief Assign PPI channels to a channel group.
AnnaBridge 146:22da6e220af6 654 *
AnnaBridge 146:22da6e220af6 655 * @param[in] group_num Number of the channel group.
AnnaBridge 146:22da6e220af6 656 * @param[in] channel_msk Mask of the channels to assign to the group.
AnnaBridge 146:22da6e220af6 657 *
AnnaBridge 146:22da6e220af6 658 * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid.
AnnaBridge 146:22da6e220af6 659 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 660 */
AnnaBridge 146:22da6e220af6 661 SVCALL(SD_PPI_GROUP_ASSIGN, uint32_t, sd_ppi_group_assign(uint8_t group_num, uint32_t channel_msk));
AnnaBridge 146:22da6e220af6 662
AnnaBridge 146:22da6e220af6 663 /**@brief Gets the PPI channels of a channel group.
AnnaBridge 146:22da6e220af6 664 *
AnnaBridge 146:22da6e220af6 665 * @param[in] group_num Number of the channel group.
AnnaBridge 146:22da6e220af6 666 * @param[out] p_channel_msk Mask of the channels assigned to the group.
AnnaBridge 146:22da6e220af6 667 *
AnnaBridge 146:22da6e220af6 668 * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid.
AnnaBridge 146:22da6e220af6 669 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 670 */
AnnaBridge 146:22da6e220af6 671 SVCALL(SD_PPI_GROUP_GET, uint32_t, sd_ppi_group_get(uint8_t group_num, uint32_t * p_channel_msk));
AnnaBridge 146:22da6e220af6 672
AnnaBridge 146:22da6e220af6 673 /**@brief Configures the Radio Notification signal.
AnnaBridge 146:22da6e220af6 674 *
AnnaBridge 146:22da6e220af6 675 * @note
AnnaBridge 146:22da6e220af6 676 * - The notification signal latency depends on the interrupt priority settings of SWI used
AnnaBridge 146:22da6e220af6 677 * for notification signal.
AnnaBridge 146:22da6e220af6 678 * - To ensure that the radio notification signal behaves in a consistent way, always
AnnaBridge 146:22da6e220af6 679 * configure radio notifications when there is no protocol stack or other SoftDevice
AnnaBridge 146:22da6e220af6 680 * activity in progress. It is recommended that the radio notification signal is
AnnaBridge 146:22da6e220af6 681 * configured directly after the SoftDevice has been enabled.
AnnaBridge 146:22da6e220af6 682 * - In the period between the ACTIVE signal and the start of the Radio Event, the SoftDevice
AnnaBridge 146:22da6e220af6 683 * will interrupt the application to do Radio Event preparation.
AnnaBridge 146:22da6e220af6 684 * - Using the Radio Notification feature may limit the bandwidth, as the SoftDevice may have
AnnaBridge 146:22da6e220af6 685 * to shorten the connection events to have time for the Radio Notification signals.
AnnaBridge 146:22da6e220af6 686 *
AnnaBridge 146:22da6e220af6 687 * @param[in] type Type of notification signal, see @ref NRF_RADIO_NOTIFICATION_TYPES.
AnnaBridge 146:22da6e220af6 688 * @ref NRF_RADIO_NOTIFICATION_TYPE_NONE shall be used to turn off radio
AnnaBridge 146:22da6e220af6 689 * notification. Using @ref NRF_RADIO_NOTIFICATION_DISTANCE_NONE is
AnnaBridge 146:22da6e220af6 690 * recommended (but not required) to be used with
AnnaBridge 146:22da6e220af6 691 * @ref NRF_RADIO_NOTIFICATION_TYPE_NONE.
AnnaBridge 146:22da6e220af6 692 *
AnnaBridge 146:22da6e220af6 693 * @param[in] distance Distance between the notification signal and start of radio activity, see @ref NRF_RADIO_NOTIFICATION_DISTANCES.
AnnaBridge 146:22da6e220af6 694 * This parameter is ignored when @ref NRF_RADIO_NOTIFICATION_TYPE_NONE or
AnnaBridge 146:22da6e220af6 695 * @ref NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE is used.
AnnaBridge 146:22da6e220af6 696 *
AnnaBridge 146:22da6e220af6 697 * @retval ::NRF_ERROR_INVALID_PARAM The group number is invalid.
AnnaBridge 146:22da6e220af6 698 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 699 */
AnnaBridge 146:22da6e220af6 700 SVCALL(SD_RADIO_NOTIFICATION_CFG_SET, uint32_t, sd_radio_notification_cfg_set(uint8_t type, uint8_t distance));
AnnaBridge 146:22da6e220af6 701
AnnaBridge 146:22da6e220af6 702 /**@brief Encrypts a block according to the specified parameters.
AnnaBridge 146:22da6e220af6 703 *
AnnaBridge 146:22da6e220af6 704 * 128-bit AES encryption.
AnnaBridge 146:22da6e220af6 705 *
AnnaBridge 146:22da6e220af6 706 * @note:
AnnaBridge 146:22da6e220af6 707 * - The application may set the SEVONPEND bit in the SCR to 1 to make the SoftDevice sleep while
AnnaBridge 146:22da6e220af6 708 * the ECB is running. The SEVONPEND bit should only be cleared (set to 0) from application
AnnaBridge 146:22da6e220af6 709 * main or low interrupt level.
AnnaBridge 146:22da6e220af6 710 *
AnnaBridge 146:22da6e220af6 711 * @param[in, out] p_ecb_data Pointer to the ECB parameters' struct (two input
AnnaBridge 146:22da6e220af6 712 * parameters and one output parameter).
AnnaBridge 146:22da6e220af6 713 *
AnnaBridge 146:22da6e220af6 714 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 715 */
AnnaBridge 146:22da6e220af6 716 SVCALL(SD_ECB_BLOCK_ENCRYPT, uint32_t, sd_ecb_block_encrypt(nrf_ecb_hal_data_t * p_ecb_data));
AnnaBridge 146:22da6e220af6 717
AnnaBridge 146:22da6e220af6 718 /**@brief Encrypts multiple data blocks provided as an array of data block structures.
AnnaBridge 146:22da6e220af6 719 *
AnnaBridge 146:22da6e220af6 720 * @details: Performs 128-bit AES encryption on multiple data blocks
AnnaBridge 146:22da6e220af6 721 *
AnnaBridge 146:22da6e220af6 722 * @note:
AnnaBridge 146:22da6e220af6 723 * - The application may set the SEVONPEND bit in the SCR to 1 to make the SoftDevice sleep while
AnnaBridge 146:22da6e220af6 724 * the ECB is running. The SEVONPEND bit should only be cleared (set to 0) from application
AnnaBridge 146:22da6e220af6 725 * main or low interrupt level.
AnnaBridge 146:22da6e220af6 726 *
AnnaBridge 146:22da6e220af6 727 * @param[in] block_count Count of blocks in the p_data_blocks array.
AnnaBridge 146:22da6e220af6 728 * @param[in,out] p_data_blocks Pointer to the first entry in a contiguous array of
AnnaBridge 146:22da6e220af6 729 * @ref nrf_ecb_hal_data_block_t structures.
AnnaBridge 146:22da6e220af6 730 *
AnnaBridge 146:22da6e220af6 731 * @retval ::NRF_SUCCESS
AnnaBridge 146:22da6e220af6 732 */
AnnaBridge 146:22da6e220af6 733 SVCALL(SD_ECB_BLOCKS_ENCRYPT, uint32_t, sd_ecb_blocks_encrypt(uint8_t block_count, nrf_ecb_hal_data_block_t * p_data_blocks));
AnnaBridge 146:22da6e220af6 734
AnnaBridge 146:22da6e220af6 735 /**@brief Gets any pending events generated by the SoC API.
AnnaBridge 146:22da6e220af6 736 *
AnnaBridge 146:22da6e220af6 737 * The application should keep calling this function to get events, until ::NRF_ERROR_NOT_FOUND is returned.
AnnaBridge 146:22da6e220af6 738 *
AnnaBridge 146:22da6e220af6 739 * @param[out] p_evt_id Set to one of the values in @ref NRF_SOC_EVTS, if any events are pending.
AnnaBridge 146:22da6e220af6 740 *
AnnaBridge 146:22da6e220af6 741 * @retval ::NRF_SUCCESS An event was pending. The event id is written in the p_evt_id parameter.
AnnaBridge 146:22da6e220af6 742 * @retval ::NRF_ERROR_NOT_FOUND No pending events.
AnnaBridge 146:22da6e220af6 743 */
AnnaBridge 146:22da6e220af6 744 SVCALL(SD_EVT_GET, uint32_t, sd_evt_get(uint32_t * p_evt_id));
AnnaBridge 146:22da6e220af6 745
AnnaBridge 146:22da6e220af6 746 /**@brief Get the temperature measured on the chip
AnnaBridge 146:22da6e220af6 747 *
AnnaBridge 146:22da6e220af6 748 * This function will block until the temperature measurement is done.
AnnaBridge 146:22da6e220af6 749 * It takes around 50us from call to return.
AnnaBridge 146:22da6e220af6 750 *
AnnaBridge 146:22da6e220af6 751 * @param[out] p_temp Result of temperature measurement. Die temperature in 0.25 degrees celsius.
AnnaBridge 146:22da6e220af6 752 *
AnnaBridge 146:22da6e220af6 753 * @retval ::NRF_SUCCESS A temperature measurement was done, and the temperature was written to temp
AnnaBridge 146:22da6e220af6 754 */
AnnaBridge 146:22da6e220af6 755 SVCALL(SD_TEMP_GET, uint32_t, sd_temp_get(int32_t * p_temp));
AnnaBridge 146:22da6e220af6 756
AnnaBridge 146:22da6e220af6 757 /**@brief Flash Write
AnnaBridge 146:22da6e220af6 758 *
AnnaBridge 146:22da6e220af6 759 * Commands to write a buffer to flash
AnnaBridge 146:22da6e220af6 760 *
AnnaBridge 146:22da6e220af6 761 * If the SoftDevice is enabled:
AnnaBridge 146:22da6e220af6 762 * This call initiates the flash access command, and its completion will be communicated to the
AnnaBridge 146:22da6e220af6 763 * application with exactly one of the following events:
AnnaBridge 146:22da6e220af6 764 * - @ref NRF_EVT_FLASH_OPERATION_SUCCESS - The command was successfully completed.
AnnaBridge 146:22da6e220af6 765 * - @ref NRF_EVT_FLASH_OPERATION_ERROR - The command could not be started.
AnnaBridge 146:22da6e220af6 766 *
AnnaBridge 146:22da6e220af6 767 * If the SoftDevice is not enabled no event will be generated, and this call will return @ref NRF_SUCCESS when the
AnnaBridge 146:22da6e220af6 768 * write has been completed
AnnaBridge 146:22da6e220af6 769 *
AnnaBridge 146:22da6e220af6 770 * @note
AnnaBridge 146:22da6e220af6 771 * - This call takes control over the radio and the CPU during flash erase and write to make sure that
AnnaBridge 146:22da6e220af6 772 * they will not interfere with the flash access. This means that all interrupts will be blocked
AnnaBridge 146:22da6e220af6 773 * for a predictable time (depending on the NVMC specification in nRF51 Series Reference Manual
AnnaBridge 146:22da6e220af6 774 * and the command parameters).
AnnaBridge 146:22da6e220af6 775 *
AnnaBridge 146:22da6e220af6 776 *
AnnaBridge 146:22da6e220af6 777 * @param[in] p_dst Pointer to start of flash location to be written.
AnnaBridge 146:22da6e220af6 778 * @param[in] p_src Pointer to buffer with data to be written.
AnnaBridge 146:22da6e220af6 779 * @param[in] size Number of 32-bit words to write. Maximum size is 256 32-bit words for nRF51 and 1024 for nRF52.
AnnaBridge 146:22da6e220af6 780 *
AnnaBridge 146:22da6e220af6 781 * @retval ::NRF_ERROR_INVALID_ADDR Tried to write to a non existing flash address, or p_dst or p_src was unaligned.
AnnaBridge 146:22da6e220af6 782 * @retval ::NRF_ERROR_BUSY The previous command has not yet completed.
AnnaBridge 146:22da6e220af6 783 * @retval ::NRF_ERROR_INVALID_LENGTH Size was 0, or higher than the maximum allowed size.
AnnaBridge 146:22da6e220af6 784 * @retval ::NRF_ERROR_FORBIDDEN Tried to write to or read from protected location.
AnnaBridge 146:22da6e220af6 785 * @retval ::NRF_SUCCESS The command was accepted.
AnnaBridge 146:22da6e220af6 786 */
AnnaBridge 146:22da6e220af6 787 SVCALL(SD_FLASH_WRITE, uint32_t, sd_flash_write(uint32_t * const p_dst, uint32_t const * const p_src, uint32_t size));
AnnaBridge 146:22da6e220af6 788
AnnaBridge 146:22da6e220af6 789
AnnaBridge 146:22da6e220af6 790 /**@brief Flash Erase page
AnnaBridge 146:22da6e220af6 791 *
AnnaBridge 146:22da6e220af6 792 * Commands to erase a flash page
AnnaBridge 146:22da6e220af6 793 * If the SoftDevice is enabled:
AnnaBridge 146:22da6e220af6 794 * This call initiates the flash access command, and its completion will be communicated to the
AnnaBridge 146:22da6e220af6 795 * application with exactly one of the following events:
AnnaBridge 146:22da6e220af6 796 * - @ref NRF_EVT_FLASH_OPERATION_SUCCESS - The command was successfully completed.
AnnaBridge 146:22da6e220af6 797 * - @ref NRF_EVT_FLASH_OPERATION_ERROR - The command could not be started.
AnnaBridge 146:22da6e220af6 798 *
AnnaBridge 146:22da6e220af6 799 * If the SoftDevice is not enabled no event will be generated, and this call will return @ref NRF_SUCCESS when the
AnnaBridge 146:22da6e220af6 800 * erase has been completed
AnnaBridge 146:22da6e220af6 801 *
AnnaBridge 146:22da6e220af6 802 * @note
AnnaBridge 146:22da6e220af6 803 * - This call takes control over the radio and the CPU during flash erase and write to make sure that
AnnaBridge 146:22da6e220af6 804 * they will not interfere with the flash access. This means that all interrupts will be blocked
AnnaBridge 146:22da6e220af6 805 * for a predictable time (depending on the NVMC specification in nRF51 Series Reference Manual
AnnaBridge 146:22da6e220af6 806 * and the command parameters).
AnnaBridge 146:22da6e220af6 807 *
AnnaBridge 146:22da6e220af6 808 *
AnnaBridge 146:22da6e220af6 809 * @param[in] page_number Pagenumber of the page to erase
AnnaBridge 146:22da6e220af6 810 * @retval ::NRF_ERROR_INTERNAL If a new session could not be opened due to an internal error.
AnnaBridge 146:22da6e220af6 811 * @retval ::NRF_ERROR_INVALID_ADDR Tried to erase to a non existing flash page.
AnnaBridge 146:22da6e220af6 812 * @retval ::NRF_ERROR_BUSY The previous command has not yet completed.
AnnaBridge 146:22da6e220af6 813 * @retval ::NRF_ERROR_FORBIDDEN Tried to erase a protected page.
AnnaBridge 146:22da6e220af6 814 * @retval ::NRF_SUCCESS The command was accepted.
AnnaBridge 146:22da6e220af6 815 */
AnnaBridge 146:22da6e220af6 816 SVCALL(SD_FLASH_PAGE_ERASE, uint32_t, sd_flash_page_erase(uint32_t page_number));
AnnaBridge 146:22da6e220af6 817
AnnaBridge 146:22da6e220af6 818
AnnaBridge 146:22da6e220af6 819 /**@brief Flash Protection set
AnnaBridge 146:22da6e220af6 820 *
AnnaBridge 146:22da6e220af6 821 * Commands to set the flash protection configuration registers.
AnnaBridge 146:22da6e220af6 822 On nRF51 this sets the PROTENSETx registers of the MPU peripheral.
AnnaBridge 146:22da6e220af6 823 On nRF52 this sets the CONFIGx registers of the BPROT peripheral.
AnnaBridge 146:22da6e220af6 824 *
AnnaBridge 146:22da6e220af6 825 * @note To read the values read them directly. They are only write-protected.
AnnaBridge 146:22da6e220af6 826 *
AnnaBridge 146:22da6e220af6 827 * @param[in] block_cfg0 Value to be written to the configuration register.
AnnaBridge 146:22da6e220af6 828 * @param[in] block_cfg1 Value to be written to the configuration register.
AnnaBridge 146:22da6e220af6 829 * @param[in] block_cfg2 Value to be written to the configuration register (ignored on nRF51).
AnnaBridge 146:22da6e220af6 830 * @param[in] block_cfg3 Value to be written to the configuration register (ignored on nRF51).
AnnaBridge 146:22da6e220af6 831 *
AnnaBridge 146:22da6e220af6 832 * @retval ::NRF_ERROR_FORBIDDEN Tried to protect the SoftDevice.
AnnaBridge 146:22da6e220af6 833 * @retval ::NRF_SUCCESS Values successfully written to configuration registers.
AnnaBridge 146:22da6e220af6 834 */
AnnaBridge 146:22da6e220af6 835 SVCALL(SD_FLASH_PROTECT, uint32_t, sd_flash_protect(uint32_t block_cfg0, uint32_t block_cfg1, uint32_t block_cfg2, uint32_t block_cfg3));
AnnaBridge 146:22da6e220af6 836
AnnaBridge 146:22da6e220af6 837 /**@brief Opens a session for radio timeslot requests.
AnnaBridge 146:22da6e220af6 838 *
AnnaBridge 146:22da6e220af6 839 * @note Only one session can be open at a time.
AnnaBridge 146:22da6e220af6 840 * @note p_radio_signal_callback(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START) will be called when the radio timeslot
AnnaBridge 146:22da6e220af6 841 * starts. From this point the NRF_RADIO and NRF_TIMER0 peripherals can be freely accessed
AnnaBridge 146:22da6e220af6 842 * by the application.
AnnaBridge 146:22da6e220af6 843 * @note p_radio_signal_callback(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0) is called whenever the NRF_TIMER0
AnnaBridge 146:22da6e220af6 844 * interrupt occurs.
AnnaBridge 146:22da6e220af6 845 * @note p_radio_signal_callback(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO) is called whenever the NRF_RADIO
AnnaBridge 146:22da6e220af6 846 * interrupt occurs.
AnnaBridge 146:22da6e220af6 847 * @note p_radio_signal_callback() will be called at ARM interrupt priority level 0. This
AnnaBridge 146:22da6e220af6 848 * implies that none of the sd_* API calls can be used from p_radio_signal_callback().
AnnaBridge 146:22da6e220af6 849 *
AnnaBridge 146:22da6e220af6 850 * @param[in] p_radio_signal_callback The signal callback.
AnnaBridge 146:22da6e220af6 851 *
AnnaBridge 146:22da6e220af6 852 * @retval ::NRF_ERROR_INVALID_ADDR p_radio_signal_callback is an invalid function pointer.
AnnaBridge 146:22da6e220af6 853 * @retval ::NRF_ERROR_BUSY If session cannot be opened.
AnnaBridge 146:22da6e220af6 854 * @retval ::NRF_ERROR_INTERNAL If a new session could not be opened due to an internal error.
AnnaBridge 146:22da6e220af6 855 * @retval ::NRF_SUCCESS Otherwise.
AnnaBridge 146:22da6e220af6 856 */
AnnaBridge 146:22da6e220af6 857 SVCALL(SD_RADIO_SESSION_OPEN, uint32_t, sd_radio_session_open(nrf_radio_signal_callback_t p_radio_signal_callback));
AnnaBridge 146:22da6e220af6 858
AnnaBridge 146:22da6e220af6 859 /**@brief Closes a session for radio timeslot requests.
AnnaBridge 146:22da6e220af6 860 *
AnnaBridge 146:22da6e220af6 861 * @note Any current radio timeslot will be finished before the session is closed.
AnnaBridge 146:22da6e220af6 862 * @note If a radio timeslot is scheduled when the session is closed, it will be canceled.
AnnaBridge 146:22da6e220af6 863 * @note The application cannot consider the session closed until the @ref NRF_EVT_RADIO_SESSION_CLOSED
AnnaBridge 146:22da6e220af6 864 * event is received.
AnnaBridge 146:22da6e220af6 865 *
AnnaBridge 146:22da6e220af6 866 * @retval ::NRF_ERROR_FORBIDDEN If session not opened.
AnnaBridge 146:22da6e220af6 867 * @retval ::NRF_ERROR_BUSY If session is currently being closed.
AnnaBridge 146:22da6e220af6 868 * @retval ::NRF_SUCCESS Otherwise.
AnnaBridge 146:22da6e220af6 869 */
AnnaBridge 146:22da6e220af6 870 SVCALL(SD_RADIO_SESSION_CLOSE, uint32_t, sd_radio_session_close(void));
AnnaBridge 146:22da6e220af6 871
AnnaBridge 146:22da6e220af6 872 /**@brief Requests a radio timeslot.
AnnaBridge 146:22da6e220af6 873 *
AnnaBridge 146:22da6e220af6 874 * @note The request type is determined by p_request->request_type, and can be one of @ref NRF_RADIO_REQ_TYPE_EARLIEST
AnnaBridge 146:22da6e220af6 875 * and @ref NRF_RADIO_REQ_TYPE_NORMAL. The first request in a session must always be of type @ref NRF_RADIO_REQ_TYPE_EARLIEST.
AnnaBridge 146:22da6e220af6 876 * @note For a normal request (@ref NRF_RADIO_REQ_TYPE_NORMAL), the start time of a radio timeslot is specified by
AnnaBridge 146:22da6e220af6 877 * p_request->distance_us and is given relative to the start of the previous timeslot.
AnnaBridge 146:22da6e220af6 878 * @note A too small p_request->distance_us will lead to a @ref NRF_EVT_RADIO_BLOCKED event.
AnnaBridge 146:22da6e220af6 879 * @note Timeslots scheduled too close will lead to a @ref NRF_EVT_RADIO_BLOCKED event.
AnnaBridge 146:22da6e220af6 880 * @note See the SoftDevice Specification for more on radio timeslot scheduling, distances and lengths.
AnnaBridge 146:22da6e220af6 881 * @note If an opportunity for the first radio timeslot is not found before 100ms after the call to this
AnnaBridge 146:22da6e220af6 882 * function, it is not scheduled, and instead a @ref NRF_EVT_RADIO_BLOCKED event is sent.
AnnaBridge 146:22da6e220af6 883 * The application may then try to schedule the first radio timeslot again.
AnnaBridge 146:22da6e220af6 884 * @note Successful requests will result in nrf_radio_signal_callback_t(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START).
AnnaBridge 146:22da6e220af6 885 * Unsuccessful requests will result in a @ref NRF_EVT_RADIO_BLOCKED event, see @ref NRF_SOC_EVTS.
AnnaBridge 146:22da6e220af6 886 * @note The jitter in the start time of the radio timeslots is +/- @ref NRF_RADIO_START_JITTER_US us.
AnnaBridge 146:22da6e220af6 887 * @note The nrf_radio_signal_callback_t(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START) call has a latency relative to the
AnnaBridge 146:22da6e220af6 888 * specified radio timeslot start, but this does not affect the actual start time of the timeslot.
AnnaBridge 146:22da6e220af6 889 * @note NRF_TIMER0 is reset at the start of the radio timeslot, and is clocked at 1MHz from the high frequency
AnnaBridge 146:22da6e220af6 890 * (16 MHz) clock source. If p_request->hfclk_force_xtal is true, the high frequency clock is
AnnaBridge 146:22da6e220af6 891 * guaranteed to be clocked from the external crystal.
AnnaBridge 146:22da6e220af6 892 * @note The SoftDevice will neither access the NRF_RADIO peripheral nor the NRF_TIMER0 peripheral
AnnaBridge 146:22da6e220af6 893 * during the radio timeslot.
AnnaBridge 146:22da6e220af6 894 *
AnnaBridge 146:22da6e220af6 895 * @param[in] p_request Pointer to the request parameters.
AnnaBridge 146:22da6e220af6 896 *
AnnaBridge 146:22da6e220af6 897 * @retval ::NRF_ERROR_FORBIDDEN If session not opened or the session is not IDLE.
AnnaBridge 146:22da6e220af6 898 * @retval ::NRF_ERROR_INVALID_ADDR If the p_request pointer is invalid.
AnnaBridge 146:22da6e220af6 899 * @retval ::NRF_ERROR_INVALID_PARAM If the parameters of p_request are not valid.
AnnaBridge 146:22da6e220af6 900 * @retval ::NRF_SUCCESS Otherwise.
AnnaBridge 146:22da6e220af6 901 */
AnnaBridge 146:22da6e220af6 902 SVCALL(SD_RADIO_REQUEST, uint32_t, sd_radio_request(nrf_radio_request_t * p_request ));
AnnaBridge 146:22da6e220af6 903
AnnaBridge 146:22da6e220af6 904 /**@} */
AnnaBridge 146:22da6e220af6 905
AnnaBridge 146:22da6e220af6 906 #ifdef __cplusplus
AnnaBridge 146:22da6e220af6 907 }
AnnaBridge 146:22da6e220af6 908 #endif
AnnaBridge 146:22da6e220af6 909 #endif // NRF_SOC_H__
AnnaBridge 146:22da6e220af6 910
AnnaBridge 146:22da6e220af6 911 /**@} */