I am writing a device driver.
I have two queries regarding that
When I use InterruptAttach(), the whole system hangs but if I use InterruptAttachEvent(), there is no problem. why?
My device requires
- Make a queue of buffers
- Put the start of the queue into the device register after converting this address into device physical address
I am using calloc function to create queue and then use mem_offset64 () to convert the head address to physical address and put the address into register. I initialize the buffers in queue with invalid values.
The device uses physical address of the buffers in queue to write data while I read using virtual address
Now when the device has something to inform, it uses a buffer from queue to store data and interrupts the processor.
I am getting interrupt but the data in the buffer is still invalid value.
Reading device status reveals that queue is full and no interrupt has been serviced.
The physical address of the queue is same as what I generated using mem_offset64 and the virtual address is same that I am using to read device interrupt data from queue. In other words, when I the physical address in the device register to obtain virtual address, I get same value that I am already using for read.
Now my problem is if both the addresses are correct, where is the device actually writing? Why do not I get to see the data in the interrupt queue?