diff options
Diffstat (limited to 'software/mpu')
-rw-r--r-- | software/mpu/usb-cdc-shell.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/software/mpu/usb-cdc-shell.c b/software/mpu/usb-cdc-shell.c index ce62ce4..b78f035 100644 --- a/software/mpu/usb-cdc-shell.c +++ b/software/mpu/usb-cdc-shell.c @@ -176,24 +176,22 @@ static int8_t shell_return_code; #define SHELL_WA_SIZE THD_WA_SIZE(2048) #define TEST_WA_SIZE THD_WA_SIZE(256) -static int8_t cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) +static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) { size_t n, size; (void)argv; if (argc > 0) { chprintf(chp, "Usage: mem\r\n"); - return SHELL_CMD_CONTINUE; + return; } n = chHeapStatus(NULL, &size); chprintf(chp, "core free memory : %u bytes\r\n", chCoreStatus()); chprintf(chp, "heap fragments : %u\r\n", n); chprintf(chp, "heap free total : %u bytes\r\n", size); - - return SHELL_CMD_CONTINUE; } -static int8_t cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) +static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { static const char *states[] = {THD_STATE_NAMES}; Thread *tp; @@ -201,7 +199,7 @@ static int8_t cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) (void)argv; if (argc > 0) { chprintf(chp, "Usage: threads\r\n"); - return SHELL_CMD_CONTINUE; + return; } chprintf(chp, " addr stack prio refs state time name\r\n"); tp = chRegFirstThread(); @@ -213,67 +211,63 @@ static int8_t cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) (tp->p_name == NULL) ? "-" : tp->p_name); tp = chRegNextThread(tp); } while (tp != NULL); - - return SHELL_CMD_CONTINUE; } -static int8_t cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) +static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) { Thread *tp; (void)argv; if (argc > 0) { chprintf(chp, "Usage: test\r\n"); - return SHELL_CMD_CONTINUE; + return; } tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(), TestThread, chp); if (tp == NULL) { chprintf(chp, "out of memory\r\n"); - return SHELL_CMD_CONTINUE; + return; } chThdWait(tp); - - return SHELL_CMD_CONTINUE; } -static int8_t cmd_halt(BaseSequentialStream *chp, int argc, char *argv[]) +static void cmd_halt(BaseSequentialStream *chp, int argc, char *argv[]) { (void)argv; if (argc > 0) { chprintf(chp, "Usage: halt\r\n"); - return SHELL_CMD_CONTINUE; + return; } shell_return_code = MPU_HALT; chprintf(chp, "halting system.\r\n"); - return SHELL_CMD_EXIT; + shellExit(RDY_OK); } -static int8_t cmd_reboot(BaseSequentialStream *chp, int argc, char *argv[]) +static void cmd_reboot(BaseSequentialStream *chp, int argc, char *argv[]) { (void)argv; if (argc > 0) { chprintf(chp, "Usage: reboot\r\n"); - return SHELL_CMD_CONTINUE; + return; } shell_return_code = MPU_REBOOT; chprintf(chp, "rebooting system ...\r\n"); - return SHELL_CMD_EXIT; + shellExit(RDY_OK); } -static int8_t cmd_bootloader(BaseSequentialStream *chp, int argc, char *argv[]) +static void cmd_bootloader(BaseSequentialStream *chp, int argc, char *argv[]) { (void)argv; if (argc > 0) { chprintf(chp, "Usage: bootloader\r\n"); - return SHELL_CMD_CONTINUE; + return; } shell_return_code = MPU_BOOTLOADER; chprintf(chp, "rebooting to bootloader ...\r\n"); - return SHELL_CMD_EXIT; + shellExit(RDY_OK); } static const ShellCommand commands[] = { |