User Tools

Site Tools


access_memory-mapped_accelerators_on_fpga_from_software_on_arm_with_os

The key is the Unix system call – mmap function.

The idea is to use mmap function to map a memory-mapped components on FPGA, or a contiguous non-cacheable region of physical memory (not managed by the OS virtual memory) to the current software process's virtual memory space.

Here is an example C++ code.

  1. The main function starts with opening the /dev/mem device file.
  2. Then the first mmap function call requests to map a region of kSdramSize bytes of physical memory starting at kSdramPhysicalAddress, to the current program's virtual memory (referenced by sdram_mmap).
  3. The second mmap function maps konChipBufferSize bytes of on-chip buffer starting at kOnChipBufferPhysicalAddressL3, to the virtual memory (referenced by ocb_mmap).

The rest of the program then moves data back-and-forth between SDRAM and on-chip buffer using the 'memcpy' system call.

access_memory-mapped_accelerators_on_fpga_from_software_on_arm_with_os.txt · Last modified: 2016/05/30 13:40 by lianruo