Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sun May 14 23:18:57 2017 +0000
Revision:
18:6a4db94011d3
Publishing again

Who changed what in which revision?

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