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