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 );

Since:

BlackBerry 10.0.0

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>.

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:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

Caveats:

You need I/O privileges to use the result of the mmap_device_io() function. The calling thread must:

  • have the PROCMGR_AID_IO ability enabled. For more information, see procmgr_ability().
  • call ThreadCtl() with the _NTO_TCTL_IO command to establish these privileges.

Last modified: 2014-06-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus