Tiva Driver Lib
Macros | Functions
Interrupt_api

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)
 

Detailed Description

Function Documentation

void IntDisable ( uint32_t  ui32Interrupt)

Disables an interrupt.

Parameters
ui32Interruptspecifies the interrupt to be disabled.

The specified interrupt is disabled in the interrupt controller. Other enables for the interrupt (such as at the peripheral level) are unaffected by this function.

Returns
None.
void IntEnable ( uint32_t  ui32Interrupt)

Enables an interrupt.

Parameters
ui32Interruptspecifies the interrupt to be enabled.

The specified interrupt is enabled in the interrupt controller. Other enables for the interrupt (such as at the peripheral level) are unaffected by this function.

Returns
None.
uint32_t IntIsEnabled ( uint32_t  ui32Interrupt)

Returns if a peripheral interrupt is enabled.

Parameters
ui32Interruptspecifies the interrupt to check.

This function checks if the specified interrupt is enabled in the interrupt controller.

Returns
A non-zero value if the interrupt is enabled.
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.

Note
Previously, this function had no return value. As such, it was possible to include interrupt.h and call this function without having included hw_types.h. Now that the return is a bool, a compiler error occurs in this case. The solution is to include hw_types.h before including interrupt.h.
Returns
Returns true if interrupts were already disabled when the function was called or false if they were initially enabled.
void IntPendClear ( uint32_t  ui32Interrupt)

Un-pends an interrupt.

Parameters
ui32Interruptspecifies the interrupt to be un-pended.

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.

Returns
None.
void IntPendSet ( uint32_t  ui32Interrupt)

Pends an interrupt.

Parameters
ui32Interruptspecifies the interrupt to be pended.

The specified interrupt is pended in the interrupt controller. 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.

Returns
None.
int32_t IntPriorityGet ( uint32_t  ui32Interrupt)

Gets the priority of an interrupt.

Parameters
ui32Interruptspecifies the interrupt in question.

This function gets the priority of an interrupt. See IntPrioritySet() for a definition of the priority value.

Returns
Returns the interrupt priority, or -1 if an invalid interrupt was specified.
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.

Returns
The number of bits of preemptable priority.
void IntPriorityGroupingSet ( uint32_t  ui32Bits)

Sets the priority grouping of the interrupt controller.

Parameters
ui32Bitsspecifies 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. The range of the grouping values are dependent upon the hardware implementation; on the Tiva C and E Series family, three bits are available for hardware interrupt prioritization and therefore priority grouping values of three through seven have the same effect.

Returns
None.
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 N bits of the priority level (where N is 3 for the Tiva C and E Series family), so any prioritization must be performed in those bits.

Returns
Returns the value of the interrupt priority level mask.
void IntPriorityMaskSet ( uint32_t  ui32PriorityMask)

Sets the priority masking level

Parameters
ui32PriorityMaskis 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.

The hardware priority mechanism only looks at the upper N bits of the priority level (where N is 3 for the Tiva C and E Series family), so any prioritization must be performed in those bits.

Returns
None.
void IntPrioritySet ( uint32_t  ui32Interrupt,
uint8_t  ui8Priority 
)

Sets the priority of an interrupt.

Parameters
ui32Interruptspecifies the interrupt in question.
ui8Priorityspecifies the priority of the interrupt.

This function is used to set the priority of an interrupt. 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.

The hardware priority mechanism only looks at the upper N bits of the priority level (where N is 3 for the Tiva C and E Series family), so any prioritization must be performed in those bits. The remaining bits can be used to sub-prioritize the interrupt sources, and may be used by the hardware priority mechanism on a future part. This arrangement allows priorities to migrate to different NVIC implementations without changing the gross prioritization of the interrupts.

Returns
None.
void IntRegister ( uint32_t  ui32Interrupt,
void(*)(void)  pfnHandler 
)

Registers a function to be called when an interrupt occurs.

Parameters
ui32Interruptspecifies the interrupt in question.
pfnHandleris 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. 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.

Note
The use of this function (directly or indirectly via a peripheral driver interrupt register function) moves the interrupt vector table from flash to SRAM. Therefore, care must be taken when linking the application to ensure that the SRAM vector table is located at the beginning of SRAM; otherwise the NVIC does not look in the correct portion of memory for the vector table (it requires the vector table be on a 1 kB memory alignment). Normally, the SRAM vector table is so placed via the use of linker scripts. See the discussion of compile-time versus run-time interrupt handler registration in the introduction to this chapter.
Returns
None.
void IntTrigger ( uint32_t  ui32Interrupt)

Triggers an interrupt.

Parameters
ui32Interruptspecifies the interrupt to be triggered.

This function performs a software trigger of an interrupt. 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).

Returns
None.
void IntUnregister ( uint32_t  ui32Interrupt)

Unregisters the function to be called when an interrupt occurs.

Parameters
ui32Interruptspecifies 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 interrupt source is automatically disabled (via IntDisable()) if necessary.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.