On Mon, Apr 18, 2011 at 8:14 PM, Ardelean, Andrei <Andrei.Ardelean@xxxxxxx> wrote: > Mmap() worked fine for one io memory region, but when I tried to open > twice for different io memory regions with different base addresses and > sizes it didn't work. It returned the same memory pointer value in both > cases. In my design the h/w guys put those h/w registers in two distinct > memory mapped regions with a large reserved area in between. Is it any > solution for this case? This works for me. Unlike QNX, you can only map multiples of the page size and the base must also be aligned on a page boundary: #define MMIO 0x11900000 /* SYS_xxx */ #define MMIO2 0x14000000 /* MEM_xxx */ memfd = open("/dev/mem", O_RDWR); pgsize = sysconf(_SC_PAGESIZE); mmio = (unsigned long)mmap(0, pgsize, PROT_READ | PROT_WRITE, MAP_SHARED, memfd, MMIO); mmio2 = (unsigned long)mmap(0, 2 * pgsize, PROT_READ | PROT_WRITE, MAP_SHARED, memfd, MMIO2); Manuel