Beispiel #1
0
        public static void StartISADevice(ISADeviceDriverRegistryEntry driver)
        {
            var hardwareDevice = driver.Factory() as IHardwareDevice;

            var ioPortRegions = new List <IOPortRegion>();
            var memoryRegions = new List <MemoryRegion>();

            ioPortRegions.Add(new IOPortRegion(driver.BasePort, driver.PortRange));

            if (driver.AltBasePort != 0x00)
            {
                ioPortRegions.Add(new IOPortRegion(driver.AltBasePort, driver.AltPortRange));
            }

            if (driver.BaseAddress != 0x00)
            {
                memoryRegions.Add(new MemoryRegion(driver.BaseAddress, driver.AddressRange));
            }

            //if (driver.PhysicalMemory != null)
            //{
            //	foreach (var physicalMemory in driver.PhysicalMemory)
            //	{
            //		if (physicalMemory.MemorySize > 0)
            //		{
            //			var memory = HAL.AllocateMemory(physicalMemory.MemorySize, physicalMemory.MemoryAlignment);

            //			memoryRegions.Add(new MemoryRegion(memory.Address, memory.Size));
            //		}
            //	}
            //}

            var interruptHandler = new InterruptHandler(InterruptManager, driver.IRQ, hardwareDevice);

            var hardwareResources = new HardwareResources(ioPortRegions, memoryRegions, interruptHandler);

            hardwareDevice.Setup(hardwareResources);

            if (!hardwareDevice.Probe())
            {
                return;
            }

            DeviceManager.Add(hardwareDevice);

            hardwareResources.EnableIRQ();

            hardwareDevice.Start();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="HardwareResources" /> class.
 /// </summary>
 /// <param name="ioPortRegions">The io port regions.</param>
 /// <param name="memoryRegions">The memory regions.</param>
 /// <param name="interruptHandler">The interrupt handler.</param>
 public HardwareResources(List <IOPortRegion> ioPortRegions, List <MemoryRegion> memoryRegions, InterruptHandler interruptHandler)
 {
     this.ioPortRegions    = ioPortRegions;
     this.memoryRegions    = memoryRegions;
     this.interruptHandler = interruptHandler;
 }