aboutsummaryrefslogtreecommitdiffstats
path: root/demos/PPC-SPC563-GCC/main.c
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-07-13 21:09:39 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-07-13 21:09:39 +0000
commit5fee9bc344b38d79ff1baf26e6365eeae7d407b5 (patch)
treecd03f7ccbdf0a44026bc0f80b6fc87b9a6d361d0 /demos/PPC-SPC563-GCC/main.c
parent2bdd9885e282b8cf26642f4a4b73fc4e61da872c (diff)
parent2e5abeebad5e94989f62e05582028f02c5e71dda (diff)
downloadChibiOS-5fee9bc344b38d79ff1baf26e6365eeae7d407b5.tar.gz
ChibiOS-5fee9bc344b38d79ff1baf26e6365eeae7d407b5.tar.bz2
ChibiOS-5fee9bc344b38d79ff1baf26e6365eeae7d407b5.zip
I2C. Merged changes from trunk.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@3160 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/PPC-SPC563-GCC/main.c')
-rw-r--r--demos/PPC-SPC563-GCC/main.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/demos/PPC-SPC563-GCC/main.c b/demos/PPC-SPC563-GCC/main.c
index b0eac06ab..aa1b9fd7e 100644
--- a/demos/PPC-SPC563-GCC/main.c
+++ b/demos/PPC-SPC563-GCC/main.c
@@ -24,26 +24,23 @@
#include "hal.h"
#include "test.h"
#include "shell.h"
+#include "chprintf.h"
#define SHELL_WA_SIZE THD_WA_SIZE(1024)
#define TEST_WA_SIZE THD_WA_SIZE(256)
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 : %i bytes", chCoreStatus());
- shellPrintLine(chp, buf);
- siprintf(buf, "heap fragments : %i", n);
- shellPrintLine(chp, buf);
- siprintf(buf, "heap free total : %i 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[]) {
@@ -61,24 +58,23 @@ static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) {
"SNDMSGQ",
"SNDMSG",
"WTMSG",
+ "WTQUEUE",
"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.sp,
- (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.sp,
+ (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);
}
@@ -88,13 +84,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);
@@ -119,6 +115,7 @@ static WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) {
(void)arg;
+ chRegSetThreadName("blinker");
SIU.GPDO[GPIO_LED1].R = 1;
SIU.GPDO[GPIO_LED2].R = 1;