/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h substitute line 894 extern } by }

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Fri Aug 15 15:28:31 2014 +0100
Revision:
88:9327015d4013
Parent:
TARGET_ARCH_BLE/TARGET_NORDIC/TARGET_NRF51822/Lib/s110_nrf51822_7_0_0/s110_nrf51822_7.0.0_API/include/nrf_soc.h@87:6213f644d804
Release 88 of the mbed library

Main changes:

- changed "error.h" to "mbed_error.h" to avoid conflicts with 3rd party code
- LPC1549 SPI driver fixes
- K64F Ethernet TX buffer reclaim mechanism fix
- STDIO initialization fix
- NUCLEO_F334R8 I2C clock fix
- various other fixes

Who changed what in which revision?

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