pci card resource manager problem

I have a pci framegrabber card with two apertures (offsets defined in BADR0
and BADR1 of the configuration space). I am using mmap_device_memory as
shown below. I can read and write to the first set of registers fine but
writing to the second set does not alter their value. In fact the second
set of registers each hold their offset address no matter what I write to
them. The documentation states that all registers are read/write and 32
bits. Does anyone know what I have done wrong?


// Map registers to pointer in virtual address space
first_regbase = (uint32_t *) mmap_device_memory(NULL,
info.BaseAddressSize[0], PROT_READ|PROT_WRITE|PROT_NOCACHE, 0,
info.CpuBaseAddress[0]);
second_regbase = (uint32_t *) mmap_device_memory(NULL,
info.BaseAddressSize[1], PROT_READ|PROT_WRITE|PROT_NOCACHE, 0,
info.CpuBaseAddress[1]);

if ( first_regbase == MAP_FAILED || second_regbase == MAP_FAILED)
printf(“Problem with mmap_device_memory”);

printf(“first = 0x%x\n”, first_regbase[0]);
printf(“second = 0x%x\n”, second_regbase[0]);

first_regbase[0] = 0x00000000; // This one works
second_regbase[0] = 0x00000000; // This one doesn’t
work

printf(“first = 0x%x\n”, first_regbase[0]);
printf(“second = 0x%x\n”, second_regbase[0]);

\

Paul.