Lines Matching refs:backend

25 	struct modem_backend_tty *backend = (struct modem_backend_tty *)p1;  in modem_backend_tty_routine()  local
31 pd.fd = backend->tty_fd; in modem_backend_tty_routine()
35 while (atomic_test_bit(&backend->state, MODEM_BACKEND_TTY_STATE_RUN_BIT)) { in modem_backend_tty_routine()
45 modem_pipe_notify_receive_ready(&backend->pipe); in modem_backend_tty_routine()
54 struct modem_backend_tty *backend = (struct modem_backend_tty *)data; in modem_backend_tty_open() local
56 if (atomic_test_and_set_bit(&backend->state, MODEM_BACKEND_TTY_STATE_RUN_BIT)) { in modem_backend_tty_open()
60 backend->tty_fd = open(backend->tty_path, (O_RDWR | O_NONBLOCK), 0644); in modem_backend_tty_open()
61 if (backend->tty_fd < 0) { in modem_backend_tty_open()
65 k_thread_create(&backend->thread, backend->stack, backend->stack_size, in modem_backend_tty_open()
66 modem_backend_tty_routine, backend, NULL, NULL, in modem_backend_tty_open()
69 modem_pipe_notify_opened(&backend->pipe); in modem_backend_tty_open()
75 struct modem_backend_tty *backend = (struct modem_backend_tty *)data; in modem_backend_tty_transmit() local
78 ret = write(backend->tty_fd, buf, size); in modem_backend_tty_transmit()
79 modem_pipe_notify_transmit_idle(&backend->pipe); in modem_backend_tty_transmit()
86 struct modem_backend_tty *backend = (struct modem_backend_tty *)data; in modem_backend_tty_receive() local
88 ret = read(backend->tty_fd, buf, size); in modem_backend_tty_receive()
94 struct modem_backend_tty *backend = (struct modem_backend_tty *)data; in modem_backend_tty_close() local
96 if (!atomic_test_and_clear_bit(&backend->state, MODEM_BACKEND_TTY_STATE_RUN_BIT)) { in modem_backend_tty_close()
100 k_thread_join(&backend->thread, K_MSEC(MODEM_BACKEND_TTY_THREAD_RUN_PERIOD_MS * 2)); in modem_backend_tty_close()
101 close(backend->tty_fd); in modem_backend_tty_close()
102 modem_pipe_notify_closed(&backend->pipe); in modem_backend_tty_close()
113 struct modem_pipe *modem_backend_tty_init(struct modem_backend_tty *backend, in modem_backend_tty_init() argument
116 __ASSERT_NO_MSG(backend != NULL); in modem_backend_tty_init()
120 memset(backend, 0x00, sizeof(*backend)); in modem_backend_tty_init()
121 backend->tty_path = config->tty_path; in modem_backend_tty_init()
122 backend->stack = config->stack; in modem_backend_tty_init()
123 backend->stack_size = config->stack_size; in modem_backend_tty_init()
124 atomic_set(&backend->state, 0); in modem_backend_tty_init()
125 modem_pipe_init(&backend->pipe, backend, &modem_backend_tty_api); in modem_backend_tty_init()
126 return &backend->pipe; in modem_backend_tty_init()