diff --git a/src/Emulator/Main/Peripherals/GPIOPort/GPIOInterruptManager.cs b/src/Emulator/Main/Peripherals/GPIOPort/GPIOInterruptManager.cs index 6c4942670..cd4448061 100644 --- a/src/Emulator/Main/Peripherals/GPIOPort/GPIOInterruptManager.cs +++ b/src/Emulator/Main/Peripherals/GPIOPort/GPIOInterruptManager.cs @@ -67,18 +67,26 @@ public void RefreshInterrupts() switch(InterruptType[i]) { case InterruptTrigger.ActiveHigh: - if(underlyingState[i]) + if(DeassertActiveInterruptTrigger) { - irqState |= !InterruptMask[i]; - activeInterrupts[i] = true; + activeInterrupts[i] = underlyingState[i]; } + else + { + activeInterrupts[i] |= underlyingState[i]; + } + irqState |= activeInterrupts[i] && !InterruptMask[i]; break; case InterruptTrigger.ActiveLow: - if(!underlyingState[i]) + if(DeassertActiveInterruptTrigger) { - irqState |= !InterruptMask[i]; - activeInterrupts[i] = true; + activeInterrupts[i] = !underlyingState[i]; + } + else + { + activeInterrupts[i] |= !underlyingState[i]; } + irqState |= activeInterrupts[i] && !InterruptMask[i]; break; case InterruptTrigger.RisingEdge: if(isEdge && underlyingState[i]) @@ -114,6 +122,8 @@ public void RefreshInterrupts() } } + public bool DeassertActiveInterruptTrigger { get; set; } + public IArray InterruptEnable { get { return interruptEnable; } } public IArray InterruptType { get { return interruptType; } }