2019-10-20 01:47:02 +02:00
|
|
|
/*
|
|
|
|
* BCM2835 SYS timer emulation
|
|
|
|
*
|
|
|
|
* Copyright (c) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BCM2835_SYSTIMER_H
|
|
|
|
#define BCM2835_SYSTIMER_H
|
|
|
|
|
|
|
|
#include "hw/sysbus.h"
|
|
|
|
#include "hw/irq.h"
|
2020-10-10 22:37:08 +02:00
|
|
|
#include "qemu/timer.h"
|
2020-09-03 22:43:22 +02:00
|
|
|
#include "qom/object.h"
|
2019-10-20 01:47:02 +02:00
|
|
|
|
|
|
|
#define TYPE_BCM2835_SYSTIMER "bcm2835-sys-timer"
|
2020-09-16 20:25:19 +02:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(BCM2835SystemTimerState, BCM2835_SYSTIMER)
|
2019-10-20 01:47:02 +02:00
|
|
|
|
2020-10-10 22:37:06 +02:00
|
|
|
#define BCM2835_SYSTIMER_COUNT 4
|
|
|
|
|
2020-10-10 22:37:08 +02:00
|
|
|
typedef struct {
|
|
|
|
unsigned id;
|
|
|
|
QEMUTimer timer;
|
|
|
|
qemu_irq irq;
|
|
|
|
BCM2835SystemTimerState *state;
|
|
|
|
} BCM2835SystemTimerCompare;
|
|
|
|
|
2020-09-03 22:43:22 +02:00
|
|
|
struct BCM2835SystemTimerState {
|
2019-10-20 01:47:02 +02:00
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice parent_obj;
|
|
|
|
|
|
|
|
/*< public >*/
|
|
|
|
MemoryRegion iomem;
|
|
|
|
struct {
|
2020-10-10 22:37:07 +02:00
|
|
|
uint32_t ctrl_status;
|
2020-10-10 22:37:06 +02:00
|
|
|
uint32_t compare[BCM2835_SYSTIMER_COUNT];
|
2019-10-20 01:47:02 +02:00
|
|
|
} reg;
|
2020-10-10 22:37:08 +02:00
|
|
|
BCM2835SystemTimerCompare tmr[BCM2835_SYSTIMER_COUNT];
|
2020-09-03 22:43:22 +02:00
|
|
|
};
|
2019-10-20 01:47:02 +02:00
|
|
|
|
|
|
|
#endif
|