forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: Paul Sokolovsky <[email protected]>
- Loading branch information
Showing
10 changed files
with
80 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
CONFIG_CONSOLE_PULL=y | ||
CONFIG_CONSOLE_SUBSYS=y | ||
CONFIG_CONSOLE_GETCHAR=y | ||
CONFIG_CONSOLE_GETCHAR_BUFSIZE=64 | ||
CONFIG_CONSOLE_PUTCHAR_BUFSIZE=512 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
CONFIG_CONSOLE_PULL=y | ||
CONFIG_CONSOLE_SUBSYS=y | ||
CONFIG_CONSOLE_GETCHAR=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
CONFIG_CONSOLE_PULL=y | ||
CONFIG_CONSOLE_SUBSYS=y | ||
CONFIG_CONSOLE_GETLINE=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
zephyr_sources(line_fifo.c) | ||
zephyr_sources_ifdef(CONFIG_CONSOLE_GETCHAR getchar.c) | ||
zephyr_sources_ifdef(CONFIG_CONSOLE_GETLINE getline.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (c) 2018 Linaro Limited. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/** | ||
* @file | ||
* @brief Legacy fifo-based line input | ||
*/ | ||
|
||
#include <zephyr.h> | ||
#include <console.h> | ||
|
||
#ifdef CONFIG_UART_CONSOLE | ||
#include <drivers/console/uart_console.h> | ||
#endif | ||
#ifdef CONFIG_TELNET_CONSOLE | ||
#include <drivers/console/telnet_console.h> | ||
#endif | ||
#ifdef CONFIG_NATIVE_POSIX_CONSOLE | ||
#include <drivers/console/native_posix_console.h> | ||
#endif | ||
#ifdef CONFIG_WEBSOCKET_CONSOLE | ||
#include <drivers/console/websocket_console.h> | ||
#endif | ||
|
||
void console_register_line_input(struct k_fifo *avail_queue, | ||
struct k_fifo *out_queue, | ||
u8_t (*completion)(char *str, u8_t len)) | ||
{ | ||
/* Register serial console handler */ | ||
#ifdef CONFIG_UART_CONSOLE | ||
uart_register_input(avail_queue, out_queue, completion); | ||
#endif | ||
#ifdef CONFIG_TELNET_CONSOLE | ||
telnet_register_input(avail_queue, out_queue, completion); | ||
#endif | ||
#ifdef CONFIG_NATIVE_POSIX_STDIN_CONSOLE | ||
native_stdin_register_input(avail_queue, out_queue, completion); | ||
#endif | ||
#ifdef CONFIG_WEBSOCKET_CONSOLE | ||
ws_register_input(avail_queue, out_queue, completion); | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters