In our example above, the function serint() is
the ISR.
In general, an ISR is responsible for:
- determining which hardware device requires servicing, if any
- performing some kind of servicing of that hardware (usually this is done by simply
reading and/or writing the hardware's registers)
- updating some data structures shared between the ISR and some
of the threads running in the application
- notifying the application that some kind of event has occurred
Depending on the complexity of the hardware device, the ISR,
and the application, some of the above steps may be omitted.
Note:
(QNX Neutrino 7.1 or later) The kernel saves and restores the FPU context on entering and leaving ISRs,
so it's safe to use floating-point operations in them.
Let's take a look at these steps in turn.