public static bool Dispose(PciPortHandle handle) { if (handle.id != UIntPtr.Zero) { Thread.CurrentProcess.ReleaseHandle(handle.id); } return(false); }
public static unsafe bool Read32(PciPortHandle handle, int offset, out uint value) { unsafe { fixed(uint *valuePtr = &value) { return(Read32Impl(handle, offset, valuePtr)); } } }
public static unsafe bool Read8(PciPortHandle handle, int offset, out byte value) { unsafe { fixed(byte *valuePtr = &value) { return(Read8Impl(handle, offset, valuePtr)); } } }
bool Write32(PciPortHandle handle, int offset, uint value) { if (handle.id != UIntPtr.Zero) { PciPort p = HandleTable.GetHandle(handle.id) as PciPort; p.Write32(offset, value); return(true); } else { return(false); } }
bool Read16Impl(PciPortHandle handle, int offset, ushort *value) { if (handle.id != UIntPtr.Zero) { PciPort p = HandleTable.GetHandle(handle.id) as PciPort; * value = p.Read16(offset); return(true); } else { *value = 0; return(false); } }
public static bool Create(out PciPortHandle handle) { IoConfig config = Thread.CurrentProcess.IoConfig; PciConfig pciConfig = config as PciConfig; if (pciConfig != null) { handle = new PciPortHandle( Thread.CurrentProcess.AllocateHandle(pciConfig.PciPort) ); return(true); } else { handle = new PciPortHandle(); return(false); } }
public static extern bool GetPciPort(out PciPortHandle handle);
public static extern bool Write16(PciPortHandle h, int offset, ushort value);
public static extern bool Write8(PciPortHandle h, int offset, byte value);
public static extern unsafe bool Read32Impl(PciPortHandle h, int offset, uint *value);
public static extern unsafe bool Read8Impl(PciPortHandle h, int offset, byte *value);
public static extern bool Write32(PciPortHandle h, int offset, uint value);
public static unsafe bool GetPciPort( out PciPortHandle pciPortHandle ) { return(PciPortHandle.Create(out pciPortHandle)); }