InterruptHookIdle()

Attach an “idle” interrupt handler

Synopsis:

#include <sys/neutrino.h>

int InterruptHookIdle(
    void (*handler)( uint64_t *ptime,
                     struct qtime_entry *pqtime),
    unsigned flags );

Arguments:

handler
A pointer to the handler function; see below.
flags
There are currently no flags that apply; specify 0 for this argument.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The InterruptHookIdle() kernel call attaches the specified interrupt handler to the _NTO_HOOK_IDLE synthetic interrupt, which is generated when a processor becomes idle. This is typically used to implement power management features.

Before calling this function, the thread must obtain I/O privileges by successfully calling:

ThreadCtl( _NTO_TCTL_IO, 0 );

If the thread doesn't do this, the attachment fails with an error code of EPERM.

To detach the interrupt handler, call InterruptDetach().

The arguments to the handler function are:

uint64_t* ptime
A pointer to the time, in nanoseconds, when the next timer will expire.
struct qtime_entry *pqtime
A pointer to the section of the system page with the time information, including the current time of day.

The simplest idle handler consists of a halt instruction.

Blocking states

This call doesn't block.

Returns:

An interrupt function ID, or -1 if an error occurs (errno is set).

Use the returned value with the InterruptDetach() function to detach this interrupt handler.

Errors:

EAGAIN
All kernel interrupt entries are in use.
EPERM
The process doesn't have superuser capabilities, or the calling thread doesn't have I/O privileges.

Classification:

QNX Neutrino

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

See also:

InterruptAttach(), InterruptAttachEvent(), InterruptDetach()

Writing an Interrupt Handler chapter of the Neutrino Programmer's Guide