来源于QNX IDE
参考该文QNX中 mmap_device_memory()的使用
mmap_device_io()
Gain access to a device's registers//访问设备的寄存器
Synopsis:
#include <stdint.h>
#include <sys/mman.h>
uintptr_t mmap_device_io( size_t len,
uint64_t io );
Arguments:
len
The number of bytes of device I/O memory that you want to access. It can't be 0. //可以是一个很大的数,比如0x1000
io
The address of the area that you want to access.//寄存器地址,0x01C14000 //32位
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
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>.
Returns:
A handle to the device's I/O memory, or MAP_DEVICE_FAILED if an error occurs (errno is set).