From 8b377a9d6d0ad281474a8dbff49ea3b093178b28 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 22 Jan 2010 16:00:45 -0800 Subject: moved into subdir --- usrp2/opencores/aemb/sw/c/endian-test.c | 86 +++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 usrp2/opencores/aemb/sw/c/endian-test.c (limited to 'usrp2/opencores/aemb/sw/c/endian-test.c') diff --git a/usrp2/opencores/aemb/sw/c/endian-test.c b/usrp2/opencores/aemb/sw/c/endian-test.c new file mode 100644 index 000000000..b585f7a30 --- /dev/null +++ b/usrp2/opencores/aemb/sw/c/endian-test.c @@ -0,0 +1,86 @@ + +#include "memory_map.h" + +int main() { + char *p = (char *)0x4000; + short *q = (short *)0x5000; + int *r= (int *)0x6000; + + int *output = (int *)0x7000; + + char s; + short t; + int u; + + // Write + // Bytes + *p = (char)1; + p++; + *p = (char)2; + p++; + *p = (char)3; + p++; + *p = (char)4; + p++; + *p = (char)5; + + // Words + *q = (short) 0x1112; + q++; + *q = (short) 0x1314; + q++; + *q = (short) 0x1516; + + // Double Words + *r = 0x21222324; + r++; + *r = 0x25262728; + r++; + *r = 0x292a2b2c; + + + // Read + p = (char *)0x6000; + s = *p; + if(s == 0x21) + *output = 0x53534150; // PASS + else + *output = 0x4C494146; // FAIL + + p = (char *)0x6001; + s = *p; + if(s == 0x22) + *output = 0x53534150; // PASS + else + *output = 0x4C494146; // FAIL + + p = (char *)0x6002; + s = *p; + if(s == 0x23) + *output = 0x53534150; // PASS + else + *output = 0x4C494146; // FAIL + + + p = (char *)0x6003; + s = *p; + if(s == 0x24) + *output = 0x53534150; // PASS + else + *output = 0x4C494146; // FAIL + + q = (short *)0x4000; + t = *q; + if(t == 0x0102) + *output = 0x53534150; // PASS + else + *output = 0x4C494146; // FAIL + + r = (int *)0x4000; + u = *r; + if(u == 0x01020304) + *output = 0x53534150; // PASS + else + *output = 0x4C494146; // FAIL + +} -- cgit v1.2.3