class Sp804(AmbaPioDevice):
type = 'Sp804'
cxx_header = "dev/arm/timer_sp804.hh"
- gic = Param.BaseGic(Parent.any, "Gic to use for interrupting")
- int_num0 = Param.UInt32("Interrupt number that connects to GIC")
+ int0 = Param.ArmSPI("Interrupt that connects to GIC")
clock0 = Param.Clock('1MHz', "Clock speed of the input")
- int_num1 = Param.UInt32("Interrupt number that connects to GIC")
+ int1 = Param.ArmSPI("Interrupt that connects to GIC")
clock1 = Param.Clock('1MHz', "Clock speed of the input")
amba_id = 0x00141804
int_virt=ArmPPI(num=27),
int_hyp=ArmPPI(num=26))
- timer0 = Sp804(int_num0=34, int_num1=34, pio_addr=0x1C110000, clock0='1MHz', clock1='1MHz')
- timer1 = Sp804(int_num0=35, int_num1=35, pio_addr=0x1C120000, clock0='1MHz', clock1='1MHz')
+ timer0 = Sp804(int0=ArmSPI(num=34), int1=ArmSPI(num=34),
+ pio_addr=0x1C110000, clock0='1MHz', clock1='1MHz')
+ timer1 = Sp804(int0=ArmSPI(num=35), int1=ArmSPI(num=35),
+ pio_addr=0x1C120000, clock0='1MHz', clock1='1MHz')
clcd = Pl111(pio_addr=0x1c1f0000, interrupt=ArmSPI(num=46))
kmi0 = Pl050(pio_addr=0x1c060000, interrupt=ArmSPI(num=44),
ps2=PS2Keyboard())
#include "mem/packet_access.hh"
Sp804::Sp804(Params *p)
- : AmbaPioDevice(p, 0x1000), gic(p->gic),
- timer0(name() + ".timer0", this, p->int_num0, p->clock0),
- timer1(name() + ".timer1", this, p->int_num1, p->clock1)
+ : AmbaPioDevice(p, 0x1000),
+ timer0(name() + ".timer0", this, p->int0->get(), p->clock0),
+ timer1(name() + ".timer1", this, p->int1->get(), p->clock1)
{
}
-Sp804::Timer::Timer(std::string __name, Sp804 *_parent, int int_num, Tick _clock)
- : _name(__name), parent(_parent), intNum(int_num), clock(_clock), control(0x20),
+Sp804::Timer::Timer(std::string __name, Sp804 *_parent,
+ ArmInterruptPin *_interrupt, Tick _clock)
+ : _name(__name), parent(_parent), interrupt(_interrupt),
+ clock(_clock), control(0x20),
rawInt(false), pendingInt(false), loadValue(0xffffffff),
zeroEvent([this]{ counterAtZero(); }, name())
{
if (pendingInt) {
pendingInt = false;
DPRINTF(Timer, "Clearing interrupt\n");
- parent->gic->clearInt(intNum);
+ interrupt->clear();
}
break;
case BGLoad:
pendingInt = true;
if (pendingInt && !old_pending) {
DPRINTF(Timer, "-- Causing interrupt\n");
- parent->gic->sendInt(intNum);
+ interrupt->raise();
}
if (control.oneShot)
/** Pointer to parent class */
Sp804 *parent;
- /** Number of interrupt to cause/clear */
- const uint32_t intNum;
+ /** Pointer to the interrupt pin */
+ ArmInterruptPin * const interrupt;
/** Number of ticks in a clock input */
const Tick clock;
* @param val the value to start at (pre-16 bit masking if en) */
void restartCounter(uint32_t val);
- Timer(std::string __name, Sp804 *parent, int int_num, Tick clock);
+ Timer(std::string __name, Sp804 *parent, ArmInterruptPin *_interrupt,
+ Tick clock);
std::string name() const { return _name; }
void unserialize(CheckpointIn &cp) override;
};
- /** Pointer to the GIC for causing an interrupt */
- BaseGic *gic;
-
/** Timers that do the actual work */
Timer timer0;
Timer timer1;