Beispiel #1
0
        /// <summary>
        /// Performs the LBA28.
        /// </summary>
        /// <param name="operation">The operation.</param>
        /// <param name="drive">The drive NBR.</param>
        /// <param name="lba">The lba.</param>
        /// <param name="data">The data.</param>
        /// <param name="offset">The offset.</param>
        /// <returns></returns>
        protected bool PerformLBA28(SectorOperation operation, uint drive, uint lba, byte[] data, uint offset)
        {
            if (drive >= MaximumDriveCount || !driveInfo[drive].Present)
            {
                return(false);
            }

            DeviceHeadPort.Write8((byte)(0xE0 | (drive << 4) | ((lba >> 24) & 0x0F)));
            FeaturePort.Write8(0);
            SectorCountPort.Write8(1);
            LBAHighPort.Write8((byte)((lba >> 16) & 0xFF));
            LBAMidPort.Write8((byte)((lba >> 8) & 0xFF));
            LBALowPort.Write8((byte)(lba & 0xFF));

            CommandPort.Write8((operation == SectorOperation.Write) ? IDECommand.WriteSectorsWithRetry : IDECommand.ReadSectorsWithRetry);

            if (!WaitForReadyStatus())
            {
                return(false);
            }

            var sector = new DataBlock(data);

            //TODO: Don't use PIO
            if (operation == SectorOperation.Read)
            {
                for (uint index = 0; index < 256; index++)
                {
                    sector.SetUShort(offset + (index * 2), DataPort.Read16());
                }
            }
            else
            {
                //NOTE: Transferring 16bits at a time seems to fail(?) to write each second 16bits - transferring 32bits seems to fix this (???)
                for (uint index = 0; index < 128; index++)
                {
                    DataPort.Write32(sector.GetUInt(offset + (index * 4)));
                }

                //Cache flush
                DoCacheFlush();
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Probes for this device.
        /// </summary>
        /// <returns></returns>
        public override void Probe()
        {
            configAddress.Write32(BaseValue);

            var found = configAddress.Read32() == BaseValue;

            Device.Status = (found) ? DeviceStatus.Available : DeviceStatus.NotFound;
        }
Beispiel #3
0
 /// <summary>
 /// Writes to 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>
 /// <param name="value">The value.</param>
 void IPCIController.WriteConfig32(byte bus, byte slot, byte function, byte register, uint value)
 {
     configAddress.Write32(GetIndex(bus, slot, function, register));
     configData.Write32(value);
 }
Beispiel #4
0
 /// <summary>
 /// Sends the command.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <param name="value">The value.</param>
 protected void SendCommand(uint command, uint value)
 {
     indexPort.Write32(command);
     valuePort.Write32(value);
 }
Beispiel #5
0
 /// <summary>Sends the command.</summary>
 /// <param name="command">The command.</param>
 /// <param name="value">The value.</param>
 protected void SVGASetRegister(uint command, uint value)
 {
     indexPort.Write32(command);
     valuePort.Write32(value);
 }