Hi all,
I’am programming now a driver for PCI device with FPGA on board. The device making some operations (checks) inside itself. For the new check launching i need to write check code to the some address in device address space. And then i should waiting interrupt. BIOS give for my device IRQ 12. There are no more devices in system have same IRQ.
After calling of InterruptWait() function thread of my resource manger falling to the blocked state and forever wait for the interrupt. In Windows 7 same device work fine, i.e. the problem not in device.
I’ve realised needing operations inside io_devctl function. There is a problem part of my code (inside switch body):
memset(&event, 0, sizeof(event));
event.sigev_notify = SIGEV_INTR;
intrId = InterruptAttachEvent (intrNum, &event, _NTO_INTR_FLAGS_PROCESS );
if(intrId < 0)
{
errx(1, "Interrupt attaching fail\n");
}
fprintf(stdout, "Intr %d attach\n", intrNum);
//writing check code in needing bit of addr0
*(ptrAddr0) = ctlCode(msg->i.dcmd);
InterruptWait (0, NULL);
fprintf(stdout, "Interrupt recieved\n");
//checking of device interrupt address
if(*(ptrAddr3) == 0x1)
{
//interrupt rest
*(ptrAddr2) = 0x1;
fprintf(stdout, "Intr reset\n");
//reading of check result
if((*(ptrAddr0) >> msg->i.dcmd) == 0x1)
{
fprintf(stdout, "Check result is success\n");
*(int *) data = 0x1;
}
else if((*(ptrAddr1) >> msg->i.dcmd) == 0x1)
{
fprintf(stdout, "Check result is fail\n");
*(int *) data = 0x0;
}
}
//interrupt detaching
InterruptDetach(intrId);
Would you please give me advice? Your prompt reply will be highly appreciated.