Interrup handler

Hi, I need some help.

I have written interrupt handler of IRQ7(LPT 1) in QNX 6.0.
IRC generates interrupt on LPT for a long time, but interrupt handler is
performed only some times and further nothing. The thread waiting for
interupt, that is generated, but don’t catch the interrupt.

Thank you for your help.

#include <sys/neutrino.h>
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <sys/mman.h>
#include <hw/inout.h>
#include <sys/siginfo.h>

#define IRQ7 7

int id;
volatile int i = 0;
struct sigevent event;

const struct sigevent *isr_handler(void *arg, int id)
{
i++;
return(&event);
}

void *int_thread(void *arg)
{
unsigned char port;

ThreadCtl(_NTO_TCTL_IO, NULL);
port = in8(0x37A);
port & = 0x0DF;
port |= 0x10;
out8(0x37A, port);

id = InterruptAttach(IRQ7, isr_handler, NULL, 0, 0);

while(1)
{
InterruptWait(NULL, NULL);
printf(“number of interrupts %d \n”, i);
}
}

main()
{
SIGEV_INTR_INIT(&event);
pthread_create(NULL, NULL, int_thread, NULL);

getchar();
}

In article <b3d1fm$ssp$1@inn.qnx.com>, J.Pajer@sh.cvut.cz says…

Hi, I need some help.

I have written interrupt handler of IRQ7(LPT 1) in QNX 6.0.
IRC generates interrupt on LPT for a long time, but interrupt handler is

Excuse my ignorance, who does generate interrupt? and what is frequency of interrupts? Does it work
if that IRC generates an interrupt (toggle -ACK line?) once in a 1 or even 2 seconds?

Eduard.

“Eduard” <ed1k@humber.bay> wrote in message
news:MPG.18c480548ebb869d98969e@inn.qnx.com

In article <b3d1fm$ssp$> 1@inn.qnx.com> >, > J.Pajer@sh.cvut.cz > says…

Hi, I need some help.

I have written interrupt handler of IRQ7(LPT 1) in QNX 6.0.
IRC generates interrupt on LPT for a long time, but interrupt handler is

Excuse my ignorance, who does generate interrupt? and what is frequency of
interrupts? Does it work
if that IRC generates an interrupt (toggle -ACK line?) once in a 1 or even
2 seconds?

Eduard.

I control rotation speed of DC motor that is scanned with IRC. Whole is
preparation that generate interrupt when change state of IRC (this work
perfect). State changes is 16 per one rotation, that’s mean 16 interrupt per
one rotation. Max. motor speed is 6000 RMP.
Frequency = <0, 16*6000 interrupts per minute>.

I think, that problem is otherwhere, because when motor stop (no interrupt
is generate) interrupt handler is performed.

I apologize for my English.

In article <b3fi09$pa7$1@inn.qnx.com>, J.Pajer@sh.cvut.cz says…

I control rotation speed of DC motor that is scanned with IRC. Whole is
preparation that generate interrupt when change state of IRC (this work
perfect). State changes is 16 per one rotation, that’s mean 16 interrupt per
one rotation. Max. motor speed is 6000 RMP.
Frequency = <0, 16*6000 interrupts per minute>.

So, maximal interrupt rate is 16*6000= 96000 ints/min or maximal frequency is
1.6 kHz. You can’t do printf() in your interrupt handler. While your interrupt thread is printing
out there are lots of interrupt requests, because printf() is not something fast… it takes huge
amount of time.

I think, that problem is otherwhere, because when motor stop (no interrupt
is generate) interrupt handler is performed.

There is one-entry (at least) queue for pending interrupt, this could explain why your interrupt
handler is executed when there is no actual interrupt request on the line.

While you’re testing your interrupt handler (I believe that’s why you’re sending data through LPT,
but not receiving… receiving is more appropriate for your task, IMO) you can change data which are
sent through LPT in interrupt handler instead of printf(). Then connect oscilloscope to -ACK line
and to some data line and see if every low level (active) signal on -ACK leads the data line
changing.

Good luck,
Eduard.