diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-06-28 06:54:35 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-06-28 06:54:35 +0000 |
commit | 7bdd564b9d903146bbfc02fe38e586fc8e15f282 (patch) | |
tree | c644e509bc81a35a96bad01c9d801206a52d3627 /testhal/STM32 | |
parent | ddc9ded3f065d8da59a843390814b1c19061c566 (diff) | |
download | ChibiOS-7bdd564b9d903146bbfc02fe38e586fc8e15f282.tar.gz ChibiOS-7bdd564b9d903146bbfc02fe38e586fc8e15f282.tar.bz2 ChibiOS-7bdd564b9d903146bbfc02fe38e586fc8e15f282.zip |
Updated demos using the shell.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3094 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32')
-rw-r--r-- | testhal/STM32/USB_CDC/Makefile | 2 | ||||
-rw-r--r-- | testhal/STM32/USB_CDC/main.c | 31 |
2 files changed, 14 insertions, 19 deletions
diff --git a/testhal/STM32/USB_CDC/Makefile b/testhal/STM32/USB_CDC/Makefile index 16b23cc48..8ebd984fb 100644 --- a/testhal/STM32/USB_CDC/Makefile +++ b/testhal/STM32/USB_CDC/Makefile @@ -73,7 +73,7 @@ CSRC = $(PORTSRC) \ $(PLATFORMSRC) \
$(BOARDSRC) \
$(CHIBIOS)/os/various/shell.c \
- $(CHIBIOS)/os/various/syscalls.c \
+ $(CHIBIOS)/os/various/chprintf.c \
main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global
diff --git a/testhal/STM32/USB_CDC/main.c b/testhal/STM32/USB_CDC/main.c index 6d8994c8d..e55e54685 100644 --- a/testhal/STM32/USB_CDC/main.c +++ b/testhal/STM32/USB_CDC/main.c @@ -27,6 +27,7 @@ #include "usb_cdc.h"
#include "shell.h"
+#include "chprintf.h"
/*===========================================================================*/
/* USB related stuff. */
@@ -318,20 +319,16 @@ static const SerialUSBConfig serusbcfg = { static void cmd_mem(BaseChannel *chp, int argc, char *argv[]) {
size_t n, size;
- char buf[52];
(void)argv;
if (argc > 0) {
- shellPrintLine(chp, "Usage: mem");
+ chprintf(chp, "Usage: mem\r\n");
return;
}
n = chHeapStatus(NULL, &size);
- siprintf(buf, "core free memory : %u bytes", chCoreStatus());
- shellPrintLine(chp, buf);
- siprintf(buf, "heap fragments : %u", n);
- shellPrintLine(chp, buf);
- siprintf(buf, "heap free total : %u bytes", size);
- shellPrintLine(chp, buf);
+ 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);
}
static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) {
@@ -352,21 +349,19 @@ static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { "FINAL"
};
Thread *tp;
- char buf[60];
(void)argv;
if (argc > 0) {
- shellPrintLine(chp, "Usage: threads");
+ chprintf(chp, "Usage: threads\r\n");
return;
}
- shellPrintLine(chp, " addr stack prio refs state time");
+ chprintf(chp, " addr stack prio refs state time\r\n");
tp = chRegFirstThread();
do {
- siprintf(buf, "%8lx %8lx %4u %4i %9s %u",
- (uint32_t)tp, (uint32_t)tp->p_ctx.r13,
- (unsigned int)tp->p_prio, tp->p_refs - 1,
- states[tp->p_state], (unsigned int)tp->p_time);
- shellPrintLine(chp, buf);
+ chprintf(chp, "%.8lx %.8lx %4lu %4lu %9s %lu\r\n",
+ (uint32_t)tp, (uint32_t)tp->p_ctx.r13,
+ (uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1),
+ states[tp->p_state], (uint32_t)tp->p_time);
tp = chRegNextThread(tp);
} while (tp != NULL);
}
@@ -376,13 +371,13 @@ static void cmd_test(BaseChannel *chp, int argc, char *argv[]) { (void)argv;
if (argc > 0) {
- shellPrintLine(chp, "Usage: test");
+ chprintf(chp, "Usage: test\r\n");
return;
}
tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(),
TestThread, chp);
if (tp == NULL) {
- shellPrintLine(chp, "out of memory");
+ chprintf(chp, "out of memory\r\n");
return;
}
chThdWait(tp);
|