Skip to content

Commit acb2be9

Browse files
committed
[nrf fromlist] soc: nordic: nrf53: Align to the new GPPI API
Align use of GPPI API. Upstream PR #: 98327 Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 5767eac commit acb2be9

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

soc/nordic/nrf53/soc.c

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -390,28 +390,25 @@ bool z_arm_on_enter_cpu_idle(void)
390390
/* RTC pretick - application core part. */
391391
static int rtc_pretick_cpuapp_init(void)
392392
{
393-
uint8_t ch;
394-
nrfx_err_t err;
393+
nrfx_gppi_handle_t handle;
394+
int err;
395395
nrf_ipc_event_t ipc_event =
396396
nrf_ipc_receive_event_get(CONFIG_SOC_NRF53_RTC_PRETICK_IPC_CH_FROM_NET);
397397
nrf_ipc_task_t ipc_task =
398398
nrf_ipc_send_task_get(CONFIG_SOC_NRF53_RTC_PRETICK_IPC_CH_TO_NET);
399399
uint32_t task_ipc = nrf_ipc_task_address_get(NRF_IPC, ipc_task);
400400
uint32_t evt_ipc = nrf_ipc_event_address_get(NRF_IPC, ipc_event);
401401

402-
err = nrfx_gppi_channel_alloc(&ch);
403-
if (err != NRFX_SUCCESS) {
404-
return -ENOMEM;
405-
}
406-
407402
nrf_ipc_receive_config_set(NRF_IPC, CONFIG_SOC_NRF53_RTC_PRETICK_IPC_CH_FROM_NET,
408403
BIT(CONFIG_SOC_NRF53_RTC_PRETICK_IPC_CH_FROM_NET));
409404
nrf_ipc_send_config_set(NRF_IPC, CONFIG_SOC_NRF53_RTC_PRETICK_IPC_CH_TO_NET,
410405
BIT(CONFIG_SOC_NRF53_RTC_PRETICK_IPC_CH_TO_NET));
406+
err = nrfx_gppi_conn_alloc(evt_ipc, task_ipc, &handle);
407+
if (err < 0) {
408+
return err;
409+
}
411410

412-
nrfx_gppi_task_endpoint_setup(ch, task_ipc);
413-
nrfx_gppi_event_endpoint_setup(ch, evt_ipc);
414-
nrfx_gppi_channels_enable(BIT(ch));
411+
nrfx_gppi_conn_enable(handle);
415412

416413
return 0;
417414
}
@@ -429,7 +426,7 @@ void rtc_pretick_rtc1_isr_hook(void)
429426

430427
static int rtc_pretick_cpunet_init(void)
431428
{
432-
uint8_t ppi_ch;
429+
nrfx_gppi_handle_t ppi_handle;
433430
nrf_ipc_task_t ipc_task =
434431
nrf_ipc_send_task_get(CONFIG_SOC_NRF53_RTC_PRETICK_IPC_CH_FROM_NET);
435432
nrf_ipc_event_t ipc_event =
@@ -439,6 +436,7 @@ static int rtc_pretick_cpunet_init(void)
439436
uint32_t task_wdt = nrf_wdt_task_address_get(NRF_WDT, NRF_WDT_TASK_START);
440437
uint32_t evt_cc = nrf_rtc_event_address_get(NRF_RTC1,
441438
NRF_RTC_CHANNEL_EVENT_ADDR(RTC1_PRETICK_CC_CHAN));
439+
int err;
442440

443441
/* Configure Watchdog to allow stopping. */
444442
nrf_wdt_behaviour_set(NRF_WDT, WDT_CONFIG_STOPEN_Msk | BIT(4));
@@ -451,17 +449,16 @@ static int rtc_pretick_cpunet_init(void)
451449
BIT(CONFIG_SOC_NRF53_RTC_PRETICK_IPC_CH_FROM_NET));
452450

453451
/* Allocate PPI channel for RTC Compare event publishers that starts WDT. */
454-
nrfx_err_t err = nrfx_gppi_channel_alloc(&ppi_ch);
455-
456-
if (err != NRFX_SUCCESS) {
457-
return -ENOMEM;
452+
err = nrfx_gppi_domain_conn_alloc(0, 0, &ppi_handle);
453+
if (err < 0) {
454+
return err;
458455
}
459456

460-
nrfx_gppi_event_endpoint_setup(ppi_ch, evt_cc);
461-
nrfx_gppi_task_endpoint_setup(ppi_ch, task_ipc);
462-
nrfx_gppi_event_endpoint_setup(ppi_ch, evt_ipc);
463-
nrfx_gppi_task_endpoint_setup(ppi_ch, task_wdt);
464-
nrfx_gppi_channels_enable(BIT(ppi_ch));
457+
nrfx_gppi_ep_attach(ppi_handle, evt_cc);
458+
nrfx_gppi_ep_attach(ppi_handle, task_ipc);
459+
nrfx_gppi_ep_attach(ppi_handle, evt_ipc);
460+
nrfx_gppi_ep_attach(ppi_handle, task_wdt);
461+
nrfx_gppi_conn_enable(ppi_handle);
465462

466463
nrf_rtc_event_enable(NRF_RTC1, NRF_RTC_CHANNEL_INT_MASK(RTC1_PRETICK_CC_CHAN));
467464
nrf_rtc_event_clear(NRF_RTC1, NRF_RTC_CHANNEL_EVENT_ADDR(RTC1_PRETICK_CC_CHAN));

0 commit comments

Comments
 (0)