Commit f6d8ab82 authored by Paul Sokolovsky's avatar Paul Sokolovsky Committed by Anas Nashif
Browse files

subsys: console: Factor out fifo-based console input abstraction



Console subsystem is intended to be a layer between console drivers
and console clients, like e.g. shell. This change factors out code
from shell which dealed with individial console drivers and moves it
to console subsystem, under the name console_register_line_input().

To accommodate for this change, older console subsys Kconfig symbol
is changed from CONFIG_CONSOLE_PULL to CONFIG_CONSOLE_SUBSYS
(CONFIG_CONSOLE is already used by console drivers). This signifies
that console subsystem is intended to deal with all of console
aspects in Zephyr (existing and new), not just provide some "new"
functionality on top of raw console drivers, like it initially
started.

Signed-off-by: default avatarPaul Sokolovsky <paul.sokolovsky@linaro.org>
parent 54a5997f
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -77,6 +77,25 @@ void console_getline_init(void);
 */
char *console_getline(void);

/** @brief Initialize legacy fifo-based line input
 *
 *  Input processing is started when string is typed in the console.
 *  Carriage return is translated to NULL making string always NULL
 *  terminated. Application before calling register function need to
 *  initialize two fifo queues mentioned below.
 *
 *  This is a special-purpose function, it's recommended to use
 *  console_getchar() or console_getline() functions instead.
 *
 *  @param avail_queue k_fifo queue keeping available line buffers
 *  @param out_queue k_fifo queue of entered lines which to be processed
 *         in the application code.
 *  @param completion callback for tab completion of entered commands
 */
void console_register_line_input(struct k_fifo *avail_queue,
				 struct k_fifo *out_queue,
				 u8_t (*completion)(char *str, u8_t len));


#ifdef __cplusplus
}
+1 −1
Original line number Diff line number Diff line
CONFIG_CONSOLE_PULL=y
CONFIG_CONSOLE_SUBSYS=y
CONFIG_CONSOLE_GETCHAR=y
CONFIG_CONSOLE_GETCHAR_BUFSIZE=64
CONFIG_CONSOLE_PUTCHAR_BUFSIZE=512
+1 −1
Original line number Diff line number Diff line
CONFIG_CONSOLE_PULL=y
CONFIG_CONSOLE_SUBSYS=y
CONFIG_CONSOLE_GETCHAR=y
+1 −1
Original line number Diff line number Diff line
CONFIG_CONSOLE_PULL=y
CONFIG_CONSOLE_SUBSYS=y
CONFIG_CONSOLE_GETLINE=y
+1 −1
Original line number Diff line number Diff line
add_subdirectory(debug)
add_subdirectory(logging)
add_subdirectory_ifdef(CONFIG_BT                   bluetooth)
add_subdirectory_ifdef(CONFIG_CONSOLE_PULL         console)
add_subdirectory_ifdef(CONFIG_CONSOLE_SUBSYS       console)
add_subdirectory_ifdef(CONFIG_CONSOLE_SHELL        shell)
add_subdirectory_ifdef(CONFIG_CPLUSPLUS            cpp)
add_subdirectory_ifdef(CONFIG_DISK_ACCESS          disk)
Loading