As with most microprocessors, the TMS320C66x allows normal program flow to be interrupted. In response to the interruption, the CPU finishes executing the current instruction(s) and branches to a procedure which services the interrupt. To service an interrupt, the user or the system must save the contents of the registers and the context of the current process, then service the interrupt task, restore the registers and the context of the process, and finally resume the original process (see Figure 6.1). The interrupt can come from an external device, an internal peripheral or simply a special instruction in the program.
There are four types of interrupts on the TMS320CC66x CPUs. These are the two non‐maskable interrupts (Reset and NMI) and maskable interrupts (EXCEP and INT4–INT15) (see Figure 6.2 and Table 6.1). The interrupt controllers described in this chapter allow events to be mapped to any of the input interrupts from INT4 to INT15.
Table 6.1 Interrupt sources and priority
Type | Interrupt name | Priority |
Non‐maskable | Highest | |
NMI | ||
Maskable | EXCEP | |
INT4 | ||
INT5 | ||
INT6 | ||
INT7 | ||
INT8 | ||
INT9 | ||
INT10 | ||
INT11 | ||
INT12 | ||
INT13 | ||
INT14 | ||
INT15 | Lowest |
Due to the sheer number of events available (hundreds) and the low number of interrupts that the CPU, Enhanced Direct Memory Access (EDMA) or hyperlink can handle, some events are aggregated first by the chip‐level interrupt controllers (CICs or CpIntcs) to generate the secondary events. The other events are unchanged and are called primary events. Secondary events are infrequent events and are routed to the CIC first to offload the interrupt controller (INTC) as shown in Figure 6.3.
Each processor has a fixed number of CICs. For instance, the TMS320C6678 has four CICs and the 66AK2H14/12 has only three CICs; see Figure 6.4 or 6.5. As can be seen from these figures, each event (primary or secondary) is mapped to a specific core or peripheral. However, some events are broadcast to many cores.
The primary task of the user is to identify which event or events are to be programmed to generate an interrupt. Each event is identified by a number and described in the user guide. A sample of events available is shown in Table 6.2. Let’s now examine the CIC.
Table 6.2 CIC0 event inputs (secondary interrupts for TMS320C66x CorePacs) [1]
Input event no. on CIC | System interrupt | Description |
0 | EDMA3CC1 CC_ERRINT | EDMA3CC1 error interrupt |
1 | EDMA3CC1 CC_MPINT | EDMA3CC1 memory protection interrupt |
2 | EDMA3CC1 TC_ERRINT0 | EDMA3CC1 TC0 error interrupt |
– – |
– – |
– – |
38 | EDMA3CC0 CCINT0 | EDMA3CC0 individual completion interrupt |
39 | EDMA3CC0 CCINT1 | EDMA3CC0 individual completion interrupt |
40 | EDMA3CC0 CCINT2 | EDMA3CC0 individual completion interrupt |
– – |
– – |
– – |
157 | QM_INT_PASS_TXQ_PEND_23 | Queue manager pending event |
158 | QM_INT_PASS_TXQ_PEND_24 | Queue manager pending event |
159 | QM_INT_PASS_TXQ_PEND_25 | Queue manager pending event |
A CIC (see Figures 6.3, 6.4 and 6.5) accepts system‐level events (see datasheet for a particular device) and combines them to generate secondary events to the interrupt controller, as shown in Figure 6.3. Figure 6.4 shows that the TMS320C6678 has four CICs (CIC0, CIC1, CIC2 and CIC3) responding to various events (some events can be found in different CICs).
The CICs are composed of:
CIC0 registers for the TMS320C6678 are located in address 0x02600000 as shown in Table 6.3. The interrupt status register is offset by 0x20 as shown in Table 6.4.
As an example, if System Event 4 needs to be enabled, there are two options:
To set Event 4, the index in the System Interrupt Status Indexed Set Register (STATUS_SET_INDEX_REG) (see Figure 6.7) needs to be set to 4. The index represents the event number. The index is a 10‐bit number, and therefore 1024 events can be represented.
This is illustrated in Figure 6.8. The event to channel mapping is made through the Channel Interrupt Map Register (CH_MAP_REGx) illustrated in Figure 6.9 and viewed using the CCS (see Figure 6.10).
The channel number will depend on the device used. Each channel has a register. The mapping of the channels to host interrupts is fixed (one‐to‐one mapping). Each of the four channels has a register to define their host interrupts, and the register is read‐only; see Figure 6.11.
The INTC, shown in Figure 6.3 and detailed in Figure 6.16, is composed of:
The complete interrupt system is illustrated in Figure 6.18, with the highlighted System Event 4 (SE4) being programmed to generate Interrupt 15 (INT15).
There are two experiments: using the GIPIOs to trigger some functions, and using the console to trigger an interrupt.
In this example, two general‐purpose input–output (GPIO) events (GPIO 14 and GPIO15) are made to generate two different functions when triggered and combined to generate one function if either event is generated (see Figure 6.19). To avoid sending real signals to the GPIOs, the events are triggered by software.
Examine the code, then compile, build and run it.
In this experiment, the application written will scan the input from the console (the user inputs a GPIO number) and call the applicate function (each GPIO triggers a different function; only GPIO0 and GPIO8 to GPIO15 are used in this example). It is worth noting at this stage that GPIOn will only trigger Core n, where n is 0 to 7; that is, GPIO0 triggers only Core 0, GPIO1 triggers only Core 1 and so on. However, GPIOx (x = 8–15) will trigger all cores.
The steps to implement this example are as follows:
To program this, use:
This chapter shows how the interrupt controller events and the CIC work, and how to program them to respond to events. The examples given use the GPIO pins to provide the interrupts. To avoid sending real signals to the GPIOs, the interrupts have been set by software.
3.138.204.208