InterruptUnmask()

Updated: April 19, 2023

Enable a hardware interrupt

Synopsis:

#include <sys/neutrino.h>

int InterruptUnmask( int intr, 
                     int id );

Arguments:

intr
The interrupt you want to unmask.
id
The value returned by InterruptAttach(), InterruptAttachArray(), or InterruptAttachEvent(), or -1 if you don't want the kernel to track interrupt maskings and unmaskings for each handler.

If you set the _NTO_INTR_FLAGS_TRK_MSK flag when calling the interrupt attach function, you must pass in a proper ID value (not -1). This ID value, along with the flag setting, allows better error recovery if a process unexpectedly terminates because it lets the kernel know how many times to call InterruptUnmask().

Library:

libc

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

Description:

The InterruptUnmask() kernel call enables the hardware interrupt specified by intr for the interrupt handler specified by id when the mask count reaches zero. You can call this function from a thread or from an interrupt handler.

If id isn't -1, the calling thread must be in the process that attached the interrupt. Otherwise the function fails with an error of EPERM.

If id is -1, then before you call this function from a thread:

If you're in an ISR, you must have had proper permissions, so the call will never fail for that reason.

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

Returns:

The current mask count, or -1 if an error occurs (errno is set).

Errors:

EINVAL
Not a supported hardware interrupt intr.
ESRCH
The id parameter is neither something returned by InterruptAttach(), InterruptAttachArray(), or InterruptAttachEvent(), nor -1.
EPERM
The function was called from a thread other than the one that called one of the InterruptAttach*() functions and obtained id, or the caller didn't request I/O privileges by first calling ThreadCtl( _NTO_TCTL_IO_LEVEL, (void*)_NTO_IO_LEVEL_1 ).

Classification:

QNX Neutrino

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