project for nrf51822 qfab

Dependencies:   eddystone_URL mbed

Fork of eddystone_URL by vo dung

Committer:
tridung141196
Date:
Thu Nov 23 15:38:48 2017 +0000
Revision:
5:267bdacf5508
Parent:
0:76dfa9657d9d
ibeacon

Who changed what in which revision?

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