X-Git-Url: http://git.joshuawise.com/firearm.git/blobdiff_plain/4ad5ab91c49da6711650444e2836c6bbcfa1608a..a9f76b88574c4e20ed91ab6704f3f74852584825:/tests/testbench.c diff --git a/tests/testbench.c b/tests/testbench.c index f8366b4..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) @@ -19,6 +28,7 @@ void puthex(unsigned int x) #include "ack.c" #include "j4cbo.c" #include "corecurse.c" +#include "miniblarg.c" int fact(int n) { @@ -42,8 +52,11 @@ struct tests { }; extern int ldm_bonehead(); + #ifndef X86 -__asm__( +int shnasto() +{ +__asm__ volatile( ".globl ldm_bonehead\n" "ldm_bonehead:;" "mov r3, lr;" @@ -59,8 +72,9 @@ __asm__( "nop;" "mov pc, r3\n;" "1:\n" -"ldr r2, =0x00002FE0;" -"ldr r1, =0x0000004C;" +"mov r2, #0x00002F00;" +"orr r2, r2, #0x000000E0;" +"mov r1, #0x0000004C;" "mov ip, sp;" "stmdb sp!, {fp, ip, lr, pc};" "mov r0, #0x00880000;" @@ -69,7 +83,9 @@ __asm__( "nop;" "nop;\n" ); +} #endif + void ldm_tester() { #ifdef X86 @@ -91,6 +107,7 @@ struct tests tlist[] = { {"fact", facttest}, {"j4cbo", j4cbo}, {"ack", acktest}, + {"miniblarg", testmain}, {"corecurse", corecurse}, {0, 0}}; @@ -107,7 +124,9 @@ int main() puts(": "); t->test(); } - puts("Done!\n"); + puts("Done! Echoing characters.\n"); + while (1) + putc(serial_getc()); return 0; }