F28069教程3-中断 PIE


https://dev.ti.com/tirex/explore/content/c2000_academy_2.00.01.41_all/modules/Module_3_Deep_Dive/module_3_deep_dive.html


PIE:Peripheral Interrupt Expansion block

Interrupts

What are interrupts?

An interrupt is a response by the processor to an event that needs attention. The processor executes instructions that are defined within the interrupt service routine (ISR) as soon as is capable, and then goes back to normal operational tasks. Unlike idle loops where code waits for an event to occur, interrupts provide the opportunity to have non-idle code loops that execute based on the CPU’s availability and priority of tasks.

Interrupt Architecture within C2000 devices

Refer to the ‘Device Interrupt Architecture’ figure of the device’s Technical Reference Manual (TRM) for a visual representation of the interrupt architecture described below.

The internal interrupt sources include the general purpose timers 0, 1, and 2, and all of the peripherals on the device.

External interrupt sources include the five external interrupt lines. From the Input X-BAR, INPUT4 maps to XINT1, INPUT5 maps to XINT2, INPUT6 maps to XINT3, INPUT13 maps to XINT4, and INPUT14 maps to XINT5.

The Peripheral Interrupt Expansion block, known as the PIE block, is used to expand the core interrupt capability. Timer 0 is directly connected to the PIE block as well as the WAKEINT signal from the Watchdog module. For dual core devices, each core has its own PIE block and the XINTx signals are shared between the two cores as well as the peripheral interrupts, and inter-processor (IPC) signals.

The core has 14 interrupt lines (for dual core devices, each core has its own set of 14 interrupt lines). Interrupts 1-12 come from the PIE block, interrupt 13 is mapped to Timer 1 and interrupt 14 is mapped to Timer 2. The NMI module is directly connected to the NMI interrupt which is mapped to the core.

Peripheral Interrupt Expansion (PIE)

在这里插入图片描述
A Peripheral Interrupt Expansion (PIE) module multiplexes up to sixteen peripheral interrupts into each of the twelve CPU interrupt lines, further expanding support for up to 192 peripheral interrupt signals.

The PIE module also expands the interrupt vector table, allowing each unique interrupt signal to have its own interrupt service routine (ISR), permitting the CPU to support a large number of peripherals.

The PIE block consists of 12 groups. Within each group, there are sixteen interrupt sources. Each group has a PIE interrupt enable register and a PIE interrupt flag register.

Any interrupt lines that do not go through the PIE block are directly connected to the CPU like Timer 1/2 and NMI.

To view the PIE block mapping refer to the ‘PIE Channel Mapping’ table within the device’s Technical Reference Manual (TRM). Figure 4 shows an example of the PIE channel mapping for the F2838x device.
在这里插入图片描述
The PIE assignment table maps each peripheral interrupt to the unique vector location for that interrupt service routine. The interrupt numbers on the left (rows) represent the twelve core group interrupt lines and the interrupt numbers across the top (columns) represent the channel number within the core group interrupt line.

Each of the 12 PIE groups has a 16-bit flag register (PIEIFRx), a 16-bit enable register (PIEIERx), and a bit field in the PIE acknowledge register (PIEACK) which acts as a common interrupt mask for the entire group.

For a peripheral interrupt to propagate to the CPU, the appropriate PIEIFR must be set, the PIEIER enabled, the CPU IFR set, the IER enabled, and the INTM enabled. Note that some peripherals can have multiple events trigger the same interrupt signal, and the cause of the interrupt can be determined by reading the peripheral’s status register.

The enable PIE bit in the PIECTRL register is used to activate the PIE module. Note that when using the Driverlib function to enable and disable interrupts, both the PIEIER and CPU core IER registers are modified.

Driverlib functions to modify both the PIEIER and core IER registers:

    Interrupt_enable(interruptNumber);
    Interrupt_disable(interruptNumber);

PIE Block Initialization

Two separate functions are called to initialize the interrupt module and PIE block.

  Interrupt_initModule();
  Interrupt_initVectorTable();

During processor initialization the interrupt vectors, as mapped in the PIE interrupt mapping table, are copied to the PIE RAM and then the PIE module is enabled by setting ENPIE to ‘1’.

When the CPU receives an interrupt, the vector address of the ISR is fetched from the PIE RAM, and the interrupt with the highest priority that is both flagged and enabled is executed.

Priority is determined by the location within the interrupt vector table. The lowest numbered interrupt has the highest priority when multiple interrupts are pending.

In summary, the PIE initialization code flow is as follows:

  1. After the device is reset and execution of the boot code is completed, the selected boot option determines the code entry point.

  2. The CodeStartBranch.asm file has a long branch instruction to the entry point of the runtime support library. After the runtime support library completes execution, main is called.

  3. In main, a function is called to initialize the interrupt process and enable the PIE module.

  4. When the CPU receives an interrupt, the vector address of the ISR is fetched from the PIE RAM, and the interrupt with the highest priority that is both flagged and enabled is executed.

  5. Priority is determined by the location within the interrupt vector table.

Interrupt Processing

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值