I am writing a QNX driver for PCI device. I am using QNX 6.2.1A OS
my main function works as follows:
- attach pci server
- Detect and attach the device using pci_attach_device()
- Read the BAR0 offset using pci_read_config into a variable addr
- map the memory address addr to process address space . I tried allocation using both mmap and mmap_device_memory. The handle for address is stored in mem_hndl (pointer to void).
- try to read and write at various offsets from mem_hndl
- Unmap device memory
- detach device
- detach pci server
my problem is
when i read the device as in step 5:
I get 0xffffffff at any offset irrespective of what i read or write if memory has been mapped using mmap_devicce_memory
if i use mmap to map memory of device, i am able to read and write
but the problem is that I perform soft reset of device by writing to a bit of request register (mapped into memory) and this value stays same after reset.
I am not sure whether my map is correct when i using mmap and
I want to know what is the problem with mmap_device_memory return base because I cannot write to this map nor read from it? I use PROT_WRITE|PROT_READ|PROT_NOCACHE for protection pqrameter
Please help me in this regard
Regards
Moreshwar