Anas Nashif | 3ae5262 | 2019-04-06 09:08:09 -0400 | [diff] [blame] | 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | |
Alberto Escolar Piedras | 013f279 | 2018-09-22 19:19:59 +0200 | [diff] [blame] | 3 | config UART_NATIVE_POSIX |
| 4 | bool "UART driver for native_posix" |
Kumar Gala | 7d5215f | 2022-07-20 13:46:30 -0500 | [diff] [blame] | 5 | default y |
| 6 | depends on DT_HAS_ZEPHYR_NATIVE_POSIX_UART_ENABLED |
Alberto Escolar Piedras | 013f279 | 2018-09-22 19:19:59 +0200 | [diff] [blame] | 7 | select SERIAL_HAS_DRIVER |
Alberto Escolar Piedras | 013f279 | 2018-09-22 19:19:59 +0200 | [diff] [blame] | 8 | help |
Jukka Rissanen | f521996 | 2019-04-15 10:10:02 +0300 | [diff] [blame] | 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 |
Alberto Escolar Piedras | 013f279 | 2018-09-22 19:19:59 +0200 | [diff] [blame] | 11 | to either connect to the terminal from which native_posix was run, or into |
Jukka Rissanen | f521996 | 2019-04-15 10:10:02 +0300 | [diff] [blame] | 12 | one dedicated pseudoterminal for that UART. |
Alberto Escolar Piedras | 013f279 | 2018-09-22 19:19:59 +0200 | [diff] [blame] | 13 | |
| 14 | if UART_NATIVE_POSIX |
| 15 | |
Alberto Escolar Piedras | 013f279 | 2018-09-22 19:19:59 +0200 | [diff] [blame] | 16 | choice |
| 17 | prompt "Native UART Port 0 connection" |
| 18 | default NATIVE_UART_0_ON_OWN_PTY |
| 19 | |
| 20 | config NATIVE_UART_0_ON_OWN_PTY |
| 21 | bool "Connect the UART to its own pseudo terminal" |
| 22 | help |
Jukka Rissanen | f521996 | 2019-04-15 10:10:02 +0300 | [diff] [blame] | 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_posix |
| 26 | backend which may use the calling shell standard input/output. |
Alberto Escolar Piedras | 013f279 | 2018-09-22 19:19:59 +0200 | [diff] [blame] | 27 | |
| 28 | config NATIVE_UART_0_ON_STDINOUT |
| 29 | bool "Connect the UART to the invoking shell stdin/stdout" |
| 30 | help |
Jukka Rissanen | f521996 | 2019-04-15 10:10:02 +0300 | [diff] [blame] | 31 | Connect this UART to the stdin & stdout of the calling shell/terminal |
| 32 | which invoked the native_posix 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. This option should NOT be used in conjunction with |
Alberto Escolar Piedras | acefd36 | 2019-01-18 14:47:40 +0100 | [diff] [blame] | 36 | NATIVE_POSIX_STDIN_CONSOLE |
Jukka Rissanen | f521996 | 2019-04-15 10:10:02 +0300 | [diff] [blame] | 37 | It is strongly discouraged to try to use this option with the new |
| 38 | shell interactively, as the default terminal configuration is NOT |
| 39 | appropriate for interactive use. |
Alberto Escolar Piedras | 013f279 | 2018-09-22 19:19:59 +0200 | [diff] [blame] | 40 | |
| 41 | endchoice |
| 42 | |
Pavel Král | 97696f3 | 2020-10-28 21:17:17 +0100 | [diff] [blame] | 43 | config UART_NATIVE_WAIT_PTS_READY_ENABLE |
| 44 | bool "Support waiting for pseudo terminal client readiness" |
| 45 | depends on NATIVE_UART_0_ON_OWN_PTY || UART_NATIVE_POSIX_PORT_1_ENABLE |
| 46 | help |
| 47 | When this option is selected a new command line switch is provided: |
Fabio Utzig | 0f1517a | 2020-11-07 09:36:16 -0300 | [diff] [blame] | 48 | ``--wait_uart`` |
| 49 | When ``--wait_uart`` is used, writes to the UART will be held until a |
Pavel Král | 97696f3 | 2020-10-28 21:17:17 +0100 | [diff] [blame] | 50 | client has connected to the slave side of the pseudoterminal. |
| 51 | Otherwise writes are sent irrespectively. |
| 52 | |
Jukka Rissanen | f521996 | 2019-04-15 10:10:02 +0300 | [diff] [blame] | 53 | config UART_NATIVE_POSIX_PORT_1_ENABLE |
Gerard Marull-Paretas | 95fb0de | 2022-03-09 12:05:12 +0100 | [diff] [blame] | 54 | bool "Second UART port" |
Jukka Rissanen | f521996 | 2019-04-15 10:10:02 +0300 | [diff] [blame] | 55 | help |
| 56 | Useful if you need to have another serial connection to host. |
| 57 | This is used for example in PPP (Point-to-Point Protocol) |
| 58 | implementation. |
| 59 | |
Alberto Escolar Piedras | 013f279 | 2018-09-22 19:19:59 +0200 | [diff] [blame] | 60 | config NATIVE_UART_AUTOATTACH_DEFAULT_CMD |
| 61 | string "Default command to attach the UART to a new terminal" |
| 62 | default "xterm -e screen %s &" |
| 63 | help |
Jukka Rissanen | f521996 | 2019-04-15 10:10:02 +0300 | [diff] [blame] | 64 | If the native_posix executable is called with the --attach_uart |
| 65 | command line option, this will be the default command which will be |
| 66 | run to attach a new terminal to the 1st UART. |
| 67 | Note that this command must have one, and only one, '%s' as |
| 68 | placeholder for the pseudoterminal device name (e.g. /dev/pts/35) |
| 69 | This is only applicable if the UART_0 is configured to use its own |
| 70 | PTY with NATIVE_UART_0_ON_OWN_PTY. |
| 71 | The 2nd UART will not be affected by this option. |
Jukka Rissanen | adf7291 | 2020-08-12 11:01:11 +0300 | [diff] [blame] | 72 | If you are using GNOME, then you can use this command string |
| 73 | 'gnome-terminal -- screen %s' |
Alberto Escolar Piedras | 013f279 | 2018-09-22 19:19:59 +0200 | [diff] [blame] | 74 | |
Ulf Magnusson | 116fb2f | 2019-03-09 04:23:02 +0100 | [diff] [blame] | 75 | endif # UART_NATIVE_POSIX |