The Generic Interrupt Controller Functions grant access to the configuration, control and status registers of the Generic Interrupt Controller (GIC). More...
Data Structures | |
struct | GICInterface_Type |
Structure type to access the Generic Interrupt Controller Interface (GICC) More... | |
struct | GICDistributor_Type |
Structure type to access the Generic Interrupt Controller Distributor (GICD) More... | |
Macros | |
#define | GICDistributor ((GICDistributor_Type *) GIC_DISTRIBUTOR_BASE ) |
GIC Distributor register set access pointer. | |
#define | GICInterface ((GICInterface_Type *) GIC_INTERFACE_BASE ) |
GIC Interface register set access pointer. | |
Functions | |
__STATIC_INLINE void | GIC_EnableDistributor (void) |
Enable the interrupt distributor using the GIC's CTLR register. | |
__STATIC_INLINE void | GIC_DisableDistributor (void) |
Disable the interrupt distributor using the GIC's CTLR register. | |
__STATIC_INLINE uint32_t | GIC_DistributorInfo (void) |
Read the GIC's TYPER register. | |
__STATIC_INLINE uint32_t | GIC_DistributorImplementer (void) |
Reads the GIC's IIDR register. | |
__STATIC_INLINE void | GIC_SetTarget (IRQn_Type IRQn, uint32_t cpu_target) |
Sets the GIC's ITARGETSR register for the given interrupt. | |
__STATIC_INLINE uint32_t | GIC_GetTarget (IRQn_Type IRQn) |
Read the GIC's ITARGETSR register. | |
__STATIC_INLINE void | GIC_EnableInterface (void) |
Enable the CPU's interrupt interface. | |
__STATIC_INLINE void | GIC_DisableInterface (void) |
Disable the CPU's interrupt interface. | |
__STATIC_INLINE IRQn_Type | GIC_AcknowledgePending (void) |
Read the CPU's IAR register. | |
__STATIC_INLINE void | GIC_EndInterrupt (IRQn_Type IRQn) |
Writes the given interrupt number to the CPU's EOIR register. | |
__STATIC_INLINE void | GIC_EnableIRQ (IRQn_Type IRQn) |
Enables the given interrupt using GIC's ISENABLER register. | |
__STATIC_INLINE void | GIC_DisableIRQ (IRQn_Type IRQn) |
Disables the given interrupt using GIC's ICENABLER register. | |
__STATIC_INLINE void | GIC_SetPendingIRQ (IRQn_Type IRQn) |
Sets the given interrupt as pending using GIC's ISPENDR register. | |
__STATIC_INLINE void | GIC_ClearPendingIRQ (IRQn_Type IRQn) |
Clears the given interrupt from being pending using GIC's ICPENDR register. | |
__STATIC_INLINE void | GIC_SetPriority (IRQn_Type IRQn, uint32_t priority) |
Set the priority for the given interrupt in the GIC's IPRIORITYR register. | |
__STATIC_INLINE uint32_t | GIC_GetPriority (IRQn_Type IRQn) |
Read the current interrupt priority from GIC's IPRIORITYR register. | |
__STATIC_INLINE void | GIC_SetInterfacePriorityMask (uint32_t priority) |
Set the interrupt priority mask using CPU's PMR register. | |
__STATIC_INLINE uint32_t | GIC_GetInterfacePriorityMask (void) |
Read the current interrupt priority mask from CPU's PMR register. | |
__STATIC_INLINE void | GIC_SetBinaryPoint (uint32_t binary_point) |
Configures the group priority and subpriority split point using CPU's BPR register. | |
__STATIC_INLINE uint32_t | GIC_GetBinaryPoint (void) |
Read the current group priority and subpriority split point from CPU's BPR register. | |
__STATIC_INLINE uint32_t | GIC_GetIRQStatus (IRQn_Type IRQn) |
Get the status for a given interrupt. | |
__STATIC_INLINE void | GIC_SendSGI (IRQn_Type IRQn, uint32_t target_list, uint32_t filter_list) |
Generate a software interrupt using GIC's SGIR register. | |
__STATIC_INLINE uint32_t | GIC_GetHighPendingIRQ (void) |
Get the interrupt number of the highest interrupt pending from CPU's HPPIR register. | |
__STATIC_INLINE uint32_t | GIC_GetInterfaceId (void) |
Provides information about the implementer and revision of the CPU interface. | |
__STATIC_INLINE void | GIC_DistInit (void) |
Initialize the interrupt distributor. | |
__STATIC_INLINE void | GIC_CPUInterfaceInit (void) |
Initialize the CPU's interrupt interface. | |
__STATIC_INLINE void | GIC_Enable (void) |
Initialize and enable the GIC. | |
The Generic Interrupt Controller Functions grant access to the configuration, control and status registers of the Generic Interrupt Controller (GIC).
Reference: Generic Interrupt Controller Architecture Specificaton.
The following table shows the register naming of CMSIS in correlation with various technical reference manuals.
CMSIS Register Name | Cortex-A5 TRM | Cortex-A7 TRM | Cortex-A9 TRM |
---|---|---|---|
GIC Distributor | |||
GICDistributor->CTLR | ICDDCR | GICD_CTLR | ICDDCR |
GICDistributor->TYPER | ICDICTR | GICD_TYPER | ICDICTR |
GICDistributor->IIDR | ICDIIDR | GICD_IIDR | ICDIIDR |
GICDistributor->STATUSR | |||
GICDistributor->SETSPI_NSR | |||
GICDistributor->CLRSPI_NSR | |||
GICDistributor->IGROUPR[] | ICDISR | GICD_IGROUPRn | ICDISRn |
GICDistributor->ISENABLER[] | ICDISER | GICD_ISENABLERn | ICDISERn |
GICDistributor->ICENABLER[] | ICDICER | GICD_ICENABLERn | ICDICERn |
GICDistributor->ISPENDR[] | ICDISPR | GICD_ISPENDRn | ICDISPRn |
GICDistributor->ICPENDR[] | ICDICPR | GICD_ICPENDRn | ICDICPRn |
GICDistributor->ISACTIVER[] | ICDABR | GICD_ISACTIVERn | ICDABRn |
GICDistributor->ICACTIVER[] | GICD_ICACTIVERn | ||
GICDistributor->IPRIORITYR[] | ICDIPR | GICD_IPRIORITYRn | ICDIPRn |
GICDistributor->ITARGETSR[] | ICDIPTR | GICD_ITARGETSRn | ICDIPTRn |
GICDistributor->ICFGR[] | ICDICFR | GICD_ICFGRn | ICDICFRn |
GICDistributor->IGRPMODR[0] | ICDPPIS | GICD_PPISR | ppi_status |
GICDistributor->IGRPMODR[31:1] | ICDSPIS | GICD_SPISRn | spi_status |
GICDistributor->NSACR[] | |||
GICDistributor->SGIR | ICDSGIR | GICD_SGIR | ICDSGIR |
GICDistributor->CPENDSGIR[] | GICD_CPENDSGIRn | ||
GICDistributor->SPENDSGIR[] | GICD_SPENDSGIRn | ||
GICDistributor->IROUTER[] | |||
GIC Interface | |||
GICInterface->CTLR | ICPICR | GICC_CTLR | ICCICR |
GICInterface->PMR | ICCIPMR | GICC_PMRn | ICCPMR |
GICInterface->BPR | ICCBPR | GICC_BPR | ICCBPR |
GICInterface->IAR | ICCIAR | GICC_IAR | ICCIAR |
GICInterface->EOIR | ICCEOIR | GICC_EOIR | ICCEOIR |
GICInterface->RPR | ICCRPR | GICC_RPR | ICCRPR |
GICInterface->HPPIR | ICCHPIR | GICC_HPPIR | ICCHPIR |
GICInterface->ABPR | ICCABPR | GICC_ABPR | ICCABPR |
GICInterface->AIAR | GICC_AIAR | ||
GICInterface->AEOIR | GICC_AEOIR | ||
GICInterface->AHPPIR | GICC_AHPPIR | ||
GICInterface->STATUSR | |||
GICInterface->APR[] | GICC_APR0 | ||
GICInterface->NSAPR[] | GICC_NSAPR0 | ||
GICInterface->IIDR | ICCIIDR | GICC_IIDR | ICCIDR |
GICInterface->DIR | GICC_DIR |
#define GICDistributor ((GICDistributor_Type *) GIC_DISTRIBUTOR_BASE ) |
GIC Distributor register set access pointer.
Use GICDistributor to access the GIC Distributor registers.
Example:
#define GICInterface ((GICInterface_Type *) GIC_INTERFACE_BASE ) |
GIC Interface register set access pointer.
Use GICInterface to access the GIC Interface registers.
Example:
__STATIC_INLINE IRQn_Type GIC_AcknowledgePending | ( | void | ) |
Read the CPU's IAR register.
Provides the interrupt number of the highest priority interrupt pending. A read of this register acts as an acknowledge for the interrupt.
The read returns a spurious interrupt number of 1023 if any of the following apply:
__STATIC_INLINE void GIC_ClearPendingIRQ | ( | IRQn_Type | IRQn | ) |
Clears the given interrupt from being pending using GIC's ICPENDR register.
[in] | IRQn | The interrupt to be enabled. |
Removes the pending state from the corresponding interrupt.
__STATIC_INLINE void GIC_CPUInterfaceInit | ( | void | ) |
Initialize the CPU's interrupt interface.
All software generated (SGIs) and private peripheral interrupts (PPIs) are initialized to be
The binary point is set to zero.
The interrupt priority mask is set to 0xFF.
__STATIC_INLINE void GIC_DisableDistributor | ( | void | ) |
Disable the interrupt distributor using the GIC's CTLR register.
Globally disable the forwarding of interrupts to the CPU interfaces.
__STATIC_INLINE void GIC_DisableInterface | ( | void | ) |
Disable the CPU's interrupt interface.
Resets the Enable bit in the local CPUs CTLR register. Only the CPU executing the call is affected.
__STATIC_INLINE void GIC_DisableIRQ | ( | IRQn_Type | IRQn | ) |
Disables the given interrupt using GIC's ICENABLER register.
[in] | IRQn | The interrupt to be disabled. |
Disables forwarding of the corresponding interrupt to the CPU interfaces.
__STATIC_INLINE void GIC_DistInit | ( | void | ) |
Initialize the interrupt distributor.
All shared peripheral interrupts (SPIs) are initialized to be
__STATIC_INLINE uint32_t GIC_DistributorImplementer | ( | void | ) |
Reads the GIC's IIDR register.
Provides information about the implementer and revision of the Distributor.
__STATIC_INLINE uint32_t GIC_DistributorInfo | ( | void | ) |
Read the GIC's TYPER register.
Provides information about the configuration of the GIC. It indicates:
__STATIC_INLINE void GIC_Enable | ( | void | ) |
Initialize and enable the GIC.
Initializes the distributor and the cpu interface.
__STATIC_INLINE void GIC_EnableDistributor | ( | void | ) |
Enable the interrupt distributor using the GIC's CTLR register.
Globally enable the forwarding of interrupts to the CPU interfaces.
__STATIC_INLINE void GIC_EnableInterface | ( | void | ) |
Enable the CPU's interrupt interface.
Sets the Enable bit in the local CPUs CTLR register. Only the CPU executing the call is affected.
__STATIC_INLINE void GIC_EnableIRQ | ( | IRQn_Type | IRQn | ) |
Enables the given interrupt using GIC's ISENABLER register.
[in] | IRQn | The interrupt to be enabled. |
Enables forwarding of the corresponding interrupt to the CPU interfaces.
__STATIC_INLINE void GIC_EndInterrupt | ( | IRQn_Type | IRQn | ) |
Writes the given interrupt number to the CPU's EOIR register.
[in] | IRQn | The interrupt to be signaled as finished. |
A write to this register performs priority drop for the specified interrupt.
For nested interrupts, the order of calls to this function must be the reverse of the order of interrupt acknowledgement, i.e. calls to GIC_AcknowledgePending. Behavior is UNPREDICTABLE if:
__STATIC_INLINE uint32_t GIC_GetBinaryPoint | ( | void | ) |
Read the current group priority and subpriority split point from CPU's BPR register.
__STATIC_INLINE uint32_t GIC_GetHighPendingIRQ | ( | void | ) |
Get the interrupt number of the highest interrupt pending from CPU's HPPIR register.
__STATIC_INLINE uint32_t GIC_GetInterfaceId | ( | void | ) |
Provides information about the implementer and revision of the CPU interface.
__STATIC_INLINE uint32_t GIC_GetInterfacePriorityMask | ( | void | ) |
Read the current interrupt priority mask from CPU's PMR register.
__STATIC_INLINE uint32_t GIC_GetIRQStatus | ( | IRQn_Type | IRQn | ) |
Get the status for a given interrupt.
[in] | IRQn | The interrupt to get status for. |
The return value is a combination of GIC's ISACTIVER and ISPENDR registers.
Bit 0 denotes interrupts pending bit (interrupt should be handled) and bit 1 denotes interrupts active bit (interrupt is currently handled).
__STATIC_INLINE uint32_t GIC_GetPriority | ( | IRQn_Type | IRQn | ) |
Read the current interrupt priority from GIC's IPRIORITYR register.
[in] | IRQn | The interrupt to be queried. |
Can be used to retrieve the actual priority depending on the GIC implementation.
__STATIC_INLINE uint32_t GIC_GetTarget | ( | IRQn_Type | IRQn | ) |
Read the GIC's ITARGETSR register.
[in] | IRQn | Interrupt to acquire the configuration for. |
Read the current interrupt to CPU assignment for the given interrupt.
__STATIC_INLINE void GIC_SendSGI | ( | IRQn_Type | IRQn, |
uint32_t | target_list, | ||
uint32_t | filter_list | ||
) |
Generate a software interrupt using GIC's SGIR register.
[in] | IRQn | Software interrupt to be generated. |
[in] | target_list | List of CPUs the software interrupt should be forwarded to. |
[in] | filter_list | Filter to be applied to determine interrupt receivers. |
__STATIC_INLINE void GIC_SetBinaryPoint | ( | uint32_t | binary_point | ) |
Configures the group priority and subpriority split point using CPU's BPR register.
[in] | binary_point | Amount of bits used as subpriority. |
The binary point defines the amount of priority bits used as a group priority and subpriorities.
Interrupts sharing the same group priority do not preempt each other. But interrupts having a higher group priority (lower value) preempt interrups with a lower group priority.
The subpriority defines the execution sequence of interrupts with the same group priority if multiple are pending at time.
__STATIC_INLINE void GIC_SetInterfacePriorityMask | ( | uint32_t | priority | ) |
Set the interrupt priority mask using CPU's PMR register.
[in] | priority | Priority mask to be set. |
Only interrupts with a higher priority (lower values) than the value provided are signaled.
__STATIC_INLINE void GIC_SetPendingIRQ | ( | IRQn_Type | IRQn | ) |
Sets the given interrupt as pending using GIC's ISPENDR register.
[in] | IRQn | The interrupt to be enabled. |
Adds the pending state to the corresponding interrupt.
__STATIC_INLINE void GIC_SetPriority | ( | IRQn_Type | IRQn, |
uint32_t | priority | ||
) |
Set the priority for the given interrupt in the GIC's IPRIORITYR register.
[in] | IRQn | The interrupt to be configured. |
[in] | priority | The priority for the interrupt, lower values denote higher priorities. |
Configures the priority of the given interrupt.
The available interrupt priorities are IMPLEMENTATION DEFINED. In order to query the actual priorities one can
__STATIC_INLINE void GIC_SetTarget | ( | IRQn_Type | IRQn, |
uint32_t | cpu_target | ||
) |
Sets the GIC's ITARGETSR register for the given interrupt.
[in] | IRQn | Interrupt to be configured. |
[in] | cpu_target | CPU interfaces to assign this interrupt to. |
The ITARGETSR registers provide an 8-bit CPU targets field for each interrupt supported by the GIC. This field stores the list of target processors for the interrupt. That is, it holds the list of CPU interfaces to which the Distributor forwards the interrupt if it is asserted and has sufficient priority.