diff options
author | oharboe <oharboe> | 2008-05-01 18:49:10 +0000 |
---|---|---|
committer | oharboe <oharboe> | 2008-05-01 18:49:10 +0000 |
commit | ed14271c9743490ebc4947ba7904adaa0d16e279 (patch) | |
tree | a15289fc3d891b23b835fdaea4d46b1b51c75684 | |
parent | 47fd50b7c9654cf750e6c2024c9169a9eab2d6ad (diff) | |
download | zpu-ed14271c9743490ebc4947ba7904adaa0d16e279.zip zpu-ed14271c9743490ebc4947ba7904adaa0d16e279.tar.gz |
wip for interrupts
-rw-r--r-- | zpu/hdl/zpu4/test/interrupt/build.sh | 4 | ||||
-rw-r--r-- | zpu/hdl/zpu4/test/interrupt/int.c | 32 |
2 files changed, 36 insertions, 0 deletions
diff --git a/zpu/hdl/zpu4/test/interrupt/build.sh b/zpu/hdl/zpu4/test/interrupt/build.sh new file mode 100644 index 0000000..3d617e9 --- /dev/null +++ b/zpu/hdl/zpu4/test/interrupt/build.sh @@ -0,0 +1,4 @@ +zpu-elf-gcc -O3 -phi `pwd`/int.c -o int.elf -Wl,--relax -Wl,--gc-sections -g +zpu-elf-objdump --disassemble-all >int.dis int.elf +zpu-elf-objcopy -O binary int.elf int.bin +java -classpath ../../../../sw/simulator/zpusim.jar com.zylin.zpu.simulator.tools.MakeRam int.bin >int.ram diff --git a/zpu/hdl/zpu4/test/interrupt/int.c b/zpu/hdl/zpu4/test/interrupt/int.c new file mode 100644 index 0000000..2be6483 --- /dev/null +++ b/zpu/hdl/zpu4/test/interrupt/int.c @@ -0,0 +1,32 @@ +/*
+ * Shows usage of interrupts. Goes along with zpu_core_small_wip.vhd.
+ */
+#include <stdio.h>
+
+
+int counter;
+
+/* Example of single, fixed interval non-maskable, nested interrupt */
+void _zpu_interrupt(void)
+{
+ /* interrupts are enabled so we need to finish up quickly,
+ * lest we will get infinite recursion!*/
+ counter++;
+}
+
+int main(int argc, char **argv)
+{
+ int t;
+ t=counter;
+ for (;;)
+ {
+ if (t==counter)
+ {
+ puts("No interrupt\n");
+ } else
+ {
+ puts("Got interrupt\n");
+ }
+ }
+
+}
|