1# Console driver configuration options
2
3# Copyright (c) 2014-2015 Wind River Systems, Inc.
4# Copyright (c) 2016 Cadence Design Systems, Inc.
5# SPDX-License-Identifier: Apache-2.0
6
7# Setting shared by different subsystems
8
9menuconfig CONSOLE
10	bool "Console drivers"
11
12if CONSOLE
13
14config CONSOLE_INPUT_MAX_LINE_LEN
15	int "Console maximum input line length"
16	default 128
17	help
18	  This option can be used to modify the maximum length a console input
19	  can be.
20
21config CONSOLE_HAS_DRIVER
22	bool
23	help
24	  This is an option to be enabled by console drivers to signal
25	  that some kind of console exists.
26
27config CONSOLE_HANDLER
28	bool "Enable console input handler"
29	depends on UART_CONSOLE && SERIAL_SUPPORT_INTERRUPT
30	select UART_INTERRUPT_DRIVEN
31	help
32	  This option enables console input handler allowing to write simple
33	  interaction between serial console and the OS.
34
35config UART_CONSOLE
36	bool "Use UART for console"
37	depends on SERIAL && SERIAL_HAS_DRIVER
38	select CONSOLE_HAS_DRIVER
39	help
40	  Enable this option to use one UART for console.
41
42config UART_CONSOLE_INIT_PRIORITY
43	int "Init priority"
44	default 95 if USB_UART_CONSOLE
45	default 60
46	depends on UART_CONSOLE
47	help
48	  Device driver initialization priority.
49	  Console has to be initialized after the UART driver
50	  it uses.
51
52config UART_CONSOLE_DEBUG_SERVER_HOOKS
53	bool "Debug server hooks in debug console"
54	depends on UART_CONSOLE
55	help
56	  This option allows a debug server agent such as GDB to take over the
57	  handling of traffic that goes through the console logic. The debug
58	  server looks at characters received and decides to handle them itself if
59	  they are some sort of control characters, or let the regular console
60	  code handle them if they are of no special significance to it.
61
62config UART_CONSOLE_MCUMGR
63	bool "Enable UART console mcumgr passthrough"
64	depends on UART_CONSOLE
65	help
66	  Enables the UART console to receive mcumgr frames for image upgrade
67	  and device management.  When enabled, the UART console does not
68	  process mcumgr frames, but it hands them up to a higher level module
69	  (e.g., the shell).  If unset, incoming mcumgr frames are dropped.
70
71config UART_CONSOLE_INPUT_EXPIRED
72	bool "Enable support for UART console input expired mechanism"
73	default y
74	depends on UART_CONSOLE && PM
75	help
76	  This option allows a notification to the power management module that
77	  the module for UART console is in use now. If the interval of console
78	  module doesn't receive any input message exceeds expired timeout, such
79	  as UART_CONSOLE_INPUT_EXPIRED_TIMEOUT, the power management module is
80	  allowed to enter sleep/deep sleep state and turn off the clock of UART
81	  console module. This mechanism gives a window in which the users can
82	  organize input message if CONFIG_PM is enabled.
83
84config UART_CONSOLE_INPUT_EXPIRED_TIMEOUT
85	int "Fixed amount of time to keep the UART console in use flag true"
86	default 15000
87	depends on UART_CONSOLE_INPUT_EXPIRED
88	help
89	  Fixed amount of time which unit is milliseconds to keep the UART
90	  console in use flag true.
91
92config USB_UART_CONSOLE
93	bool "Use USB port for console outputs"
94	select UART_CONSOLE
95	select USB_CDC_ACM
96	help
97	  Enable this option to use the USB CDC ACM class for console.
98	  As for the console driver, this option only changes the initialization
99	  level.
100
101config RAM_CONSOLE
102	bool "Use RAM console"
103	select CONSOLE_HAS_DRIVER
104	help
105	  Emit console messages to a RAM buffer "ram_console" which can
106	  be examined at runtime with a debugger. Useful in board bring-up
107	  if there aren't any working serial drivers.
108
109config RAM_CONSOLE_BUFFER_SIZE
110	int "Ram Console buffer size"
111	default 1024
112	depends on RAM_CONSOLE
113	help
114	  Size of the RAM console buffer. Messages will wrap around if the
115	  length is exceeded.
116
117config RTT_CONSOLE
118	bool "Use RTT console"
119	depends on USE_SEGGER_RTT
120	select CONSOLE_HAS_DRIVER
121	help
122	  Emit console messages to a RAM buffer that is then read by the
123	  Segger J-Link software and displayed on a computer in real-time.
124	  Requires support for Segger J-Link on the companion IC onboard.
125
126if RTT_CONSOLE
127
128config RTT_TX_RETRY_CNT
129	int "Number of TX retries"
130	default 2
131	help
132	  Number of TX retries before dropping the byte and assuming that
133	  RTT session is inactive.
134
135config RTT_TX_RETRY_DELAY_MS
136	int "Delay between TX retries in milliseconds"
137	default 2
138	help
139	  Sleep period between TX retry attempts. During RTT session, host pulls data
140	  periodically. Period starts from 1-2 milliseconds and can be increased
141	  if traffic on RTT increases (also from host to device). In case of
142	  heavy traffic data can be lost and it may be necessary to increase
143	  delay or number of retries.
144
145config RTT_TX_RETRY_IN_INTERRUPT
146	bool "Busy wait in the interrupt context for TX retry"
147	help
148	  If enabled RTT console will busy wait between TX retries when console
149	  assumes that RTT session is active. In case of heavy traffic data can
150	  be lost and it may be necessary to increase delay or number of
151	  retries.
152
153endif
154
155config IPM_CONSOLE_SENDER
156	bool "Inter-processor Mailbox console sender"
157	select CONSOLE_HAS_DRIVER
158	help
159	  Enable the sending side of IPM console
160
161config IPM_CONSOLE_RECEIVER
162	bool "Inter-processor Mailbox console receiver"
163	select RING_BUFFER
164	help
165	  Enable the receiving side of IPM console
166
167config IPM_CONSOLE_STACK_SIZE
168	int "Stack size for IPM console receiver thread"
169	depends on IPM_CONSOLE_RECEIVER
170	default 2048 if COVERAGE
171	default 512
172	help
173	  Each instance of the IPM console receiver driver creates a worker
174	  thread to print out incoming messages from the remote CPU. Specify the
175	  stack size for these threads here.
176
177config IPM_CONSOLE
178	bool "Inter-processor Mailbox console"
179	depends on IPM
180	select CONSOLE_HAS_DRIVER
181	help
182	  Enable console over Inter-processor Mailbox.
183
184# Workaround for not being able to have commas in macro arguments
185DT_CHOSEN_Z_IPM_CONSOLE := zephyr,console
186
187config IPM_CONSOLE_ON_DEV_NAME
188	string "IPM device name used by console"
189	default "$(dt_chosen_label,$(DT_CHOSEN_Z_IPM_CONSOLE))" if HAS_DTS
190	default "IPM_0"
191	depends on IPM_CONSOLE
192	help
193	  IPM device name used by IPM console driver.
194
195config IPM_CONSOLE_LINE_BUF_LEN
196	int "IPM console line buffer length"
197	default 128
198	depends on IPM_CONSOLE
199	help
200	  IPM console line buffer length specify amount of the buffer
201	  where characters are stored before sending the whole line.
202
203config UART_PIPE
204	bool "Enable pipe UART driver"
205	select UART_INTERRUPT_DRIVEN
206	help
207	  Enable pipe UART driver. This driver allows application to communicate
208	  over UART with custom defined protocol. Driver doesn't inspect received
209	  data (as contrary to console UART driver) and all aspects of received
210	  protocol data are handled by application provided callback.
211
212# Workaround for not being able to have commas in macro arguments
213DT_CHOSEN_Z_UART_PIPE := zephyr,uart-pipe
214
215config UART_PIPE_ON_DEV_NAME
216	string "Device Name of UART Device for pipe UART"
217	default "$(dt_chosen_label,$(DT_CHOSEN_Z_UART_PIPE))" if HAS_DTS
218	default "UART_0"
219	depends on UART_PIPE
220	help
221	  This option specifies the name of UART device to be used
222	  for pipe UART.
223
224config UART_MCUMGR
225	bool "Enable mcumgr UART driver"
226	select UART_INTERRUPT_DRIVEN
227	help
228	  Enable the mcumgr UART driver. This driver allows the application to
229	  communicate over UART using the mcumgr protocol for image upgrade and
230	  device management. The driver doesn't inspect received data (as
231	  contrary to console UART driver) and all aspects of received protocol
232	  data are handled by an application provided callback.
233
234if UART_MCUMGR
235
236config UART_MCUMGR_RX_BUF_SIZE
237	int "Size of receive buffer for mcumgr fragments received over UART, in bytes"
238	default 128
239	help
240	  Specifies the size of the mcumgr UART receive buffer, in bytes. This
241	  value must be large enough to accommodate any line sent by an mcumgr
242	  client.
243
244config UART_MCUMGR_RX_BUF_COUNT
245	int "Number of receive buffers for mcumgr fragments received over UART"
246	default 2
247	help
248	  Specifies the number of the mcumgr UART receive buffers.  Receive
249	  buffers hold received mcumgr fragments prior to reassembly.  This
250	  setting's value must satisfy the following relation:
251	  UART_MCUMGR_RX_BUF_COUNT * UART_MCUMGR_RX_BUF_SIZE >=
252	  MCUMGR_SMP_UART_MTU
253
254endif # UART_MCUMGR
255
256config XTENSA_SIM_CONSOLE
257	bool "Use Xtensa simulator console"
258	depends on SIMULATOR_XTENSA
259	select CONSOLE_HAS_DRIVER
260	default y
261	help
262	  Use simulator console to print messages.
263
264config NATIVE_POSIX_CONSOLE
265	bool "Use the host terminal for console"
266	depends on ARCH_POSIX
267	select CONSOLE_HAS_DRIVER
268	help
269	  Use the host terminal (where the native_posix binary was launched) for the
270	  Zephyr console
271
272config NATIVE_POSIX_STDIN_CONSOLE
273	bool "Use the host terminal stdin"
274	depends on NATIVE_POSIX_CONSOLE
275	help
276	  No current use. Kept only as there is plans to start using these
277	  drivers with the shell
278
279config NATIVE_STDIN_POLL_PERIOD
280	int "Polling period for stdin"
281	depends on NATIVE_POSIX_STDIN_CONSOLE
282	default 20
283	help
284	  In ms, polling period for stdin
285
286config NATIVE_POSIX_STDOUT_CONSOLE
287	bool "Print to the host terminal stdout"
288	depends on NATIVE_POSIX_CONSOLE
289	default y
290	help
291	  Zephyr's printk messages will be directed to the host terminal stdout.
292
293config XTENSA_CONSOLE_INIT_PRIORITY
294	int "Init priority"
295	default 60
296	depends on XTENSA_SIM_CONSOLE
297	help
298	  Device driver initialization priority.
299
300config NATIVE_POSIX_CONSOLE_INIT_PRIORITY
301	int "Init priority"
302	default 99
303	depends on NATIVE_POSIX_CONSOLE
304	help
305	  Device driver initialization priority.
306
307config SEMIHOST_CONSOLE
308	bool "Use semihosting for console"
309	select CONSOLE_HAS_DRIVER
310	depends on CPU_CORTEX_M || ARM64
311	help
312	  Enable this option to use semihosting for console.
313	  Semihosting is a mechanism that enables code running on an ARM target
314	  to communicate and use the Input/Output facilities on a host computer
315	  that is running a debugger.
316	  Additional information can be found in:
317	  https://developer.arm.com/docs/dui0471/k/what-is-semihosting/what-is-semihosting
318	  This option is compatible with hardware and with QEMU, through the
319	  (automatic) use of the -semihosting-config switch when invoking it.
320
321module = UART_CONSOLE
322module-str = UART console
323source "subsys/logging/Kconfig.template.log_config"
324
325source "drivers/console/Kconfig.gsm_mux"
326
327config UART_MUX
328	bool "Enable UART muxing (GSM 07.10) support [EXPERIMENTAL]"
329	depends on SERIAL_SUPPORT_INTERRUPT && GSM_MUX
330	select UART_INTERRUPT_DRIVEN
331	help
332	  Enable this option to create UART muxer that run over a physical
333	  UART. The GSM 07.10 muxing protocol is used to separate the data
334	  between these muxed UARTs.
335
336if UART_MUX
337
338config UART_MUX_INIT_PRIORITY
339	int "Init priority"
340	default 95
341	help
342	  Device driver initialization priority. UART mux has to be
343	  initialized after the UART driver it uses.
344
345config UART_MUX_DEVICE_NAME
346	string "UART mux device name template"
347	default "GSM"
348	help
349	  Device name template for the UART mux Devices. First device would
350	  have name $(UART_MUX_DEVICE_NAME)_0, etc. User will access muxed
351	  UART using this name.
352
353config UART_MUX_RINGBUF_SIZE
354	int "UART mux ring buffer size"
355	default 256
356	help
357	  UART mux ring buffer size when passing data from RX ISR to worker
358	  thread that will do the unmuxing.
359
360config UART_MUX_TEMP_BUF_SIZE
361	int "Size of the temp buffer when reading data from real UART"
362	default 32
363	help
364	  Size of the temporary RX buffer in receiving ISR.
365
366config UART_MUX_DEVICE_COUNT
367	int "Number of UART mux devices (DLCIs)"
368	default GSM_MUX_DLCI_MAX
369	range 1 64
370	help
371	  Number of instances of UART muxes. Default value is set by
372	  maximum number of DLCIs (Data Link Connection Identifiers)
373	  configured in the system.
374
375config UART_MUX_REAL_DEVICE_COUNT
376	int "Number of real UART devices"
377	default 1
378	help
379	  Tells how many real UART devices there are. Typically there is
380	  only one UART and the muxed UARTs are run on top of that. If you have
381	  two modems for example, then you would need to increase this to two.
382
383config UART_MUX_RX_STACK_SIZE
384	int "Size of the stack allocated for receiving data from UART"
385	default 512
386	help
387	  Sets the stack size which will be used by the PPP RX workqueue.
388
389config UART_MUX_RX_PRIORITY
390	int "RX workqueue thread priority"
391	default 7
392	help
393	  Sets the priority of the RX workqueue thread.
394
395module = UART_MUX
396module-str = UART mux
397source "subsys/logging/Kconfig.template.log_config"
398
399endif # UART_MUX
400
401config UART_MUX_VERBOSE_DEBUG
402	bool "Print hexdump of sent and received packets"
403	depends on UART_MUX_LOG_LEVEL_DBG
404	help
405	  As there might be lot of debug output printed, only enable
406	  this if really needed.
407
408
409endif # CONSOLE
410