Add Asynchronous UART implementation, which does not drop data when automatic hardware-flow-control is set in the device tree. With automatic hardware flow control, the CTS pin will be automatically deactivated when there are no more asynchronous UART RX buffers available. After buffer space becomes available, and UART RX is restarted, the CTS pin will be activated. Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
67 lines
1.9 KiB
Plaintext
67 lines
1.9 KiB
Plaintext
# Copyright (c) 2023 Trackunit Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
config MODEM_BACKEND_TTY
|
|
bool "Modem TTY backend module"
|
|
select MODEM_PIPE
|
|
depends on ARCH_POSIX
|
|
|
|
config MODEM_BACKEND_UART
|
|
bool "Modem UART backend module"
|
|
select MODEM_PIPE
|
|
select RING_BUFFER
|
|
depends on UART_INTERRUPT_DRIVEN || UART_ASYNC_API
|
|
|
|
if MODEM_BACKEND_UART
|
|
|
|
config MODEM_BACKEND_UART_ISR
|
|
bool "Modem UART backend module interrupt driven implementation"
|
|
default y if UART_INTERRUPT_DRIVEN
|
|
|
|
config MODEM_BACKEND_UART_ASYNC
|
|
bool "Modem UART backend module async implementation"
|
|
default y if UART_ASYNC_API
|
|
|
|
if MODEM_BACKEND_UART_ISR
|
|
|
|
config MODEM_BACKEND_UART_ISR_RECEIVE_IDLE_TIMEOUT_MS
|
|
int "Modem ISR UART delay between first byte received and RECEIVE_READY pipe event"
|
|
default 20
|
|
help
|
|
This defines the delay, in milliseconds, that the backend waits
|
|
when receiving a byte before sending the RECEIVE_READY pipe event.
|
|
The backend will anyway send the event before this delay if buffer space runs out.
|
|
A good value is ~90% the time it takes to fill half the receive buffer.
|
|
It can be calculated as follows:
|
|
(<UART receive_buf_size> / 2) / (<UART baud rate> / <UART bits per byte>) * <ms per sec>
|
|
By default (for the modem_cellular driver): (512 / 2) / (115200 / 10) * 1000 = 22,222 => 20
|
|
|
|
endif
|
|
|
|
if MODEM_BACKEND_UART_ASYNC
|
|
|
|
config MODEM_BACKEND_UART_ASYNC_TRANSMIT_TIMEOUT_MS
|
|
int "Modem async UART transmit timeout in milliseconds"
|
|
default 1000
|
|
|
|
config MODEM_BACKEND_UART_ASYNC_RECEIVE_IDLE_TIMEOUT_MS
|
|
int "Modem async UART receive idle timeout in milliseconds"
|
|
default 30
|
|
|
|
config MODEM_BACKEND_UART_ASYNC_HWFC
|
|
bool "Hardware flow control (HWFC) for the modem async UART backend"
|
|
select EXPERIMENTAL
|
|
|
|
if MODEM_BACKEND_UART_ASYNC_HWFC
|
|
|
|
config MODEM_BACKEND_UART_ASYNC_HWFC_BUFFER_COUNT
|
|
int "Modem async UART HWFC buffer count"
|
|
range 2 4
|
|
default 3
|
|
|
|
endif # MODEM_BACKEND_UART_ASYNC_HWFC
|
|
|
|
endif # MODEM_BACKEND_UART_ASYNC
|
|
|
|
endif # MODEM_BACKEND_UART
|