Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

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

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.

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 may call ThreadCtl() with the _NTO_TCTL_IO command to establish these privileges.

See also:

mmap(), mmap_device_memory(), munmap_device_io()