From 098963a1ffdaad3e16dce2d50e287dfc4713792b Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Fri, 22 Dec 2017 16:24:04 +0300 Subject: [PATCH] [PciDevice] Add EnableBusMaster --- source/Cosmos.HAL2/PciDevice.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/source/Cosmos.HAL2/PciDevice.cs b/source/Cosmos.HAL2/PciDevice.cs index 572a6c928..6419beceb 100644 --- a/source/Cosmos.HAL2/PciDevice.cs +++ b/source/Cosmos.HAL2/PciDevice.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -198,6 +198,20 @@ namespace Cosmos.HAL WriteRegister16(0x04, command); } + public void EnableBusMaster(bool enable) + { + UInt16 command = ReadRegister16(0x04); + + UInt16 flags = (1 << 2); + + if (enable) + command |= flags; + else + command &= (ushort)~flags; + + WriteRegister16(0x04, command); + } + public class DeviceClass { public static string GetString(PCIDevice device) @@ -345,4 +359,4 @@ namespace Cosmos.HAL get { return isIO; } } } -} \ No newline at end of file +}