|
Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
|
Driver for ARM Generic Interrupt Controller. More...
Go to the source code of this file.
Macros | |
| #define | GIC_DIST_BASE DT_REG_ADDR_BY_IDX(DT_INST(0, arm_gic), 0) |
| #define | GIC_CPU_BASE DT_REG_ADDR_BY_IDX(DT_INST(0, arm_gic), 1) |
| #define | GICD_CTLR (GIC_DIST_BASE + 0x0) |
| GIC Distributor Control Register. | |
| #define | GICD_TYPER (GIC_DIST_BASE + 0x4) |
| GIC Distributor Interrupt Controller Type Register. | |
| #define | GICD_IIDR (GIC_DIST_BASE + 0x8) |
| GIC Distributor Implementer Identification Register. | |
| #define | GICD_IGROUPRn (GIC_DIST_BASE + 0x80) |
| GIC Distributor Interrupt Group Registers. | |
| #define | GICD_IGROUPRnE (GIC_DIST_BASE + 0x1000) |
| GIC Distributor Interrupt Group Registers for Extended SPI Range. | |
| #define | GICD_ISENABLERn (GIC_DIST_BASE + 0x100) |
| GIC Distributor Interrupt Set-Enable Registers. | |
| #define | GICD_ISENABLERnE (GIC_DIST_BASE + 0x1200) |
| GIC Distributor Interrupt Set-Enable Registers for Extended SPI Range. | |
| #define | GICD_ICENABLERn (GIC_DIST_BASE + 0x180) |
| GIC Distributor Interrupt Clear-Enable Registers. | |
| #define | GICD_ICENABLERnE (GIC_DIST_BASE + 0x1400) |
| GIC Distributor Interrupt Clear-Enable Registers for Extended SPI Range. | |
| #define | GICD_ISPENDRn (GIC_DIST_BASE + 0x200) |
| GIC Distributor Interrupt Set-Pending Registers. | |
| #define | GICD_ISPENDRnE (GIC_DIST_BASE + 0x1600) |
| GIC Distributor Interrupt Set-Pending Registers for Extended SPI Range. | |
| #define | GICD_ICPENDRn (GIC_DIST_BASE + 0x280) |
| GIC Distributor Interrupt Clear-Pending Registers. | |
| #define | GICD_ICPENDRnE (GIC_DIST_BASE + 0x1800) |
| GIC Distributor Interrupt Clear-Pending Registers for Extended SPI Range. | |
| #define | GICD_ISACTIVERn (GIC_DIST_BASE + 0x300) |
| GIC Distributor Interrupt Set-Active Registers. | |
| #define | GICD_ISACTIVERnE (GIC_DIST_BASE + 0x1A00) |
| GIC Distributor Interrupt Set-Active Registers for Extended SPI Range. | |
| #define | GICD_ICACTIVERn (GIC_DIST_BASE + 0x380) |
| GIC Distributor Interrupt Clear-Active Registers. | |
| #define | GICD_ICACTIVERnE (GIC_DIST_BASE + 0x1C00) |
| GIC Distributor Interrupt Clear-Active Registers for Extended SPI Range. | |
| #define | GICD_IPRIORITYRn (GIC_DIST_BASE + 0x400) |
| GIC Distributor Interrupt Priority Registers. | |
| #define | GICD_IPRIORITYRnE (GIC_DIST_BASE + 0x2000) |
| GIC Distributor Interrupt Priority Registers for Extended SPI Range. | |
| #define | GICD_ITARGETSRn (GIC_DIST_BASE + 0x800) |
| GIC Distributor Interrupt Processor Targets Registers. | |
| #define | GICD_ICFGRn (GIC_DIST_BASE + 0xc00) |
| GIC Distributor Interrupt Configuration Registers. | |
| #define | GICD_ICFGRnE (GIC_DIST_BASE + 0x3000) |
| GIC Distributor Interrupt Configuration Registers for Extended SPI Range. | |
| #define | GICD_SGIR (GIC_DIST_BASE + 0xf00) |
| GIC Distributor Software Generated Interrupt Register. | |
| #define | GICD_CTLR_DS BIT(6) |
| Disable Security (DS) bit in GICD_CTLR. | |
| #define | GICC_CTLR (GIC_CPU_BASE + 0x0) |
| GIC CPU Interface Control Register. | |
| #define | GICC_PMR (GIC_CPU_BASE + 0x4) |
| GIC CPU Interface Interrupt Priority Mask Register. | |
| #define | GICC_BPR (GIC_CPU_BASE + 0x8) |
| GIC CPU Interface Binary Point Register. | |
| #define | GICC_IAR (GIC_CPU_BASE + 0xc) |
| GIC CPU Interface Interrupt Acknowledge Register. | |
| #define | GICC_EOIR (GIC_CPU_BASE + 0x10) |
| GIC CPU Interface End of Interrupt Register. | |
| #define | GIC_SGI_INT_BASE 0 |
| Base ID of SGI interrupts. | |
| #define | GIC_PPI_INT_BASE 16 |
| Base ID of PPI interrupts. | |
| #define | GIC_IS_SGI(intid) |
| #define | GIC_SPI_INT_BASE 32 |
| Base ID of SPI interrupts. | |
| #define | GIC_SPI_MAX_INTID 1019 |
| Max ID of SPI interrupts. | |
| #define | GIC_IDLE_PRIO 0xff |
| GIC idle priority : value '0xff' will allow all interrupts. | |
| #define | GIC_PRI_MASK 0xff |
| Priority levels 0:255. | |
| #define | GIC_INT_DEF_PRI_X4 0xa0a0a0a0 |
| Default priority initializer helper macro. | |
| #define | GIC_INTID_SPURIOUS 1023 |
| GIC special interrupt id. | |
| #define | GIC_NUM_CPU_IF CONFIG_MP_MAX_NUM_CPUS |
| Max number of supported CPUs in a SMP environment. | |
Functions | |
| void | arm_gic_irq_enable (unsigned int irq) |
| Enable interrupt. | |
| void | arm_gic_irq_disable (unsigned int irq) |
| Disable interrupt. | |
| bool | arm_gic_irq_is_enabled (unsigned int irq) |
| Check if an interrupt is enabled. | |
| bool | arm_gic_irq_is_pending (unsigned int irq) |
| Check if an interrupt is pending. | |
| void | arm_gic_irq_set_pending (unsigned int irq) |
| Set interrupt as pending. | |
| void | arm_gic_irq_clear_pending (unsigned int irq) |
| Clear the pending irq. | |
| void | arm_gic_irq_set_priority (unsigned int irq, unsigned int prio, unsigned int flags) |
| Set interrupt priority. | |
| void | arm_gic_irq_set_affinity (unsigned int irq, uint64_t mpidr) |
| Route an SPI/extended-SPI interrupt to a specific core. | |
| unsigned int | arm_gic_get_active (void) |
| Get active interrupt ID. | |
| void | arm_gic_eoi (unsigned int irq) |
| Signal end-of-interrupt. | |
| void | arm_gic_secondary_init (void) |
| Initialize GIC of secondary cores. | |
| void | gic_raise_sgi (unsigned int sgi_id, uint64_t target_aff, uint16_t target_list) |
| raise SGI to target cores | |
Driver for ARM Generic Interrupt Controller.
The Generic Interrupt Controller (GIC) is the default interrupt controller for the ARM A and R profile cores. This driver is used by the ARM arch implementation to handle interrupts.
| #define GIC_CPU_BASE DT_REG_ADDR_BY_IDX(DT_INST(0, arm_gic), 1) |
| #define GIC_DIST_BASE DT_REG_ADDR_BY_IDX(DT_INST(0, arm_gic), 0) |
| #define GIC_IDLE_PRIO 0xff |
GIC idle priority : value '0xff' will allow all interrupts.
| #define GIC_INT_DEF_PRI_X4 0xa0a0a0a0 |
Default priority initializer helper macro.
'0xa0'is used to initialize each interrupt default priority. This is an arbitrary value in current context. Any value '0x80' to '0xff' will work for both NS and S state. The values of individual interrupt and default has to be chosen carefully if PMR and BPR based nesting and preemption has to be done.
| #define GIC_INTID_SPURIOUS 1023 |
GIC special interrupt id.
| #define GIC_IS_SGI | ( | intid | ) |
| #define GIC_NUM_CPU_IF CONFIG_MP_MAX_NUM_CPUS |
Max number of supported CPUs in a SMP environment.
Fixme: update from platform specific define or dt DEPRECATED - Use CONFIG_MP_MAX_NUM_CPUS instead.
| #define GIC_PPI_INT_BASE 16 |
Base ID of PPI interrupts.
| #define GIC_PRI_MASK 0xff |
Priority levels 0:255.
| #define GIC_SGI_INT_BASE 0 |
Base ID of SGI interrupts.
| #define GIC_SPI_INT_BASE 32 |
Base ID of SPI interrupts.
| #define GIC_SPI_MAX_INTID 1019 |
Max ID of SPI interrupts.
| #define GICC_BPR (GIC_CPU_BASE + 0x8) |
GIC CPU Interface Binary Point Register.
v1 ICCBPR v2 GICC_BPR
| #define GICC_CTLR (GIC_CPU_BASE + 0x0) |
GIC CPU Interface Control Register.
v1 ICCICR v2 GICC_CTLR
| #define GICC_EOIR (GIC_CPU_BASE + 0x10) |
GIC CPU Interface End of Interrupt Register.
v1 ICCEOIR v2 GICC_EOIR
| #define GICC_IAR (GIC_CPU_BASE + 0xc) |
GIC CPU Interface Interrupt Acknowledge Register.
v1 ICCIAR v2 GICC_IAR
| #define GICC_PMR (GIC_CPU_BASE + 0x4) |
GIC CPU Interface Interrupt Priority Mask Register.
v1 ICCPMR v2 GICC_PMR
| #define GICD_CTLR (GIC_DIST_BASE + 0x0) |
GIC Distributor Control Register.
v1 ICDDCR v2/v3 GICD_CTLR
| #define GICD_CTLR_DS BIT(6) |
Disable Security (DS) bit in GICD_CTLR.
v3/v3.1 See ARM GIC architecture spec, GICD_CTLR
| #define GICD_ICACTIVERn (GIC_DIST_BASE + 0x380) |
GIC Distributor Interrupt Clear-Active Registers.
v2/v3 GICD_ICACTIVERn
| #define GICD_ICACTIVERnE (GIC_DIST_BASE + 0x1C00) |
GIC Distributor Interrupt Clear-Active Registers for Extended SPI Range.
v3.1 GICD_ICACTIVERnE
| #define GICD_ICENABLERn (GIC_DIST_BASE + 0x180) |
GIC Distributor Interrupt Clear-Enable Registers.
v1 ICDICERn v2/v3 GICD_ICENABLERn
| #define GICD_ICENABLERnE (GIC_DIST_BASE + 0x1400) |
GIC Distributor Interrupt Clear-Enable Registers for Extended SPI Range.
v3.1 GICD_ICENABLERnE
| #define GICD_ICFGRn (GIC_DIST_BASE + 0xc00) |
GIC Distributor Interrupt Configuration Registers.
v1 ICDICRn v2/v3 GICD_ICFGRn
| #define GICD_ICFGRnE (GIC_DIST_BASE + 0x3000) |
GIC Distributor Interrupt Configuration Registers for Extended SPI Range.
v3.1 GICD_ICFGRnE
| #define GICD_ICPENDRn (GIC_DIST_BASE + 0x280) |
GIC Distributor Interrupt Clear-Pending Registers.
v1 ICDICPRn v2/v3 GICD_ICPENDRn
| #define GICD_ICPENDRnE (GIC_DIST_BASE + 0x1800) |
GIC Distributor Interrupt Clear-Pending Registers for Extended SPI Range.
v3.1 GICD_ICPENDRnE
| #define GICD_IGROUPRn (GIC_DIST_BASE + 0x80) |
GIC Distributor Interrupt Group Registers.
v1 ICDISRn v2/v3 GICD_IGROUPRn
| #define GICD_IGROUPRnE (GIC_DIST_BASE + 0x1000) |
GIC Distributor Interrupt Group Registers for Extended SPI Range.
v3.1 GICD_IGROUPRnE
| #define GICD_IIDR (GIC_DIST_BASE + 0x8) |
GIC Distributor Implementer Identification Register.
v1 ICDIIDR v2/v3 GICD_IIDR
| #define GICD_IPRIORITYRn (GIC_DIST_BASE + 0x400) |
GIC Distributor Interrupt Priority Registers.
v1 ICDIPRn v2/v3 GICD_IPRIORITYRn
| #define GICD_IPRIORITYRnE (GIC_DIST_BASE + 0x2000) |
GIC Distributor Interrupt Priority Registers for Extended SPI Range.
v3.1 GICD_IPRIORITYRnE
| #define GICD_ISACTIVERn (GIC_DIST_BASE + 0x300) |
GIC Distributor Interrupt Set-Active Registers.
v1 ICDABRn v2/v3 GICD_ISACTIVERn
| #define GICD_ISACTIVERnE (GIC_DIST_BASE + 0x1A00) |
GIC Distributor Interrupt Set-Active Registers for Extended SPI Range.
v3.1 GICD_ISACTIVERnE
| #define GICD_ISENABLERn (GIC_DIST_BASE + 0x100) |
GIC Distributor Interrupt Set-Enable Registers.
v1 ICDISERn v2/v3 GICD_ISENABLERn
| #define GICD_ISENABLERnE (GIC_DIST_BASE + 0x1200) |
GIC Distributor Interrupt Set-Enable Registers for Extended SPI Range.
v3.1 GICD_ISENABLERnE
| #define GICD_ISPENDRn (GIC_DIST_BASE + 0x200) |
GIC Distributor Interrupt Set-Pending Registers.
v1 ICDISPRn v2/v3 GICD_ISPENDRn
| #define GICD_ISPENDRnE (GIC_DIST_BASE + 0x1600) |
GIC Distributor Interrupt Set-Pending Registers for Extended SPI Range.
v3.1 GICD_ISPENDRnE
| #define GICD_ITARGETSRn (GIC_DIST_BASE + 0x800) |
GIC Distributor Interrupt Processor Targets Registers.
v1 ICDIPTRn v2/v3 GICD_ITARGETSRn
| #define GICD_SGIR (GIC_DIST_BASE + 0xf00) |
GIC Distributor Software Generated Interrupt Register.
v1 ICDSGIR v2/v3 GICD_SGIR
| #define GICD_TYPER (GIC_DIST_BASE + 0x4) |
GIC Distributor Interrupt Controller Type Register.
v1 ICDICTR v2/v3 GICD_TYPER
| void arm_gic_eoi | ( | unsigned int | irq | ) |
Signal end-of-interrupt.
| irq | interrupt ID |
| unsigned int arm_gic_get_active | ( | void | ) |
Get active interrupt ID.
| void arm_gic_irq_clear_pending | ( | unsigned int | irq | ) |
Clear the pending irq.
| irq | interrupt ID |
| void arm_gic_irq_disable | ( | unsigned int | irq | ) |
Disable interrupt.
| irq | interrupt ID |
| void arm_gic_irq_enable | ( | unsigned int | irq | ) |
Enable interrupt.
| irq | interrupt ID |
Check if an interrupt is enabled.
| irq | interrupt ID |
Check if an interrupt is pending.
| irq | interrupt ID |
Route an SPI/extended-SPI interrupt to a specific core.
Programs GICD_IROUTER for irq with specific-affinity routing (IRM=0) targeting the core identified by mpidr, analogous to pinning a thread to a CPU with k_thread_cpu_pin(). Only valid for SPIs/extended SPIs, and only takes effect once GICv3 affinity routing itself is enabled (GICD_CTLR.ARE_S/ARE_NS) - true by default on builds with CONFIG_ARMV8_A_NS or CONFIG_GIC_SINGLE_SECURITY_STATE, and on any SoC whose own EL3/Secure pre-init already enables it.
Callable at any time after the interrupt is connected, from any core - unlike arm_gic_irq_enable()'s implicit self-affinity (which always targets whichever core is calling it), this can target an arbitrary core. If called after arm_gic_irq_enable(), this call's target wins.
| irq | interrupt ID (must be an SPI or extended SPI) |
| mpidr | target core's MPIDR affinity value. On arm64 this can come from a specific CPU's devicetree node (DT_REG_ADDR(DT_NODELABEL(cpuX))), or, for the core the caller is currently pinned to, from MPIDR_TO_CORE(GET_MPIDR()) |
| void arm_gic_irq_set_pending | ( | unsigned int | irq | ) |
Set interrupt as pending.
| irq | interrupt ID |
Set interrupt priority.
| irq | interrupt ID |
| prio | interrupt priority |
| flags | interrupt flags |
| void arm_gic_secondary_init | ( | void | ) |
Initialize GIC of secondary cores.