1# Virtual UART RTT driver option
2
3# Copyright (c) 2019 omSquare s.r.o.
4# SPDX-License-Identifier: Apache-2.0
5
6menuconfig UART_RTT
7	bool "Enable UART RTT driver"
8	depends on USE_SEGGER_RTT
9	select SEGGER_RTT_CUSTOM_LOCKING
10	help
11	  This option enables access RTT channel as UART device.
12
13if UART_RTT
14
15# Workaround for not being able to have commas in macro arguments
16DT_COMPAT_SEGGER_RTT_UART  := segger,rtt-uart
17
18config UART_RTT_0
19	def_bool $(dt_nodelabel_has_compat,rtt0,$(DT_COMPAT_SEGGER_RTT_UART))
20	depends on SEGGER_RTT_MAX_NUM_UP_BUFFERS >= 1 && SEGGER_RTT_MAX_NUM_DOWN_BUFFERS >= 1
21	depends on SEGGER_RTT_MODE_NO_BLOCK_SKIP
22	select SERIAL_HAS_DRIVER
23	select UART_RTT_DRIVER
24	help
25	  Enable UART on (default) RTT channel 0. Default channel has to be configured in non-blocking skip mode.
26
27config UART_RTT_1
28	def_bool $(dt_nodelabel_has_compat,rtt1,$(DT_COMPAT_SEGGER_RTT_UART))
29	depends on SEGGER_RTT_MAX_NUM_UP_BUFFERS >= 2 && SEGGER_RTT_MAX_NUM_DOWN_BUFFERS >= 2
30	select SERIAL_HAS_DRIVER
31	select UART_RTT_DRIVER
32	help
33	  Enable UART on RTT channel 1
34
35config UART_RTT_2
36	def_bool $(dt_nodelabel_has_compat,rtt2,$(DT_COMPAT_SEGGER_RTT_UART))
37	depends on SEGGER_RTT_MAX_NUM_UP_BUFFERS >= 3 && SEGGER_RTT_MAX_NUM_DOWN_BUFFERS >= 3
38	select SERIAL_HAS_DRIVER
39	select UART_RTT_DRIVER
40	help
41	  Enable UART on RTT channel 2
42
43config UART_RTT_3
44	def_bool $(dt_nodelabel_has_compat,rtt3,$(DT_COMPAT_SEGGER_RTT_UART))
45	depends on SEGGER_RTT_MAX_NUM_UP_BUFFERS >= 4 && SEGGER_RTT_MAX_NUM_DOWN_BUFFERS >= 4
46	select SERIAL_HAS_DRIVER
47	select UART_RTT_DRIVER
48	help
49	  Enable UART on RTT channel 3
50
51config UART_RTT_DRIVER
52	bool
53
54endif
55