[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [PATCH v2 38/47] arm32: add a new helper read_frequency()



This patch adds a new helpers read_frequency() to read out the
frequency.

Signed-off-by: Huang Shijie <shijie.huang@xxxxxxx>
---
 arch/arm/time.c          | 2 +-
 include/arm/arm32/time.h | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/time.c b/arch/arm/time.c
index 49d2f8d..7602fc9 100644
--- a/arch/arm/time.c
+++ b/arch/arm/time.c
@@ -110,7 +110,7 @@ void init_time(void)
 {
     printk("Initialising timer interface\n");
 
-    __asm__ __volatile__("mrc p15, 0, %0, c14, c0, 0":"=r"(counter_freq));
+    counter_freq = read_frequency();
     cntvct_at_init = read_virtual_count();
     printk("Virtual Count register is %"PRIX64", freq = %d Hz\n",
            cntvct_at_init, counter_freq);
diff --git a/include/arm/arm32/time.h b/include/arm/arm32/time.h
index 9a44635..cacc082 100644
--- a/include/arm/arm32/time.h
+++ b/include/arm/arm32/time.h
@@ -23,4 +23,13 @@ static inline void set_vtimer_compare(uint64_t value)
     write_timer_ctl(1);
 }
 
+static inline uint32_t read_frequency(void)
+{
+    uint32_t counter_freq;
+
+    __asm__ __volatile__("mrc p15, 0, %0, c14, c0, 0":"=r"(counter_freq));
+
+    return counter_freq;
+}
+
 #endif
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.