public override void Start() { ControlPort.Write8(0); for (byte drive = 0; drive < MaximumDriveCount; drive++) { DoIdentifyDrive(drive); } Device.Status = DeviceStatus.Online; }
/// <summary> /// Writes the settings. /// </summary> /// <param name="settings">The settings.</param> protected void WriteSettings(byte[] settings) { // Write MISCELLANEOUS reg miscellaneousOutputWrite.Write8(settings[0]); // Write SEQUENCER regs for (byte i = 0; i < 5; i++) { sequencerAddress.Write8(i); sequencerData.Write8(settings[1 + i]); } // Unlock CRTC registers crtControllerIndexColor.Write8(0x03); crtControllerDataColor.Write8((byte)(crtControllerData.Read8() | 0x80)); crtControllerIndexColor.Write8(0x11); crtControllerDataColor.Write8((byte)(crtControllerData.Read8() & 0x7F)); // Make sure they remain unlocked settings[0x03] = (byte)(settings[0x03] | 0x80); settings[0x11] = (byte)(settings[0x11] & 0x7F); // Write CRTC regs for (byte i = 0; i < 25; i++) { crtControllerIndexColor.Write8(i); crtControllerDataColor.Write8(settings[6 + i]); } // Write GRAPHICS CONTROLLER regs for (byte i = 0; i < 9; i++) { graphicsControllerAddress.Write8(i); graphicsControllerData.Write8(settings[31 + i]); } // Write ATTRIBUTE CONTROLLER regs for (byte i = 0; i < 21; i++) { inputStatus1ReadB.Read8(); attributeAddress.Write8(i); attributeAddress.Write8(settings[40 + i]); // TODO: Double check } // Lock 16-color palette and unblank display */ inputStatus1ReadB.Read8(); attributeAddress.Write8(0x20); }
private void DoIdentifyDrive(byte index) { driveInfo[index].Present = false; //Send the identify command to the selected drive DeviceHeadPort.Write8((byte)((index == 0) ? 0xA0 : 0xB0)); SectorCountPort.Write8(0); LBALowPort.Write8(0); LBAMidPort.Write8(0); LBAHighPort.Write8(0); CommandPort.Write8(IDECommand.IdentifyDrive); if (StatusPort.Read8() == 0) { //Drive doesn't exist return; } //Wait until a ready status is present if (!WaitForReadyStatus()) { return; //There's no ready status, this drive doesn't exist } if (LBAMidPort.Read8() != 0 && LBAHighPort.Read8() != 0) //Check if the drive is ATA { //In this case the drive is ATAPI //HAL.DebugWriteLine("Device " + index.ToString() + " not ATA"); return; } //Wait until the identify data is present (256x16 bits) if (!WaitForIdentifyData()) { //HAL.DebugWriteLine("Device " + index.ToString() + " ID error"); return; } //An ATA drive is present driveInfo[index].Present = true; //Read the identification info var info = new DataBlock(512); for (uint ix = 0; ix < 256; ix++) { info.SetUShort(ix * 2, DataPort.Read16()); } //Find the addressing mode var lba28SectorCount = info.GetUInt(IdentifyDrive.MaxLBA28); AddressingMode aMode = AddressingMode.NotSupported; if ((info.GetUShort(IdentifyDrive.CommandSetSupported83) & 0x200) == 0x200) //Check the LBA48 support bit { aMode = AddressingMode.LBA48; driveInfo[index].MaxLBA = info.GetUInt(IdentifyDrive.MaxLBA48); } else if (lba28SectorCount > 0) //LBA48 not supported, check LBA28 { aMode = AddressingMode.LBA28; driveInfo[index].MaxLBA = lba28SectorCount; } driveInfo[index].AddressingMode = aMode; //HAL.DebugWriteLine("Device " + index.ToString() + " present - MaxLBA=" + driveInfo[index].MaxLBA.ToString()); }
/// <summary> /// Starts this hardware device. /// </summary> public override void Start() { SMI_CommandPort.Write8(FADT->AcpiEnable); HAL.Sleep(3000); Device.Status = DeviceStatus.Online; }