// Constructor internal Timer8254LegacyPC(PnpConfig config, Pic pic) { #if VERBOSE Tracing.Log(Tracing.Debug, "Timer8254: create"); #endif // /pnp/08/02/01/PNP0100 0003 cfg dis : ISA 8254 Timer : AT Timer // IRQ mask=0001 type=47 // I/O Port inf=01 min=0040 max=0040 aln=01 len=04 0040..0043 this.config = config; this.pic = pic; this.irq = ((IoIrqRange)config.DynamicRanges[1]).Irq; IoPortRange ioPorts = (IoPortRange)config.DynamicRanges[0]; C0Port = ioPorts.PortAtOffset(i8254_C0, 1, Access.ReadWrite); C2Port = ioPorts.PortAtOffset(i8254_C2, 1, Access.ReadWrite); CWPort = ioPorts.PortAtOffset(i8254_CW, 1, Access.ReadWrite); // Enable Timer2 // Lower 2 bits of port 61 are described in: // The Indispensable PC Hardware Book (3rd Edition) p.724 ioPorts = (IoPortRange)config.FixedRanges[0]; IoPort p = ioPorts.PortAtOffset(0, 1, Access.ReadWrite); // // Also clear the NMI RAM parity error to enable the PCI card // to generate NMI if the button is depressed // p.Write8((byte)((p.Read8() & 0xf8) | 0x01)); }
public OperationRegionAccessor() { IoPortRange pciConfigPorts = new IoPortRange(PciAddressPort, 8, Access.ReadWrite); pciConfigAddressPort = pciConfigPorts.PortAtOffset(0, 4, Access.Write); pciConfigDataPort = pciConfigPorts.PortAtOffset(4, 4, Access.ReadWrite); }
// Constructor internal Timer8254Apic(PnpConfig config) { // /pnp/08/02/01/PNP0100 0003 cfg dis : ISA 8254 Timer : AT Timer // IRQ mask=0001 type=47 // I/O Port inf=01 min=0040 max=0040 aln=01 len=04 0040..0043 this.config = config; this.irq = ((IoIrqRange)config.DynamicRanges[1]).Irq; IoPortRange ioPorts = (IoPortRange)config.DynamicRanges[0]; C2Port = ioPorts.PortAtOffset(i8254_C2, 1, Access.ReadWrite); CWPort = ioPorts.PortAtOffset(i8254_CW, 1, Access.ReadWrite); // Use Timer2 as it's not connected as interrupt source. // // Lower 2 bits of port 61 are described in: // The Indispensable PC Hardware Book (3rd Edition) p.724 ioPorts = (IoPortRange)config.FixedRanges[0]; IoPort p = ioPorts.PortAtOffset(0, 1, Access.ReadWrite); // // Also clear the NMI RAM parity error to enable the PCI card // to generate NMI if the button is depressed // p.Write8((byte)((p.Read8() & 0xf8) | 0x01)); }
public static bool GetDynamicIoPortRange(uint range, out ushort port, out ushort size, out bool readable, out bool writable) { bool ret = false; port = 0; size = 0; readable = false; writable = false; IoConfig config = Thread.CurrentProcess.IoConfig; if (config != null && config.DynamicRanges.Length > range) { IoPortRange ipr = config.DynamicRanges[range] as IoPortRange; if (ipr != null) { port = ipr.Port; size = ipr.Size; readable = ipr.Readable; writable = ipr.Writable; ret = true; } } Tracing.Log(Tracing.Debug, "DeviceService.GetDynamicIoPortRange(range={0}, out port={1:x4}, out size={2})", range, port, size); return(ret); }
public Vga() { IoPortRange dev = new IoPortRange(0x3c0, 0x20, Access.ReadWrite); atcAddrPort = dev.PortAtOffset(ATC_ADDR_PORT, 2, Access.ReadWrite); miscOutputRegWritePort = dev.PortAtOffset(MISC_OUTPUT_REG_WRITE_PORT, 2, Access.ReadWrite); seqAddrPort = dev.PortAtOffset(SEQ_ADDR_PORT, 2, Access.Write); seqDataPort = dev.PortAtOffset(SEQ_DATA_PORT, 2, Access.ReadWrite); dacPixelMaskPort = dev.PortAtOffset(DAC_PIXEL_MASK_PORT, 2, Access.Write); dacAddressWritePort = dev.PortAtOffset(DAC_ADDR_WRITE_PORT, 2, Access.Write); dacDataRegPort = dev.PortAtOffset(DAC_DATA_REG_PORT, 2, Access.Write); graphAddrPort = dev.PortAtOffset(GRAPH_ADDR_PORT, 2, Access.Write); graphDataPort = dev.PortAtOffset(GRAPH_DATA_PORT, 2, Access.ReadWrite); crtcAddressColorPort = dev.PortAtOffset(CRTC_ADDR_COLOR_PORT, 2, Access.ReadWrite); inputStatusColorPort = dev.PortAtOffset(INPUT_STATUS_COLOR_PORT, 2, Access.ReadWrite); screenBuffer = IoMemory.AllocateIo(0xa0000, 0x20000, true, true); textBuffer = IoMemory.AllocateIo(0xb8000, 0x8000, true, true); }