Configuring Ordinary Interrupt Service Routines; Interrupt Priority Groups - Infineon Technologies TC1728 User Manual

32-bit single-chip microcontroller
Table of Contents

Advertisement

13.8.2

Configuring Ordinary Interrupt Service Routines

When the CPU starts to service an interrupt, the interrupt system is globally disabled and
the CPU priority ICR.CCPN is set to the priority of the interrupt now being serviced. This
blocks all further interrupts from being serviced until the interrupt system is enabled
again.
After an ordinary ISR begins execution, it is usually desirable for the ISR to re-enable
global interrupts so that higher-priority interrupts (that is, interrupts that are greater than
the current value of ICR.CCPN) can be serviced even during the current ISR's execution.
Thus, such an ISR may set ICR.IE = 1 again with, for instance, the ENABLE instruction.
If the ISR enables the interrupt system again by setting ICR.IE = 1 but does not change
ICR.CCPN, the effect is that from that point on the hardware can be interrupted by
higher-priority interrupts but will be blocked from servicing interrupt requests with the
same or lower priority than the current value of bit field ISR.CCPN. Since the current ISR
is clearly also at this priority level, the hardware is also blocked from delivering further
interrupts to it as well. (This condition is clearly necessary so that the ISR can service
the interrupt request automatically.)
When the ISR is finished, it exits with an RFE instruction. Hardware then restores the
values of ICR.CCPN and ICR.IE to the values of the interrupted program.
13.8.3

Interrupt Priority Groups

It is sometimes useful to create groups of interrupts at the same or different interrupt
priorities that cannot interrupt each other's ISRs. For instance, devices that can generate
multiple interrupts may need to have interrupts at different priorities interlocked in this
way. The TC1728 interrupt architecture can be used to create such interrupt priority
groups. It is effected by managing the current CPU priority level ICR.CCPN in a way
described in this section.
For example, in order to make an interrupt priority group out of priority numbers 11 and
12, one would not want an ISR executing at priority 11 to be interrupted by a service
request at priority 12, since this would be in the same priority group. Only interrupts
above 12 should be allowed to interrupt the ISRs in this interrupt priority group. However,
under ordinary ISR usage, the ISR at priority 11 would be interrupted by any request with
a higher priority number, including priority 12.
If, however, all ISRs in the interrupt priority group set the value of ICR.CCPN to the
highest priority level within their group before they re-enable interrupts, then the desired
interlocking will occur.
Figure 13-4
shows an example for interrupt priority grouping. The interrupt requests with
the priority numbers 11 and 12 form one group, while the requests with priority numbers
14 through 17 form another group. Each ISR in group 1 sets the value of ICR.CCPN to
12, the highest number in that group, before re-enabling the interrupt system. Each ISR
in group 2 sets the value of ICR.CCPN to 17 before re-enabling the interrupt system. If,
User's Manual
Interrupt, V1.4
13-19
TC1728
Interrupt System
V1.0, 2011-12

Advertisement

Table of Contents
loading

Table of Contents