[Previous] [Contents] [Next]

InterruptMask()

Disable a hardware interrupt

Synopsis:

#include <sys/neutrino.h>

int InterruptMask( int intr, 
                   int id );

Library:

libc

Description:

The InterruptMask() kernel call disables the hardware interrupt specified by intr for the handler specified by id (which is the ID returned by InterruptAttach() or InterruptAttachEvent()). It may be called from a thread or from an interrupt handler. Before calling this function the thread must request I/O privity by calling:

ThreadCtl( _NTO_TCTL_IO, 0 );

If the thread doesn't do this, it might SIGSEGV when InterruptUnlock() is called.

The interrupt should be reenabled by calling InterruptUnmask().

The kernel automatically enables an interrupt when the first handler attaches to it using InterruptAttach() and disables it when the last handler detaches. This call is often used when a device presents a level sensitive interrupt to the system which can't be easily cleared in the interrupt handler. Since the interrupt is level sensitive, you can't exit the handler with the interrupt line active and unmasked. InterruptMask() allows you to mask the interrupt in the handler and schedule a thread to do the real work of communicating with the device to clear the source. Once cleared, InterruptUnmask() should be called by the thread to reenable this interrupt.

To disable all hardware interrupts use the InterruptLock() function.


Note: This function should be used in place of code to talk directly to the interrupt controller to ensure hardware portability.

Calls to InterruptMask() are nested; the interrupt won't be unmasked until InterruptUnmask() has been called once for every call to InterruptMask().


Note: The id can be -1 if you don't want the kernel to track interrupt masks and unmasks for each handler.

The id is ignored unless you use the _NTO_INTR_FLAGS_TRK_MSK flag in the InterruptAttach() call.


Returns:

The current mask level count for success; or -1 if an error occurs (errno is set).

Errors:

EINVAL
The value of intr isn't a supported hardware interrupt.

Classification:

QNX 6

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

See also:

InterruptAttach(), InterruptDisable(), InterruptEnable(), InterruptLock(), InterruptUnlock(), InterruptUnmask(), ThreadCtl()


[Previous] [Contents] [Next]