Skip to content

Commit f29ca96

Browse files
committed
[nrf fromlist] drivers: serial: nrfx_uarte: Use new GPPI API
Align to changes in the GPPI API. Upstream PR #: 98327 Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 3ec02b2 commit f29ca96

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

drivers/serial/uart_nrfx_uarte.c

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ struct uarte_async_rx {
259259
int32_t timeout_slab; /* rx_timeout divided by RX_TIMEOUT_DIV */
260260
int32_t timeout_left; /* Current time left until user callback */
261261
union {
262-
uint8_t ppi;
262+
nrfx_gppi_handle_t ppi;
263263
uint32_t cnt;
264264
} cnt;
265265
/* Flag to ensure that RX timeout won't be executed during ENDRX ISR */
@@ -310,7 +310,7 @@ struct uarte_nrfx_data {
310310
atomic_val_t poll_out_lock;
311311
atomic_t flags;
312312
#ifdef UARTE_ENHANCED_POLL_OUT
313-
uint8_t ppi_ch_endtx;
313+
nrfx_gppi_handle_t ppi_h_endtx;
314314
#endif
315315
};
316316

@@ -1083,15 +1083,14 @@ static int uarte_nrfx_rx_counting_init(const struct device *dev)
10831083

10841084
nrfx_timer_clear(&cfg->timer);
10851085

1086-
ret = nrfx_gppi_channel_alloc(&data->async->rx.cnt.ppi);
1087-
if (ret != NRFX_SUCCESS) {
1086+
ret = nrfx_gppi_conn_alloc(evt_addr, tsk_addr, &data->async->rx.cnt.ppi);
1087+
if (ret < 0) {
10881088
LOG_ERR("Failed to allocate PPI Channel");
10891089
nrfx_timer_uninit(&cfg->timer);
1090-
return -EINVAL;
1090+
return ret;
10911091
}
10921092

1093-
nrfx_gppi_channel_endpoints_setup(data->async->rx.cnt.ppi, evt_addr, tsk_addr);
1094-
nrfx_gppi_channels_enable(BIT(data->async->rx.cnt.ppi));
1093+
nrfx_gppi_conn_enable(data->async->rx.cnt.ppi);
10951094
} else {
10961095
nrf_uarte_int_enable(uarte, NRF_UARTE_INT_RXDRDY_MASK);
10971096
}
@@ -3141,18 +3140,17 @@ static DEVICE_API(uart, uart_nrfx_uarte_driver_api) = {
31413140
static int endtx_stoptx_ppi_init(NRF_UARTE_Type *uarte,
31423141
struct uarte_nrfx_data *data)
31433142
{
3144-
nrfx_err_t ret;
3143+
int ret;
31453144

3146-
ret = nrfx_gppi_channel_alloc(&data->ppi_ch_endtx);
3147-
if (ret != NRFX_SUCCESS) {
3145+
ret = nrfx_gppi_conn_alloc(
3146+
nrf_uarte_event_address_get(uarte, NRF_UARTE_EVENT_ENDTX),
3147+
nrf_uarte_task_address_get(uarte, NRF_UARTE_TASK_STOPTX), &data->ppi_h_endtx);
3148+
if (ret < 0) {
31483149
LOG_ERR("Failed to allocate PPI Channel");
3149-
return -EIO;
3150+
return ret;
31503151
}
31513152

3152-
nrfx_gppi_channel_endpoints_setup(data->ppi_ch_endtx,
3153-
nrf_uarte_event_address_get(uarte, NRF_UARTE_EVENT_ENDTX),
3154-
nrf_uarte_task_address_get(uarte, NRF_UARTE_TASK_STOPTX));
3155-
nrfx_gppi_channels_enable(BIT(data->ppi_ch_endtx));
3153+
nrfx_gppi_conn_enable(data->ppi_h_endtx);
31563154

31573155
return 0;
31583156
}

0 commit comments

Comments
 (0)