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