aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libnet/time.h6
-rw-r--r--slof/helpers.c18
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/libnet/time.h b/lib/libnet/time.h
new file mode 100644
index 0000000..fcd5cd5
--- /dev/null
+++ b/lib/libnet/time.h
@@ -0,0 +1,6 @@
+
+extern void set_timer(int);
+extern int get_timer(void);
+extern int get_sec_ticks(void);
+
+#define TICKS_SEC get_sec_ticks()
diff --git a/slof/helpers.c b/slof/helpers.c
index 86fd2b6..d074178 100644
--- a/slof/helpers.c
+++ b/slof/helpers.c
@@ -18,6 +18,7 @@
#include <cpu.h>
#include "helpers.h"
#include "paflof.h"
+#include "../lib/libnet/time.h" /* TODO: Get rid of old timer code */
/**
* get msec-timer value
@@ -46,6 +47,23 @@ void SLOF_usleep(uint32_t time)
forth_eval("us");
}
+static unsigned int dest_timer;
+
+void set_timer(int val)
+{
+ dest_timer = SLOF_GetTimer() + val;
+}
+
+int get_timer()
+{
+ return dest_timer - SLOF_GetTimer();
+}
+
+int get_sec_ticks(void)
+{
+ return 1000; /* number of ticks in 1 second */
+}
+
void *SLOF_dma_alloc(long size)
{
forth_push(size);