2016-01-29 23:50:41 +01:00
|
|
|
/*
|
|
|
|
* Raspberry Pi emulation (c) 2012 Gregory Estrade
|
|
|
|
* Upstreaming code cleanup [including bcm2835_*] (c) 2013 Jan Petrous
|
|
|
|
*
|
|
|
|
* Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft
|
|
|
|
* Written by Andrew Baumann
|
|
|
|
*
|
2019-03-15 12:12:28 +01:00
|
|
|
* ARM Local Timer IRQ Copyright (c) 2019. Zoltán Baldaszti
|
|
|
|
* Added basic IRQ_TIMER interrupt support
|
|
|
|
*
|
2020-03-23 18:22:30 +01:00
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
2016-01-29 23:50:41 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BCM2836_CONTROL_H
|
|
|
|
#define BCM2836_CONTROL_H
|
|
|
|
|
|
|
|
#include "hw/sysbus.h"
|
2019-03-15 12:12:28 +01:00
|
|
|
#include "qemu/timer.h"
|
2020-09-03 22:43:22 +02:00
|
|
|
#include "qom/object.h"
|
2016-01-29 23:50:41 +01:00
|
|
|
|
|
|
|
/* 4 mailboxes per core, for 16 total */
|
|
|
|
#define BCM2836_NCORES 4
|
|
|
|
#define BCM2836_MBPERCORE 4
|
|
|
|
|
|
|
|
#define TYPE_BCM2836_CONTROL "bcm2836-control"
|
2020-09-03 22:43:22 +02:00
|
|
|
typedef struct BCM2836ControlState BCM2836ControlState;
|
2020-08-31 23:07:33 +02:00
|
|
|
DECLARE_INSTANCE_CHECKER(BCM2836ControlState, BCM2836_CONTROL,
|
|
|
|
TYPE_BCM2836_CONTROL)
|
2016-01-29 23:50:41 +01:00
|
|
|
|
2020-09-03 22:43:22 +02:00
|
|
|
struct BCM2836ControlState {
|
2016-01-29 23:50:41 +01:00
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice busdev;
|
|
|
|
/*< public >*/
|
|
|
|
MemoryRegion iomem;
|
|
|
|
|
|
|
|
/* mailbox state */
|
|
|
|
uint32_t mailboxes[BCM2836_NCORES * BCM2836_MBPERCORE];
|
|
|
|
|
|
|
|
/* interrupt routing/control registers */
|
|
|
|
uint8_t route_gpu_irq, route_gpu_fiq;
|
|
|
|
uint32_t timercontrol[BCM2836_NCORES];
|
|
|
|
uint32_t mailboxcontrol[BCM2836_NCORES];
|
|
|
|
|
|
|
|
/* interrupt status regs (derived from input pins; not visible to user) */
|
|
|
|
bool gpu_irq, gpu_fiq;
|
|
|
|
uint8_t timerirqs[BCM2836_NCORES];
|
|
|
|
|
2019-03-15 12:12:28 +01:00
|
|
|
/* local timer */
|
|
|
|
QEMUTimer timer;
|
|
|
|
uint32_t local_timer_control;
|
|
|
|
uint8_t route_localtimer;
|
|
|
|
|
2016-01-29 23:50:41 +01:00
|
|
|
/* interrupt source registers, post-routing (also input-derived; visible) */
|
|
|
|
uint32_t irqsrc[BCM2836_NCORES];
|
|
|
|
uint32_t fiqsrc[BCM2836_NCORES];
|
|
|
|
|
|
|
|
/* outputs to CPU cores */
|
|
|
|
qemu_irq irq[BCM2836_NCORES];
|
|
|
|
qemu_irq fiq[BCM2836_NCORES];
|
2020-09-03 22:43:22 +02:00
|
|
|
};
|
2016-01-29 23:50:41 +01:00
|
|
|
|
|
|
|
#endif
|