User`s manual

Dynamic C Users Manual digi.com 77
Figure 5-7 Type 1 ISR
If, however, an ISR needs to signal a task to the ready state, then the ISR must be tasking aware. In the
example in Figure 5-8, the TA-ISR increments the interrupt nesting counter, does the work necessary for
the ISR, readies a higher priority task, decrements the nesting count, and returns to the higher priority task.
Figure 5-8 Type 2 ISR
It may seem as though the ISR in Figure 5-8 does not have to increment and decrement the nesting count.
However, this is very important. If the ISR for Interrupt X is called during an ISR that re-enables interrupts
before completion, scheduling should not be performed when Interrupt X completes; scheduling should
instead be deferred until the least nested ISR completes. Figure 5-9 shows an example of this situation.
Task 1
Task 1
Interrupt X
Interrupt X ISR
ipres
Task 2
Task 1
Interrupt X
Interrupt X TA-ISR
Nesting = 1
Task 1 is readied
Nesting = 0
ipres