aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/arm_timer.c1
-rw-r--r--hw/etraxfs_timer.c1
-rw-r--r--hw/grlib_apbuart.c1
-rw-r--r--hw/grlib_gptimer.c1
-rw-r--r--hw/lan9118.c1
-rw-r--r--hw/leon3.c1
-rw-r--r--hw/lm32_timer.c1
-rw-r--r--hw/mcf5206.c1
-rw-r--r--hw/mcf5208.c1
-rw-r--r--hw/milkymist-sysctl.c1
-rw-r--r--hw/musicpal.c1
-rw-r--r--hw/ptimer.c1
-rw-r--r--hw/ptimer.h27
-rw-r--r--hw/sh_timer.c1
-rw-r--r--hw/slavio_timer.c1
-rw-r--r--hw/xilinx_axidma.c1
-rw-r--r--hw/xilinx_timer.c1
17 files changed, 43 insertions, 0 deletions
diff --git a/hw/arm_timer.c b/hw/arm_timer.c
index 60e1c63ab6..1902f1a7b9 100644
--- a/hw/arm_timer.c
+++ b/hw/arm_timer.c
@@ -11,6 +11,7 @@
#include "qemu-timer.h"
#include "qemu-common.h"
#include "qdev.h"
+#include "ptimer.h"
/* Common timer implementation. */
diff --git a/hw/etraxfs_timer.c b/hw/etraxfs_timer.c
index 319cee130b..2dfdb3063e 100644
--- a/hw/etraxfs_timer.c
+++ b/hw/etraxfs_timer.c
@@ -24,6 +24,7 @@
#include "sysbus.h"
#include "sysemu.h"
#include "qemu-timer.h"
+#include "ptimer.h"
#define D(x)
diff --git a/hw/grlib_apbuart.c b/hw/grlib_apbuart.c
index 62bdb03a9c..f8a64e1644 100644
--- a/hw/grlib_apbuart.c
+++ b/hw/grlib_apbuart.c
@@ -24,6 +24,7 @@
#include "sysbus.h"
#include "qemu-char.h"
+#include "ptimer.h"
#include "trace.h"
diff --git a/hw/grlib_gptimer.c b/hw/grlib_gptimer.c
index 5645054c3c..9c98a830d7 100644
--- a/hw/grlib_gptimer.c
+++ b/hw/grlib_gptimer.c
@@ -24,6 +24,7 @@
#include "sysbus.h"
#include "qemu-timer.h"
+#include "ptimer.h"
#include "trace.h"
diff --git a/hw/lan9118.c b/hw/lan9118.c
index 7e64c5dee3..341a52142f 100644
--- a/hw/lan9118.c
+++ b/hw/lan9118.c
@@ -11,6 +11,7 @@
#include "net.h"
#include "devices.h"
#include "sysemu.h"
+#include "ptimer.h"
/* For crc32 */
#include <zlib.h>
diff --git a/hw/leon3.c b/hw/leon3.c
index e25bb046a7..71d79a65a7 100644
--- a/hw/leon3.c
+++ b/hw/leon3.c
@@ -23,6 +23,7 @@
*/
#include "hw.h"
#include "qemu-timer.h"
+#include "ptimer.h"
#include "qemu-char.h"
#include "sysemu.h"
#include "boards.h"
diff --git a/hw/lm32_timer.c b/hw/lm32_timer.c
index 445847f1ce..115e1e968f 100644
--- a/hw/lm32_timer.c
+++ b/hw/lm32_timer.c
@@ -25,6 +25,7 @@
#include "sysbus.h"
#include "trace.h"
#include "qemu-timer.h"
+#include "ptimer.h"
#include "qemu-error.h"
#define DEFAULT_FREQUENCY (50*1000000)
diff --git a/hw/mcf5206.c b/hw/mcf5206.c
index 7b6d501447..5110d833af 100644
--- a/hw/mcf5206.c
+++ b/hw/mcf5206.c
@@ -8,6 +8,7 @@
#include "hw.h"
#include "mcf.h"
#include "qemu-timer.h"
+#include "ptimer.h"
#include "sysemu.h"
#include "exec-memory.h"
diff --git a/hw/mcf5208.c b/hw/mcf5208.c
index 3b0636dc2f..aa11a755cc 100644
--- a/hw/mcf5208.c
+++ b/hw/mcf5208.c
@@ -8,6 +8,7 @@
#include "hw.h"
#include "mcf.h"
#include "qemu-timer.h"
+#include "ptimer.h"
#include "sysemu.h"
#include "net.h"
#include "boards.h"
diff --git a/hw/milkymist-sysctl.c b/hw/milkymist-sysctl.c
index 6326b70abb..bd2a298d2e 100644
--- a/hw/milkymist-sysctl.c
+++ b/hw/milkymist-sysctl.c
@@ -26,6 +26,7 @@
#include "sysemu.h"
#include "trace.h"
#include "qemu-timer.h"
+#include "ptimer.h"
#include "qemu-error.h"
enum {
diff --git a/hw/musicpal.c b/hw/musicpal.c
index a01e3d2d92..522559d4b7 100644
--- a/hw/musicpal.c
+++ b/hw/musicpal.c
@@ -14,6 +14,7 @@
#include "boards.h"
#include "pc.h"
#include "qemu-timer.h"
+#include "ptimer.h"
#include "block.h"
#include "flash.h"
#include "console.h"
diff --git a/hw/ptimer.c b/hw/ptimer.c
index b6cabd5b7d..de7d6643ad 100644
--- a/hw/ptimer.c
+++ b/hw/ptimer.c
@@ -7,6 +7,7 @@
*/
#include "hw.h"
#include "qemu-timer.h"
+#include "ptimer.h"
#include "host-utils.h"
struct ptimer_state
diff --git a/hw/ptimer.h b/hw/ptimer.h
new file mode 100644
index 0000000000..69cdddc721
--- /dev/null
+++ b/hw/ptimer.h
@@ -0,0 +1,27 @@
+/*
+ * General purpose implementation of a simple periodic countdown timer.
+ *
+ * Copyright (c) 2007 CodeSourcery.
+ *
+ * This code is licensed under the GNU LGPL.
+ */
+#ifndef PTIMER_H
+#define PTIMER_H
+
+#include "qemu-common.h"
+#include "qemu-timer.h"
+
+/* ptimer.c */
+typedef struct ptimer_state ptimer_state;
+typedef void (*ptimer_cb)(void *opaque);
+
+ptimer_state *ptimer_init(QEMUBH *bh);
+void ptimer_set_period(ptimer_state *s, int64_t period);
+void ptimer_set_freq(ptimer_state *s, uint32_t freq);
+void ptimer_set_limit(ptimer_state *s, uint64_t limit, int reload);
+uint64_t ptimer_get_count(ptimer_state *s);
+void ptimer_set_count(ptimer_state *s, uint64_t count);
+void ptimer_run(ptimer_state *s, int oneshot);
+void ptimer_stop(ptimer_state *s);
+
+#endif
diff --git a/hw/sh_timer.c b/hw/sh_timer.c
index d2c0cec835..64bf604ba4 100644
--- a/hw/sh_timer.c
+++ b/hw/sh_timer.c
@@ -12,6 +12,7 @@
#include "sh.h"
#include "qemu-timer.h"
#include "exec-memory.h"
+#include "ptimer.h"
//#define DEBUG_TIMER
diff --git a/hw/slavio_timer.c b/hw/slavio_timer.c
index 2353c43bda..44b500a5fa 100644
--- a/hw/slavio_timer.c
+++ b/hw/slavio_timer.c
@@ -24,6 +24,7 @@
#include "sun4m.h"
#include "qemu-timer.h"
+#include "ptimer.h"
#include "sysbus.h"
#include "trace.h"
diff --git a/hw/xilinx_axidma.c b/hw/xilinx_axidma.c
index 596ec0ed68..0da20d9565 100644
--- a/hw/xilinx_axidma.c
+++ b/hw/xilinx_axidma.c
@@ -25,6 +25,7 @@
#include "sysbus.h"
#include "qemu-char.h"
#include "qemu-timer.h"
+#include "ptimer.h"
#include "qemu-log.h"
#include "qdev-addr.h"
diff --git a/hw/xilinx_timer.c b/hw/xilinx_timer.c
index 0b2f32a3af..adca53b98c 100644
--- a/hw/xilinx_timer.c
+++ b/hw/xilinx_timer.c
@@ -24,6 +24,7 @@
#include "sysbus.h"
#include "qemu-timer.h"
+#include "ptimer.h"
#define D(x)