Hello there.
I'm writing my serial driver and my initial approach was to detect the port where the serial interrupt comes from
by registering 4 different interrupt handlers.
The problem is that, afaik COM1 uses the same IRQ (4) as COM3 and COM2 uses the same (3) as COM4, so my method plainly wont work
as two COM ports would use the same IRQ.
How would you approach this? Perhaps there is some reference to the serial device interrupting inside the interrupt frame?
Thank you so much in advance!
How to know which COM triggered the interrupt
-
- Posts: 18
- Joined: Mon Aug 15, 2022 12:30 pm
Re: How to know which COM triggered the interrupt
How about polling each serial port after an interrupt to see which one(s) have data ready?
-
- Member
- Posts: 5562
- Joined: Mon Mar 25, 2013 7:01 pm
Re: How to know which COM triggered the interrupt
The ISA serial port that triggered the interrupt will be the one that you have enabled, because you can't enable IRQs for two ISA serial ports on a single ISA IRQ line at once. Attempting to do so may damage your hardware.
PCI(e) serial ports don't have this limitation, but they're not really standardized. If your PCI(e) serial port uses an 8250-compatible UART, you'll probably need to read the interrupt identification register to see if it's responsible for the IRQ.
PCI(e) serial ports don't have this limitation, but they're not really standardized. If your PCI(e) serial port uses an 8250-compatible UART, you'll probably need to read the interrupt identification register to see if it's responsible for the IRQ.
Re: How to know which COM triggered the interrupt
That would be true of an actual ISA adapter card that goes into an ISA slot on an early eighties computer, such as the original IBM PC. Today's PCs have built in serial ports, and there is no problem.
Re: How to know which COM triggered the interrupt
It's a bit complicated when several serial ports share the same IRQ. At least with typical sharing when the IRQ handlers run after each other. That's because the hardware interface was not designed for sharing.
-
- Member
- Posts: 5562
- Joined: Mon Mar 25, 2013 7:01 pm
Re: How to know which COM triggered the interrupt
Maybe, but I'm not aware of any way to detect whether it will work other than trying it (which risks damaging that ISA adapter card).Gigasoft wrote:That would be true of an actual ISA adapter card that goes into an ISA slot on an early eighties computer, such as the original IBM PC. Today's PCs have built in serial ports, and there is no problem.
Re: How to know which COM triggered the interrupt
If the device was declared by ACPI or is an EISA PNP device, then the resource descriptor will indicate if it supports IRQ sharing. If it was manually declared by the user or manufacturer, then they know how the port is connected and if it supports IRQ sharing.
If a device was found through guessing, and the address is within the decode range of any PCI device whose vendor/device ID indicates a known device that does not have adapter slots, then you know it does not reside on an ISA adapter and there shouldn't be an electrical issue. Same if the host bridge is configured not to forward the address to the PCI/PCIe bus.
If a device was found through guessing, and the address is within the decode range of any PCI device whose vendor/device ID indicates a known device that does not have adapter slots, then you know it does not reside on an ISA adapter and there shouldn't be an electrical issue. Same if the host bridge is configured not to forward the address to the PCI/PCIe bus.