S115 SoftDevice for nRF54LV10 API documentation 10.0.0
Loading...
Searching...
No Matches
nrf_soc.h
1/*
2 * Copyright (c) Nordic Semiconductor ASA
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this
9 * list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form, except as embedded into a Nordic
12 * Semiconductor ASA integrated circuit in a product or a software update for
13 * such product, must reproduce the above copyright notice, this list of
14 * conditions and the following disclaimer in the documentation and/or other
15 * materials provided with the distribution.
16 *
17 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * 4. This software, with or without modification, must only be used with a
22 * Nordic Semiconductor ASA integrated circuit.
23 *
24 * 5. Any software provided in binary form under this license must not be reverse
25 * engineered, decompiled, modified and/or disassembled.
26 *
27 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
28 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
30 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
33 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
36 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
38
47#ifndef NRF_SOC_H__
48#define NRF_SOC_H__
49
50#include <stdint.h>
51#include "nrf_svc.h"
52#include "nrf_error.h"
53#include "nrf_error_soc.h"
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
63#define SOC_SVC_BASE (0x20)
64#define SOC_SVC_BASE_NOT_AVAILABLE (0x2D)
67#define NRF_RADIO_NOTIFICATION_INACTIVE_GUARANTEED_TIME_US (62)
68
70#define NRF_RADIO_MINIMUM_TIMESLOT_LENGTH_EXTENSION_TIME_US (200)
71
73#define NRF_RADIO_MAX_EXTENSION_PROCESSING_TIME_US (25)
74
76#define NRF_RADIO_MIN_EXTENSION_MARGIN_US (87)
77
78#define SOC_ECB_KEY_LENGTH (16)
79#define SOC_ECB_CLEARTEXT_LENGTH (16)
80#define SOC_ECB_CIPHERTEXT_LENGTH (SOC_ECB_CLEARTEXT_LENGTH)
81#define SD_EVT_IRQn (SWI01_IRQn)
82#define SD_EVT_IRQHandler (SWI01_IRQHandler)
83#define RADIO_NOTIFICATION_IRQn (SWI02_IRQn)
84#define RADIO_NOTIFICATION_IRQHandler (SWI02_IRQHandler)
85#define SD_EVT_IRQ_PRI (6)
86#define RADIO_NOTIFICATION_IRQ_PRI (6)
87#define NRF_RADIO_LENGTH_MIN_US (100)
88#define NRF_RADIO_LENGTH_MAX_US (100000)
90#define NRF_RADIO_DISTANCE_MAX_US (256000000UL - 1UL)
92#define NRF_RADIO_EARLIEST_TIMEOUT_MAX_US (256000000UL - 1UL)
94#define NRF_RADIO_START_JITTER_US (0)
96#define SD_RAND_SEED_SIZE (32)
131
138
145
162
163
181
190
200
218
235
242
249
264
273typedef volatile uint8_t nrf_mutex_t;
274
276typedef struct
277{
278 uint8_t hfclk;
279 uint8_t priority;
280 uint32_t length_us;
281 uint32_t timeout_us;
283
285typedef struct
286{
287 uint8_t hfclk;
288 uint8_t priority;
289 uint32_t distance_us;
290 uint32_t length_us;
292
303
305typedef struct
306{
308 union
309 {
310 struct
311 {
313 } request;
314 struct
315 {
316 uint32_t length_us;
317 } extend;
318 } params;
320
333typedef nrf_radio_signal_callback_return_param_t * (*nrf_radio_signal_callback_t) (uint8_t signal_type);
334
347
356
368SVCALL(SD_MUTEX_NEW, uint32_t, sd_mutex_new(nrf_mutex_t * p_mutex));
369
377SVCALL(SD_MUTEX_ACQUIRE, uint32_t, sd_mutex_acquire(nrf_mutex_t * p_mutex));
378
385SVCALL(SD_MUTEX_RELEASE, uint32_t, sd_mutex_release(nrf_mutex_t * p_mutex));
386
399SVCALL(SD_RAND_APPLICATION_VECTOR_GET, uint32_t, sd_rand_application_vector_get(uint8_t * p_buff, uint8_t length));
400
413SVCALL(SD_RAND_SEED_SET, uint32_t, sd_rand_seed_set(uint8_t p_seed[SD_RAND_SEED_SIZE]));
414
422SVCALL(SD_POWER_MODE_SET, uint32_t, sd_power_mode_set(uint8_t power_mode));
423
433SVCALL(SD_POWER_POF_ENABLE, uint32_t, sd_power_pof_enable(uint8_t pof_enable));
434
443SVCALL(SD_POWER_POF_THRESHOLD_SET, uint32_t, sd_power_pof_threshold_set(uint8_t threshold));
444
452SVCALL(SD_POWER_GPREGRET_SET, uint32_t, sd_power_gpregret_set(uint32_t gpregret_id, uint32_t gpregret_msk));
453
461SVCALL(SD_POWER_GPREGRET_CLR, uint32_t, sd_power_gpregret_clr(uint32_t gpregret_id, uint32_t gpregret_msk));
462
470SVCALL(SD_POWER_GPREGRET_GET, uint32_t, sd_power_gpregret_get(uint32_t gpregret_id, uint32_t *p_gpregret));
471
483
494
504SVCALL(SD_CLOCK_HFCLK_IS_RUNNING, uint32_t, sd_clock_hfclk_is_running(uint32_t * p_is_running));
505
536SVCALL(SD_RADIO_NOTIFICATION_CFG_SET, uint32_t, sd_radio_notification_cfg_set(uint8_t type, uint16_t distance_us));
537
553
569SVCALL(SD_ECB_BLOCKS_ENCRYPT, uint32_t, sd_ecb_blocks_encrypt(uint8_t block_count, nrf_ecb_hal_data_block_t * p_data_blocks));
570
580SVCALL(SD_EVT_GET, uint32_t, sd_evt_get(uint32_t * p_evt_id));
581
591SVCALL(SD_TEMP_GET, uint32_t, sd_temp_get(int32_t * p_temp));
592
628SVCALL(SD_FLASH_WRITE, uint32_t, sd_flash_write(uint32_t * p_dst, uint32_t const * p_src, uint32_t size));
629
651
664
700 SVCALL(SD_RADIO_REQUEST, uint32_t, sd_radio_request(nrf_radio_request_t const * p_request));
701
704#ifdef __cplusplus
705}
706#endif
707#endif // NRF_SOC_H__
708
#define SOC_SVC_BASE
The number of the lowest SVC number reserved for the SoC library.
Definition nrf_soc.h:63
#define SOC_SVC_BASE_NOT_AVAILABLE
Definition nrf_soc.h:64
#define SOC_ECB_CLEARTEXT_LENGTH
Definition nrf_soc.h:79
#define SOC_ECB_CIPHERTEXT_LENGTH
Definition nrf_soc.h:80
#define SD_RAND_SEED_SIZE
Definition nrf_soc.h:96
#define SOC_ECB_KEY_LENGTH
Definition nrf_soc.h:78
NRF_RADIO_REQUEST_TYPE
Radio timeslot request type.
Definition nrf_soc.h:245
@ NRF_RADIO_REQ_TYPE_NORMAL
Definition nrf_soc.h:247
@ NRF_RADIO_REQ_TYPE_EARLIEST
Definition nrf_soc.h:246
NRF_RADIO_NOTIFICATION_TYPES
Radio notification types.
Definition nrf_soc.h:184
@ NRF_RADIO_NOTIFICATION_TYPE_INT_ON_ACTIVE
Definition nrf_soc.h:186
@ NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE
Definition nrf_soc.h:187
@ NRF_RADIO_NOTIFICATION_TYPE_NONE
Definition nrf_soc.h:185
@ NRF_RADIO_NOTIFICATION_TYPE_INT_ON_BOTH
Definition nrf_soc.h:188
NRF_RADIO_SIGNAL_CALLBACK_ACTION
The actions requested by the signal callback.
Definition nrf_soc.h:207
@ NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END
Definition nrf_soc.h:216
@ NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE
Definition nrf_soc.h:208
@ NRF_RADIO_SIGNAL_CALLBACK_ACTION_END
Definition nrf_soc.h:215
@ NRF_RADIO_SIGNAL_CALLBACK_ACTION_EXTEND
Definition nrf_soc.h:209
NRF_SOC_EVTS
SoC Events.
Definition nrf_soc.h:252
@ NRF_EVT_FLASH_OPERATION_SUCCESS
Definition nrf_soc.h:255
@ NRF_EVT_NUMBER_OF_EVTS
Definition nrf_soc.h:262
@ NRF_EVT_FLASH_OPERATION_ERROR
Definition nrf_soc.h:256
@ NRF_EVT_RADIO_BLOCKED
Definition nrf_soc.h:257
@ NRF_EVT_POWER_FAILURE_WARNING
Definition nrf_soc.h:254
@ NRF_EVT_RADIO_SESSION_CLOSED
Definition nrf_soc.h:260
@ NRF_EVT_HFCLKSTARTED
Definition nrf_soc.h:253
@ NRF_EVT_RADIO_SIGNAL_CALLBACK_INVALID_RETURN
Definition nrf_soc.h:258
@ NRF_EVT_RADIO_SESSION_IDLE
Definition nrf_soc.h:259
@ NRF_EVT_RAND_SEED_REQUEST
Definition nrf_soc.h:261
NRF_RADIO_CALLBACK_SIGNAL_TYPE
The Radio signal callback types.
Definition nrf_soc.h:193
@ NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0
Definition nrf_soc.h:195
@ NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_FAILED
Definition nrf_soc.h:197
@ NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO
Definition nrf_soc.h:196
@ NRF_RADIO_CALLBACK_SIGNAL_TYPE_START
Definition nrf_soc.h:194
@ NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_SUCCEEDED
Definition nrf_soc.h:198
NRF_POWER_THRESHOLDS
Power failure thresholds.
Definition nrf_soc.h:148
@ NRF_POWER_THRESHOLD_V22
Definition nrf_soc.h:154
@ NRF_POWER_THRESHOLD_V21
Definition nrf_soc.h:153
@ NRF_POWER_THRESHOLD_V26
Definition nrf_soc.h:158
@ NRF_POWER_THRESHOLD_V20
Definition nrf_soc.h:152
@ NRF_POWER_THRESHOLD_V17
Definition nrf_soc.h:149
@ NRF_POWER_THRESHOLD_V18
Definition nrf_soc.h:150
@ NRF_POWER_THRESHOLD_V24
Definition nrf_soc.h:156
@ NRF_POWER_THRESHOLD_V25
Definition nrf_soc.h:157
@ NRF_POWER_THRESHOLD_V19
Definition nrf_soc.h:151
@ NRF_POWER_THRESHOLD_V23
Definition nrf_soc.h:155
@ NRF_POWER_THRESHOLD_V27
Definition nrf_soc.h:159
@ NRF_POWER_THRESHOLD_V28
Definition nrf_soc.h:160
NRF_RADIO_PRIORITY
Radio timeslot priorities.
Definition nrf_soc.h:238
@ NRF_RADIO_PRIORITY_HIGH
Definition nrf_soc.h:239
@ NRF_RADIO_PRIORITY_NORMAL
Definition nrf_soc.h:240
NRF_RADIO_NOTIFICATION_DISTANCES
Radio notification distances.
Definition nrf_soc.h:170
@ NRF_RADIO_NOTIFICATION_DISTANCE_2680US
Definition nrf_soc.h:176
@ NRF_RADIO_NOTIFICATION_DISTANCE_420US
Definition nrf_soc.h:173
@ NRF_RADIO_NOTIFICATION_DISTANCE_3620US
Definition nrf_soc.h:177
@ NRF_RADIO_NOTIFICATION_DISTANCE_NONE
Definition nrf_soc.h:171
@ NRF_RADIO_NOTIFICATION_DISTANCE_800US
Definition nrf_soc.h:174
@ NRF_RADIO_NOTIFICATION_DISTANCE_4560US
Definition nrf_soc.h:178
@ NRF_RADIO_NOTIFICATION_DISTANCE_1740US
Definition nrf_soc.h:175
@ NRF_RADIO_NOTIFICATION_DISTANCE_5500US
Definition nrf_soc.h:179
@ NRF_RADIO_NOTIFICATION_DISTANCE_200US
Definition nrf_soc.h:172
NRF_POWER_MODES
Power modes.
Definition nrf_soc.h:141
@ NRF_POWER_MODE_LOWPWR
Definition nrf_soc.h:143
@ NRF_POWER_MODE_CONSTLAT
Definition nrf_soc.h:142
NRF_RADIO_HFCLK_CFG
Radio timeslot high frequency clock source configuration.
Definition nrf_soc.h:221
@ NRF_RADIO_HFCLK_CFG_NO_GUARANTEE
Definition nrf_soc.h:229
@ NRF_RADIO_HFCLK_CFG_XTAL_GUARANTEED
Definition nrf_soc.h:222
NRF_MUTEX_VALUES
Possible values of a nrf_mutex_t.
Definition nrf_soc.h:134
@ NRF_MUTEX_FREE
Definition nrf_soc.h:135
@ NRF_MUTEX_TAKEN
Definition nrf_soc.h:136
NRF_SOC_SVCS
The SVC numbers used by the SVC functions in the SoC library.
Definition nrf_soc.h:105
@ SD_MUTEX_RELEASE
Definition nrf_soc.h:109
@ SD_ECB_BLOCKS_ENCRYPT
Definition nrf_soc.h:122
@ SD_POWER_MODE_SET
Definition nrf_soc.h:111
@ SD_POWER_GPREGRET_SET
Definition nrf_soc.h:114
@ SD_TEMP_GET
Definition nrf_soc.h:127
@ SD_RADIO_NOTIFICATION_CFG_SET
Definition nrf_soc.h:120
@ SD_CLOCK_HFCLK_IS_RUNNING
Definition nrf_soc.h:119
@ SD_POWER_GPREGRET_CLR
Definition nrf_soc.h:115
@ SD_MUTEX_NEW
Definition nrf_soc.h:107
@ SD_RAND_APPLICATION_VECTOR_GET
Definition nrf_soc.h:110
@ SD_POWER_GPREGRET_GET
Definition nrf_soc.h:116
@ SD_FLASH_WRITE
Definition nrf_soc.h:106
@ SD_RADIO_SESSION_OPEN
Definition nrf_soc.h:123
@ SD_ECB_BLOCK_ENCRYPT
Definition nrf_soc.h:121
@ SD_RADIO_REQUEST
Definition nrf_soc.h:125
@ SD_POWER_POF_THRESHOLD_SET
Definition nrf_soc.h:113
@ SD_CLOCK_HFCLK_RELEASE
Definition nrf_soc.h:118
@ SD_CLOCK_HFCLK_REQUEST
Definition nrf_soc.h:117
@ SVC_SOC_LAST
Definition nrf_soc.h:129
@ SD_RADIO_SESSION_CLOSE
Definition nrf_soc.h:124
@ SD_POWER_POF_ENABLE
Definition nrf_soc.h:112
@ SD_MUTEX_ACQUIRE
Definition nrf_soc.h:108
@ SD_EVT_GET
Definition nrf_soc.h:126
@ SD_RAND_SEED_SET
Definition nrf_soc.h:128
uint32_t sd_power_pof_threshold_set(uint8_t threshold)
Sets the power failure comparator threshold value.
uint32_t sd_mutex_new(nrf_mutex_t *p_mutex)
Initialize a mutex.
uint32_t sd_ecb_blocks_encrypt(uint8_t block_count, nrf_ecb_hal_data_block_t *p_data_blocks)
Encrypts multiple data blocks provided as an array of data block structures.
uint32_t sd_clock_hfclk_request(void)
Request the high frequency crystal oscillator.
uint32_t sd_radio_request(nrf_radio_request_t const *p_request)
Requests a radio timeslot.
uint32_t sd_radio_session_open(nrf_radio_signal_callback_t p_radio_signal_callback)
Opens a session for radio timeslot requests.
uint32_t sd_power_gpregret_clr(uint32_t gpregret_id, uint32_t gpregret_msk)
Clear bits in the general purpose retention registers (NRF_POWER->GPREGRET*).
uint32_t sd_power_mode_set(uint8_t power_mode)
Sets the power mode when in CPU sleep.
uint32_t sd_clock_hfclk_is_running(uint32_t *p_is_running)
Checks if the high frequency crystal oscillator is running.
uint32_t sd_power_gpregret_set(uint32_t gpregret_id, uint32_t gpregret_msk)
Set bits in the general purpose retention registers (NRF_POWER->GPREGRET*).
uint32_t sd_ecb_block_encrypt(nrf_ecb_hal_data_t *p_ecb_data)
Encrypts a block according to the specified parameters.
uint32_t sd_clock_hfclk_release(void)
Releases the high frequency crystal oscillator.
uint32_t sd_rand_application_vector_get(uint8_t *p_buff, uint8_t length)
Generate NIST SP 800-90A compliant random numbers.
uint32_t sd_evt_get(uint32_t *p_evt_id)
Gets any pending events generated by the SoC API.
uint32_t sd_power_gpregret_get(uint32_t gpregret_id, uint32_t *p_gpregret)
Get contents of the general purpose retention registers (NRF_POWER->GPREGRET*).
uint32_t sd_mutex_acquire(nrf_mutex_t *p_mutex)
Attempt to acquire a mutex.
uint32_t sd_mutex_release(nrf_mutex_t *p_mutex)
Release a mutex.
uint32_t sd_radio_session_close(void)
Closes a session for radio timeslot requests.
uint32_t sd_power_pof_enable(uint8_t pof_enable)
Enables or disables the power-fail comparator.
uint32_t sd_rand_seed_set(uint8_t p_seed[(32)])
Seed the random number generator.
uint32_t sd_radio_notification_cfg_set(uint8_t type, uint16_t distance_us)
Configures the Radio Notification signal.
uint32_t sd_temp_get(int32_t *p_temp)
Get the temperature measured on the chip.
uint32_t sd_flash_write(uint32_t *p_dst, uint32_t const *p_src, uint32_t size)
Flash Write.
nrf_radio_signal_callback_return_param_t *(* nrf_radio_signal_callback_t)(uint8_t signal_type)
The radio timeslot signal callback type.
Definition nrf_soc.h:333
uint8_t soc_ecb_ciphertext_t[((16))]
Definition nrf_soc.h:338
volatile uint8_t nrf_mutex_t
Represents a mutex for use with the nrf_mutex functions.
Definition nrf_soc.h:273
uint8_t soc_ecb_cleartext_t[(16)]
Definition nrf_soc.h:337
uint8_t soc_ecb_key_t[(16)]
AES ECB parameter typedefs.
Definition nrf_soc.h:336
soc_ecb_key_t const * p_key
Definition nrf_soc.h:352
soc_ecb_cleartext_t const * p_cleartext
Definition nrf_soc.h:353
soc_ecb_ciphertext_t * p_ciphertext
Definition nrf_soc.h:354
AES ECB block. Used to provide multiple blocks in a single call to sd_ecb_blocks_encrypt.
Definition nrf_soc.h:351
soc_ecb_ciphertext_t ciphertext
Definition nrf_soc.h:345
soc_ecb_key_t key
Definition nrf_soc.h:343
soc_ecb_cleartext_t cleartext
Definition nrf_soc.h:344
AES ECB data structure.
Definition nrf_soc.h:342
uint32_t length_us
Definition nrf_soc.h:280
uint8_t hfclk
Definition nrf_soc.h:278
uint8_t priority
Definition nrf_soc.h:279
uint32_t timeout_us
Definition nrf_soc.h:281
Parameters for a request for a timeslot as early as possible.
Definition nrf_soc.h:277
uint8_t priority
Definition nrf_soc.h:288
uint8_t hfclk
Definition nrf_soc.h:287
uint32_t distance_us
Definition nrf_soc.h:289
uint32_t length_us
Definition nrf_soc.h:290
Parameters for a normal radio timeslot request.
Definition nrf_soc.h:286
nrf_radio_request_normal_t normal
Definition nrf_soc.h:300
nrf_radio_request_earliest_t earliest
Definition nrf_soc.h:299
uint8_t request_type
Definition nrf_soc.h:296
Radio timeslot request parameters.
Definition nrf_soc.h:295
nrf_radio_request_t * p_next
Definition nrf_soc.h:312
uint8_t callback_action
Definition nrf_soc.h:307
uint32_t length_us
Definition nrf_soc.h:316
Return parameters of the radio timeslot signal callback.
Definition nrf_soc.h:306