Le 29/07/2016 à 15:39, Peter Maydell a écrit :
On 13 June 2016 at 17:27,  <fred.kon...@greensocs.com> wrote:
From: KONRAD Frederic <fred.kon...@greensocs.com>

This introduces the clock binding and the update part.
When the qemu_clk_rate_update(qemu_clk, int) function is called:
   * The clock callback is called on the qemu_clk so it can change the rate.
   * The qemu_clk_rate_update function is called on all the driven clock.

Signed-off-by: KONRAD Frederic <fred.kon...@greensocs.com>
---
  include/qemu/qemu-clock.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++
  qemu-clock.c              | 56 ++++++++++++++++++++++++++++++++++++++++
  2 files changed, 121 insertions(+)

diff --git a/include/qemu/qemu-clock.h b/include/qemu/qemu-clock.h
index a2ba105..677de9a 100644
--- a/include/qemu/qemu-clock.h
+++ b/include/qemu/qemu-clock.h
@@ -27,15 +27,29 @@
  #include "qemu/osdep.h"
  #include "qom/object.h"

+typedef float (*qemu_clk_on_rate_update_cb)(void *opaque, float rate);
+
  #define TYPE_CLOCK "qemu-clk"
  #define QEMU_CLOCK(obj) OBJECT_CHECK(struct qemu_clk, (obj), TYPE_CLOCK)

+typedef struct ClkList ClkList;
+
  typedef struct qemu_clk {
      /*< private >*/
      Object parent_obj;
      char *name;            /* name of this clock in the device. */
+    float in_rate;         /* rate of the clock which drive this pin. */
+    float out_rate;        /* rate of this clock pin. */
I'm rather dubious that we should be using floats here.
Almost nothing in our hardware emulation uses float or double.

We probably can use uint64_t here?

Thanks,
Fred

+    void *opaque;
+    qemu_clk_on_rate_update_cb cb;
+    QLIST_HEAD(, ClkList) bound;
  } *qemu_clk;
thanks
-- PMM



Reply via email to