Double-Hit on Interrupt Handler

QNX 6.2.0
x86 (NS Geode GX-1) - Advantech PCM-3350 PC-104 card
Digital I/O card generating IRQ5

The interrupt handler is being called twice for each interrupt generated by
the DIO card.
In the interrupt handler, I:

  • turn on a digital output
  • reset the interrupt on the DIO card
  • turn off the digital output
  • read the digital inputs
  • unmask the interrupt
    A scope trace clearly shows that the IRQ is turning off while the digital
    output is on. However the interrupt handler is immediately reentered once
    more when it calls InterruptWait.

Source snippet - all the I/O handing is contained in the
mClient->hardware_read() call.

ThreadCtl( _NTO_TCTL_IO, 0 );
mINT_event.sigev_notify = SIGEV_INTR;
mInterrupt_ID = InterruptAttachEvent(mIRQ_num, &mINT_event,
_NTO_INTR_FLAGS_END );
if (mInterrupt_ID == -1)
{
perror(“INT_thread::INT_thread - InterruptAttachEvent”);
}

while ( InterruptWait(0, NULL) != -1)
{
// A read to the hardware will clear the interrupt bit on the card.
mClient → hardware_read();
// Clear the interrupt being serviced so it can be used again.
if (-1 == InterruptUnmask( mIRQ_num, mInterrupt_ID ))
{
perror(“INT_thread::Thread_execution - InterruptUnmask”);
}
if (sem_post( mIO_cycle ) == -1)
{
perror(“INT_thread::Thread_execution - sem_post failed”);
}
}

Marty Doane
Siemens Dematic

Marty Doane wrote:

QNX 6.2.0
x86 (NS Geode GX-1) - Advantech PCM-3350 PC-104 card
Digital I/O card generating IRQ5

Is the digital I/O card a PCI card??
If yes … is there an other device sharing that IRQ5 ?

The interrupt handler is being called twice for each interrupt generated by
the DIO card.
In the interrupt handler, I:

  • turn on a digital output
  • reset the interrupt on the DIO card
  • turn off the digital output
  • read the digital inputs

Try to use an ISR (attached with InterruptAttach) which does the
actions listed above. Would be interesting what happens then …

Armin

  • unmask the interrupt
    A scope trace clearly shows that the IRQ is turning off while the digital
    output is on. However the interrupt handler is immediately reentered once
    more when it calls InterruptWait.

Source snippet - all the I/O handing is contained in the
mClient->hardware_read() call.

ThreadCtl( _NTO_TCTL_IO, 0 );
mINT_event.sigev_notify = SIGEV_INTR;
mInterrupt_ID = InterruptAttachEvent(mIRQ_num, &mINT_event,
_NTO_INTR_FLAGS_END );
if (mInterrupt_ID == -1)
{
perror(“INT_thread::INT_thread - InterruptAttachEvent”);
}

while ( InterruptWait(0, NULL) != -1)
{
// A read to the hardware will clear the interrupt bit on the card.
mClient → hardware_read();
// Clear the interrupt being serviced so it can be used again.
if (-1 == InterruptUnmask( mIRQ_num, mInterrupt_ID ))
{
perror(“INT_thread::Thread_execution - InterruptUnmask”);
}
if (sem_post( mIO_cycle ) == -1)
{
perror(“INT_thread::Thread_execution - sem_post failed”);
}
}

Marty Doane
Siemens Dematic

In article <b331g1$m18$1@inn.qnx.com>, a-steinhoff@web.de says…

Marty Doane wrote:
QNX 6.2.0
x86 (NS Geode GX-1) - Advantech PCM-3350 PC-104 card
Digital I/O card generating IRQ5

Is the digital I/O card a PCI card??
If yes … is there an other device sharing that IRQ5 ?

LPT loves to use IRQ5. Also interesting in which mode QNX puts this interrupt line to edge or level
sensitive mode? I’ll not surprised if it’s edge-triggered mode for legacy ISA devices :slight_smile:
Eduard.

Marty Doane <martin.doane@siemens.com> wrote:

QNX 6.2.0
x86 (NS Geode GX-1) - Advantech PCM-3350 PC-104 card
Digital I/O card generating IRQ5

Is the digital I/O card a PCI card??

No, it’s on the PC-104 bus.

If yes … is there an other device sharing that IRQ5 ?

Nothing else sharing the interrupt.

LPT loves to use IRQ5.

LPT is disabled, and would have used IRQ7. And no printer driver running.

Do you have the ability to monitor the INT5 line on the 8259A?

If it is still active when the EOI is issued and the 8259A is set for
level sensitive interrupts, a new interrupt will be issued the instant
the EOI is issued.


Bill Caroselli – Q-TPS Consulting
1-(626) 824-7983
qtps@earthlink.net

QNX 6.2.0
x86 (NS Geode GX-1) - Advantech PCM-3350 PC-104 card
Digital I/O card generating IRQ5

Is the digital I/O card a PCI card??

No, it’s on the PC-104 bus.

If yes … is there an other device sharing that IRQ5 ?

Nothing else sharing the interrupt.

LPT loves to use IRQ5.

LPT is disabled, and would have used IRQ7. And no printer driver running.

Also interesting in which mode QNX puts this interrupt line to edge or
level
sensitive mode? I’ll not surprised if it’s edge-triggered mode for legacy
ISA devices > :slight_smile:
Eduard.

QNX 6.2.0
x86 (NS Geode GX-1) - Advantech PCM-3350 PC-104 card
Digital I/O card generating IRQ5

Is the digital I/O card a PCI card??

No, it’s on the PC-104 bus.

If yes … is there an other device sharing that IRQ5 ?

Nothing else sharing the interrupt.

LPT loves to use IRQ5.

LPT is disabled, and would have used IRQ7. And no printer driver
running.

Do you have the ability to monitor the INT5 line on the 8259A?

I’ve been monitoring the IRQ5 line on the PC-104 bus. I’m assuming that goes
directly to the IRQ5 input on the PIC. The PIC is actually contained in a
CS5530A I/O Companion chip from NS.

If it is still active when the EOI is issued and the 8259A is set for
level sensitive interrupts, a new interrupt will be issued the instant
the EOI is issued.

The IRQ5 line on the bus is definitely inactive when the InterruptUnmask
call is made. I assume that’s when the EOI would be issued.
Seems like the next step is to try to monitor the INTR line to the CPU. I
don’t know if we can get at it or not.

Thanks,
Marty

On Fri, 21 Feb 2003 11:15:55 -0500, “Marty Doane” <martin.doane@siemens.com> wrote:

QNX 6.2.0
x86 (NS Geode GX-1) - Advantech PCM-3350 PC-104 card
Digital I/O card generating IRQ5

Is the digital I/O card a PCI card??

No, it’s on the PC-104 bus.

If yes … is there an other device sharing that IRQ5 ?

Nothing else sharing the interrupt.

LPT loves to use IRQ5.

LPT is disabled, and would have used IRQ7. And no printer driver
running.

Do you have the ability to monitor the INT5 line on the 8259A?

I’ve been monitoring the IRQ5 line on the PC-104 bus. I’m assuming that goes
directly to the IRQ5 input on the PIC. The PIC is actually contained in a
CS5530A I/O Companion chip from NS.

If it is still active when the EOI is issued and the 8259A is set for
level sensitive interrupts, a new interrupt will be issued the instant
the EOI is issued.

The IRQ5 line on the bus is definitely inactive when the InterruptUnmask
call is made. I assume that’s when the EOI would be issued.
Seems like the next step is to try to monitor the INTR line to the CPU. I
don’t know if we can get at it or not.

Is the audio disabled?
This is also emulated by the chip, and by default would use IRQ5.

QNX 6.2.0
x86 (NS Geode GX-1) - Advantech PCM-3350 PC-104 card
Digital I/O card generating IRQ5

Is the digital I/O card a PCI card??

No, it’s on the PC-104 bus.

If yes … is there an other device sharing that IRQ5 ?

Nothing else sharing the interrupt.

LPT loves to use IRQ5.

LPT is disabled, and would have used IRQ7. And no printer driver
running.

Do you have the ability to monitor the INT5 line on the 8259A?

I’ve been monitoring the IRQ5 line on the PC-104 bus. I’m assuming that
goes
directly to the IRQ5 input on the PIC. The PIC is actually contained in
a
CS5530A I/O Companion chip from NS.

If it is still active when the EOI is issued and the 8259A is set for
level sensitive interrupts, a new interrupt will be issued the instant
the EOI is issued.

The IRQ5 line on the bus is definitely inactive when the InterruptUnmask
call is made. I assume that’s when the EOI would be issued.
Seems like the next step is to try to monitor the INTR line to the CPU.
I
don’t know if we can get at it or not.

Is the audio disabled?
This is also emulated by the chip, and by default would use IRQ5.

Yes, disabled.

Solved. My coworker was somehow activating multiple threads that each called
InterruptAttachEvent. The OS was doing a great job of servicing both of
them.

Marty Doane
Siemens Dematic