@@ -24,21 +24,6 @@ LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL);
24
24
25
25
#include <zephyr/drivers/pinctrl.h>
26
26
27
- /* Generalize PPI or DPPI channel management */
28
- #if defined(PPI_PRESENT )
29
- #include <nrfx_ppi.h>
30
- #define gppi_channel_t nrf_ppi_channel_t
31
- #define gppi_channel_alloc nrfx_ppi_channel_alloc
32
- #define gppi_channel_enable nrfx_ppi_channel_enable
33
- #elif defined(DPPI_PRESENT )
34
- #include <nrfx_dppi.h>
35
- #define gppi_channel_t uint8_t
36
- #define gppi_channel_alloc nrfx_dppi_channel_alloc
37
- #define gppi_channel_enable nrfx_dppi_channel_enable
38
- #else
39
- #error "No PPI or DPPI"
40
- #endif
41
-
42
27
#define UARTE (idx ) DT_NODELABEL(uart##idx)
43
28
#define UARTE_HAS_PROP (idx , prop ) DT_NODE_HAS_PROP(UARTE(idx), prop)
44
29
#define UARTE_PROP (idx , prop ) DT_PROP(UARTE(idx), prop)
@@ -185,7 +170,7 @@ struct uarte_nrfx_data {
185
170
atomic_val_t poll_out_lock ;
186
171
uint8_t * char_out ;
187
172
uint8_t * rx_data ;
188
- gppi_channel_t ppi_ch_endtx ;
173
+ uint8_t ppi_ch_endtx ;
189
174
};
190
175
191
176
#define UARTE_LOW_POWER_TX BIT(0)
@@ -618,6 +603,8 @@ static int uarte_nrfx_rx_counting_init(const struct device *dev)
618
603
if (HW_RX_COUNTING_ENABLED (cfg )) {
619
604
nrfx_timer_config_t tmr_config = NRFX_TIMER_DEFAULT_CONFIG (
620
605
NRF_TIMER_BASE_FREQUENCY_GET (cfg -> timer .p_reg ));
606
+ uint32_t evt_addr = nrf_uarte_event_address_get (uarte , NRF_UARTE_EVENT_RXDRDY );
607
+ uint32_t tsk_addr = nrfx_timer_task_address_get (& cfg -> timer , NRF_TIMER_TASK_COUNT );
621
608
622
609
tmr_config .mode = NRF_TIMER_MODE_COUNTER ;
623
610
tmr_config .bit_width = NRF_TIMER_BIT_WIDTH_32 ;
@@ -632,37 +619,15 @@ static int uarte_nrfx_rx_counting_init(const struct device *dev)
632
619
nrfx_timer_clear (& cfg -> timer );
633
620
}
634
621
635
- ret = gppi_channel_alloc (& data -> async -> rx .cnt .ppi );
622
+ ret = nrfx_gppi_channel_alloc (& data -> async -> rx .cnt .ppi );
636
623
if (ret != NRFX_SUCCESS ) {
637
624
LOG_ERR ("Failed to allocate PPI Channel" );
638
625
nrfx_timer_uninit (& cfg -> timer );
639
626
return - EINVAL ;
640
627
}
641
628
642
- #if CONFIG_HAS_HW_NRF_PPI
643
- ret = nrfx_ppi_channel_assign (
644
- data -> async -> rx .cnt .ppi ,
645
- nrf_uarte_event_address_get (uarte ,
646
- NRF_UARTE_EVENT_RXDRDY ),
647
- nrfx_timer_task_address_get (& cfg -> timer ,
648
- NRF_TIMER_TASK_COUNT ));
649
-
650
- if (ret != NRFX_SUCCESS ) {
651
- return - EIO ;
652
- }
653
- #else
654
- nrf_uarte_publish_set (uarte ,
655
- NRF_UARTE_EVENT_RXDRDY ,
656
- data -> async -> rx .cnt .ppi );
657
- nrf_timer_subscribe_set (cfg -> timer .p_reg ,
658
- NRF_TIMER_TASK_COUNT ,
659
- data -> async -> rx .cnt .ppi );
660
-
661
- #endif
662
- ret = gppi_channel_enable (data -> async -> rx .cnt .ppi );
663
- if (ret != NRFX_SUCCESS ) {
664
- return - EIO ;
665
- }
629
+ nrfx_gppi_channel_endpoints_setup (data -> async -> rx .cnt .ppi , evt_addr , tsk_addr );
630
+ nrfx_gppi_channels_enable (BIT (data -> async -> rx .cnt .ppi ));
666
631
} else {
667
632
nrf_uarte_int_enable (uarte , NRF_UARTE_INT_RXDRDY_MASK );
668
633
}
@@ -1745,7 +1710,7 @@ static int endtx_stoptx_ppi_init(NRF_UARTE_Type *uarte,
1745
1710
{
1746
1711
nrfx_err_t ret ;
1747
1712
1748
- ret = gppi_channel_alloc (& data -> ppi_ch_endtx );
1713
+ ret = nrfx_gppi_channel_alloc (& data -> ppi_ch_endtx );
1749
1714
if (ret != NRFX_SUCCESS ) {
1750
1715
LOG_ERR ("Failed to allocate PPI Channel" );
1751
1716
return - EIO ;
0 commit comments