UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Explorer
Explorer
145 Views
Registered: ‎05-14-2017

Wrong address returned by mmap

Hi,

I am using he AXI DMA (on an UltraZed EG board) to inject data into the DDR system and reading it from Linux.

The C code regarding this task is the following:

#define DDR_ADDR_LOW (uint32_t) 0x00000000
#define DDR_ADDR_HIGH (uint32_t) 0x1fffffff
#define SAXI_DMA_BASE_ADDR (uint32_t) 0x80000000

uint32_t *ddrp = NULL;
int32_t sh_mem_fd = open("/dev/mem", O_RDWR | O_SYNC);
saxi_addr = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, sh_mem_fd, SAXI_DMA_BASE_ADDR);
ddrp = mmap(NULL, 4096, PROT_READ, MAP_SHARED, sh_mem_fd, DDR_ADDR_LOW);

This should be correct according to Vivado addresses memory map

Screenshot_2019-12-09_12-16-59.png

The problem is the wrong address pointed to by ddrp as a result of the mmap function.

When I print the address pointed to ddrp

printf("ddrp = %p\n", ddrp);

it results to be

ddrp = 0xffffffffffffffff

which is obviously wrong.

The problem raised after enabling USB 3.0 support as detailed in my last post

https://forums.xilinx.com/t5/Embedded-Linux/USB-3-0-pendrive-not-recognized-petalinux-kernel-4-19-0-xilinx/m-p/1052994#M38719

Before that I could correctly mmap the DDR address to read AXI DMA data, so the whole code was working correctly.

Is there something I am missing on ? Could someone give an hint about this ?

Thanks in advance,

Regards,

s.

 

 

0 Kudos
1 Reply
Explorer
Explorer
68 Views
Registered: ‎05-14-2017

Re: Wrong address returned by mmap

Any useful hint on this problem ?

0 Kudos