private ushort PrepareAccess(PciDevice d, ushort pos) { if (pos >= 256) { throw new ArgumentOutOfRangeException(nameof(pos)); } var code = GetConfigAddress(d.Bus, d.Dev, d.Func, pos); DirectIo.Write(code, 0xcf8); var addr = (ushort)(0xcfc + (ushort)(pos & 3)); return(addr); }
public bool Detect() { if (!DirectIo.Startup()) { return(false); } DirectIo.Write(1, 0xCFB); var tmp = DirectIo.ReadUInt32(0xCF8); DirectIo.Write(0x80000000, 0xCF8); var result = DirectIo.ReadUInt32(0xCF8) == 0x80000000; DirectIo.Write(tmp, 0xCF8); return(result && Check()); }
public void Write(PciDevice device, ushort offset, uint value) { var ptr = PrepareAccess(device, offset); DirectIo.Write(value, ptr); }