From d0a2e55ed0cf97be924ebbdae2497fd77bfac5b6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 May 2012 17:09:20 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4175 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 55cfdf445..09596e592 100644 --- a/test/test.c +++ b/test/test.c @@ -85,7 +85,12 @@ void * ROMCONST wa[5] = {test.wa.T0, test.wa.T1, test.wa.T2, /* * Console output. */ -static BaseChannel *chp; +static BaseSequentialStream *chp; + +static void _putc(BaseSequentialStream *chp, char c) { + + chSequentialStreamWrite(chp, (const uint8_t *)&c, 1); +} /** * @brief Prints a decimal unsigned number. @@ -96,13 +101,13 @@ void test_printn(uint32_t n) { char buf[16], *p; if (!n) - chIOPut(chp, '0'); + _putc(chp, '0'); else { p = buf; while (n) *p++ = (n % 10) + '0', n /= 10; while (p > buf) - chIOPut(chp, *--p); + _putc(chp, *--p); } } @@ -114,7 +119,7 @@ void test_printn(uint32_t n) { void test_print(const char *msgp) { while (*msgp) - chIOPut(chp, *msgp++); + _putc(chp, *msgp++); } /** @@ -125,8 +130,7 @@ void test_print(const char *msgp) { void test_println(const char *msgp) { test_print(msgp); - chIOPut(chp, '\r'); - chIOPut(chp, '\n'); + chSequentialStreamWrite(chp, (const uint8_t *)"\r\n", 1); } /* @@ -141,7 +145,7 @@ static void print_tokens(void) { char *cp = tokens_buffer; while (cp < tokp) - chIOPut(chp, *cp++); + _putc(chp, *cp++); } /** @@ -306,9 +310,8 @@ static void print_line(void) { unsigned i; for (i = 0; i < 76; i++) - chIOPut(chp, '-'); - chIOPut(chp, '\r'); - chIOPut(chp, '\n'); + _putc(chp, '-'); + chSequentialStreamWrite(chp, (const uint8_t *)"\r\n", 1); } /** -- cgit v1.2.3