Ejemplo n.º 1
0
 public static bool Dispose(PciPortHandle handle)
 {
     if (handle.id != UIntPtr.Zero)
     {
         Thread.CurrentProcess.ReleaseHandle(handle.id);
     }
     return(false);
 }
Ejemplo n.º 2
0
 public static unsafe bool Read32(PciPortHandle handle,
                                  int offset,
                                  out uint value)
 {
     unsafe
     {
         fixed(uint *valuePtr = &value)
         {
             return(Read32Impl(handle, offset, valuePtr));
         }
     }
 }
Ejemplo n.º 3
0
 public static unsafe bool Read8(PciPortHandle handle,
                                 int offset,
                                 out byte value)
 {
     unsafe
     {
         fixed(byte *valuePtr = &value)
         {
             return(Read8Impl(handle, offset, valuePtr));
         }
     }
 }
Ejemplo n.º 4
0
 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);
     }
 }
Ejemplo n.º 5
0
 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);
     }
 }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
 public static extern bool GetPciPort(out PciPortHandle handle);
Ejemplo n.º 8
0
 public static extern bool Write16(PciPortHandle h,
                                   int offset,
                                   ushort value);
Ejemplo n.º 9
0
 public static extern bool Write8(PciPortHandle h,
                                  int offset,
                                  byte value);
Ejemplo n.º 10
0
 public static extern unsafe bool Read32Impl(PciPortHandle h,
                                             int offset,
                                             uint *value);
Ejemplo n.º 11
0
 public static extern unsafe bool Read8Impl(PciPortHandle h,
                                            int offset,
                                            byte *value);
Ejemplo n.º 12
0
 public static extern bool Write32(PciPortHandle h,
                                   int offset,
                                   uint value);
Ejemplo n.º 13
0
 public static unsafe bool GetPciPort(
     out PciPortHandle pciPortHandle
     )
 {
     return(PciPortHandle.Create(out pciPortHandle));
 }