[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

Exec provides a means of generating software interrupts. Software
interrupts execute at a priority higher than that of tasks but lower than
that of hardware interrupts, so they are often used to defer hardware
interrupt processing to a lower priority.  Software interrupts use the
same Interrupt data structure as hardware interrupts.  As described above,
this structure contains pointers to both interrupt code and data, and
should be initialized as node type NT_INTERRUPT (not NT_SOFTINT which is
an internal Exec flag).

A software interrupt is usually activated with the Cause() function.  If
this function is called from a task, the task will be interrupted and the
software interrupt will occur.  If it is called from a hardware interrupt,
the software interrupt will not be processed until the system exits from
its last hardware interrupt.  If a software interrupt occurs from within
another software interrupt, it is not processed until the current one is
completed.  However, individual software interrupts do not nest, and will
not be caused if already running as a software interrupt.

    Don't Trash A6!
    Software interrupts execute in an environment almost identical to
    that of hardware interrupts, and the same restrictions on allowable
    system function calls (as described earlier) apply to both.  Note
    however that, unlike other interrupts, software interrupts must
    preserve A6.

Software interrupts are prioritized.  Unlike interrupt servers, software
interrupts have only five allowable priority levels:  -32, -16, 0, +16,
and +32.  The priority should be put into the ln_Pri field prior to
calling Cause().

Software interrupts can also be generated by message arrival at a
PA_SOFTINT message port.  The applications of this technique are limited
since it is not permissible, with most devices, to send IO requests from
within interrupt code.  However, the timer.device does allow such
interactions, so a self-perpetuating PA_SOFTINT timer port can provide an
application with quite consistent timing under varying multitasking loads.
The following example demonstrates use of a software interrupt and a
PA_SOFTINT port.  See the "Exec Messages and Ports" chapter for more
information about messages and ports.


[Back to Amiga Developer Docs]