summary refs log tree commit diff stats
path: root/include/hw/ptimer.h
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-07-09 14:51:34 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-07-09 14:51:34 +0100
commit086ede32afc9c70de3d75c4fb91c63db790cbd5c (patch)
tree471f251d68728013c8737b5b90022b1628e76521 /include/hw/ptimer.h
parentb78aae9bb65876baa47b73d5cf63372171630bf9 (diff)
downloadfocaccia-qemu-086ede32afc9c70de3d75c4fb91c63db790cbd5c.tar.gz
focaccia-qemu-086ede32afc9c70de3d75c4fb91c63db790cbd5c.zip
ptimer: Add TRIGGER_ONLY_ON_DECREMENT policy option
The CMSDK timer behaviour is that an interrupt is triggered when the
counter counts down from 1 to 0; however one is not triggered if the
counter is manually set to 0 by a guest write to the counter register.
Currently ptimer can't handle this; add a policy option to allow
a ptimer user to request this behaviour.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 20180703171044.9503-2-peter.maydell@linaro.org
Diffstat (limited to 'include/hw/ptimer.h')
-rw-r--r--include/hw/ptimer.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h
index fc4ef5cc1d..0731d9aef1 100644
--- a/include/hw/ptimer.h
+++ b/include/hw/ptimer.h
@@ -69,6 +69,15 @@
  * not the one less.  */
 #define PTIMER_POLICY_NO_COUNTER_ROUND_DOWN (1 << 4)
 
+/*
+ * Starting to run with a zero counter, or setting the counter to "0" via
+ * ptimer_set_count() or ptimer_set_limit() will not trigger the timer
+ * (though it will cause a reload). Only a counter decrement to "0"
+ * will cause a trigger. Not compatible with NO_IMMEDIATE_TRIGGER;
+ * ptimer_init() will assert() that you don't set both.
+ */
+#define PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT (1 << 5)
+
 /* ptimer.c */
 typedef struct ptimer_state ptimer_state;
 typedef void (*ptimer_cb)(void *opaque);