From a1982f90a42b22f2858e7d8497ab7223cd49b65d Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 24 Aug 2018 13:17:40 +0100 Subject: hw/misc/mps2-fpgaio: Implement 1Hz and 100Hz counters The MPS2 FPGAIO block includes some simple free-running counters. Implement these. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20180820141116.9118-2-peter.maydell@linaro.org --- include/hw/misc/mps2-fpgaio.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/hw/misc/mps2-fpgaio.h') diff --git a/include/hw/misc/mps2-fpgaio.h b/include/hw/misc/mps2-fpgaio.h index eedf17e..ec057d3 100644 --- a/include/hw/misc/mps2-fpgaio.h +++ b/include/hw/misc/mps2-fpgaio.h @@ -38,6 +38,10 @@ typedef struct { uint32_t misc; uint32_t prescale_clk; + + /* These hold the CLOCK_VIRTUAL ns tick when the CLK1HZ/CLK100HZ was zero */ + int64_t clk1hz_tick_offset; + int64_t clk100hz_tick_offset; } MPS2FPGAIO; #endif -- cgit v1.1 From 93739075d28ce81ae06237b48084f26a377cdcad Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 24 Aug 2018 13:17:40 +0100 Subject: hw/misc/mps2-fpgaio: Implement PSCNTR and COUNTER In the MPS2 FPGAIO, PSCNTR is a free-running downcounter with a reload value configured via the PRESCALE register, and COUNTER counts up by 1 every time PSCNTR reaches zero. Implement these counters. We can just increment the counters migration subsection's version ID because we only added it in the previous commit, so no released QEMU versions will be using it. Signed-off-by: Peter Maydell Reviewed-by: Alistair Francis Reviewed-by: Richard Henderson Message-id: 20180820141116.9118-3-peter.maydell@linaro.org --- include/hw/misc/mps2-fpgaio.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/hw/misc/mps2-fpgaio.h') diff --git a/include/hw/misc/mps2-fpgaio.h b/include/hw/misc/mps2-fpgaio.h index ec057d3..69e265c 100644 --- a/include/hw/misc/mps2-fpgaio.h +++ b/include/hw/misc/mps2-fpgaio.h @@ -37,6 +37,12 @@ typedef struct { uint32_t prescale; uint32_t misc; + /* QEMU_CLOCK_VIRTUAL time at which counter and pscntr were last synced */ + int64_t pscntr_sync_ticks; + /* Values of COUNTER and PSCNTR at time pscntr_sync_ticks */ + uint32_t counter; + uint32_t pscntr; + uint32_t prescale_clk; /* These hold the CLOCK_VIRTUAL ns tick when the CLK1HZ/CLK100HZ was zero */ -- cgit v1.1