mmap_device_io()
QNX SDP8.0C Library ReferenceAPIDeveloper
Gain access to a device's registers
Warning: 
  Use mmap() instead of
          mmap_device_io(). The mmap_device_io() function is a
        wrapper function for mmap() and is only provided for backwards
        compatibility.
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.
 - io
 - The address of the area that you want to access.
 
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>.
Note: 
In order to map physical memory, your process must have the
PROCMGR_AID_MEM_PHYS ability enabled.
For more information, see
procmgr_ability().
Returns:
A handle to the device's I/O memory, or MAP_DEVICE_FAILED if an error occurs (errno is set).
Errors:
- EINVAL
 - Invalid flags type, or len is 0.
 - ENOMEM
 - The address range requested is outside of the allowed process address range, or there wasn't enough memory to satisfy the request.
 - ENXIO
 - The address from io for len bytes is invalid.
 - EPERM
 - The calling process doesn't have the required permission; see procmgr_ability().
 
Classification:
| Safety: | |
|---|---|
| Cancellation point | No | 
| Signal handler | Yes | 
| Thread | Yes | 
Caveats:
On x86_64, you need I/O privileges to use the result of the mmap_device_io() function:
- The process must have the PROCMGR_AID_IO ability enabled. For more information, see procmgr_ability().
 - The calling thread must call 
ThreadCtl( _NTO_TCTL_IO_LEVEL, (void*)_NTO_IO_LEVEL_1 )to establish these privileges. 
On AArch64, these conditions don't apply.
Page updated: 
