1# Copyright (c) 2023 Trackunit Corporation
2# SPDX-License-Identifier: Apache-2.0
3
4config MODEM_BACKEND_TTY
5	bool "Modem TTY backend module"
6	select MODEM_PIPE
7	depends on ARCH_POSIX
8
9config MODEM_BACKEND_UART
10	bool "Modem UART backend module"
11	select MODEM_PIPE
12	select RING_BUFFER
13	depends on UART_INTERRUPT_DRIVEN || UART_ASYNC_API
14
15if MODEM_BACKEND_UART
16
17config MODEM_BACKEND_UART_ISR
18	bool "Modem UART backend module interrupt driven implementation"
19	default y if UART_INTERRUPT_DRIVEN
20
21config MODEM_BACKEND_UART_ASYNC
22	bool "Modem UART backend module async implementation"
23	default y if UART_ASYNC_API
24
25if MODEM_BACKEND_UART_ISR
26
27config MODEM_BACKEND_UART_ISR_RECEIVE_IDLE_TIMEOUT_MS
28	int "Modem ISR UART delay between first byte received and RECEIVE_READY pipe event"
29	default 20
30	help
31	  This defines the delay, in milliseconds, that the backend waits
32	  when receiving a byte before sending the RECEIVE_READY pipe event.
33	  The backend will anyway send the event before this delay if buffer space runs out.
34	  A good value is ~90% the time it takes to fill half the receive buffer.
35	  It can be calculated as follows:
36	  (<UART receive_buf_size> / 2) / (<UART baud rate> / <UART bits per byte>) * <ms per sec>
37	  By default (for the modem_cellular driver): (512 / 2) / (115200 / 10) * 1000 = 22,222 => 20
38
39endif
40
41if MODEM_BACKEND_UART_ASYNC
42
43config MODEM_BACKEND_UART_ASYNC_TRANSMIT_TIMEOUT_MS
44	int "Modem async UART transmit timeout in milliseconds"
45	default 1000
46
47config MODEM_BACKEND_UART_ASYNC_RECEIVE_IDLE_TIMEOUT_MS
48	int "Modem async UART receive idle timeout in milliseconds"
49	default 30
50
51endif
52
53endif # MODEM_BACKEND_UART
54