aboutsummaryrefslogtreecommitdiff
path: root/src/time.c
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2021-12-04 17:09:22 -0700
committerChristian Cunningham <cc@localhost>2021-12-04 17:09:22 -0700
commit1c6cd8e1ea53275cc44b2a0ee5a8448cbc4a3f0d (patch)
tree8ba9eed6acebbd0940898e5c46b35caed7e03792 /src/time.c
parent0ee2aaaa26441e37ed27e6c83cf9b65202596a4e (diff)
Restructured project
Diffstat (limited to 'src/time.c')
-rw-r--r--src/time.c76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/time.c b/src/time.c
deleted file mode 100644
index d637612..0000000
--- a/src/time.c
+++ /dev/null
@@ -1,76 +0,0 @@
-static inline unsigned long load32(unsigned long addr) {
- return *(volatile unsigned long*)addr;
-}
-
-static inline void store32(unsigned long value, unsigned long addr) {
- *(volatile unsigned long*)addr = value;
-}
-
-#define uint64_t unsigned long long
-#define uint32_t unsigned long
-
-#define CORE0_TIMER_IRQCNTL 0x40000040
-#define CORE0_IRQ_SOURCE 0x40000060
-
-void routing_core0cntv_to_core0irq(void)
-{
- // IRQ
- store32(0x08, CORE0_TIMER_IRQCNTL);
- // FIQ
- //store32(0x80, CORE0_TIMER_IRQCNTL);
-}
-
-uint32_t read_core0timer_pending(void)
-{
- uint32_t tmp;
- tmp = load32(CORE0_IRQ_SOURCE);
- return tmp;
-}
-
-void enable_cntv(void)
-{
- uint32_t cntv_ctl;
- cntv_ctl = 1;
- asm volatile ("mcr p15, 0, %0, c14, c3, 1" :: "r"(cntv_ctl) ); // write CNTV_CTL
-}
-
-void disable_cntv(void)
-{
- uint32_t cntv_ctl;
- cntv_ctl = 0;
- asm volatile ("mcr p15, 0, %0, c14, c3, 1" :: "r"(cntv_ctl) ); // write CNTV_CTL
-}
-
-uint64_t read_cntvct(void)
-{
- uint64_t val;
- asm volatile("mrrc p15, 1, %Q0, %R0, c14" : "=r" (val));
- return (val);
-}
-
-uint64_t read_cntvoff(void)
-{
- uint64_t val;
- asm volatile("mrrc p15, 4, %Q0, %R0, c14" : "=r" (val));
- return (val);
-}
-
-uint32_t read_cntv_tval(void)
-{
- uint32_t val;
- asm volatile ("mrc p15, 0, %0, c14, c3, 0" : "=r"(val) );
- return val;
-}
-
-void write_cntv_tval(uint32_t val)
-{
- asm volatile ("mcr p15, 0, %0, c14, c3, 0" :: "r"(val) );
- return;
-}
-
-uint32_t read_cntfrq(void)
-{
- uint32_t val;
- asm volatile ("mrc p15, 0, %0, c14, c0, 0" : "=r"(val) );
- return val;
-}