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