testbench: Add a putc(getc()) loop.
[firearm.git] / tests / testbench.c
index 0c1cb77..e708df6 100644 (file)
@@ -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;
 }
This page took 0.017025 seconds and 4 git commands to generate.