Skip to content

Commit 4cc213b

Browse files
nordic-krchcarlescufi
authored andcommitted
drivers: serial: nrfx: Add new shim based on nrfx_uarte
Add new shim which is based on nrfx driver. Legacy shim is kept for transition period. It can be used after setting CONFIG_UART_NRFX_UARTE_LEGACY_SHIM. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 4fcf8e0 commit 4cc213b

File tree

4 files changed

+1091
-3
lines changed

4 files changed

+1091
-3
lines changed

drivers/serial/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ zephyr_library_sources_ifdef(CONFIG_UART_MIV uart_miv.c)
2626
zephyr_library_sources_ifdef(CONFIG_UART_MSP432P4XX uart_msp432p4xx.c)
2727
zephyr_library_sources_ifdef(CONFIG_UART_NS16550 uart_ns16550.c)
2828
zephyr_library_sources_ifdef(CONFIG_UART_NRFX_UART uart_nrfx_uart.c)
29-
zephyr_library_sources_ifdef(CONFIG_UART_NRFX_UARTE uart_nrfx_uarte.c)
29+
if (CONFIG_UART_NRFX_UARTE)
30+
if (CONFIG_UART_NRFX_UARTE_LEGACY_SHIM)
31+
zephyr_library_sources(uart_nrfx_uarte.c)
32+
else()
33+
zephyr_library_sources(uart_nrfx_uarte2.c)
34+
endif()
35+
endif()
3036
zephyr_library_sources_ifdef(CONFIG_UART_NUMICRO uart_numicro.c)
3137
zephyr_library_sources_ifdef(CONFIG_UART_SAM uart_sam.c)
3238
zephyr_library_sources_ifdef(CONFIG_USART_SAM usart_sam.c)

drivers/serial/Kconfig.nrfx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,20 @@ config UART_NRFX_UART
2525
config UART_NRFX_UARTE
2626
def_bool y
2727
depends on DT_HAS_NORDIC_NRF_UARTE_ENABLED
28+
imply NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM
29+
imply NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM
30+
31+
config UART_NRFX_UARTE_LEGACY_SHIM
32+
bool "Legacy UARTE shim"
33+
depends on UART_NRFX_UARTE
34+
# New shim takes more ROM. Until it is fixed use legacy shim in memory
35+
# constraint case.
36+
default y if MCUBOOT
2837

2938
config UART_ASYNC_TX_CACHE_SIZE
3039
int "TX cache buffer size"
3140
depends on UART_ASYNC_API
32-
depends on UART_NRFX_UARTE
41+
depends on UART_NRFX_UARTE_LEGACY_SHIM
3342
default 8
3443
help
3544
For UARTE, TX cache buffer is used when provided TX buffer is not located

drivers/serial/Kconfig.nrfx_uart_instance

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
config UART_$(nrfx_uart_num)_INTERRUPT_DRIVEN
77
bool "Interrupt support on port $(nrfx_uart_num)"
88
depends on UART_INTERRUPT_DRIVEN
9+
select UART_ASYNC_TO_INT_DRIVEN_API if !UART_NRFX_UARTE_LEGACY_SHIM
910
default y
1011
help
1112
This option enables UART interrupt support on port $(nrfx_uart_num).
@@ -27,14 +28,18 @@ config UART_$(nrfx_uart_num)_ENHANCED_POLL_OUT
2728
When enabled, polling out does not trigger interrupt which stops TX.
2829
Feature uses a PPI channel.
2930

31+
config NRFX_UARTE$(nrfx_uart_num)
32+
def_bool y if HAS_HW_NRF_UARTE$(nrfx_uart_num) && !UART_NRFX_UARTE_LEGACY_SHIM
33+
3034
config UART_$(nrfx_uart_num)_NRF_PARITY_BIT
3135
bool "Parity bit"
3236
help
3337
Enable parity bit.
3438

3539
config UART_$(nrfx_uart_num)_NRF_TX_BUFFER_SIZE
3640
int "Size of RAM buffer"
37-
depends on UART_INTERRUPT_DRIVEN
41+
depends on HAS_HW_NRF_UARTE$(nrfx_uart_num)
42+
depends on UART_NRFX_UARTE_LEGACY_SHIM
3843
range 1 65535
3944
default 32
4045
help
@@ -46,6 +51,7 @@ config UART_$(nrfx_uart_num)_NRF_HW_ASYNC
4651
bool "Use hardware RX byte counting"
4752
depends on HAS_HW_NRF_UARTE$(nrfx_uart_num)
4853
depends on UART_ASYNC_API
54+
depends on UART_NRFX_UARTE_LEGACY_SHIM
4955
select NRFX_PPI if HAS_HW_NRF_PPI
5056
select NRFX_DPPI if HAS_HW_NRF_DPPIC
5157
help
@@ -58,6 +64,7 @@ config UART_$(nrfx_uart_num)_NRF_ASYNC_LOW_POWER
5864
bool "Low power mode"
5965
depends on HAS_HW_NRF_UARTE$(nrfx_uart_num)
6066
depends on UART_ASYNC_API
67+
depends on UART_NRFX_UARTE_LEGACY_SHIM
6168
help
6269
When enabled, UARTE is enabled before each TX or RX usage and disabled
6370
when not used. Disabling UARTE while in idle allows to achieve lowest
@@ -67,6 +74,42 @@ config UART_$(nrfx_uart_num)_NRF_HW_ASYNC_TIMER
6774
int "Timer instance"
6875
depends on UART_$(nrfx_uart_num)_NRF_HW_ASYNC
6976

77+
config UART_$(nrfx_uart_num)_TX_CACHE_SIZE
78+
int "TX cache buffer size"
79+
depends on !UART_NRFX_UARTE_LEGACY_SHIM
80+
default 8
81+
help
82+
For UARTE, TX cache buffer is used when provided TX buffer is not located
83+
in memory which can be used by the EasyDMA.
84+
85+
config UART_$(nrfx_uart_num)_RX_CACHE_SIZE
86+
int "RX cache buffer size"
87+
depends on !UART_NRFX_UARTE_LEGACY_SHIM
88+
default 32 if $(dt_nodelabel_has_compat,ram3x,$(DT_COMPAT_MMIO_SRAM))
89+
default 5
90+
range 5 255
91+
help
92+
For UARTE, RX cache buffer is used when provided RX buffer is not located
93+
in memory which can be used by the EasyDMA. It is also used to store
94+
flushed data.
95+
96+
config UART_$(nrfx_uart_num)_A2I_RX_SIZE
97+
depends on !UART_NRFX_UARTE_LEGACY_SHIM
98+
int "Asynchronous to interrupt driven adaptation layer RX buffer size"
99+
default 64 if UART_$(nrfx_uart_num)_INTERRUPT_DRIVEN
100+
default 0
101+
help
102+
Amount of space dedicated for RX. It is divided into chunks with some
103+
amount of that space used for control data.
104+
105+
config UART_$(nrfx_uart_num)_A2I_RX_BUF_COUNT
106+
depends on !UART_NRFX_UARTE_LEGACY_SHIM
107+
int "Asynchronous to interrupt driven adaptation layer RX buffer count"
108+
default 8 if UART_$(nrfx_uart_num)_INTERRUPT_DRIVEN
109+
default 0
110+
help
111+
Number of chunks into RX space is divided.
112+
70113
config UART_$(nrfx_uart_num)_GPIO_MANAGEMENT
71114
bool "GPIO management on port $(nrfx_uart_num)"
72115
depends on PM_DEVICE

0 commit comments

Comments
 (0)