MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
INTC: Interrupt Controller Driver

Read Guidance

This document consists of sections titled with Driver Overview, Data Structures, Enumerations, Functions, etc., each with an overview list and detailed documentation. It is recommended to read the Driver Overview first for it includes a comprehensive description of the peripheral, driver and driver changes. Other sections give detailed information for APIs, enums, macros, etc., for your further reference.

Driver Overview

 INTC Peripheral and Driver Overview
 Content including 1) peripheral features; 2) driver design logic and use method; 3) typical use case.
 
 The Driver Change Log
 The current INTC driver version is 2.0.1.
 

Macros

#define INTC_DisableIRQ(x)   INTC_SetIRQPriorityLevel(x, 0U)
 Macro to disable the IRQ. More...
 
#define INTC_PEND_REG_INDEX(x)   ((((uint16_t)(x)) - 1U) >> 4U)
 Helper Macro function to extract IRQ pending register index comparing to INTC_IRQP0. More...
 
#define INTC_PEND_BIT_INDEX(x)   ((((uint16_t)(x)) - 1U) & 0x0FU)
 Helper Macro function to extract pending IRQs bit index. More...
 

Typedefs

typedef void(* fast_irq_handler )(void)
 The handle of the fast irq handler function. More...
 

Driver version

#define FSL_INTC_DRIVER_VERSION   (MAKE_VERSION(2, 0, 1))
 INTC driver version 2.0.1. More...
 

Normal Interrupt Interfaces

static void INTC_SetIRQPriorityNum (IRQn_Type eIrq, uint8_t u8PriorityNum)
 Disable IRQ or Enable IRQ with priority. More...
 
static void INTC_SetVectorBaseAddress (uint32_t u32VectorBaseAddr)
 Set the base address vector table. More...
 

Fast Interrupt Interfaces

static void INTC_SetFastIRQVectorHandler0 (vector_type_t eVector, fast_irq_handler pfHandler)
 Set the IRQ handler for fast IRQ0. More...
 
static void INTC_SetFastIRQVectorHandler1 (vector_type_t eVector, fast_irq_handler pfHandler)
 Set the IRQ handler for fast IRQ1. More...
 

Interrupt Status Interfaces

static uint8_t INTC_GetIRQPermittedPriorityLevel (void)
 Get IRQ permitted priority levels. More...
 
static bool INTC_GetPendingIRQ (vector_type_t eVector)
 Check if IRQ is pending for execution. More...
 
static uint16_t INTC_GetLatestRespondedVectorNumber (void)
 Get the latest responded IRQ's vector number. More...
 

Macro Definition Documentation

#define FSL_INTC_DRIVER_VERSION   (MAKE_VERSION(2, 0, 1))
#define INTC_DisableIRQ (   x)    INTC_SetIRQPriorityLevel(x, 0U)
#define INTC_PEND_REG_INDEX (   x)    ((((uint16_t)(x)) - 1U) >> 4U)
#define INTC_PEND_BIT_INDEX (   x)    ((((uint16_t)(x)) - 1U) & 0x0FU)

Typedef Documentation

typedef void(* fast_irq_handler)(void)

Normally this function should be guarded by: #pragma interrupt fast and #pragma interrupt off.

Function Documentation

static void INTC_SetIRQPriorityNum ( IRQn_Type  eIrq,
uint8_t  u8PriorityNum 
)
inlinestatic

There are similar function in fsl_common:

  • EnableIRQWithPriority,
  • DisableIRQ,
  • EnableIRQ,
  • IRQ_SetPriority.

This function is faster and simpler than those in fsl_common. Generally, this function and IRQ functions in fsl_common are either-or, don't use them together for same IRQn type, but feasible that different IRQn type use them simultaneously, for example: It is OK OCCS_IRQn use INTC_SetIRQPriorityLevel, and ADC12_CC1_IRQn use EnableIRQWithPriority. It is NOT OK that OCCS_IRQn use INTC_SetIRQPriorityLevel and EnableIRQWithPriority simultaneously.

Parameters
eIrqThe IRQ number.
u8PriorityNumIRQ interrupt priority number.
  • 0: disable IRQ.
  • 1-3: enable IRQ and set its priority, 3 is the highest priority for this IRQ and 1 is the lowest priority.
Note
Please note a none-zero priority number does directly map to priority level, simple summary is as below, you could check RM INTC chapter for more details.
  • Some IPs have priority level 1~3, maps priority number 1 to priority 1, 2 to priority 2, 3 to priority 3.
  • Some IPs have priority level 0~2, maps priority number 1 to priority 0, 2 to priority 1, 3 to priority 2.
static void INTC_SetVectorBaseAddress ( uint32_t  u32VectorBaseAddr)
inlinestatic

The value in INTC_VBA is used as the upper 13 bits of the interrupt vector VAB[20:0].

Parameters
u32VectorBaseAddrVector table base address. The address requires 256 words (512 bytes) aligned. Take the vector table in MC56F83xxx_Vectors.c as example for how to implement this table.
static void INTC_SetFastIRQVectorHandler0 ( vector_type_t  eVector,
fast_irq_handler  pfHandler 
)
inlinestatic

The INTC takes the vector address from the appropriate FIVAL0 and FIVAH0 registers, instead of generating an address that is an offset from the vector base address (VBA).

Parameters
eVectorThe vector number.
pfHandlerPointer to the fast IRQ handler function, see fast_irq_handler definition for more info.
static void INTC_SetFastIRQVectorHandler1 ( vector_type_t  eVector,
fast_irq_handler  pfHandler 
)
inlinestatic

The INTC takes the vector address from the appropriate FIVAL1 and FIVAH1 registers, instead of generating an address that is an offset from the vector base address (VBA).

Parameters
eVectorThe eVector number.
pfHandlerPointer to the fast IRQ handler function, see @ ref fast_irq_handler definition for more info.
static uint8_t INTC_GetIRQPermittedPriorityLevel ( void  )
inlinestatic

Interrupt exceptions may be nested to allow the servicing of an IRQ with higher priority than the current exception.

The return value indicate the priority level needed for a new IRQ to interrupt the current interrupt being sent to the Core.

Return values
0Required nested exception priority levels are 0, 1, 2, or 3.
1Required nested exception priority levels are 1, 2, or 3.
2Required nested exception priority levels are 2 or 3.
3Required nested exception priority level is 3.
static bool INTC_GetPendingIRQ ( vector_type_t  eVector)
inlinestatic

Before the ISR is entered, IRQ is pending. After the ISR is entered, the IRQ is not pending.

Parameters
eVectorThe IRQ vector number.
Return values
Trueif interrupt is pending, otherwise return false.
static uint16_t INTC_GetLatestRespondedVectorNumber ( void  )
inlinestatic

It shows the Vector Address Bus used at the time the last IRQ was taken.

Note
Return value of the function call could be different according to where the function call is invoked.
  • when called in normal ISR handler, it returns current ISR's vector number defined in vector_type_t.
  • when called in fast IRQ handler, it returns the lower address bits of the jump address.
  • when called in none ISR handler code, it returns previous responded IRQ vector number defined in vector_type_t or fast IRQ low address bits.
Returns
The latest vector number.