Lines Matching +full:uart +full:- +full:dev

4  * SPDX-License-Identifier: Apache-2.0
11 #include <zephyr/drivers/uart.h>
20 * UART driver for POSIX ARCH based boards.
23 * For the first UART:
31 * more like a real UART.
37 static int np_uart_stdin_poll_in(const struct device *dev,
39 static int np_uart_tty_poll_in(const struct device *dev,
41 static void np_uart_poll_out(const struct device *dev,
55 static DEVICE_API(uart, np_uart_driver_api_0) = {
67 static DEVICE_API(uart, np_uart_driver_api_1) = {
81 * @param dev UART_0 device struct
85 static int np_uart_0_init(const struct device *dev) in np_uart_0_init() argument
89 d = (struct native_uart_status *)dev->data; in np_uart_0_init()
92 int tty_fn = np_uart_open_ptty(dev->name, auto_attach_cmd, auto_attach, wait_pts); in np_uart_0_init()
94 d->in_fd = tty_fn; in np_uart_0_init()
95 d->out_fd = tty_fn; in np_uart_0_init()
97 d->in_fd = np_uart_ptty_get_stdin_fileno(); in np_uart_0_init()
98 d->out_fd = np_uart_ptty_get_stdout_fileno(); in np_uart_0_init()
106 * Initialize the 2nd UART port.
109 static int np_uart_1_init(const struct device *dev) in np_uart_1_init() argument
114 d = (struct native_uart_status *)dev->data; in np_uart_1_init()
116 tty_fn = np_uart_open_ptty(dev->name, NULL, false, wait_pts); in np_uart_1_init()
118 d->in_fd = tty_fn; in np_uart_1_init()
119 d->out_fd = tty_fn; in np_uart_1_init()
128 * @param dev UART device struct
131 static void np_uart_poll_out(const struct device *dev, in np_uart_poll_out() argument
135 struct native_uart_status *d = (struct native_uart_status *)dev->data; in np_uart_poll_out()
140 int rc = np_uart_slave_connected(d->out_fd); in np_uart_poll_out()
152 ret = nsi_host_write(d->out_fd, &out_char, 1); in np_uart_poll_out()
159 * @param dev UART device structure.
163 * @retval -1 If no character was available to read
165 static int __maybe_unused np_uart_stdin_poll_in(const struct device *dev, unsigned char *p_char) in np_uart_stdin_poll_in() argument
167 int in_f = ((struct native_uart_status *)dev->data)->in_fd; in np_uart_stdin_poll_in()
172 return -1; in np_uart_stdin_poll_in()
176 if (rc == -2) { in np_uart_stdin_poll_in()
178 return -1; in np_uart_stdin_poll_in()
187 * @param dev UART device structure.
191 * @retval -1 If no character was available to read
193 static int __maybe_unused np_uart_tty_poll_in(const struct device *dev, unsigned char *p_char) in np_uart_tty_poll_in() argument
195 int n = -1; in np_uart_tty_poll_in()
196 int in_f = ((struct native_uart_status *)dev->data)->in_fd; in np_uart_tty_poll_in()
199 if (n == -1) { in np_uart_tty_poll_in()
200 return -1; in np_uart_tty_poll_in()
237 .descript = "Automatically attach to the UART terminal" in np_add_uart_options()
254 .descript = "Hold writes to the uart/pts until a client is connected/ready" in np_add_uart_options()