Esempio n. 1
0
        /// <summary>
        /// Sets an interrupt handler for a PCI device
        /// </summary>
        /// <param name="dev">The device</param>
        public static void SetInterruptHandler(PciDevice dev, IRQ.IRQHandler handler)
        {
            // Get IRQ routing data from table
            PciIRQEntry irq    = m_irqTable[(dev.Slot * PCI_PINS) + (dev.IRQPin - 1)];
            uint        irqNum = irq.Irq;

            // If no routing exists, use the interrupt line
            if (irqNum == 0)
            {
                irqNum = dev.IRQLine;
            }

            // First set the IRQ handler to avoid race conditions
            IRQ.SetHandler(irqNum, handler);
            IOApicManager.CreateEntry(irqNum, irqNum, irq.Flags);

            // Info
            Console.Write("[PCI] Set device to use IRQ ");
            Console.WriteNum((int)irqNum);
            Console.Write('\n');
        }