作为经典的嵌入式设备处理器,其用户手册有学习并总结的必要。
一,中断机制
使用一个UIC管理所有的中断,包括内部中断和外部中断。(例如,mac芯片的中断属于外部中断,)
UIC:universal interrupt controller
可管理7个外部中断,23个内部中断:
Interrupt Polarity Sensitivity Interrupt Source
0 High Level UART0
1 High Level UART1
2 High Level IIC
3 High Level PCI External Command Write
4 Reserved
5 High Level DMA Channel 0
6 High Level DMA Channel 1
7 High Level DMA Channel 2
8 High Level DMA Channel 3
9 High Level Ethernet Wake Up
10 High Level MAL System Error (SERR)
11 High Level MAL TX End of Buffer (T XEOB0)
12 High Level MAL RX End of Buffer (RXEOB)
13 High Level MAL TX Descriptor Error (TXDE)
14 High Level MAL RX Descriptor Error (RXDE)
15 High Level EMAC0
16 Low Level External PCI SERR
17 High Level EMAC1
18 High Level PCI Power Management
19 GPT Level GPT Interrupt 0
20 GPT Level GPT Interrupt 1
21 GPT Level GPT Interrupt 2
22 GPT Level GPT Interrupt 3
23 GPT Level GPT Interrupt 4
UIC的主要功能如下描述:
The PPC405EP has 18 architected PowerPC interrupts. Two of these interrupts are the Critical and External
(noncritical) interrupt inputs connected to the universal interrupt controller (UIC). The
UIC routes interrupts from the 7 external (off-chip) and 23 internal (on-chip) sources to the PPC405EP
processor core.
UIC寄存器:
Mnemonic Register DCR Number Access Page
UIC0_SR UIC Status Register 0x0C0 Read/Clear 10-205 记录中断是否被触发
A UIC Status Register (UIC0_SR) 提供了如下信息:
– Current state of interrupts
– Current state of all enabled interrupts (其掩码为UIC Enable Register (UIC0_ER)
UIC0_ER UIC Enable Register 0x0C2 R/W 10-205 做为掩码管理中断是否使能
UIC0_CR UIC Critical Register 0x0C3 R/W 10-205 记录中断信号发往processor core时是critical还是non-critical
UIC0_PR UIC Polarity Register 0x0C4 R/W 10-205 表示中断的polarity是active还是negative
UIC0_TR UIC Trigger Register 0x0C5 R/W 10-205 表示中断信号是edge-sensitive or level-sensitive
UIC0_MSR UIC Masked Status Register 0x0C6 Read-only 10-205 SR和ER与的结果,为软件read到有效的中断状态提供方便
以上这几个寄存器都是32位的,每位对应一个uic管理的中断。
UIC0_VR UIC Vector Register 0x0C7 Read-only 10-205
UIC0_VCR UIC Vector Configuration Register 0x0C8 Write-only 10-205
以上两个寄存器与中断向量有关
UIC0_VR:保存中断向量表的基地址
UIC0_VCR:包含了一个中断向量地址(由偏移+基地址形成)
向量的偏移总是以512B为单位
The following example illustrates the generation of a UIC0_VR vector for external interrupt request
IRQ2.
For the example, assume that UIC0_VCR[PRO] = 0, so that UIC0_SR[EIR6S] (UIC0_SR31) has the highest
interrupt priority, and that UIC0_SR[EIR2S] (UIC0_SR27) is the current highest priority, enabled, active,
critical interrupt. To generate the vector for the interrupt associated with UIC0_SR[EIR2S], internal logic
multiplies the difference between the highest priority interrupt bit and the active enabled priority interrupt bit
by 512. The interrupt vector offset is therefore (31 – 27) × 512 = 4 × 512. This offset is added to the base
address in UIC0_VCR[VBA], and the UIC0_VR returns UIC0_VCR[VBA] + (4 × 512).
General Interrupt Handling Registers
1.Machine State Register (MSR)
管理上下文保存的寄存器