1 /*
2 * Copyright (c) 2018 - 2025, Nordic Semiconductor ASA
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * 3. Neither the name of the copyright holder 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 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #ifndef NRF_RADIO_H__
35 #define NRF_RADIO_H__
36
37 #include <nrfx.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /**
44 * @defgroup nrf_radio_hal RADIO HAL
45 * @{
46 * @ingroup nrf_radio
47 * @brief Hardware access layer for managing the RADIO peripheral.
48 */
49
50 #if defined(DPPI_PRESENT) || defined(__NRFX_DOXYGEN__)
51 /** @brief Symbol specifying offset between address of TASK/EVENT register and address of associated SUBSCRIBE/PUBLISH register. */
52 #define NRF_RADIO_DPPI_OFFSET NRF_SUBSCRIBE_PUBLISH_OFFSET_RADIO
53 #endif // defined(DPPI_PRESENT) || defined(__NRFX_DOXYGEN__)
54
55 #if defined(RADIO_DATAWHITE_POLY_Msk) || defined(__NRFX_DOXYGEN__)
56 /** @brief Symbol indicating whether data whitening configuration register is present. **/
57 #define NRF_RADIO_HAS_DATAWHITE 1
58 #else
59 #define NRF_RADIO_HAS_DATAWHITE 0
60 #endif
61
62 /** @brief RADIO tasks. */
63 typedef enum
64 {
65 NRF_RADIO_TASK_TXEN = offsetof(NRF_RADIO_Type, TASKS_TXEN), /**< Enable RADIO in TX mode. */
66 NRF_RADIO_TASK_RXEN = offsetof(NRF_RADIO_Type, TASKS_RXEN), /**< Enable RADIO in RX mode. */
67 NRF_RADIO_TASK_START = offsetof(NRF_RADIO_Type, TASKS_START), /**< Start RADIO. */
68 NRF_RADIO_TASK_STOP = offsetof(NRF_RADIO_Type, TASKS_STOP), /**< Stop RADIO. */
69 NRF_RADIO_TASK_DISABLE = offsetof(NRF_RADIO_Type, TASKS_DISABLE), /**< Disable RADIO. */
70 NRF_RADIO_TASK_RSSISTART = offsetof(NRF_RADIO_Type, TASKS_RSSISTART), /**< Start the RSSI and take one single sample of the receive signal strength. */
71 #if defined(RADIO_TASKS_RSSISTOP_TASKS_RSSISTOP_Msk) || \
72 defined(RADIO_SHORTS_DISABLED_RSSISTOP_Msk) || \
73 defined(__NRFX_DOXYGEN__)
74 NRF_RADIO_TASK_RSSISTOP = offsetof(NRF_RADIO_Type, TASKS_RSSISTOP), /**< Stop the RSSI measurement. */
75 #endif
76 NRF_RADIO_TASK_BCSTART = offsetof(NRF_RADIO_Type, TASKS_BCSTART), /**< Start the bit counter. */
77 NRF_RADIO_TASK_BCSTOP = offsetof(NRF_RADIO_Type, TASKS_BCSTOP), /**< Stop the bit counter. */
78 #if defined(RADIO_TASKS_EDSTART_TASKS_EDSTART_Msk) || defined(__NRFX_DOXYGEN__)
79 NRF_RADIO_TASK_EDSTART = offsetof(NRF_RADIO_Type, TASKS_EDSTART), /**< Start the Energy Detect measurement used in IEEE 802.15.4 mode. */
80 #endif
81 #if defined(RADIO_TASKS_EDSTOP_TASKS_EDSTOP_Msk) || defined(__NRFX_DOXYGEN__)
82 NRF_RADIO_TASK_EDSTOP = offsetof(NRF_RADIO_Type, TASKS_EDSTOP), /**< Stop the Energy Detect measurement. */
83 #endif
84 #if defined(RADIO_TASKS_CCASTART_TASKS_CCASTART_Msk) || defined(__NRFX_DOXYGEN__)
85 NRF_RADIO_TASK_CCASTART = offsetof(NRF_RADIO_Type, TASKS_CCASTART), /**< Start the Clear Channel Assessment used in IEEE 802.15.4 mode. */
86 #endif
87 #if defined(RADIO_TASKS_CCASTOP_TASKS_CCASTOP_Msk) || defined(__NRFX_DOXYGEN__)
88 NRF_RADIO_TASK_CCASTOP = offsetof(NRF_RADIO_Type, TASKS_CCASTOP), /**< Stop the Clear Channel Assessment. */
89 #endif
90 #if defined(RADIO_TASKS_SOFTRESET_TASKS_SOFTRESET_Msk) || defined(__NRFX_DOXYGEN__)
91 NRF_RADIO_TASK_SOFTRESET = offsetof(NRF_RADIO_Type, TASKS_SOFTRESET), /**< Reset all public registers, but with these exceptions:
92 * DMA registers and EVENT/INTEN/SUBSCRIBE/PUBLISH
93 * registers. Only to be used in DISABLED state. */
94 #endif
95 } nrf_radio_task_t;
96
97 /** @brief RADIO events. */
98 typedef enum
99 {
100 NRF_RADIO_EVENT_READY = offsetof(NRF_RADIO_Type, EVENTS_READY), /**< Radio has ramped up and is ready to be started. */
101 NRF_RADIO_EVENT_ADDRESS = offsetof(NRF_RADIO_Type, EVENTS_ADDRESS), /**< Address sent or received. */
102 NRF_RADIO_EVENT_PAYLOAD = offsetof(NRF_RADIO_Type, EVENTS_PAYLOAD), /**< Packet payload sent or received. */
103 NRF_RADIO_EVENT_END = offsetof(NRF_RADIO_Type, EVENTS_END), /**< Packet transmitted or received. */
104 NRF_RADIO_EVENT_DISABLED = offsetof(NRF_RADIO_Type, EVENTS_DISABLED), /**< RADIO has been disabled. */
105 NRF_RADIO_EVENT_DEVMATCH = offsetof(NRF_RADIO_Type, EVENTS_DEVMATCH), /**< A device address match occurred on the last received packet. */
106 NRF_RADIO_EVENT_DEVMISS = offsetof(NRF_RADIO_Type, EVENTS_DEVMISS), /**< No device address match occurred on the last received packet. */
107 #if defined(RADIO_INTENSET_RSSIEND_Msk) || \
108 defined(RADIO_INTENSET00_RSSIEND_Msk) || \
109 defined(__NRFX_DOXYGEN__)
110 NRF_RADIO_EVENT_RSSIEND = offsetof(NRF_RADIO_Type, EVENTS_RSSIEND), /**< Sampling of receive signal strength complete. */
111 #endif
112 NRF_RADIO_EVENT_BCMATCH = offsetof(NRF_RADIO_Type, EVENTS_BCMATCH), /**< Bit counter reached bit count value. */
113 #if defined(RADIO_INTENSET_CRCOK_Msk) || \
114 defined(RADIO_INTENSET00_CRCOK_Msk) || \
115 defined(__NRFX_DOXYGEN__)
116 NRF_RADIO_EVENT_CRCOK = offsetof(NRF_RADIO_Type, EVENTS_CRCOK), /**< Packet received with correct CRC. */
117 #endif
118 #if defined(RADIO_INTENSET_CRCERROR_Msk) || \
119 defined(RADIO_INTENSET00_CRCERROR_Msk) || \
120 defined(__NRFX_DOXYGEN__)
121 NRF_RADIO_EVENT_CRCERROR = offsetof(NRF_RADIO_Type, EVENTS_CRCERROR), /**< Packet received with incorrect CRC. */
122 #endif
123 #if defined(RADIO_INTENSET_FRAMESTART_Msk) || \
124 defined(RADIO_INTENSET00_FRAMESTART_Msk) || \
125 defined(__NRFX_DOXYGEN__)
126 NRF_RADIO_EVENT_FRAMESTART = offsetof(NRF_RADIO_Type, EVENTS_FRAMESTART), /**< IEEE 802.15.4 length field received. */
127 #endif
128 #if defined(RADIO_INTENSET_EDEND_Msk) || \
129 defined(RADIO_INTENSET00_EDEND_Msk) || \
130 defined(__NRFX_DOXYGEN__)
131 NRF_RADIO_EVENT_EDEND = offsetof(NRF_RADIO_Type, EVENTS_EDEND), /**< Energy Detection procedure ended. */
132 #endif
133 #if defined(RADIO_INTENSET_EDSTOPPED_Msk) || \
134 defined(RADIO_INTENSET00_EDSTOPPED_Msk) || \
135 defined(__NRFX_DOXYGEN__)
136 NRF_RADIO_EVENT_EDSTOPPED = offsetof(NRF_RADIO_Type, EVENTS_EDSTOPPED), /**< The sampling of Energy Detection has stopped. */
137 #endif
138 #if defined(RADIO_INTENSET_CCAIDLE_Msk) || \
139 defined(RADIO_INTENSET00_CCAIDLE_Msk) || \
140 defined(__NRFX_DOXYGEN__)
141 NRF_RADIO_EVENT_CCAIDLE = offsetof(NRF_RADIO_Type, EVENTS_CCAIDLE), /**< Wireless medium in idle - clear to send. */
142 #endif
143 #if defined(RADIO_INTENSET_CCABUSY_Msk) || \
144 defined(RADIO_INTENSET00_CCABUSY_Msk) || \
145 defined(__NRFX_DOXYGEN__)
146 NRF_RADIO_EVENT_CCABUSY = offsetof(NRF_RADIO_Type, EVENTS_CCABUSY), /**< Wireless medium busy - do not send. */
147 #endif
148 #if defined(RADIO_INTENSET_CCASTOPPED_Msk) || \
149 defined(RADIO_INTENSET00_CCASTOPPED_Msk) || \
150 defined(__NRFX_DOXYGEN__)
151 NRF_RADIO_EVENT_CCASTOPPED = offsetof(NRF_RADIO_Type, EVENTS_CCASTOPPED), /**< The CCA has stopped. */
152 #endif
153 #if defined(RADIO_INTENSET_RATEBOOST_Msk) || \
154 defined(RADIO_INTENSET00_RATEBOOST_Msk) || \
155 defined(__NRFX_DOXYGEN__)
156 NRF_RADIO_EVENT_RATEBOOST = offsetof(NRF_RADIO_Type, EVENTS_RATEBOOST), /**< Ble_LR CI field received, receive mode is changed from Ble_LR125Kbit to Ble_LR500Kbit. */
157 #endif
158 #if defined(RADIO_INTENSET_TXREADY_Msk) || \
159 defined(RADIO_INTENSET00_TXREADY_Msk) || \
160 defined(__NRFX_DOXYGEN__)
161 NRF_RADIO_EVENT_TXREADY = offsetof(NRF_RADIO_Type, EVENTS_TXREADY), /**< RADIO has ramped up and is ready to be started TX path. */
162 #endif
163 #if defined(RADIO_INTENSET_RXREADY_Msk) || \
164 defined(RADIO_INTENSET00_RXREADY_Msk) || \
165 defined(__NRFX_DOXYGEN__)
166 NRF_RADIO_EVENT_RXREADY = offsetof(NRF_RADIO_Type, EVENTS_RXREADY), /**< RADIO has ramped up and is ready to be started RX path. */
167 #endif
168 #if defined(RADIO_INTENSET_MHRMATCH_Msk) || \
169 defined(RADIO_INTENSET00_MHRMATCH_Msk) || \
170 defined(__NRFX_DOXYGEN__)
171 NRF_RADIO_EVENT_MHRMATCH = offsetof(NRF_RADIO_Type, EVENTS_MHRMATCH), /**< MAC Header match found. */
172 #endif
173 #if defined(RADIO_INTENSET_PHYEND_Msk) || \
174 defined(RADIO_INTENSET00_PHYEND_Msk) || \
175 defined(__NRFX_DOXYGEN__)
176 NRF_RADIO_EVENT_PHYEND = offsetof(NRF_RADIO_Type, EVENTS_PHYEND), /**< Generated in Ble_LR125Kbit, Ble_LR500Kbit
177 * and BleIeee802154_250Kbit modes when last
178 * bit is sent on the air. */
179 #endif
180 #if defined(RADIO_INTENSET_SYNC_Msk) || \
181 defined(RADIO_INTENSET00_SYNC_Msk) || \
182 defined(__NRFX_DOXYGEN__)
183 NRF_RADIO_EVENT_SYNC = offsetof(NRF_RADIO_Type, EVENTS_SYNC), /**< Generated in Ble_LR125Kbit, Ble_LR500Kbit
184 * and BleIeee802154_250Kbit modes when possible
185 * preamble has been received. */
186 #endif
187 #if defined(RADIO_INTENSET_CTEPRESENT_Msk) || \
188 defined(RADIO_INTENSET00_CTEPRESENT_Msk) || \
189 defined(__NRFX_DOXYGEN__)
190 NRF_RADIO_EVENT_CTEPRESENT = offsetof(NRF_RADIO_Type, EVENTS_CTEPRESENT) /**< CTE is present. */
191 #endif
192 } nrf_radio_event_t;
193
194 /** @brief RADIO interrupts. */
195 typedef enum
196 {
197 #if defined(RADIO_INTENSET_READY_Msk) || defined(__NRFX_DOXYGEN__)
198 NRF_RADIO_INT_READY_MASK = RADIO_INTENSET_READY_Msk, /**< Interrupt on READY event. */
199 #elif defined(RADIO_INTENSET00_READY_Msk)
200 NRF_RADIO_INT_READY_MASK = RADIO_INTENSET00_READY_Msk, /**< Interrupt on READY event. */
201 #endif
202 #if defined(RADIO_INTENSET_ADDRESS_Msk) || defined(__NRFX_DOXYGEN__)
203 NRF_RADIO_INT_ADDRESS_MASK = RADIO_INTENSET_ADDRESS_Msk, /**< Interrupt on ADDRESS event. */
204 #elif defined(RADIO_INTENSET00_ADDRESS_Msk)
205 NRF_RADIO_INT_ADDRESS_MASK = RADIO_INTENSET00_ADDRESS_Msk, /**< Interrupt on ADDRESS event. */
206 #endif
207 #if defined(RADIO_INTENSET_PAYLOAD_Msk) || defined(__NRFX_DOXYGEN__)
208 NRF_RADIO_INT_PAYLOAD_MASK = RADIO_INTENSET_PAYLOAD_Msk, /**< Interrupt on PAYLOAD event. */
209 #elif defined(RADIO_INTENSET00_PAYLOAD_Msk)
210 NRF_RADIO_INT_PAYLOAD_MASK = RADIO_INTENSET00_PAYLOAD_Msk, /**< Interrupt on PAYLOAD event. */
211 #endif
212 #if defined(RADIO_INTENSET_END_Msk) || defined(__NRFX_DOXYGEN__)
213 NRF_RADIO_INT_END_MASK = RADIO_INTENSET_END_Msk, /**< Interrupt on END event. */
214 #elif defined(RADIO_INTENSET00_END_Msk)
215 NRF_RADIO_INT_END_MASK = RADIO_INTENSET00_END_Msk, /**< Interrupt on END event. */
216 #endif
217 #if defined(RADIO_INTENSET_DISABLED_Msk) || defined(__NRFX_DOXYGEN__)
218 NRF_RADIO_INT_DISABLED_MASK = RADIO_INTENSET_DISABLED_Msk, /**< Interrupt on DISABLED event. */
219 #elif defined(RADIO_INTENSET00_DISABLED_Msk)
220 NRF_RADIO_INT_DISABLED_MASK = RADIO_INTENSET00_DISABLED_Msk, /**< Interrupt on DISABLED event. */
221 #endif
222 #if defined(RADIO_INTENSET_DEVMATCH_Msk) || defined(__NRFX_DOXYGEN__)
223 NRF_RADIO_INT_DEVMATCH_MASK = RADIO_INTENSET_DEVMATCH_Msk, /**< Interrupt on DEVMATCH event. */
224 #elif defined(RADIO_INTENSET00_DEVMATCH_Msk)
225 NRF_RADIO_INT_DEVMATCH_MASK = RADIO_INTENSET00_DEVMATCH_Msk, /**< Interrupt on DEVMATCH event. */
226 #endif
227 #if defined(RADIO_INTENSET_DEVMISS_Msk) || defined(__NRFX_DOXYGEN__)
228 NRF_RADIO_INT_DEVMISS_MASK = RADIO_INTENSET_DEVMISS_Msk, /**< Interrupt on DEVMISS event. */
229 #elif defined(RADIO_INTENSET00_DEVMISS_Msk)
230 NRF_RADIO_INT_DEVMISS_MASK = RADIO_INTENSET00_DEVMISS_Msk, /**< Interrupt on DEVMISS event. */
231 #endif
232 #if defined(RADIO_INTENSET_RSSIEND_Msk) || defined(__NRFX_DOXYGEN__)
233 NRF_RADIO_INT_RSSIEND_MASK = RADIO_INTENSET_RSSIEND_Msk, /**< Interrupt on RSSIEND event. */
234 #elif defined(RADIO_INTENSET00_RSSIEND_Msk)
235 NRF_RADIO_INT_RSSIEND_MASK = RADIO_INTENSET00_RSSIEND_Msk, /**< Interrupt on RSSIEND event. */
236 #endif
237 #if defined(RADIO_INTENSET_BCMATCH_Msk) || defined(__NRFX_DOXYGEN__)
238 NRF_RADIO_INT_BCMATCH_MASK = RADIO_INTENSET_BCMATCH_Msk, /**< Interrupt on BCMATCH event. */
239 #elif defined(RADIO_INTENSET00_BCMATCH_Msk)
240 NRF_RADIO_INT_BCMATCH_MASK = RADIO_INTENSET00_BCMATCH_Msk, /**< Interrupt on BCMATCH event. */
241 #endif
242 #if defined(RADIO_INTENSET_CRCOK_Msk) || defined(__NRFX_DOXYGEN__)
243 NRF_RADIO_INT_CRCOK_MASK = RADIO_INTENSET_CRCOK_Msk, /**< Interrupt on CRCOK event. */
244 #elif defined(RADIO_INTENSET00_CRCOK_Msk)
245 NRF_RADIO_INT_CRCOK_MASK = RADIO_INTENSET00_CRCOK_Msk, /**< Interrupt on CRCOK event. */
246 #endif
247 #if defined(RADIO_INTENSET_CRCERROR_Msk) || defined(__NRFX_DOXYGEN__)
248 NRF_RADIO_INT_CRCERROR_MASK = RADIO_INTENSET_CRCERROR_Msk, /**< Interrupt on CRCERROR event. */
249 #elif defined(RADIO_INTENSET00_CRCERROR_Msk)
250 NRF_RADIO_INT_CRCERROR_MASK = RADIO_INTENSET00_CRCERROR_Msk, /**< Interrupt on CRCERROR event. */
251 #endif
252 #if defined(RADIO_INTENSET_FRAMESTART_Msk) || defined(__NRFX_DOXYGEN__)
253 NRF_RADIO_INT_FRAMESTART_MASK = RADIO_INTENSET_FRAMESTART_Msk, /**< Interrupt on FRAMESTART event. */
254 #elif defined(RADIO_INTENSET00_FRAMESTART_Msk)
255 NRF_RADIO_INT_FRAMESTART_MASK = RADIO_INTENSET00_FRAMESTART_Msk, /**< Interrupt on FRAMESTART event. */
256 #endif
257 #if defined(RADIO_INTENSET_EDEND_Msk) || defined(__NRFX_DOXYGEN__)
258 NRF_RADIO_INT_EDEND_MASK = RADIO_INTENSET_EDEND_Msk, /**< Interrupt on EDEND event. */
259 #elif defined(RADIO_INTENSET00_EDEND_Msk)
260 NRF_RADIO_INT_EDEND_MASK = RADIO_INTENSET00_EDEND_Msk, /**< Interrupt on EDEND event. */
261 #endif
262 #if defined(RADIO_INTENSET_EDSTOPPED_Msk) || defined(__NRFX_DOXYGEN__)
263 NRF_RADIO_INT_EDSTOPPED_MASK = RADIO_INTENSET_EDSTOPPED_Msk, /**< Interrupt on EDSTOPPED event. */
264 #elif defined(RADIO_INTENSET00_EDSTOPPED_Msk)
265 NRF_RADIO_INT_EDSTOPPED_MASK = RADIO_INTENSET00_EDSTOPPED_Msk, /**< Interrupt on EDSTOPPED event. */
266 #endif
267 #if defined(RADIO_INTENSET_CCAIDLE_Msk) || defined(__NRFX_DOXYGEN__)
268 NRF_RADIO_INT_CCAIDLE_MASK = RADIO_INTENSET_CCAIDLE_Msk, /**< Interrupt on CCAIDLE event. */
269 #elif defined(RADIO_INTENSET00_CCAIDLE_Msk)
270 NRF_RADIO_INT_CCAIDLE_MASK = RADIO_INTENSET00_CCAIDLE_Msk, /**< Interrupt on CCAIDLE event. */
271 #endif
272 #if defined(RADIO_INTENSET_CCABUSY_Msk) || defined(__NRFX_DOXYGEN__)
273 NRF_RADIO_INT_CCABUSY_MASK = RADIO_INTENSET_CCABUSY_Msk, /**< Interrupt on CCABUSY event. */
274 #elif defined(RADIO_INTENSET00_CCABUSY_Msk)
275 NRF_RADIO_INT_CCABUSY_MASK = RADIO_INTENSET00_CCABUSY_Msk, /**< Interrupt on CCABUSY event. */
276 #endif
277 #if defined(RADIO_INTENSET_CCASTOPPED_Msk) || defined(__NRFX_DOXYGEN__)
278 NRF_RADIO_INT_CCASTOPPED_MASK = RADIO_INTENSET_CCASTOPPED_Msk, /**< Interrupt on CCASTOPPED event. */
279 #elif defined(RADIO_INTENSET00_CCASTOPPED_Msk)
280 NRF_RADIO_INT_CCASTOPPED_MASK = RADIO_INTENSET00_CCASTOPPED_Msk, /**< Interrupt on CCASTOPPED event. */
281 #endif
282 #if defined(RADIO_INTENSET_RATEBOOST_Msk) || defined(__NRFX_DOXYGEN__)
283 NRF_RADIO_INT_RATEBOOST_MASK = RADIO_INTENSET_RATEBOOST_Msk, /**< Interrupt on RATEBOOST event. */
284 #elif defined(RADIO_INTENSET00_RATEBOOST_Msk)
285 NRF_RADIO_INT_RATEBOOST_MASK = RADIO_INTENSET00_RATEBOOST_Msk, /**< Interrupt on RATEBOOST event. */
286 #endif
287 #if defined(RADIO_INTENSET_TXREADY_Msk) || defined(__NRFX_DOXYGEN__)
288 NRF_RADIO_INT_TXREADY_MASK = RADIO_INTENSET_TXREADY_Msk, /**< Interrupt on TXREADY event. */
289 #elif defined(RADIO_INTENSET00_TXREADY_Msk)
290 NRF_RADIO_INT_TXREADY_MASK = RADIO_INTENSET00_TXREADY_Msk, /**< Interrupt on TXREADY event. */
291 #endif
292 #if defined(RADIO_INTENSET_RXREADY_Msk) || defined(__NRFX_DOXYGEN__)
293 NRF_RADIO_INT_RXREADY_MASK = RADIO_INTENSET_RXREADY_Msk, /**< Interrupt on RXREADY event. */
294 #elif defined(RADIO_INTENSET00_RXREADY_Msk)
295 NRF_RADIO_INT_RXREADY_MASK = RADIO_INTENSET00_RXREADY_Msk, /**< Interrupt on RXREADY event. */
296 #endif
297 #if defined(RADIO_INTENSET_MHRMATCH_Msk) || defined(__NRFX_DOXYGEN__)
298 NRF_RADIO_INT_MHRMATCH_MASK = RADIO_INTENSET_MHRMATCH_Msk, /**< Interrupt on MHRMATCH event. */
299 #elif defined(RADIO_INTENSET00_MHRMATCH_Msk)
300 NRF_RADIO_INT_MHRMATCH_MASK = RADIO_INTENSET00_MHRMATCH_Msk, /**< Interrupt on MHRMATCH event. */
301 #endif
302 #if defined(RADIO_INTENSET_PHYEND_Msk) || defined(__NRFX_DOXYGEN__)
303 NRF_RADIO_INT_PHYEND_MASK = RADIO_INTENSET_PHYEND_Msk, /**< Interrupt on PHYEND event. */
304 #elif defined(RADIO_INTENSET00_PHYEND_Msk)
305 NRF_RADIO_INT_PHYEND_MASK = RADIO_INTENSET00_PHYEND_Msk, /**< Interrupt on PHYEND event. */
306 #endif
307 #if defined(RADIO_INTENSET_SYNC_Msk) || defined(__NRFX_DOXYGEN__)
308 NRF_RADIO_INT_SYNC_MASK = RADIO_INTENSET_SYNC_Msk, /**< Interrupt on SYNC event. */
309 #elif defined(RADIO_INTENSET00_SYNC_Msk)
310 NRF_RADIO_INT_SYNC_MASK = RADIO_INTENSET00_SYNC_Msk, /**< Interrupt on SYNC event. */
311 #endif
312 #if defined(RADIO_INTENSET_CTEPRESENT_Msk) || defined(__NRFX_DOXYGEN__)
313 NRF_RADIO_INT_CTEPRESENT_MASK = RADIO_INTENSET_CTEPRESENT_Msk /**< Interrupt on CTEPRESENT event. */
314 #elif defined(RADIO_INTENSET00_CTEPRESENT_Msk)
315 NRF_RADIO_INT_CTEPRESENT_MASK = RADIO_INTENSET00_CTEPRESENT_Msk /**< Interrupt on CTEPRESENT event. */
316 #endif
317 } nrf_radio_int_mask_t;
318
319 /** @brief RADIO shortcuts. */
320 typedef enum
321 {
322 NRF_RADIO_SHORT_READY_START_MASK = RADIO_SHORTS_READY_START_Msk, /**< Shortcut between READY event and START task. */
323 #if defined(RADIO_SHORTS_END_DISABLE_Msk) || defined(__NRFX_DOXYGEN__)
324 NRF_RADIO_SHORT_END_DISABLE_MASK = RADIO_SHORTS_END_DISABLE_Msk, /**< Shortcut between END event and DISABLE task. */
325 #endif
326 NRF_RADIO_SHORT_DISABLED_TXEN_MASK = RADIO_SHORTS_DISABLED_TXEN_Msk, /**< Shortcut between DISABLED event and TXEN task. */
327 NRF_RADIO_SHORT_DISABLED_RXEN_MASK = RADIO_SHORTS_DISABLED_RXEN_Msk, /**< Shortcut between DISABLED event and RXEN task. */
328 NRF_RADIO_SHORT_ADDRESS_RSSISTART_MASK = RADIO_SHORTS_ADDRESS_RSSISTART_Msk, /**< Shortcut between ADDRESS event and RSSISTART task. */
329 NRF_RADIO_SHORT_END_START_MASK = RADIO_SHORTS_END_START_Msk, /**< Shortcut between END event and START task. */
330 NRF_RADIO_SHORT_ADDRESS_BCSTART_MASK = RADIO_SHORTS_ADDRESS_BCSTART_Msk, /**< Shortcut between ADDRESS event and BCSTART task. */
331 #if defined(RADIO_SHORTS_DISABLED_RSSISTOP_Msk) || defined(__NRFX_DOXYGEN__)
332 NRF_RADIO_SHORT_DISABLED_RSSISTOP_MASK = RADIO_SHORTS_DISABLED_RSSISTOP_Msk, /**< Shortcut between DISABLED event and RSSISTOP task. */
333 #endif
334 #if defined(RADIO_SHORTS_RXREADY_CCASTART_Msk) || defined(__NRFX_DOXYGEN__)
335 NRF_RADIO_SHORT_RXREADY_CCASTART_MASK = RADIO_SHORTS_RXREADY_CCASTART_Msk, /**< Shortcut between RXREADY event and CCASTART task. */
336 #endif
337 #if defined(RADIO_SHORTS_CCAIDLE_TXEN_Msk) || defined(__NRFX_DOXYGEN__)
338 NRF_RADIO_SHORT_CCAIDLE_TXEN_MASK = RADIO_SHORTS_CCAIDLE_TXEN_Msk, /**< Shortcut between CCAIDLE event and TXEN task. */
339 #endif
340 #if defined(RADIO_SHORTS_CCABUSY_DISABLE_Msk) || defined(__NRFX_DOXYGEN__)
341 NRF_RADIO_SHORT_CCABUSY_DISABLE_MASK = RADIO_SHORTS_CCABUSY_DISABLE_Msk, /**< Shortcut between CCABUSY event and DISABLE task. */
342 #endif
343 #if defined(RADIO_SHORTS_FRAMESTART_BCSTART_Msk) || defined(__NRFX_DOXYGEN__)
344 NRF_RADIO_SHORT_FRAMESTART_BCSTART_MASK = RADIO_SHORTS_FRAMESTART_BCSTART_Msk, /**< Shortcut between FRAMESTART event and BCSTART task. */
345 #endif
346 #if defined(RADIO_SHORTS_READY_EDSTART_Msk) || defined(__NRFX_DOXYGEN__)
347 NRF_RADIO_SHORT_READY_EDSTART_MASK = RADIO_SHORTS_READY_EDSTART_Msk, /**< Shortcut between READY event and EDSTART task. */
348 #endif
349 #if defined(RADIO_SHORTS_EDEND_DISABLE_Msk) || defined(__NRFX_DOXYGEN__)
350 NRF_RADIO_SHORT_EDEND_DISABLE_MASK = RADIO_SHORTS_EDEND_DISABLE_Msk, /**< Shortcut between EDEND event and DISABLE task. */
351 #endif
352 #if defined(RADIO_SHORTS_CCAIDLE_STOP_Msk) || defined(__NRFX_DOXYGEN__)
353 NRF_RADIO_SHORT_CCAIDLE_STOP_MASK = RADIO_SHORTS_CCAIDLE_STOP_Msk, /**< Shortcut between CCAIDLE event and STOP task. */
354 #endif
355 #if defined(RADIO_SHORTS_TXREADY_START_Msk) || defined(__NRFX_DOXYGEN__)
356 NRF_RADIO_SHORT_TXREADY_START_MASK = RADIO_SHORTS_TXREADY_START_Msk, /**< Shortcut between TXREADY event and START task. */
357 #endif
358 #if defined(RADIO_SHORTS_RXREADY_START_Msk) || defined(__NRFX_DOXYGEN__)
359 NRF_RADIO_SHORT_RXREADY_START_MASK = RADIO_SHORTS_RXREADY_START_Msk, /**< Shortcut between RXREADY event and START task. */
360 #endif
361 #if defined(RADIO_SHORTS_PHYEND_DISABLE_Msk) || defined(__NRFX_DOXYGEN__)
362 NRF_RADIO_SHORT_PHYEND_DISABLE_MASK = RADIO_SHORTS_PHYEND_DISABLE_Msk, /**< Shortcut between PHYEND event and DISABLE task. */
363 #endif
364 #if defined(RADIO_SHORTS_PHYEND_START_Msk) || defined(__NRFX_DOXYGEN__)
365 NRF_RADIO_SHORT_PHYEND_START_MASK = RADIO_SHORTS_PHYEND_START_Msk, /**< Shortcut between PHYEND event and START task. */
366 #endif
367 } nrf_radio_short_mask_t;
368
369 #if defined(RADIO_CCACTRL_CCAMODE_Msk) || defined(__NRFX_DOXYGEN__)
370 /** @brief RADIO Clear Channel Assessment modes. */
371 typedef enum
372 {
373 NRF_RADIO_CCA_MODE_ED = RADIO_CCACTRL_CCAMODE_EdMode, /**< Energy Above Threshold. Will report busy whenever energy is detected above set threshold. */
374 NRF_RADIO_CCA_MODE_CARRIER = RADIO_CCACTRL_CCAMODE_CarrierMode, /**< Carrier Seen. Will report busy whenever compliant IEEE 802.15.4 signal is seen. */
375 NRF_RADIO_CCA_MODE_CARRIER_AND_ED = RADIO_CCACTRL_CCAMODE_CarrierAndEdMode, /**< Energy Above Threshold AND Carrier Seen. */
376 NRF_RADIO_CCA_MODE_CARRIER_OR_ED = RADIO_CCACTRL_CCAMODE_CarrierOrEdMode, /**< Energy Above Threshold OR Carrier Seen. */
377 NRF_RADIO_CCA_MODE_ED_TEST1 = RADIO_CCACTRL_CCAMODE_EdModeTest1, /**< Energy Above Threshold test mode that will abort when first ED measurement over threshold is seen. No averaging. */
378 } nrf_radio_cca_mode_t;
379 #endif // defined(RADIO_CCACTRL_CCAMODE_Msk) || defined(__NRFX_DOXYGEN__)
380
381 /** @brief Types of RADIO states. */
382 typedef enum
383 {
384 NRF_RADIO_STATE_DISABLED = RADIO_STATE_STATE_Disabled, /**< No operations are going on inside the radio and the power consumption is at a minimum. */
385 NRF_RADIO_STATE_RXRU = RADIO_STATE_STATE_RxRu, /**< The radio is ramping up and preparing for reception. */
386 NRF_RADIO_STATE_RXIDLE = RADIO_STATE_STATE_RxIdle, /**< The radio is ready for reception to start. */
387 NRF_RADIO_STATE_RX = RADIO_STATE_STATE_Rx, /**< Reception has been started. */
388 NRF_RADIO_STATE_RXDISABLE = RADIO_STATE_STATE_RxDisable, /**< The radio is disabling the receiver. */
389 NRF_RADIO_STATE_TXRU = RADIO_STATE_STATE_TxRu, /**< The radio is ramping up and preparing for transmission. */
390 NRF_RADIO_STATE_TXIDLE = RADIO_STATE_STATE_TxIdle, /**< The radio is ready for transmission to start. */
391 NRF_RADIO_STATE_TX = RADIO_STATE_STATE_Tx, /**< The radio is transmitting a packet. */
392 NRF_RADIO_STATE_TXDISABLE = RADIO_STATE_STATE_TxDisable, /**< The radio is disabling the transmitter. */
393 } nrf_radio_state_t;
394
395 /** @brief Types of RADIO TX power. */
396 typedef enum
397 {
398 #if defined(RADIO_TXPOWER_TXPOWER_Pos10dBm) || defined(__NRFX_DOXYGEN__)
399 NRF_RADIO_TXPOWER_POS10DBM = RADIO_TXPOWER_TXPOWER_Pos10dBm, /**< 10 dBm. */
400 #endif
401 #if defined(RADIO_TXPOWER_TXPOWER_Pos9dBm) || defined(__NRFX_DOXYGEN__)
402 NRF_RADIO_TXPOWER_POS9DBM = RADIO_TXPOWER_TXPOWER_Pos9dBm, /**< 9 dBm. */
403 #endif
404 #if defined(RADIO_TXPOWER_TXPOWER_Pos8dBm) || defined(__NRFX_DOXYGEN__)
405 NRF_RADIO_TXPOWER_POS8DBM = RADIO_TXPOWER_TXPOWER_Pos8dBm, /**< 8 dBm. */
406 #endif
407 #if defined(RADIO_TXPOWER_TXPOWER_Pos7dBm) || defined(__NRFX_DOXYGEN__)
408 NRF_RADIO_TXPOWER_POS7DBM = RADIO_TXPOWER_TXPOWER_Pos7dBm, /**< 7 dBm. */
409 #endif
410 #if defined(RADIO_TXPOWER_TXPOWER_Pos6dBm) || defined(__NRFX_DOXYGEN__)
411 NRF_RADIO_TXPOWER_POS6DBM = RADIO_TXPOWER_TXPOWER_Pos6dBm, /**< 6 dBm. */
412 #endif
413 #if defined(RADIO_TXPOWER_TXPOWER_Pos5dBm) || defined(__NRFX_DOXYGEN__)
414 NRF_RADIO_TXPOWER_POS5DBM = RADIO_TXPOWER_TXPOWER_Pos5dBm, /**< 5 dBm. */
415 #endif
416 #if defined(RADIO_TXPOWER_TXPOWER_Pos4dBm) || defined(__NRFX_DOXYGEN__)
417 NRF_RADIO_TXPOWER_POS4DBM = RADIO_TXPOWER_TXPOWER_Pos4dBm, /**< 4 dBm. */
418 #endif
419 #if defined(RADIO_TXPOWER_TXPOWER_Pos3dBm) || defined(__NRFX_DOXYGEN__)
420 NRF_RADIO_TXPOWER_POS3DBM = RADIO_TXPOWER_TXPOWER_Pos3dBm, /**< 3 dBm. */
421 #endif
422 #if defined(RADIO_TXPOWER_TXPOWER_Pos2dBm) || defined(__NRFX_DOXYGEN__)
423 NRF_RADIO_TXPOWER_POS2DBM = RADIO_TXPOWER_TXPOWER_Pos2dBm, /**< 2 dBm. */
424 #endif
425 #if defined(RADIO_TXPOWER_TXPOWER_Pos1dBm) || defined(__NRFX_DOXYGEN__)
426 NRF_RADIO_TXPOWER_POS1DBM = RADIO_TXPOWER_TXPOWER_Pos1dBm, /**< 1 dBm. */
427 #endif
428 NRF_RADIO_TXPOWER_0DBM = RADIO_TXPOWER_TXPOWER_0dBm, /**< 0 dBm. */
429 #if defined(RADIO_TXPOWER_TXPOWER_Neg1dBm) || defined(__NRFX_DOXYGEN__)
430 NRF_RADIO_TXPOWER_NEG1DBM = RADIO_TXPOWER_TXPOWER_Neg1dBm, /**< -1 dBm. */
431 #endif
432 #if defined(RADIO_TXPOWER_TXPOWER_Neg2dBm) || defined(__NRFX_DOXYGEN__)
433 NRF_RADIO_TXPOWER_NEG2DBM = RADIO_TXPOWER_TXPOWER_Neg2dBm, /**< -2 dBm. */
434 #endif
435 #if defined(RADIO_TXPOWER_TXPOWER_Neg3dBm) || defined(__NRFX_DOXYGEN__)
436 NRF_RADIO_TXPOWER_NEG3DBM = RADIO_TXPOWER_TXPOWER_Neg3dBm, /**< -3 dBm. */
437 #endif
438 NRF_RADIO_TXPOWER_NEG4DBM = RADIO_TXPOWER_TXPOWER_Neg4dBm, /**< -4 dBm. */
439 #if defined(RADIO_TXPOWER_TXPOWER_Neg5dBm) || defined(__NRFX_DOXYGEN__)
440 NRF_RADIO_TXPOWER_NEG5DBM = RADIO_TXPOWER_TXPOWER_Neg5dBm, /**< -5 dBm. */
441 #endif
442 #if defined(RADIO_TXPOWER_TXPOWER_Neg6dBm) || defined(__NRFX_DOXYGEN__)
443 NRF_RADIO_TXPOWER_NEG6DBM = RADIO_TXPOWER_TXPOWER_Neg6dBm, /**< -6 dBm. */
444 #endif
445 #if defined(RADIO_TXPOWER_TXPOWER_Neg7dBm) || defined(__NRFX_DOXYGEN__)
446 NRF_RADIO_TXPOWER_NEG7DBM = RADIO_TXPOWER_TXPOWER_Neg7dBm, /**< -7 dBm. */
447 #endif
448 NRF_RADIO_TXPOWER_NEG8DBM = RADIO_TXPOWER_TXPOWER_Neg8dBm, /**< -8 dBm. */
449 #if defined(RADIO_TXPOWER_TXPOWER_Neg9dBm) || defined(__NRFX_DOXYGEN__)
450 NRF_RADIO_TXPOWER_NEG9DBM = RADIO_TXPOWER_TXPOWER_Neg9dBm, /**< -9 dBm. */
451 #endif
452 #if defined(RADIO_TXPOWER_TXPOWER_Neg10dBm) || defined(__NRFX_DOXYGEN__)
453 NRF_RADIO_TXPOWER_NEG10DBM = RADIO_TXPOWER_TXPOWER_Neg10dBm, /**< -10 dBm. */
454 #endif
455 NRF_RADIO_TXPOWER_NEG12DBM = RADIO_TXPOWER_TXPOWER_Neg12dBm, /**< -12 dBm. */
456 #if defined(RADIO_TXPOWER_TXPOWER_Neg14dBm) || defined(__NRFX_DOXYGEN__)
457 NRF_RADIO_TXPOWER_NEG14DBM = RADIO_TXPOWER_TXPOWER_Neg14dBm, /**< -14 dBm. */
458 #endif
459 NRF_RADIO_TXPOWER_NEG16DBM = RADIO_TXPOWER_TXPOWER_Neg16dBm, /**< -16 dBm. */
460 #if defined(RADIO_TXPOWER_TXPOWER_Neg18dBm) || defined(__NRFX_DOXYGEN__)
461 NRF_RADIO_TXPOWER_NEG18DBM = RADIO_TXPOWER_TXPOWER_Neg18dBm, /**< -18 dBm. */
462 #endif
463 NRF_RADIO_TXPOWER_NEG20DBM = RADIO_TXPOWER_TXPOWER_Neg20dBm, /**< -20 dBm. */
464 #if defined(RADIO_TXPOWER_TXPOWER_Neg22dBm) || defined(__NRFX_DOXYGEN__)
465 NRF_RADIO_TXPOWER_NEG22DBM = RADIO_TXPOWER_TXPOWER_Neg22dBm, /**< -22 dBm. */
466 #endif
467 #if defined(RADIO_TXPOWER_TXPOWER_Neg28dBm) || defined(__NRFX_DOXYGEN__)
468 NRF_RADIO_TXPOWER_NEG28DBM = RADIO_TXPOWER_TXPOWER_Neg28dBm, /**< -28 dBm. */
469 #endif
470 #if defined(RADIO_TXPOWER_TXPOWER_Neg30dBm) || defined(__NRFX_DOXYGEN__)
471 NRF_RADIO_TXPOWER_NEG30DBM = RADIO_TXPOWER_TXPOWER_Neg30dBm, /**< -30 dBm. */
472 #endif
473 #if defined(RADIO_TXPOWER_TXPOWER_Neg40dBm) || defined(__NRFX_DOXYGEN__)
474 NRF_RADIO_TXPOWER_NEG40DBM = RADIO_TXPOWER_TXPOWER_Neg40dBm, /**< -40 dBm. */
475 #endif
476 #if defined(RADIO_TXPOWER_TXPOWER_Neg46dBm) || defined(__NRFX_DOXYGEN__)
477 NRF_RADIO_TXPOWER_NEG46DBM = RADIO_TXPOWER_TXPOWER_Neg46dBm, /**< -46 dBm. */
478 #endif
479 #if defined(RADIO_TXPOWER_TXPOWER_Neg70dBm) || defined(__NRFX_DOXYGEN__)
480 NRF_RADIO_TXPOWER_NEG70DBM = RADIO_TXPOWER_TXPOWER_Neg70dBm, /**< -70 dBm. */
481 #endif
482 #if defined(RADIO_TXPOWER_TXPOWER_Neg100dBm) || defined(__NRFX_DOXYGEN__)
483 NRF_RADIO_TXPOWER_NEG100DBM = RADIO_TXPOWER_TXPOWER_Neg100dBm, /**< -100 dBm. */
484 #endif
485 } nrf_radio_txpower_t;
486
487 /** @brief Types of RADIO modes (data rate and modulation). */
488 typedef enum
489 {
490 NRF_RADIO_MODE_NRF_1MBIT = RADIO_MODE_MODE_Nrf_1Mbit, /**< 1Mbit/s Nordic proprietary radio mode. */
491 NRF_RADIO_MODE_NRF_2MBIT = RADIO_MODE_MODE_Nrf_2Mbit, /**< 2Mbit/s Nordic proprietary radio mode. */
492 #if defined(RADIO_MODE_MODE_Nrf_250Kbit) || defined(__NRFX_DOXYGEN__)
493 NRF_RADIO_MODE_NRF_250KBIT = RADIO_MODE_MODE_Nrf_250Kbit, /**< 250Kbit/s Nordic proprietary radio mode. */
494 #endif
495 #if defined(RADIO_MODE_MODE_Nrf_4Mbit0_5) || defined(__NRFX_DOXYGEN__)
496 NRF_RADIO_MODE_NRF_4MBIT_H_0_5 = RADIO_MODE_MODE_Nrf_4Mbit0_5, /*!< 4Mbit/s Nordic proprietary radio mode (BT=0.5/h=0.5). */
497 #endif
498 #if defined(RADIO_MODE_MODE_Nrf_4Mbit0_25) || defined(__NRFX_DOXYGEN__)
499 NRF_RADIO_MODE_NRF_4MBIT_H_0_25 = RADIO_MODE_MODE_Nrf_4Mbit0_25, /*!< 4Mbit/s Nordic proprietary radio mode (BT=0.5/h=0.25). */
500 #endif
501 #if defined(RADIO_MODE_MODE_Nrf_4Mbit_0BT6) || defined(__NRFX_DOXYGEN__)
502 NRF_RADIO_MODE_NRF_4MBIT_BT_0_6 = RADIO_MODE_MODE_Nrf_4Mbit_0BT6, /*!< 4Mbit/s Nordic proprietary radio mode (BT=0.6/h=0.5). */
503 #endif
504 #if defined(RADIO_MODE_MODE_Nrf_4Mbit_0BT4) || defined(__NRFX_DOXYGEN__)
505 NRF_RADIO_MODE_NRF_4MBIT_BT_0_4 = RADIO_MODE_MODE_Nrf_4Mbit_0BT4, /*!< 4Mbit/s Nordic proprietary radio mode (BT=0.4/h=0.5). */
506 #endif
507 NRF_RADIO_MODE_BLE_1MBIT = RADIO_MODE_MODE_Ble_1Mbit, /**< 1 Mbit/s Bluetooth Low Energy. */
508 #if defined(RADIO_MODE_MODE_Ble_2Mbit) || defined(__NRFX_DOXYGEN__)
509 NRF_RADIO_MODE_BLE_2MBIT = RADIO_MODE_MODE_Ble_2Mbit, /**< 2 Mbit/s Bluetooth Low Energy. */
510 #endif
511 #if defined(RADIO_MODE_MODE_Ble_LR125Kbit) || defined(__NRFX_DOXYGEN__)
512 NRF_RADIO_MODE_BLE_LR125KBIT = RADIO_MODE_MODE_Ble_LR125Kbit, /*!< Bluetooth Low Energy Long range 125 kbit/s TX, 125 kbit/s and 500 kbit/s RX */
513 #endif
514 #if defined(RADIO_MODE_MODE_Ble_LR500Kbit) || defined(__NRFX_DOXYGEN__)
515 NRF_RADIO_MODE_BLE_LR500KBIT = RADIO_MODE_MODE_Ble_LR500Kbit, /*!< Bluetooth Low Energy Long range 500 kbit/s TX, 125 kbit/s and 500 kbit/s RX */
516 #endif
517 #if defined(RADIO_MODE_MODE_Ieee802154_250Kbit) || defined(__NRFX_DOXYGEN__)
518 NRF_RADIO_MODE_IEEE802154_250KBIT = RADIO_MODE_MODE_Ieee802154_250Kbit, /**< IEEE 802.15.4-2006 250 kbit/s. */
519 #endif
520 } nrf_radio_mode_t;
521
522 #if defined(RADIO_PCNF0_PLEN_Msk) || defined(__NRFX_DOXYGEN__)
523 /** @brief Types of preamble length. */
524 typedef enum
525 {
526 NRF_RADIO_PREAMBLE_LENGTH_8BIT = RADIO_PCNF0_PLEN_8bit, /**< 8-bit preamble. */
527 NRF_RADIO_PREAMBLE_LENGTH_16BIT = RADIO_PCNF0_PLEN_16bit, /**< 16-bit preamble. */
528 #if defined(RADIO_PCNF0_PLEN_32bitZero) || defined(__NRFX_DOXYGEN__)
529 NRF_RADIO_PREAMBLE_LENGTH_32BIT_ZERO = RADIO_PCNF0_PLEN_32bitZero, /**< 32-bit zero preamble used for IEEE 802.15.4. */
530 #endif
531 #if defined(RADIO_PCNF0_PLEN_LongRange) || defined(__NRFX_DOXYGEN__)
532 NRF_RADIO_PREAMBLE_LENGTH_LONG_RANGE = RADIO_PCNF0_PLEN_LongRange, /**< Preamble - used for BTLE Long Range. */
533 #endif
534 } nrf_radio_preamble_length_t;
535 #endif // defined(RADIO_PCNF0_PLEN_Msk) || defined(__NRFX_DOXYGEN__)
536
537 /** @brief Types of CRC calculatons regarding address. */
538 typedef enum
539 {
540 #if defined(RADIO_CRCCNF_SKIPADDR_Include) || defined(__NRFX_DOXYGEN__)
541 NRF_RADIO_CRC_ADDR_INCLUDE = RADIO_CRCCNF_SKIPADDR_Include, /**< CRC calculation includes address field. */
542 #else
543 NRF_RADIO_CRC_ADDR_INCLUDE = RADIO_CRCCNF_OFFSET_Include, /**< CRC calculation includes address field. */
544 #endif
545 #if defined(RADIO_CRCCNF_SKIPADDR_Skip) || defined(__NRFX_DOXYGEN__)
546 NRF_RADIO_CRC_ADDR_SKIP = RADIO_CRCCNF_SKIPADDR_Skip, /**< CRC calculation does not include address field. */
547 #else
548 NRF_RADIO_CRC_ADDR_SKIP = RADIO_CRCCNF_OFFSET_Skip, /**< CRC calculation does not include address field. */
549 #endif
550 #if defined(RADIO_CRCCNF_SKIPADDR_Ieee802154) || defined(__NRFX_DOXYGEN__)
551 NRF_RADIO_CRC_ADDR_IEEE802154 = RADIO_CRCCNF_SKIPADDR_Ieee802154, /**< CRC calculation as per 802.15.4 standard. */
552 #elif defined(RADIO_CRCCNF_OFFSET_LENGTH)
553 NRF_RADIO_CRC_ADDR_IEEE802154 = RADIO_CRCCNF_OFFSET_LENGTH, /**< CRC calculation as per 802.15.4 standard. */
554 #endif
555 #if defined(RADIO_CRCCNF_OFFSET_SO) || defined(__NRFX_DOXYGEN__)
556 NRF_RADIO_CRC_ADDR_S0 = RADIO_CRCCNF_OFFSET_SO, /**< CRC calculation starting at first byte after S0 field. */
557 #endif
558 #if defined(RADIO_CRCCNF_OFFSET_S1) || defined(__NRFX_DOXYGEN__)
559 NRF_RADIO_CRC_ADDR_S1 = RADIO_CRCCNF_OFFSET_S1, /**< CRC calculation starting at first byte after S1 field. */
560 #endif
561 } nrf_radio_crc_addr_t;
562
563 /** @brief Packet configuration. */
564 typedef struct
565 {
566 uint8_t lflen; /**< Length on air of LENGTH field in number of bits. */
567 uint8_t s0len; /**< Length on air of S0 field in number of bytes. */
568 uint8_t s1len; /**< Length on air of S1 field in number of bits. */
569 #if defined(RADIO_PCNF0_S1INCL_Msk) || defined(__NRFX_DOXYGEN__)
570 bool s1incl; /**< Include or exclude S1 field in RAM. */
571 #endif
572 #if defined(RADIO_PCNF0_CILEN_Msk) || defined(__NRFX_DOXYGEN__)
573 uint8_t cilen; /**< Length of code indicator - long range. */
574 #endif
575 #if defined(RADIO_PCNF0_PLEN_Msk) || defined(__NRFX_DOXYGEN__)
576 nrf_radio_preamble_length_t plen; /**< Length of preamble on air. Decision point: TASKS_START task. */
577 #endif
578 #if defined(RADIO_PCNF0_CRCINC_Msk) || defined(__NRFX_DOXYGEN__)
579 bool crcinc; /**< Indicates if LENGTH field contains CRC or not. */
580 #endif
581 #if defined(RADIO_PCNF0_TERMLEN_Msk) || defined(__NRFX_DOXYGEN__)
582 uint8_t termlen; /**< Length of TERM field in Long Range operation. */
583 #endif
584 uint8_t maxlen; /**< Maximum length of packet payload. */
585 uint8_t statlen; /**< Static length in number of bytes. */
586 uint8_t balen; /**< Base address length in number of bytes. */
587 bool big_endian; /**< On air endianness of packet. */
588 bool whiteen; /**< Enable or disable packet whitening. */
589 } nrf_radio_packet_conf_t;
590
591 #if defined(RADIO_DFEMODE_DFEOPMODE_Msk) || defined(__NRFX_DOXYGEN__)
592 /** @brief Direction Finding operation modes. */
593 typedef enum
594 {
595 NRF_RADIO_DFE_OP_MODE_AOD = RADIO_DFEMODE_DFEOPMODE_AoD, /**< Angle-of-Departure mode. */
596 NRF_RADIO_DFE_OP_MODE_AOA = RADIO_DFEMODE_DFEOPMODE_AoA, /**< Angle-of-Arrival mode. */
597 } nrf_radio_dfe_op_mode_t;
598 #endif
599
600 #if defined(RADIO_DFESTATUS_SWITCHINGSTATE_Msk) || defined(__NRFX_DOXYGEN__)
601 /** @brief States of Direction Finding switching state machine. */
602 typedef enum
603 {
604 NRF_RADIO_DFE_SWITCH_STATE_IDLE = RADIO_DFESTATUS_SWITCHINGSTATE_Idle, /**< Switching state Idle. */
605 NRF_RADIO_DFE_SWITCH_STATE_OFFSET = RADIO_DFESTATUS_SWITCHINGSTATE_Offset, /**< Switching state Offset. */
606 NRF_RADIO_DFE_SWITCH_STATE_GUARD = RADIO_DFESTATUS_SWITCHINGSTATE_Guard, /**< Switching state Guard. */
607 NRF_RADIO_DFE_SWITCH_STATE_REF = RADIO_DFESTATUS_SWITCHINGSTATE_Ref, /**< Switching state Ref. */
608 NRF_RADIO_DFE_SWITCH_STATE_SWITCHING = RADIO_DFESTATUS_SWITCHINGSTATE_Switching, /**< Switching state Switching. */
609 NRF_RADIO_DFE_SWITCH_STATE_ENDING = RADIO_DFESTATUS_SWITCHINGSTATE_Ending, /**< Switching state Ending. */
610 } nrf_radio_dfe_switch_state_t;
611
612 /** @brief States of Direction Finding sampling state machine. */
613 typedef enum
614 {
615 NRF_RADIO_DFE_SAMPLE_STATE_IDLE = RADIO_DFESTATUS_SAMPLINGSTATE_Idle, /**< Sampling state Idle. */
616 NRF_RADIO_DFE_SAMPLE_STATE_SAMPLING = RADIO_DFESTATUS_SAMPLINGSTATE_Sampling, /**< Sampling state Sampling. */
617 } nrf_radio_dfe_sample_state_t;
618 #endif
619
620 #if defined(RADIO_CTEINLINECONF_S0CONF_Msk) || defined(__NRFX_DOXYGEN__)
621 /** @brief Valid ranges of CTE time, expressed in 8 us units. */
622 typedef enum
623 {
624 NRF_RADIO_CTEINLINE_TIME_RANGE_20 = RADIO_CTEINLINECONF_CTETIMEVALIDRANGE_20, /**< 20 units time range. */
625 NRF_RADIO_CTEINLINE_TIME_RANGE_31 = RADIO_CTEINLINECONF_CTETIMEVALIDRANGE_31, /**< 31 units time range. */
626 NRF_RADIO_CTEINLINE_TIME_RANGE_63 = RADIO_CTEINLINECONF_CTETIMEVALIDRANGE_63, /**< 63 units time range. */
627 } nrf_radio_cteinline_time_range_t;
628
629 /** @brief Spacing between samples for the samples in the switching period. */
630 typedef enum
631 {
632 NRF_RADIO_CTEINLINE_RX_MODE_125NS = RADIO_CTEINLINECONF_CTEINLINERXMODE1US_125ns, /**< 125 ns spacing. */
633 NRF_RADIO_CTEINLINE_RX_MODE_250NS = RADIO_CTEINLINECONF_CTEINLINERXMODE1US_250ns, /**< 250 ns spacing. */
634 NRF_RADIO_CTEINLINE_RX_MODE_500NS = RADIO_CTEINLINECONF_CTEINLINERXMODE1US_500ns, /**< 500 ns spacing. */
635 NRF_RADIO_CTEINLINE_RX_MODE_1US = RADIO_CTEINLINECONF_CTEINLINERXMODE1US_1us, /**< 1 us spacing. */
636 NRF_RADIO_CTEINLINE_RX_MODE_2US = RADIO_CTEINLINECONF_CTEINLINERXMODE1US_2us, /**< 2 us spacing. */
637 NRF_RADIO_CTEINLINE_RX_MODE_4US = RADIO_CTEINLINECONF_CTEINLINERXMODE1US_4us, /**< 4 us spacing. */
638 } nrf_radio_cteinline_rx_mode_t;
639
640 /** @brief Configuration for CTE inline mode */
641 typedef struct
642 {
643 bool enable; /**< Enable or disable parsing of CTEInfo from received packet. */
644 bool info_in_s1; /**< Indicates whether CTEInfo is in S1 byte or not. */
645 bool err_handling; /**< Enable or disable switching and sampling when CRC is not OK. */
646 nrf_radio_cteinline_time_range_t time_range; /**< Maximum range of CTE time. */
647 nrf_radio_cteinline_rx_mode_t rx1us; /**< Spacing between samples during switching period for AoD 1 us. */
648 nrf_radio_cteinline_rx_mode_t rx2us; /**< Spacing between samples during switching period for AoD 2 us or AoA 4 us. */
649 uint8_t s0_pattern; /**< S0 bit pattern to match. */
650 uint8_t s0_mask; /**< S0 bit mask to set which bit to match. */
651 } nrf_radio_cteinline_conf_t;
652 #endif // defined(RADIO_CTEINLINECONF_S0CONF_Msk) || defined(__NRFX_DOXYGEN__)
653
654 #if defined(RADIO_DFECTRL1_NUMBEROF8US_Msk) || defined(__NRFX_DOXYGEN__)
655 /** @brief State when CTE extension is added and antenna switching/sampling is done. */
656 typedef enum
657 {
658 NRF_RADIO_DFECTRL_EXTENSION_CRC = RADIO_DFECTRL1_DFEINEXTENSION_CRC, /**< AoA/AoD procedure triggered at end of CRC. */
659 NRF_RADIO_DFECTRL_EXTENSION_PAYLOAD = RADIO_DFECTRL1_DFEINEXTENSION_Payload, /**< Antenna switching/sampling done in the packet payload. */
660 } nrf_radio_dfectrl_extension_t;
661
662 /** @brief Interval between antenna changes in the switching state. */
663 typedef enum
664 {
665 NRF_RADIO_DFECTRL_SWITCH_SPACING_1US = RADIO_DFECTRL1_TSWITCHSPACING_1us, /**< 1 us interval between antenna change. */
666 NRF_RADIO_DFECTRL_SWITCH_SPACING_2US = RADIO_DFECTRL1_TSWITCHSPACING_2us, /**< 2 us interval between antenna change. */
667 NRF_RADIO_DFECTRL_SWITCH_SPACING_4US = RADIO_DFECTRL1_TSWITCHSPACING_4us, /**< 4 us interval between antenna change. */
668 } nrf_radio_dfectrl_switch_spacing_t;
669
670 /** @brief Interval between samples. */
671 typedef enum
672 {
673 NRF_RADIO_DFECTRL_SAMPLE_SPACING_125NS = RADIO_DFECTRL1_TSAMPLESPACING_125ns, /**< 125 ns interval between samples. */
674 NRF_RADIO_DFECTRL_SAMPLE_SPACING_250NS = RADIO_DFECTRL1_TSAMPLESPACING_250ns, /**< 250 ns interval between samples. */
675 NRF_RADIO_DFECTRL_SAMPLE_SPACING_500NS = RADIO_DFECTRL1_TSAMPLESPACING_500ns, /**< 500 ns interval between samples. */
676 NRF_RADIO_DFECTRL_SAMPLE_SPACING_1US = RADIO_DFECTRL1_TSAMPLESPACING_1us, /**< 1 us interval between samples. */
677 NRF_RADIO_DFECTRL_SAMPLE_SPACING_2US = RADIO_DFECTRL1_TSAMPLESPACING_2us, /**< 2 us interval between samples. */
678 NRF_RADIO_DFECTRL_SAMPLE_SPACING_4US = RADIO_DFECTRL1_TSAMPLESPACING_4us, /**< 4 us interval between samples. */
679 } nrf_radio_dfectrl_sample_spacing_t;
680
681 /** @brief Direction finding sample type. */
682 typedef enum
683 {
684 NRF_RADIO_DFECTRL_SAMPLE_TYPE_IQ = RADIO_DFECTRL1_SAMPLETYPE_IQ, /**< Complex samples in I and Q. */
685 NRF_RADIO_DFECTRL_SAMPLE_TYPE_MAGPHASE = RADIO_DFECTRL1_SAMPLETYPE_MagPhase, /**< Complex samples as magnitude and phase. */
686 } nrf_radio_dfectrl_sample_type_t;
687
688 /** @brief Direction finding configuration. */
689 typedef struct
690 {
691 uint8_t dfe_len; /**< Length of the AoA/AoD procedure in number of 8 µs units. */
692 nrf_radio_dfectrl_extension_t extension; /**< State in which CTE extension is added and antenna switching/sampling is done. */
693 nrf_radio_dfectrl_switch_spacing_t switch_spacing; /**< Interval between antenna changes in the switching state. */
694 nrf_radio_dfectrl_sample_spacing_t spacing_ref; /**< Interval between samples in the reference period. */
695 nrf_radio_dfectrl_sample_type_t sample_type; /**< Indicates whether to sample I/Q or magnitude/phase. */
696 nrf_radio_dfectrl_sample_spacing_t sample_spacing; /**< Interval between samples in the switching period. */
697 #if defined(RADIO_DFECTRL1_REPEATPATTERN_Msk)
698 uint8_t repeat_pattern; /**< Number of times antenna pattern should be repeated. */
699 #endif
700 uint8_t gain_steps; /**< Number of gain steps lowering the total gain at the start of CTE . */
701 int16_t switch_offset; /**< Signed value offset after the end of the CRC before starting switching expressed in 16 Mhz cycles. */
702 int16_t sample_offset; /**< Signed value offset before starting sampling expressed in 16 Mhz cycles
703 * relative to the beginning of the reference state. */
704 } nrf_radio_dfectrl_conf_t;
705 #endif // defined(RADIO_DFECTRL1_NUMBEROF8US_Msk) || defined(__NRFX_DOXYGEN__)
706
707 /**
708 * @brief Function for activating a specific RADIO task.
709 *
710 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
711 * @param[in] task Task to be activated.
712 */
713 NRF_STATIC_INLINE void nrf_radio_task_trigger(NRF_RADIO_Type * p_reg, nrf_radio_task_t task);
714
715 /**
716 * @brief Function for getting the address of a specific RADIO task register.
717 *
718 * This function can be used by the PPI module.
719 *
720 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
721 * @param[in] task Requested task.
722 *
723 * @return Address of the specified task register.
724 */
725 NRF_STATIC_INLINE uint32_t nrf_radio_task_address_get(NRF_RADIO_Type const * p_reg,
726 nrf_radio_task_t task);
727
728 /**
729 * @brief Function for clearing a specific RADIO event.
730 *
731 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
732 * @param[in] event Event to clean.
733 */
734 NRF_STATIC_INLINE void nrf_radio_event_clear(NRF_RADIO_Type * p_reg, nrf_radio_event_t event);
735
736 /**
737 * @brief Function for retrieving the state of the RADIO event.
738 *
739 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
740 * @param[in] event Event to be checked.
741 *
742 * @retval true The event has been generated.
743 * @retval false The event has not been generated.
744 */
745 NRF_STATIC_INLINE bool nrf_radio_event_check(NRF_RADIO_Type const * p_reg, nrf_radio_event_t event);
746
747 /**
748 * @brief Function for getting the address of a specific RADIO event register.
749 *
750 * This function can be used by the PPI module.
751 *
752 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
753 * @param[in] event Requested Event.
754 *
755 * @return Address of the specified event register.
756 */
757 NRF_STATIC_INLINE uint32_t nrf_radio_event_address_get(NRF_RADIO_Type const * p_reg,
758 nrf_radio_event_t event);
759
760 /**
761 * @brief Function for enabling specified RADIO shortcuts.
762 *
763 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
764 * @param[in] shorts_mask Mask of shortcuts.
765 */
766 NRF_STATIC_INLINE void nrf_radio_shorts_enable(NRF_RADIO_Type * p_reg, uint32_t shorts_mask);
767
768 /**
769 * @brief Function for disabling specified RADIO shortcuts.
770 *
771 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
772 * @param[in] shorts_mask Mask of shortcuts.
773 */
774 NRF_STATIC_INLINE void nrf_radio_shorts_disable(NRF_RADIO_Type * p_reg, uint32_t shorts_mask);
775
776 /**
777 * @brief Function for setting the configuration of RADIO shortcuts.
778 *
779 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
780 * @param[in] shorts_mask Shortcuts configuration to set.
781 */
782 NRF_STATIC_INLINE void nrf_radio_shorts_set(NRF_RADIO_Type * p_reg, uint32_t shorts_mask);
783
784 /**
785 * @brief Function for getting the configuration of RADIO shortcuts.
786 *
787 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
788 *
789 * @return Mask of currently enabled shortcuts.
790 */
791 NRF_STATIC_INLINE uint32_t nrf_radio_shorts_get(NRF_RADIO_Type const * p_reg);
792
793 /**
794 * @brief Function for enabling specified RADIO interrupts.
795 *
796 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
797 * @param[in] mask Mask of interrupts to be enabled.
798 * Use @ref nrf_radio_int_mask_t values for bit masking.
799 */
800 NRF_STATIC_INLINE void nrf_radio_int_enable(NRF_RADIO_Type * p_reg, uint32_t mask);
801
802 /**
803 * @brief Function for disabling specified RADIO interrupts.
804 *
805 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
806 * @param[in] mask Mask of interrupts to be disabled.
807 * Use @ref nrf_radio_int_mask_t values for bit masking.
808 */
809 NRF_STATIC_INLINE void nrf_radio_int_disable(NRF_RADIO_Type * p_reg, uint32_t mask);
810
811 /**
812 * @brief Function for checking if the specified interrupts are enabled.
813 *
814 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
815 * @param[in] mask Mask of interrupts to be checked.
816 * Use @ref nrf_radio_int_mask_t values for bit masking.
817 *
818 * @return Mask of enabled interrupts.
819 */
820 NRF_STATIC_INLINE uint32_t nrf_radio_int_enable_check(NRF_RADIO_Type const * p_reg, uint32_t mask);
821
822 #if defined(DPPI_PRESENT) || defined(__NRFX_DOXYGEN__)
823 /**
824 * @brief Function for setting the subscribe configuration for a given
825 * RADIO task.
826 *
827 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
828 * @param[in] task Task for which to set the configuration.
829 * @param[in] channel Channel through which to subscribe events.
830 */
831 NRF_STATIC_INLINE void nrf_radio_subscribe_set(NRF_RADIO_Type * p_reg,
832 nrf_radio_task_t task,
833 uint8_t channel);
834
835 /**
836 * @brief Function for clearing the subscribe configuration for a given
837 * RADIO task.
838 *
839 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
840 * @param[in] task Task for which to clear the configuration.
841 */
842 NRF_STATIC_INLINE void nrf_radio_subscribe_clear(NRF_RADIO_Type * p_reg,
843 nrf_radio_task_t task);
844
845 /**
846 * @brief Function for setting the publish configuration for a given
847 * RADIO event.
848 *
849 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
850 * @param[in] event Event for which to set the configuration.
851 * @param[in] channel Channel through which to publish the event.
852 */
853 NRF_STATIC_INLINE void nrf_radio_publish_set(NRF_RADIO_Type * p_reg,
854 nrf_radio_event_t event,
855 uint8_t channel);
856
857 /**
858 * @brief Function for clearing the publish configuration for a given
859 * RADIO event.
860 *
861 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
862 * @param[in] event Event for which to clear the configuration.
863 */
864 NRF_STATIC_INLINE void nrf_radio_publish_clear(NRF_RADIO_Type * p_reg,
865 nrf_radio_event_t event);
866 #endif // defined(DPPI_PRESENT) || defined(__NRFX_DOXYGEN__)
867
868 /**
869 * @brief Function for getting CRC status of last received packet.
870 *
871 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
872 *
873 * @retval true The packet was received without CRC error.
874 * @retval false The packet was received with CRC error.
875 */
876 NRF_STATIC_INLINE bool nrf_radio_crc_status_check(NRF_RADIO_Type const * p_reg);
877
878 /**
879 * @brief Function for getting the received address.
880 *
881 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
882 *
883 * @return Received address.
884 */
885 NRF_STATIC_INLINE uint8_t nrf_radio_rxmatch_get(NRF_RADIO_Type const * p_reg);
886
887 /**
888 * @brief Function for getting CRC field of the last received packet.
889 *
890 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
891 *
892 * @return CRC field of previously received packet.
893 */
894 NRF_STATIC_INLINE uint32_t nrf_radio_rxcrc_get(NRF_RADIO_Type const * p_reg);
895
896 /**
897 * @brief Function for getting the device address match index.
898 *
899 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
900 *
901 * @return Device adress match index.
902 */
903 NRF_STATIC_INLINE uint8_t nrf_radio_dai_get(NRF_RADIO_Type const * p_reg);
904
905 #if defined(RADIO_PDUSTAT_PDUSTAT_Msk) || defined(__NRFX_DOXYGEN__)
906 /**
907 * @brief Function for getting status on payload length.
908 *
909 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
910 *
911 * @retval 0 The payload is lesser than PCNF1.MAXLEN.
912 * @retval 1 The payload is greater than PCNF1.MAXLEN.
913 */
914 NRF_STATIC_INLINE uint8_t nrf_radio_pdustat_get(NRF_RADIO_Type const * p_reg);
915 #endif // defined(RADIO_PDUSTAT_PDUSTAT_Msk) || defined(__NRFX_DOXYGEN__)
916
917 #if defined(RADIO_PDUSTAT_CISTAT_Msk) || defined(__NRFX_DOXYGEN__)
918 /**
919 * @brief Function for getting status on what rate packet is received with in Long Range.
920 *
921 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
922 *
923 * @retval 0 The frame is received at 125kbps.
924 * @retval 1 The frame is received at 500kbps.
925 */
926 NRF_STATIC_INLINE uint8_t nrf_radio_cistat_get(NRF_RADIO_Type const * p_reg);
927 #endif // defined(RADIO_PDUSTAT_CISTAT_Msk) || defined(__NRFX_DOXYGEN__)
928
929 /**
930 * @brief Function for setting packet pointer to given location in memory.
931 *
932 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
933 * @param[in] p_packet Packet pointer.
934 */
935 NRF_STATIC_INLINE void nrf_radio_packetptr_set(NRF_RADIO_Type * p_reg, void const * p_packet);
936
937 /**
938 * @brief Function for getting packet pointer.
939 *
940 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
941 *
942 * @return Pointer to tx or rx packet buffer.
943 */
944 NRF_STATIC_INLINE void * nrf_radio_packetptr_get(NRF_RADIO_Type const * p_reg);
945
946 /**
947 * @brief Function for setting the radio frequency.
948 *
949 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
950 * @param[in] radio_frequency Frequency in MHz.
951 */
952 NRF_STATIC_INLINE void nrf_radio_frequency_set(NRF_RADIO_Type * p_reg, uint16_t radio_frequency);
953
954 /**
955 * @brief Function for getting the radio frequency.
956 *
957 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
958 *
959 * @return Frequency in MHz.
960 */
961 NRF_STATIC_INLINE uint16_t nrf_radio_frequency_get(NRF_RADIO_Type const * p_reg);
962
963 /**
964 * @brief Function for setting the radio transmit power.
965 *
966 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
967 * @param[in] tx_power Transmit power of the radio [dBm].
968 */
969 NRF_STATIC_INLINE void nrf_radio_txpower_set(NRF_RADIO_Type * p_reg, nrf_radio_txpower_t tx_power);
970
971 /**
972 * @brief Function for getting the radio transmit power.
973 *
974 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
975 *
976 * @return Transmit power of the radio.
977 */
978 NRF_STATIC_INLINE nrf_radio_txpower_t nrf_radio_txpower_get(NRF_RADIO_Type const * p_reg);
979
980 /**
981 * @brief Function for setting the radio data rate and modulation settings.
982 *
983 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
984 * @param[in] radio_mode Radio data rate and modulation.
985 */
986 NRF_STATIC_INLINE void nrf_radio_mode_set(NRF_RADIO_Type * p_reg, nrf_radio_mode_t radio_mode);
987
988 /**
989 * @brief Function for getting Radio data rate and modulation settings.
990 *
991 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
992 *
993 * @return Radio data rate and modulation.
994 */
995 NRF_STATIC_INLINE nrf_radio_mode_t nrf_radio_mode_get(NRF_RADIO_Type const * p_reg);
996
997 /**
998 * @brief Function for setting the packet configuration.
999 *
1000 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1001 * @param[in] p_config Pointer to the structure with packet configuration.
1002 */
1003 NRF_STATIC_INLINE void nrf_radio_packet_configure(NRF_RADIO_Type * p_reg,
1004 nrf_radio_packet_conf_t const * p_config);
1005
1006 /**
1007 * @brief Function for setting the base address 0.
1008 *
1009 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1010 * @param[in] address Base address 0 value.
1011 */
1012 NRF_STATIC_INLINE void nrf_radio_base0_set(NRF_RADIO_Type * p_reg, uint32_t address);
1013
1014 /**
1015 * @brief Function for getting the base address 0.
1016 *
1017 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1018 *
1019 * @return Base address 0.
1020 */
1021 NRF_STATIC_INLINE uint32_t nrf_radio_base0_get(NRF_RADIO_Type const * p_reg);
1022
1023 /**
1024 * @brief Function for setting Base address 1.
1025 *
1026 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1027 * @param[in] address Base address 1 value.
1028 */
1029 NRF_STATIC_INLINE void nrf_radio_base1_set(NRF_RADIO_Type * p_reg, uint32_t address);
1030
1031 /**
1032 * @brief Function for getting base address 1.
1033 *
1034 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1035 *
1036 * @return Base address 1.
1037 */
1038 NRF_STATIC_INLINE uint32_t nrf_radio_base1_get(NRF_RADIO_Type const * p_reg);
1039
1040 /**
1041 * @brief Function for setting prefixes bytes for logical addresses 0-3.
1042 *
1043 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1044 * @param[in] prefixes Prefixes bytes for logical addresses 0-3.
1045 */
1046 NRF_STATIC_INLINE void nrf_radio_prefix0_set(NRF_RADIO_Type * p_reg, uint32_t prefixes);
1047
1048 /**
1049 * @brief Function for getting prefixes bytes for logical addresses 0-3
1050 *
1051 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1052 *
1053 * @return Prefixes bytes for logical addresses 0-3
1054 */
1055 NRF_STATIC_INLINE uint32_t nrf_radio_prefix0_get(NRF_RADIO_Type const * p_reg);
1056
1057 /**
1058 * @brief Function for setting prefixes bytes for logical addresses 4-7.
1059 *
1060 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1061 * @param[in] prefixes Prefixes bytes for logical addresses 4-7.
1062 */
1063 NRF_STATIC_INLINE void nrf_radio_prefix1_set(NRF_RADIO_Type * p_reg, uint32_t prefixes);
1064
1065 /**
1066 * @brief Function for getting prefixes bytes for logical addresses 4-7
1067 *
1068 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1069 *
1070 * @return Prefixes bytes for logical addresses 4-7
1071 */
1072 NRF_STATIC_INLINE uint32_t nrf_radio_prefix1_get(NRF_RADIO_Type const * p_reg);
1073
1074 /**
1075 * @brief Function for setting the transmit address.
1076 *
1077 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1078 * @param[in] txaddress Logical address to be used when transmitting a packet.
1079 */
1080 NRF_STATIC_INLINE void nrf_radio_txaddress_set(NRF_RADIO_Type * p_reg, uint8_t txaddress);
1081
1082 /**
1083 * @brief Function for getting the transmit address select.
1084 *
1085 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1086 *
1087 * @return Logical address to be used when transmitting a packet.
1088 */
1089 NRF_STATIC_INLINE uint8_t nrf_radio_txaddress_get(NRF_RADIO_Type const * p_reg);
1090
1091 /**
1092 * @brief Function for for selecting the receive addresses.
1093 *
1094 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1095 * @param[in] rxaddresses Enable or disable reception on logical address i.
1096 * Read more in the Product Specification.
1097 */
1098 NRF_STATIC_INLINE void nrf_radio_rxaddresses_set(NRF_RADIO_Type * p_reg, uint8_t rxaddresses);
1099
1100 /**
1101 * @brief Function for getting receive address select.
1102 *
1103 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1104 *
1105 * @return Receive address select.
1106 */
1107 NRF_STATIC_INLINE uint8_t nrf_radio_rxaddresses_get(NRF_RADIO_Type const * p_reg);
1108
1109 /**
1110 * @brief Function for configure CRC.
1111 *
1112 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1113 * @param[in] crc_length CRC length in number of bytes [0-3].
1114 * @param[in] crc_address Include or exclude packet address field out of CRC.
1115 * @param[in] crc_polynominal CRC polynominal to set.
1116 */
1117 NRF_STATIC_INLINE void nrf_radio_crc_configure(NRF_RADIO_Type * p_reg,
1118 uint8_t crc_length,
1119 nrf_radio_crc_addr_t crc_address,
1120 uint32_t crc_polynominal);
1121
1122 /**
1123 * @brief Function for setting CRC initial value.
1124 *
1125 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1126 * @param[in] crc_init_value CRC initial value
1127 */
1128 NRF_STATIC_INLINE void nrf_radio_crcinit_set(NRF_RADIO_Type * p_reg, uint32_t crc_init_value);
1129
1130 /**
1131 * @brief Function for getting CRC initial value.
1132 *
1133 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1134 *
1135 * @return CRC initial value.
1136 */
1137 NRF_STATIC_INLINE uint32_t nrf_radio_crcinit_get(NRF_RADIO_Type const * p_reg);
1138
1139 /**
1140 * @brief Function for setting Inter Frame Spacing interval.
1141 *
1142 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1143 * @param[in] radio_ifs Inter frame spacing interval [us].
1144 */
1145 NRF_STATIC_INLINE void nrf_radio_ifs_set(NRF_RADIO_Type * p_reg, uint32_t radio_ifs);
1146
1147 /**
1148 * @brief Function for getting Inter Frame Spacing interval.
1149 *
1150 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1151 *
1152 * @return Inter frame spacing interval [us].
1153 */
1154 NRF_STATIC_INLINE uint32_t nrf_radio_ifs_get(NRF_RADIO_Type const * p_reg);
1155
1156 /**
1157 * @brief Function for getting RSSI sample result.
1158 *
1159 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1160 *
1161 * @note The read value is a positive value while the actual received signal
1162 * is a negative value. Actual received signal strength is therefore as follows:
1163 * received signal strength = - read_value dBm .
1164 *
1165 * @return RSSI sample result.
1166 */
1167 NRF_STATIC_INLINE uint8_t nrf_radio_rssi_sample_get(NRF_RADIO_Type const * p_reg);
1168
1169 /**
1170 * @brief Function for getting the current state of the radio module.
1171 *
1172 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1173 *
1174 * @return Current radio state.
1175 */
1176 NRF_STATIC_INLINE nrf_radio_state_t nrf_radio_state_get(NRF_RADIO_Type const * p_reg);
1177
1178 /**
1179 * @brief Function for setting the data whitening initial value.
1180 *
1181 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1182 * @param[in] datawhiteiv Data whitening initial value.
1183 */
1184 NRF_STATIC_INLINE void nrf_radio_datawhiteiv_set(NRF_RADIO_Type * p_reg, uint16_t datawhiteiv);
1185
1186 /**
1187 * @brief Function for getting the data whitening initial value.
1188 *
1189 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1190 *
1191 * @return Data whitening initial value.
1192 */
1193 NRF_STATIC_INLINE uint16_t nrf_radio_datawhiteiv_get(NRF_RADIO_Type const * p_reg);
1194
1195 #if NRF_RADIO_HAS_DATAWHITE
1196 /**
1197 * @brief Function for setting the data whitening polynomial.
1198 *
1199 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1200 * @param[in] poly Data whitening polynomial.
1201 */
1202 NRF_STATIC_INLINE void nrf_radio_datawhite_poly_set(NRF_RADIO_Type * p_reg, uint16_t poly);
1203
1204 /**
1205 * @brief Function for getting the data whitening polynomial.
1206 *
1207 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1208 *
1209 * @return Data whitening polynomial.
1210 */
1211 NRF_STATIC_INLINE uint16_t nrf_radio_datawhite_poly_get(NRF_RADIO_Type const * p_reg);
1212 #endif
1213
1214 /**
1215 * @brief Function for setting Bit counter compare.
1216 *
1217 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1218 * @param[in] radio_bcc Bit counter compare [bits].
1219 */
1220 NRF_STATIC_INLINE void nrf_radio_bcc_set(NRF_RADIO_Type * p_reg, uint32_t radio_bcc);
1221
1222 /**
1223 * @brief Function for getting Bit counter compare.
1224 *
1225 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1226 *
1227 * @return Bit counter compare.
1228 */
1229 NRF_STATIC_INLINE uint32_t nrf_radio_bcc_get(NRF_RADIO_Type const * p_reg);
1230
1231 /**
1232 * @brief Function for setting Device address base segment.
1233 *
1234 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1235 * @param[in] dab_value Particular base segment value.
1236 * @param[in] segment Index of the particular Device address base segment register.
1237 */
1238 NRF_STATIC_INLINE void nrf_radio_dab_set(NRF_RADIO_Type * p_reg,
1239 uint32_t dab_value,
1240 uint8_t segment);
1241
1242 /**
1243 * @brief Function for getting Device address base segment.
1244 *
1245 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1246 * @param[in] segment Number of the Device address base segment.
1247 *
1248 * @return Particular segment of the Device address base.
1249 */
1250 NRF_STATIC_INLINE uint32_t nrf_radio_dab_get(NRF_RADIO_Type const * p_reg, uint8_t segment);
1251
1252 /**
1253 * @brief Function for setting device address prefix.
1254 *
1255 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1256 * @param[in] dap_value Particular device address prefix value.
1257 * @param[in] prefix_index Index of the particular device address prefix register.
1258 */
1259 NRF_STATIC_INLINE void nrf_radio_dap_set(NRF_RADIO_Type * p_reg,
1260 uint16_t dap_value,
1261 uint8_t prefix_index);
1262
1263 /**
1264 * @brief Function for getting Device address prefix.
1265 *
1266 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1267 * @param[in] prefix_index Number of the Device address prefix segment.
1268 *
1269 * @return Particular segment of the Device address prefix.
1270 */
1271 NRF_STATIC_INLINE uint32_t nrf_radio_dap_get(NRF_RADIO_Type const * p_reg, uint8_t prefix_index);
1272
1273 /**
1274 * @brief Function for setting device address match configuration.
1275 *
1276 * @note Read more about configuring device address match in the Product Specification.
1277 *
1278 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1279 * @param[in] ena Device address matching bitmask.
1280 * @param[in] txadd TxAdd bitmask.
1281 */
1282 NRF_STATIC_INLINE void nrf_radio_dacnf_set(NRF_RADIO_Type * p_reg, uint8_t ena, uint8_t txadd);
1283
1284 /**
1285 * @brief Function for getting ENA field of the Device address match configuration register.
1286 *
1287 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1288 *
1289 * @return ENA field of the Device address match configuration register.
1290 */
1291 NRF_STATIC_INLINE uint8_t nrf_radio_dacnf_ena_get(NRF_RADIO_Type const * p_reg);
1292
1293 /**
1294 * @brief Function for getting TXADD field of the Device address match configuration register.
1295 *
1296 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1297 *
1298 * @return TXADD field of the Device address match configuration register.
1299 */
1300 NRF_STATIC_INLINE uint8_t nrf_radio_dacnf_txadd_get(NRF_RADIO_Type const * p_reg);
1301
1302 #if defined(RADIO_INTENSET_MHRMATCH_Msk) || defined(RADIO_INTENSET00_MHRMATCH_Msk) || \
1303 defined(__NRFX_DOXYGEN__)
1304 /**
1305 * @brief Function for setting MAC Header Match Unit search pattern configuration.
1306 *
1307 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1308 * @param[in] radio_mhmu_search_pattern Search Pattern Configuration.
1309 */
1310 NRF_STATIC_INLINE
1311 void nrf_radio_mhmu_search_pattern_set(NRF_RADIO_Type * p_reg,
1312 uint32_t radio_mhmu_search_pattern);
1313
1314 /**
1315 * @brief Function for getting MAC Header Match Unit search pattern configuration.
1316 *
1317 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1318 *
1319 * @return Search Pattern Configuration.
1320 */
1321 NRF_STATIC_INLINE uint32_t nrf_radio_mhmu_search_pattern_get(NRF_RADIO_Type const * p_reg);
1322
1323 /**
1324 * @brief Function for setting MAC Header Match Unit pattern mask configuration.
1325 *
1326 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1327 * @param[in] radio_mhmu_pattern_mask Pattern mask.
1328 */
1329 NRF_STATIC_INLINE void nrf_radio_mhmu_pattern_mask_set(NRF_RADIO_Type * p_reg,
1330 uint32_t radio_mhmu_pattern_mask);
1331
1332 /**
1333 * @brief Function for getting MAC Header Match Unit pattern mask configuration.
1334 *
1335 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1336 *
1337 * @return Pattern mask.
1338 */
1339 NRF_STATIC_INLINE uint32_t nrf_radio_mhmu_pattern_mask_get(NRF_RADIO_Type const * p_reg);
1340 #endif // defined(RADIO_INTENSET_MHRMATCH_Msk) || defined(RADIO_INTENSET00_MHRMATCH_Msk) ||
1341 // defined(__NRFX_DOXYGEN__)
1342
1343 #if defined(RADIO_MODECNF0_RU_Msk) || defined(__NRFX_DOXYGEN__)
1344 /**
1345 * @brief Function for setting Radio mode configuration register 0.
1346 *
1347 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1348 * @param[in] fast_ramp_up Use fast radio ramp-up time
1349 * @param[in] default_tx Default TX value during inactivity.
1350 */
1351 NRF_STATIC_INLINE void nrf_radio_modecnf0_set(NRF_RADIO_Type * p_reg,
1352 bool fast_ramp_up,
1353 uint8_t default_tx);
1354
1355 /**
1356 * @brief Function for getting ramp-up time configuration of the Radio mode configuration register 0.
1357 *
1358 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1359 *
1360 * @retval true If the ramp-up time is set to fast.
1361 * @retval false If the ramp-up time is set to default.
1362 */
1363 NRF_STATIC_INLINE bool nrf_radio_modecnf0_ru_get(NRF_RADIO_Type const * p_reg);
1364
1365 /**
1366 * @brief Function for getting default TX value of the Radio mode configuration register 0.
1367 *
1368 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1369 *
1370 * @return Default TX value.
1371 */
1372 NRF_STATIC_INLINE uint8_t nrf_radio_modecnf0_dtx_get(NRF_RADIO_Type const * p_reg);
1373 #endif // defined(RADIO_MODECNF0_RU_Msk) || defined(__NRFX_DOXYGEN__)
1374
1375 #if defined(RADIO_MODECNF0_RU_Msk) || defined(RADIO_TIMING_RU_Msk) || defined(__NRFX_DOXYGEN__)
1376 /**
1377 * @brief Function for enabling or disabling fast ramp-up setting.
1378 *
1379 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1380 * @param[in] enable True if fast ramp-up is to be enabled, false otherwise.
1381 */
1382 NRF_STATIC_INLINE void nrf_radio_fast_ramp_up_enable_set(NRF_RADIO_Type * p_reg, bool enable);
1383
1384 /**
1385 * @brief Function for checking fast ramp-up time configuration.
1386 *
1387 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1388 *
1389 * @return true If the ramp-up time is set to fast.
1390 * @return false If the ramp-up time is set to default compatible with 180nm radio.
1391 */
1392 NRF_STATIC_INLINE bool nrf_radio_fast_ramp_up_check(NRF_RADIO_Type const * p_reg);
1393 #endif
1394
1395 #if defined(RADIO_SFD_SFD_Msk) || defined(__NRFX_DOXYGEN__)
1396 /**
1397 * @brief Function for setting IEEE 802.15.4 start of frame delimiter.
1398 *
1399 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1400 * @param[in] sfd IEEE 802.15.4 start of frame delimiter.
1401 */
1402 NRF_STATIC_INLINE void nrf_radio_sfd_set(NRF_RADIO_Type * p_reg, uint8_t sfd);
1403
1404 /**
1405 * @brief Function for getting IEEE 802.15.4 start of frame delimiter.
1406 *
1407 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1408 *
1409 * @return IEEE 802.15.4 start of frame delimiter.
1410 */
1411 NRF_STATIC_INLINE uint8_t nrf_radio_sfd_get(NRF_RADIO_Type const * p_reg);
1412 #endif // defined(RADIO_SFD_SFD_Msk) || defined(__NRFX_DOXYGEN__)
1413
1414 #if defined(RADIO_EDCNT_EDCNT_Msk) || defined(RADIO_EDCTRL_EDCNT_Msk) || defined(__NRFX_DOXYGEN__)
1415 /**
1416 * @brief Function for setting number of iterations to perform ED scan.
1417 *
1418 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1419 * @param[in] ed_loop_count Number of iterations during ED procedure.
1420 */
1421 NRF_STATIC_INLINE void nrf_radio_ed_loop_count_set(NRF_RADIO_Type * p_reg, uint32_t ed_loop_count);
1422 #endif // defined(RADIO_EDCNT_EDCNT_Msk) || defined(RADIO_EDCTRL_EDCNT_Msk) || defined(__NRFX_DOXYGEN__)
1423
1424 #if defined(RADIO_EDCTRL_EDPERIOD_Msk) || defined(__NRFX_DOXYGEN__)
1425 /**
1426 * @brief Function for setting the period of a ED/CCA iteration.
1427 *
1428 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1429 * @param[in] ed_period Duration of a single ED/CCA iteration.
1430 */
1431 NRF_STATIC_INLINE void nrf_radio_ed_cca_period_set(NRF_RADIO_Type * p_reg, uint8_t ed_period);
1432 #endif // defined(RADIO_EDCTRL_EDPERIOD_Msk) || defined(__NRFX_DOXYGEN__)
1433
1434 #if defined(RADIO_EDSAMPLE_EDLVL_Msk) || defined(__NRFX_DOXYGEN__)
1435 /**
1436 * @brief Function for getting Energy Detection level.
1437 *
1438 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1439 *
1440 * @return IEEE 802.15.4 energy detect level.
1441 */
1442 NRF_STATIC_INLINE uint8_t nrf_radio_ed_sample_get(NRF_RADIO_Type const * p_reg);
1443 #endif // defined(RADIO_EDSAMPLE_EDLVL_Msk) || defined(__NRFX_DOXYGEN__)
1444
1445 #if defined(RADIO_CCACTRL_CCAMODE_Msk) || defined(__NRFX_DOXYGEN__)
1446 /**
1447 * @brief Function for configuring the IEEE 802.15.4 clear channel assessment.
1448 *
1449 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1450 * @param[in] cca_mode Mode of CCA.
1451 * @param[in] cca_ed_threshold Energy Detection threshold value.
1452 * @param[in] cca_corr_threshold Correlator Busy Threshold.
1453 * @param[in] cca_corr_cnt Limit of occurances above Correlator Threshold.
1454 * When not equal to zero the correlator based
1455 * signal detect is enabled.
1456 */
1457 NRF_STATIC_INLINE void nrf_radio_cca_configure(NRF_RADIO_Type * p_reg,
1458 nrf_radio_cca_mode_t cca_mode,
1459 uint8_t cca_ed_threshold,
1460 uint8_t cca_corr_threshold,
1461 uint8_t cca_corr_cnt);
1462 #endif // defined(RADIO_CCACTRL_CCAMODE_Msk) || defined(__NRFX_DOXYGEN__)
1463
1464 #if defined(RADIO_POWER_POWER_Msk) || defined(__NRFX_DOXYGEN__)
1465 /**
1466 * @brief Function for setting power mode of the radio peripheral.
1467 *
1468 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1469 * @param[in] radio_power If radio should be powered on.
1470 */
1471 NRF_STATIC_INLINE void nrf_radio_power_set(NRF_RADIO_Type * p_reg, bool radio_power);
1472 #endif // defined(RADIO_POWER_POWER_Msk) || defined(__NRFX_DOXYGEN__)
1473
1474 #if defined(RADIO_CTESTATUS_CTETIME_Msk) || defined(__NRFX_DOXYGEN__)
1475 /**
1476 * @brief Function for getting the CTE time parsed from received packet.
1477 *
1478 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1479 *
1480 * @return CTE time.
1481 */
1482 NRF_STATIC_INLINE uint32_t nrf_radio_cte_time_get(NRF_RADIO_Type const * p_reg);
1483
1484 /**
1485 * @brief Function for getting the CTE type parsed from received packet.
1486 *
1487 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1488 *
1489 * @return CTE type.
1490 */
1491 NRF_STATIC_INLINE uint32_t nrf_radio_cte_type_get(NRF_RADIO_Type const * p_reg);
1492
1493 /**
1494 * @brief Function for getting the CTE RFU parsed from received packet.
1495 *
1496 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1497 *
1498 * @return CTE RFU.
1499 */
1500 NRF_STATIC_INLINE uint32_t nrf_radio_cte_rfu_get(NRF_RADIO_Type const * p_reg);
1501 #endif // defined(RADIO_CTESTATUS_CTETIME_Msk) || defined(__NRFX_DOXYGEN__)
1502
1503 #if defined(RADIO_DFESTATUS_SWITCHINGSTATE_Msk) || defined(__NRFX_DOXYGEN__)
1504 /**
1505 * @brief Function for getting the current state of DFE switching state machine.
1506 *
1507 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1508 *
1509 * @return State of switching state machine.
1510 */
1511 NRF_STATIC_INLINE
1512 nrf_radio_dfe_switch_state_t nrf_radio_dfe_switch_state_get(NRF_RADIO_Type const * p_reg);
1513
1514 /**
1515 * @brief Function for getting the current state of DFE sampling state machine.
1516 *
1517 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1518 *
1519 * @return State of sampling state machine.
1520 */
1521 NRF_STATIC_INLINE
1522 nrf_radio_dfe_sample_state_t nrf_radio_dfe_sample_state_get(NRF_RADIO_Type const * p_reg);
1523 #endif
1524
1525 #if defined(RADIO_CTEINLINECONF_S0CONF_Msk) || defined(__NRFX_DOXYGEN__)
1526 /**
1527 * @brief Function for setting the configuration of CTE inline mode.
1528 *
1529 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1530 * @param[in] p_config Pointer to the structure with CTE inline mode configuration.
1531 */
1532 NRF_STATIC_INLINE void nrf_radio_cteinline_configure(NRF_RADIO_Type * p_reg,
1533 nrf_radio_cteinline_conf_t const * p_config);
1534 #endif
1535
1536 #if defined(RADIO_DFECTRL1_NUMBEROF8US_Msk) || defined(__NRFX_DOXYGEN__)
1537 /**
1538 * @brief Function for setting the direction finding configuration.
1539 *
1540 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1541 * @param[in] p_config Pointer to the structure with direction finding configuration.
1542 */
1543 NRF_STATIC_INLINE void nrf_radio_dfectrl_configure(NRF_RADIO_Type * p_reg,
1544 nrf_radio_dfectrl_conf_t const * p_config);
1545 #endif
1546
1547 #if defined(RADIO_SWITCHPATTERN_SWITCHPATTERN_Msk) || defined(__NRFX_DOXYGEN__)
1548 /**
1549 * @brief Function for configuring the specified GPIO pin for antenna control.
1550 *
1551 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1552 * @param[in] pin Pin number.
1553 * @param[in] pos Position of the pin in the switching pattern
1554 * configured with @ref nrf_radio_dfe_pattern_add()
1555 or @ref nrf_radio_dfe_patterns_add().
1556 */
1557 NRF_STATIC_INLINE void nrf_radio_dfe_pattern_pin_set(NRF_RADIO_Type * p_reg,
1558 uint32_t pin,
1559 uint8_t pos);
1560
1561 /**
1562 * @brief Function for adding single pattern to the array of GPIO patterns for antenna control.
1563 *
1564 * The GPIO pattern array size is 40 entries. This function configures single pattern consisting of 8 pins.
1565 * To set subsequent pattern, call this function again.
1566 * To get total number of currently configured patterns use @ref nrf_radio_dfe_pattern_cnt_get().
1567 * To clear the array of GPIO patterns use @ref nrf_radio_dfe_pattern_clear().
1568 *
1569 * @warning A minimum number of 3 patterns must be written.
1570 *
1571 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1572 * @param[in] pin_mask Bitmask specifying pins to be used in this switching pattern.
1573 * Each bit corresponds to the index of the pin
1574 configured with @ref nrf_radio_dfe_pattern_pin_set().
1575 */
1576 NRF_STATIC_INLINE void nrf_radio_dfe_pattern_add(NRF_RADIO_Type * p_reg, uint8_t pin_mask);
1577
1578 /**
1579 * @brief Function for adding multiple patterns to the array of GPIO patterns for antenna control.
1580 *
1581 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1582 * @param[in] p_pin_masks Pointer to the array of bitmasks specifying pins
1583 * to be used in subsequent switching patterns.
1584 * @param[in] length Bitmask array length.
1585 *
1586 * @sa nrf_radio_dfe_pattern_add()
1587 */
1588 NRF_STATIC_INLINE void nrf_radio_dfe_patterns_add(NRF_RADIO_Type * p_reg,
1589 uint8_t const * p_pin_masks,
1590 size_t length);
1591
1592 /**
1593 * @brief Function for getting number of currently configured GPIO patterns for antenna control.
1594 *
1595 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1596 *
1597 * @return Number of patterns.
1598 */
1599 NRF_STATIC_INLINE uint32_t nrf_radio_dfe_pattern_cnt_get(NRF_RADIO_Type const * p_reg);
1600
1601 /**
1602 * @brief Function for clearing all of the currently configured GPIO patterns for antenna control.
1603 *
1604 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1605 */
1606 NRF_STATIC_INLINE void nrf_radio_dfe_pattern_clear(NRF_RADIO_Type * p_reg);
1607 #endif // defined(RADIO_SWITCHPATTERN_SWITCHPATTERN_Msk) || defined(__NRFX_DOXYGEN__)
1608
1609 #if defined(RADIO_DFEPACKET_PTR_PTR_Msk) || defined(RADIO_DFEPACKET_PTR_OFFSET_Msk) || \
1610 defined(__NRFX_DOXYGEN__)
1611 /**
1612 * @brief Function for setting the buffer for storing IQ samples or magnitude and phase pairs
1613 * of the samples.
1614 *
1615 * @note Each sample or pair is stored on a 32-bit word.
1616 *
1617 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1618 * @param[in] p_buffer Pointer to the buffer for storing IQ samples
1619 * or magnitude and phase of the samples.
1620 * @param[in] length Maximum number of samples to receive.
1621 */
1622 NRF_STATIC_INLINE void nrf_radio_dfe_buffer_set(NRF_RADIO_Type * p_reg,
1623 uint32_t * p_buffer,
1624 size_t length);
1625
1626 /**
1627 * @brief Function for getting the number of stored IQ samples or magnitude and phase pairs
1628 * of the samples during last transaction.
1629 *
1630 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1631 *
1632 * @retval Amount of samples.
1633 */
1634 NRF_STATIC_INLINE uint32_t nrf_radio_dfe_amount_get(NRF_RADIO_Type const * p_reg);
1635
1636 #if defined(RADIO_DFEPACKET_CURRENTAMOUNT_AMOUNT_Msk) || defined(__NRFX_DOXYGEN__)
1637 /**
1638 * @brief Function for getting the number of bytes transferred in the current transaction.
1639 *
1640 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
1641 *
1642 * @return Number of bytes.
1643 */
1644 NRF_STATIC_INLINE uint32_t nrf_radio_dfe_current_amount_get(NRF_RADIO_Type const * p_reg);
1645
1646 #endif
1647
1648 #endif
1649
1650 #ifndef NRF_DECLARE_ONLY
1651
nrf_radio_task_trigger(NRF_RADIO_Type * p_reg,nrf_radio_task_t task)1652 NRF_STATIC_INLINE void nrf_radio_task_trigger(NRF_RADIO_Type * p_reg, nrf_radio_task_t task)
1653 {
1654 *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
1655 }
1656
nrf_radio_task_address_get(NRF_RADIO_Type const * p_reg,nrf_radio_task_t task)1657 NRF_STATIC_INLINE uint32_t nrf_radio_task_address_get(NRF_RADIO_Type const * p_reg,
1658 nrf_radio_task_t task)
1659 {
1660 return ((uint32_t)p_reg + (uint32_t)task);
1661 }
1662
nrf_radio_event_clear(NRF_RADIO_Type * p_reg,nrf_radio_event_t event)1663 NRF_STATIC_INLINE void nrf_radio_event_clear(NRF_RADIO_Type * p_reg, nrf_radio_event_t event)
1664 {
1665 *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
1666 nrf_event_readback((uint8_t *)p_reg + (uint32_t)event);
1667 }
1668
nrf_radio_event_check(NRF_RADIO_Type const * p_reg,nrf_radio_event_t event)1669 NRF_STATIC_INLINE bool nrf_radio_event_check(NRF_RADIO_Type const * p_reg, nrf_radio_event_t event)
1670 {
1671 return nrf_event_check(p_reg, event);
1672 }
1673
nrf_radio_event_address_get(NRF_RADIO_Type const * p_reg,nrf_radio_event_t event)1674 NRF_STATIC_INLINE uint32_t nrf_radio_event_address_get(NRF_RADIO_Type const * p_reg,
1675 nrf_radio_event_t event)
1676 {
1677 return ((uint32_t)p_reg + (uint32_t)event);
1678 }
1679
nrf_radio_shorts_enable(NRF_RADIO_Type * p_reg,uint32_t shorts_mask)1680 NRF_STATIC_INLINE void nrf_radio_shorts_enable(NRF_RADIO_Type * p_reg, uint32_t shorts_mask)
1681 {
1682 p_reg->SHORTS |= shorts_mask;
1683 }
1684
nrf_radio_shorts_disable(NRF_RADIO_Type * p_reg,uint32_t shorts_mask)1685 NRF_STATIC_INLINE void nrf_radio_shorts_disable(NRF_RADIO_Type * p_reg, uint32_t shorts_mask)
1686 {
1687 p_reg->SHORTS &= ~shorts_mask;
1688 }
1689
nrf_radio_shorts_set(NRF_RADIO_Type * p_reg,uint32_t shorts_mask)1690 NRF_STATIC_INLINE void nrf_radio_shorts_set(NRF_RADIO_Type * p_reg, uint32_t shorts_mask)
1691 {
1692 p_reg->SHORTS = shorts_mask;
1693 }
1694
nrf_radio_shorts_get(NRF_RADIO_Type const * p_reg)1695 NRF_STATIC_INLINE uint32_t nrf_radio_shorts_get(NRF_RADIO_Type const * p_reg)
1696 {
1697 return p_reg->SHORTS;
1698 }
1699
nrf_radio_int_enable(NRF_RADIO_Type * p_reg,uint32_t mask)1700 NRF_STATIC_INLINE void nrf_radio_int_enable(NRF_RADIO_Type * p_reg, uint32_t mask)
1701 {
1702 #if defined(RADIO_INTENSET_READY_Msk)
1703 p_reg->INTENSET = mask;
1704 #elif defined(RADIO_INTENSET00_READY_Msk)
1705 p_reg->INTENSET00 = mask;
1706 #endif
1707 }
1708
nrf_radio_int_disable(NRF_RADIO_Type * p_reg,uint32_t mask)1709 NRF_STATIC_INLINE void nrf_radio_int_disable(NRF_RADIO_Type * p_reg, uint32_t mask)
1710 {
1711 #if defined(RADIO_INTENCLR_READY_Msk)
1712 p_reg->INTENCLR = mask;
1713 #elif defined(RADIO_INTENCLR00_READY_Msk)
1714 p_reg->INTENCLR00 = mask;
1715 #endif
1716 }
1717
nrf_radio_int_enable_check(NRF_RADIO_Type const * p_reg,uint32_t mask)1718 NRF_STATIC_INLINE uint32_t nrf_radio_int_enable_check(NRF_RADIO_Type const * p_reg, uint32_t mask)
1719 {
1720 #if defined(RADIO_INTENSET_READY_Msk)
1721 return p_reg->INTENSET & mask;
1722 #elif defined(RADIO_INTENSET00_READY_Msk)
1723 return p_reg->INTENSET00 & mask;
1724 #endif
1725 }
1726
1727 #if defined(DPPI_PRESENT)
nrf_radio_subscribe_set(NRF_RADIO_Type * p_reg,nrf_radio_task_t task,uint8_t channel)1728 NRF_STATIC_INLINE void nrf_radio_subscribe_set(NRF_RADIO_Type * p_reg,
1729 nrf_radio_task_t task,
1730 uint8_t channel)
1731 {
1732 *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) task + NRF_RADIO_DPPI_OFFSET)) =
1733 ((uint32_t)channel | NRF_SUBSCRIBE_PUBLISH_ENABLE);
1734 }
1735
nrf_radio_subscribe_clear(NRF_RADIO_Type * p_reg,nrf_radio_task_t task)1736 NRF_STATIC_INLINE void nrf_radio_subscribe_clear(NRF_RADIO_Type * p_reg,
1737 nrf_radio_task_t task)
1738 {
1739 *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) task + NRF_RADIO_DPPI_OFFSET)) = 0;
1740 }
1741
nrf_radio_publish_set(NRF_RADIO_Type * p_reg,nrf_radio_event_t event,uint8_t channel)1742 NRF_STATIC_INLINE void nrf_radio_publish_set(NRF_RADIO_Type * p_reg,
1743 nrf_radio_event_t event,
1744 uint8_t channel)
1745 {
1746 *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) event + NRF_RADIO_DPPI_OFFSET)) =
1747 ((uint32_t)channel | NRF_SUBSCRIBE_PUBLISH_ENABLE);
1748 }
1749
nrf_radio_publish_clear(NRF_RADIO_Type * p_reg,nrf_radio_event_t event)1750 NRF_STATIC_INLINE void nrf_radio_publish_clear(NRF_RADIO_Type * p_reg,
1751 nrf_radio_event_t event)
1752 {
1753 *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) event + NRF_RADIO_DPPI_OFFSET)) = 0;
1754 }
1755 #endif // defined(DPPI_PRESENT)
1756
nrf_radio_crc_status_check(NRF_RADIO_Type const * p_reg)1757 NRF_STATIC_INLINE bool nrf_radio_crc_status_check(NRF_RADIO_Type const * p_reg)
1758 {
1759 return ((p_reg->CRCSTATUS & RADIO_CRCSTATUS_CRCSTATUS_Msk) >> RADIO_CRCSTATUS_CRCSTATUS_Pos)
1760 == RADIO_CRCSTATUS_CRCSTATUS_CRCOk ;
1761 }
1762
nrf_radio_rxmatch_get(NRF_RADIO_Type const * p_reg)1763 NRF_STATIC_INLINE uint8_t nrf_radio_rxmatch_get(NRF_RADIO_Type const * p_reg)
1764 {
1765 return (uint8_t)p_reg->RXMATCH;
1766 }
1767
nrf_radio_rxcrc_get(NRF_RADIO_Type const * p_reg)1768 NRF_STATIC_INLINE uint32_t nrf_radio_rxcrc_get(NRF_RADIO_Type const * p_reg)
1769 {
1770 return p_reg->RXCRC;
1771 }
1772
nrf_radio_dai_get(NRF_RADIO_Type const * p_reg)1773 NRF_STATIC_INLINE uint8_t nrf_radio_dai_get(NRF_RADIO_Type const * p_reg)
1774 {
1775 return (uint8_t)p_reg->DAI;
1776 }
1777
1778 #if defined(RADIO_PDUSTAT_PDUSTAT_Msk)
nrf_radio_pdustat_get(NRF_RADIO_Type const * p_reg)1779 NRF_STATIC_INLINE uint8_t nrf_radio_pdustat_get(NRF_RADIO_Type const * p_reg)
1780 {
1781 return (uint8_t)(p_reg->PDUSTAT & RADIO_PDUSTAT_PDUSTAT_Msk);
1782 }
1783 #endif
1784
1785 #if defined(RADIO_PDUSTAT_CISTAT_Msk)
nrf_radio_cistat_get(NRF_RADIO_Type const * p_reg)1786 NRF_STATIC_INLINE uint8_t nrf_radio_cistat_get(NRF_RADIO_Type const * p_reg)
1787 {
1788 return (uint8_t)((p_reg->PDUSTAT & RADIO_PDUSTAT_CISTAT_Msk) >> RADIO_PDUSTAT_CISTAT_Pos);
1789 }
1790 #endif
1791
nrf_radio_packetptr_set(NRF_RADIO_Type * p_reg,void const * p_packet)1792 NRF_STATIC_INLINE void nrf_radio_packetptr_set(NRF_RADIO_Type * p_reg, void const * p_packet)
1793 {
1794 p_reg->PACKETPTR = (uint32_t)p_packet;
1795 }
1796
nrf_radio_packetptr_get(NRF_RADIO_Type const * p_reg)1797 NRF_STATIC_INLINE void * nrf_radio_packetptr_get(NRF_RADIO_Type const * p_reg)
1798 {
1799 return (void *)p_reg->PACKETPTR;
1800 }
1801
nrf_radio_frequency_set(NRF_RADIO_Type * p_reg,uint16_t radio_frequency)1802 NRF_STATIC_INLINE void nrf_radio_frequency_set(NRF_RADIO_Type * p_reg, uint16_t radio_frequency)
1803 {
1804 NRFX_ASSERT(radio_frequency <= 2500);
1805
1806 #if defined(RADIO_FREQUENCY_MAP_Msk)
1807 NRFX_ASSERT(radio_frequency >= 2360);
1808
1809 uint32_t delta;
1810 if (radio_frequency < 2400)
1811 {
1812 delta = (uint32_t)(radio_frequency - 2360) | RADIO_FREQUENCY_MAP_Msk;
1813 }
1814 else
1815 {
1816 delta = (uint32_t)(radio_frequency - 2400);
1817 }
1818
1819 p_reg->FREQUENCY = delta;
1820 #else
1821 NRFX_ASSERT(radio_frequency >= 2400);
1822 p_reg->FREQUENCY = (uint32_t)(radio_frequency - 2400);
1823 #endif //defined(RADIO_FREQUENCY_MAP_Msk)
1824 }
1825
nrf_radio_frequency_get(NRF_RADIO_Type const * p_reg)1826 NRF_STATIC_INLINE uint16_t nrf_radio_frequency_get(NRF_RADIO_Type const * p_reg)
1827 {
1828 uint32_t freq;
1829
1830 #if defined(RADIO_FREQUENCY_MAP_Msk)
1831 if ((p_reg->FREQUENCY & RADIO_FREQUENCY_MAP_Msk) == RADIO_FREQUENCY_MAP_Msk)
1832 {
1833 freq = 2360;
1834 }
1835 else
1836 #endif
1837 {
1838 freq = 2400;
1839 }
1840 freq += p_reg->FREQUENCY & RADIO_FREQUENCY_FREQUENCY_Msk;
1841
1842 return (uint16_t)freq;
1843 }
1844
nrf_radio_txpower_set(NRF_RADIO_Type * p_reg,nrf_radio_txpower_t tx_power)1845 NRF_STATIC_INLINE void nrf_radio_txpower_set(NRF_RADIO_Type * p_reg, nrf_radio_txpower_t tx_power)
1846 {
1847 p_reg->TXPOWER = (((uint32_t)tx_power) << RADIO_TXPOWER_TXPOWER_Pos);
1848 }
1849
nrf_radio_txpower_get(NRF_RADIO_Type const * p_reg)1850 NRF_STATIC_INLINE nrf_radio_txpower_t nrf_radio_txpower_get(NRF_RADIO_Type const * p_reg)
1851 {
1852 return (nrf_radio_txpower_t)(p_reg->TXPOWER >> RADIO_TXPOWER_TXPOWER_Pos);
1853 }
1854
nrf_radio_mode_set(NRF_RADIO_Type * p_reg,nrf_radio_mode_t radio_mode)1855 NRF_STATIC_INLINE void nrf_radio_mode_set(NRF_RADIO_Type * p_reg, nrf_radio_mode_t radio_mode)
1856 {
1857 p_reg->MODE = ((uint32_t) radio_mode << RADIO_MODE_MODE_Pos);
1858 }
1859
nrf_radio_mode_get(NRF_RADIO_Type const * p_reg)1860 NRF_STATIC_INLINE nrf_radio_mode_t nrf_radio_mode_get(NRF_RADIO_Type const * p_reg)
1861 {
1862 return (nrf_radio_mode_t)((p_reg->MODE & RADIO_MODE_MODE_Msk) >> RADIO_MODE_MODE_Pos);
1863 }
1864
nrf_radio_packet_configure(NRF_RADIO_Type * p_reg,nrf_radio_packet_conf_t const * p_config)1865 NRF_STATIC_INLINE void nrf_radio_packet_configure(NRF_RADIO_Type * p_reg,
1866 nrf_radio_packet_conf_t const * p_config)
1867 {
1868 p_reg->PCNF0 = (((uint32_t)p_config->lflen << RADIO_PCNF0_LFLEN_Pos) |
1869 ((uint32_t)p_config->s0len << RADIO_PCNF0_S0LEN_Pos) |
1870 ((uint32_t)p_config->s1len << RADIO_PCNF0_S1LEN_Pos) |
1871 #if defined(RADIO_PCNF0_S1INCL_Msk)
1872 (p_config->s1incl ?
1873 (RADIO_PCNF0_S1INCL_Include << RADIO_PCNF0_S1INCL_Pos) :
1874 (RADIO_PCNF0_S1INCL_Automatic << RADIO_PCNF0_S1INCL_Pos) ) |
1875 #endif
1876 #if defined(RADIO_PCNF0_CILEN_Msk)
1877 ((uint32_t)p_config->cilen << RADIO_PCNF0_CILEN_Pos) |
1878 #endif
1879 #if defined(RADIO_PCNF0_PLEN_Msk)
1880 ((uint32_t)p_config->plen << RADIO_PCNF0_PLEN_Pos) |
1881 #endif
1882 #if defined(RADIO_PCNF0_CRCINC_Msk)
1883 (p_config->crcinc ?
1884 (RADIO_PCNF0_CRCINC_Include << RADIO_PCNF0_CRCINC_Pos) :
1885 (RADIO_PCNF0_CRCINC_Exclude << RADIO_PCNF0_CRCINC_Pos) ) |
1886 #endif
1887 #if defined(RADIO_PCNF0_TERMLEN_Msk)
1888 ((uint32_t)p_config->termlen << RADIO_PCNF0_TERMLEN_Pos) |
1889 #endif
1890 0);
1891
1892 p_reg->PCNF1 = (((uint32_t)p_config->maxlen << RADIO_PCNF1_MAXLEN_Pos) |
1893 ((uint32_t)p_config->statlen << RADIO_PCNF1_STATLEN_Pos) |
1894 ((uint32_t)p_config->balen << RADIO_PCNF1_BALEN_Pos) |
1895 (p_config->big_endian ?
1896 (RADIO_PCNF1_ENDIAN_Big << RADIO_PCNF1_ENDIAN_Pos) :
1897 (RADIO_PCNF1_ENDIAN_Little << RADIO_PCNF1_ENDIAN_Pos) ) |
1898 (p_config->whiteen ?
1899 (RADIO_PCNF1_WHITEEN_Enabled << RADIO_PCNF1_WHITEEN_Pos) :
1900 (RADIO_PCNF1_WHITEEN_Disabled << RADIO_PCNF1_WHITEEN_Pos) ));
1901 }
1902
nrf_radio_base0_set(NRF_RADIO_Type * p_reg,uint32_t address)1903 NRF_STATIC_INLINE void nrf_radio_base0_set(NRF_RADIO_Type * p_reg, uint32_t address)
1904 {
1905 p_reg->BASE0 = address;
1906 }
1907
nrf_radio_base0_get(NRF_RADIO_Type const * p_reg)1908 NRF_STATIC_INLINE uint32_t nrf_radio_base0_get(NRF_RADIO_Type const * p_reg)
1909 {
1910 return p_reg->BASE0;
1911 }
1912
nrf_radio_base1_set(NRF_RADIO_Type * p_reg,uint32_t address)1913 NRF_STATIC_INLINE void nrf_radio_base1_set(NRF_RADIO_Type * p_reg, uint32_t address)
1914 {
1915 p_reg->BASE1 = address;
1916 }
1917
nrf_radio_base1_get(NRF_RADIO_Type const * p_reg)1918 NRF_STATIC_INLINE uint32_t nrf_radio_base1_get(NRF_RADIO_Type const * p_reg)
1919 {
1920 return p_reg->BASE1;
1921 }
1922
nrf_radio_prefix0_set(NRF_RADIO_Type * p_reg,uint32_t prefixes)1923 NRF_STATIC_INLINE void nrf_radio_prefix0_set(NRF_RADIO_Type * p_reg, uint32_t prefixes)
1924 {
1925 p_reg->PREFIX0 = prefixes;
1926 }
1927
nrf_radio_prefix0_get(NRF_RADIO_Type const * p_reg)1928 NRF_STATIC_INLINE uint32_t nrf_radio_prefix0_get(NRF_RADIO_Type const * p_reg)
1929 {
1930 return p_reg->PREFIX0;
1931 }
1932
nrf_radio_prefix1_set(NRF_RADIO_Type * p_reg,uint32_t prefixes)1933 NRF_STATIC_INLINE void nrf_radio_prefix1_set(NRF_RADIO_Type * p_reg, uint32_t prefixes)
1934 {
1935 p_reg->PREFIX1 = prefixes;
1936 }
1937
nrf_radio_prefix1_get(NRF_RADIO_Type const * p_reg)1938 NRF_STATIC_INLINE uint32_t nrf_radio_prefix1_get(NRF_RADIO_Type const * p_reg)
1939 {
1940 return p_reg->PREFIX1;
1941 }
1942
nrf_radio_txaddress_set(NRF_RADIO_Type * p_reg,uint8_t txaddress)1943 NRF_STATIC_INLINE void nrf_radio_txaddress_set(NRF_RADIO_Type * p_reg, uint8_t txaddress)
1944 {
1945 p_reg->TXADDRESS = ((uint32_t)txaddress) << RADIO_TXADDRESS_TXADDRESS_Pos;
1946 }
1947
nrf_radio_txaddress_get(NRF_RADIO_Type const * p_reg)1948 NRF_STATIC_INLINE uint8_t nrf_radio_txaddress_get(NRF_RADIO_Type const * p_reg)
1949 {
1950 return (uint8_t)((p_reg->TXADDRESS & RADIO_TXADDRESS_TXADDRESS_Msk) >>
1951 RADIO_TXADDRESS_TXADDRESS_Pos);
1952 }
1953
nrf_radio_rxaddresses_set(NRF_RADIO_Type * p_reg,uint8_t rxaddresses)1954 NRF_STATIC_INLINE void nrf_radio_rxaddresses_set(NRF_RADIO_Type * p_reg, uint8_t rxaddresses)
1955 {
1956 p_reg->RXADDRESSES = (uint32_t)(rxaddresses);
1957 }
1958
nrf_radio_rxaddresses_get(NRF_RADIO_Type const * p_reg)1959 NRF_STATIC_INLINE uint8_t nrf_radio_rxaddresses_get(NRF_RADIO_Type const * p_reg)
1960 {
1961 return (uint8_t)(p_reg->RXADDRESSES);
1962 }
1963
nrf_radio_crc_configure(NRF_RADIO_Type * p_reg,uint8_t crc_length,nrf_radio_crc_addr_t crc_address,uint32_t crc_polynominal)1964 NRF_STATIC_INLINE void nrf_radio_crc_configure(NRF_RADIO_Type * p_reg,
1965 uint8_t crc_length,
1966 nrf_radio_crc_addr_t crc_address,
1967 uint32_t crc_polynominal)
1968 {
1969 p_reg->CRCCNF = ((uint32_t)crc_length << RADIO_CRCCNF_LEN_Pos) |
1970 #if defined(RADIO_CRCCNF_SKIPADDR_Msk)
1971 ((uint32_t)crc_address << RADIO_CRCCNF_SKIPADDR_Pos);
1972 #else
1973 ((uint32_t)crc_address << RADIO_CRCCNF_OFFSET_Pos);
1974 #endif
1975 p_reg->CRCPOLY = (crc_polynominal << RADIO_CRCPOLY_CRCPOLY_Pos);
1976 }
1977
nrf_radio_crcinit_set(NRF_RADIO_Type * p_reg,uint32_t crc_init_value)1978 NRF_STATIC_INLINE void nrf_radio_crcinit_set(NRF_RADIO_Type * p_reg, uint32_t crc_init_value)
1979 {
1980 p_reg->CRCINIT = crc_init_value;
1981 }
1982
nrf_radio_crcinit_get(NRF_RADIO_Type const * p_reg)1983 NRF_STATIC_INLINE uint32_t nrf_radio_crcinit_get(NRF_RADIO_Type const * p_reg)
1984 {
1985 return p_reg->CRCINIT;
1986 }
1987
nrf_radio_ifs_set(NRF_RADIO_Type * p_reg,uint32_t radio_ifs)1988 NRF_STATIC_INLINE void nrf_radio_ifs_set(NRF_RADIO_Type * p_reg, uint32_t radio_ifs)
1989 {
1990 p_reg->TIFS = radio_ifs;
1991 }
1992
nrf_radio_ifs_get(NRF_RADIO_Type const * p_reg)1993 NRF_STATIC_INLINE uint32_t nrf_radio_ifs_get(NRF_RADIO_Type const * p_reg)
1994 {
1995 return p_reg->TIFS;
1996 }
1997
nrf_radio_rssi_sample_get(NRF_RADIO_Type const * p_reg)1998 NRF_STATIC_INLINE uint8_t nrf_radio_rssi_sample_get(NRF_RADIO_Type const * p_reg)
1999 {
2000 return (uint8_t)((p_reg->RSSISAMPLE & RADIO_RSSISAMPLE_RSSISAMPLE_Msk) >>
2001 RADIO_RSSISAMPLE_RSSISAMPLE_Pos);
2002 }
2003
nrf_radio_state_get(NRF_RADIO_Type const * p_reg)2004 NRF_STATIC_INLINE nrf_radio_state_t nrf_radio_state_get(NRF_RADIO_Type const * p_reg)
2005 {
2006 return (nrf_radio_state_t) p_reg->STATE;
2007 }
2008
nrf_radio_datawhiteiv_set(NRF_RADIO_Type * p_reg,uint16_t datawhiteiv)2009 NRF_STATIC_INLINE void nrf_radio_datawhiteiv_set(NRF_RADIO_Type * p_reg, uint16_t datawhiteiv)
2010 {
2011 #if NRF_RADIO_HAS_DATAWHITE
2012 p_reg->DATAWHITE = (p_reg->DATAWHITE & ~RADIO_DATAWHITE_IV_Msk) |
2013 (((uint32_t)datawhiteiv << RADIO_DATAWHITE_IV_Pos)
2014 & RADIO_DATAWHITE_IV_Msk);
2015 #else
2016 p_reg->DATAWHITEIV = (((uint16_t)datawhiteiv) & RADIO_DATAWHITEIV_DATAWHITEIV_Msk);
2017 #endif
2018 }
2019
nrf_radio_datawhiteiv_get(NRF_RADIO_Type const * p_reg)2020 NRF_STATIC_INLINE uint16_t nrf_radio_datawhiteiv_get(NRF_RADIO_Type const * p_reg)
2021 {
2022 #if NRF_RADIO_HAS_DATAWHITE
2023 return (uint16_t)((p_reg->DATAWHITE & RADIO_DATAWHITE_IV_Msk) >> RADIO_DATAWHITE_IV_Pos);
2024 #else
2025 return (uint16_t)(p_reg->DATAWHITEIV & RADIO_DATAWHITEIV_DATAWHITEIV_Msk);
2026 #endif
2027 }
2028
2029 #if NRF_RADIO_HAS_DATAWHITE
nrf_radio_datawhite_poly_set(NRF_RADIO_Type * p_reg,uint16_t poly)2030 NRF_STATIC_INLINE void nrf_radio_datawhite_poly_set(NRF_RADIO_Type * p_reg, uint16_t poly)
2031 {
2032 p_reg->DATAWHITE = (p_reg->DATAWHITE & ~RADIO_DATAWHITE_POLY_Msk) |
2033 (((uint32_t)poly << RADIO_DATAWHITE_POLY_Pos)
2034 & RADIO_DATAWHITE_POLY_Msk);
2035 }
2036
nrf_radio_datawhite_poly_get(NRF_RADIO_Type const * p_reg)2037 NRF_STATIC_INLINE uint16_t nrf_radio_datawhite_poly_get(NRF_RADIO_Type const * p_reg)
2038 {
2039 return (uint16_t)((p_reg->DATAWHITE & RADIO_DATAWHITE_POLY_Msk) >> RADIO_DATAWHITE_POLY_Pos);
2040 }
2041 #endif
2042
nrf_radio_bcc_set(NRF_RADIO_Type * p_reg,uint32_t radio_bcc)2043 NRF_STATIC_INLINE void nrf_radio_bcc_set(NRF_RADIO_Type * p_reg, uint32_t radio_bcc)
2044 {
2045 p_reg->BCC = radio_bcc;
2046 }
2047
nrf_radio_bcc_get(NRF_RADIO_Type const * p_reg)2048 NRF_STATIC_INLINE uint32_t nrf_radio_bcc_get(NRF_RADIO_Type const * p_reg)
2049 {
2050 return p_reg->BCC;
2051 }
2052
nrf_radio_dab_set(NRF_RADIO_Type * p_reg,uint32_t dab_value,uint8_t segment)2053 NRF_STATIC_INLINE void nrf_radio_dab_set(NRF_RADIO_Type * p_reg,
2054 uint32_t dab_value,
2055 uint8_t segment)
2056 {
2057 NRFX_ASSERT(segment < 8);
2058 p_reg->DAB[segment] = dab_value;
2059 }
2060
nrf_radio_dab_get(NRF_RADIO_Type const * p_reg,uint8_t segment)2061 NRF_STATIC_INLINE uint32_t nrf_radio_dab_get(NRF_RADIO_Type const * p_reg, uint8_t segment)
2062 {
2063 NRFX_ASSERT(segment < 8);
2064 return p_reg->DAB[segment];
2065 }
2066
nrf_radio_dap_set(NRF_RADIO_Type * p_reg,uint16_t dap_value,uint8_t prefix_index)2067 NRF_STATIC_INLINE void nrf_radio_dap_set(NRF_RADIO_Type * p_reg,
2068 uint16_t dap_value,
2069 uint8_t prefix_index)
2070 {
2071 NRFX_ASSERT(prefix_index < 8);
2072 p_reg->DAP[prefix_index] = (uint32_t)dap_value;
2073 }
2074
nrf_radio_dap_get(NRF_RADIO_Type const * p_reg,uint8_t prefix_index)2075 NRF_STATIC_INLINE uint32_t nrf_radio_dap_get(NRF_RADIO_Type const * p_reg, uint8_t prefix_index)
2076 {
2077 NRFX_ASSERT(prefix_index < 8);
2078 return p_reg->DAP[prefix_index];
2079 }
2080
nrf_radio_dacnf_set(NRF_RADIO_Type * p_reg,uint8_t ena,uint8_t txadd)2081 NRF_STATIC_INLINE void nrf_radio_dacnf_set(NRF_RADIO_Type * p_reg, uint8_t ena, uint8_t txadd)
2082 {
2083 p_reg->DACNF = (((uint32_t)ena << RADIO_DACNF_ENA0_Pos) |
2084 ((uint32_t)txadd << RADIO_DACNF_TXADD0_Pos));
2085 }
2086
nrf_radio_dacnf_ena_get(NRF_RADIO_Type const * p_reg)2087 NRF_STATIC_INLINE uint8_t nrf_radio_dacnf_ena_get(NRF_RADIO_Type const * p_reg)
2088 {
2089 return (uint8_t)((p_reg->DACNF & (RADIO_DACNF_ENA0_Msk |
2090 RADIO_DACNF_ENA1_Msk |
2091 RADIO_DACNF_ENA2_Msk |
2092 RADIO_DACNF_ENA3_Msk |
2093 RADIO_DACNF_ENA4_Msk |
2094 RADIO_DACNF_ENA5_Msk |
2095 RADIO_DACNF_ENA6_Msk |
2096 RADIO_DACNF_ENA7_Msk)) >> RADIO_DACNF_ENA0_Pos);
2097 }
2098
nrf_radio_dacnf_txadd_get(NRF_RADIO_Type const * p_reg)2099 NRF_STATIC_INLINE uint8_t nrf_radio_dacnf_txadd_get(NRF_RADIO_Type const * p_reg)
2100 {
2101 return (uint8_t)((p_reg->DACNF & (RADIO_DACNF_TXADD0_Msk |
2102 RADIO_DACNF_TXADD1_Msk |
2103 RADIO_DACNF_TXADD2_Msk |
2104 RADIO_DACNF_TXADD3_Msk |
2105 RADIO_DACNF_TXADD4_Msk |
2106 RADIO_DACNF_TXADD5_Msk |
2107 RADIO_DACNF_TXADD6_Msk |
2108 RADIO_DACNF_TXADD7_Msk)) >> RADIO_DACNF_TXADD0_Pos);
2109 }
2110
2111 #if defined(RADIO_INTENSET_MHRMATCH_Msk) || defined(RADIO_INTENSET00_MHRMATCH_Msk)
nrf_radio_mhmu_search_pattern_set(NRF_RADIO_Type * p_reg,uint32_t radio_mhmu_search_pattern)2112 void nrf_radio_mhmu_search_pattern_set(NRF_RADIO_Type * p_reg,
2113 uint32_t radio_mhmu_search_pattern)
2114 {
2115 p_reg->MHRMATCHCONF = radio_mhmu_search_pattern;
2116 }
2117
nrf_radio_mhmu_search_pattern_get(NRF_RADIO_Type const * p_reg)2118 NRF_STATIC_INLINE uint32_t nrf_radio_mhmu_search_pattern_get(NRF_RADIO_Type const * p_reg)
2119 {
2120 return p_reg->MHRMATCHCONF;
2121 }
2122
nrf_radio_mhmu_pattern_mask_set(NRF_RADIO_Type * p_reg,uint32_t radio_mhmu_pattern_mask)2123 NRF_STATIC_INLINE void nrf_radio_mhmu_pattern_mask_set(NRF_RADIO_Type * p_reg,
2124 uint32_t radio_mhmu_pattern_mask)
2125 {
2126 #if defined(RADIO_MHRMATCHMAS_MHRMATCHMAS_Msk)
2127 p_reg->MHRMATCHMAS = radio_mhmu_pattern_mask;
2128 #else
2129 p_reg->MHRMATCHMASK = radio_mhmu_pattern_mask;
2130 #endif
2131 }
2132
nrf_radio_mhmu_pattern_mask_get(NRF_RADIO_Type const * p_reg)2133 NRF_STATIC_INLINE uint32_t nrf_radio_mhmu_pattern_mask_get(NRF_RADIO_Type const * p_reg)
2134 {
2135 #if defined(RADIO_MHRMATCHMAS_MHRMATCHMAS_Msk)
2136 return p_reg->MHRMATCHMAS;
2137 #else
2138 return p_reg->MHRMATCHMASK;
2139 #endif
2140 }
2141 #endif // defined(RADIO_INTENSET_MHRMATCH_Msk) || defined(RADIO_INTENSET00_MHRMATCH_Msk)
2142
2143 #if defined(RADIO_MODECNF0_RU_Msk)
nrf_radio_modecnf0_set(NRF_RADIO_Type * p_reg,bool fast_ramp_up,uint8_t default_tx)2144 NRF_STATIC_INLINE void nrf_radio_modecnf0_set(NRF_RADIO_Type * p_reg,
2145 bool fast_ramp_up,
2146 uint8_t default_tx)
2147 {
2148 p_reg->MODECNF0 = (fast_ramp_up ? (RADIO_MODECNF0_RU_Fast << RADIO_MODECNF0_RU_Pos) :
2149 (RADIO_MODECNF0_RU_Default << RADIO_MODECNF0_RU_Pos) ) |
2150 (((uint32_t)default_tx) << RADIO_MODECNF0_DTX_Pos);
2151 }
2152
nrf_radio_modecnf0_ru_get(NRF_RADIO_Type const * p_reg)2153 NRF_STATIC_INLINE bool nrf_radio_modecnf0_ru_get(NRF_RADIO_Type const * p_reg)
2154 {
2155 return ((p_reg->MODECNF0 & RADIO_MODECNF0_RU_Msk) >> RADIO_MODECNF0_RU_Pos) ==
2156 RADIO_MODECNF0_RU_Fast;
2157 }
2158
nrf_radio_modecnf0_dtx_get(NRF_RADIO_Type const * p_reg)2159 NRF_STATIC_INLINE uint8_t nrf_radio_modecnf0_dtx_get(NRF_RADIO_Type const * p_reg)
2160 {
2161 return (uint8_t)((p_reg->MODECNF0 & RADIO_MODECNF0_DTX_Msk) >> RADIO_MODECNF0_DTX_Pos);
2162 }
2163 #endif // defined(RADIO_MODECNF0_RU_Msk)
2164
2165 #if defined(RADIO_MODECNF0_RU_Msk) || defined(RADIO_TIMING_RU_Msk)
nrf_radio_fast_ramp_up_enable_set(NRF_RADIO_Type * p_reg,bool enable)2166 NRF_STATIC_INLINE void nrf_radio_fast_ramp_up_enable_set(NRF_RADIO_Type * p_reg, bool enable)
2167 {
2168 #if defined(RADIO_TIMING_RU_Msk)
2169 p_reg->TIMING = (enable ? RADIO_TIMING_RU_Fast : RADIO_TIMING_RU_Legacy) <<
2170 RADIO_TIMING_RU_Pos;
2171 #elif defined(RADIO_MODECNF0_RU_Msk)
2172 p_reg->MODECNF0 = ((p_reg->MODECNF0 & (~RADIO_MODECNF0_RU_Msk)) |
2173 (enable ? RADIO_MODECNF0_RU_Fast : RADIO_MODECNF0_RU_Default) <<
2174 RADIO_MODECNF0_RU_Pos);
2175 #endif
2176 }
2177
nrf_radio_fast_ramp_up_check(NRF_RADIO_Type const * p_reg)2178 NRF_STATIC_INLINE bool nrf_radio_fast_ramp_up_check(NRF_RADIO_Type const * p_reg)
2179 {
2180 #if defined(RADIO_TIMING_RU_Msk)
2181 return ((p_reg->TIMING & RADIO_TIMING_RU_Msk) >> RADIO_TIMING_RU_Pos) == RADIO_TIMING_RU_Fast;
2182 #elif defined(RADIO_MODECNF0_RU_Msk)
2183 return ((p_reg->MODECNF0 & RADIO_MODECNF0_RU_Msk) >> RADIO_MODECNF0_RU_Pos) ==
2184 RADIO_MODECNF0_RU_Fast;
2185 #endif
2186 }
2187 #endif
2188
2189 #if defined(RADIO_SFD_SFD_Msk)
nrf_radio_sfd_set(NRF_RADIO_Type * p_reg,uint8_t sfd)2190 NRF_STATIC_INLINE void nrf_radio_sfd_set(NRF_RADIO_Type * p_reg, uint8_t sfd)
2191 {
2192 p_reg->SFD = ((uint32_t)sfd) << RADIO_SFD_SFD_Pos;
2193 }
2194
nrf_radio_sfd_get(NRF_RADIO_Type const * p_reg)2195 NRF_STATIC_INLINE uint8_t nrf_radio_sfd_get(NRF_RADIO_Type const * p_reg)
2196 {
2197 return (uint8_t)((p_reg->SFD & RADIO_SFD_SFD_Msk) >> RADIO_SFD_SFD_Pos);
2198 }
2199 #endif // defined(RADIO_SFD_SFD_Msk)
2200
2201 #if defined(RADIO_EDCNT_EDCNT_Msk) || defined(RADIO_EDCTRL_EDCNT_Msk)
nrf_radio_ed_loop_count_set(NRF_RADIO_Type * p_reg,uint32_t ed_loop_count)2202 NRF_STATIC_INLINE void nrf_radio_ed_loop_count_set(NRF_RADIO_Type * p_reg, uint32_t ed_loop_count)
2203 {
2204 #if defined(RADIO_EDCNT_EDCNT_Msk)
2205 p_reg->EDCNT = (ed_loop_count & RADIO_EDCNT_EDCNT_Msk);
2206 #elif defined(RADIO_EDCTRL_EDCNT_Msk)
2207 p_reg->EDCTRL = ((p_reg->EDCTRL & ~RADIO_EDCTRL_EDCNT_Msk) |
2208 ((ed_loop_count << RADIO_EDCTRL_EDCNT_Pos) & RADIO_EDCTRL_EDCNT_Msk));
2209 #endif
2210 }
2211 #endif
2212
2213 #if defined(RADIO_EDCTRL_EDPERIOD_Msk)
nrf_radio_ed_cca_period_set(NRF_RADIO_Type * p_reg,uint8_t ed_period)2214 NRF_STATIC_INLINE void nrf_radio_ed_cca_period_set(NRF_RADIO_Type * p_reg, uint8_t ed_period)
2215 {
2216 p_reg->EDCTRL = ((p_reg->EDCTRL & ~RADIO_EDCTRL_EDPERIOD_Msk) |
2217 ((ed_period << RADIO_EDCTRL_EDPERIOD_Pos) & RADIO_EDCTRL_EDPERIOD_Msk));
2218 }
2219 #endif
2220
2221 #if defined(RADIO_EDSAMPLE_EDLVL_Msk)
nrf_radio_ed_sample_get(NRF_RADIO_Type const * p_reg)2222 NRF_STATIC_INLINE uint8_t nrf_radio_ed_sample_get(NRF_RADIO_Type const * p_reg)
2223 {
2224 return (uint8_t) p_reg->EDSAMPLE;
2225 }
2226 #endif
2227
2228 #if defined(RADIO_CCACTRL_CCAMODE_Msk)
nrf_radio_cca_configure(NRF_RADIO_Type * p_reg,nrf_radio_cca_mode_t cca_mode,uint8_t cca_ed_threshold,uint8_t cca_corr_threshold,uint8_t cca_corr_cnt)2229 NRF_STATIC_INLINE void nrf_radio_cca_configure(NRF_RADIO_Type * p_reg,
2230 nrf_radio_cca_mode_t cca_mode,
2231 uint8_t cca_ed_threshold,
2232 uint8_t cca_corr_threshold,
2233 uint8_t cca_corr_cnt)
2234 {
2235 p_reg->CCACTRL = (((uint32_t)cca_mode << RADIO_CCACTRL_CCAMODE_Pos) |
2236 ((uint32_t)cca_ed_threshold << RADIO_CCACTRL_CCAEDTHRES_Pos) |
2237 ((uint32_t)cca_corr_threshold << RADIO_CCACTRL_CCACORRTHRES_Pos) |
2238 ((uint32_t)cca_corr_cnt << RADIO_CCACTRL_CCACORRCNT_Pos));
2239 }
2240 #endif
2241
2242 #if defined(RADIO_POWER_POWER_Msk)
nrf_radio_power_set(NRF_RADIO_Type * p_reg,bool radio_power)2243 NRF_STATIC_INLINE void nrf_radio_power_set(NRF_RADIO_Type * p_reg, bool radio_power)
2244 {
2245 p_reg->POWER = (radio_power ? RADIO_POWER_POWER_Enabled : RADIO_POWER_POWER_Disabled)
2246 << RADIO_POWER_POWER_Pos;
2247 }
2248 #endif
2249
2250 #if defined(RADIO_CTESTATUS_CTETIME_Msk)
nrf_radio_cte_time_get(NRF_RADIO_Type const * p_reg)2251 NRF_STATIC_INLINE uint32_t nrf_radio_cte_time_get(NRF_RADIO_Type const * p_reg)
2252 {
2253 return ((p_reg->CTESTATUS & RADIO_CTESTATUS_CTETIME_Msk) >> RADIO_CTESTATUS_CTETIME_Pos);
2254 }
2255
nrf_radio_cte_type_get(NRF_RADIO_Type const * p_reg)2256 NRF_STATIC_INLINE uint32_t nrf_radio_cte_type_get(NRF_RADIO_Type const * p_reg)
2257 {
2258 return ((p_reg->CTESTATUS & RADIO_CTESTATUS_CTETYPE_Msk) >> RADIO_CTESTATUS_CTETYPE_Pos);
2259 }
2260
nrf_radio_cte_rfu_get(NRF_RADIO_Type const * p_reg)2261 NRF_STATIC_INLINE uint32_t nrf_radio_cte_rfu_get(NRF_RADIO_Type const * p_reg)
2262 {
2263 return ((p_reg->CTESTATUS & RADIO_CTESTATUS_RFU_Msk) >> RADIO_CTESTATUS_RFU_Pos);
2264 }
2265 #endif
2266
2267 #if defined(RADIO_DFESTATUS_SWITCHINGSTATE_Msk)
2268 NRF_STATIC_INLINE
nrf_radio_dfe_switch_state_get(NRF_RADIO_Type const * p_reg)2269 nrf_radio_dfe_switch_state_t nrf_radio_dfe_switch_state_get(NRF_RADIO_Type const * p_reg)
2270 {
2271 return (nrf_radio_dfe_switch_state_t)((p_reg->DFESTATUS & RADIO_DFESTATUS_SWITCHINGSTATE_Msk) >>
2272 RADIO_DFESTATUS_SWITCHINGSTATE_Pos);
2273 }
2274
2275 NRF_STATIC_INLINE
nrf_radio_dfe_sample_state_get(NRF_RADIO_Type const * p_reg)2276 nrf_radio_dfe_sample_state_t nrf_radio_dfe_sample_state_get(NRF_RADIO_Type const * p_reg)
2277 {
2278 return (nrf_radio_dfe_sample_state_t)((p_reg->DFESTATUS & RADIO_DFESTATUS_SAMPLINGSTATE_Msk) >>
2279 RADIO_DFESTATUS_SAMPLINGSTATE_Pos);
2280 }
2281 #endif
2282
2283 #if defined(RADIO_CTEINLINECONF_S0CONF_Msk)
nrf_radio_cteinline_configure(NRF_RADIO_Type * p_reg,nrf_radio_cteinline_conf_t const * p_config)2284 NRF_STATIC_INLINE void nrf_radio_cteinline_configure(NRF_RADIO_Type * p_reg,
2285 nrf_radio_cteinline_conf_t const * p_config)
2286 {
2287 p_reg->CTEINLINECONF = (((p_config->enable ?
2288 RADIO_CTEINLINECONF_CTEINLINECTRLEN_Enabled :
2289 RADIO_CTEINLINECONF_CTEINLINECTRLEN_Disabled) <<
2290 RADIO_CTEINLINECONF_CTEINLINECTRLEN_Pos ) |
2291 ((p_config->info_in_s1 ?
2292 RADIO_CTEINLINECONF_CTEINFOINS1_InS1 :
2293 RADIO_CTEINLINECONF_CTEINFOINS1_NotInS1) <<
2294 RADIO_CTEINLINECONF_CTEINFOINS1_Pos ) |
2295 ((p_config->err_handling ?
2296 RADIO_CTEINLINECONF_CTEERRORHANDLING_Yes :
2297 RADIO_CTEINLINECONF_CTEERRORHANDLING_No) <<
2298 RADIO_CTEINLINECONF_CTEERRORHANDLING_Pos ) |
2299 ((uint32_t)p_config->time_range <<
2300 RADIO_CTEINLINECONF_CTETIMEVALIDRANGE_Pos) |
2301 ((uint32_t)p_config->rx1us <<
2302 RADIO_CTEINLINECONF_CTEINLINERXMODE1US_Pos) |
2303 ((uint32_t)p_config->rx2us <<
2304 RADIO_CTEINLINECONF_CTEINLINERXMODE2US_Pos) |
2305 ((uint32_t)p_config->s0_pattern << RADIO_CTEINLINECONF_S0CONF_Pos) |
2306 ((uint32_t)p_config->s0_mask << RADIO_CTEINLINECONF_S0MASK_Pos));
2307 }
2308 #endif
2309
2310 #if defined(RADIO_DFECTRL1_NUMBEROF8US_Msk)
nrf_radio_dfectrl_configure(NRF_RADIO_Type * p_reg,nrf_radio_dfectrl_conf_t const * p_config)2311 NRF_STATIC_INLINE void nrf_radio_dfectrl_configure(NRF_RADIO_Type * p_reg,
2312 nrf_radio_dfectrl_conf_t const * p_config)
2313 {
2314 p_reg->DFECTRL1 = ((((uint32_t)p_config->dfe_len << RADIO_DFECTRL1_NUMBEROF8US_Pos) &
2315 RADIO_DFECTRL1_NUMBEROF8US_Msk) |
2316 ((uint32_t)p_config->extension << RADIO_DFECTRL1_DFEINEXTENSION_Pos) |
2317 ((uint32_t)p_config->switch_spacing << RADIO_DFECTRL1_TSWITCHSPACING_Pos) |
2318 ((uint32_t)p_config->spacing_ref << RADIO_DFECTRL1_TSAMPLESPACINGREF_Pos) |
2319 ((uint32_t)p_config->sample_type << RADIO_DFECTRL1_SAMPLETYPE_Pos) |
2320 ((uint32_t)p_config->sample_spacing << RADIO_DFECTRL1_TSAMPLESPACING_Pos) |
2321 #if defined(RADIO_DFECTRL1_REPEATPATTERN_Msk)
2322 (((uint32_t)p_config->repeat_pattern << RADIO_DFECTRL1_REPEATPATTERN_Pos) &
2323 RADIO_DFECTRL1_REPEATPATTERN_Msk) |
2324 #endif
2325 (((uint32_t)p_config->gain_steps << RADIO_DFECTRL1_AGCBACKOFFGAIN_Pos) &
2326 RADIO_DFECTRL1_AGCBACKOFFGAIN_Msk));
2327
2328 p_reg->DFECTRL2 = ((((uint32_t)p_config->switch_offset << RADIO_DFECTRL2_TSWITCHOFFSET_Pos) &
2329 RADIO_DFECTRL2_TSWITCHOFFSET_Msk) |
2330 (((uint32_t)p_config->sample_offset << RADIO_DFECTRL2_TSAMPLEOFFSET_Pos) &
2331 RADIO_DFECTRL2_TSAMPLEOFFSET_Msk));
2332 }
2333 #endif
2334
2335 #if defined(RADIO_SWITCHPATTERN_SWITCHPATTERN_Msk)
nrf_radio_dfe_pattern_pin_set(NRF_RADIO_Type * p_reg,uint32_t pin,uint8_t pos)2336 NRF_STATIC_INLINE void nrf_radio_dfe_pattern_pin_set(NRF_RADIO_Type * p_reg,
2337 uint32_t pin,
2338 uint8_t pos)
2339 {
2340 p_reg->PSEL.DFEGPIO[pos] = pin;
2341 }
2342
nrf_radio_dfe_pattern_add(NRF_RADIO_Type * p_reg,uint8_t pin_mask)2343 NRF_STATIC_INLINE void nrf_radio_dfe_pattern_add(NRF_RADIO_Type * p_reg, uint8_t pin_mask)
2344 {
2345 p_reg->SWITCHPATTERN = (uint32_t)pin_mask;
2346 }
2347
nrf_radio_dfe_patterns_add(NRF_RADIO_Type * p_reg,uint8_t const * p_pin_masks,size_t length)2348 NRF_STATIC_INLINE void nrf_radio_dfe_patterns_add(NRF_RADIO_Type * p_reg,
2349 uint8_t const * p_pin_masks,
2350 size_t length)
2351 {
2352 for (size_t i = 0; i < length; i++)
2353 {
2354 nrf_radio_dfe_pattern_add(p_reg, p_pin_masks[i]);
2355 }
2356 }
2357
nrf_radio_dfe_pattern_cnt_get(NRF_RADIO_Type const * p_reg)2358 NRF_STATIC_INLINE uint32_t nrf_radio_dfe_pattern_cnt_get(NRF_RADIO_Type const * p_reg)
2359 {
2360 return p_reg->SWITCHPATTERN;
2361 }
2362
nrf_radio_dfe_pattern_clear(NRF_RADIO_Type * p_reg)2363 NRF_STATIC_INLINE void nrf_radio_dfe_pattern_clear(NRF_RADIO_Type * p_reg)
2364 {
2365 p_reg->CLEARPATTERN = RADIO_CLEARPATTERN_CLEARPATTERN_Msk;
2366 }
2367 #endif
2368
2369 #if defined(RADIO_DFEPACKET_PTR_PTR_Msk) || defined(RADIO_DFEPACKET_PTR_OFFSET_Msk)
nrf_radio_dfe_buffer_set(NRF_RADIO_Type * p_reg,uint32_t * p_buffer,size_t length)2370 NRF_STATIC_INLINE void nrf_radio_dfe_buffer_set(NRF_RADIO_Type * p_reg,
2371 uint32_t * p_buffer,
2372 size_t length)
2373 {
2374 p_reg->DFEPACKET.PTR = (uint32_t)p_buffer;
2375 #if defined(RADIO_DFEPACKET_MAX_MAX_Msk)
2376 p_reg->DFEPACKET.MAX = length;
2377 #else
2378 p_reg->DFEPACKET.MAXCNT = length;
2379 #endif
2380 }
2381
nrf_radio_dfe_amount_get(NRF_RADIO_Type const * p_reg)2382 NRF_STATIC_INLINE uint32_t nrf_radio_dfe_amount_get(NRF_RADIO_Type const * p_reg)
2383 {
2384 return p_reg->DFEPACKET.AMOUNT;
2385 }
2386
2387 #if defined(RADIO_DFEPACKET_CURRENTAMOUNT_AMOUNT_Msk)
nrf_radio_dfe_current_amount_get(NRF_RADIO_Type const * p_reg)2388 NRF_STATIC_INLINE uint32_t nrf_radio_dfe_current_amount_get(NRF_RADIO_Type const * p_reg)
2389 {
2390 return p_reg->DFEPACKET.CURRENTAMOUNT;
2391 }
2392 #endif
2393
2394 #endif
2395
2396 #endif // NRF_DECLARE_ONLY
2397
2398 /** @} */
2399
2400 #ifdef __cplusplus
2401 }
2402 #endif
2403
2404 #endif // NRF_RADIO_H__
2405