1#nRF UART(E) instance configuration
2
3# Copyright (c) 2023 Nordic Semiconductor ASA
4# SPDX-License-Identifier: Apache-2.0
5
6config UART_$(nrfx_uart_num)_INTERRUPT_DRIVEN
7	bool "Interrupt support on port $(nrfx_uart_num)"
8	depends on UART_INTERRUPT_DRIVEN
9	select UART_ASYNC_TO_INT_DRIVEN_API if !UART_NRFX_UARTE_LEGACY_SHIM
10	default y
11	help
12	  This option enables UART interrupt support on port $(nrfx_uart_num).
13
14config UART_$(nrfx_uart_num)_ASYNC
15	bool "Asynchronous API support on port $(nrfx_uart_num)"
16	depends on UART_ASYNC_API && !UART_$(nrfx_uart_num)_INTERRUPT_DRIVEN
17	default y
18	help
19	  This option enables UART Asynchronous API support on port $(nrfx_uart_num).
20
21config UART_$(nrfx_uart_num)_ENHANCED_POLL_OUT
22	bool "Efficient poll out on port $(nrfx_uart_num)"
23	depends on !$(dt_nodelabel_bool_prop,uart$(nrfx_uart_num),endtx-stoptx-supported)
24	default y
25	depends on HAS_HW_NRF_UARTE$(nrfx_uart_num)
26	depends on HAS_HW_NRF_PPI || HAS_HW_NRF_DPPIC
27	select NRFX_GPPI
28	help
29	  When enabled, polling out does not trigger interrupt which stops TX.
30	  Feature uses a PPI channel.
31
32config NRFX_UARTE$(nrfx_uart_num)
33	def_bool y if HAS_HW_NRF_UARTE$(nrfx_uart_num) && !UART_NRFX_UARTE_LEGACY_SHIM
34
35config UART_$(nrfx_uart_num)_NRF_PARITY_BIT
36	bool "Parity bit"
37	help
38	  Enable parity bit.
39
40config UART_$(nrfx_uart_num)_NRF_TX_BUFFER_SIZE
41	int "Size of RAM buffer"
42	depends on HAS_HW_NRF_UARTE$(nrfx_uart_num)
43	depends on UART_NRFX_UARTE_LEGACY_SHIM
44	range 1 $(UINT16_MAX)
45	default 32
46	help
47	  Size of the transmit buffer for API function: fifo_fill.
48	  This value is limited by range of TXD.MAXCNT register for
49	  particular SoC.
50
51config UART_$(nrfx_uart_num)_NRF_HW_ASYNC
52	bool "Use hardware RX byte counting"
53	depends on HAS_HW_NRF_UARTE$(nrfx_uart_num)
54	depends on UART_ASYNC_API
55	depends on UART_NRFX_UARTE_LEGACY_SHIM
56	depends on HAS_HW_NRF_PPI || HAS_HW_NRF_DPPIC
57	select NRFX_GPPI
58	help
59	  If default driver uses interrupts to count incoming bytes, it is possible
60	  that with higher speeds and/or high cpu load some data can be lost.
61	  It is recommended to use hardware byte counting in such scenarios.
62	  Hardware RX byte counting requires timer instance and one PPI channel.
63
64config UART_$(nrfx_uart_num)_NRF_ASYNC_LOW_POWER
65	bool "Low power mode"
66	depends on HAS_HW_NRF_UARTE$(nrfx_uart_num)
67	depends on UART_ASYNC_API
68	depends on UART_NRFX_UARTE_LEGACY_SHIM
69	default y if !PM_DEVICE
70	help
71	  When enabled, UARTE is enabled before each TX or RX usage and disabled
72	  when not used. Disabling UARTE while in idle allows to achieve lowest
73	  power consumption. It is only feasible if receiver is not always on.
74	  This option is irrelevant when device power management (PM) is enabled
75	  because then device state is controlled by the PM actions.
76
77
78config UART_$(nrfx_uart_num)_NRF_HW_ASYNC_TIMER
79	int "Timer instance"
80	depends on UART_$(nrfx_uart_num)_NRF_HW_ASYNC
81
82config UART_$(nrfx_uart_num)_HAS_RX_CACHE_SECTION
83	def_bool $(dt_nodelabel_has_prop,uart$(nrfx_uart_num),memory-regions)
84	imply NRFX_UARTE_CONFIG_RX_CACHE_ENABLED
85	help
86	  This helper symbol indicates the existence of a linker section which
87	  can be dedicated to an RX cache buffer.
88
89config UART_$(nrfx_uart_num)_TX_CACHE_SIZE
90	int "TX cache buffer size"
91	depends on !UART_NRFX_UARTE_LEGACY_SHIM
92	default 8
93	help
94	  For UARTE, TX cache buffer is used when provided TX buffer is not located
95	  in memory which can be used by the EasyDMA.
96
97config UART_$(nrfx_uart_num)_RX_CACHE_SIZE
98	int "RX cache buffer size"
99	depends on !UART_NRFX_UARTE_LEGACY_SHIM
100	default 32 if UART_$(nrfx_uart_num)_HAS_RX_CACHE_SECTION
101	default 5
102	range 5 $(UINT8_MAX)
103	help
104	  For UARTE, RX cache buffer is used when provided RX buffer is not located
105	  in memory which can be used by the EasyDMA. It is also used to store
106	  flushed data.
107
108config UART_$(nrfx_uart_num)_A2I_RX_SIZE
109	depends on !UART_NRFX_UARTE_LEGACY_SHIM
110	int "Asynchronous to interrupt driven adaptation layer RX buffer size"
111	default 64 if UART_$(nrfx_uart_num)_INTERRUPT_DRIVEN
112	default 0
113	help
114	  Amount of space dedicated for RX. It is divided into chunks with some
115	  amount of that space used for control data.
116
117config UART_$(nrfx_uart_num)_A2I_RX_BUF_COUNT
118	depends on !UART_NRFX_UARTE_LEGACY_SHIM
119	int "Asynchronous to interrupt driven adaptation layer RX buffer count"
120	default 8 if UART_$(nrfx_uart_num)_INTERRUPT_DRIVEN
121	default 0
122	help
123	  Number of chunks into RX space is divided.
124