A problem with InterruptWait()

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

Would you please give me advice? Your prompt reply will be highly appreciated.

How did you map the device, are you sure ptrAddr1 point at the board, correctly?

Thank you for your answer. I’ve maped memory with mmap_device_memory function. Device have a 128 KBytes address space, it work correct, because simple functions like lighting LED works fine.
Here is my code:

unsigned char *devMemAddr, *ptrAddr0, *ptrAddr1;


devMemAddr = (unsigned char *) mmap_device_memory(
 if((void *)devMemAddr == MAP_FAILED)
    	   errx(1, "Map failed\n");

ptrAddr0 = devMemAddr + 1;
ptrAddr1 = ptrAddr0 + 1;


Not in a position to verify my statement, I think you might have to call InterruptUnmask.

Thank you very much, i’ve used InterruptWait() and now all work correct.