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