cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rohithsaradhy
Observer
Observer
2,352 Views
Registered: ‎05-11-2018

MMAP operation not permitted on /dev/mem [ZYNQ Ultrascale+, Trenz 820 board]

Jump to solution

Hi all, 

I am trying to copy data from the PL to the PS using the DMA engine. I am not able to set the target memory region using mmap. Part of the code is attached here. 

 

#define TARGET_REG  0x0f000000
#define DATA_SIZE 512
#define MAP_SIZE 4096UL
#define MAP_MASK (MAP_SIZE - 1)

#define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \
  __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0)

int main() {

int dh = open("/dev/mem", O_RDWR | O_SYNC); // Open /dev/mem which represents the whole physical memory unsigned int* virtual_address = mmap(NULL, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, dh, 0x80000000); // Memory map AXI Lite register block if(virtual_address == (void *) -1) FATAL; unsigned int* virtual_destination_address = mmap(NULL, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, dh,TARGET_REG ); // Memory map destination address if(virtual_destination_address == (void *) -1) FATAL; return 0;

}
The error that I get is "Operation Not Permitted". Note that the error is generated from the "virtual_destination_address" in the code.
 

Here is the address map:

image.png

This code used to work for Cora Z7 with a Zynq 7000 [after adjusting for the address map]. 
 
Best,
Rohith
 

 

0 Kudos
1 Solution

Accepted Solutions
rohithsaradhy
Observer
Observer
2,263 Views
Registered: ‎05-11-2018
0 Kudos
1 Reply
rohithsaradhy
Observer
Observer
2,264 Views
Registered: ‎05-11-2018
0 Kudos