]> Joshua Wise's Git repositories - firearm.git/blobdiff - tests/testbench.c
Issue: AUTORESET.
[firearm.git] / tests / testbench.c
index ff9f96cb05ee84c2595560bf0b3e9fe3e42794e1..e708df676b6169b0aa4e116e4b8c298b4e8be0bc 100644 (file)
@@ -1,5 +1,14 @@
 extern void putc(unsigned char c);
 
 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)
 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 "ack.c"
 #include "j4cbo.c"
 #include "corecurse.c"
+#include "miniblarg.c"
 
 int fact(int n)
 {
 
 int fact(int n)
 {
@@ -43,7 +53,10 @@ struct tests {
 
 extern int ldm_bonehead();
 
 
 extern int ldm_bonehead();
 
-__asm__(
+#ifndef X86
+int shnasto()
+{
+__asm__ volatile(
 ".globl ldm_bonehead\n"
 "ldm_bonehead:;"
 "mov r3, lr;"
 ".globl ldm_bonehead\n"
 "ldm_bonehead:;"
 "mov r3, lr;"
@@ -59,8 +72,9 @@ __asm__(
 "nop;"
 "mov pc, r3\n;"
 "1:\n"
 "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;"
 "mov ip, sp;"
 "stmdb sp!, {fp, ip, lr, pc};"
 "mov r0, #0x00880000;"
@@ -69,10 +83,16 @@ __asm__(
 "nop;"
 "nop;\n"
 );
 "nop;"
 "nop;\n"
 );
+}
+#endif
 
 void ldm_tester()
 {
 
 void ldm_tester()
 {
+#ifdef X86
+       int x = 0x00880000;
+#else
        int x = ldm_bonehead();
        int x = ldm_bonehead();
+#endif
        if (x != 0x00880000)
        {
                puts("FAIL: result was ");
        if (x != 0x00880000)
        {
                puts("FAIL: result was ");
@@ -87,6 +107,7 @@ struct tests tlist[] = {
        {"fact", facttest},
        {"j4cbo", j4cbo},
        {"ack", acktest},
        {"fact", facttest},
        {"j4cbo", j4cbo},
        {"ack", acktest},
+       {"miniblarg", testmain},
        {"corecurse", corecurse},
        {0, 0}};
 
        {"corecurse", corecurse},
        {0, 0}};
 
@@ -103,7 +124,9 @@ int main()
                puts(": ");
                t->test();
        }
                puts(": ");
                t->test();
        }
-       puts("Done!\n");
+       puts("Done! Echoing characters.\n");
        
        
+       while (1)
+               putc(serial_getc());
        return 0;
 }
        return 0;
 }
This page took 0.027802 seconds and 4 git commands to generate.