aboutsummaryrefslogtreecommitdiff
path: root/include/hw/ptimer.h
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2016-10-24 16:26:52 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-10-24 16:26:52 +0100
commit5580ea4576b60a4fa615c85e254fab1401149b45 (patch)
tree3d7d4dbe2ed49179b0b6a3ea352925ade49ec480 /include/hw/ptimer.h
parent56700e1aa6959c082a839285022fa4e48d5cf512 (diff)
hw/ptimer: Add "no counter round down" policy
For most of the timers counter starts to decrement after first period expires. Due to rounding down performed by the ptimer_get_count, it returns counter - 1 for the running timer, so that for the ptimer user it looks like counter gets decremented immediately after running the timer. Add "no counter round down" policy that provides correct behaviour for those timers. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Message-id: ef39622d0ebfdc32a0877e59ffdf6910dc3db688.1475421224.git.digetx@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/hw/ptimer.h')
-rw-r--r--include/hw/ptimer.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h
index 5455340187..48cccbdb51 100644
--- a/include/hw/ptimer.h
+++ b/include/hw/ptimer.h
@@ -51,6 +51,10 @@
* immediately, but after a one period. */
#define PTIMER_POLICY_NO_IMMEDIATE_RELOAD (1 << 3)
+/* Make counter value of the running timer represent the actual value and
+ * not the one less. */
+#define PTIMER_POLICY_NO_COUNTER_ROUND_DOWN (1 << 4)
+
/* ptimer.c */
typedef struct ptimer_state ptimer_state;
typedef void (*ptimer_cb)(void *opaque);