aboutsummaryrefslogtreecommitdiff
path: root/src/util/time.c
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-01-20 16:28:18 -0700
committerChristian Cunningham <cc@localhost>2022-01-20 16:28:18 -0700
commit022dfd0f42962da6c60fbeb5604e1455a07eaaa6 (patch)
tree9798813d345b18a00337c26ec6384b42fe41e208 /src/util/time.c
parenta9171b3f7499dfff1f40bf3503fdf13a20487b68 (diff)
Added System Timer Hook
Diffstat (limited to 'src/util/time.c')
-rw-r--r--src/util/time.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util/time.c b/src/util/time.c
index a0c539b..e9e5716 100644
--- a/src/util/time.c
+++ b/src/util/time.c
@@ -51,3 +51,17 @@ unsigned long read_cntfrq(void)
asm volatile ("mrc p15, 0, %0, c14, c0, 0" : "=r"(val) );
return val;
}
+
+unsigned long long get_time(void)
+{
+ union {
+ unsigned long long tval;
+ struct {
+ unsigned long high;
+ unsigned long low;
+ } tvalb;
+ } t;
+ t.tvalb.low = *(unsigned long*)SYS_TIMER_CLO;
+ t.tvalb.high = *(unsigned long*)SYS_TIMER_CHI;
+ return t.tval;
+}