diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-04-10 12:21:53 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-04-10 12:21:53 +0000 |
commit | 4fb90c9c32b458b1607e46438b8417d9f59ecaf4 (patch) | |
tree | 3838ab846eae5f3e63b0633e154abceef95b056a /os/various | |
parent | 8dd80c1aa541de9fb3814f8481bf97f3d974f1ab (diff) | |
download | ChibiOS-4fb90c9c32b458b1607e46438b8417d9f59ecaf4.tar.gz ChibiOS-4fb90c9c32b458b1607e46438b8417d9f59ecaf4.tar.bz2 ChibiOS-4fb90c9c32b458b1607e46438b8417d9f59ecaf4.zip |
More shell enhancements.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9276 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/various')
-rw-r--r-- | os/various/shell/shell.c | 18 | ||||
-rw-r--r-- | os/various/shell/shell.h | 10 | ||||
-rw-r--r-- | os/various/shell/shell_cmd.c | 4 |
3 files changed, 19 insertions, 13 deletions
diff --git a/os/various/shell/shell.c b/os/various/shell/shell.c index 2a61c70eb..341f9eb06 100644 --- a/os/various/shell/shell.c +++ b/os/various/shell/shell.c @@ -227,7 +227,7 @@ static int get_history(ShellHistory *shp, char *line, int dir) { }
#endif
-#if (SHELL_USE_COMPLETION == TRUE)
+#if (SHELL_USE_COMPLETION == TRUE) || defined(__DOXYGEN__)
static void get_completions(ShellConfig *scfg, char *line) {
ShellCommand *lcp = shell_local_commands;
const ShellCommand *scp = scfg->sc_commands;
@@ -327,8 +327,8 @@ static void write_completions(ShellConfig *scfg, char *line, int pos) { THD_FUNCTION(shellThread, p) {
int n;
ShellConfig *scfg = p;
- BaseSequentialStream *chp = ((ShellConfig *)p)->sc_channel;
- const ShellCommand *scp = ((ShellConfig *)p)->sc_commands;
+ BaseSequentialStream *chp = scfg->sc_channel;
+ const ShellCommand *scp = scfg->sc_commands;
char *lp, *cmd, *tokp, line[SHELL_MAX_LINE_LENGTH];
char *args[SHELL_MAX_ARGUMENTS + 1];
@@ -433,8 +433,10 @@ void shellExit(msg_t msg) { bool shellGetLine(ShellConfig *scfg, char *line, unsigned size) {
char *p = line;
BaseSequentialStream *chp = scfg->sc_channel;
+#if (SHELL_USE_ESC_SEQ == TRUE)
bool escape = false;
bool bracket = false;
+#endif
#if (SHELL_USE_HISTORY == TRUE)
ShellHistory *shp = scfg->sc_history;
@@ -445,7 +447,7 @@ bool shellGetLine(ShellConfig *scfg, char *line, unsigned size) { if (streamRead(chp, (uint8_t *)&c, 1) == 0)
return true;
-#if (SHELL_USE_ESC_SEQ == TRUE)
+#if SHELL_USE_ESC_SEQ == TRUE
if (c == 27) {
escape = true;
continue;
@@ -459,7 +461,7 @@ bool shellGetLine(ShellConfig *scfg, char *line, unsigned size) { }
if (bracket) {
bracket = false;
-#if (SHELL_USE_HISTORY == TRUE)
+#if SHELL_USE_HISTORY == TRUE
if (c == 'A') {
int len = get_history(shp, line, SHELL_HIST_DIR_BK);
@@ -507,7 +509,7 @@ bool shellGetLine(ShellConfig *scfg, char *line, unsigned size) { }
if (c == '\r') {
chprintf(chp, SHELL_NEWLINE_STR);
-#if (SHELL_USE_HISTORY == TRUE)
+#if SHELL_USE_HISTORY == TRUE
if (shp != NULL) {
save_history(shp, line, p - line);
}
@@ -515,7 +517,7 @@ bool shellGetLine(ShellConfig *scfg, char *line, unsigned size) { *p = 0;
return false;
}
-#if (SHELL_USE_COMPLETION == TRUE)
+#if SHELL_USE_COMPLETION == TRUE
if (c == '\t') {
if (p < line + size - 1) {
*p = 0;
@@ -530,7 +532,7 @@ bool shellGetLine(ShellConfig *scfg, char *line, unsigned size) { continue;
}
#endif
-#if (SHELL_USE_HISTORY == TRUE)
+#if SHELL_USE_HISTORY == TRUE
if (c == 14) {
int len = get_history(shp, line, SHELL_HIST_DIR_FW);
diff --git a/os/various/shell/shell.h b/os/various/shell/shell.h index cf52bce9a..4620ded8b 100644 --- a/os/various/shell/shell.h +++ b/os/various/shell/shell.h @@ -25,6 +25,10 @@ #ifndef SHELL_H
#define SHELL_H
+#if defined(SHELL_CONFIG_FILE)
+#include "shellconf.h"
+#endif
+
/*===========================================================================*/
/* Module constants. */
/*===========================================================================*/
@@ -74,14 +78,14 @@ * @brief Enable shell command history
*/
#if !defined(SHELL_USE_HISTORY) || defined(__DOXYGEN__)
-#define SHELL_USE_HISTORY TRUE
+#define SHELL_USE_HISTORY FALSE
#endif
/**
* @brief Enable shell command completion
*/
#if !defined(SHELL_USE_COMPLETION) || defined(__DOXYGEN__)
-#define SHELL_USE_COMPLETION TRUE
+#define SHELL_USE_COMPLETION FALSE
#endif
/**
@@ -95,7 +99,7 @@ * @brief Enable shell escape sequence processing
*/
#if !defined(SHELL_USE_ESC_SEQ) || defined(__DOXYGEN__)
-#define SHELL_USE_ESC_SEQ TRUE
+#define SHELL_USE_ESC_SEQ FALSE
#endif
/*===========================================================================*/
diff --git a/os/various/shell/shell_cmd.c b/os/various/shell/shell_cmd.c index 3b40f1bb8..724d83351 100644 --- a/os/various/shell/shell_cmd.c +++ b/os/various/shell/shell_cmd.c @@ -156,8 +156,8 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { chprintf(chp, "stklimit stack addr refs prio state name\r\n"SHELL_NEWLINE_STR);
tp = chRegFirstThread();
do {
-#if CH_DBG_ENABLE_STACK_CHECK == TRUE
- uint32_t stklimit = (uint32_t)tp->stklimit;
+#if (CH_DBG_ENABLE_STACK_CHECK == TRUE) || (CH_CFG_USE_DYNAMIC == TRUE)
+ uint32_t stklimit = (uint32_t)tp->wabase;
#else
uint32_t stklimit = 0U;
#endif
|