Skip to content

Commit fb3b887

Browse files
committed
Reorder ATAPI to be last device and undo test changes
1 parent 5b449d0 commit fb3b887

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

Tests/Kernels/Cosmos.Kernel.Tests.DiskManager/System.FileSystem/DiskManagerTest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class DiskManagerTest
1515
/// </summary>
1616
public static void Execute(Debugger mDebugger)
1717
{
18-
string driveName = @"1:\";
18+
string driveName = @"0:\";
1919
var MyDrive = new System.FileSystem.DiskManager(driveName);
2020

2121
mDebugger.Send("START TEST: Get Name");
@@ -56,16 +56,16 @@ public static void Execute(Debugger mDebugger)
5656
Assert.IsTrue(xDi.TotalSize == xDi.TotalFreeSpace, "DiskManager.Format (quick) failed TotalFreeSpace is not the same of TotalSize");
5757

5858
/* Let's try to create a new file on the Root Directory */
59-
File.Create(@"1:\newFile.txt");
59+
File.Create(@"0:\newFile.txt");
6060

61-
Assert.IsTrue(File.Exists(@"1:\newFile.txt") == true, "Failed to create new file after disk format");
61+
Assert.IsTrue(File.Exists(@"0:\newFile.txt") == true, "Failed to create new file after disk format");
6262

6363
mDebugger.Send("END TEST");
6464

6565
mDebugger.Send("Testing if you can create directories");
6666

67-
Directory.CreateDirectory(@"1:\SYS\");
68-
Assert.IsTrue(Directory.GetDirectories(@"1:\SYS\").Length == 0, "Can create a directory and its content is emtpy");
67+
Directory.CreateDirectory(@"0:\SYS\");
68+
Assert.IsTrue(Directory.GetDirectories(@"0:\SYS\").Length == 0, "Can create a directory and its content is emtpy");
6969

7070
mDebugger.Send("END TEST");
7171

source/Cosmos.HAL2/BlockDevice/IDE.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using Cosmos.HAL.BlockDevice;
34

45
namespace Cosmos.HAL.BlockDevice
@@ -20,9 +21,15 @@ internal static void InitDriver()
2021
Initialize(Ata.ControllerIdEnum.Secondary, Ata.BusPositionEnum.Master);
2122
Console.WriteLine("ATA Secondary Slave");
2223
Initialize(Ata.ControllerIdEnum.Secondary, Ata.BusPositionEnum.Slave);
24+
25+
//Add in the atapi devices
26+
foreach (var item in ATAPIPartions)
27+
{
28+
BlockDevice.Devices.Add(item);
29+
}
2330
}
2431
}
25-
32+
private static List<Partition> ATAPIPartions = new List<Partition>();
2633
private static void Initialize(Ata.ControllerIdEnum aControllerID, Ata.BusPositionEnum aBusPosition)
2734
{
2835
var xIO = aControllerID == Ata.ControllerIdEnum.Primary ? Core.Global.BaseIOGroups.ATA1 : Core.Global.BaseIOGroups.ATA2;
@@ -41,7 +48,8 @@ private static void Initialize(Ata.ControllerIdEnum aControllerID, Ata.BusPositi
4148
var atapi = new ATAPI(xATA);
4249

4350
//TODO: Replace 1000000 with proper size once ATAPI driver implements it
44-
BlockDevice.Devices.Add(new Partition(atapi, 0, 1000000));
51+
//Add the atapi device to an array so we reorder them to be last
52+
ATAPIPartions.Add(new Partition(atapi, 0, 1000000));
4553
Ata.AtaDebugger.Send("ATA device with speclevel ATAPI found");
4654
return;
4755
}

0 commit comments

Comments
 (0)