Macros | |
#define | NUM_INTERRUPTS 155 |
Functions | |
bool | IntMasterDisable (void) |
void | IntRegister (uint32_t ui32Interrupt, void(*pfnHandler)(void)) |
void | IntUnregister (uint32_t ui32Interrupt) |
void | IntPriorityGroupingSet (uint32_t ui32Bits) |
uint32_t | IntPriorityGroupingGet (void) |
void | IntPrioritySet (uint32_t ui32Interrupt, uint8_t ui8Priority) |
int32_t | IntPriorityGet (uint32_t ui32Interrupt) |
void | IntEnable (uint32_t ui32Interrupt) |
void | IntDisable (uint32_t ui32Interrupt) |
uint32_t | IntIsEnabled (uint32_t ui32Interrupt) |
void | IntPendSet (uint32_t ui32Interrupt) |
void | IntPendClear (uint32_t ui32Interrupt) |
void | IntPriorityMaskSet (uint32_t ui32PriorityMask) |
uint32_t | IntPriorityMaskGet (void) |
void | IntTrigger (uint32_t ui32Interrupt) |
#define NUM_INTERRUPTS 155 |
Referenced by IntDisable(), IntEnable(), IntIsEnabled(), IntPendClear(), IntPendSet(), IntPriorityGet(), IntPrioritySet(), IntRegister(), IntTrigger(), and IntUnregister().
bool IntMasterDisable | ( | void | ) |
Disables the processor interrupt.
This function prevents the processor from receiving interrupts. This function does not affect the set of interrupts enabled in the interrupt controller; it just gates the single interrupt from the controller to the processor.
interrupt.h
and call this function without having included types.h
. Now that the return is a bool
, a compiler error occurs in this case. The solution is to include types.h
before including interrupt.h
.Example: Disable interrupts to the processor.
//! // //! // Disable interrupts to the processor. //! // //! IntMasterDisable(); //! //!
\return Returns \b true if interrupts were already disabled when the function was called or \b false if they were initially enabled.
References CPUcpsid().
void IntRegister | ( | uint32_t | ui32Interrupt, |
void(*)(void) | pfnHandler | ||
) |
Registers a function to be called when an interrupt occurs.
ui32Interrupt | specifies the interrupt in question. |
pfnHandler | is a pointer to the function to be called. |
This function is used to specify the handler function to be called when the given interrupt is asserted to the processor. The ui32Interrupt parameter must be one of the valid INT_* values listed in Peripheral Driver Library User's Guide and defined in the inc/hw_ints.h header file. When the interrupt occurs, if it is enabled (via IntEnable()), the handler function is called in interrupt context. Because the handler function can preempt other code, care must be taken to protect memory or peripherals that are accessed by the handler and other non-handler code.
Example: Set the UART 0 interrupt handler.
//! //! // //! // UART 0 interrupt handler. //! // //! void //! UART0Handler(void) //! { //! // //! // Handle interrupt. //! // //! } //! //! // //! // Set the UART 0 interrupt handler. //! // //! IntRegister(INT_UART0, UART0Handler); //! //!
\return None.
References ASSERT, HWREG, NUM_INTERRUPTS, and NVIC_VTABLE.
Referenced by AESIntRegister(), ComparatorIntRegister(), DESIntRegister(), EMACIntRegister(), FlashIntRegister(), LCDIntRegister(), MPUIntRegister(), SHAMD5IntRegister(), SysCtlIntRegister(), SysTickIntRegister(), uDMAIntRegister(), and WatchdogIntRegister().
void IntUnregister | ( | uint32_t | ui32Interrupt | ) |
Unregisters the function to be called when an interrupt occurs.
ui32Interrupt | specifies the interrupt in question. |
This function is used to indicate that no handler is called when the given interrupt is asserted to the processor. The ui32Interrupt parameter must be one of the valid INT_* values listed in Peripheral Driver Library User's Guide and defined in the inc/hw_ints.h header file. The interrupt source is automatically disabled (via IntDisable()) if necessary.
Example: Reset the UART 0 interrupt handler to the default handler.
//! // //! // Reset the UART 0 interrupt handler to the default handler. //! // //! IntUnregister(INT_UART0); //! //!
\return None.
References ASSERT, and NUM_INTERRUPTS.
Referenced by AESIntUnregister(), ComparatorIntUnregister(), DESIntUnregister(), EMACIntUnregister(), FlashIntUnregister(), LCDIntUnregister(), MPUIntUnregister(), SHAMD5IntUnregister(), SysCtlIntUnregister(), SysTickIntUnregister(), uDMAIntUnregister(), and WatchdogIntUnregister().
void IntPriorityGroupingSet | ( | uint32_t | ui32Bits | ) |
Sets the priority grouping of the interrupt controller.
ui32Bits | specifies the number of bits of preemptable priority. |
This function specifies the split between preemptable priority levels and sub-priority levels in the interrupt priority specification. Three bits are available for hardware interrupt prioritization and therefore priority grouping values of three through seven have the same effect.
Example: Set the priority grouping for the interrupt controller.
//! // //! // Set the priority grouping for the interrupt controller to 2 bits. //! // //! IntPriorityGroupingSet(2); //! //!
\return None.
References ASSERT, HWREG, NUM_PRIORITY, NVIC_APINT, and NVIC_APINT_VECTKEY.
uint32_t IntPriorityGroupingGet | ( | void | ) |
Gets the priority grouping of the interrupt controller.
This function returns the split between preemptable priority levels and sub-priority levels in the interrupt priority specification.
Example: Get the priority grouping for the interrupt controller.
//! // //! // Get the priority grouping for the interrupt controller. //! // //! IntPriorityGroupingGet(); //! //!
\return The number of bits of preemptable priority.
References HWREG, NUM_PRIORITY, NVIC_APINT, and NVIC_APINT_PRIGROUP_M.
void IntPrioritySet | ( | uint32_t | ui32Interrupt, |
uint8_t | ui8Priority | ||
) |
Sets the priority of an interrupt.
ui32Interrupt | specifies the interrupt in question. |
ui8Priority | specifies the priority of the interrupt. |
This function is used to set the priority of an interrupt. The ui32Interrupt parameter must be one of the valid INT_* values listed in Peripheral Driver Library User's Guide and defined in the inc/hw_ints.h header file. The ui8Priority parameter specifies the interrupts hardware priority level of the interrupt in the interrupt controller. When multiple interrupts are asserted simultaneously, the ones with the highest priority are processed before the lower priority interrupts. Smaller numbers correspond to higher interrupt priorities; priority 0 is the highest interrupt priority.
Example: Set priorities for UART 0 and USB interrupts.
//! // //! // Set the UART 0 interrupt priority to the lowest priority. //! // //! IntPrioritySet(INT_UART0, 0xE0); //! //! // //! // Set the USB 0 interrupt priority to the highest priority. //! // //! IntPrioritySet(INT_USB0, 0); //! //!
\return None.
References ASSERT, HWREG, and NUM_INTERRUPTS.
int32_t IntPriorityGet | ( | uint32_t | ui32Interrupt | ) |
Gets the priority of an interrupt.
ui32Interrupt | specifies the interrupt in question. |
This function gets the priority of an interrupt. The ui32Interrupt parameter must be one of the valid INT_* values listed in Peripheral Driver Library User's Guide and defined in the inc/hw_ints.h header file. See IntPrioritySet() for a full definition of the priority value.
Example: Get the current UART 0 interrupt priority.
//! // //! // Get the current UART 0 interrupt priority. //! // //! IntPriorityGet(INT_UART0); //! //!
\return Returns the interrupt priority for the given interrupt.
References ASSERT, HWREG, and NUM_INTERRUPTS.
void IntEnable | ( | uint32_t | ui32Interrupt | ) |
Enables an interrupt.
ui32Interrupt | specifies the interrupt to be enabled. |
The specified interrupt is enabled in the interrupt controller. The ui32Interrupt parameter must be one of the valid INT_* values listed in Peripheral Driver Library User's Guide and defined in the inc/hw_ints.h header file. Other enables for the interrupt (such as at the peripheral level) are unaffected by this function.
Example: Enable the UART 0 interrupt.
//! // //! // Enable the UART 0 interrupt in the interrupt controller. //! // //! IntEnable(INT_UART0); //! //!
\return None.
References ASSERT, FAULT_BUS, FAULT_MPU, FAULT_SYSTICK, FAULT_USAGE, HWREG, NUM_INTERRUPTS, NVIC_ST_CTRL, NVIC_ST_CTRL_INTEN, NVIC_SYS_HND_CTRL, NVIC_SYS_HND_CTRL_BUS, NVIC_SYS_HND_CTRL_MEM, and NVIC_SYS_HND_CTRL_USAGE.
Referenced by AESIntRegister(), ComparatorIntRegister(), DESIntRegister(), EMACIntRegister(), FlashIntRegister(), LCDIntRegister(), MPUIntRegister(), SHAMD5IntRegister(), SysCtlIntRegister(), uDMAIntRegister(), and WatchdogIntRegister().
void IntDisable | ( | uint32_t | ui32Interrupt | ) |
Disables an interrupt.
ui32Interrupt | specifies the interrupt to be disabled. |
The specified interrupt is disabled in the interrupt controller. The ui32Interrupt parameter must be one of the valid INT_* values listed in interrupt.h. Other enables for the interrupt (such as at the peripheral level) are unaffected by this function.
Example: Disable the UART 0 interrupt.
//! // //! // Disable the UART 0 interrupt in the interrupt controller. //! // //! IntDisable(INT_UART0); //! //!
\return None.
References ASSERT, FAULT_BUS, FAULT_MPU, FAULT_SYSTICK, FAULT_USAGE, HWREG, NUM_INTERRUPTS, NVIC_ST_CTRL, NVIC_ST_CTRL_INTEN, NVIC_SYS_HND_CTRL, NVIC_SYS_HND_CTRL_BUS, NVIC_SYS_HND_CTRL_MEM, and NVIC_SYS_HND_CTRL_USAGE.
Referenced by AESIntUnregister(), ComparatorIntUnregister(), DESIntUnregister(), EMACIntUnregister(), FlashIntUnregister(), LCDIntUnregister(), MPUIntUnregister(), SHAMD5IntUnregister(), SysCtlIntUnregister(), uDMAIntUnregister(), and WatchdogIntUnregister().
uint32_t IntIsEnabled | ( | uint32_t | ui32Interrupt | ) |
Returns if a peripheral interrupt is enabled.
ui32Interrupt | specifies the interrupt to check. |
This function checks if the specified interrupt is enabled in the interrupt controller. The ui32Interrupt parameter must be one of the valid INT_* values listed in interrupt.h.
Example: Disable the UART 0 interrupt if it is enabled.
//! // //! // Disable the UART 0 interrupt if it is enabled. //! // //! if(IntIsEnabled(INT_UART0)) //! { //! IntDisable(INT_UART0); //! } //!
\return A non-zero value if the interrupt is enabled.
References ASSERT, FAULT_BUS, FAULT_MPU, FAULT_SYSTICK, FAULT_USAGE, HWREG, NUM_INTERRUPTS, NVIC_ST_CTRL, NVIC_ST_CTRL_INTEN, NVIC_SYS_HND_CTRL, NVIC_SYS_HND_CTRL_BUS, NVIC_SYS_HND_CTRL_MEM, and NVIC_SYS_HND_CTRL_USAGE.
void IntPendSet | ( | uint32_t | ui32Interrupt | ) |
Pends an interrupt.
ui32Interrupt | specifies the interrupt to be pended. |
The specified interrupt is pended in the interrupt controller. The ui32Interrupt parameter must be one of the valid INT_* values listed in interrupt.h. Pending an interrupt causes the interrupt controller to execute the corresponding interrupt handler at the next available time, based on the current interrupt state priorities. For example, if called by a higher priority interrupt handler, the specified interrupt handler is not called until after the current interrupt handler has completed execution. The interrupt must have been enabled for it to be called.
Example: Pend a UART 0 interrupt.
//! // //! // Pend a UART 0 interrupt. //! // //! IntPendSet(INT_UART0); //!
\return None.
References ASSERT, FAULT_NMI, FAULT_PENDSV, FAULT_SYSTICK, HWREG, NUM_INTERRUPTS, NVIC_INT_CTRL, NVIC_INT_CTRL_NMI_SET, NVIC_INT_CTRL_PEND_SV, and NVIC_INT_CTRL_PENDSTSET.
void IntPendClear | ( | uint32_t | ui32Interrupt | ) |
Un-pends an interrupt.
ui32Interrupt | specifies the interrupt to be un-pended. The ui32Interrupt parameter must be one of the valid INT_* values listed in interrupt.h. |
The specified interrupt is un-pended in the interrupt controller. This causes any previously generated interrupts that have not been handled yet (due to higher priority interrupts or the interrupt not having been enabled yet) to be discarded.
Example: Un-pend a UART 0 interrupt.
//! // //! // Un-pend a UART 0 interrupt. //! // //! IntPendClear(INT_UART0); //!
\return None.
References ASSERT, FAULT_PENDSV, FAULT_SYSTICK, HWREG, NUM_INTERRUPTS, NVIC_INT_CTRL, NVIC_INT_CTRL_PENDSTCLR, and NVIC_INT_CTRL_UNPEND_SV.
void IntPriorityMaskSet | ( | uint32_t | ui32PriorityMask | ) |
Sets the priority masking level
ui32PriorityMask | is the priority level that is masked. |
This function sets the interrupt priority masking level so that all interrupts at the specified or lesser priority level are masked. Masking interrupts can be used to globally disable a set of interrupts with priority below a predetermined threshold. A value of 0 disables priority masking.
Smaller numbers correspond to higher interrupt priorities. So for example a priority level mask of 4 allows interrupts of priority level 0-3, and interrupts with a numerical priority of 4 and greater are blocked.
Example: Mask of interrupt priorities greater than or equal to 0x80.
//! // //! // Mask of interrupt priorities greater than or equal to 0x80. //! // //! IntPriorityMaskSet(0x80); //!
\return None.
References CPUbasepriSet().
uint32_t IntPriorityMaskGet | ( | void | ) |
Gets the priority masking level
This function gets the current setting of the interrupt priority masking level. The value returned is the priority level such that all interrupts of that and lesser priority are masked. A value of 0 means that priority masking is disabled.
Smaller numbers correspond to higher interrupt priorities. So for example a priority level mask of 4 allows interrupts of priority level 0-3, and interrupts with a numerical priority of 4 and greater are blocked.
The hardware priority mechanism only looks at the upper 3 bits of the priority level, so any prioritization must be performed in those bits.
Example: Get the current interrupt priority mask.
//! // //! // Get the current interrupt priority mask. //! // //! IntPriorityMaskGet(); //!
\return Returns the value of the interrupt priority level mask.
References CPUbasepriGet().
void IntTrigger | ( | uint32_t | ui32Interrupt | ) |
Triggers an interrupt.
ui32Interrupt | specifies the interrupt to be triggered. |
This function performs a software trigger of an interrupt. The ui32Interrupt parameter must be one of the valid INT_* values listed in interrupt.h. The interrupt controller behaves as if the corresponding interrupt line was asserted, and the interrupt is handled in the same manner (meaning that it must be enabled in order to be processed, and the processing is based on its priority with respect to other unhandled interrupts).
References ASSERT, HWREG, NUM_INTERRUPTS, and NVIC_SW_TRIG.