Cefn Hoile / nRF51822

Dependencies:   nrf51-sdk

Dependents:   microbit-dal

Fork of nRF51822 by Lancaster University

Committer:
rgrover1
Date:
Wed Dec 02 10:32:53 2015 +0000
Revision:
504:2179e57ad950
Child:
551:ab7a8de3ff10
Synchronized with git rev 27c5043f
Author: Rohit Grover
Merge pull request #77 from LiyouZhou/update-to-sdk-8.1

Update to sdk 8.1

Who changed what in which revision?

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