Hello.
Since my card is working properly, I’m trying to write an ISR.
After starting this my system hangs up and i don’t know why. I’m working on
x86 and I’ve read this:
http://www.qnx.com/developers/docs/qnx_6.1_docs/neutrino/prog/inthandler.html
It seems, that I don’t handle the InterruptAttach()-function right, but
don’t find my fault.
Tobias
// this thread is dedicated to handling and managing interrupts
void * int_thread (void *arg){
int interruptID = 0;
// _uint32 intevent;
struct sigevent *event;
ThreadCtl (_NTO_TCTL_IO, NULL); // enable I/O privilege
printf(“test\n”);
// attach the ISR to IRQ 11
interruptID = InterruptAttach (11, isr_handler, &event, sizeof(event), 0);
printf(“InterruptID = %d\n”, interruptID);
if (interruptID == -1){
printf(“InterruptAttach() failed!\n”);
exit(-1);
}
while (1){
InterruptWait (NULL, NULL);
// do the work
printf("\nInterrupt angekommen!!!\n");
}
}
// this is the ISR
const struct sigevent * isr_handler (void *area, int id){
// get and set registers
intevent = *IEEE1394_HW_OHCI_GetReg(OHCI1394_IntEventClear);
IEEE1394_HW_OHCI_SetReg(OHCI1394_IntEventClear, intevent &
~OHCI1394_busReset);
if (!intevent) return NULL;
else SIGEV_INTR_INIT( (struct sigevent *) area );
return (area);
}
int main(){
IEEE1394_HW_PCI_Init(); /* initialising my card */
// start up a thread that is dedicated to interrupt processing
pthread_create (NULL, NULL, &int_thread, NULL);
/* Allow threads to run for 2 seconds. */
sleep( 2 );
}