Exemplo n.º 1
0
        private static void InitAta(BlockDevice.Ata.ControllerIdEnum aControllerID,
                                    BlockDevice.Ata.BusPositionEnum aBusPosition)
        {
            var xIO = aControllerID == BlockDevice.Ata.ControllerIdEnum.Primary
                ? Cosmos.Core.Global.BaseIOGroups.ATA1
                : Cosmos.Core.Global.BaseIOGroups.ATA2;
            var xATA = new BlockDevice.AtaPio(xIO, aControllerID, aBusPosition);

            if (xATA.DriveType == BlockDevice.AtaPio.SpecLevel.Null)
            {
                return;
            }
            if (xATA.DriveType == BlockDevice.AtaPio.SpecLevel.ATA)
            {
                BlockDevice.BlockDevice.Devices.Add(xATA);
                Ata.AtaDebugger.Send("ATA device with speclevel ATA found.");
            }
            else
            {
                Ata.AtaDebugger.Send("ATA device with spec level " + (int)xATA.DriveType +
                                     " found, which is not supported!");
                return;
            }
            var xMbrData = new byte[512];

            xATA.ReadBlock(0UL, 1U, xMbrData);
            var xMBR = new BlockDevice.MBR(xMbrData);

            if (xMBR.EBRLocation != 0)
            {
                //EBR Detected
                var xEbrData = new byte[512];
                xATA.ReadBlock(xMBR.EBRLocation, 1U, xEbrData);
                var xEBR = new BlockDevice.EBR(xEbrData);

                for (int i = 0; i < xEBR.Partitions.Count; i++)
                {
                    //var xPart = xEBR.Partitions[i];
                    //var xPartDevice = new BlockDevice.Partition(xATA, xPart.StartSector, xPart.SectorCount);
                    //BlockDevice.BlockDevice.Devices.Add(xPartDevice);
                }
            }

            // TODO Change this to foreach when foreach is supported
            Ata.AtaDebugger.Send("Number of MBR partitions found:  " + xMBR.Partitions.Count);
            for (int i = 0; i < xMBR.Partitions.Count; i++)
            {
                var xPart = xMBR.Partitions[i];
                if (xPart == null)
                {
                    Console.WriteLine("Null partition found at idx " + i);
                }
                else
                {
                    var xPartDevice = new BlockDevice.Partition(xATA, xPart.StartSector, xPart.SectorCount);
                    BlockDevice.BlockDevice.Devices.Add(xPartDevice);
                    Console.WriteLine("Found partition at idx " + i);
                }
            }
        }
Exemplo n.º 2
0
    private static void InitAta(Ata.ControllerIdEnum aControllerID,
        Ata.BusPositionEnum aBusPosition)
    {
      var xIO = aControllerID == Ata.ControllerIdEnum.Primary
          ? Core.Global.BaseIOGroups.ATA1
          : Core.Global.BaseIOGroups.ATA2;
      var xATA = new AtaPio(xIO, aControllerID, aBusPosition);
      if (xATA.DriveType == AtaPio.SpecLevel.Null)
      {
        return;
      }
      if (xATA.DriveType == AtaPio.SpecLevel.ATA)
      {
        BlockDevice.BlockDevice.Devices.Add(xATA);
        Ata.AtaDebugger.Send("ATA device with speclevel ATA found.");
      }
      else
      {
        //Ata.AtaDebugger.Send("ATA device with spec level " + (int)xATA.DriveType +
        //                     " found, which is not supported!");
        return;
      }
      var xMbrData = new byte[512];
      xATA.ReadBlock(0UL, 1U, xMbrData);
      var xMBR = new MBR(xMbrData);

      if (xMBR.EBRLocation != 0)
      {
        //EBR Detected
        var xEbrData = new byte[512];
        xATA.ReadBlock(xMBR.EBRLocation, 1U, xEbrData);
        var xEBR = new EBR(xEbrData);

        for (int i = 0; i < xEBR.Partitions.Count; i++)
        {
          //var xPart = xEBR.Partitions[i];
          //var xPartDevice = new BlockDevice.Partition(xATA, xPart.StartSector, xPart.SectorCount);
          //BlockDevice.BlockDevice.Devices.Add(xPartDevice);
        }
      }

      // TODO Change this to foreach when foreach is supported
      Ata.AtaDebugger.Send("Number of MBR partitions found:");
      Ata.AtaDebugger.SendNumber(xMBR.Partitions.Count);
      for (int i = 0; i < xMBR.Partitions.Count; i++)
      {
        var xPart = xMBR.Partitions[i];
        if (xPart == null)
        {
          Console.WriteLine("Null partition found at idx: " + i);
        }
        else
        {
          var xPartDevice = new Partition(xATA, xPart.StartSector, xPart.SectorCount);
          BlockDevice.BlockDevice.Devices.Add(xPartDevice);
          Console.WriteLine("Found partition at idx" + i);
        }
      }
    }
Exemplo n.º 3
0
    protected override void Run()
    {
      Test xTest;

      var xATA = new Cosmos.HAL.BlockDevice.AtaPio(Cosmos.Core.Global.BaseIOGroups.ATA1
        , Cosmos.HAL.BlockDevice.Ata.ControllerIdEnum.Primary
        , Cosmos.HAL.BlockDevice.Ata.BusPositionEnum.Master);
      UInt64 xBlockSize = xATA.BlockSize;

      Console.WriteLine("Running FieldInitTest");
      xTest = new FieldInitTest();
      xTest.Run();

      Console.WriteLine("Running ListTest");
      xTest = new ListTest();
      xTest.Run();
      Console.WriteLine("Running NullableTest");
      xTest = new NullableTest();
      xTest.Run();

      Console.WriteLine("Running Int64Test");
      xTest = new Int64Test();
      xTest.Run();

      Console.WriteLine("Running Trace1");
      Trace1();
      Console.WriteLine("Running TestSB");
      TestSB();
      Console.WriteLine("Running TestStringCtor");
      TestStringCtor();
      Console.WriteLine("Running TestCompare");
      TestCompare();

      Console.WriteLine("Running TestATA");
      //TestATA();

      Console.WriteLine("Press enter.");
      Console.ReadLine();
      Stop();
    }
Exemplo n.º 4
0
        protected override void Run()
        {
            Test xTest;

            var xATA = new Cosmos.HAL.BlockDevice.AtaPio(Cosmos.Core.Global.BaseIOGroups.ATA1
                                                         , Cosmos.HAL.BlockDevice.Ata.ControllerIdEnum.Primary
                                                         , Cosmos.HAL.BlockDevice.Ata.BusPositionEnum.Master);
            UInt64 xBlockSize = xATA.BlockSize;

            Console.WriteLine("Running FieldInitTest");
            xTest = new FieldInitTest();
            xTest.Run();

            Console.WriteLine("Running ListTest");
            xTest = new ListTest();
            xTest.Run();
            Console.WriteLine("Running NullableTest");
            xTest = new NullableTest();
            xTest.Run();

            Console.WriteLine("Running Int64Test");
            xTest = new Int64Test();
            xTest.Run();

            Console.WriteLine("Running Trace1");
            Trace1();
            Console.WriteLine("Running TestSB");
            TestSB();
            Console.WriteLine("Running TestStringCtor");
            TestStringCtor();
            Console.WriteLine("Running TestCompare");
            TestCompare();

            Console.WriteLine("Running TestATA");
            //TestATA();

            Console.WriteLine("Press enter.");
            Console.ReadLine();
            Stop();
        }