|
@@ -13,6 +13,8 @@
|
|
|
|
|
|
#include "qemu/osdep.h"
|
|
#include "qemu/osdep.h"
|
|
#include "qemu/cutils.h"
|
|
#include "qemu/cutils.h"
|
|
|
|
+#include "qapi/visitor.h"
|
|
|
|
+#include "sysemu/qtest.h"
|
|
#include "hw/clock.h"
|
|
#include "hw/clock.h"
|
|
#include "trace.h"
|
|
#include "trace.h"
|
|
|
|
|
|
@@ -158,6 +160,15 @@ bool clock_set_mul_div(Clock *clk, uint32_t multiplier, uint32_t divider)
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void clock_period_prop_get(Object *obj, Visitor *v, const char *name,
|
|
|
|
+ void *opaque, Error **errp)
|
|
|
|
+{
|
|
|
|
+ Clock *clk = CLOCK(obj);
|
|
|
|
+ uint64_t period = clock_get(clk);
|
|
|
|
+ visit_type_uint64(v, name, &period, errp);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
static void clock_initfn(Object *obj)
|
|
static void clock_initfn(Object *obj)
|
|
{
|
|
{
|
|
Clock *clk = CLOCK(obj);
|
|
Clock *clk = CLOCK(obj);
|
|
@@ -166,6 +177,11 @@ static void clock_initfn(Object *obj)
|
|
clk->divider = 1;
|
|
clk->divider = 1;
|
|
|
|
|
|
QLIST_INIT(&clk->children);
|
|
QLIST_INIT(&clk->children);
|
|
|
|
+
|
|
|
|
+ if (qtest_enabled()) {
|
|
|
|
+ object_property_add(obj, "qtest-clock-period", "uint64",
|
|
|
|
+ clock_period_prop_get, NULL, NULL, NULL);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
static void clock_finalizefn(Object *obj)
|
|
static void clock_finalizefn(Object *obj)
|