|
An issue about DMA memory
|
11/11/2014 12:39 AM
post112308
|
An issue about DMA memory
hello,
There is an issue about DMA memory setting.
I use mmap() to map a memory and mem_offset() to get the physical address.
I find that when I use mem_offset() to get the physical address, this function always return Error EOVERFLOW; but when
I use mem_offset64(), mostly the physicalAddressA can return the correct value(the value is larger than 2G), and
sometimes it returns value 0 or 1 also. could you tell me why?
this can appear on QNX6.5.0 SP1 system, and the platform is Intel Core i7-3610QE pocessor on x86 with 4G DDR3 RAM. but
if I change the DDR3 RAM to 2G, it is disappear. the mem_offset() can work OK!
the source code is as follow:
void *virtualAddressA;
off_t physicalAddressA;
int mem_offset_flag = 0;
int size = 7800;
virtualAddressA = mmap( 0,
size,
PROT_READ|PROT_WRITE|PROT_NOCACHE,
MAP_PHYS|MAP_ANON,
NOFD,
0 );
if (virtualAddressA == MAP_FAILED) {
perror("mmap");
exit(EXIT_FAILURE);
}else{
printf("mmap succeed\n");
}
// mem_offset_flag = mem_offset( virtualAddressA, NOFD, size, &physicalAddressA, 0);
mem_offset_flag = mem_offset64( virtualAddressA, NOFD, size, &physicalAddressA, 0);
if(mem_offset_flag == -1)
{
printf("mem_offset error: %s!\n",strerror(errno ));
}
|
|
|