26 cci::cci_param<unsigned int> p_nr_frames;
27 cci::cci_param<unsigned int> p_nr_views;
28 cci::cci_param<unsigned int> p_frame_stride;
29 cci::cci_param<uint32_t> p_freq_hz;
30 cci::cci_param<uint32_t> p_freq_scale;
33 std::vector<std::unique_ptr<cci::cci_param<unsigned int>>> p_cnttid;
47 sc_core::sc_vector<QemuInitiatorSignalSocket> irq;
50 qemu_hexagon_qtimer(
const sc_core::sc_module_name& name, sc_core::sc_object* o)
51 : qemu_hexagon_qtimer(name, *(
dynamic_cast<QemuInstance*
>(o)))
54 qemu_hexagon_qtimer(sc_core::sc_module_name nm,
QemuInstance& inst)
56 , p_nr_frames(
"nr_frames", 2,
"Number of frames")
57 , p_nr_views(
"nr_views", 1,
"Number of views")
58 , p_frame_stride(
"frame_stride", 0x1000,
"Frame stride in bytes")
59 , p_freq_hz(
"freq_hz", 19200000,
"freq of the timer in hz")
60 , p_freq_scale(
"freq_scale", 100,
"scale down factor of the timer freq")
62 , view_socket(
"mem_view", inst)
63 , irq(
"irq", p_nr_frames.get_value(), [](
const char* n,
size_t i) { return new QemuInitiatorSignalSocket(n); })
66 unsigned int nr_cnttid = (p_nr_frames.get_value() + 7) / 8;
67 for (
unsigned int i = 0; i < nr_cnttid; ++i) {
68 p_cnttid.push_back(std::make_unique<cci::cci_param<unsigned int>>(
69 std::string(
"cnttid_") + std::to_string(i), (i == 0) ? 0x11u : 0x0u,
70 std::string(
"Value of cnttid_") + std::to_string(i)));
74 void before_end_of_elaboration()
override
76 QemuDevice::before_end_of_elaboration();
78 m_dev.set_prop_int(
"nr_frames", p_nr_frames);
79 m_dev.set_prop_int(
"nr_views", p_nr_views);
80 m_dev.set_prop_int(
"frame_stride", p_frame_stride);
81 m_dev.set_prop_int(
"freq", p_freq_hz.get_value());
82 m_dev.set_prop_int(
"freq-scale", p_freq_scale.get_value());
83 for (
unsigned int i = 0; i < p_cnttid.size(); ++i) {
84 m_dev.set_prop_int((std::string(
"cnttid_") + std::to_string(i)).c_str(), *p_cnttid[i]);
88 void end_of_elaboration()
override
90 QemuDevice::set_sysbus_as_parent_bus();
91 QemuDevice::end_of_elaboration();
95 view_socket.init(sbd, 1);
97 for (uint32_t i = 0; i < p_nr_frames.get_value(); ++i) {
98 irq[i].init_sbd(sbd, i);