Skip to content

Commit

Permalink
Merge pull request CosmosOS#2339 from CosmosOS/pci-publicregisterread…
Browse files Browse the repository at this point in the history
…write

Make PCI Read/Write register methods public
  • Loading branch information
valentinbreiz authored Jul 21, 2022
2 parents ea6350b + b048d8f commit 34698c7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions source/Cosmos.HAL2/PCIDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ public static ushort GetVendorID(ushort Bus, ushort Slot, ushort Function)
/// </summary>
/// <param name="aRegister">A register to read.</param>
/// <returns>byte value.</returns>
protected byte ReadRegister8(byte aRegister)
public byte ReadRegister8(byte aRegister)
{
uint xAddr = GetAddressBase(bus, slot, function) | ((uint)(aRegister & 0xFC));
IO.ConfigAddressPort.DWord = xAddr;
return (byte)(IO.ConfigDataPort.DWord >> ((aRegister % 4) * 8) & 0xFF);
}

protected void WriteRegister8(byte aRegister, byte value)
public void WriteRegister8(byte aRegister, byte value)
{
uint xAddr = GetAddressBase(bus, slot, function) | ((uint)(aRegister & 0xFC));
IO.ConfigAddressPort.DWord = xAddr;
Expand All @@ -211,7 +211,7 @@ protected void WriteRegister8(byte aRegister, byte value)
/// </summary>
/// <param name="aRegister">A register.</param>
/// <returns>UInt16 value.</returns>
protected ushort ReadRegister16(byte aRegister)
public ushort ReadRegister16(byte aRegister)
{
uint xAddr = GetAddressBase(bus, slot, function) | ((uint)(aRegister & 0xFC));
IO.ConfigAddressPort.DWord = xAddr;
Expand All @@ -223,21 +223,21 @@ protected ushort ReadRegister16(byte aRegister)
/// </summary>
/// <param name="aRegister">A register.</param>
/// <param name="value">A value.</param>
protected void WriteRegister16(byte aRegister, ushort value)
public void WriteRegister16(byte aRegister, ushort value)
{
uint xAddr = GetAddressBase(bus, slot, function) | ((uint)(aRegister & 0xFC));
IO.ConfigAddressPort.DWord = xAddr;
IO.ConfigDataPort.Word = value;
}

protected uint ReadRegister32(byte aRegister)
public uint ReadRegister32(byte aRegister)
{
uint xAddr = GetAddressBase(bus, slot, function) | ((uint)(aRegister & 0xFC));
IO.ConfigAddressPort.DWord = xAddr;
return IO.ConfigDataPort.DWord;
}

protected void WriteRegister32(byte aRegister, uint value)
public void WriteRegister32(byte aRegister, uint value)
{
uint xAddr = GetAddressBase(bus, slot, function) | ((uint)(aRegister & 0xFC));
IO.ConfigAddressPort.DWord = xAddr;
Expand Down

0 comments on commit 34698c7

Please sign in to comment.