aboutsummaryrefslogtreecommitdiff
path: root/include/util/time.h
blob: e5e18b13b8e58e75253b3e58a4a324f2118b37f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef UTIL_TIME_H
#define UTIL_TIME_H

void routing_core0cntv_to_core0fiq(void);
void routing_core0cntv_to_core0irq(void);
unsigned long read_core0timer_pending(void);
unsigned long long read_cntvct(void);
unsigned long long read_cntvoff(void);
unsigned long read_cntv_tval(void);
void write_cntv_tval(unsigned long val);
unsigned long read_cntfrq(void);
unsigned long long get_time(void);
void wait_msec(unsigned int n);

static inline void enablecntv(void)
{
	unsigned long cntv_ctl;
	cntv_ctl = 1;
	asm volatile ("mcr p15, 0, %0, c14, c3, 1" :: "r"(cntv_ctl) ); // write CNTV_CTL
}

static inline void disablecntv(void)
{
	unsigned long cntv_ctl;
	cntv_ctl = 0;
	asm volatile ("mcr p15, 0, %0, c14, c3, 1" :: "r"(cntv_ctl) ); // write CNTV_CTL
}

#endif