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