From: Joshua Wise Date: Wed, 18 Mar 2009 01:09:09 +0000 (-0400) Subject: testbench: Add a putc(getc()) loop. X-Git-Url: http://git.joshuawise.com/firearm.git/commitdiff_plain/121556d62c2c40b07a709ef038fa1ce0a67127c9?ds=inline testbench: Add a putc(getc()) loop. --- diff --git a/tests/testbench.c b/tests/testbench.c index 0c1cb77..e708df6 100644 --- a/tests/testbench.c +++ b/tests/testbench.c @@ -1,5 +1,14 @@ extern void putc(unsigned char c); +int serial_getc (void) +{ + int c; + do + asm volatile("mrc 5, 0, %0, c1, c1, 1" : "=r"(c)); + while (!(c & 0x100)); + return c & 0xFF; +} + void puts(unsigned char *s) { while (*s) @@ -115,7 +124,9 @@ int main() puts(": "); t->test(); } - puts("Done!\n"); + puts("Done! Echoing characters.\n"); + while (1) + putc(serial_getc()); return 0; } diff --git a/tests/testbench.hex b/tests/testbench.hex index 0627427..1335254 100644 Binary files a/tests/testbench.hex and b/tests/testbench.hex differ