/// <summary> Registers a handler for the given type of interrupt on this pin. </summary> public void RegisterInterruptHandler(EventHandler <InputInterrupt> Handler, InterruptType Type) { switch (Type) { case InterruptType.RISING_EDGE: { if (this.IntPortRise == null) { this.IntPortRise = new InterruptPortMM(IO.BeagleBone.Pin.PinToGPIO(this.Pin), InterruptMode.InterruptEdgeLevelHigh); this.IntPortRise.EnableInterrupt(); this.IntPortRise.OnInterrupt += this.InterruptRising; } this.RisingHandlers += Handler; return; } case InterruptType.FALLING_EDGE: { if (this.IntPortFall == null) { this.IntPortFall = new InterruptPortMM(IO.BeagleBone.Pin.PinToGPIO(this.Pin), InterruptMode.InterruptEdgeLevelLow); this.IntPortFall.EnableInterrupt(); this.IntPortFall.OnInterrupt += this.InterruptFalling; } this.FallingHandlers += Handler; return; } case InterruptType.ANY_EDGE: { if (this.IntPortAny == null) { this.IntPortAny = new InterruptPortMM(IO.BeagleBone.Pin.PinToGPIO(this.Pin), InterruptMode.InterruptEdgeBoth); this.IntPortAny.EnableInterrupt(); this.IntPortAny.OnInterrupt += this.InterruptAny; } this.AnyHandlers += Handler; return; } } }
/// <summary> /// Registers an interrupt handler for the specified interrupt type. /// </summary> public void RegisterInterruptHandler(EventHandler <InputInterrupt> Handler, InterruptType Type) { switch (Type) { case InterruptType.RISING_EDGE: { if (!this.RisingInit) { RaspberryPi.AddInterrupt(this.PinNumber, 2, this.InterruptRising); this.RisingInit = true; } this.RisingHandlers += Handler; return; } case InterruptType.FALLING_EDGE: { if (!this.FallingInit) { RaspberryPi.AddInterrupt(this.PinNumber, 1, this.InterruptFalling); this.FallingInit = true; } this.FallingHandlers += Handler; return; } case InterruptType.ANY_EDGE: { if (!this.AnyInit) { RaspberryPi.AddInterrupt(this.PinNumber, 3, this.InterruptAny); this.AnyInit = true; } this.AnyHandlers += Handler; return; } } }
private uint ReadStatusRegister(int number, InterruptType type) { var value = 0u; lock(interrupts) { for(var i = 0; i < 32; ++i) { var status = interrupts[32 * number + i]; if((status & InterruptStatus.Running) != 0 && GetInterruptType(i) == type) { value |= (1u << i); } } } return value; }
public bool InterruptPending(InterruptType interrupt) { return(InterruptEnabled(interrupt) && ((InterruptRequestFlags & (UInt32)interrupt) != 0)); }
bool InterruptEnabled(InterruptType interrupt) { return((InterruptEnableRegister.Value & (UInt32)interrupt) != 0); }
public void RequestInterrupt(InterruptType interrupt) { InterruptRequestFlags |= (ushort)interrupt; }
public abstract object SignalInterrupt(InterruptType interrupt, params object[] details);
// Выполняет одну инструкцию процессора public int Step() { // Нужно ли подождать несколько циклов if (Stall > 0) { Stall--; return(1); } var cycles = Cycles; // Проверяем нужно ли сделать прерывание switch (Interrupt) { case InterruptType.NMI: NMI(); break; case InterruptType.IRQ: IRQ(); break; } Interrupt = InterruptType.None; var opcode = Read(PC); AddressingMode mode = (AddressingMode)instructionModes[opcode]; UInt16 address = 0; bool pageCrossed = false; switch (mode) { case AddressingMode.Absolute: address = Read16((UInt16)(PC + 1)); break; case AddressingMode.AbsoluteX: address = (UInt16)(Read16((UInt16)(PC + 1)) + X); pageCrossed = PagesDiffer((UInt16)(address - X), address); break; case AddressingMode.AbsoluteY: address = (UInt16)(Read16((UInt16)(PC + 1)) + Y); break; case AddressingMode.Acculumator: address = 0; break; case AddressingMode.Immediate: address = (UInt16)(PC + 1); break; case AddressingMode.Implied: address = 0; break; case AddressingMode.IndexedIndirect: address = (UInt16)(Read16Bug((UInt16)(Read((UInt16)(PC + 1)))) + X); break; case AddressingMode.Indirect: address = (UInt16)(Read16Bug(Read16((UInt16)(PC + 1)))); break; case AddressingMode.IndirectIndexed: address = (UInt16)(Read16Bug((Read((UInt16)(PC + (1))))) + (UInt16)Y); pageCrossed = PagesDiffer((UInt16)(address - Y), address); break; case AddressingMode.Relative: var offset = (UInt16)(Read((UInt16)(PC + 1))); if (offset < 0x80) { address = (UInt16)(PC + 2 + offset); } else { address = (UInt16)(PC + 2 + offset - 0x100); } break; case AddressingMode.ZeroPage: address = Read((UInt16)(PC + 1)); break; case AddressingMode.ZeroPageX: address = (UInt16)(Read((UInt16)(PC + 1 + X)) & 0xff); break; case AddressingMode.ZeroPageY: address = (UInt16)(Read((UInt16)(PC + 1 + Y)) & 0xff); break; } PC += (UInt16)(instructionSizes[opcode]); Cycles += instructionCycles[opcode]; bool pagesCrossed = false; if (pagesCrossed) { Cycles += instructionPageCycles[opcode]; } var info = new StepInfo { Address = address, PC = PC, Mode = (byte)mode }; PrintInstruction(); table[opcode](info); return((int)(Cycles - cycles)); }
/// <summary> /// Request that an interrupt be flagged in [IF]. /// </summary> /// <param name="intType">The type of interrupt to flag.</param> public void RequestInterrupt(InterruptType intType) { IF |= (byte)intType; }
private void InternalSetInterrupt(InterruptType interrupt, bool value) { lock(irqSync) { if(value) { TlibSetPendingInterrupt((int)interrupt, 1); base.OnGPIO(0, true); return; } if(TlibSetPendingInterrupt((int)interrupt, 0) == 1) { base.OnGPIO(0, false); } } }
public void Interrupt(InterruptType type) { }
private void RaiseInterrupt(InterruptType type) { this._lastInterruptType = type; this._system.Cpu.Interrupt(this._interruptMessage); }
public void Reset() { this._interruptMessage = 0xffff; this._deviceFlags = DeviceFlagBits.NONE; this._lastInterruptType = InterruptType.NONE; this._currentOperation = OperationType.None; this._currentSector = 0; this._sectorsRemaining = 0; this._currentHeadSector = 0; this._currentMemoryAddress = 0x0000; }
public void ClearInterrupt(InterruptType type) => _interruptFlag &= ~(1 << type.Ordinal);
public void RequestInterrupt(InterruptType type) => _interruptFlag |= 1 << type.Ordinal;
/// <summary> /// Allow other modules to inform simEntity that it should interrupt the sub pulse process, and why. /// </summary> /// <param name="Type"></param> public void SetInterrupt(InterruptType Type) { Interrupt = true; TypeOfInterrupt = Type; }
/// <summary> /// Request that an interrupt be flagged in [IF]. /// </summary> /// <param name="intType">The type of interrupt to flag.</param> public void RequestInterrupt(InterruptType intType) { IF |= (byte)intType; }
public void PushLastInterrupt(InterruptType interruptType) { _lastInterrupt.Push(interruptType); }
public void TriggerNMI() { Interrupt = InterruptType.NMI; }
public void Interrupt(InterruptType interrupt) { _interruptType = interrupt; }
/// <summary> /// Non-maskable interrupt request /// </summary> public void NMI() { interruptRequested = InterruptType.NonMaskable; }
public void InterruptZ80(InterruptType interruptType) => this.IoAddresses.If.Value |= (byte)interruptType;