1 /*
2  * Copyright (c) 2022 Trackunit Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/kernel.h>
8 #include <zephyr/types.h>
9 #include <zephyr/device.h>
10 #include <zephyr/sys/ring_buffer.h>
11 #include <zephyr/sys/atomic.h>
12 
13 #include <zephyr/modem/pipe.h>
14 
15 #ifndef ZEPHYR_MODEM_BACKEND_TTY_
16 #define ZEPHYR_MODEM_BACKEND_TTY_
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 struct modem_backend_tty {
23 	const char *tty_path;
24 	int tty_fd;
25 	struct modem_pipe pipe;
26 	struct k_thread thread;
27 	k_thread_stack_t *stack;
28 	size_t stack_size;
29 	atomic_t state;
30 };
31 
32 struct modem_backend_tty_config {
33 	const char *tty_path;
34 	k_thread_stack_t *stack;
35 	size_t stack_size;
36 };
37 
38 struct modem_pipe *modem_backend_tty_init(struct modem_backend_tty *backend,
39 					  const struct modem_backend_tty_config *config);
40 
41 #ifdef __cplusplus
42 }
43 #endif
44 
45 #endif /* ZEPHYR_MODEM_BACKEND_TTY_ */
46