public override void AckIrq(byte irq) { DebugStub.Assert(Processor.InterruptsDisabled()); #if PIC_DEBUG DumpRegisters(); #endif // Mark the IRQ as activated and mask it #if DEBUG_INTERRUPTS DebugStub.WriteLine("Int{0:x2} Acked, Mask={3:x8}{2:x8}{1:x8}", __arglist(irq, irqMask0, irqMask1, irqMask2)); #endif // Quiet the interrupt controller. IoResult result = IoResult.Success; uint n = irq / 32u; uint bit = 1u << (irq % 32); if (n < intcps_isr_clear.Length) { intcps_isr_clear[n].Write32NoThrow(bit, ref result); } DebugStub.Assert(IoResult.Success == result); #if PIC_DEBUG DumpRegisters(); #endif }
public void Write32NoThrow(uint offset, uint value, ref IoResult result) { if (CheckWriteNoThrow(offset, 4, ref result)) { HalWrite32(offset, value); } }
public void Write16NoThrow(uint offset, ushort value, ref IoResult result) { if (CheckWriteNoThrow(offset, 2, ref result)) { HalWrite16(offset, value); } }
public IoResult Load(string fromPath, out IAppConfiguration configuration) { configuration = null; try { var serializer = _configurationFactory.CreateSerializerFor <AppConfiguration>(); using (var reader = _configurationFactory .CreateSerializationReaderFor(fromPath)) { configuration = (IAppConfiguration)serializer.Deserialize(reader); return(IoResult.ForSuccess()); } } catch (InvalidOperationException ex) when(ex.InnerException is XmlException) { return(IoResult.ForReadError(ex)); } catch (FileNotFoundException ex) { return(IoResult.ForNotFound(ex)); } catch (DirectoryNotFoundException ex) { return(IoResult.ForNotFound(ex)); } catch (Exception ex) { return(IoResult.ForException(ex)); } }
public void Write64NoThrow(uint offset, ulong value, ref IoResult result) { if (CheckWriteNoThrow(offset, 8, ref result)) { HalWrite64(offset, value); } }
protected void ShouldThrowImpl(IoResult result) { Invocation.Of(() => _configurationController.Load()) .Should() .Throw(result.Exception); }
private void Unmask(byte irq) { DebugStub.Assert(Processor.InterruptsDisabled()); uint n = irq / 32u; uint bit = 1u << (irq % 32); #if DEBUG_DISPATCH_IO DebugStub.WriteLine("PIC.Unmask({0}) => {1:x8}", __arglist(irq, bit)); #endif uint mask = GetMaskWord(n); if ((mask & bit) != 0) { #if DEBUG_DISPATCH_IO DebugStub.WriteLine("-- Unmask IRQs [{0}: old={1:x8} new={2:x8}", __arglist(n, mask, mask & ~bit)); #endif #if false // Enable this to set interrupt without hardware. IoResult result = IoResult.Success; intcps_mir_clear[n].Write32NoThrow(bit, ref result); intcps_isr_set[n].Write32NoThrow(bit, ref result); DebugStub.Assert(IoResult.Success == result); #endif SetMaskWord(n, mask & ~bit); #if PIC_DEBUG DumpBits("-- PIC interrupt mask: {2:x8}{1:x8}{0:x8}", intcps_mir); #endif } }
public void Write8NoThrow(uint offset, byte value, ref IoResult result) { if (CheckWriteNoThrow(offset, 1, ref result)) { HalWrite8(offset, value); } }
private void SetupProviderMockFor(IoResult result) { IAppConfiguration expected = _appConfigurationMock.Object; _configurationProviderMock.Setup(provider => provider.Create(It.IsAny <string>(), out expected)) .Returns(result); }
internal uint Read(IoMappedPort register) { uint outValue; IoResult result = register.Read32NoThrow(0, out outValue); DebugStub.Assert(IoResult.Success == result); return(outValue); }
internal uint Read(uint offset) { uint outValue; IoResult result = apicRegion.Read32NoThrow((int)offset, out outValue); DebugStub.Assert(IoResult.Success == result); return(outValue); }
private void DumpBits(String label, IoMappedPort[] regs) { IoResult result = IoResult.Success; uint v0 = regs[0].Read32NoThrow(ref result); uint v1 = regs[1].Read32NoThrow(ref result); uint v2 = regs[2].Read32NoThrow(ref result); DebugStub.WriteLine(label, __arglist(v0, v1, v2)); }
public IoResult Write64NoThrow(uint offset, ulong value) { IoResult check = CheckWriteNoThrow(offset, 8); if (IoResult.Success == check) { HalWrite64(offset, value); } return(check); }
public IoResult Write32NoThrow(uint offset, uint value) { IoResult check = CheckWriteNoThrow(offset, 4); if (IoResult.Success == check) { HalWrite32(offset, value); } return(check); }
public IoResult Write16NoThrow(uint offset, ushort value) { IoResult check = CheckWriteNoThrow(offset, 2); if (IoResult.Success == check) { HalWrite16(offset, value); } return(check); }
public IoResult Write8NoThrow(uint offset, byte value) { IoResult check = CheckWriteNoThrow(offset, 1); if (IoResult.Success == check) { HalWrite8(offset, value); } return(check); }
public void TestEmptyHistory() { var session = new ProcessSession(); Assert.AreEqual(null, session.LastCommand); var emptyIoResult = new IoResult[0]; Assert.AreEqual(emptyIoResult, session.RecentCommands); Assert.AreEqual(null, session.StatusLine); }
public IoResult Save(IAppConfiguration configuration, string toPath) { try { return(Save(_configurationFactory.ToXmlConfiguration(configuration), toPath)); } catch (Exception ex) { return(IoResult.ForException(ex)); } }
public byte Read8NoThrow(uint offset, ref IoResult result) { if (CheckReadNoThrow(offset, 1, ref result)) { return(HalRead8(offset)); } else { return(0); } }
public ushort Read16NoThrow(uint offset, ref IoResult result) { if (CheckReadNoThrow(offset, 2, ref result)) { return(HalRead16(offset)); } else { return(0); } }
public ulong Read64NoThrow(uint offset, ref IoResult result) { if (CheckReadNoThrow(offset, 8, ref result)) { return(HalRead64(offset)); } else { return(0); } }
public uint Read32NoThrow(uint offset, ref IoResult result) { if (CheckReadNoThrow(offset, 4, ref result)) { return(HalRead32(offset)); } else { return(0); } }
private void WriteRegister(uint offset, uint value) { RangeCheck(offset, RegisterLimit, "offset"); DebugStub.Assert(Processor.InterruptsDisabled()); IoResult result = ioRegSel.Write32NoThrow(0, offset); DebugStub.Assert(IoResult.Success == result); result = ioWin.Write32NoThrow((byte)0, value); DebugStub.Assert(IoResult.Success == result); }
internal void ClearInterrupt(uint timer) { if (timer <= MaxCounterIndex) { uint value; IoResult result = region.Read32NoThrow(0x20, out value); DebugStub.Assert(IoResult.Success == result); value = value & ~(1u << (int)timer); result = region.Write32NoThrow(0x20, value); DebugStub.Assert(IoResult.Success == result); } }
public override bool PutCharAt(char c, int column, int row) { if (column < 0 || column >= Columns || row < 0 || row >= Rows) { return(false); } int offset = (column + row * Columns) * 2; IoResult result = screenBuffer.Write16NoThrow(offset, (ushort)(color | c)); DebugStub.Assert(IoResult.Success == result); return(true); }
public unsafe IoResult Read32NoThrow(uint offset, out uint value) { IoResult check = CheckReadNoThrow(offset, 4); if (IoResult.Success == check) { value = HalReadInt32(port + offset); } else { value = 0; } return(check); }
public IoResult Read8NoThrow(uint offset, out byte value) { IoResult check = CheckReadNoThrow(offset, 1); if (IoResult.Success == check) { value = HalRead8(offset); } else { value = 0; } return(check); }
public IoResult Read16NoThrow(uint offset, out ushort value) { IoResult check = CheckReadNoThrow(offset, 2); if (IoResult.Success == check) { value = HalRead16(offset); } else { value = 0; } return(check); }
public IoResult Read64NoThrow(uint offset, out ulong value) { IoResult check = CheckReadNoThrow(offset, 8); if (IoResult.Success == check) { value = HalRead64(offset); } else { value = 0; } return(check); }
public IoResult Create(string atPath, out IAppConfiguration configuration) { try { var xmlConfiguration = _configurationFactory.CreateXmlConfiguration(); configuration = xmlConfiguration; return(Save(xmlConfiguration, atPath)); } catch (Exception ex) { configuration = null; return(IoResult.ForException(ex)); } }