mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +00:00
Code cleanup.
This commit is contained in:
parent
53ddb83209
commit
945a1cce72
4 changed files with 35 additions and 61 deletions
|
|
@ -1,8 +0,0 @@
|
||||||
[*.cs]
|
|
||||||
indent_size=4
|
|
||||||
|
|
||||||
[Global.cs]
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
[BlockDevice/Ata.cs]
|
|
||||||
indent_size = 2
|
|
||||||
|
|
@ -1,36 +1,30 @@
|
||||||
using System;
|
using Cosmos.Debug.Kernel;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Cosmos.Debug.Kernel;
|
|
||||||
|
|
||||||
namespace Cosmos.HAL.BlockDevice {
|
namespace Cosmos.HAL.BlockDevice
|
||||||
public abstract class Ata : BlockDevice
|
{
|
||||||
{
|
public abstract class Ata : BlockDevice
|
||||||
|
|
||||||
internal static Debugger AtaDebugger = new Debugger("HAL", "Ata");
|
|
||||||
|
|
||||||
protected Ata() {
|
|
||||||
mBlockSize = 512;
|
|
||||||
}
|
|
||||||
|
|
||||||
// In future may need to add a None for PCI ATA controllers.
|
|
||||||
// Or maybe they all have Primary and Secondary on them as well.
|
|
||||||
public enum ControllerIdEnum { Primary, Secondary }
|
|
||||||
protected ControllerIdEnum mControllerID;
|
|
||||||
public ControllerIdEnum ControllerID {
|
|
||||||
get { return mControllerID; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum BusPositionEnum { Master, Slave }
|
|
||||||
protected BusPositionEnum mBusPosition;
|
|
||||||
public BusPositionEnum BusPosition {
|
|
||||||
get { return mBusPosition; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
{
|
||||||
return "Ata (Abstract)";
|
|
||||||
|
internal static Debugger AtaDebugger = new Debugger("HAL", "Ata");
|
||||||
|
|
||||||
|
protected Ata()
|
||||||
|
{
|
||||||
|
mBlockSize = 512;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In future may need to add a None for PCI ATA controllers.
|
||||||
|
// Or maybe they all have Primary and Secondary on them as well.
|
||||||
|
public enum ControllerIdEnum { Primary, Secondary }
|
||||||
|
protected ControllerIdEnum mControllerID;
|
||||||
|
public ControllerIdEnum ControllerID => mControllerID;
|
||||||
|
|
||||||
|
public enum BusPositionEnum { Master, Slave }
|
||||||
|
protected BusPositionEnum mBusPosition;
|
||||||
|
public BusPositionEnum BusPosition => mBusPosition;
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return "Ata (Abstract)";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Cosmos.Debug.Kernel;
|
|
||||||
|
|
||||||
namespace Cosmos.HAL.BlockDevice
|
namespace Cosmos.HAL.BlockDevice
|
||||||
{
|
{
|
||||||
|
|
@ -23,21 +20,15 @@ namespace Cosmos.HAL.BlockDevice
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UInt64 mBlockCount = 0;
|
protected UInt64 mBlockCount = 0;
|
||||||
public UInt64 BlockCount
|
public UInt64 BlockCount => mBlockCount;
|
||||||
{
|
|
||||||
get { return mBlockCount; }
|
|
||||||
}
|
|
||||||
|
|
||||||
protected UInt64 mBlockSize = 0;
|
protected UInt64 mBlockSize = 0;
|
||||||
public UInt64 BlockSize
|
public UInt64 BlockSize => mBlockSize;
|
||||||
{
|
|
||||||
get { return mBlockSize; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only allow reading and writing whole blocks because many of the hardware
|
// Only allow reading and writing whole blocks because many of the hardware
|
||||||
// command work that way and we dont want to add complexity at the BlockDevice level.
|
// command work that way and we dont want to add complexity at the BlockDevice level.
|
||||||
// public abstract void ReadBlock(UInt64 aBlockNo, UInt32 aBlockCount, byte[] aData);
|
// public abstract void ReadBlock(UInt64 aBlockNo, UInt32 aBlockCount, byte[] aData);
|
||||||
public abstract void ReadBlock(UInt64 aBlockNo, UInt64 aBlockCount, byte[] aData);
|
public abstract void ReadBlock(UInt64 aBlockNo, UInt64 aBlockCount, byte[] aData);
|
||||||
public abstract void WriteBlock(UInt64 aBlockNo, UInt64 aBlockCount, byte[] aData);
|
public abstract void WriteBlock(UInt64 aBlockNo, UInt64 aBlockCount, byte[] aData);
|
||||||
|
|
||||||
protected void CheckDataSize(byte[] aData, UInt64 aBlockCount)
|
protected void CheckDataSize(byte[] aData, UInt64 aBlockCount)
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,11 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Cosmos.HAL.BlockDevice
|
namespace Cosmos.HAL.BlockDevice
|
||||||
{
|
{
|
||||||
public class Partition : BlockDevice
|
public class Partition : BlockDevice
|
||||||
{
|
{
|
||||||
BlockDevice mHost;
|
private readonly BlockDevice mHost;
|
||||||
UInt64 mStartingSector;
|
private readonly UInt64 mStartingSector;
|
||||||
|
|
||||||
public Partition(BlockDevice aHost, UInt64 aStartingSector, UInt64 aSectorCount)
|
public Partition(BlockDevice aHost, UInt64 aStartingSector, UInt64 aSectorCount)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue