Example #1
0
        internal IoDma(byte ugly)
        {
            channel = (byte)ugly;
            byte addrReg;
            byte countReg;
            byte pageReg;
            byte maskReg;
            byte clearReg;
            byte modeReg;

            eightBit        = true;
            controlByte     = 0;
            modeByte        = 0;
            controlByteMask = 0;

            if (channel < 4)
            {
                // 8 bit transfer
                addrReg  = (byte)(0x00 + (channel * 2));
                countReg = (byte)(0x01 + (channel * 2));
                pageReg  = (byte)(0x80 + (new byte[4] {
                    0x7, 0x3, 0x1, 0x2
                })[channel]);
                maskReg  = 0x0A;
                clearReg = 0x0C;
                modeReg  = 0x0B;
                eightBit = true;
            }
            else if (channel > 4 && channel < 8)
            {
                channel -= 4;

                //16 bit channel
                addrReg  = (byte)(0xC0 + (channel * 4));
                countReg = (byte)(0xC2 + (channel * 4));
                pageReg  = (byte)(0x88 + (new byte[4] {
                    0x7, 0x3, 0x1, 0x2
                })[channel]);
                maskReg  = 0xD4;
                clearReg = 0xD8;
                modeReg  = 0xD6;
                eightBit = false;
            }
            else
            {
                Tracing.Log(Tracing.Fatal, "Invalid DMA Channel {0}", channel);
                throw new Exception("Invalid DMA Channel");
            }
            // create ports
            addrPort  = new IoPort(addrReg, 1, Access.ReadWrite);
            countPort = new IoPort(countReg, 1, Access.ReadWrite);
            pagePort  = new IoPort(pageReg, 1, Access.ReadWrite);
            maskPort  = new IoPort(maskReg, 1, Access.ReadWrite);
            clearPort = new IoPort(clearReg, 1, Access.ReadWrite);
            modePort  = new IoPort(modeReg, 1, Access.ReadWrite);
        }
Example #2
0
 public PciPort(IoPort addressPort, IoPort dataPort, ushort identifier)
 {
     this.addressPort = addressPort;
     this.dataPort    = dataPort;
     this.identifier  = identifier;
 }