1# Modem configuration options
2
3# Copyright (c) 2018 Foundries.io
4# SPDX-License-Identifier: Apache-2.0
5
6menuconfig MODEM
7	bool "Modem drivers"
8	help
9	  Enable config options for modem drivers.
10
11if MODEM
12
13module = MODEM
14module-str = modem
15source "subsys/logging/Kconfig.template.log_config"
16
17config MODEM_RECEIVER
18	bool "Modem receiver helper driver"
19	depends on SERIAL_SUPPORT_INTERRUPT
20	select UART_INTERRUPT_DRIVEN
21	select RING_BUFFER
22	help
23	  This driver allows modem drivers to communicate over UART with custom
24	  defined protocols. Driver doesn't inspect received data and all
25	  aspects of received protocol data are handled by application via
26	  work method provided.  This driver differs from the pipe UART driver
27	  in that callbacks are executed in a different work queue and data is
28	  passed around in k_pipe structures.
29
30config MODEM_RECEIVER_MAX_CONTEXTS
31	int "Maximum number of modem receiver contexts"
32	depends on MODEM_RECEIVER
33	range 1 10
34	default 1
35	help
36	  Maximum number of modem receiver contexts to handle.  For most
37	  purposes this should stay at 1.
38
39config MODEM_CONTEXT
40	bool "Modem context helper driver [EXPERIMENTAL]"
41	select EXPERIMENTAL
42	help
43	  This driver allows modem drivers to communicate with an interface
44	  using custom defined protocols. Driver doesn't inspect received data
45	  and all aspects of received protocol data are handled by application
46	  work method provided.  This driver combines abstractions for:
47	  modem interface, command handler, pin config and socket handling each
48	  of which will need to be configured.
49
50if MODEM_CONTEXT
51
52config MODEM_CONTEXT_MAX_NUM
53	int "Maximum number of modem contexts"
54	default 1
55	help
56	  Maximum number of modem contexts to handle.  For most
57	  purposes this should stay at 1.
58
59config MODEM_CONTEXT_VERBOSE_DEBUG
60	bool "Verbose debug output in the modem context"
61	help
62	  Enabling this setting will turn on VERY heavy debugging from the
63	  modem context helper.  Do NOT leave on for production.
64
65config MODEM_IFACE_UART
66	bool "UART-based modem interface"
67	select RING_BUFFER
68	help
69	  To configure this layer for use, create a modem_iface_uart_data
70	  object and pass it's reference to modem_iface_uart_init()
71	  along with the modem_iface reference from your modem_context object
72	  and the UART device name.
73
74if MODEM_IFACE_UART
75
76choice MODEM_IFACE_UART_BACKEND
77	prompt "UART backend to use for modem interface"
78	default MODEM_IFACE_UART_INTERRUPT
79
80config MODEM_IFACE_UART_INTERRUPT
81	bool "UART-based modem interface using interrupt API"
82	depends on SERIAL_SUPPORT_INTERRUPT
83	select UART_INTERRUPT_DRIVEN
84
85config MODEM_IFACE_UART_ASYNC
86	bool "UART-based modem interface using async API"
87	depends on SERIAL_SUPPORT_ASYNC
88	select UART_ASYNC_API
89
90endchoice
91
92if MODEM_IFACE_UART_ASYNC
93
94config MODEM_IFACE_UART_ASYNC_RX_BUFFER_SIZE
95	int "Size in bytes of the RX buffers provided to UART driver"
96	default 64
97	help
98	  Increasing this value decreases the number of UART interrupts needed
99	  to receive large packets.
100
101config MODEM_IFACE_UART_ASYNC_RX_NUM_BUFFERS
102	int "Number of RX buffers available to the UART driver"
103	default 2
104	help
105	  This value needs to be twice the number of UART modems using the
106	  driver to avoid buffer starvation.
107
108config MODEM_IFACE_UART_ASYNC_RX_TIMEOUT_US
109	int "Timeout for flushing RX buffers after receiving no additional data"
110	default 278
111	help
112	  Decreasing this value can help increase data throughput when high
113	  baudrates are used. 278us is 4 bytes at 115200 baud. Decreasing this
114	  value too much can result in spurious interrupts. Leaving it too
115	  high can reduce data throughput.
116
117endif # MODEM_IFACE_UART_ASYNC
118
119endif # MODEM_IFACE_UART
120
121config MODEM_CMD_HANDLER
122	bool "Generic modem command handler"
123	select NET_BUF
124	help
125	  This generic command handler uses a modem interface to process
126	  incoming data and hand it back to the modem driver via callbacks
127	  defined for:
128	  - modem responses
129	  - unsolicited messages
130	  - specified handlers for current operation
131	  To configure this layer for use, create a modem_cmd_handler_data
132	  object and pass it's reference to modem_cmd_handler_init() along with
133	  the modem_cmd_handler reference from your modem_context object.
134
135config MODEM_CMD_HANDLER_MAX_PARAM_COUNT
136	int "Maximum number of params parsed per command"
137	depends on MODEM_CMD_HANDLER
138	default 6
139	help
140	  This option sets the maximum number of parameters which may be
141	  parsed by the command handler.  This is also limited by the length
142	  of the match_buf (match_buf_len) field as it needs to be large
143	  enough to hold a single line of data (ending with /r).
144
145config MODEM_SOCKET
146	bool "Generic modem socket support layer"
147	help
148	  This layer provides much of the groundwork for keeping track of
149	  modem "sockets" throughout their lifecycle (from the initial offload
150	  API calls through the command handler call back layers).
151	  To configure this layer for use, create a modem_socket_config
152	  object with your socket data and pass it's reference to
153	  modem_socket_init().
154	  Note that the modem socket uses runtime allocated file descriptors
155	  reserved from the fdtable, for which the max count is set using the
156	  Kconfig option POSIX_MAX_FDS. Make sure to update this value as both
157	  the modem sockets and the POSIX_API, if used, share them.
158
159config MODEM_SOCKET_PACKET_COUNT
160	int "Maximum number of stored packet sizes per socket"
161	depends on MODEM_SOCKET
162	default 6
163	help
164	  As the modem indicates more data is available to be received,
165	  these values are organized into "packets".  This setting limits
166	  the maximum number of packet sizes the socket can keep track of.
167
168endif # MODEM_CONTEXT
169
170config MODEM_SHELL
171	bool "Modem shell utilities"
172	select SHELL
173	help
174	  Activate shell module that provides modem utilities like
175	  sending a command to the modem UART.
176
177config MODEM_SIM_NUMBERS
178	bool "Query the SIM for IMSI and ICCID"
179	default y
180	help
181	  Query the SIM card for the IMSI and ICCID identifiers. This
182	  can be disabled if the application does not use a SIM.
183
184config MODEM_CELL_INFO
185	bool "Query for operator and cell info"
186	help
187	  Query for numerical operator id, location area code and cell id.
188
189source "drivers/modem/Kconfig.ublox-sara-r4"
190source "drivers/modem/Kconfig.quectel-bg9x"
191source "drivers/modem/Kconfig.wncm14a2a"
192source "drivers/modem/Kconfig.gsm"
193source "drivers/modem/Kconfig.cellular"
194
195source "drivers/modem/Kconfig.hl7800"
196source "drivers/modem/Kconfig.simcom-sim7080"
197
198endif # MODEM
199