SPRUJ79 November 2024 F29H850TU , F29H859TU-Q1
Interrupt Nesting
By default, nesting is supported at the hardware level in the C29x CPU. The PIPE module allows for interrupt types RTINT and INT to nest within one another. A higher priority interrupt nests within a lower priority interrupt. Nesting for INTs within the PIPE module is enabled within a Interrupt Service Routine (ISR) by setting the CPU level DSTS.INTE bit active because this bit is disabled while entering the ISR.
Grouping Interrupts Based on Priority Levels
The PIPE also allows for interrupts to prevent nesting within other interrupts using "groups". Interrupts in a given group do not preempt or nest within other interrupts in the group.
To form a group, the least significant bits of the priority (INT_CONFIG.PRI_LEVEL) are used to choose which interrupts are in the same group. The number of least significant bits of the INT_CONFIG.PRI_LEVEL that is used for grouping interrupts is also configurable (masked using the INT_GRP_MASK register) in binary multiples (ex: 2, 4, 8, 16). Groups are made up of interrupts that are near one another in configured priority levels.
For example when this above note is not followed, some group includes both priority levels INT_7 and INT_29 and the RTINT_THRESHOLD is set to 10. If the CPU was servicing INT_29 (INT) and INT_7 comes (RTINT), irrespective of the RTINT threshold, INT_7 is not forwarded on RTINT/INT lines.
The group mask combinations possible are outlined in Table 6-2. Any other group mask chosen for INT_GRP_MASK that is not listed in Table 6-2 results in using the default group mask of 0xFF where all interrupts can nest.
| Group Mask | Group Size | Number of Groups | Priority Assignment Distance | Comment |
|---|---|---|---|---|
| 0xFF/Other | 1 | 256 | 1 | 0xFF: All interrupts can nest in one another. All interrupt
levels are in individual groups, so 256 configurable priorities are
available with 1 interrupt level in each. All other values: If any other value is used, the mask value defaults to 0xFF that correlates to no group mask. |
| 0xFE | 2 | 128 | 2 | 128 priority groups with 2 interrupt levels in each; hence, the number of priorities reduce to 128 for preemption. |
| 0xFC | 4 | 64 | 4 | 64 priority groups with 4 interrupt levels in each; hence, the number of priorities reduce to 64 for preemption. |
| 0xF8 | 8 | 32 | 8 | 32 priority groups with 8 interrupt levels in each; hence, the number of priorities reduce to 32 for preemption. |
| 0xF0 | 16 | 16 | 16 | 16 priority groups with 16 interrupt levels in each; hence, the number of priorities reduce to 16 for preemption. |
| 0xE0 | 32 | 8 | 32 | 8 priority groups with 32 interrupt levels in each; hence, the number of priorities reduce to 8 for preemption. |
| 0xC0 | 64 | 4 | 64 | 4 priority groups with 64 interrupt levels in each; hence, the number of priorities reduce to 4 for preemption. |
| 0x80 | 128 | 2 | 128 | 2 priority groups with 128 interrupt levels in each; hence, the number of priorities reduce to 2 for preemption. |
| 0x00 | 256 | 1 | 256 | No interrupts can nest in one another. All interrupts are in one group, so configurable priorities are used for the highest priority interrupt. There is no nesting of interrupt priority levels regardless of INT or RTINT status. |
For example, in the case of an interrupt with priority level 13, this interrupt can belong to different groups depending on the group mask: 0xFF: Group 14, 0xFC: Group 11, 0xFC: Group 4, and so on.
Figure 6-3 illustrates one example of how grouping allows interrupts to nest, and is shown with PRI_LEVEL 0 to 7 set and group sizes selected as shown. In this example, no two interrupts have the same interrupt priority level configurations.