1.簡介
GIC-400是用於控制中斷的。在cubieboard2 上 的A20芯片采用了這款控制器。
cubieboard2 的GIC控制器 的地址是0x01C80000---0x01C87FFF ,長度等於GIC-400寄存器的長度。
具體的內容如下所示。
以0x01C80000為起始地址,下面給出的是偏移:
|
Reserved 未使用,無用 |
|
|
Distributor 配置器 有用 |
|
|
CPU interfaces CPU接口 有用 |
|
|
Virtual interface control block, for the processor that is performing the access 虛擬化相關,無用 |
|
|
Virtual interface control block, for the processor selected by address bits [11:9] 虛擬化相關,無用 |
|
...
|
Alias for Processor 0 Alias for Processor 1 ... Alias for Processor 7 |
|
|
Virtual CPU interfaces 虛擬化相關,無用 |
常用的是圖中第二塊和第三塊,0x1000~0x3fff這部分的配置。
2.Distributor 配置器
distributor這塊寄存器的地址 = GIC控制器 的地址 + 0x1000 ,使用的時候別忘記了偏移。然后從這里開始,有如下的寄存器
偏移 |
名稱 |
可讀寫 |
復位后 |
作用 |
---|---|---|---|---|
|
GICD_CTLR |
RW |
|
Distributor Control Register 寫入1使能控制器,必備 |
|
GICD_TYPER |
RO |
Configuration-dependent[d] |
Interrupt Controller Type Register 其中可以查看中斷線的總數 |
|
GICD_IIDR |
RO |
|
Distributor Implementer Identification Register, GICD_IIDR 存了一些版本信息,沒用 |
|
GICD_IGROUPRn |
RW |
|
Interrupt Group Registers[e] 一個位圖,控制中斷屬於A組還是B組 |
|
GICD_ISENABLERn |
RW[f] |
SGIs and PPIs: |
Interrupt Set-Enable Registers 一個位圖,用於使能各個中斷,寫入1使能。有用 |
|
SPIs: |
|||
|
GICD_ICENABLERn |
RW[f] |
|
Interrupt Clear-Enable Registers 和上一個寄存器類似,作用相反,寫入1禁止。 |
|
|
|||
|
GICD_ISPENDRn |
RW |
|
Interrupt Set-Pending Registers pend位圖,寫入1可以進入pend狀態 |
|
GICD_ICPENDRn |
RW |
|
Interrupt Clear-Pending Registers 同上,寫入1效果相反,阻止pend狀態 |
|
GICD_ISACTIVERn |
RW |
|
Interrupt Set-Active Registers 位圖,寫入1可以激活中斷 |
0x380 -0x3BC |
GICD_ICACTIVERn |
RW |
|
Interrupt Clear-Active Registers 寫入1反激活中斷 |
|
GICD_IPRIORITYRn |
RW |
|
Interrupt Priority Registers 存着各個中斷的優先級,每8位算一個 |
|
GICD_ITARGETSRn |
RO[h] |
- |
Interrupt Processor Targets Registers[i] 某個中斷應該發往哪個處理器進行處理 |
|
RW |
|
||
|
GICD_ICFGRn |
RO |
SGIs: |
Interrupt Configuration Registers, GICD_ICFGRn 配置中斷是低電平觸發還是下降沿觸發 |
|
RO |
PPIs: |
||
|
RW[j] |
SPIs: |
||
0xD00 |
GICD_PPISR |
RO |
0x00000000 |
Private Peripheral Interrupt Status Register, GICD_PPISR 一般沒用 |
0xD04 -0xD3C |
GICD_SPISRn |
RO |
0x00000000 |
Shared Peripheral Interrupt Status Registers, GICD_SPISRn 沒用 |
0xF00 |
GICD_SGIR |
WO |
- | Software Generated Interrupt Register 控制軟中斷 |
0xF10-0xF1C |
GICD_CPENDSGIRn |
RW |
|
SGI Clear-Pending Registers 軟中斷的pend位 |
|
GICD_SPENDSGIRn |
RW |
|
SGI Set-Pending Registers 同上,不過寫入1時停止pend |
|
GICD_PIDR4 |
RO |
|
Peripheral ID 4 Register |
|
GICD_PIDR5 |
RO |
|
Peripheral ID 5 Register |
|
GICD_PIDR6 |
RO |
|
Peripheral ID 6 Register |
|
GICD_PIDR7 |
RO |
|
Peripheral ID 7 Register |
|
GICD_PIDR0 |
RO |
|
Peripheral ID 0 Register |
|
GICD_PIDR1 |
RO |
|
Peripheral ID 1 Register |
|
GICD_PIDR2 |
RO |
|
Peripheral ID 2 Register |
|
GICD_PIDR3 |
RO |
|
Peripheral ID 3 Register |
|
GICD_CIDR0 |
RO |
|
Component ID 0 Register |
|
GICD_CIDR1 |
RO |
0x000000F0 |
Component ID 1 Register |
|
GICD_CIDR2 |
RO |
|
Component ID 2 Register |
|
GICD_CIDR3 |
RO |
|
Component ID 3 Register |
3.cpu接口
開始地址的偏移量為0x2000
Offset |
Name |
Type |
Reset |
Description[a] |
---|---|---|---|---|
|
GICC_CTLR |
RW |
|
CPU Interface Control Register 使能位。寫入1使能 |
|
GICC_PMR |
RW |
|
Interrupt Priority Mask Register 限制中斷最低優先級,高於此值無法中斷,最好寫大一點 |
|
GICC_BPR |
RW |
|
Binary Point Register The minimum value of the Binary Point Register depends on which security-banked copy is considered:
|
|
GICC_IAR |
RO |
|
Interrupt Acknowledge Register 只讀,中斷id |
|
GICC_EOIR |
WO |
- | End of Interrupt Register 寫入以告知cpu已經處理完中斷 |
|
GICC_RPR |
RO |
|
Running Priority Register 當前中斷優先級 |
|
GICC_HPPIR |
RO |
|
Highest Priority Pending Interrupt Register [c] 最高優先級中斷號及其pend值 |
|
GICC_ABPR |
RW |
|
Aliased Binary Point Register[d] The minimum value of the Aliased Binary Point Register is 別名寄存器 |
|
GICC_AIAR |
RO |
|
Aliased Interrupt Acknowledge Register[d] 別名寄存器 |
|
GICC_AEOIR |
WO |
- |
Aliased End of Interrupt Register[d] 別名寄存器 |
|
GICC_AHPPIR | RO |
|
Aliased Highest Priority Pending Interrupt Register[c][d] 別名寄存器 |
|
GICC_APR0 |
RW |
|
Active Priority Register 用於保存和恢復 |
|
GICC_NSAPR0 |
RW |
|
Non-Secure Active Priority Register[d] 用於保存和恢復 |
|
GICC_IIDR | RO |
|
CPU Interface Identification Register, GICC_IIDR 存着版本信息 |
|
GICC_DIR | WO |
- | Deactivate Interrupt Register |