Skip to content

Commit 11c62e9

Browse files
committed
modules: nrfxlib: nrf_802154: sl: Adapt to the new GPPI API
Use the new GPPI API. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent ab0f609 commit 11c62e9

File tree

3 files changed

+52
-93
lines changed

3 files changed

+52
-93
lines changed

modules/nrfxlib/nrf_802154/sl/platform/nrf_802154_platform_sl_lptimer_grtc_hw_task.c

Lines changed: 27 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -226,96 +226,65 @@ void nrf_802154_platform_sl_lptimer_hw_task_local_domain_connections_clear(void)
226226

227227
#elif defined(NRF54L_SERIES)
228228

229-
#include <nrfx_ppib.h>
230-
#include <nrfx_dppi.h>
229+
#include <helpers/nrfx_gppi.h>
230+
#include <helpers/nrfx_gppi_lumos.h>
231231

232-
/* To trigger GRTC.TASKS_CAPTURE[#cc] with RADIO.EVENT_{?}, the following connection chain must be
232+
/* To trigger RADIO.TASKS_x with GRTC.EVENT_CAPTURE{?}, the following connection chain must be
233233
* created:
234-
* - starting from RADIO domain (_R_):
235-
* {a} RADIO.EVENT_{?} <-- DPPIC_10
236-
* {b} DPPIC_10 <-- PPIB_11
234+
* - starting with the PERI domain (_P_):
235+
* {a} DPPIC_20 <-- GRTC.CC
236+
* {b} PPIB_21 <-- DPPIC_20
237237
* - crossing domain boundaries
238238
* {c} PPIB_11 <-- PPIB_21
239-
* - ending in the PERI domain (_P_):
240-
* {d} PPIB_21 <-- DPPIC_20
241-
* {e} DPPIC_20 <-- GRTC.CC
239+
* - ending with RADIO domain (_R_):
240+
* {d} DPPIC_10 <-- PPIB_11
241+
* {e} RADIO.TASK_{?} <-- DPPIC_10
242242
*/
243243

244244
#define INVALID_CHANNEL UINT8_MAX
245245

246-
static nrfx_dppi_t dppi20 = NRFX_DPPI_INSTANCE(20);
247-
static nrfx_ppib_interconnect_t ppib11_21 = NRFX_PPIB_INTERCONNECT_INSTANCE(11, 21);
248-
static uint8_t peri_dppi_ch = INVALID_CHANNEL;
249-
static uint8_t peri_ppib_ch = INVALID_CHANNEL;
246+
static nrfx_gppi_handle_t peri_rad_handle;
250247

251248
void nrf_802154_platform_sl_lptimer_hw_task_cross_domain_connections_setup(uint32_t cc_channel)
252249
{
253-
nrfx_err_t err;
254-
255-
err = nrfx_dppi_channel_alloc(&dppi20, &peri_dppi_ch);
256-
__ASSERT_NO_MSG(err == NRFX_SUCCESS);
257-
258-
err = nrfx_ppib_channel_alloc(&ppib11_21, &peri_ppib_ch);
259-
__ASSERT_NO_MSG(err == NRFX_SUCCESS);
260-
261-
/* {c} PPIB_11 <-- PPIB_21
262-
* One of HW-fixed connections, so nothing to do.
263-
*/
264-
265-
/* {d} PPIB_21 <-- DPPIC_20 */
266-
NRF_DPPI_ENDPOINT_SETUP(
267-
nrfx_ppib_send_task_address_get(&ppib11_21.right, peri_ppib_ch), peri_dppi_ch);
268-
269-
/* {e} DPPIC_20 <-- GRTC.CC */
270-
NRF_DPPI_ENDPOINT_SETUP(
271-
z_nrf_grtc_timer_compare_evt_address_get(cc_channel), peri_dppi_ch);
250+
ARG_UNUSED(cc_channel);
272251
}
273252

274253
void nrf_802154_platform_sl_lptimer_hw_task_cross_domain_connections_clear(void)
275254
{
276-
nrfx_err_t err;
277-
278-
err = nrfx_ppib_channel_free(&ppib11_21, peri_ppib_ch);
279-
__ASSERT_NO_MSG(err == NRFX_SUCCESS);
280-
281-
err = nrfx_dppi_channel_free(&dppi20, peri_dppi_ch);
282-
__ASSERT_NO_MSG(err == NRFX_SUCCESS);
283-
284-
peri_dppi_ch = INVALID_CHANNEL;
285-
peri_ppib_ch = INVALID_CHANNEL;
255+
nrfx_gppi_domain_conn_free(peri_rad_handle);
286256
}
287257

288258
void nrf_802154_platform_sl_lptimer_hw_task_local_domain_connections_setup(uint32_t dppi_ch,
289259
uint32_t cc_channel)
290260
{
291-
nrfx_err_t err;
261+
nrfx_gppi_resource_t resource = {
262+
.domain_id = NRFX_GPPI_DOMAIN_RAD,
263+
.channel = dppi_ch
264+
};
265+
uint32_t eep = z_nrf_grtc_timer_compare_evt_address_get(cc_channel);
266+
int err;
292267

293268
if (dppi_ch == NRF_802154_SL_HW_TASK_PPI_INVALID) {
294269
return;
295270
}
296271

297-
/* {a} RADIO.TASKS_{?} <-- DPPIC_10[dppi_ch]
298-
* It is the responsibility of the user of this platform to make the {a} connection
299-
* and pass the DPPI channel number as a parameter here.
272+
/* Setup a connection between Peri and Rad domain. For Rad domain use provided channel.
273+
* Remaining resources (bridge and dppi channel in PERI) allocate dynamically.
300274
*/
275+
err = nrfx_gppi_ext_conn_alloc(NRFX_GPPI_DOMAIN_PERI, NRFX_GPPI_DOMAIN_RAD,
276+
&peri_rad_handle, &resource);
277+
__ASSERT_NO_MSG(err == 0);
301278

302-
/* {b} DPPIC_10 <-- PPIB_11 */
303-
NRF_DPPI_ENDPOINT_SETUP(
304-
nrfx_ppib_receive_event_address_get(&ppib11_21.left, peri_ppib_ch), dppi_ch);
279+
err = nrfx_gppi_ep_attach(eep, peri_rad_handle);
280+
__ASSERT_NO_MSG(err == 0);
305281

306-
err = nrfx_dppi_channel_enable(&dppi20, peri_dppi_ch);
307-
__ASSERT_NO_MSG(err == NRFX_SUCCESS);
282+
nrfx_gppi_conn_enable(peri_rad_handle);
308283
}
309284

310285
void nrf_802154_platform_sl_lptimer_hw_task_local_domain_connections_clear(void)
311286
{
312-
nrfx_err_t err;
313-
314-
NRF_DPPI_ENDPOINT_CLEAR(
315-
nrfx_ppib_receive_event_address_get(&ppib11_21.left, peri_ppib_ch));
316-
317-
err = nrfx_dppi_channel_disable(&dppi20, peri_dppi_ch);
318-
__ASSERT_NO_MSG(err == NRFX_SUCCESS);
287+
nrfx_gppi_conn_disable(peri_rad_handle);
319288
}
320289

321290
#endif

modules/nrfxlib/nrf_802154/sl/platform/nrf_802154_platform_sl_lptimer_zephyr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,15 @@ static void hw_task_rtc_cc_bind_to_ppi(int32_t cc_num, uint32_t ppi_num)
139139
{
140140
uint32_t event_address = hw_task_rtc_get_compare_evt_address(cc_num);
141141

142-
nrfx_gppi_event_endpoint_setup(ppi_num, event_address);
142+
nrfx_gppi_ep_to_ch_attach(event_address, ppi_num);
143143
}
144144

145145
static void hw_task_rtc_cc_unbind(int32_t cc_num, uint32_t ppi_num)
146146
{
147147
if (ppi_num != NRF_802154_SL_HW_TASK_PPI_INVALID) {
148148
uint32_t event_address = hw_task_rtc_get_compare_evt_address(cc_num);
149149

150-
nrfx_gppi_event_endpoint_clear(ppi_num, event_address);
150+
nrfx_gppi_ep_ch_clear(event_address, ppi_num);
151151
}
152152
}
153153

@@ -426,7 +426,7 @@ nrf_802154_sl_lptimer_platform_result_t nrf_802154_platform_sl_lptimer_hw_task_p
426426
}
427427

428428
if (ppi_channel != NRF_802154_SL_HW_TASK_PPI_INVALID) {
429-
nrfx_gppi_event_endpoint_setup(ppi_channel, evt_address);
429+
nrfx_gppi_ep_to_ch_attach(evt_address, ppi_channel);
430430
}
431431
m_hw_task.ppi = ppi_channel;
432432
m_hw_task.fire_lpticks = fire_lpticks;

modules/nrfxlib/nrf_802154/sl/platform/nrf_802154_platform_timestamper.c

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -227,51 +227,41 @@ void nrf_802154_platform_timestamper_local_domain_connections_setup(uint32_t dpp
227227
* {e} DPPIC_20 --> GRTC.CC
228228
*/
229229

230-
#include <nrfx_ppib.h>
231-
#include <nrfx_dppi.h>
230+
#include <helpers/nrfx_gppi.h>
231+
#include <helpers/nrfx_gppi_lumos.h>
232232

233-
#define INVALID_CHANNEL UINT8_MAX
234-
235-
static nrfx_dppi_t dppi20 = NRFX_DPPI_INSTANCE(20);
236-
static nrfx_ppib_interconnect_t ppib11_21 = NRFX_PPIB_INTERCONNECT_INSTANCE(11, 21);
237-
static uint8_t peri_dppi_ch = INVALID_CHANNEL;
238-
static uint8_t peri_ppib_ch = INVALID_CHANNEL;
233+
static nrfx_gppi_handle_t rad_peri_handle;
239234

240235
void nrf_802154_platform_timestamper_cross_domain_connections_setup(void)
241236
{
242-
nrfx_err_t err;
243-
244-
err = nrfx_dppi_channel_alloc(&dppi20, &peri_dppi_ch);
245-
__ASSERT_NO_MSG(err == NRFX_SUCCESS);
246-
247-
err = nrfx_ppib_channel_alloc(&ppib11_21, &peri_ppib_ch);
248-
__ASSERT_NO_MSG(err == NRFX_SUCCESS);
249-
250-
/* {d} PPIB_21 --> DPPIC_20 */
251-
NRF_DPPI_ENDPOINT_SETUP(
252-
nrfx_ppib_receive_event_address_get(&ppib11_21.right, peri_ppib_ch), peri_dppi_ch);
253-
254-
/* {e} DPPIC_20[dppi_ch] --> GRTC.CC[cc_channel] */
237+
__ASSERT_NO_MSG(rad_peri_handle != 0);
255238
nrf_grtc_task_t capture_task =
256239
nrfy_grtc_sys_counter_capture_task_get(m_timestamp_cc_channel);
257-
NRF_DPPI_ENDPOINT_SETUP(nrfy_grtc_task_address_get(NRF_GRTC, capture_task), peri_dppi_ch);
240+
uint32_t tep = nrfy_grtc_task_address_get(NRF_GRTC, capture_task);
241+
int err;
242+
243+
/* Add task endpoint (GRTC capture) to the previously configured connection. */
244+
err = nrfx_gppi_ep_attach(tep, rad_peri_handle);
245+
__ASSERT_NO_MSG(err == 0);
258246

259-
err = nrfx_dppi_channel_enable(&dppi20, peri_dppi_ch);
260-
__ASSERT_NO_MSG(err == NRFX_SUCCESS);
247+
nrfx_gppi_conn_enable(rad_peri_handle);
261248
}
262249

263250
void nrf_802154_platform_timestamper_local_domain_connections_setup(uint32_t dppi_ch)
264251
{
265-
z_nrf_grtc_timer_capture_prepare(m_timestamp_cc_channel);
252+
nrfx_gppi_resource_t resource = {
253+
.domain_id = NRFX_GPPI_DOMAIN_RAD,
254+
.channel = dppi_ch
255+
};
256+
int err;
266257

267-
/* {a} RADIO.EVENT_{?} --> DPPIC_10
268-
* It is the responsibility of the user of this platform to make the {a} connection
269-
* and pass the DPPI channel number as a parameter here.
258+
z_nrf_grtc_timer_capture_prepare(m_timestamp_cc_channel);
259+
/* Setup a connection between Rad and Peri domain. For Rad domain use provided channel.
260+
* Remaining resources (bridge and dppi channel in PERI) allocate dynamically.
270261
*/
271-
272-
/* {b} DPPIC_10 --> PPIB_11 */
273-
NRF_DPPI_ENDPOINT_SETUP(
274-
nrfx_ppib_send_task_address_get(&ppib11_21.left, peri_ppib_ch), dppi_ch);
262+
err = nrfx_gppi_ext_conn_alloc(NRFX_GPPI_DOMAIN_RAD, NRFX_GPPI_DOMAIN_PERI,
263+
&rad_peri_handle, &resource);
264+
__ASSERT_NO_MSG(err == 0);
275265
}
276266

277267
#endif

0 commit comments

Comments
 (0)