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