aboutsummaryrefslogtreecommitdiff
path: root/src/util/time.c
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-03-24 09:38:08 -0700
committerChristian Cunningham <cc@localhost>2022-03-24 09:38:08 -0700
commit93bf62580a68533dc8252b9a2a055c02f34ecb67 (patch)
tree1b1ca92ebbe107a998136a1442c0dba5be885e13 /src/util/time.c
parent3e64dda5d5c350cc325650133f7e64967f1efe84 (diff)
Modularized
Diffstat (limited to 'src/util/time.c')
-rw-r--r--src/util/time.c76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/util/time.c b/src/util/time.c
deleted file mode 100644
index abb9c8d..0000000
--- a/src/util/time.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include <symbols.h>
-#include <sys/core.h>
-
-// CCNT - Cycle Timer (Close to ns resolution)
-
-void routing_core0cntv_to_core0fiq(void)
-{
- store32(0x80, CORE0_TIMER_IRQCNTL);
-}
-
-void routing_core0cntv_to_core0irq(void)
-{
- store32(0x08, CORE0_TIMER_IRQCNTL);
-}
-
-unsigned long read_core0timer_pending(void)
-{
- unsigned long tmp;
- tmp = load32(CORE0_IRQ_SOURCE);
- return tmp;
-}
-
-unsigned long long read_cntvct(void)
-{
- unsigned long long val;
- asm volatile("mrrc p15, 1, %Q0, %R0, c14" : "=r" (val));
- return (val);
-}
-
-unsigned long long read_cntvoff(void)
-{
- unsigned long long val;
- asm volatile("mrrc p15, 4, %Q0, %R0, c14" : "=r" (val));
- return (val);
-}
-
-unsigned long read_cntv_tval(void)
-{
- unsigned long val;
- asm volatile ("mrc p15, 0, %0, c14, c3, 0" : "=r"(val) );
- return val;
-}
-
-void write_cntv_tval(unsigned long val)
-{
- asm volatile ("mcr p15, 0, %0, c14, c3, 0" :: "r"(val) );
- return;
-}
-
-unsigned long read_cntfrq(void)
-{
- unsigned long val;
- 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;
-}
-
-void wait_msec(unsigned int n)
-{
- unsigned long start = *(volatile unsigned long*)SYS_TIMER_CHI;
- while (*(volatile unsigned long*)SYS_TIMER_CHI - start < n)
- asm volatile("nop");
-}