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