aboutsummaryrefslogtreecommitdiff
path: root/VexRiscvSocSoftware/projects/briey/timer
diff options
context:
space:
mode:
Diffstat (limited to 'VexRiscvSocSoftware/projects/briey/timer')
-rwxr-xr-xVexRiscvSocSoftware/projects/briey/timer/makefile21
-rwxr-xr-xVexRiscvSocSoftware/projects/briey/timer/src/crt.S1
-rwxr-xr-xVexRiscvSocSoftware/projects/briey/timer/src/main.c27
3 files changed, 49 insertions, 0 deletions
diff --git a/VexRiscvSocSoftware/projects/briey/timer/makefile b/VexRiscvSocSoftware/projects/briey/timer/makefile
new file mode 100755
index 0000000..2af3acb
--- /dev/null
+++ b/VexRiscvSocSoftware/projects/briey/timer/makefile
@@ -0,0 +1,21 @@
+PROJ_NAME=timer
+DEBUG=yes
+BENCH=no
+MULDIV=no
+
+
+SRCS = $(wildcard src/*.c) \
+ $(wildcard src/*.cpp) \
+ $(wildcard src/*.S)
+
+
+
+LDSCRIPT = ../libs/linker.ld
+INC += -I../../../libs/
+INC += -I../libs/
+
+include ../../../resources/gcc.mk
+include ../../../resources/subproject.mk
+
+
+
diff --git a/VexRiscvSocSoftware/projects/briey/timer/src/crt.S b/VexRiscvSocSoftware/projects/briey/timer/src/crt.S
new file mode 100755
index 0000000..b0a8ddb
--- /dev/null
+++ b/VexRiscvSocSoftware/projects/briey/timer/src/crt.S
@@ -0,0 +1 @@
+#include "../../../../resources/crt.S"
diff --git a/VexRiscvSocSoftware/projects/briey/timer/src/main.c b/VexRiscvSocSoftware/projects/briey/timer/src/main.c
new file mode 100755
index 0000000..1b3531b
--- /dev/null
+++ b/VexRiscvSocSoftware/projects/briey/timer/src/main.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <briey.h>
+
+int main() {
+ interruptCtrl_init(TIMER_INTERRUPT);
+ prescaler_init(TIMER_PRESCALER);
+ timer_init(TIMER_A);
+
+ TIMER_PRESCALER->LIMIT = 7;
+
+ TIMER_A->LIMIT = 100;
+ TIMER_A->CLEARS_TICKS = 0x00010002;
+
+ TIMER_INTERRUPT->PENDINGS = 0xF;
+ TIMER_INTERRUPT->MASKS = 0x1;
+}
+
+
+void irqCallback(){
+ TIMER_INTERRUPT->PENDINGS = 1;
+}
+
+