テスト用

Fork of nRF51822 by Nordic Semiconductor

Committer:
Rohit Grover
Date:
Fri Sep 26 14:46:19 2014 +0100
Revision:
69:936d81c963fe
Parent:
37:c29c330d942c
Release 0.2.1
=============

Features
~~~~~~~~

- Turn on the service-changed characteristic by default.

Bugfixes
~~~~~~~~

- Raised the maximum number of supported characteristics/descriptors to 24
(was 10 previously). We're beginning to find services like Device-
Information with several characteristics populated.

Compatibility
~~~~~~~~~~~~~

Works with 0.2.0 of BLE_API.

Who changed what in which revision?

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