[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [PATCH v2 37/47] arm32: move several timer functions to a separate header
This patch moves read_virtual_count()/write_timer_ctl()/set_vtimer_compare() to a separate header: include/arm/arm32/time.h Signed-off-by: Huang Shijie <shijie.huang@xxxxxxx> --- arch/arm/time.c | 25 +------------------------ include/arm/arm32/time.h | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 24 deletions(-) create mode 100644 include/arm/arm32/time.h diff --git a/arch/arm/time.c b/arch/arm/time.c index 42b6848..49d2f8d 100644 --- a/arch/arm/time.c +++ b/arch/arm/time.c @@ -3,6 +3,7 @@ #include <mini-os/events.h> #if defined(__arm__) +#include <mini-os/arm32/time.h> #include <mini-os/arm32/traps.h> #else #include <mini-os/arm64/traps.h> @@ -63,13 +64,6 @@ static inline uint64_t ns_to_ticks(s_time_t ns) */ static struct timespec shadow_ts; -static inline uint64_t read_virtual_count(void) -{ - uint32_t c_lo, c_hi; - __asm__ __volatile__("mrrc p15, 1, %0, %1, c14":"=r"(c_lo), "=r"(c_hi)); - return (((uint64_t) c_hi) << 32) + c_lo; -} - /* monotonic_clock(): returns # of nanoseconds passed since time_init() * Note: This function is required to return accurate * time even in the absence of multiple timer ticks. @@ -91,23 +85,6 @@ int gettimeofday(struct timeval *tv, void *tz) return 0; } -/* Set the timer and mask. */ -void write_timer_ctl(uint32_t value) { - __asm__ __volatile__( - "mcr p15, 0, %0, c14, c3, 1\n" - "isb"::"r"(value)); -} - -void set_vtimer_compare(uint64_t value) { - DEBUG("New CompareValue : %llx\n", value); - - __asm__ __volatile__("mcrr p15, 3, %0, %H0, c14" - ::"r"(value)); - - /* Enable timer and unmask the output signal */ - write_timer_ctl(1); -} - void unset_vtimer_compare(void) { /* Disable timer and mask the output signal */ write_timer_ctl(2); diff --git a/include/arm/arm32/time.h b/include/arm/arm32/time.h new file mode 100644 index 0000000..9a44635 --- /dev/null +++ b/include/arm/arm32/time.h @@ -0,0 +1,26 @@ +#ifndef __ARM32_TIME_H +#define __ARM32_TIME_H + +static inline uint64_t read_virtual_count(void) +{ + uint32_t c_lo, c_hi; + __asm__ __volatile__("mrrc p15, 1, %0, %1, c14":"=r"(c_lo), "=r"(c_hi)); + return (((uint64_t) c_hi) << 32) + c_lo; +} + +/* Set the timer and mask. */ +static inline void write_timer_ctl(uint32_t value) +{ + __asm__ __volatile__("mcr p15, 0, %0, c14, c3, 1\n" + "isb"::"r"(value)); +} + +static inline void set_vtimer_compare(uint64_t value) +{ + __asm__ __volatile__("mcrr p15, 3, %0, %H0, c14" ::"r"(value)); + + /* Enable timer and unmask the output signal */ + write_timer_ctl(1); +} + +#endif -- 2.7.4 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |