serial driver : IRQ and PCI

Hello,

I work on a QNX driver for a PCI board based on an XR17D158 from Exar. This board provides 6 RS485 serial links.
I have started the developpement using the devc_ser8250 source on x86.

What I have done :
1- read the interrupt line (5) in pci local bus configuration register. This interrupt line is shared with an other device (Intelligent I/O).
2- configure the serial links
3- disable interrupt, clear the device by reading RX, TX, LS, … registers
4- do the interrupt attach on my interrupt handler.
5- enable the interrupt

I send a character on the serial link, and my interrupt handler is not called!

I have checked that, just before sending my character, the interrupt registers of the exar which give the interrupt source are empty.
I am able to read the characters in RX register, to read the LS register, and just after the interrupt register are cleaned again.

I have several questions :

  • How I can know if interrupts are level or edge triggered?
  • If I do a “pci -v”, I can read :
    PCI Int Pin = INT A
    Interrupt line = 5
    CPU Interrupt = 5h
    What is the difference between interrupt line and CPU interrupt?
    If I change the interrupt line using pci_map_irq, the CPU interrupt is not changed.
    - Is it possible to know the state or level of a given IRQ with QNX? I wish to check if the IRQ 5 is not always activated (in high level).
    - The IRQ 5 is shared with an other device. Could it explain my issue?

Many thanks for our help.

Alexandre

Hello Alexandre

Generally PCI interrupts are level triggered ( in opposite of edge triggered as on ISA bus) .
But in fact if you enable Transmit interrupt, and if your transmitter is empty, your handler would be called immediatly even before you send a first byte to the serial controler.
I don’t know if you can read the interrupt level state with a QNX call ( I don’t think so).
If you share the interrupt level with other device, you’ll be called even when you are not the source of the interrupt.
IMHO QNX actually don’t use directly interrupt handler in their drivers but rather interrupt event technics.

I don’t if that help you.

Philippe

One minor point. I haven’t looked at the serial driver, but I’m willing to bet it does some processing in the interrupt handler, and not just after a thread is woken up. Why is this? Well a basic 8250 chip can support 38400baud, which involves about 4000 interrupts a second. Imagine there were a task switch every time this occured.

Thanks for your help!

In fact, there is an hardware issue on the board ( the PCI chip of the board is on interrupt pin A, and the board itself is on interrupt pin B…)

I hanve another small question about devc_ser8250 driver.
The interrupts are enabled by writing in interrupt enable register before interrupt_attach.
Can we do this after interrupt attach?
(In any case the interrupt is masked until interrupt attach)

Best regards,

Alexandre Pineau

Yes, you can.