Modified the test suite to work with a generic channel rather than with a serial driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@939 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
83cafc020d
commit
a8df5dfb84
22
test/test.c
22
test/test.c
|
@ -64,33 +64,33 @@ Thread *threads[MAX_THREADS];
|
||||||
/*
|
/*
|
||||||
* Console output.
|
* Console output.
|
||||||
*/
|
*/
|
||||||
static FullDuplexDriver *comp;
|
static BaseChannel *chp;
|
||||||
|
|
||||||
void test_printn(uint32_t n) {
|
void test_printn(uint32_t n) {
|
||||||
char buf[16], *p;
|
char buf[16], *p;
|
||||||
|
|
||||||
if (!n)
|
if (!n)
|
||||||
chIOPut(comp, '0');
|
chIOPut(chp, '0');
|
||||||
else {
|
else {
|
||||||
p = buf;
|
p = buf;
|
||||||
while (n)
|
while (n)
|
||||||
*p++ = (n % 10) + '0', n /= 10;
|
*p++ = (n % 10) + '0', n /= 10;
|
||||||
while (p > buf)
|
while (p > buf)
|
||||||
chIOPut(comp, *--p);
|
chIOPut(chp, *--p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_print(char *msgp) {
|
void test_print(char *msgp) {
|
||||||
|
|
||||||
while (*msgp)
|
while (*msgp)
|
||||||
chIOPut(comp, *msgp++);
|
chIOPut(chp, *msgp++);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_println(char *msgp) {
|
void test_println(char *msgp) {
|
||||||
|
|
||||||
test_print(msgp);
|
test_print(msgp);
|
||||||
chIOPut(comp, '\r');
|
chIOPut(chp, '\r');
|
||||||
chIOPut(comp, '\n');
|
chIOPut(chp, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -105,7 +105,7 @@ static void print_tokens(void) {
|
||||||
char *cp = tokens_buffer;
|
char *cp = tokens_buffer;
|
||||||
|
|
||||||
while (cp < tokp)
|
while (cp < tokp)
|
||||||
chIOPut(comp, *cp++);
|
chIOPut(chp, *cp++);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_emit_token(char token) {
|
void test_emit_token(char token) {
|
||||||
|
@ -232,15 +232,15 @@ static void print_line(void) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < 76; i++)
|
for (i = 0; i < 76; i++)
|
||||||
chIOPut(comp, '-');
|
chIOPut(chp, '-');
|
||||||
chIOPut(comp, '\r');
|
chIOPut(chp, '\r');
|
||||||
chIOPut(comp, '\n');
|
chIOPut(chp, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t TestThread(void *p) {
|
msg_t TestThread(void *p) {
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
comp = p;
|
chp = p;
|
||||||
test_println("");
|
test_println("");
|
||||||
test_println("*** ChibiOS/RT test suite");
|
test_println("*** ChibiOS/RT test suite");
|
||||||
test_println("***");
|
test_println("***");
|
||||||
|
|
Loading…
Reference in New Issue