[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.

     timersoftint.c