Gain access to a device's registers
#include <stdint.h> #include <sys/mman.h> uintptr_t mmap_device_io( size_t len, uint64_t io );
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The mmap_device_io() function maps len bytes of device I/O memory at io and makes it accessible via the in*() and out*() functions in <hw/inout.h>.
A handle to the device's I/O memory, or MAP_DEVICE_FAILED if an error occurs (errno is set).
You need I/O privileges to use the result of the mmap_device_io() function. The calling thread may call ThreadCtl() with the _NTO_TCTL_IO command to establish these privileges.
mmap(), mmap_device_memory(), munmap_device_io()