Hi,
I am using mmap() to map OMAP_MCSPI1_BASE (0x48098000) which is the start of the McSPI1 registers (OMAP3530 running Linux). mmap works fine if I don't access any of the registers. But when I try to print out the register values I got
Unhandled fault: external abort on non-linefetch (0x1018) at 0x4002100c Bus error
I have seen some posts which had the same issue but I haven't seen any reply or solutions to it. Any help and suggestion would be appreciated.
Here is the code:
fd = open("/dev/mem", O_RDWR);
if (fd == -1)
{
printf("open() failed!\n");
return -1;
}
mmap_addr = mmap(NULL, mem_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd,mem_start);
if (mmap_addr == MAP_FAILED) {
printf("gpio mmap() failed!\n");
exit(1);
}
ptr = (unsigned int *)(mmap_addr) ;
printf(" 0x%08x mapped to %p (%p)\n", OMAP_MCSPI1_BASE, mmap_addr, ptr) ;
ptr+=4 ; // start from SCR register print out the register values
printf("%p 0x08x\n", ptr, *ptr) ; ptr ++ ;
printf("%p 0x08x\n", ptr, *ptr) ; ptr ++ ;
...
I tried similar code to map the GPIO registers, it works fine and I can do read/write with the registers.
Many thanks.