mmap, cache and libraries
I have a trouble with a user space driver for a PCI board on a PC running linux (gento ditrib).
I tried to apply solutions from the "Linux Device Driver" book without success.
Here is the problem :
the software has to poll a PCI register to get results from the board
but sometimes the register value changes (from the board) and the corresponding variable in software don't. I've seen this because an other application gets the correct value from this register.
To do this I've mapped the register to the user memory space with a map command :
volatile int *mapPointer;
mapPointer= mmap(NULL, BAR2_BLOCK_SIZE,PROT_READ|PROT_WRITE, MAP_SHARED, memFileId, avnetCard.bar2);
It happens the status to be 0 while the board says it's 1 . Also, an other application, which only checks the status register, says it's 1.
I believe it's a cache problem or a compiler optimization.
I tried to use the pgprot_noncached macro without success.
if I include
I have several errors.
Please, which is the way to get this problem solved ?
Thanks a lot