mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-03-04 09:04:39 -07:00
hw/timer/bcm2835: Add the BCM2835 SYS_timer
Add the 64-bit free running timer. Do not model the COMPARE register (no IRQ generated). This timer is used by Linux kernel and recently U-Boot: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clocksource/bcm2835_timer.c?h=v3.7 https://github.com/u-boot/u-boot/blob/v2019.07/include/configs/rpi.h#L19 Datasheet used: https://www.raspberrypi.org/app/uploads/2012/02/BCM2835-ARM-Peripherals.pdf Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-id: 20191019234715.25750-4-f4bug@amsat.org [PMM: squashed in switch to using memset in reset] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
d442d95f2f
commit
d05be883fc
4 changed files with 202 additions and 0 deletions
33
include/hw/timer/bcm2835_systmr.h
Normal file
33
include/hw/timer/bcm2835_systmr.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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"
|
||||
|
||||
#define TYPE_BCM2835_SYSTIMER "bcm2835-sys-timer"
|
||||
#define BCM2835_SYSTIMER(obj) \
|
||||
OBJECT_CHECK(BCM2835SystemTimerState, (obj), TYPE_BCM2835_SYSTIMER)
|
||||
|
||||
typedef struct {
|
||||
/*< private >*/
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
/*< public >*/
|
||||
MemoryRegion iomem;
|
||||
qemu_irq irq;
|
||||
|
||||
struct {
|
||||
uint32_t status;
|
||||
uint32_t compare[4];
|
||||
} reg;
|
||||
} BCM2835SystemTimerState;
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue