@@ -306,6 +306,7 @@ struct uarte_nrfx_data {
306
306
#endif
307
307
#ifdef UARTE_ANY_ASYNC
308
308
struct uarte_async_cb * async ;
309
+ nrfx_timer_t timer ;
309
310
#endif
310
311
atomic_val_t poll_out_lock ;
311
312
atomic_t flags ;
@@ -448,7 +449,6 @@ struct uarte_nrfx_config {
448
449
size_t bounce_buf_swap_len ;
449
450
struct uarte_async_rx_cbwt * cbwt_data ;
450
451
#endif
451
- nrfx_timer_t timer ;
452
452
uint8_t * tx_cache ;
453
453
uint8_t * rx_flush_buf ;
454
454
#endif
@@ -878,7 +878,7 @@ static void uarte_periph_enable(const struct device *dev)
878
878
#ifdef UARTE_ANY_ASYNC
879
879
if (data -> async ) {
880
880
if (HW_RX_COUNTING_ENABLED (config )) {
881
- const nrfx_timer_t * timer = & config -> timer ;
881
+ nrfx_timer_t * timer = & data -> timer ;
882
882
883
883
nrfx_timer_enable (timer );
884
884
@@ -1067,26 +1067,26 @@ static int uarte_nrfx_rx_counting_init(const struct device *dev)
1067
1067
1068
1068
if (HW_RX_COUNTING_ENABLED (cfg )) {
1069
1069
nrfx_timer_config_t tmr_config = NRFX_TIMER_DEFAULT_CONFIG (
1070
- NRF_TIMER_BASE_FREQUENCY_GET (cfg -> timer .p_reg ));
1070
+ NRF_TIMER_BASE_FREQUENCY_GET (data -> timer .p_reg ));
1071
1071
uint32_t evt_addr = nrf_uarte_event_address_get (uarte , NRF_UARTE_EVENT_RXDRDY );
1072
- uint32_t tsk_addr = nrfx_timer_task_address_get (& cfg -> timer , NRF_TIMER_TASK_COUNT );
1072
+ uint32_t tsk_addr = nrfx_timer_task_address_get (& data -> timer , NRF_TIMER_TASK_COUNT );
1073
1073
1074
1074
tmr_config .mode = NRF_TIMER_MODE_COUNTER ;
1075
1075
tmr_config .bit_width = NRF_TIMER_BIT_WIDTH_32 ;
1076
- ret = nrfx_timer_init (& cfg -> timer ,
1076
+ ret = nrfx_timer_init (& data -> timer ,
1077
1077
& tmr_config ,
1078
1078
timer_handler );
1079
1079
if (ret != NRFX_SUCCESS ) {
1080
1080
LOG_ERR ("Timer already initialized" );
1081
1081
return - EINVAL ;
1082
1082
}
1083
1083
1084
- nrfx_timer_clear (& cfg -> timer );
1084
+ nrfx_timer_clear (& data -> timer );
1085
1085
1086
1086
ret = nrfx_gppi_channel_alloc (& data -> async -> rx .cnt .ppi );
1087
1087
if (ret != NRFX_SUCCESS ) {
1088
1088
LOG_ERR ("Failed to allocate PPI Channel" );
1089
- nrfx_timer_uninit (& cfg -> timer );
1089
+ nrfx_timer_uninit (& data -> timer );
1090
1090
return - EINVAL ;
1091
1091
}
1092
1092
@@ -3639,8 +3639,8 @@ static int uarte_instance_deinit(const struct device *dev)
3639
3639
IF_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER, \
3640
3640
(UARTE_COUNT_BYTES_WITH_TIMER_CONFIG(idx))) \
3641
3641
IF_ENABLED(CONFIG_UART_##idx##_NRF_HW_ASYNC, \
3642
- (.timer = NRFX_TIMER_INSTANCE( \
3643
- CONFIG_UART_##idx##_NRF_HW_ASYNC_TIMER),)) \
3642
+ (.timer = NRFX_TIMER_INSTANCE(NRF_TIMER_INST_GET( \
3643
+ CONFIG_UART_##idx##_NRF_HW_ASYNC_TIMER)) ,)) \
3644
3644
IF_ENABLED(INSTANCE_IS_FAST(_, /*empty*/ , idx , _), \
3645
3645
(.clk_dev = DEVICE_DT_GET_OR_NULL(DT_CLOCKS_CTLR(UARTE(idx))), \
3646
3646
.clk_spec = { \
0 commit comments