Nut/OS  5.0.5
API Reference
Interrupt_api

Functions

unsigned char IntMasterEnable (void)
unsigned char IntMasterDisable (void)
void IntRegister (IRQn_Type ulInterrupt, void(*pfnHandler)(void *))
void IntUnregister (IRQn_Type ulInterrupt)
void IntPrioritySet (IRQn_Type Interrupt, uint32_t Priority)
uint32_t IntPriorityGet (IRQn_Type Interrupt)
void IntEnable (IRQn_Type ulInterrupt)
void IntDisable (IRQn_Type ulInterrupt)
int IntIsEnabled (IRQn_Type ulInterrupt)
void Cortex_IntInit (void)
void CortexExceptHandler (int state)

Variables

void * _evect

Function Documentation

unsigned char IntMasterEnable ( void  )

Enables the processor interrupt.

Allows the processor to respond to interrupts. This does not affect the set of interrupts enabled in the interrupt controller; it just gates the single interrupt from the controller to the processor.

Returns:
Returns true if interrupts were disabled when the function was called or false if they were initially enabled.

References CPUcpsie().

Here is the call graph for this function:

unsigned char IntMasterDisable ( void  )

Disables the processor interrupt.

Prevents the processor from receiving interrupts. This does not affect the set of interrupts enabled in the interrupt controller; it just gates the single interrupt from the controller to the processor.

Returns:
Returns true if interrupts were already disabled when the function was called or false if they were initially enabled.

References CPUcpsid().

Here is the call graph for this function:

void IntRegister ( IRQn_Type  ulInterrupt,
void(*)(void *)  pfnHandler 
)

Registers a function to be called when an interrupt occurs.

Parameters:
ulInterruptspecifies 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 will be called in interrupt context. Since 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 NVIC will 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; some tool chains, such as the evaluation version of RV-MDK, do not support linker scripts and therefore will not produce a valid executable. See the discussion of compile-time versus run-time interrupt handler registration in the introduction to this chapter.
Returns:
None.

References NUTASSERT.

Referenced by DMA_Init(), and NutRegisterTimer().

void IntUnregister ( IRQn_Type  ulInterrupt)

Unregisters the function to be called when an interrupt occurs.

Parameters:
ulInterruptspecifies the interrupt in question.

This function is used to indicate that no handler should be called when the given interrupt is asserted to the processor. The interrupt source will be automatically disabled (via IntDisable()) if necessary.

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

References NUTASSERT.

void IntPrioritySet ( IRQn_Type  Interrupt,
uint32_t  Priority 
)

Sets the priority grouping of the interrupt controller.

Parameters:
ulBitsspecifies the number of bits of preemptable priority.

This function specifies the split between preemptable priority levels and subpriority levels in the interrupt priority specification. The range of the grouping values are dependent upon the hardware implementation; on the Stellaris family, three bits are available for hardware interrupt prioritization and therefore priority grouping values of three through seven have the same effect.

Returns:
None. Gets the priority grouping of the interrupt controller.

This function returns the split between preemptable priority levels and subpriority levels in the interrupt priority specification.

Returns:
The number of bits of preemptable priority. Sets the priority of an interrupt.
Parameters:
ulInterruptspecifies the interrupt in question.
ucPriorityspecifies 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 will only look at the upper N bits of the priority level (where N is 3 for the Stellaris 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.

References NVIC_SetPriority().

Here is the call graph for this function:

uint32_t IntPriorityGet ( IRQn_Type  Interrupt)

Gets the priority of an interrupt.

Parameters:
ulInterruptspecifies 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.

References NVIC_GetPriority().

Here is the call graph for this function:

void IntEnable ( IRQn_Type  ulInterrupt)

Enables an interrupt.

Parameters:
ulInterruptspecifies 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.

References BusFault_IRQn, MemoryManagement_IRQn, NVIC_EnableIRQ(), SCB, SCB_SHCSR_BUSFAULTENA_Msk, SCB_SHCSR_MEMFAULTENA_Msk, SCB_SHCSR_USGFAULTENA_Msk, SysTick, SysTick_CTRL_TICKINT_Msk, SysTick_IRQn, and UsageFault_IRQn.

Referenced by Cortex_IntInit(), and DMA_Init().

Here is the call graph for this function:

void IntDisable ( IRQn_Type  ulInterrupt)

Disables an interrupt.

Parameters:
ulInterruptspecifies 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.

References BusFault_IRQn, MemoryManagement_IRQn, NVIC_DisableIRQ(), SCB, SCB_SHCSR_BUSFAULTENA_Msk, SCB_SHCSR_MEMFAULTENA_Msk, SCB_SHCSR_USGFAULTENA_Msk, SysTick, SysTick_CTRL_TICKINT_Msk, SysTick_IRQn, and UsageFault_IRQn.

Referenced by Cortex_IntInit().

Here is the call graph for this function:

int IntIsEnabled ( IRQn_Type  ulInterrupt)

Check if an interrupt is enabled.

Parameters:
ulInterruptspecifies the interrupt to check.

Check if the specified interrupt is enabled in the interrupt controller.

Returns:
-1 for invalid interrupt, 0 if disabled, 1 if enabled.

References BusFault_IRQn, HardFault_IRQn, MemoryManagement_IRQn, NonMaskableInt_IRQn, NVIC_GetEnableIRQ, rc, SCB, SCB_SHCSR_BUSFAULTENA_Msk, SCB_SHCSR_MEMFAULTENA_Msk, SCB_SHCSR_USGFAULTENA_Msk, SysTick, SysTick_CTRL_TICKINT_Msk, SysTick_IRQn, and UsageFault_IRQn.

void Cortex_IntInit ( void  )

References __enable_irq(), g_pfnVectors, IntDisable(), IntEnable(), NULL, SCB, SCB_ICSR_ISRPENDING_Msk, SCB_ICSR_PENDSTCLR_Msk, and SCB_ICSR_PENDSVCLR_Msk.

Referenced by Cortex_Start().

Here is the call graph for this function:

void CortexExceptHandler ( int  state)

References __get_CONTROL(), __set_CONTROL(), SCB, SCB_SHCSR_BUSFAULTENA, SCB_SHCSR_MEMFAULTENA, and SCB_SHCSR_USGFAULTENA.

Here is the call graph for this function:


Variable Documentation

void* _evect