コード例 #1
0
        /// <summary>
        /// Sets the bit.
        /// </summary>
        /// <param name="bit">The bit.</param>
        protected void SetBit(byte bit)
        {
            switch (bits)
            {
            case 8: ioPort.Write8(SetBit(ioPort.Read8(), bit)); break;

            case 16: ioPort.Write16(SetBit(ioPort.Read16(), bit)); break;

            case 32: ioPort.Write32(SetBit(ioPort.Read32(), bit)); break;
            }
        }
コード例 #2
0
        /// <summary>
        /// Probes for this device.
        /// </summary>
        /// <returns></returns>
        public bool Probe()
        {
            configAddress.Write32(BaseValue);

            if (configAddress.Read32() != BaseValue)
            {
                return(false);
            }

            return(true);
        }
コード例 #3
0
        public uint ReadConfig(uint bus, uint slot, uint function, uint register)
        {
            uint address = BaseValue
                           | ((bus & 0xFF) << 16)
                           | ((slot & 0x0F) << 11)
                           | ((function & 0x07) << 8)
                           | (register & 0xFC);

            ConfigAddress.Write32(address);
            return(ConfigData.Read32());
        }
コード例 #4
0
        /// <summary>
        /// Starts this hardware device.
        /// </summary>
        /// <returns></returns>
        public override DeviceDriverStartStatus Start()
        {
            // Enable the card
            hardwareResources.DeviceResource.EnableDevice();

            // Do a 32-bit write to set 32-bit mode
            rdp.Write32(0);

            // Get the EEPROM MAC Address
            byte[] eepromMac = new byte[6];
            uint   data      = ioProm1.Read32();

            eepromMac[0] = (byte)(data & 0xFF);
            eepromMac[1] = (byte)((data >> 8) & 0xFF);
            eepromMac[2] = (byte)((data >> 16) & 0xFF);
            eepromMac[3] = (byte)((data >> 24) & 0xFF);
            data         = ioProm4.Read32();
            eepromMac[4] = (byte)(data & 0xFF);
            eepromMac[5] = (byte)((data >> 8) & 0xFF);

            macAddress = new MACAddress(eepromMac);

            // Fill in the initialization block
            initBlock.Write32(0, (0x4 << 28) | (0x4 << 30));
            initBlock.Write32(4, (uint)(eepromMac[0] | (eepromMac[1] << 8) | (eepromMac[2] << 16) | (eepromMac[3] << 24)));
            initBlock.Write32(8, (uint)(eepromMac[4] | (eepromMac[5] << 8)));             // Fill in the hardware MAC address
            initBlock.Write32(16, 0x0);
            initBlock.Write32(24, 0x0);
            initBlock.Write32(28, rxDescriptor.Address);
            initBlock.Write32(32, txDescriptor.Address);

            // Write the initialization blocks address to the registers on the card
            InitializationBlockAddress = HAL.GetPhysicalAddress(initBlock);

            // Set the device to PCNet-PCI II Controller mode (full 32-bit mode)
            SoftwareStyleRegister = 0x03;

            nextTXDesc = 0;

            return(DeviceDriverStartStatus.Started);
        }
コード例 #5
0
        public void Initialize()
        {
            spinLock.Enter();

            TextMode.Write(base.name);
            TextMode.Write(": ");

            ConfigAddress.Write32(BaseValue);

            if (ConfigAddress.Read32() != BaseValue)
            {
                base.deviceStatus = DeviceStatus.NotFound;

                TextMode.WriteLine("PCI controller not found");
                return;
            }

            TextMode.WriteLine("PCI controller found at 0x" + ((uint)PCIConfigAddress).ToString("X"));

            Setup();

            base.deviceStatus = DeviceStatus.Online;
        }
コード例 #6
0
 /// <summary>
 /// Reads from configuration space
 /// </summary>
 /// <param name="bus">The bus.</param>
 /// <param name="slot">The slot.</param>
 /// <param name="function">The function.</param>
 /// <param name="register">The register.</param>
 /// <returns></returns>
 public uint ReadConfig32(byte bus, byte slot, byte function, byte register)
 {
     configAddress.Write32(GetIndex(bus, slot, function, register));
     return(configData.Read32());
 }
コード例 #7
0
 /// <summary>
 /// Gets the value.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <returns></returns>
 protected uint ReadRegister(uint command)
 {
     indexPort.Write32(command);
     return(valuePort.Read32());
 }
コード例 #8
0
ファイル: VMwareSVGAII.cs プロジェクト: djlw78/Mosa
 /// <summary>
 /// Gets the value.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <returns></returns>
 protected uint GetValue(uint command)
 {
     indexPort.Write32(command);
     return(valuePort.Read32());
 }