meh

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon Apr 07 18:28:36 2014 +0100
Revision:
82:6473597d706e
Release 82 of the mbed library

Main changes:

- support for K64F
- Revisited Nordic code structure
- Test infrastructure improvements
- various bug fixes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 82:6473597d706e 1 /* Copyright (c) 2011 Nordic Semiconductor. All Rights Reserved.
bogdanm 82:6473597d706e 2 *
bogdanm 82:6473597d706e 3 * The information contained herein is confidential property of Nordic Semiconductor. The use,
bogdanm 82:6473597d706e 4 * copying, transfer or disclosure of such information is prohibited except by express written
bogdanm 82:6473597d706e 5 * agreement with Nordic Semiconductor.
bogdanm 82:6473597d706e 6 *
bogdanm 82:6473597d706e 7 */
bogdanm 82:6473597d706e 8
bogdanm 82:6473597d706e 9 /**
bogdanm 82:6473597d706e 10 @defgroup nrf_soc_api SoC Library API
bogdanm 82:6473597d706e 11 @{
bogdanm 82:6473597d706e 12
bogdanm 82:6473597d706e 13 @brief APIs for the SoC library.
bogdanm 82:6473597d706e 14
bogdanm 82:6473597d706e 15 */
bogdanm 82:6473597d706e 16
bogdanm 82:6473597d706e 17 #ifndef NRF_SOC_H__
bogdanm 82:6473597d706e 18 #define NRF_SOC_H__
bogdanm 82:6473597d706e 19
bogdanm 82:6473597d706e 20 #include <stdint.h>
bogdanm 82:6473597d706e 21 #include <stdbool.h>
bogdanm 82:6473597d706e 22 #include "nrf_svc.h"
bogdanm 82:6473597d706e 23 #include "nrf51.h"
bogdanm 82:6473597d706e 24 #include "nrf51_bitfields.h"
bogdanm 82:6473597d706e 25 #include "nrf_error_soc.h"
bogdanm 82:6473597d706e 26
bogdanm 82:6473597d706e 27 /** @addtogroup NRF_SOC_DEFINES Defines
bogdanm 82:6473597d706e 28 * @{ */
bogdanm 82:6473597d706e 29
bogdanm 82:6473597d706e 30 /**@brief The number of the lowest SVC number reserved for the SoC library. */
bogdanm 82:6473597d706e 31 #define SOC_SVC_BASE 0x20
bogdanm 82:6473597d706e 32
bogdanm 82:6473597d706e 33 /**@brief Guranteed time for application to process radio inactive notification. */
bogdanm 82:6473597d706e 34 #define NRF_RADIO_NOTIFICATION_INACTIVE_GUARANTEED_TIME_US (62)
bogdanm 82:6473597d706e 35
bogdanm 82:6473597d706e 36 #define SOC_ECB_KEY_LENGTH (16) /**< ECB key length. */
bogdanm 82:6473597d706e 37 #define SOC_ECB_CLEARTEXT_LENGTH (16) /**< ECB cleartext length. */
bogdanm 82:6473597d706e 38 #define SOC_ECB_CIPHERTEXT_LENGTH (SOC_ECB_CLEARTEXT_LENGTH) /**< ECB ciphertext length. */
bogdanm 82:6473597d706e 39
bogdanm 82:6473597d706e 40 #define SD_EVT_IRQn (SWI2_IRQn) /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */
bogdanm 82:6473597d706e 41 #define SD_EVT_IRQHandler (SWI2_IRQHandler) /**< SoftDevice Event IRQ handler. Used for both protocol events and SoC events. */
bogdanm 82:6473597d706e 42 #define RADIO_NOTIFICATION_IRQn (SWI1_IRQn) /**< The radio notification IRQ number. */
bogdanm 82:6473597d706e 43 #define RADIO_NOTIFICATION_IRQHandler (SWI1_IRQHandler) /**< The radio notification IRQ handler. */
bogdanm 82:6473597d706e 44
bogdanm 82:6473597d706e 45 /** @} */
bogdanm 82:6473597d706e 46
bogdanm 82:6473597d706e 47 /** @addtogroup NRF_SOC_TYPES Types
bogdanm 82:6473597d706e 48 * @{ */
bogdanm 82:6473597d706e 49
bogdanm 82:6473597d706e 50 /**@brief The SVC numbers used by the SVC functions in the SoC library. */
bogdanm 82:6473597d706e 51 enum NRF_SOC_SVCS
bogdanm 82:6473597d706e 52 {
bogdanm 82:6473597d706e 53 SD_MUTEX_NEW = SOC_SVC_BASE,
bogdanm 82:6473597d706e 54 SD_MUTEX_ACQUIRE,
bogdanm 82:6473597d706e 55 SD_MUTEX_RELEASE,
bogdanm 82:6473597d706e 56 SD_NVIC_ENABLEIRQ,
bogdanm 82:6473597d706e 57 SD_NVIC_DISABLEIRQ,
bogdanm 82:6473597d706e 58 SD_NVIC_GETPENDINGIRQ,
bogdanm 82:6473597d706e 59 SD_NVIC_SETPENDINGIRQ,
bogdanm 82:6473597d706e 60 SD_NVIC_CLEARPENDINGIRQ,
bogdanm 82:6473597d706e 61 SD_NVIC_SETPRIORITY,
bogdanm 82:6473597d706e 62 SD_NVIC_GETPRIORITY,
bogdanm 82:6473597d706e 63 SD_NVIC_SYSTEMRESET,
bogdanm 82:6473597d706e 64 SD_NVIC_CRITICAL_REGION_ENTER,
bogdanm 82:6473597d706e 65 SD_NVIC_CRITICAL_REGION_EXIT,
bogdanm 82:6473597d706e 66 SD_RAND_APPLICATION_POOL_CAPACITY,
bogdanm 82:6473597d706e 67 SD_RAND_APPLICATION_BYTES_AVAILABLE,
bogdanm 82:6473597d706e 68 SD_RAND_APPLICATION_GET_VECTOR,
bogdanm 82:6473597d706e 69 SD_POWER_MODE_SET,
bogdanm 82:6473597d706e 70 SD_POWER_SYSTEM_OFF,
bogdanm 82:6473597d706e 71 SD_POWER_RESET_REASON_GET,
bogdanm 82:6473597d706e 72 SD_POWER_RESET_REASON_CLR,
bogdanm 82:6473597d706e 73 SD_POWER_POF_ENABLE,
bogdanm 82:6473597d706e 74 SD_POWER_POF_THRESHOLD_SET,
bogdanm 82:6473597d706e 75 SD_POWER_RAMON_SET,
bogdanm 82:6473597d706e 76 SD_POWER_RAMON_CLR,
bogdanm 82:6473597d706e 77 SD_POWER_RAMON_GET,
bogdanm 82:6473597d706e 78 SD_POWER_GPREGRET_SET,
bogdanm 82:6473597d706e 79 SD_POWER_GPREGRET_CLR,
bogdanm 82:6473597d706e 80 SD_POWER_GPREGRET_GET,
bogdanm 82:6473597d706e 81 SD_POWER_DCDC_MODE_SET,
bogdanm 82:6473597d706e 82 SD_APP_EVT_WAIT,
bogdanm 82:6473597d706e 83 SD_CLOCK_HFCLK_REQUEST,
bogdanm 82:6473597d706e 84 SD_CLOCK_HFCLK_RELEASE,
bogdanm 82:6473597d706e 85 SD_CLOCK_HFCLK_IS_RUNNING,
bogdanm 82:6473597d706e 86 SD_PPI_CHANNEL_ENABLE_GET,
bogdanm 82:6473597d706e 87 SD_PPI_CHANNEL_ENABLE_SET,
bogdanm 82:6473597d706e 88 SD_PPI_CHANNEL_ENABLE_CLR,
bogdanm 82:6473597d706e 89 SD_PPI_CHANNEL_ASSIGN,
bogdanm 82:6473597d706e 90 SD_PPI_GROUP_TASK_ENABLE,
bogdanm 82:6473597d706e 91 SD_PPI_GROUP_TASK_DISABLE,
bogdanm 82:6473597d706e 92 SD_PPI_GROUP_ASSIGN,
bogdanm 82:6473597d706e 93 SD_PPI_GROUP_GET,
bogdanm 82:6473597d706e 94 SD_RADIO_NOTIFICATION_CFG_SET,
bogdanm 82:6473597d706e 95 SD_ECB_BLOCK_ENCRYPT,
bogdanm 82:6473597d706e 96 SD_RESERVED1,
bogdanm 82:6473597d706e 97 SD_RESERVED2,
bogdanm 82:6473597d706e 98 SD_RESERVED3,
bogdanm 82:6473597d706e 99 SD_EVT_GET,
bogdanm 82:6473597d706e 100 SD_TEMP_GET,
bogdanm 82:6473597d706e 101 SD_FLASH_ERASE_PAGE,
bogdanm 82:6473597d706e 102 SD_FLASH_WRITE,
bogdanm 82:6473597d706e 103 SD_FLASH_PROTECT,
bogdanm 82:6473597d706e 104 SVC_SOC_LAST
bogdanm 82:6473597d706e 105 };
bogdanm 82:6473597d706e 106
bogdanm 82:6473597d706e 107 /**@brief Possible values of a ::nrf_mutex_t. */
bogdanm 82:6473597d706e 108 enum NRF_MUTEX_VALUES
bogdanm 82:6473597d706e 109 {
bogdanm 82:6473597d706e 110 NRF_MUTEX_FREE,
bogdanm 82:6473597d706e 111 NRF_MUTEX_TAKEN
bogdanm 82:6473597d706e 112 };
bogdanm 82:6473597d706e 113
bogdanm 82:6473597d706e 114 /**@brief Possible values of ::nrf_app_irq_priority_t. */
bogdanm 82:6473597d706e 115 enum NRF_APP_PRIORITIES
bogdanm 82:6473597d706e 116 {
bogdanm 82:6473597d706e 117 NRF_APP_PRIORITY_HIGH = 1,
bogdanm 82:6473597d706e 118 NRF_APP_PRIORITY_LOW = 3
bogdanm 82:6473597d706e 119 };
bogdanm 82:6473597d706e 120
bogdanm 82:6473597d706e 121 /**@brief Possible values of ::nrf_power_mode_t. */
bogdanm 82:6473597d706e 122 enum NRF_POWER_MODES
bogdanm 82:6473597d706e 123 {
bogdanm 82:6473597d706e 124 NRF_POWER_MODE_CONSTLAT, /**< Constant latency mode. See power management in the reference manual. */
bogdanm 82:6473597d706e 125 NRF_POWER_MODE_LOWPWR /**< Low power mode. See power management in the reference manual. */
bogdanm 82:6473597d706e 126 };
bogdanm 82:6473597d706e 127
bogdanm 82:6473597d706e 128
bogdanm 82:6473597d706e 129 /**@brief Possible values of ::nrf_power_failure_threshold_t */
bogdanm 82:6473597d706e 130 enum NRF_POWER_THRESHOLDS
bogdanm 82:6473597d706e 131 {
bogdanm 82:6473597d706e 132 NRF_POWER_THRESHOLD_V21, /**< 2.1 Volts power failure threshold. */
bogdanm 82:6473597d706e 133 NRF_POWER_THRESHOLD_V23, /**< 2.3 Volts power failure threshold. */
bogdanm 82:6473597d706e 134 NRF_POWER_THRESHOLD_V25, /**< 2.5 Volts power failure threshold. */
bogdanm 82:6473597d706e 135 NRF_POWER_THRESHOLD_V27 /**< 2.7 Volts power failure threshold. */
bogdanm 82:6473597d706e 136 };
bogdanm 82:6473597d706e 137
bogdanm 82:6473597d706e 138
bogdanm 82:6473597d706e 139 /**@brief Possible values of ::nrf_power_dcdc_mode_t. */
bogdanm 82:6473597d706e 140 enum NRF_POWER_DCDC_MODES
bogdanm 82:6473597d706e 141 {
bogdanm 82:6473597d706e 142 NRF_POWER_DCDC_MODE_OFF, /**< The DCDC is always off. */
bogdanm 82:6473597d706e 143 NRF_POWER_DCDC_MODE_ON, /**< The DCDC is always on. */
bogdanm 82:6473597d706e 144 NRF_POWER_DCDC_MODE_AUTOMATIC /**< The DCDC is automatically managed. */
bogdanm 82:6473597d706e 145 };
bogdanm 82:6473597d706e 146
bogdanm 82:6473597d706e 147 /**@brief Possible values of ::nrf_radio_notification_distance_t. */
bogdanm 82:6473597d706e 148 enum NRF_RADIO_NOTIFICATION_DISTANCES
bogdanm 82:6473597d706e 149 {
bogdanm 82:6473597d706e 150 NRF_RADIO_NOTIFICATION_DISTANCE_NONE = 0, /**< The event does not have a notification. */
bogdanm 82:6473597d706e 151 NRF_RADIO_NOTIFICATION_DISTANCE_800US, /**< The distance from the active notification to start of radio activity. */
bogdanm 82:6473597d706e 152 NRF_RADIO_NOTIFICATION_DISTANCE_1740US, /**< The distance from the active notification to start of radio activity. */
bogdanm 82:6473597d706e 153 NRF_RADIO_NOTIFICATION_DISTANCE_2680US, /**< The distance from the active notification to start of radio activity. */
bogdanm 82:6473597d706e 154 NRF_RADIO_NOTIFICATION_DISTANCE_3620US, /**< The distance from the active notification to start of radio activity. */
bogdanm 82:6473597d706e 155 NRF_RADIO_NOTIFICATION_DISTANCE_4560US, /**< The distance from the active notification to start of radio activity. */
bogdanm 82:6473597d706e 156 NRF_RADIO_NOTIFICATION_DISTANCE_5500US /**< The distance from the active notification to start of radio activity. */
bogdanm 82:6473597d706e 157 };
bogdanm 82:6473597d706e 158
bogdanm 82:6473597d706e 159
bogdanm 82:6473597d706e 160 /**@brief Possible values of ::nrf_radio_notification_type_t. */
bogdanm 82:6473597d706e 161 enum NRF_RADIO_NOTIFICATION_TYPES
bogdanm 82:6473597d706e 162 {
bogdanm 82:6473597d706e 163 NRF_RADIO_NOTIFICATION_TYPE_NONE = 0, /**< The event does not have a radio notification signal. */
bogdanm 82:6473597d706e 164 NRF_RADIO_NOTIFICATION_TYPE_INT_ON_ACTIVE, /**< Using interrupt for notification when the radio will be enabled. */
bogdanm 82:6473597d706e 165 NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE, /**< Using interrupt for notification when the radio has been disabled. */
bogdanm 82:6473597d706e 166 NRF_RADIO_NOTIFICATION_TYPE_INT_ON_BOTH, /**< Using interrupt for notification both when the radio will be enabled and disabled. */
bogdanm 82:6473597d706e 167 };
bogdanm 82:6473597d706e 168
bogdanm 82:6473597d706e 169 /**@brief SoC Events. */
bogdanm 82:6473597d706e 170 enum NRF_SOC_EVTS
bogdanm 82:6473597d706e 171 {
bogdanm 82:6473597d706e 172 NRF_EVT_HFCLKSTARTED, /**< Event indicating that the HFCLK has started. */
bogdanm 82:6473597d706e 173 NRF_EVT_POWER_FAILURE_WARNING, /**< Event indicating that a power failure warning has occurred. */
bogdanm 82:6473597d706e 174 NRF_EVT_FLASH_OPERATION_SUCCESS, /**< Event indicating that the ongoing flash operation has completed successfully. */
bogdanm 82:6473597d706e 175 NRF_EVT_FLASH_OPERATION_ERROR, /**< Event indicating that the ongoing flash operation has timed out with an error. */
bogdanm 82:6473597d706e 176 NRF_EVT_RESERVED1,
bogdanm 82:6473597d706e 177 NRF_EVT_RESERVED2,
bogdanm 82:6473597d706e 178 NRF_EVT_RESERVED3,
bogdanm 82:6473597d706e 179 NRF_EVT_RESERVED4,
bogdanm 82:6473597d706e 180 NRF_EVT_RESERVED5,
bogdanm 82:6473597d706e 181 NRF_EVT_NUMBER_OF_EVTS
bogdanm 82:6473597d706e 182 };
bogdanm 82:6473597d706e 183
bogdanm 82:6473597d706e 184 /** @} */
bogdanm 82:6473597d706e 185
bogdanm 82:6473597d706e 186 /** @addtogroup NRF_SOC_TYPES Types
bogdanm 82:6473597d706e 187 * @{ */
bogdanm 82:6473597d706e 188
bogdanm 82:6473597d706e 189 /**@brief Represents a mutex for use with the nrf_mutex functions.
bogdanm 82:6473597d706e 190 * @note Accessing the value directly is not safe, use the mutex functions!
bogdanm 82:6473597d706e 191 */
bogdanm 82:6473597d706e 192 typedef volatile uint8_t nrf_mutex_t;
bogdanm 82:6473597d706e 193
bogdanm 82:6473597d706e 194 /**@brief The interrupt priorities available to the application while the softdevice is active. */
bogdanm 82:6473597d706e 195 typedef uint8_t nrf_app_irq_priority_t;
bogdanm 82:6473597d706e 196
bogdanm 82:6473597d706e 197 /**@brief Represents a power mode, used in power mode functions */
bogdanm 82:6473597d706e 198 typedef uint8_t nrf_power_mode_t;
bogdanm 82:6473597d706e 199
bogdanm 82:6473597d706e 200 /**@brief Represents a power failure threshold value. */
bogdanm 82:6473597d706e 201 typedef uint8_t nrf_power_failure_threshold_t;
bogdanm 82:6473597d706e 202
bogdanm 82:6473597d706e 203 /**@brief Represents a DCDC mode value. */
bogdanm 82:6473597d706e 204 typedef uint32_t nrf_power_dcdc_mode_t;
bogdanm 82:6473597d706e 205
bogdanm 82:6473597d706e 206 /**@brief Radio notification distances. */
bogdanm 82:6473597d706e 207 typedef uint8_t nrf_radio_notification_distance_t;
bogdanm 82:6473597d706e 208
bogdanm 82:6473597d706e 209 /**@brief Radio notification types. */
bogdanm 82:6473597d706e 210 typedef uint8_t nrf_radio_notification_type_t;
bogdanm 82:6473597d706e 211
bogdanm 82:6473597d706e 212
bogdanm 82:6473597d706e 213 /**@brief AES ECB data structure */
bogdanm 82:6473597d706e 214 typedef struct
bogdanm 82:6473597d706e 215 {
bogdanm 82:6473597d706e 216 uint8_t key[SOC_ECB_KEY_LENGTH]; /**< Encryption key. */
bogdanm 82:6473597d706e 217 uint8_t cleartext[SOC_ECB_CLEARTEXT_LENGTH]; /**< Clear Text data. */
bogdanm 82:6473597d706e 218 uint8_t ciphertext[SOC_ECB_CIPHERTEXT_LENGTH]; /**< Cipher Text data. */
bogdanm 82:6473597d706e 219 } nrf_ecb_hal_data_t;
bogdanm 82:6473597d706e 220
bogdanm 82:6473597d706e 221 /** @} */
bogdanm 82:6473597d706e 222
bogdanm 82:6473597d706e 223 /** @addtogroup NRF_SOC_FUNCTIONS Functions
bogdanm 82:6473597d706e 224 * @{ */
bogdanm 82:6473597d706e 225
bogdanm 82:6473597d706e 226 /**@brief Initialize a mutex.
bogdanm 82:6473597d706e 227 *
bogdanm 82:6473597d706e 228 * @param[in] p_mutex Pointer to the mutex to initialize.
bogdanm 82:6473597d706e 229 *
bogdanm 82:6473597d706e 230 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 231 */
bogdanm 82:6473597d706e 232 SVCALL(SD_MUTEX_NEW, uint32_t, sd_mutex_new(nrf_mutex_t * p_mutex));
bogdanm 82:6473597d706e 233
bogdanm 82:6473597d706e 234 /**@brief Attempt to acquire a mutex.
bogdanm 82:6473597d706e 235 *
bogdanm 82:6473597d706e 236 * @param[in] p_mutex Pointer to the mutex to acquire.
bogdanm 82:6473597d706e 237 *
bogdanm 82:6473597d706e 238 * @retval ::NRF_SUCCESS The mutex was successfully acquired.
bogdanm 82:6473597d706e 239 * @retval ::NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN The mutex could not be acquired.
bogdanm 82:6473597d706e 240 */
bogdanm 82:6473597d706e 241 SVCALL(SD_MUTEX_ACQUIRE, uint32_t, sd_mutex_acquire(nrf_mutex_t * p_mutex));
bogdanm 82:6473597d706e 242
bogdanm 82:6473597d706e 243 /**@brief Release a mutex.
bogdanm 82:6473597d706e 244 *
bogdanm 82:6473597d706e 245 * @param[in] p_mutex Pointer to the mutex to release.
bogdanm 82:6473597d706e 246 *
bogdanm 82:6473597d706e 247 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 248 */
bogdanm 82:6473597d706e 249 SVCALL(SD_MUTEX_RELEASE, uint32_t, sd_mutex_release(nrf_mutex_t * p_mutex));
bogdanm 82:6473597d706e 250
bogdanm 82:6473597d706e 251 /**@brief Enable External Interrupt.
bogdanm 82:6473597d706e 252 * @note Corresponds to NVIC_EnableIRQ in CMSIS.
bogdanm 82:6473597d706e 253 *
bogdanm 82:6473597d706e 254 * @pre{IRQn is valid and not reserved by the stack}
bogdanm 82:6473597d706e 255 *
bogdanm 82:6473597d706e 256 * @param[in] IRQn See the NVIC_EnableIRQ documentation in CMSIS.
bogdanm 82:6473597d706e 257 *
bogdanm 82:6473597d706e 258 * @retval ::NRF_SUCCESS The interrupt was enabled.
bogdanm 82:6473597d706e 259 * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE The interrupt is not available for the application.
bogdanm 82:6473597d706e 260 * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt has a priority not available for the application.
bogdanm 82:6473597d706e 261 */
bogdanm 82:6473597d706e 262 SVCALL(SD_NVIC_ENABLEIRQ, uint32_t, sd_nvic_EnableIRQ(IRQn_Type IRQn));
bogdanm 82:6473597d706e 263
bogdanm 82:6473597d706e 264 /**@brief Disable External Interrupt.
bogdanm 82:6473597d706e 265 * @note Corresponds to NVIC_DisableIRQ in CMSIS.
bogdanm 82:6473597d706e 266 *
bogdanm 82:6473597d706e 267 * @pre{IRQn is valid and not reserved by the stack}
bogdanm 82:6473597d706e 268 *
bogdanm 82:6473597d706e 269 * @param[in] IRQn See the NVIC_DisableIRQ documentation in CMSIS
bogdanm 82:6473597d706e 270 *
bogdanm 82:6473597d706e 271 * @retval ::NRF_SUCCESS The interrupt was disabled.
bogdanm 82:6473597d706e 272 * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE The interrupt is not available for the application.
bogdanm 82:6473597d706e 273 */
bogdanm 82:6473597d706e 274 SVCALL(SD_NVIC_DISABLEIRQ, uint32_t, sd_nvic_DisableIRQ(IRQn_Type IRQn));
bogdanm 82:6473597d706e 275
bogdanm 82:6473597d706e 276 /**@brief Get Pending Interrupt.
bogdanm 82:6473597d706e 277 * @note Corresponds to NVIC_GetPendingIRQ in CMSIS.
bogdanm 82:6473597d706e 278 *
bogdanm 82:6473597d706e 279 * @pre{IRQn is valid and not reserved by the stack}
bogdanm 82:6473597d706e 280 *
bogdanm 82:6473597d706e 281 * @param[in] IRQn See the NVIC_GetPendingIRQ documentation in CMSIS.
bogdanm 82:6473597d706e 282 * @param[out] p_pending_irq Return value from NVIC_GetPendingIRQ.
bogdanm 82:6473597d706e 283 *
bogdanm 82:6473597d706e 284 * @retval ::NRF_SUCCESS The interrupt is available for the application.
bogdanm 82:6473597d706e 285 * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application.
bogdanm 82:6473597d706e 286 */
bogdanm 82:6473597d706e 287 SVCALL(SD_NVIC_GETPENDINGIRQ, uint32_t, sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq));
bogdanm 82:6473597d706e 288
bogdanm 82:6473597d706e 289 /**@brief Set Pending Interrupt.
bogdanm 82:6473597d706e 290 * @note Corresponds to NVIC_SetPendingIRQ in CMSIS.
bogdanm 82:6473597d706e 291 *
bogdanm 82:6473597d706e 292 * @pre{IRQn is valid and not reserved by the stack}
bogdanm 82:6473597d706e 293 *
bogdanm 82:6473597d706e 294 * @param[in] IRQn See the NVIC_SetPendingIRQ documentation in CMSIS.
bogdanm 82:6473597d706e 295 *
bogdanm 82:6473597d706e 296 * @retval ::NRF_SUCCESS The interrupt is set pending.
bogdanm 82:6473597d706e 297 * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application.
bogdanm 82:6473597d706e 298 */
bogdanm 82:6473597d706e 299 SVCALL(SD_NVIC_SETPENDINGIRQ, uint32_t, sd_nvic_SetPendingIRQ(IRQn_Type IRQn));
bogdanm 82:6473597d706e 300
bogdanm 82:6473597d706e 301 /**@brief Clear Pending Interrupt.
bogdanm 82:6473597d706e 302 * @note Corresponds to NVIC_ClearPendingIRQ in CMSIS.
bogdanm 82:6473597d706e 303 *
bogdanm 82:6473597d706e 304 * @pre{IRQn is valid and not reserved by the stack}
bogdanm 82:6473597d706e 305 *
bogdanm 82:6473597d706e 306 * @param[in] IRQn See the NVIC_ClearPendingIRQ documentation in CMSIS.
bogdanm 82:6473597d706e 307 *
bogdanm 82:6473597d706e 308 * @retval ::NRF_SUCCESS The interrupt pending flag is cleared.
bogdanm 82:6473597d706e 309 * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application.
bogdanm 82:6473597d706e 310 */
bogdanm 82:6473597d706e 311 SVCALL(SD_NVIC_CLEARPENDINGIRQ, uint32_t, sd_nvic_ClearPendingIRQ(IRQn_Type IRQn));
bogdanm 82:6473597d706e 312
bogdanm 82:6473597d706e 313 /**@brief Set Interrupt Priority.
bogdanm 82:6473597d706e 314 * @note Corresponds to NVIC_SetPriority in CMSIS.
bogdanm 82:6473597d706e 315 *
bogdanm 82:6473597d706e 316 * @pre{IRQn is valid and not reserved by the stack}
bogdanm 82:6473597d706e 317 * @pre{priority is valid and not reserved by the stack}
bogdanm 82:6473597d706e 318 *
bogdanm 82:6473597d706e 319 * @param[in] IRQn See the NVIC_SetPriority documentation in CMSIS.
bogdanm 82:6473597d706e 320 * @param[in] priority A valid IRQ priority for use by the application.
bogdanm 82:6473597d706e 321 *
bogdanm 82:6473597d706e 322 * @retval ::NRF_SUCCESS The interrupt and priority level is available for the application.
bogdanm 82:6473597d706e 323 * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application.
bogdanm 82:6473597d706e 324 * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt priority is not available for the application.
bogdanm 82:6473597d706e 325 */
bogdanm 82:6473597d706e 326 SVCALL(SD_NVIC_SETPRIORITY, uint32_t, sd_nvic_SetPriority(IRQn_Type IRQn, nrf_app_irq_priority_t priority));
bogdanm 82:6473597d706e 327
bogdanm 82:6473597d706e 328 /**@brief Get Interrupt Priority.
bogdanm 82:6473597d706e 329 * @note Corresponds to NVIC_GetPriority in CMSIS.
bogdanm 82:6473597d706e 330 *
bogdanm 82:6473597d706e 331 * @pre{IRQn is valid and not reserved by the stack}
bogdanm 82:6473597d706e 332 *
bogdanm 82:6473597d706e 333 * @param[in] IRQn See the NVIC_GetPriority documentation in CMSIS.
bogdanm 82:6473597d706e 334 * @param[out] p_priority Return value from NVIC_GetPriority.
bogdanm 82:6473597d706e 335 *
bogdanm 82:6473597d706e 336 * @retval ::NRF_SUCCESS The interrupt priority is returned in p_priority.
bogdanm 82:6473597d706e 337 * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE - IRQn is not available for the application.
bogdanm 82:6473597d706e 338 */
bogdanm 82:6473597d706e 339 SVCALL(SD_NVIC_GETPRIORITY, uint32_t, sd_nvic_GetPriority(IRQn_Type IRQn, nrf_app_irq_priority_t * p_priority));
bogdanm 82:6473597d706e 340
bogdanm 82:6473597d706e 341 /**@brief System Reset.
bogdanm 82:6473597d706e 342 * @note Corresponds to NVIC_SystemReset in CMSIS.
bogdanm 82:6473597d706e 343 *
bogdanm 82:6473597d706e 344 * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN
bogdanm 82:6473597d706e 345 */
bogdanm 82:6473597d706e 346 SVCALL(SD_NVIC_SYSTEMRESET, uint32_t, sd_nvic_SystemReset(void));
bogdanm 82:6473597d706e 347
bogdanm 82:6473597d706e 348 /**@brief Enters critical region.
bogdanm 82:6473597d706e 349 *
bogdanm 82:6473597d706e 350 * @post Application interrupts will be disabled.
bogdanm 82:6473597d706e 351 * @sa sd_nvic_critical_region_exit
bogdanm 82:6473597d706e 352 *
bogdanm 82:6473597d706e 353 * @param[out] p_is_nested_critical_region 1: If in a nested critical region.
bogdanm 82:6473597d706e 354 * 0: Otherwise.
bogdanm 82:6473597d706e 355 *
bogdanm 82:6473597d706e 356 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 357 */
bogdanm 82:6473597d706e 358 SVCALL(SD_NVIC_CRITICAL_REGION_ENTER, uint32_t, sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region));
bogdanm 82:6473597d706e 359
bogdanm 82:6473597d706e 360 /**@brief Exit critical region.
bogdanm 82:6473597d706e 361 *
bogdanm 82:6473597d706e 362 * @pre Application has entered a critical region using ::sd_nvic_critical_region_enter.
bogdanm 82:6473597d706e 363 * @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 82:6473597d706e 364 *
bogdanm 82:6473597d706e 365 * @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 82:6473597d706e 366 *
bogdanm 82:6473597d706e 367 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 368 */
bogdanm 82:6473597d706e 369 SVCALL(SD_NVIC_CRITICAL_REGION_EXIT, uint32_t, sd_nvic_critical_region_exit(uint8_t is_nested_critical_region));
bogdanm 82:6473597d706e 370
bogdanm 82:6473597d706e 371 /**@brief Query the capacity of the application random pool.
bogdanm 82:6473597d706e 372 *
bogdanm 82:6473597d706e 373 * @param[out] p_pool_capacity The capacity of the pool.
bogdanm 82:6473597d706e 374 *
bogdanm 82:6473597d706e 375 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 376 */
bogdanm 82:6473597d706e 377 SVCALL(SD_RAND_APPLICATION_POOL_CAPACITY, uint32_t, sd_rand_application_pool_capacity_get(uint8_t * p_pool_capacity));
bogdanm 82:6473597d706e 378
bogdanm 82:6473597d706e 379 /**@brief Get number of random bytes available to the application.
bogdanm 82:6473597d706e 380 *
bogdanm 82:6473597d706e 381 * @param[out] p_bytes_available The number of bytes currently available in the pool.
bogdanm 82:6473597d706e 382 *
bogdanm 82:6473597d706e 383 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 384 */
bogdanm 82:6473597d706e 385 SVCALL(SD_RAND_APPLICATION_BYTES_AVAILABLE, uint32_t, sd_rand_application_bytes_available_get(uint8_t * p_bytes_available));
bogdanm 82:6473597d706e 386
bogdanm 82:6473597d706e 387 /**@brief Get random bytes from the application pool.
bogdanm 82:6473597d706e 388
bogdanm 82:6473597d706e 389 @param[out] p_buff Pointer to unit8_t buffer for storing the bytes.
bogdanm 82:6473597d706e 390 @param[in] length Number of bytes to take from pool and place in p_buff.
bogdanm 82:6473597d706e 391
bogdanm 82:6473597d706e 392 @retval ::NRF_SUCCESS The requested bytes were written to p_buff.
bogdanm 82:6473597d706e 393 @retval ::NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES No bytes were written to the buffer, because there were not enough bytes available.
bogdanm 82:6473597d706e 394 */
bogdanm 82:6473597d706e 395 SVCALL(SD_RAND_APPLICATION_GET_VECTOR, uint32_t, sd_rand_application_vector_get(uint8_t * p_buff, uint8_t length));
bogdanm 82:6473597d706e 396
bogdanm 82:6473597d706e 397 /**@brief Gets the reset reason register.
bogdanm 82:6473597d706e 398 *
bogdanm 82:6473597d706e 399 * @param[out] p_reset_reason Contents of the NRF_POWER->RESETREAS register.
bogdanm 82:6473597d706e 400 *
bogdanm 82:6473597d706e 401 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 402 */
bogdanm 82:6473597d706e 403 SVCALL(SD_POWER_RESET_REASON_GET, uint32_t, sd_power_reset_reason_get(uint32_t * p_reset_reason));
bogdanm 82:6473597d706e 404
bogdanm 82:6473597d706e 405 /**@brief Clears the bits of the reset reason register.
bogdanm 82:6473597d706e 406 *
bogdanm 82:6473597d706e 407 * @param[in] reset_reason_clr_msk Contains the bits to clear from the reset reason register.
bogdanm 82:6473597d706e 408 *
bogdanm 82:6473597d706e 409 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 410 */
bogdanm 82:6473597d706e 411 SVCALL(SD_POWER_RESET_REASON_CLR, uint32_t, sd_power_reset_reason_clr(uint32_t reset_reason_clr_msk));
bogdanm 82:6473597d706e 412
bogdanm 82:6473597d706e 413 /**@brief Sets the power mode when in CPU sleep.
bogdanm 82:6473597d706e 414 *
bogdanm 82:6473597d706e 415 * @param[in] power_mode The power mode to use when in CPU sleep. @sa sd_app_evt_wait
bogdanm 82:6473597d706e 416 *
bogdanm 82:6473597d706e 417 * @retval ::NRF_SUCCESS The power mode was set.
bogdanm 82:6473597d706e 418 * @retval ::NRF_ERROR_SOC_POWER_MODE_UNKNOWN The power mode was unknown.
bogdanm 82:6473597d706e 419 */
bogdanm 82:6473597d706e 420 SVCALL(SD_POWER_MODE_SET, uint32_t, sd_power_mode_set(nrf_power_mode_t power_mode));
bogdanm 82:6473597d706e 421
bogdanm 82:6473597d706e 422 /**@brief Puts the chip in System OFF mode.
bogdanm 82:6473597d706e 423 *
bogdanm 82:6473597d706e 424 * @retval ::NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN
bogdanm 82:6473597d706e 425 */
bogdanm 82:6473597d706e 426 SVCALL(SD_POWER_SYSTEM_OFF, uint32_t, sd_power_system_off(void));
bogdanm 82:6473597d706e 427
bogdanm 82:6473597d706e 428 /**@brief Enables or disables the power-fail comparator.
bogdanm 82:6473597d706e 429 *
bogdanm 82:6473597d706e 430 * Enabling this will give a softdevice event (NRF_EVT_POWER_FAILURE_WARNING) when the power failure warning occurs.
bogdanm 82:6473597d706e 431 * The event can be retrieved with sd_evt_get();
bogdanm 82:6473597d706e 432 *
bogdanm 82:6473597d706e 433 * @param[in] pof_enable True if the power-fail comparator should be enabled, false if it should be disabled.
bogdanm 82:6473597d706e 434 *
bogdanm 82:6473597d706e 435 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 436 */
bogdanm 82:6473597d706e 437 SVCALL(SD_POWER_POF_ENABLE, uint32_t, sd_power_pof_enable(uint8_t pof_enable));
bogdanm 82:6473597d706e 438
bogdanm 82:6473597d706e 439 /**@brief Sets the power-fail threshold value.
bogdanm 82:6473597d706e 440 *
bogdanm 82:6473597d706e 441 * @param[in] threshold The power-fail threshold value to use.
bogdanm 82:6473597d706e 442 *
bogdanm 82:6473597d706e 443 * @retval ::NRF_SUCCESS The power failure threshold was set.
bogdanm 82:6473597d706e 444 * @retval ::NRF_ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN The power failure threshold is unknown.
bogdanm 82:6473597d706e 445 */
bogdanm 82:6473597d706e 446 SVCALL(SD_POWER_POF_THRESHOLD_SET, uint32_t, sd_power_pof_threshold_set(nrf_power_failure_threshold_t threshold));
bogdanm 82:6473597d706e 447
bogdanm 82:6473597d706e 448 /**@brief Sets bits in the NRF_POWER->RAMON register.
bogdanm 82:6473597d706e 449 *
bogdanm 82:6473597d706e 450 * @param[in] ramon Contains the bits needed to be set in the NRF_POWER->RAMON register.
bogdanm 82:6473597d706e 451 *
bogdanm 82:6473597d706e 452 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 453 */
bogdanm 82:6473597d706e 454 SVCALL(SD_POWER_RAMON_SET, uint32_t, sd_power_ramon_set(uint32_t ramon));
bogdanm 82:6473597d706e 455
bogdanm 82:6473597d706e 456 /** @brief Clears bits in the NRF_POWER->RAMON register.
bogdanm 82:6473597d706e 457 *
bogdanm 82:6473597d706e 458 * @param ramon Contains the bits needed to be cleared in the NRF_POWER->RAMON register.
bogdanm 82:6473597d706e 459 *
bogdanm 82:6473597d706e 460 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 461 */
bogdanm 82:6473597d706e 462 SVCALL(SD_POWER_RAMON_CLR, uint32_t, sd_power_ramon_clr(uint32_t ramon));
bogdanm 82:6473597d706e 463
bogdanm 82:6473597d706e 464 /**@brief Get contents of NRF_POWER->RAMON register, indicates power status of ram blocks.
bogdanm 82:6473597d706e 465 *
bogdanm 82:6473597d706e 466 * @param[out] p_ramon Content of NRF_POWER->RAMON register.
bogdanm 82:6473597d706e 467 *
bogdanm 82:6473597d706e 468 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 469 */
bogdanm 82:6473597d706e 470 SVCALL(SD_POWER_RAMON_GET, uint32_t, sd_power_ramon_get(uint32_t * p_ramon));
bogdanm 82:6473597d706e 471
bogdanm 82:6473597d706e 472 /**@brief Set bits in the NRF_POWER->GPREGRET register.
bogdanm 82:6473597d706e 473 *
bogdanm 82:6473597d706e 474 * @param[in] gpregret_msk Bits to be set in the GPREGRET register.
bogdanm 82:6473597d706e 475 *
bogdanm 82:6473597d706e 476 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 477 */
bogdanm 82:6473597d706e 478 SVCALL(SD_POWER_GPREGRET_SET, uint32_t, sd_power_gpregret_set(uint32_t gpregret_msk));
bogdanm 82:6473597d706e 479
bogdanm 82:6473597d706e 480 /**@brief Clear bits in the NRF_POWER->GPREGRET register.
bogdanm 82:6473597d706e 481 *
bogdanm 82:6473597d706e 482 * @param[in] gpregret_msk Bits to be clear in the GPREGRET register.
bogdanm 82:6473597d706e 483 *
bogdanm 82:6473597d706e 484 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 485 */
bogdanm 82:6473597d706e 486 SVCALL(SD_POWER_GPREGRET_CLR, uint32_t, sd_power_gpregret_clr(uint32_t gpregret_msk));
bogdanm 82:6473597d706e 487
bogdanm 82:6473597d706e 488 /**@brief Get contents of the NRF_POWER->GPREGRET register.
bogdanm 82:6473597d706e 489 *
bogdanm 82:6473597d706e 490 * @param[out] p_gpregret Contents of the GPREGRET register.
bogdanm 82:6473597d706e 491 *
bogdanm 82:6473597d706e 492 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 493 */
bogdanm 82:6473597d706e 494 SVCALL(SD_POWER_GPREGRET_GET, uint32_t, sd_power_gpregret_get(uint32_t *p_gpregret));
bogdanm 82:6473597d706e 495
bogdanm 82:6473597d706e 496 /**@brief Sets the DCDC mode.
bogdanm 82:6473597d706e 497 *
bogdanm 82:6473597d706e 498 * Depending on the internal state of the SoftDevice, the mode change may not happen immediately.
bogdanm 82:6473597d706e 499 * The DCDC mode switch will be blocked when occurring in close proximity to radio transmissions. When
bogdanm 82:6473597d706e 500 * the radio transmission is done, the last mode will be used.
bogdanm 82:6473597d706e 501 *
bogdanm 82:6473597d706e 502 * @param[in] dcdc_mode The mode of the DCDC.
bogdanm 82:6473597d706e 503 *
bogdanm 82:6473597d706e 504 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 505 * @retval ::NRF_ERROR_INVALID_PARAM The DCDC mode is invalid.
bogdanm 82:6473597d706e 506 */
bogdanm 82:6473597d706e 507 SVCALL(SD_POWER_DCDC_MODE_SET, uint32_t, sd_power_dcdc_mode_set(nrf_power_dcdc_mode_t dcdc_mode));
bogdanm 82:6473597d706e 508
bogdanm 82:6473597d706e 509 /**@brief Request the high frequency crystal oscillator.
bogdanm 82:6473597d706e 510 *
bogdanm 82:6473597d706e 511 * Will start the high frequency crystal oscillator, the startup time of the crystal varies
bogdanm 82:6473597d706e 512 * and the ::sd_clock_hfclk_is_running function can be polled to check if it has started.
bogdanm 82:6473597d706e 513 *
bogdanm 82:6473597d706e 514 * @see sd_clock_hfclk_is_running
bogdanm 82:6473597d706e 515 * @see sd_clock_hfclk_release
bogdanm 82:6473597d706e 516 *
bogdanm 82:6473597d706e 517 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 518 */
bogdanm 82:6473597d706e 519 SVCALL(SD_CLOCK_HFCLK_REQUEST, uint32_t, sd_clock_hfclk_request(void));
bogdanm 82:6473597d706e 520
bogdanm 82:6473597d706e 521 /**@brief Releases the high frequency crystal oscillator.
bogdanm 82:6473597d706e 522 *
bogdanm 82:6473597d706e 523 * Will stop the high frequency crystal oscillator, this happens immediately.
bogdanm 82:6473597d706e 524 *
bogdanm 82:6473597d706e 525 * @see sd_clock_hfclk_is_running
bogdanm 82:6473597d706e 526 * @see sd_clock_hfclk_request
bogdanm 82:6473597d706e 527 *
bogdanm 82:6473597d706e 528 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 529 */
bogdanm 82:6473597d706e 530 SVCALL(SD_CLOCK_HFCLK_RELEASE, uint32_t, sd_clock_hfclk_release(void));
bogdanm 82:6473597d706e 531
bogdanm 82:6473597d706e 532 /**@brief Checks if the high frequency crystal oscillator is running.
bogdanm 82:6473597d706e 533 *
bogdanm 82:6473597d706e 534 * @see sd_clock_hfclk_request
bogdanm 82:6473597d706e 535 * @see sd_clock_hfclk_release
bogdanm 82:6473597d706e 536 *
bogdanm 82:6473597d706e 537 * @param[out] p_is_running 1 if the external crystal oscillator is running, 0 if not.
bogdanm 82:6473597d706e 538 *
bogdanm 82:6473597d706e 539 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 540 */
bogdanm 82:6473597d706e 541 SVCALL(SD_CLOCK_HFCLK_IS_RUNNING, uint32_t, sd_clock_hfclk_is_running(uint32_t * p_is_running));
bogdanm 82:6473597d706e 542
bogdanm 82:6473597d706e 543 /**@brief Waits for an application event.
bogdanm 82:6473597d706e 544 *
bogdanm 82:6473597d706e 545 * An application event is either an application interrupt or a pended interrupt when the
bogdanm 82:6473597d706e 546 * interrupt is disabled. When the interrupt is enabled it will be taken immediately since
bogdanm 82:6473597d706e 547 * this function will wait in thread mode, then the execution will return in the application's
bogdanm 82:6473597d706e 548 * main thread. When an interrupt is disabled and gets pended it will return to the application's
bogdanm 82:6473597d706e 549 * thread main. The application must ensure that the pended flag is cleared using
bogdanm 82:6473597d706e 550 * ::sd_nvic_ClearPendingIRQ in order to sleep using this function. This is only necessary for
bogdanm 82:6473597d706e 551 * disabled interrupts, as the interrupt handler will clear the pending flag automatically for
bogdanm 82:6473597d706e 552 * enabled interrupts.
bogdanm 82:6473597d706e 553 *
bogdanm 82:6473597d706e 554 * In order to wake up from disabled interrupts, the SEVONPEND flag has to be set in the Cortex-M0
bogdanm 82:6473597d706e 555 * System Control Register (SCR). @sa CMSIS_SCB
bogdanm 82:6473597d706e 556 *
bogdanm 82:6473597d706e 557 * @note If an application interrupt has happened since the last time sd_app_evt_wait was
bogdanm 82:6473597d706e 558 * called this function will return immediately and not go to sleep. This is to avoid race
bogdanm 82:6473597d706e 559 * conditions that can occur when a flag is updated in the interrupt handler and processed
bogdanm 82:6473597d706e 560 * in the main loop.
bogdanm 82:6473597d706e 561 *
bogdanm 82:6473597d706e 562 * @post An application interrupt has happened or a interrupt pending flag is set.
bogdanm 82:6473597d706e 563 *
bogdanm 82:6473597d706e 564 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 565 */
bogdanm 82:6473597d706e 566 SVCALL(SD_APP_EVT_WAIT, uint32_t, sd_app_evt_wait(void));
bogdanm 82:6473597d706e 567
bogdanm 82:6473597d706e 568 /**@brief Get PPI channel enable register contents.
bogdanm 82:6473597d706e 569 *
bogdanm 82:6473597d706e 570 * @param[out] p_channel_enable The contents of the PPI CHEN register.
bogdanm 82:6473597d706e 571 *
bogdanm 82:6473597d706e 572 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 573 */
bogdanm 82:6473597d706e 574 SVCALL(SD_PPI_CHANNEL_ENABLE_GET, uint32_t, sd_ppi_channel_enable_get(uint32_t * p_channel_enable));
bogdanm 82:6473597d706e 575
bogdanm 82:6473597d706e 576 /**@brief Set PPI channel enable register.
bogdanm 82:6473597d706e 577 *
bogdanm 82:6473597d706e 578 * @param[in] channel_enable_set_msk Mask containing the bits to set in the PPI CHEN register.
bogdanm 82:6473597d706e 579 *
bogdanm 82:6473597d706e 580 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 581 */
bogdanm 82:6473597d706e 582 SVCALL(SD_PPI_CHANNEL_ENABLE_SET, uint32_t, sd_ppi_channel_enable_set(uint32_t channel_enable_set_msk));
bogdanm 82:6473597d706e 583
bogdanm 82:6473597d706e 584 /**@brief Clear PPI channel enable register.
bogdanm 82:6473597d706e 585 *
bogdanm 82:6473597d706e 586 * @param[in] channel_enable_clr_msk Mask containing the bits to clear in the PPI CHEN register.
bogdanm 82:6473597d706e 587 *
bogdanm 82:6473597d706e 588 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 589 */
bogdanm 82:6473597d706e 590 SVCALL(SD_PPI_CHANNEL_ENABLE_CLR, uint32_t, sd_ppi_channel_enable_clr(uint32_t channel_enable_clr_msk));
bogdanm 82:6473597d706e 591
bogdanm 82:6473597d706e 592 /**@brief Assign endpoints to a PPI channel.
bogdanm 82:6473597d706e 593 *
bogdanm 82:6473597d706e 594 * @param[in] channel_num Number of the PPI channel to assign.
bogdanm 82:6473597d706e 595 * @param[in] evt_endpoint Event endpoint of the PPI channel.
bogdanm 82:6473597d706e 596 * @param[in] task_endpoint Task endpoint of the PPI channel.
bogdanm 82:6473597d706e 597 *
bogdanm 82:6473597d706e 598 * @retval ::NRF_ERROR_SOC_PPI_INVALID_CHANNEL The channel number is invalid.
bogdanm 82:6473597d706e 599 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 600 */
bogdanm 82:6473597d706e 601 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 82:6473597d706e 602
bogdanm 82:6473597d706e 603 /**@brief Task to enable a channel group.
bogdanm 82:6473597d706e 604 *
bogdanm 82:6473597d706e 605 * @param[in] group_num Number of the channel group.
bogdanm 82:6473597d706e 606 *
bogdanm 82:6473597d706e 607 * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid
bogdanm 82:6473597d706e 608 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 609 */
bogdanm 82:6473597d706e 610 SVCALL(SD_PPI_GROUP_TASK_ENABLE, uint32_t, sd_ppi_group_task_enable(uint8_t group_num));
bogdanm 82:6473597d706e 611
bogdanm 82:6473597d706e 612 /**@brief Task to disable a channel group.
bogdanm 82:6473597d706e 613 *
bogdanm 82:6473597d706e 614 * @param[in] group_num Number of the PPI group.
bogdanm 82:6473597d706e 615 *
bogdanm 82:6473597d706e 616 * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid.
bogdanm 82:6473597d706e 617 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 618 */
bogdanm 82:6473597d706e 619 SVCALL(SD_PPI_GROUP_TASK_DISABLE, uint32_t, sd_ppi_group_task_disable(uint8_t group_num));
bogdanm 82:6473597d706e 620
bogdanm 82:6473597d706e 621 /**@brief Assign PPI channels to a channel group.
bogdanm 82:6473597d706e 622 *
bogdanm 82:6473597d706e 623 * @param[in] group_num Number of the channel group.
bogdanm 82:6473597d706e 624 * @param[in] channel_msk Mask of the channels to assign to the group.
bogdanm 82:6473597d706e 625 *
bogdanm 82:6473597d706e 626 * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid.
bogdanm 82:6473597d706e 627 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 628 */
bogdanm 82:6473597d706e 629 SVCALL(SD_PPI_GROUP_ASSIGN, uint32_t, sd_ppi_group_assign(uint8_t group_num, uint32_t channel_msk));
bogdanm 82:6473597d706e 630
bogdanm 82:6473597d706e 631 /**@brief Gets the PPI channels of a channel group.
bogdanm 82:6473597d706e 632 *
bogdanm 82:6473597d706e 633 * @param[in] group_num Number of the channel group.
bogdanm 82:6473597d706e 634 * @param[out] p_channel_msk Mask of the channels assigned to the group.
bogdanm 82:6473597d706e 635 *
bogdanm 82:6473597d706e 636 * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid.
bogdanm 82:6473597d706e 637 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 638 */
bogdanm 82:6473597d706e 639 SVCALL(SD_PPI_GROUP_GET, uint32_t, sd_ppi_group_get(uint8_t group_num, uint32_t * p_channel_msk));
bogdanm 82:6473597d706e 640
bogdanm 82:6473597d706e 641 /**@brief Configures the Radio Notification signal.
bogdanm 82:6473597d706e 642 *
bogdanm 82:6473597d706e 643 * @note
bogdanm 82:6473597d706e 644 * - The notification signal latency depends on the interrupt priority settings of SWI used
bogdanm 82:6473597d706e 645 * for notification signal.
bogdanm 82:6473597d706e 646 * - In the period between the ACTIVE signal and the start of the Radio Event, the SoftDevice
bogdanm 82:6473597d706e 647 * will interrupt the application to do Radio Event preparation.
bogdanm 82:6473597d706e 648 * - Using the Radio Notification feature may limit the bandwidth, as the SoftDevice may have
bogdanm 82:6473597d706e 649 * to shorten the connection events to have time for the Radio Notification signals.
bogdanm 82:6473597d706e 650 *
bogdanm 82:6473597d706e 651 * @param[in] type Type of notification signal.
bogdanm 82:6473597d706e 652 * @ref NRF_RADIO_NOTIFICATION_TYPE_NONE shall be used to turn off radio
bogdanm 82:6473597d706e 653 * notification. Using @ref NRF_RADIO_NOTIFICATION_DISTANCE_NONE is
bogdanm 82:6473597d706e 654 * recommended (but not required) to be used with
bogdanm 82:6473597d706e 655 * @ref NRF_RADIO_NOTIFICATION_TYPE_NONE.
bogdanm 82:6473597d706e 656 *
bogdanm 82:6473597d706e 657 * @param[in] distance Distance between the notification signal and start of radio activity.
bogdanm 82:6473597d706e 658 * This parameter is ignored when @ref NRF_RADIO_NOTIFICATION_TYPE_NONE or
bogdanm 82:6473597d706e 659 * @ref NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE is used.
bogdanm 82:6473597d706e 660 *
bogdanm 82:6473597d706e 661 * @retval ::NRF_ERROR_INVALID_PARAM The group number is invalid.
bogdanm 82:6473597d706e 662 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 663 */
bogdanm 82:6473597d706e 664 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 82:6473597d706e 665
bogdanm 82:6473597d706e 666 /**@brief Encrypts a block according to the specified parameters.
bogdanm 82:6473597d706e 667 *
bogdanm 82:6473597d706e 668 * 128-bit AES encryption.
bogdanm 82:6473597d706e 669 *
bogdanm 82:6473597d706e 670 * @param[in, out] p_ecb_data Pointer to the ECB parameters' struct (two input
bogdanm 82:6473597d706e 671 * parameters and one output parameter).
bogdanm 82:6473597d706e 672 *
bogdanm 82:6473597d706e 673 * @retval ::NRF_SUCCESS
bogdanm 82:6473597d706e 674 */
bogdanm 82:6473597d706e 675 SVCALL(SD_ECB_BLOCK_ENCRYPT, uint32_t, sd_ecb_block_encrypt(nrf_ecb_hal_data_t * p_ecb_data));
bogdanm 82:6473597d706e 676
bogdanm 82:6473597d706e 677 /**@brief Gets any pending events generated by the SoC API.
bogdanm 82:6473597d706e 678 *
bogdanm 82:6473597d706e 679 * The application should keep calling this function to get events, until ::NRF_ERROR_NOT_FOUND is returned.
bogdanm 82:6473597d706e 680 *
bogdanm 82:6473597d706e 681 * @param[out] p_evt_id Set to one of the values in @ref NRF_SOC_EVTS, if any events are pending.
bogdanm 82:6473597d706e 682 *
bogdanm 82:6473597d706e 683 * @retval ::NRF_SUCCESS An event was pending. The event id is written in the p_evt_id parameter.
bogdanm 82:6473597d706e 684 * @retval ::NRF_ERROR_NOT_FOUND No pending events.
bogdanm 82:6473597d706e 685 */
bogdanm 82:6473597d706e 686 SVCALL(SD_EVT_GET, uint32_t, sd_evt_get(uint32_t * p_evt_id));
bogdanm 82:6473597d706e 687
bogdanm 82:6473597d706e 688 /**@brief Get the temperature measured on the chip
bogdanm 82:6473597d706e 689 *
bogdanm 82:6473597d706e 690 * This function will block until the temperature measurement is done.
bogdanm 82:6473597d706e 691 * It takes around 50us from call to return.
bogdanm 82:6473597d706e 692 *
bogdanm 82:6473597d706e 693 * @note Pan #28 in PAN-028 v 1.6 "Negative measured values are not represented correctly" is corrected by this function.
bogdanm 82:6473597d706e 694 *
bogdanm 82:6473597d706e 695 * @param[out] p_temp Result of temperature measurement. Die temperature in 0.25 degrees celsius.
bogdanm 82:6473597d706e 696 *
bogdanm 82:6473597d706e 697 * @retval ::NRF_SUCCESS A temperature measurement was done, and the temperature was written to temp
bogdanm 82:6473597d706e 698 */
bogdanm 82:6473597d706e 699 SVCALL(SD_TEMP_GET, uint32_t, sd_temp_get(int32_t * p_temp));
bogdanm 82:6473597d706e 700
bogdanm 82:6473597d706e 701 /**@brief Flash Write
bogdanm 82:6473597d706e 702 *
bogdanm 82:6473597d706e 703 * Commands to write a buffer to flash
bogdanm 82:6473597d706e 704 *
bogdanm 82:6473597d706e 705 * This call initiates the flash access command, and its completion will be communicated to the
bogdanm 82:6473597d706e 706 * application with exactly one of the following events:
bogdanm 82:6473597d706e 707 * - NRF_EVT_FLASH_OPERATION_SUCCESS - The command was successfully completed.
bogdanm 82:6473597d706e 708 * - NRF_EVT_FLASH_OPERATION_ERROR - The command could not be started.
bogdanm 82:6473597d706e 709 *
bogdanm 82:6473597d706e 710 * @note
bogdanm 82:6473597d706e 711 * - This call takes control over the radio and the CPU during flash erase and write to make sure that
bogdanm 82:6473597d706e 712 * they will not interfere with the flash access. This means that all interrupts will be blocked
bogdanm 82:6473597d706e 713 * for a predictable time (depending on the NVMC specification in nRF51 Series Reference Manual
bogdanm 82:6473597d706e 714 * and the command parameters).
bogdanm 82:6473597d706e 715 *
bogdanm 82:6473597d706e 716 *
bogdanm 82:6473597d706e 717 * @param[in] p_dst Pointer to start of flash location to be written.
bogdanm 82:6473597d706e 718 * @param[in] p_src Pointer to buffer with data to be written
bogdanm 82:6473597d706e 719 * @param[in] size Number of 32-bit words to write. Maximum size is 256 32bit words.
bogdanm 82:6473597d706e 720 *
bogdanm 82:6473597d706e 721 * @retval ::NRF_ERROR_INVALID_ADDR Tried to write to a non existing flash address, or p_dst or p_src was unaligned.
bogdanm 82:6473597d706e 722 * @retval ::NRF_ERROR_BUSY The previous command has not yet completed.
bogdanm 82:6473597d706e 723 * @retval ::NRF_ERROR_INVALID_LENGTH Size was 0, or more than 256 words.
bogdanm 82:6473597d706e 724 * @retval ::NRF_ERROR_FORBIDDEN Tried to write to or read from protected location.
bogdanm 82:6473597d706e 725 * @retval ::NRF_SUCCESS The command was accepted.
bogdanm 82:6473597d706e 726 */
bogdanm 82:6473597d706e 727 SVCALL(SD_FLASH_WRITE, uint32_t, sd_flash_write(uint32_t * const p_dst, uint32_t const * const p_src, uint32_t size));
bogdanm 82:6473597d706e 728
bogdanm 82:6473597d706e 729
bogdanm 82:6473597d706e 730 /**@brief Flash Erase page
bogdanm 82:6473597d706e 731 *
bogdanm 82:6473597d706e 732 * Commands to erase a flash page
bogdanm 82:6473597d706e 733 *
bogdanm 82:6473597d706e 734 * This call initiates the flash access command, and its completion will be communicated to the
bogdanm 82:6473597d706e 735 * application with exactly one of the following events:
bogdanm 82:6473597d706e 736 * - NRF_EVT_FLASH_OPERATION_SUCCESS - The command was successfully completed.
bogdanm 82:6473597d706e 737 * - NRF_EVT_FLASH_OPERATION_ERROR - The command could not be started.
bogdanm 82:6473597d706e 738 *
bogdanm 82:6473597d706e 739 * @note
bogdanm 82:6473597d706e 740 * - This call takes control over the radio and the CPU during flash erase and write to make sure that
bogdanm 82:6473597d706e 741 * they will not interfere with the flash access. This means that all interrupts will be blocked
bogdanm 82:6473597d706e 742 * for a predictable time (depending on the NVMC specification in nRF51 Series Reference Manual
bogdanm 82:6473597d706e 743 * and the command parameters).
bogdanm 82:6473597d706e 744 *
bogdanm 82:6473597d706e 745 *
bogdanm 82:6473597d706e 746 * @param[in] page_number Pagenumber of the page to erase
bogdanm 82:6473597d706e 747 * @retval ::NRF_ERROR_INTERNAL If a new session could not be opened due to an internal error.
bogdanm 82:6473597d706e 748 * @retval ::NRF_ERROR_INVALID_ADDR Tried to erase to a non existing flash page.
bogdanm 82:6473597d706e 749 * @retval ::NRF_ERROR_BUSY The previous command has not yet completed.
bogdanm 82:6473597d706e 750 * @retval ::NRF_ERROR_FORBIDDEN Tried to erase a protected page.
bogdanm 82:6473597d706e 751 * @retval ::NRF_SUCCESS The command was accepted.
bogdanm 82:6473597d706e 752 */
bogdanm 82:6473597d706e 753 SVCALL(SD_FLASH_ERASE_PAGE, uint32_t, sd_flash_page_erase(uint32_t page_number));
bogdanm 82:6473597d706e 754
bogdanm 82:6473597d706e 755
bogdanm 82:6473597d706e 756 /**@brief Flash Protection set
bogdanm 82:6473597d706e 757 *
bogdanm 82:6473597d706e 758 * Commands to set the flash protection registers PROTENSETx
bogdanm 82:6473597d706e 759 *
bogdanm 82:6473597d706e 760 * @note To read the values in PROTENSETx you can read them directly. They are only write-protected.
bogdanm 82:6473597d706e 761 *
bogdanm 82:6473597d706e 762 * @param[in] protenset0 Value to be written to PROTENSET0
bogdanm 82:6473597d706e 763 * @param[in] protenset1 Value to be written to PROTENSET1
bogdanm 82:6473597d706e 764 *
bogdanm 82:6473597d706e 765 * @retval ::NRF_ERROR_FORBIDDEN Tried to protect the SoftDevice
bogdanm 82:6473597d706e 766 * @retval ::NRF_SUCCESS Values successfully written to PROTENSETx
bogdanm 82:6473597d706e 767 */
bogdanm 82:6473597d706e 768 SVCALL(SD_FLASH_PROTECT, uint32_t, sd_flash_protect(uint32_t protenset0, uint32_t protenset1));
bogdanm 82:6473597d706e 769
bogdanm 82:6473597d706e 770
bogdanm 82:6473597d706e 771 /** @} */
bogdanm 82:6473597d706e 772
bogdanm 82:6473597d706e 773 #endif // NRF_SOC_H__
bogdanm 82:6473597d706e 774
bogdanm 82:6473597d706e 775 /**
bogdanm 82:6473597d706e 776 @}
bogdanm 82:6473597d706e 777 */