This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

mmap failed if address is not the start of GPIO group

Other Parts Discussed in Thread: OMAP3530

Hi,

I amusing mmap to map the GPIO register so that I can monitor their setting like the input/output direction:

mmap_addr = mmap(NULL, mem_size, PROT_READ|PROT_WRITE, MAP_SHARED, gpio_fd,mem_start);
    if (mmap_addr == MAP_FAILED) {
            printf("gpio mmap() failed!\n");
            exit(1);
    }

If I set mem_start to the start of any of the GPIO groups, it works fine. Otherwise mmap() fails. For example

mem_start = 0x49052000 (GPIO group 3) mmap() works fine

mem_start = 0x49052034 (Group 3 CTRL register) mmap() fails.

 

Does anyone have any idea why it does that? I am very confused.

Platform: Omap3530, Linux

Thanks,

Max