summaryrefslogtreecommitdiff
path: root/include/hwtimer.h
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2012-01-25 21:16:46 +0000
committerVincent Palatin <vpalatin@chromium.org>2012-01-25 22:50:07 +0000
commit645dad5d3f658d7c5e0d54453964e91afe7b43c0 (patch)
tree432904125c384bc93f3792d337c08e6718fa81f3 /include/hwtimer.h
parentc89bea4a5b183f24d71277aa6b9d55c92001eda7 (diff)
downloadchrome-ec-645dad5d3f658d7c5e0d54453964e91afe7b43c0.tar.gz
Split the timer code between OS code and hardware dependant code.
Preparatory work to introduce a second SoC : 2/5 The hwtimer.* files implement the driver for the SoC timer block. The timer.* files provides the OS level clock/timer functions. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=None TEST=on BDS, check 'waitms' and 'gettime' on the EC console. Change-Id: Icbc58d9be59ee268e2d5a94f8b20de0cabcdc91d
Diffstat (limited to 'include/hwtimer.h')
-rw-r--r--include/hwtimer.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/hwtimer.h b/include/hwtimer.h
new file mode 100644
index 0000000000..384e3613dd
--- /dev/null
+++ b/include/hwtimer.h
@@ -0,0 +1,43 @@
+/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Hardware timer driver API */
+
+#ifndef __EC_HWTIMER_H
+#define __EC_HWTIMER_H
+
+/**
+ * Programs when the next timer should fire an interrupt.
+ * deadline: timestamp of the event.
+ */
+void __hw_clock_event_set(uint32_t deadline);
+
+/* Returns the timestamp of the next programed event */
+uint32_t __hw_clock_event_get(void);
+
+/* Cancel the next event programed by __hw_clock_event_set */
+void __hw_clock_event_clear(void);
+
+/* Returns the value of the free-running counter used as clock. */
+uint32_t __hw_clock_source_read(void);
+
+/**
+ * Initializes the hardware timer used to provide clock services.
+ *
+ * It returns the IRQ number of the timer routine.
+ */
+int __hw_clock_source_init(void);
+
+/**
+ * Searches the next deadline and program it in the timer hardware.
+ *
+ * overflow: if true, the 32-bit counter as overflowed since the last call.
+ *
+ * This function is exported from the common timers code as an helper for the
+ * hardware timer interrupt routine.
+ */
+void process_timers(int overflow);
+
+#endif /* __EC_HWTIMER_H */