Esempio n. 1
1
 /// <summary>
 /// Initialises a particular drive on the ATA bus.
 /// </summary>
 /// <param name="ctrlId">The controller ID of the device.</param>
 /// <param name="busPos">The bus position of the device.</param>
 public static void InitDrive(ATA.ControllerID ctrlId, ATA.BusPosition busPos)
 {
     //Get the IO ports for the correct bus
     ATAIOPorts theIO = ctrlId == ATA.ControllerID.Primary ? ATAIO1 : ATAIO2;
     //Create / init the device on the bus
     try
     {
         PATABase ThePATABase = new PATABase(theIO, ctrlId, busPos);
         //If the device was detected as present:
         if (ThePATABase.DriveType != PATABase.SpecLevel.Null)
         {
             //If the device was actually a PATA device:
             if (ThePATABase.DriveType == PATABase.SpecLevel.PATA)
             {
                 //Add it to the list of devices.
                 try
                 {
                     DeviceManager.AddDevice(new PATA(ThePATABase));
                 }
                 catch
                 {
                     ExceptionMethods.Throw(new FOS_System.Exception("Error initialising PATA device."));
                 }
             }
             else if (ThePATABase.DriveType == PATABase.SpecLevel.PATAPI)
             {
                 // Add a PATAPI device
                 try
                 {
                     DeviceManager.AddDevice(new PATAPI(ThePATABase));
                 }
                 catch
                 {
                     ExceptionMethods.Throw(new FOS_System.Exception("Error initialising PATAPI device."));
                 }
             }
             //TODO: Remove the SATA/SATAPI initialisation from here. It should be done
             //  in the ATAManager.Init method.
             else if (ThePATABase.DriveType == PATABase.SpecLevel.SATA)
             {
                 // Add a SATA device
                 try
                 {
                     DeviceManager.AddDevice(new SATA());
                 }
                 catch
                 {
                     ExceptionMethods.Throw(new FOS_System.Exception("Error initialising SATA device."));
                 }
             }
             else if (ThePATABase.DriveType == PATABase.SpecLevel.SATAPI)
             {
                 // Add a SATAPI device
                 try
                 {
                     DeviceManager.AddDevice(new SATAPI());
                 }
                 catch
                 {
                     ExceptionMethods.Throw(new FOS_System.Exception("Error initialising SATAPI device."));
                 }
             }
         }
     }
     catch
     {
         ExceptionMethods.Throw(new FOS_System.Exception((FOS_System.String)"Error initialising PATA Base device. Controller ID: " + 
             (ctrlId == ATA.ControllerID.Primary ? "Primary" : "Secondary") + " , Position: " + 
             (busPos == ATA.BusPosition.Master ? "Master" : "Slave")));
     }
 }
Esempio n. 2
0
        public PATAPI(PATABase baseDevice)
        {
            BaseDevice = baseDevice;

            // Enable IRQs - required for PATAPI
            BaseDevice.SelectDrive(0, false);
            BaseDevice.IO.Control.Write_Byte((byte)0x00);

            if (BaseDevice.controllerId == ATA.ControllerID.Primary)
            {
                Interrupts.Interrupts.AddIRQHandler(14, PATAPI.IRQHandler, this, true, true, "PATAPI IRQ 14");
            }
            else
            {
                Interrupts.Interrupts.AddIRQHandler(15, PATAPI.IRQHandler, this, true, true, "PATAPI IRQ 15");
            }
        }
Esempio n. 3
0
        public PATAPI(PATABase baseDevice)
        {
            BaseDevice = baseDevice;

            // Enable IRQs - required for PATAPI
            BaseDevice.SelectDrive(0, false);
            BaseDevice.IO.Control.Write_Byte((byte)0x00);

            //TODO: Use system calls for adding IRQ handler(s)
            //if (BaseDevice.controllerId == ATA.ControllerID.Primary)
            //{
            //    Interrupts.Interrupts.AddIRQHandler(14, PATAPI.IRQHandler, this, "PATAPI IRQ 14");
            //}
            //else
            //{
            //    Interrupts.Interrupts.AddIRQHandler(15, PATAPI.IRQHandler, this, "PATAPI IRQ 15");
            //}
        }
Esempio n. 4
0
        public PATAPI(PATABase baseDevice)
        {
            BaseDevice = baseDevice;

            // Enable IRQs - required for PATAPI
            BaseDevice.SelectDrive(0, false);
            BaseDevice.IO.Control.Write_Byte((byte)0x00);

            //TODO: Use system calls for adding IRQ handler(s)
            //if (BaseDevice.controllerId == ATA.ControllerID.Primary)
            //{
            //    Interrupts.Interrupts.AddIRQHandler(14, PATAPI.IRQHandler, this, "PATAPI IRQ 14");
            //}
            //else
            //{
            //    Interrupts.Interrupts.AddIRQHandler(15, PATAPI.IRQHandler, this, "PATAPI IRQ 15");
            //}
        }
Esempio n. 5
0
 /// <summary>
 /// Initialises a new ATA pio device.
 /// </summary>
 public PATA(PATABase baseDevice)
 {
     BaseDevice = baseDevice;
 }
Esempio n. 6
0
        /// <summary>
        /// Initialises a particular drive on the ATA bus.
        /// </summary>
        /// <param name="ctrlId">The controller ID of the device.</param>
        /// <param name="busPos">The bus position of the device.</param>
        public static void InitDrive(ATA.ControllerID ctrlId, ATA.BusPosition busPos)
        {
            //Get the IO ports for the correct bus
            ATAIOPorts theIO = ctrlId == ATA.ControllerID.Primary ? ATAIO1 : ATAIO2;

            //Create / init the device on the bus
            try
            {
                PATABase ThePATABase = new PATABase(theIO, ctrlId, busPos);
                //If the device was detected as present:
                if (ThePATABase.DriveType != PATABase.SpecLevel.Null)
                {
                    //If the device was actually a PATA device:
                    if (ThePATABase.DriveType == PATABase.SpecLevel.PATA)
                    {
                        //Add it to the list of devices.
                        try
                        {
                            DeviceManager.AddDevice(new PATA(ThePATABase));
                        }
                        catch
                        {
                            ExceptionMethods.Throw(new FOS_System.Exception("Error initialising PATA device."));
                        }
                    }
                    else if (ThePATABase.DriveType == PATABase.SpecLevel.PATAPI)
                    {
                        // Add a PATAPI device
                        try
                        {
                            DeviceManager.AddDevice(new PATAPI(ThePATABase));
                        }
                        catch
                        {
                            ExceptionMethods.Throw(new FOS_System.Exception("Error initialising PATAPI device."));
                        }
                    }
                    //TODO: Remove the SATA/SATAPI initialisation from here. It should be done
                    //  in the ATAManager.Init method.
                    else if (ThePATABase.DriveType == PATABase.SpecLevel.SATA)
                    {
                        // Add a SATA device
                        try
                        {
                            DeviceManager.AddDevice(new SATA());
                        }
                        catch
                        {
                            ExceptionMethods.Throw(new FOS_System.Exception("Error initialising SATA device."));
                        }
                    }
                    else if (ThePATABase.DriveType == PATABase.SpecLevel.SATAPI)
                    {
                        // Add a SATAPI device
                        try
                        {
                            DeviceManager.AddDevice(new SATAPI());
                        }
                        catch
                        {
                            ExceptionMethods.Throw(new FOS_System.Exception("Error initialising SATAPI device."));
                        }
                    }
                }
            }
            catch
            {
                ExceptionMethods.Throw(new FOS_System.Exception((FOS_System.String) "Error initialising PATA Base device. Controller ID: " +
                                                                (ctrlId == ATA.ControllerID.Primary ? "Primary" : "Secondary") + " , Position: " +
                                                                (busPos == ATA.BusPosition.Master ? "Master" : "Slave")));
            }
        }
Esempio n. 7
0
 /// <summary>
 /// Initialises a new ATA pio device.
 /// </summary>
 public PATA(PATABase baseDevice)
 {
     BaseDevice = baseDevice;
 }