ISR never get called when an interrupt occurs

I’m using a A/D ISA board (keithley DAS-1802HR) on QNX 6.3.0 service Pack 2 for data collection. The counter on this board is programmed to generate interrupt to the host. My problem is: the ISR which is attached to the IRQ never get called when the interrupt is generated, I can check from the status register on the board that the interrupt does occur. Here is my code related with the interrput process. What’s wrong with my code?

#define IRQ 5
#define base_add 0x300 //ISA board address
int count = 0;

extern const sigevent *send_control(void *arg, int id)
{
count += 1;
//check the status register on the board to interrupt
if(!(int8(base_add+7) & 0x1))
return NULL;
//do some A/D reading

}

int main()
{
int interpt_no;
int ttl_cnt = 1000;

if(ThreadCtrl(_NTO_TCTL_IO, 0) == -1)
exit(1);

//initiate the board

//set interrupt routine
InterruptDisable();
interpt_no = InterruptAttach(IRQ, send_control,
NULL, 0, _NTO_INTR_FLAGS_TRK_MSK);
if(interpt_no == -1)
return -1;
out8(base_add+5,0xd0) //set board interrupt level to IRQ:5
out8(base_add+7,0x80) //start counter on the board
InterruptUnmask(IRQ, interpt_no);
InterruptEnable();

while(count < ttl_cnt)
{
InterruptWait(0, NULL);
printf(“interrupt! count is %d\n”, count);
InterruptUnmask(IRQ, interpt_no);
}

out8(base_add+5,0x00) //disbable board interrupt
if(InterruptDetach(interpt_no) == -1)
printf(“detach error\n”);

return 0;
}

The ISR “send_control” never get called even if an interrupt occured, which I can check from the status register after the program running. Can somebody help me out?

Thanks!
Yicheng

it seems nobody knows the answer, sigh! Can someone post an example of how to use interrupt on keyboard? it should be much simple.

hi,

i have the same problem - i know that irq5 will be used by the system (printer/soundcard) - try to disable this hardware in the bios - and test it again!

matthias

A few things…

InterruptAttach() will automatically unmask the interrupt, so the InterruptUnmask is not required.
Also, InterruptWait() will only unblock when you return a struct sigevent of t ype SIGEV_INTR from the interrupt handler
Lastly, InterruptAttach will mask the interrupt, call your interrupt handler, and then unmask it again, whereas InterruptAttachEvent() will mask the interrupt and return the event, without unmasking. So if you are using InterruptAttach then you don’t need the InterruptUnmask in your loop.

BTW - is InterruptWait ever returning?