The address you obtain from the kernel is a virtual address - a pointer to a range of pages that have been configured via the page table to redirect to the physical addresses for the hardware, setting flags so that the CPU knows not to cache, not to read ahead, etc. Once the MMUs are enabled (which happens early in the kernel boot sequence) it isn't possible to access random physical addresses unless they are mapped into the virtual memory space in this way.
If you really want to poke the hardware directly (and I don't blame you for wanting to try, as long as you understand the pitfalls), you might be interested in pinctrl - a utility for reading and controlling the GPIO and pinmuxing hardware directly from userspace. The code is larger than you might expect because it is cross-platform and includes retrieving the addresses from Device Tree, but you might find it useful if you get stuck. See https://github.com/raspberrypi/utils/tr ... er/pinctrl .
If you really want to poke the hardware directly (and I don't blame you for wanting to try, as long as you understand the pitfalls), you might be interested in pinctrl - a utility for reading and controlling the GPIO and pinmuxing hardware directly from userspace. The code is larger than you might expect because it is cross-platform and includes retrieving the addresses from Device Tree, but you might find it useful if you get stuck. See https://github.com/raspberrypi/utils/tr ... er/pinctrl .
Statistics: Posted by PhilE — Thu May 02, 2024 7:53 am