예제 #1
0
        /// <summary>Waits for fifo.</summary>
        protected void WaitForFifo()
        {
            SVGASetRegister(SVGA_REGISTERS.Sync, 1);

            while (SVGAGetRegister(SVGA_REGISTERS.Busy) != 0)
            {
                HAL.Sleep(5);
            }
        }
예제 #2
0
        /// <summary>
        /// Waits for fifo.
        /// </summary>
        protected void WaitForFifo()
        {
            SendCommand(Register.Sync, 1);

            while (ReadRegister(Register.Busy) != 0)
            {
                HAL.Sleep(10);
            }
        }
        /// <summary>
        /// Turns the on motor.
        /// </summary>
        /// <param name="drive">The drive.</param>
        protected void TurnOnMotor(uint drive)
        {
            byte reg  = commandPort.Read8();
            byte bits = (byte)(DORFlags.MotorShift << (byte)drive | DORFlags.EnableDMA | DORFlags.EnableController | (byte)drive);

            if (reg != bits)
            {
                commandPort.Write8(bits);
                HAL.Sleep(500);                 // 500 msec
            }
        }
        /// <summary>
        /// Resets the controller.
        /// </summary>
        protected void ResetController()
        {
            ClearInterrupt();

            commandPort.Write8(DORFlags.ResetController);

            HAL.Sleep(200);

            commandPort.Write8(DORFlags.EnableController);

            WaitForInterrupt(3000);
        }
        /// <summary>
        /// Seeks the specified drive.
        /// </summary>
        /// <param name="drive">The drive.</param>
        /// <param name="track">The track.</param>
        /// <param name="head">The head.</param>
        /// <returns></returns>
        protected bool Seek(uint drive, byte track, byte head)
        {
            TurnOnMotor(drive);

            if (!lastSeek[drive].calibrated)
            {
                if (!Recalibrate(drive))
                {
                    return(false);
                }
            }

            if ((lastSeek[drive].calibrated) && (lastSeek[drive].track == track) && (lastSeek[drive].head == head))
            {
                return(true);
            }

            for (int i = 0; i < 5; i++)
            {
                ClearInterrupt();

                lastSeek[drive].calibrated = false;

                SendByte(FIFOCommand.Seek);
                SendByte((byte)(((byte)drive | (head << 2))));
                SendByte(track);

                if (!WaitForInterrupt(3000))
                {
                    return(false);
                }

                HAL.Sleep(20);

                SendByte(FIFOCommand.SenseInterrupt);
                byte sr0 = GetByte();
                byte trk = GetByte();

                if ((sr0 == (0x20 + ((byte)drive | (head << 2)))) && (trk == track))
                {
                    lastSeek[drive].calibrated = true;
                    lastSeek[drive].track      = track;
                    lastSeek[drive].head       = head;
                    return(true);
                }
            }

            return(false);
        }
예제 #6
0
        /// <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);
        }
예제 #7
0
 /// <summary>
 /// Stops this hardware device.
 /// </summary>
 public override void Stop()
 {
     SMI_CommandPort.Write8(FADT->AcpiDisable);
     HAL.Sleep(3000);
     Device.Status = DeviceStatus.Offline;
 }