Linux Audio

Check our new training course

Embedded Linux Audio

Check our new training course
with Creative Commons CC-BY-SA
lecture materials

Bootlin logo

Elixir Cross Referencer

Loading...
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# Shell backends configuration options

# Copyright (c) 2018 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

menuconfig SHELL_BACKENDS
	bool "Shell backends"
	default y
	help
	  Enable shell backends.

if SHELL_BACKENDS

# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_SHELL_UART := zephyr,shell-uart

config SHELL_BACKEND_SERIAL
	bool "Serial backend"
	# Serial (UART) requires interrupts and the RTT backend cannot be used from an ISR context.
	default n if SHELL_BACKEND_RTT
	default "$(dt_chosen_enabled,$(DT_CHOSEN_Z_SHELL_UART))"
	select SERIAL
	select RING_BUFFER
	help
	  Enable serial backend.

if SHELL_BACKEND_SERIAL

config SHELL_BACKEND_SERIAL_INIT_PRIORITY
	int "Initialization priority"
	default 55 if ACPI
	default 0
	range 0 99
	help
	  Initialization priority for UART backend. This must be bigger than
	  the initialization priority of the used serial device.

config SHELL_PROMPT_UART
	string "Displayed prompt name"
	default "uart:~$ "
	help
	  Displayed prompt name for UART backend. If prompt is set, the shell will
	  send two newlines during initialization.

config SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
	bool "Interrupt driven"
	default y
	depends on SERIAL_SUPPORT_INTERRUPT

config SHELL_ASYNC_API
	bool "Asynchronous shell API"
	default n
	depends on UART_ASYNC_API
	help
	  This option enables asynchronous shell API.

choice SHELL_BACKEND_SERIAL_API
	prompt "Mode"
	default SHELL_BACKEND_SERIAL_API_ASYNC if SHELL_ASYNC_API
	default SHELL_BACKEND_SERIAL_API_INTERRUPT_DRIVEN if SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
	default SHELL_BACKEND_SERIAL_API_POLLING

config SHELL_BACKEND_SERIAL_API_POLLING
	prompt "Polling"

config SHELL_BACKEND_SERIAL_API_INTERRUPT_DRIVEN
	bool "Interrupt driven"
	depends on SERIAL_SUPPORT_INTERRUPT
	select UART_INTERRUPT_DRIVEN


config SHELL_BACKEND_SERIAL_API_ASYNC
	bool "Asynchronous"
	depends on SERIAL_SUPPORT_ASYNC
	select UART_ASYNC_RX_HELPER

endchoice

config SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE
	int "Set TX ring buffer size"
	default 8
	depends on SHELL_BACKEND_SERIAL_API_INTERRUPT_DRIVEN
	help
	  If UART is utilizing DMA transfers then increasing ring buffer size
	  increases transfers length and reduces number of interrupts.

config SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE
	int "Set RX ring buffer size"
	depends on SHELL_BACKEND_SERIAL_API_INTERRUPT_DRIVEN || SHELL_BACKEND_SERIAL_API_POLLING
	default 256 if MCUMGR_TRANSPORT_SHELL
	default 64
	help
	  RX ring buffer size impacts accepted latency of handling incoming
	  bytes by shell. If shell input is coming from the keyboard then it is
	  usually enough if ring buffer is few bytes (more than one due to
	  escape sequences). However, if bulk data is transferred it may be
	  required to increase it.

if SHELL_BACKEND_SERIAL_API_ASYNC

config SHELL_BACKEND_SERIAL_ASYNC_RX_TIMEOUT
	int "RX inactivity timeout (in microseconds)"
	default 10000
	help
	  Inactivity timeout after which received data is reported.

config SHELL_BACKEND_SERIAL_ASYNC_RX_BUFFER_COUNT
	int "Number of RX buffers"
	default 4
	range 2 64
	help
	  Number of RX buffers. Some UART driver implementations changes buffers
	  on timeout so this number should be big enough to cover handling on
	  time incoming data. 4 should be enough for almost all the cases unless
	  CPU load is high and there is very high shell thread latency.

config SHELL_BACKEND_SERIAL_ASYNC_RX_BUFFER_SIZE
	int "Size of the RX buffer"
	default 16
	help
	  Size of a single RX buffer. Together with buffer count it defines the
	  space that can hold RX data. It may be decreased if shell input is
	  slow and may need to be increased if long messages are pasted directly
	  to the shell prompt.

endif # SHELL_BACKEND_SERIAL_API_ASYNC

config SHELL_BACKEND_SERIAL_RX_POLL_PERIOD
	int "RX polling period (in milliseconds)"
	default 10
	depends on SHELL_BACKEND_SERIAL_API_POLLING
	help
	  Determines how often UART is polled for RX byte.

config SHELL_BACKEND_SERIAL_CHECK_DTR
	bool "Check DTR signal before TX"
	depends on SHELL_BACKEND_SERIAL_API_INTERRUPT_DRIVEN
	depends on UART_LINE_CTRL
	help
	  Check DTR signal before TX.

module = SHELL_BACKEND_SERIAL
default-timeout = 100
source "subsys/shell/Kconfig.template.shell_log_queue_timeout"

default-size = 512
source "subsys/shell/Kconfig.template.shell_log_queue_size"

choice
	prompt "Initial log level limit"
	default SHELL_BACKEND_SERIAL_LOG_LEVEL_DEFAULT

config SHELL_BACKEND_SERIAL_LOG_LEVEL_DEFAULT
	bool "System limit (LOG_MAX_LEVEL)"

config SHELL_BACKEND_SERIAL_LOG_LEVEL_DBG
	bool "Debug"

config SHELL_BACKEND_SERIAL_LOG_LEVEL_INF
	bool "Info"

config SHELL_BACKEND_SERIAL_LOG_LEVEL_WRN
	bool "Warning"

config SHELL_BACKEND_SERIAL_LOG_LEVEL_ERR
	bool "Error"

config SHELL_BACKEND_SERIAL_LOG_LEVEL_NONE
	bool "None"

endchoice

config SHELL_BACKEND_SERIAL_LOG_LEVEL
	int
	default 0 if SHELL_BACKEND_SERIAL_LOG_LEVEL_NONE
	default 1 if SHELL_BACKEND_SERIAL_LOG_LEVEL_ERR
	default 2 if SHELL_BACKEND_SERIAL_LOG_LEVEL_WRN
	default 3 if SHELL_BACKEND_SERIAL_LOG_LEVEL_INF
	default 4 if SHELL_BACKEND_SERIAL_LOG_LEVEL_DBG
	default 5 if SHELL_BACKEND_SERIAL_LOG_LEVEL_DEFAULT

endif # SHELL_BACKEND_SERIAL

config SHELL_BACKEND_RTT
	bool "RTT backend"
	select CONSOLE
	select RTT_CONSOLE
	depends on USE_SEGGER_RTT
	help
	  Enable RTT backend.

if SHELL_BACKEND_RTT

config SHELL_PROMPT_RTT
	string "Displayed prompt name"
	default "rtt:~$ "
	help
	  Displayed prompt name for RTT backend. If prompt is set, the shell will
	  send two newlines during initialization.

config SHELL_BACKEND_RTT_BUFFER
	int "Buffer number used for shell input and output."
	range 0 SEGGER_RTT_MAX_NUM_UP_BUFFERS
	default 0
	help
	  Select index of up-buffer used for shell output, by default it uses
	  terminal up-buffer and its settings.

config SHELL_RTT_RX_POLL_PERIOD
	int "RX polling period (in milliseconds)"
	default 10
	help
	  Determines how often RTT is polled for RX byte.

module = SHELL_BACKEND_RTT
default-timeout = 100
source "subsys/shell/Kconfig.template.shell_log_queue_timeout"

default-size = 512
source "subsys/shell/Kconfig.template.shell_log_queue_size"

choice
	prompt "Initial log level limit"
	default SHELL_RTT_INIT_LOG_LEVEL_DEFAULT

config SHELL_RTT_INIT_LOG_LEVEL_DEFAULT
	bool "System limit (LOG_MAX_LEVEL)"

config SHELL_RTT_INIT_LOG_LEVEL_DBG
	bool "Debug"

config SHELL_RTT_INIT_LOG_LEVEL_INF
	bool "Info"

config SHELL_RTT_INIT_LOG_LEVEL_WRN
	bool "Warning"

config SHELL_RTT_INIT_LOG_LEVEL_ERR
	bool "Error"

config SHELL_RTT_INIT_LOG_LEVEL_NONE
	bool "None"

endchoice

config SHELL_RTT_INIT_LOG_LEVEL
	int
	default 0 if SHELL_RTT_INIT_LOG_LEVEL_NONE
	default 1 if SHELL_RTT_INIT_LOG_LEVEL_ERR
	default 2 if SHELL_RTT_INIT_LOG_LEVEL_WRN
	default 3 if SHELL_RTT_INIT_LOG_LEVEL_INF
	default 4 if SHELL_RTT_INIT_LOG_LEVEL_DBG
	default 5 if SHELL_RTT_INIT_LOG_LEVEL_DEFAULT

module = SHELL_RTT
module-str = RTT shell backend
source "subsys/logging/Kconfig.template.log_config"

endif # SHELL_BACKEND_RTT

config SHELL_BACKEND_MQTT
	bool "MQTT backend"
	depends on NET_TCP
	depends on NET_IPV4
	depends on NETWORKING
	select DNS_RESOLVER
	select HWINFO
	select MQTT_LIB
	select NET_MGMT
	select NET_MGMT_EVENT
	help
	  Enable MQTT backend.

if SHELL_BACKEND_MQTT

config SHELL_MQTT_SERVER_ADDR
	string "MQTT server address"
	default "192.168.0.100"
	help
	  MQTT server address.

config SHELL_MQTT_SERVER_PORT
	int "MQTT server port"
	default 1883
	help
	  MQTT server port.

config SHELL_MQTT_SERVER_USERNAME
	string "MQTT server username"
	help
	  MQTT server username.

config SHELL_MQTT_SERVER_PASSWORD
	string "MQTT server password"
	help
	  MQTT server password.

config SHELL_MQTT_RX_BUF_SIZE
	int "RX buffer size"
	default 256
	help
	  Buffer size for the MQTT data reception.

config SHELL_MQTT_TX_BUF_SIZE
	int "TX buffer size"
	range 32 65535
	default 256
	help
	  Buffer size for the MQTT data transmission.

module = SHELL_BACKEND_MQTT
default-timeout = 100
source "subsys/shell/Kconfig.template.shell_log_queue_timeout"

default-size = 512
source "subsys/shell/Kconfig.template.shell_log_queue_size"

choice
	prompt "Initial log level limit"
	default SHELL_MQTT_INIT_LOG_LEVEL_DEFAULT

config SHELL_MQTT_INIT_LOG_LEVEL_DEFAULT
	bool "System limit (LOG_MAX_LEVEL)"

config SHELL_MQTT_INIT_LOG_LEVEL_DBG
	bool "Debug"

config SHELL_MQTT_INIT_LOG_LEVEL_INF
	bool "Info"

config SHELL_MQTT_INIT_LOG_LEVEL_WRN
	bool "Warning"

config SHELL_MQTT_INIT_LOG_LEVEL_ERR
	bool "Error"

config SHELL_MQTT_INIT_LOG_LEVEL_NONE
	bool "None"

endchoice # SHELL_MQTT_INIT_LOG_LEVEL

config SHELL_MQTT_INIT_LOG_LEVEL
	int
	default 0 if SHELL_MQTT_INIT_LOG_LEVEL_NONE
	default 1 if SHELL_MQTT_INIT_LOG_LEVEL_ERR
	default 2 if SHELL_MQTT_INIT_LOG_LEVEL_WRN
	default 3 if SHELL_MQTT_INIT_LOG_LEVEL_INF
	default 4 if SHELL_MQTT_INIT_LOG_LEVEL_DBG
	default 5 if SHELL_MQTT_INIT_LOG_LEVEL_DEFAULT

module = SHELL_MQTT
module-str = MQTT shell backend
source "subsys/logging/Kconfig.template.log_config"

endif # SHELL_BACKEND_MQTT

config SHELL_BACKEND_TELNET
	bool "TELNET backend."
	depends on NET_TCP
	depends on NET_IPV4 || NET_IPV6
	help
	  Enable TELNET backend.

if SHELL_BACKEND_TELNET

config SHELL_PROMPT_TELNET
	string "Displayed prompt name"
	default "~$ "
	help
	  Displayed prompt name for TELNET backend. If prompt is set, the shell will
	  send two newlines during initialization.

config SHELL_TELNET_PORT
	int "Telnet port number"
	default 23
	help
	  This option is used to configure on which port telnet is going
	  to be bound.

config SHELL_TELNET_LINE_BUF_SIZE
	int "Telnet line buffer size"
	default 80
	help
	  This option can be used to modify the size of the buffer storing
	  shell output line, prior to sending it through the network.
	  Of course an output line can be longer than such size, it just
	  means sending it will start as soon as it reaches this size.
	  It really depends on what type of output is expected.
	  A lot of short lines: better reduce this value. On the contrary,
	  raise it.

config SHELL_TELNET_SEND_TIMEOUT
	int "Telnet line send timeout"
	default 100
	help
	  This option can be used to modify the duration of the timer that kick
	  in when a line buffer is not empty but did not yet meet the line feed.

config SHELL_TELNET_SUPPORT_COMMAND
	bool "Add support for telnet commands (IAC) [EXPERIMENTAL]"
	select EXPERIMENTAL
	help
	  Current support is so limited it's not interesting to enable it.
	  However, if proven to be needed at some point, it will be possible
	  to extend such support. It does have support for echo and "character
	  at a time" mode, which enable the history and line-editing features
	  of the shell.
	  IMPORTANT: This will increase network usage as a TCP packet will be
	  sent each time a character is typed in the telnet client.

module = SHELL_TELNET
default-timeout = 100
source "subsys/shell/Kconfig.template.shell_log_queue_timeout"

default-size = 512
source "subsys/shell/Kconfig.template.shell_log_queue_size"

choice
	prompt "Initial log level limit"
	default SHELL_TELNET_INIT_LOG_LEVEL_DEFAULT

config SHELL_TELNET_INIT_LOG_LEVEL_DEFAULT
	bool "System limit (LOG_MAX_LEVEL)"

config SHELL_TELNET_INIT_LOG_LEVEL_DBG
	bool "Debug"

config SHELL_TELNET_INIT_LOG_LEVEL_INF
	bool "Info"

config SHELL_TELNET_INIT_LOG_LEVEL_WRN
	bool "Warning"

config SHELL_TELNET_INIT_LOG_LEVEL_ERR
	bool "Error"

config SHELL_TELNET_INIT_LOG_LEVEL_NONE
	bool "None"

endchoice

config SHELL_TELNET_INIT_LOG_LEVEL
	int
	default 0 if SHELL_TELNET_INIT_LOG_LEVEL_NONE
	default 1 if SHELL_TELNET_INIT_LOG_LEVEL_ERR
	default 2 if SHELL_TELNET_INIT_LOG_LEVEL_WRN
	default 3 if SHELL_TELNET_INIT_LOG_LEVEL_INF
	default 4 if SHELL_TELNET_INIT_LOG_LEVEL_DBG
	default 5 if SHELL_TELNET_INIT_LOG_LEVEL_DEFAULT

module = SHELL_TELNET
module-str = TELNET shell backend
source "subsys/logging/Kconfig.template.log_config"

endif # SHELL_TELNET_BACKEND

config SHELL_BACKEND_DUMMY
	bool "Dummy backend."
	help
	  Enable dummy backend which can be used to execute commands with no
	  need for physical transport interface.

if SHELL_BACKEND_DUMMY

config SHELL_PROMPT_DUMMY
	string "Displayed prompt name"
	default "~$ "
	help
	  Displayed prompt name for DUMMY backend. If prompt is set, the shell will
	  send two newlines during initialization.

config SHELL_BACKEND_DUMMY_BUF_SIZE
	int "Size of dummy buffer size"
	default 400 if LOG_PRINTK
	default 300
	help
	  This is size of output buffer that will be used by dummy backend, this limits number of
	  characters that will be captured from command output.

choice
	prompt "Initial log level limit"
	default SHELL_DUMMY_INIT_LOG_LEVEL_INF

config SHELL_DUMMY_INIT_LOG_LEVEL_DEFAULT
	bool "System limit (LOG_MAX_LEVEL)"

config SHELL_DUMMY_INIT_LOG_LEVEL_DBG
	bool "Debug"

config SHELL_DUMMY_INIT_LOG_LEVEL_INF
	bool "Info"

config SHELL_DUMMY_INIT_LOG_LEVEL_WRN
	bool "Warning"

config SHELL_DUMMY_INIT_LOG_LEVEL_ERR
	bool "Error"

config SHELL_DUMMY_INIT_LOG_LEVEL_NONE
	bool "None"

endchoice

config SHELL_DUMMY_INIT_LOG_LEVEL
	int
	default 0 if SHELL_DUMMY_INIT_LOG_LEVEL_NONE
	default 1 if SHELL_DUMMY_INIT_LOG_LEVEL_ERR
	default 2 if SHELL_DUMMY_INIT_LOG_LEVEL_WRN
	default 3 if SHELL_DUMMY_INIT_LOG_LEVEL_INF
	default 4 if SHELL_DUMMY_INIT_LOG_LEVEL_DBG
	default 5 if SHELL_DUMMY_INIT_LOG_LEVEL_DEFAULT

endif # SHELL_BACKEND_DUMMY

endif # SHELL_BACKENDS