query, enable or disable a hardware interrupt
#include <sys/irqinfo.h> int qnx_hint_mask( unsigned intnum, unsigned action );
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:
In all cases, the current state of the interrupt mask is returned:
The current state of the hardware interrupt mask associated with intnum. On error, -1 is returned, and errno is set.
/* * 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 ); }
QNX
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes, but modifies errno |
Thread | Yes |
errno, qnx_hint_attach(), qnx_hint_detach(), qnx_hint_query()