public void TriggerIRQ() { if (_i == 0) { _interrupt = Interrupts.IRQ; } }
/* * SessionLive - Initialize the Content view when a session is being resume. * @param databaseAccess - The database. */ public SessionLive(Database_Controller databaseAccess) { InitializeComponent(); RefreshTime(); database = databaseAccess; current = database.GetliveSession(); selected_project = database.GetOneProject(current.project); selected_task = database.GetOneTask(current.taskId); this.Task_Name.Text = selected_task.name; this.Project_Name.Text = selected_project.name; interrupt = database.GetliveInterrupt(); if (!Resolver.IsSet) { var container = new SimpleContainer(); container.Register <IAccelerometer, Accelerometer>(); Resolver.SetResolver(container.GetResolver()); } GlobalUtilities.accelerometer = Resolver.Resolve <IAccelerometer>(); GlobalUtilities.accelerometer.Interval = AccelerometerInterval.Normal; if (interrupt is null) { Start.Text = "Pause"; getlocation = true; askLocation(); accelometeractive = true; GlobalUtilities.accelerometer.ReadingAvailable += Accelerometer_ReadingAvailable; } else { Start.Text = "Resume"; getlocation = false; askLocation(); } }
internal override bool InitGDBStub() { /* The gdb stub is predominantly interrupt driven - it is entered by: * * A #DB exception (INT 1) * A #BP exception (INT 3) */ /* Set up the COM port */ // COM2 base port is 0x2f8 libsupcs.IoOperations.PortOut((ushort)(com2 + 1), (byte)0); // Disable interrupts libsupcs.IoOperations.PortOut((ushort)(com2 + 3), (byte)0x80); // Set DLAB bit to allow us to set the baud rate libsupcs.IoOperations.PortOut((ushort)(com2 + 0), (byte)0x03); // Set divisor to 3 (baud = 115200 / 3 = 38400), low byte libsupcs.IoOperations.PortOut((ushort)(com2 + 1), (byte)0); // Divisor high byte libsupcs.IoOperations.PortOut((ushort)(com2 + 3), (byte)0x3); // 8 data bits, no parity bit, 1 stop bit, clear DLAB libsupcs.IoOperations.PortOut((ushort)(com2 + 2), (byte)0xc7); // Enable and clear the FIFOs libsupcs.IoOperations.PortOut((ushort)(com2 + 4), (byte)0x0b); // Enable IRQs, set RTS/DSR /* Register interrupt handlers */ unsafe { Interrupts.InstallHandler(1, new Interrupts.ISR(GDB_DB_handler)); Interrupts.InstallHandler(3, new Interrupts.ISR(GDB_BP_handler)); } return(true); }
private void UpdateRegister(Interrupts interrupt, bool value) { var register = _mmu.ReadByte(MemorySchema.INTERRUPT_REQUEST_REGISTER); Helpers.SetBit(ref register, (int)interrupt, value); _mmu.WriteByte(register, MemorySchema.INTERRUPT_REQUEST_REGISTER); }
public override void Reset() { base.Reset(); machineInterrupts = new Interrupts(); supervisorInterrupts = new Interrupts(); dCacheInfo = 0; }
protected override void PrivilegedExecute() { if (IsReadInstruction) { switch (ReadOpCode) { case MemoryManagementReadOpCode.CINT: CINT(); break; case MemoryManagementReadOpCode.RDF: RDF(); break; case MemoryManagementReadOpCode.RIB: RIB(); break; case MemoryManagementReadOpCode.RIF: RIF(); break; case MemoryManagementReadOpCode.RMF: RMF(); break; case MemoryManagementReadOpCode.SINT: SINT(); break; case MemoryManagementReadOpCode.CUF: CUF(); break; case MemoryManagementReadOpCode.SUF: SUF(); break; default: throw new NotImplementedException(); } } else { if (ChangeOpCodes.HasFlag(MemoryManagementChangeOpCodes.CDF)) { Register.DF.SetDF(Data >> 3); } if (ChangeOpCodes.HasFlag(MemoryManagementChangeOpCodes.CIF)) { Register.IB.SetIB(Data >> 3); Interrupts.Inhibit(); } } }
private void SKON() { if (Interrupts.Enabled) { Register.PC.Increment(); } Interrupts.Disable(); }
/* * OnSelection - display information for the select interrupt. */ void OnSelection(object sender, ItemTappedEventArgs e) { OverlayInterrupts.IsVisible = true; Interrupt_List.IsVisible = false; Interrupts temp_interrupt = (Interrupts)e.Item; TimeStartI.Text = "Start Time: " + temp_interrupt.start.ToString(); TimeEndI.Text = "End Time: " + temp_interrupt.start.ToString(); ReasonI.Text = "Reason: " + temp_interrupt.reason; }
private bool CheckInterrupt(Interrupts interrupt) { bool result = false; if ((i2cn_if & (uint)(1 << (int)interrupt)) == (uint)(1 << (int)interrupt)) { result = true; } return(result); }
private void RMF() { var sf = Register.SF; Register.IB.SetIB(sf.IF); Register.DF.SetDF(sf.DF); Register.UB.SetUB(sf.UF); Interrupts.Inhibit(); }
public override void Reset() { base.Reset(); dCacheInfo = 0; if (builtInIrqController) { machineInterrupts = new Interrupts(); supervisorInterrupts = new Interrupts(); } }
public Serial(COMPorts port, DataBits dataBits, ParityBits parityBits, StopBits stopBits, BaudRates baudRate, Interrupts interrupts) { this.port = port; this.dataBits = dataBits; this.parityBits = parityBits; this.stopBits = stopBits; this.baudRate = baudRate; this.interrupts = interrupts; Init(); }
public void RequestInterrupt(Interrupts interrupt) { UpdateRegister(interrupt, true); var register = _mmu.ReadByte(MemorySchema.INTERRUPT_REQUEST_REGISTER); var enabled = _mmu.ReadByte(MemorySchema.INTERRUPT_ENABLE_REGISTER_START); if (Helpers.TestBit(register, (int)interrupt) && Helpers.TestBit(enabled, (int)interrupt) && Halted) { Halted = false; } }
/* * askLocation - View session live for more details. */ private async void askLocation() { await Task.Delay(100).ContinueWith(async(arg) => { Task.Delay(GlobalUtilities.locationTime).Wait(); while (getlocation) { gettingLocation = true; var change = GetLocation(); change.Wait(); bool realChange = change.Result; if (!realChange) { getlocation = false; interrupt = new Interrupts(); interrupt.reason = "Change location"; DateTime toBeClonedDateTime = DateTime.Now; interrupt.start = toBeClonedDateTime; var answer = Task.FromResult(false); bool realAnwser = false; RunningInfo info = database.getRunningInfo(1); if (info.background) { info.notificationNeeded = true; database.UpdateRunningInfo(info); } Device.BeginInvokeOnMainThread( async() => { realAnwser = await DisplayAlert("Location Change", "Hey there your location change, are you still working?", "Yes.", "No, pause."); if (!realAnwser) { interrupt.Id = database.SaveInterrupt(interrupt); getlocation = false; } else { getlocation = true; } gettingLocation = false; }); } else { gettingLocation = false; } while (gettingLocation) { ; } Task.Delay(GlobalUtilities.locationTime).Wait(); } }); }
/* * StartButtonClicked - Method that start, pauses and resumes a session. */ void StartButtonClicked(object sender, EventArgs args) { if (Start.Text.CompareTo("Start") == 0) { Session new_session = new Session(); DateTime toBeClonedDateTime = DateTime.Now; DateTime initial = toBeClonedDateTime; new_session.start = initial; new_session.end = null; new_session.project = selected_project.Id; new_session.taskId = selected_task.Id; int id = database.SaveSession(new_session); new_session.Id = id; current = new_session; Start.Text = "Pause"; getlocation = true; askLocation(); //Timer_Counter.Text = "Session is live"; accelometeractive = true; GlobalUtilities.accelerometer.ReadingAvailable += Accelerometer_ReadingAvailable; RefreshTime(); } else if (Start.Text.CompareTo("Pause") == 0) { accelometeractive = false; GlobalUtilities.accelerometer.ReadingAvailable -= Accelerometer_ReadingAvailable; getlocation = false; Start.Text = "Resume"; if (database.GetliveInterrupt() is null) { interrupt = new Interrupts(); interrupt.reason = "User reason"; DateTime toBeClonedDateTime = DateTime.Now; interrupt.start = toBeClonedDateTime; interrupt.sessionId = current.Id; interrupt.Id = database.SaveInterrupt(interrupt); } Timer_Counter.Text = "Session is paused"; } else if (Start.Text.CompareTo("Resume") == 0) { Start.Text = "Pause"; interrupt = database.GetliveInterrupt(); DateTime toBeClonedDateTime = DateTime.Now; interrupt.end = toBeClonedDateTime; database.UpdateInterrupt(interrupt); getlocation = true; Timer_Counter.Text = "Session is live"; accelometeractive = true; GlobalUtilities.accelerometer.ReadingAvailable += Accelerometer_ReadingAvailable; } }
private void RTF() { var acc = Register.AC.Accumulator; Register.AC.SetLink((acc >> 11) & Masks.FLAG); Register.IB.SetIB(acc >> 3); Register.DF.SetDF(acc); Register.UB.SetUB(acc >> 6); Interrupts.Enable(false); Interrupts.Inhibit(); }
public override void Execute() { if (OpCode == MemoryReferenceOpCode.JMP || OpCode == MemoryReferenceOpCode.JMS) { if (Interrupts.Inhibited) { Interrupts.Allow(); Register.PC.SetIF(Register.IB.Data); Register.UF.SetUF(Register.UB.Data); } var operand = Indirect ? Field | Memory.Read(Location, true) : Location; switch (OpCode) { case MemoryReferenceOpCode.JMS: JMS(operand); break; case MemoryReferenceOpCode.JMP: JMP(operand); break; default: throw new NotImplementedException(); } } else { var operand = Indirect ? (Register.DF.Data << 12) | Memory.Read(Location, true) : Location; switch (OpCode) { case MemoryReferenceOpCode.AND: AND(operand); break; case MemoryReferenceOpCode.TAD: TAD(operand); break; case MemoryReferenceOpCode.ISZ: ISZ(operand); break; case MemoryReferenceOpCode.DCA: DCA(operand); break; default: throw new NotImplementedException(); } } }
/* UpdateInterrupt - Update a specific interrupt. * @param interrupt - interrupt to be updated. */ public void UpdateInterrupt(Interrupts interrupt) { lock (locker) { if (database.Table <Session>().Count() == 0) { return; } else { database.Update(interrupt); } } }
/* * OnAppearing - Get live session. */ protected override void OnAppearing() { live = database.GetliveSession(); if (live != null) { interrupt = database.GetliveInterrupt(); if (interrupt is null) { getlocation = true; askLocation(); accelometeractive = true; GlobalUtilities.accelerometer.ReadingAvailable += Accelerometer_ReadingAvailable; } } }
public void AddInterrupt(long i, object[] args) { if (!Interrupts.Contains(i)) { if (args == null) { InterruptArgs[i] = new object[] { i } } ; else { InterruptArgs[i] = (new object[] { i }).Concat(args).ToArray(); } Interrupts.Enqueue(i); } }
private bool Interrupt_IsFault(Interrupts interrupt) { switch (interrupt) { case Interrupts.DivZeroFault: case Interrupts.DoubleFault: case Interrupts.StackFault: case Interrupts.SegFault: case Interrupts.UnPrivFault: case Interrupts.UndefFault: return(true); default: return(false); } }
public override void Execute() { if (Register.UF.Data == 0) // Executive mode { if (Interrupts.UserRequested) { //Interrupts.ClearUser(); } PrivilegedExecute(); } else // User mode { Interrupts.SetUser(); } }
public string CreateDataString() { return(m_Data.I.UnitID + " " + (m_Data.I.Dmg == 0 ? "" : m_Data.I.Dmg.ToString()) + " " + (m_Data.I.EffHeal == 0 ? "" : m_Data.I.EffHeal.ToString()) + " " + (m_Data.I.DmgTaken == 0 ? "" : m_Data.I.DmgTaken.ToString()) + " " + (m_Data.I.OverHeal == 0 ? "" : m_Data.I.OverHeal.ToString()) + " " + (m_Data.I.Death == 0 ? "" : m_Data.I.Death.ToString()) + " " + (FriendlyDmg == 0 ? "" : FriendlyDmg.ToString()) + " " + (m_Data.I.Decurse == 0 ? "" : m_Data.I.Decurse.ToString()) + " " + (CCBreaks == 0 ? "" : CCBreaks.ToString()) + " " + (Interrupts == 0 ? "" : Interrupts.ToString()) + " " + (Dispelled == 0 ? "" : Dispelled.ToString()) + " " + (m_Data.I.EffHealRecv == 0 ? "" : m_Data.I.EffHealRecv.ToString()) + " " + (m_Data.I.OverHealRecv == 0 ? "" : m_Data.I.OverHealRecv.ToString()) + " " + (m_Data.I.ThreatValue == 0 ? "" : m_Data.I.ThreatValue.ToString())); }
/* * PauseButtonClicked - Stops a session. */ void PauseButtonClicked(object sender, EventArgs args) { if (preventMovement()) { current.end = DateTime.Now; database.UpdateSession(current); if (Start.Text.CompareTo("Resume") == 0) { interrupt = database.GetliveInterrupt(); DateTime toBeClonedDateTime = DateTime.Now; interrupt.end = toBeClonedDateTime; database.UpdateInterrupt(interrupt); } getlocation = false; Navigation.PopModalAsync(); } }
private void DockingManager_Loaded(object sender, RoutedEventArgs e) { List <LayoutAnchorable> docks = new List <LayoutAnchorable>(); docks.Add(Background); docks.Add(Breakpoints); docks.Add(CPU); //docks.Add(DisplayTiming); docks.Add(Interrupts); docks.Add(InstructionHistogram); docks.Add(IORegisters); docks.Add(Memory); docks.Add(MemoryImage); //docks.Add(SoundChannelInternals); //docks.Add(Spectogram); docks.Add(SpriteLayer); //docks.Add(Sprites); docks.Add(SoundRecording); docks.Add(TileMap); docks.Add(Window); foreach (LayoutAnchorable dock in docks) { dock.AutoHideWidth = 500; dock.FloatingWidth = 500; } Background.ToggleAutoHide(); Breakpoints.ToggleAutoHide(); CPU.ToggleAutoHide(); //DisplayTiming.ToggleAutoHide(); Interrupts.ToggleAutoHide(); InstructionHistogram.ToggleAutoHide(); IORegisters.ToggleAutoHide(); Memory.ToggleAutoHide(); MemoryImage.ToggleAutoHide(); //SoundChannelInternals.ToggleAutoHide(); //Spectogram.ToggleAutoHide(); SpriteLayer.ToggleAutoHide(); //Sprites.ToggleAutoHide(); SoundRecording.ToggleAutoHide(); TileMap.ToggleAutoHide(); Window.ToggleAutoHide(); }
private void Interrupt(Interrupts interrupt, ushort? errorCode = null) { // !!! Must handle stack_values // If this is not a reset interrupt, we should save PS and PC. if (interrupt != Interrupts.Reset) { ushort ps = PS; if (Interrupt_IsFault(interrupt)) PS_U = !PS_S; PS_S = true; PS_I = true; PS_Q = interrupt == Interrupts.HWI; StackPush(0xffff, ps); StackPush(0xffff, PC); if (errorCode != null) StackPush(0xffff, errorCode.Value); } PC = ReadMemInt16((ushort)((ushort)interrupt * 2), SegmentIndex.IS); Cycles += 7; }
/* * OnAppearing - Get live session, calculates the engage time and estimation time for the project. */ protected override void OnAppearing() { overlay.IsVisible = false; Tasks_List.IsVisible = true; View_Sessions.IsVisible = true; Delete_Project.IsVisible = true; tapped = null; live = database.GetliveSession(); Estimation_Time.Text = "Estimation: "; Engage_Time.Text = "Time spend: "; double auxEstimation = GetEstimation(selectedProject); double auxSpend = GetEngageTime(selectedProject); Estimation_Time.Text += TimeSpan.FromMinutes(Math.Round(auxEstimation, 3)).ToString(); Engage_Time.Text += TimeSpan.FromMinutes(Math.Round(auxSpend, 3)).ToString(); if (auxEstimation < auxSpend) { Engage_Time.BackgroundColor = Color.Red; } else { Engage_Time.BackgroundColor = Color.Green; } if (live != null) { Resume_Session.IsVisible = true; LiveSession = true; interrupt = database.GetliveInterrupt(); if (interrupt is null) { getlocation = true; askLocation(); accelometeractive = true; GlobalUtilities.accelerometer.ReadingAvailable += Accelerometer_ReadingAvailable; } } else { Resume_Session.IsVisible = false; LiveSession = false; } }
/* SaveInterrupt - Insert interrupts into the database. * @param interrupts - The interrupts. * @return - Autoincrement Id of the Interrupts. */ public int SaveInterrupt(Interrupts interrupts) { lock (locker) { try { database.Insert(interrupts); SQLiteCommand cmd = database.CreateCommand("SELECT last_insert_rowid()"); cmd.CommandText = "SELECT last_insert_rowid()"; Int64 LastRowID64 = cmd.ExecuteScalar <Int64>(); int LastRowID = (int)LastRowID64; return(LastRowID); } catch (Exception e) { database.Update(interrupts); return(interrupts.Id); } } }
/* * OnAppearing - Overrride to the screen appearing, refresh the project list, * gets the live session. */ protected override void OnAppearing() { user.projects = database.GetProjectUser(user.Id); list.Clear(); if (!Resolver.IsSet) { var container = new SimpleContainer(); container.Register <IAccelerometer, Accelerometer>(); Resolver.SetResolver(container.GetResolver()); } GlobalUtilities.accelerometer = Resolver.Resolve <IAccelerometer>(); GlobalUtilities.accelerometer.Interval = AccelerometerInterval.Normal; if (user.projects != null) { foreach (var ProjectTemp in user.projects) { ProjectTemp.tasks = database.GetTaskOfProjects(ProjectTemp.Id); list.Add(ProjectTemp); } } Proyects.ItemTemplate = new DataTemplate(typeof(Objects)); Proyects.ItemsSource = list; live = database.GetliveSession(); if (live != null) { Resume_Session.IsVisible = true; interrupt = database.GetliveInterrupt(); if (interrupt is null) { getlocation = true; askLocation(); accelometeractive = true; GlobalUtilities.accelerometer.ReadingAvailable += Accelerometer_ReadingAvailable; } } else { Resume_Session.IsVisible = false; } }
private Instruction InterruptHandler(Interrupts interrupt) { // Handle interrupt with a CALL instruction to the interrupt handler Instruction instruction = new Instruction(); instruction.OpCode = 0xCD; // CALL! byte lowOpcode = (byte)instruction.OpCode; instruction.Length = CPUInstructionLengths.Get(lowOpcode); instruction.Literal = this.interruptHandlers[(Interrupts)interrupt]; instruction.Ticks = CPUInstructionPreClocks.Get(lowOpcode); instruction.Name = CPUInstructionNames.Get(lowOpcode); instruction.Description = CPUInstructionDescriptions.Get(lowOpcode); // Disable interrupts during interrupt handling and clear the current one this._interruptController.InterruptMasterEnable = false; byte IF = this._memory.LowLevelRead((ushort)MMR.IF); IF &= (byte)~(byte)interrupt; this._memory.LowLevelWrite((ushort)MMR.IF, IF); return(instruction); }
private void Interrupt(Interrupts interrupt, ushort?errorCode = null) { // !!! Must handle stack_values // If this is not a reset interrupt, we should save PS and PC. if (interrupt != Interrupts.Reset) { ushort ps = PS; if (Interrupt_IsFault(interrupt)) { PS_U = !PS_S; } PS_S = true; PS_I = true; PS_Q = interrupt == Interrupts.HWI; StackPush(0xffff, ps); StackPush(0xffff, PC); if (errorCode != null) { StackPush(0xffff, errorCode.Value); } } PC = ReadMemInt16((ushort)((ushort)interrupt * 2), SegmentIndex.IS); Cycles += 7; }
private bool Interrupt_IsFault(Interrupts interrupt) { switch (interrupt) { case Interrupts.DivZeroFault: case Interrupts.DoubleFault: case Interrupts.StackFault: case Interrupts.SegFault: case Interrupts.UnPrivFault: case Interrupts.UndefFault: return true; default: return false; } }
private Instruction InterruptHandler(Interrupts interrupt) { // Handle interrupt with a CALL instruction to the interrupt handler Instruction instruction = new Instruction(); instruction.OpCode = 0xCD; // CALL! byte lowOpcode = (byte)instruction.OpCode; instruction.Length = CPUInstructionLengths.Get(lowOpcode); instruction.Literal = this.interruptHandlers[(Interrupts)interrupt]; instruction.Ticks = CPUInstructionPreClocks.Get(lowOpcode); instruction.Name = CPUInstructionNames.Get(lowOpcode); instruction.Description = CPUInstructionDescriptions.Get(lowOpcode); // Disable interrupts during interrupt handling and clear the current one this._interruptController.InterruptMasterEnable = false; byte IF = this._memory.LowLevelRead((ushort)MMR.IF); IF &= (byte)~(byte)interrupt; this._memory.LowLevelWrite((ushort)MMR.IF, IF); return instruction; }
public void SetInterruptBreakable(Interrupts interrupt, bool isBreakable) { _breakableInterrupts[interrupt] = isBreakable; }
/// <summary> /// Debugger. Handles the cpu.InterruptHappened event. /// </summary> private void InterruptHandler(Interrupts interrupt) { _state.InBreakpoint = true; Pause(); }
/// <summary> /// Enable/Disable device interrupts. /// </summary> /// <param name="interrupts">Specifies which device events should produce interrupts.</param> public void ConfigureInterrupts( Interrupts interrupts ) { // Enable Interrupts _deviceInterface.WriteRegister( DeviceRegisterAddress.InterruptEnable, (uint) interrupts ); }
public InterruptViewModel(string name, Interrupts interrupt, IGameBoy gameBoy) { _name = name; _interrupt = interrupt; _gameBoy = gameBoy; }
/// <summary> /// Set the interrupt flags for a given kind of interrupt. /// </summary> /// <param name="kind">An interrupt (or a combination of).</param> internal void SetInterrupt(Interrupts kind) { byte IF = this.memory.Read((ushort)MMR.IF); this.memory.Write((ushort)MMR.IF, (byte)(IF | (byte)kind)); }