[Previous]
[Contents]
[Next]

qnx_hint_mask()

query, enable or disable a hardware interrupt

Synopsis:

#include <sys/irqinfo.h>
int qnx_hint_mask( unsigned intnum,
                   unsigned action );

Description:

The qnx_hint_mask() function queries, enables or disables the hardware interrupt associated with intnum.

The value in action determines the type of operation, as follows:

0
Don't change the interrupt mask.
1
Enable the interrupt.
2
Disable the interrupt.

In all cases, the current state of the interrupt mask is returned:

Returns:

The current state of the hardware interrupt mask associated with intnum. On error, -1 is returned, and errno is set.

Errors:

EPERM
The calling process doesn't have sufficient privilege to change an interrupt mask.
EINVAL
The parameter intnum refers to a hardware interrupt that doesn't exist on this machine.

Examples:

/*
 * The following program turns on/off the interrupts
 * associated with argv[1..argc]. If the number is
 * positive, the interrupt is enabled, if negative
 * the interrupt is disabled.
 */

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/irqinfo.h>

void main( int argc, char **argv )
  {
    int i;
    int intid;

    for( i = 1; i < argc; i++ ) {
      intid = strtol( argv[i], NULL, 0 );
      if( intid < 0 ) {
        qnx_hint_mask( -intid, 2 );
      } else {
        qnx_hint_mask( intid, 1 );
      }
    }
    exit( 0 );
  }

Classification:

QNX

Safety:
Interrupt handler No
Signal handler Yes, but modifies errno
Thread Yes

See also:

errno, qnx_hint_attach(), qnx_hint_detach(), qnx_hint_query()


[Previous]
[Contents]
[Next]