1# SPDX-License-Identifier: Apache-2.0
2
3config UART_NATIVE_POSIX
4	bool "UART driver for native_sim/posix"
5	default y
6	depends on DT_HAS_ZEPHYR_NATIVE_POSIX_UART_ENABLED
7	select SERIAL_HAS_DRIVER
8	help
9	  This enables a UART driver for the POSIX ARCH with up to 2 UARTs.
10	  For the first UART port, the driver can be configured
11	  to either connect to the terminal from which the executable was run, or into
12	  one dedicated pseudoterminal for that UART.
13
14if UART_NATIVE_POSIX
15
16choice NATIVE_UART_0
17	prompt "Native UART Port 0 connection"
18	default NATIVE_UART_0_ON_OWN_PTY
19
20config NATIVE_UART_0_ON_OWN_PTY
21	bool "Connect the UART to its own pseudo terminal"
22	help
23	  Connect this UART to its own pseudoterminal. This is the preferred
24	  option for users who want to use Zephyr's shell.
25	  Moreover this option does not conflict with any other native
26	  backend which may use the invoking shell standard input/output.
27
28config NATIVE_UART_0_ON_STDINOUT
29	bool "Connect the UART to the invoking shell stdin/stdout"
30	help
31	  Connect this UART to the stdin & stdout of the calling shell/terminal
32	  which invoked the native executable. This is good enough for
33	  automated testing, or when feeding from a file/pipe.
34	  Note that other, non UART messages, will also be printed to the
35	  terminal.
36	  It is strongly discouraged to try to use this option with the new
37	  shell interactively, as the default terminal configuration is NOT
38	  appropriate for interactive use.
39
40endchoice
41
42config UART_NATIVE_WAIT_PTS_READY_ENABLE
43	bool "Support waiting for pseudo terminal client readiness"
44	depends on NATIVE_UART_0_ON_OWN_PTY || UART_NATIVE_POSIX_PORT_1_ENABLE
45	help
46	  When this option is selected a new command line switch is provided:
47	  ``--wait_uart``
48	  When ``--wait_uart`` is used, writes to the UART will be held until a
49	  client has connected to the slave side of the pseudoterminal.
50	  Otherwise writes are sent irrespectively.
51
52config UART_NATIVE_POSIX_PORT_1_ENABLE
53	bool "Second UART port"
54	help
55	  Useful if you need to have another serial connection to host.
56	  This is used for example in PPP (Point-to-Point Protocol)
57	  implementation.
58
59config NATIVE_UART_AUTOATTACH_DEFAULT_CMD
60	string "Default command to attach the UART to a new terminal"
61	default "xterm -e screen %s &"
62	help
63	  If the native executable is called with the --attach_uart
64	  command line option, this will be the default command which will be
65	  run to attach a new terminal to the 1st UART.
66	  Note that this command must have one, and only one, '%s' as
67	  placeholder for the pseudoterminal device name (e.g. /dev/pts/35)
68	  This is only applicable if the UART_0 is configured to use its own
69	  PTY with NATIVE_UART_0_ON_OWN_PTY.
70	  The 2nd UART will not be affected by this option.
71	  If you are using GNOME, then you can use this command string
72	  'gnome-terminal -- screen %s'
73
74endif # UART_NATIVE_POSIX
75