[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/13] hw/timer/allwinner: Add AW_PIT_TIMER_MAX definition
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 02/13] hw/timer/allwinner: Add AW_PIT_TIMER_MAX definition |
Date: |
Thu, 19 Dec 2019 19:51:16 +0100 |
This controller is able to use up to 6 timers.
Later we will reuse part of it to model other similar controllers
but with less timers. To simplify the VMSTATE, we'll keep a max
of 6 timers. Add a definition for that value.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
include/hw/timer/allwinner-a10-pit.h | 14 ++++++++------
hw/timer/allwinner-a10-pit.c | 8 ++++----
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/include/hw/timer/allwinner-a10-pit.h
b/include/hw/timer/allwinner-a10-pit.h
index 6aceda81ee..54c40c7db6 100644
--- a/include/hw/timer/allwinner-a10-pit.h
+++ b/include/hw/timer/allwinner-a10-pit.h
@@ -7,6 +7,8 @@
#define TYPE_AW_A10_PIT "allwinner-A10-timer"
#define AW_A10_PIT(obj) OBJECT_CHECK(AwA10PITState, (obj), TYPE_AW_A10_PIT)
+#define AW_PIT_TIMER_MAX 6
+
#define AW_A10_PIT_TIMER_NR 6
#define AW_A10_PIT_TIMER_IRQ 0x1
#define AW_A10_PIT_WDOG_IRQ 0x100
@@ -47,17 +49,17 @@ struct AwA10PITState {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
- qemu_irq irq[AW_A10_PIT_TIMER_NR];
- ptimer_state * timer[AW_A10_PIT_TIMER_NR];
- AwA10TimerContext timer_context[AW_A10_PIT_TIMER_NR];
+ qemu_irq irq[AW_PIT_TIMER_MAX];
+ ptimer_state * timer[AW_PIT_TIMER_MAX];
+ AwA10TimerContext timer_context[AW_PIT_TIMER_MAX];
MemoryRegion iomem;
uint32_t clk_freq[4];
uint32_t irq_enable;
uint32_t irq_status;
- uint32_t control[AW_A10_PIT_TIMER_NR];
- uint32_t interval[AW_A10_PIT_TIMER_NR];
- uint32_t count[AW_A10_PIT_TIMER_NR];
+ uint32_t control[AW_PIT_TIMER_MAX];
+ uint32_t interval[AW_PIT_TIMER_MAX];
+ uint32_t count[AW_PIT_TIMER_MAX];
uint32_t watch_dog_mode;
uint32_t watch_dog_control;
uint32_t count_lo;
diff --git a/hw/timer/allwinner-a10-pit.c b/hw/timer/allwinner-a10-pit.c
index 117e5c7bf8..b31a0bcd43 100644
--- a/hw/timer/allwinner-a10-pit.c
+++ b/hw/timer/allwinner-a10-pit.c
@@ -203,15 +203,15 @@ static const VMStateDescription vmstate_a10_pit = {
.fields = (VMStateField[]) {
VMSTATE_UINT32(irq_enable, AwA10PITState),
VMSTATE_UINT32(irq_status, AwA10PITState),
- VMSTATE_UINT32_ARRAY(control, AwA10PITState, AW_A10_PIT_TIMER_NR),
- VMSTATE_UINT32_ARRAY(interval, AwA10PITState, AW_A10_PIT_TIMER_NR),
- VMSTATE_UINT32_ARRAY(count, AwA10PITState, AW_A10_PIT_TIMER_NR),
+ VMSTATE_UINT32_ARRAY(control, AwA10PITState, AW_PIT_TIMER_MAX),
+ VMSTATE_UINT32_ARRAY(interval, AwA10PITState, AW_PIT_TIMER_MAX),
+ VMSTATE_UINT32_ARRAY(count, AwA10PITState, AW_PIT_TIMER_MAX),
VMSTATE_UINT32(watch_dog_mode, AwA10PITState),
VMSTATE_UINT32(watch_dog_control, AwA10PITState),
VMSTATE_UINT32(count_lo, AwA10PITState),
VMSTATE_UINT32(count_hi, AwA10PITState),
VMSTATE_UINT32(count_ctl, AwA10PITState),
- VMSTATE_PTIMER_ARRAY(timer, AwA10PITState, AW_A10_PIT_TIMER_NR),
+ VMSTATE_PTIMER_ARRAY(timer, AwA10PITState, AW_PIT_TIMER_MAX),
VMSTATE_END_OF_LIST()
}
};
--
2.21.0
- [RFC PATCH 00/13] hw/timer/allwinner: Make it reusable, Philippe Mathieu-Daudé, 2019/12/19
- [PATCH 01/13] hw/timer/allwinner: Use the AW_A10_PIT_TIMER_NR definition, Philippe Mathieu-Daudé, 2019/12/19
- [PATCH 03/13] hw/timer/allwinner: Remove unused definitions, Philippe Mathieu-Daudé, 2019/12/19
- [PATCH 04/13] hw/timer/allwinner: Move definitions from header to source, Philippe Mathieu-Daudé, 2019/12/19
- [PATCH 02/13] hw/timer/allwinner: Add AW_PIT_TIMER_MAX definition,
Philippe Mathieu-Daudé <=
- [RFC PATCH 06/13] hw/timer/allwinner: Rename 'timer_context' as 'timer', Philippe Mathieu-Daudé, 2019/12/19
- [RFC PATCH 05/13] hw/timer/allwinner: Rename the ptimer field, Philippe Mathieu-Daudé, 2019/12/19
- [RFC PATCH 08/13] hw/timer/allwinner: Add a timer_count field, Philippe Mathieu-Daudé, 2019/12/19
- [RFC PATCH 09/13] hw/timer/allwinner: Rename AwA10TimerContext as AllwinnerTmrState, Philippe Mathieu-Daudé, 2019/12/19
- [RFC PATCH 07/13] hw/timer/allwinner: Move timer specific fields into AwA10TimerContext, Philippe Mathieu-Daudé, 2019/12/19
- [RFC PATCH 10/13] hw/timer/allwinner: Rename AwA10PITState as AllwinnerTmrCtrlState, Philippe Mathieu-Daudé, 2019/12/19
- [RFC PATCH 11/13] hw/timer/allwinner: Introduce TYPE_AW_COMMON_PIT abstract device, Philippe Mathieu-Daudé, 2019/12/19
- [RFC PATCH 12/13] hw/timer/allwinner: Rename AW_A10_PIT() as AW_TIMER_CTRL(), Philippe Mathieu-Daudé, 2019/12/19