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 );
- The number of bytes of device I/O memory that you want to access. It can't be 0.
- The address of the area that you want to access.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
A handle to the device's I/O memory, or MAP_DEVICE_FAILED if an error occurs (errno is set).
- Invalid flags type, or len is 0.
- The address range requested is outside of the allowed process address range, or there wasn't enough memory to satisfy the request.
- The address from io for len bytes is invalid.
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.