Hello,
I’m using QNX6.5 SP1, and try to make a driver for FlexCAN.
using this code to test my interrupt handler, Sometimes it work correctly (the program receive 10 interrupts and printf “itr receive : 10”)
and the most of times, it nb_it jump with 200, don’t increment correclty and blocks in InterruptWait(0,NULL) (I can see this with debugger), then the programm doesn’t change in case future interrupts
I don’t understand why 200 and why it does this, knowing that it can do it at any time of increment
[code]#include <stdio.h>
#include <stdlib.h>
#include <sys/neutrino.h>
#include <string.h>
#include <sys/mman.h>
#include <hw/inout.h>
#include <stdint.h>
const struct sigevent *neutrino_handler(void *data, int id);
volatile uintptr_t ptr;
struct sigevent event;
int nb_it=0;
int main(void) {
int i;
int itr_ret;
ThreadCtl(_NTO_TCTL_IO, 0);
ptr= mmap_device_io(0x10,0x2090028);
event.sigev_notify = SIGEV_INTR;
itr_ret=InterruptAttach(142, neutrino_handler,
NULL, 0,
0);
if(itr_ret==-1)
printf("erreur attach\n");
for (i=0;i<10;i++)
{
InterruptWait(0,NULL); // wait for interrupt
}
printf(“itr received : %d\n”,nb_it);
InterruptDetach(itr_ret);
return EXIT_SUCCESS;
}
const struct sigevent *
neutrino_handler(void *data, int id)
{
InterruptDisable(); // _disable();
out32(ptr+8, 0x10); //clear interrupt
nb_it++;
InterruptEnable();
return(&event);
}[/code]