> So would I do it like this to read PLL2 Registers? (PLL2
> regs start at
> 0x01C40C00, see page 94 of TMS320DM6446 datasheet)
>
> int memfd;
> memfd = open("/dev/mem", O_RDONLY | O_NONBLOCK, 0); if
> (memfd == -1) {
> ERR("Cannot open /dev/mem (%s)\n", strerror(errno));
> return FAILURE;
> }
>
> unsigned char *memread;
> memread = (unsigned char*)malloc(512); memread = (unsigned
> char*)mmap(NULL, 16, PROT_READ, MAP_SHARED, memfd, 0x01C40C00);
> printf("PLL Values %08x\n", *(unsigned int*)memread);
Sorry for the delay. Looks fine, however, the only item that
you need to be wary of is the MMU page size. I was playing
around with the /dev/mem driver and it appears that you need
to map memory on a MMU page boundary otherwise the driver
will issue a fault. For ARM devices, I believe that the page
size used by Linux is 4KB. So what you need to do is create a
4KB mapping at address 0x01C40000 instead of 0x01C40C00. For example:
memread = (unsigned char*)mmap(NULL, 4096, PROT_READ, MAP_SHARED, memfd,
0x01C40000);
You can then access the particular register by using a 0xC00
offset with the address that mmap provides.
Cheers
Jon
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source