/// <summary> /// Starts this hardware device. /// </summary> /// <returns></returns> public override DeviceDriverStartStatus Start() { DeviceHeadPort.Write8(0xA0); HAL.Sleep(1000 / 250); // wait 1/250th of a second if ((StatusPort.Read8() & 0x40) == 0x40) { driveInfo[0].Present = true; } DeviceHeadPort.Write8(0xB0); HAL.Sleep(1000 / 250); // wait 1/250th of a second if ((StatusPort.Read8() & 0x40) == 0x40) { driveInfo[1].Present = true; } return(DeviceDriverStartStatus.Started); }
protected void ReadSerial() { try { spinLock.Enter(); if (!IsFIFOFull()) { while (CanRead()) { AddToFIFO(RBRBase.Read8()); } } } finally { spinLock.Exit(); } }
public void Initialize() { spinLock.Enter(); //IdeIRQ = base.CreateIRQHandler (14); for (int drive = 0; drive < DrivesPerConroller; drive++) { driveInfo[drive].Present = false; driveInfo[drive].MaxLBA = 0; } TextMode.Write(base.name); TextMode.Write(": "); LBALowPort.Write8(0x88); if (LBALowPort.Read8() != 0x88) { base.deviceStatus = DeviceStatus.NotFound; TextMode.WriteLine("IDE controller not found at 0x" + ((uint)ioBase).ToString("X")); return; } TextMode.WriteLine("IDE controller found at 0x" + ((uint)ioBase).ToString("X")); DeviceHeadPort.Write8(0xA0); Timer.Delay(1000 / 250); // wait 1/250th of a second if ((StatusPort.Read8() & 0x40) == 0x40) { driveInfo[0].Present = true; } DeviceHeadPort.Write8(0xB0); Timer.Delay(1000 / 250); // wait 1/250th of a second if ((StatusPort.Read8() & 0x40) == 0x40) { driveInfo[1].Present = true; } for (uint drive = 0; drive < DrivesPerConroller; drive++) { if (driveInfo[drive].Present) { if (Open(drive)) { TextMode.Write(base.name); TextMode.Write(": Disk #"); TextMode.Write((int)drive); TextMode.Write(" - ", (int)(driveInfo[drive].MaxLBA / 1024 / 2)); TextMode.Write("MB, LBA=", (int)driveInfo[drive].MaxLBA); TextMode.WriteLine(""); DeviceManager.Add(new DiskDevice(this, drive, false)); } } } base.deviceStatus = DeviceStatus.Online; }