c - Efficient mapping of hardware I/O space into Linux virtual space -


I am working with embedded ARM and hard-wired IP blocks on a SOC. Each hardware block is a mapped memory in the ARM space, i.e. in place of the 32-bit address of the registrar ARM CPU controlling the hardware block. I have Linux running on this CPU.

To access the hardware blocks, I use the MAMAP in the app which can be run as root:

  fd = open ("/ dev / Mem ", O_RDWR | O_SYNC); Mptr = mmap (zero, mem_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, phy_addr);  

Before developing BSP for other software engineers to develop the code, I want to understand some things:

  1. Is MAP_SHARED correct Have to work or do I need MAP_NORESERVE? Basically, I'm reaching the hardware registers so I do not have to assign swap space, right?

  2. How do I make sure that the virtual space (MPTR) does not go through the cache? The volatile keyword is only for compiler optimization.

  3. The entire hardware space is really huge - 16 MB (many SRAM and many registers) Whether the lamp parameter can be bigger in mmap or what page tables and mapping Can there be trouble in making? Do I need to create different virtual memory pointers or can I just get the MPR and then read the physical address offset and hardware address and join it happily?

Thanks a lot,


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -