aboutsummaryrefslogtreecommitdiffstats
path: root/opencores/aemb/sw/c/endian-test.c
diff options
context:
space:
mode:
authorjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>2008-09-08 01:00:12 +0000
committerjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>2008-09-08 01:00:12 +0000
commit61f2f0214c5999ea42a368a4fc99f03d8eb28d1e (patch)
treee7e24a9adc05ff1422fe3ada9926a51634741b47 /opencores/aemb/sw/c/endian-test.c
downloaduhd-61f2f0214c5999ea42a368a4fc99f03d8eb28d1e.tar.gz
uhd-61f2f0214c5999ea42a368a4fc99f03d8eb28d1e.tar.bz2
uhd-61f2f0214c5999ea42a368a4fc99f03d8eb28d1e.zip
Merged r9433:9527 from features/gr-usrp2 into trunk. Adds usrp2 and gr-usrp2 top-level components. Trunk passes distcheck with mb-gcc installed, but currently not without them. The key issue is that when mb-gcc is not installed, the build system skips over the usrp2/firmware directory, and the firmware include files don't get put into the dist tarball. But we can't do the usual DIST_SUBDIRS method as the firmware is a subpackage.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9528 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'opencores/aemb/sw/c/endian-test.c')
-rw-r--r--opencores/aemb/sw/c/endian-test.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/opencores/aemb/sw/c/endian-test.c b/opencores/aemb/sw/c/endian-test.c
new file mode 100644
index 000000000..b585f7a30
--- /dev/null
+++ b/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
+
+}