In your code, p is a pointer to the user memory space, which goes
through virtual address translation before becoming a physical address
which is what you're trying to use.
You need to mmmap() the physical region you want to use from /dev/mem
into your user memory space. This will give you a user-mode pointer
to the physical memory. There are many examples of how to do this
floating around, but since you're trying to use the PRU, you might
want to checkout something like:
prussdrv (C code for accessing the PRU using uio_pruss):
https://github.com/beagleboard/am335x_pru_package/blob/master/pru_sw/app_loader/interface/prussdrv.c#L70
--
Charles Steinkuehler
cha...@steinkuehler.net