Пример #1
0
            public void Write16(AcpiObject.RegionSpace regionSpace, ulong offset, ushort value)
            {
#if DUMP_RAW_READ_WRITES
                DebugStub.WriteLine("ACPI write: space: " + regionSpace + ", offset: " + offset + ", bytes: " + 2 + ", value: " + value.ToString("X"));
#endif
                switch (regionSpace)
                {
                case AcpiObject.RegionSpace.SystemMemory:
                    IoMemory region = IoMemory.MapPhysicalMemory(offset, 2, true /*readable*/, true /*writable*/);
                    region.Write16(0, value);
                    break;

                case AcpiObject.RegionSpace.SystemIO:
                    IoPort port = new IoPort((ushort)offset, 2, Access.ReadWrite);
                    port.Write16(value);
                    break;

                case AcpiObject.RegionSpace.PCI_Config:
                    pciConfigAddressPort.Write32(PciConfigEnableMask | (uint)offset);
                    pciConfigDataPort.Write16(value);
                    break;

                default:
                    throw new Exception("Unimplemented operation region type" + regionSpace);
                }
            }
Пример #2
0
        //
        private void VgaTextMode()
        {
            // start sync reset program up sequencer
            IndxOut(seqAddrPort, new byte[] { 0x01,0x00,0x03,0x00,0x02 } );

            miscOutputRegWritePort.Write8(0x67);
            graphAddrPort.Write16(0x0e06);

            //  EndSyncResetCmd
            seqAddrPort.Write16(0x0300);

            // Unlock the CTC registers.
            crtcAddressColorPort.Write16(0x0E11);

            // program crtc registers
            IndxOut(crtcAddressColorPort, new byte[] { 0x5F,0x4f,0x50,0x82,0x55,0x81,
                                                       0xbf,0x1f,0x00,0x4f,0x0d,0x0e,
                                                       0x00,0x00,0x00,0x00,0x9c,0x8e,
                                                       0x8f,0x28,0x1f,0x96,0xb9,0xa3,
                                                       0xFF } );

            // prepare atc for writing
            inputStatusColorPort.Read8();
            AtcOut(atcAddrPort, new byte[] { 0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
                                             0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
                                             0x04,0x00,0x0F,0x08,0x00 } );

            // program graphics controller registers
            IndxOut(graphAddrPort, new byte[] { 0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,0xff});

            // DAC mask registers
            dacPixelMaskPort.Write8(0xFF);

            // prepare atc for writing
            inputStatusColorPort.Read8();

            // turn video on.
            atcAddrPort.Write8(VIDEO_ENABLE);
        }
Пример #3
0
 private void IndxOut(IoPort port, byte[] values)
 {
     for (ushort i = 0; i < values.Length; i++) {
         port.Write16((ushort)(i + ((ushort)values[i] << 8)));
     }
 }