2. Interrupt handling is a key function in real-time software, and comprises interrupts and their
handlers.
Only those physical interrupts which of high enough priority can be centered into system interrupt
table.
The software assigns each interrupt to a handler in the interrupt table.
An interrupt handler is just a routine containing a sequence of operations.
Each of these may request input and output while running.
3. As soon as several tasks run in a program, it is virtually impossible to achieve good
response times by polling (continuous enquiry of an event).
Continuous polling would prevent tasks with lower priorities from running and thus waste
precious CPU time.
Therefore, it should always be attempted to replace polling by interrupts.
This leads to the best response times and optimal use of the hardware available.
RTKernel-32 uses the timer interrupt to activate tasks waiting for a certain point in time.
Module RTCom provide interrupt support for serial ports.
This section discusses how to implement a handler for any interrupt source.
An interrupt handler may be thought of as a task running with a priority higher than all other
tasks.
However, there are some important considerations to keep in mind.
4. While an interrupt handler is active, no other interrupts with lower
priorities can be processed.
Therefore, it is important to minimize the execution times of interrupt
handlers, because otherwise the interrupt response time for other
interrupts might suffer.
The handler should avoid any processing not immediately required
and delegate it to a task.
5. An interrupt handler may:
declare and use local variables,
call other functions,
call functions RTKSignal or RTKWaitCond to activate other tasks,
call the conditional mailbox and message passing operations (RTKPutCond,
RTKGetCond, RTKSendCond, RTKReceiveCond) to exchange data with tasks.
An interrupt handler must not:
use the coprocessor or emulator without saving/restoring its state,
use more than 512 bytes of stack (the less, the better),
cause blocking task switches.
6. RTOS calling the corresponding ISR, the ISR
sending messages to priority queue of
Interrupt Service threads
7. Direct Call to an ISR and ISR Enter
message
On an interrupt, the process running at
the CPU is interrupted
ISR corresponding to that source starts
executing.
A hardware source calls an ISR directly.
The ISR just sends an ISR enter message
to the RTOS. ISR enter message is to
inform the RTOS that an ISR has taken
control of the CPU