HELP required with PCI driver

I am writing a QNX driver for PCI device. I am using QNX 6.2.1A OS

my main function works as follows:

  1. attach pci server
  2. Detect and attach the device using pci_attach_device()
  3. Read the BAR0 offset using pci_read_config into a variable addr
  4. 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).
  5. try to read and write at various offsets from mem_hndl
  6. Unmap device memory
  7. detach device
  8. 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

Please don’t cross post in multiple forums. See my response in the other forum.

Rick…