Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

devi_register_interrupt()

Attach to an interrupt

Synopsis:

int devi_register_interrupt( int intr, 
                             int prio, 
                             int *pc, 
                             input_module_t *module,                  
                             struct sigevent *evp,
                             unsigned flags );

Description:

This function lets you attach to an interrupt. The default method of attachment is to use InterruptAttachEvent() and send back a pulse when the IRQ triggers. But you can override this behavior by passing in your own event structure in the fifth parameter (evp).

For example if you wanted to spawn a separate interrupt-handling thread and process interrupts within it, you could set up the event structure to send back SIGEV_INTR.

The arguments are:

intr
Interrupt number (IRQ) you're going to register.
prio
Dispatch priority that will be assigned to the callback function that processes a pulse. The priority is generated by an interrupt handler.
pc
Pulse code. If the pc argument isn't NULL and isn't equal to DEVI_PULSE_ALLOC, then it will be used as the pulse code to associate the pulse() callback.
module
Name of module data block.
evp
Pointer to sigevent structure. If provided, evp is attached to the interrupt (see InterruptAttachEvent() in the QNX Neutrino Library Reference.)

If evp is NULL, a pulse will be allocated and the module's pulse() callback will be associated with it.

flags
Can be 0 or DEVI_SHARE_RSRC. If the flags argument is set to DEVI_SHARE_RSRC, this will tell the resource database manager to allow this interrupt to be shared. If the pc parameter wasn't NULL, then the allocated pulse code will be returned in it.

Returns:

A valid interrupt ID, or -1 on error.

Classification:

QNX

Safety:
Interrupt handler Not applicable
Signal handler Not applicable
Thread Not applicable