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