/*
- * Copyright (c) 2010 ARM Limited
+ * Copyright (c) 2010, 2017 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
Pl050::Pl050(const Params *p)
: AmbaIntDevice(p, 0xfff), control(0), status(0x43), clkdiv(0),
- interrupts(0), rawInterrupts(0), ackNext(false), shiftDown(false),
+ rawInterrupts(0), ackNext(false), shiftDown(false),
vnc(p->vnc), driverInitialized(false), intEvent(this)
{
if (vnc) {
data = clkdiv;
break;
case kmiISR:
- data = interrupts;
- DPRINTF(Pl050, "Read Interrupts: %#x\n", (uint32_t)interrupts);
+ data = getInterrupt();
+ DPRINTF(Pl050, "Read Interrupts: %#x\n", getInterrupt());
break;
default:
if (readId(pkt, ambaId, pioAddr)) {
void
Pl050::updateIntStatus()
{
+ const bool old_interrupt(getInterrupt());
+
if (!rxQueue.empty())
rawInterrupts.rx = 1;
else
rawInterrupts.rx = 0;
- interrupts.tx = rawInterrupts.tx & control.txint_enable;
- interrupts.rx = rawInterrupts.rx & control.rxint_enable;
-
- DPRINTF(Pl050, "rawInterupts=%#x control=%#x interrupts=%#x\n",
- (uint32_t)rawInterrupts, (uint32_t)control, (uint32_t)interrupts);
-
- if (interrupts && !intEvent.scheduled())
+ if ((!old_interrupt && getInterrupt()) && !intEvent.scheduled()) {
schedule(intEvent, curTick() + intDelay);
+ } else if (old_interrupt && !(getInterrupt())) {
+ gic->clearInt(intNum);
+ }
}
void
Pl050::generateInterrupt()
{
+ DPRINTF(Pl050, "Generate Interrupt: rawInt=%#x ctrl=%#x int=%#x\n",
+ rawInterrupts, control, getInterrupt());
- if (interrupts) {
+ if (getInterrupt()) {
gic->sendInt(intNum);
- DPRINTF(Pl050, "Generated interrupt\n");
+ DPRINTF(Pl050, " -- Generated\n");
}
}
SERIALIZE_SCALAR(stsreg);
SERIALIZE_SCALAR(clkdiv);
- uint8_t ints = interrupts;
- SERIALIZE_SCALAR(ints);
-
uint8_t raw_ints = rawInterrupts;
SERIALIZE_SCALAR(raw_ints);
UNSERIALIZE_SCALAR(clkdiv);
- uint8_t ints;
- UNSERIALIZE_SCALAR(ints);
- interrupts = ints;
-
uint8_t raw_ints;
UNSERIALIZE_SCALAR(raw_ints);
rawInterrupts = raw_ints;
/*
- * Copyright (c) 2010 ARM Limited
+ * Copyright (c) 2010, 2017 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
Bitfield<1> tx;
EndBitUnion(InterruptReg)
- /** interrupt status register. */
- InterruptReg interrupts;
-
/** raw interrupt register (unmasked) */
InterruptReg rawInterrupts;
/** Function to generate interrupt */
void generateInterrupt();
+ /** Get interrupt value */
+ InterruptReg getInterrupt() const {
+ InterruptReg tmp_interrupt(0);
+ tmp_interrupt.tx = rawInterrupts.tx & control.txint_enable;
+ tmp_interrupt.rx = rawInterrupts.rx & control.rxint_enable;
+ return tmp_interrupt;
+ }
/** Wrapper to create an event out of the thing */
EventWrapper<Pl050, &Pl050::generateInterrupt> intEvent;