AVR SD Safety Framework 1.0.0
Loading...
Searching...
No Matches
Interrupt Manager

Contains API prototypes for the Interrupt Manager. More...

Files

file  midware_interrupt_manager.c
 Implements APIs for the Interrupt Manager.
file  midware_interrupt_manager.h
 Contains API prototypes for the Interrupt Manager.

Functions

void MW_SetIntVectorLayout (bool expectAltLoc, bool expectCompactTable)
 Configures the expected interrupt vector table location and whether the Compact Vector Table (CVT) format is used.
errFlag_t MW_SetIntPriority (bool useRoundRobin, uint8_t altStartVect, uint8_t highPriorityVect)
 Configures interrupt scheduling and priority scheme.
errFlag_t MW_EnableGlobalInterrupts (void)
 Enables global interrupts on the device.
void MW_DisableGlobalInterrupts (void)
 Disables global interrupts on the device.
bool MW_EnterCriticalSection (void)
 Enters a critical section by disabling global interrupts.
void MW_ExitCriticalSection (bool wasInterruptEnabled)
 Exits a critical section by restoring the previous global interrupt state.

Detailed Description

Contains API prototypes for the Interrupt Manager.

The Interrupt Manager provides services to Tasks to ensure correct interaction with features of the CPUCTRL and CPUINT modules.

UML Class Diagrams

UML Activity Diagrams

Function Documentation

◆ MW_DisableGlobalInterrupts()

void MW_DisableGlobalInterrupts ( void )

Disables global interrupts on the device.

Note
Non-Maskable Interrupts (NMI) are not affected by this function.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MW_EnableGlobalInterrupts()

errFlag_t MW_EnableGlobalInterrupts ( void )

Enables global interrupts on the device.

This function sets the global interrupts enable bit in the CPU status register, and verifies the status by reading back the bit.

Note

When global interrupts are expected to remain enabled, this function may be called periodically to re-establish and verify the global interrupt enable state.

Note

This function is not intended to restore the interrupt state after a critical section. Use MW_EnterCriticalSection and MW_ExitCriticalSection for state-preserving critical sections.

Return values
ERRORFailed to enable global interrupts.
NO_ERRORGlobal interrupts enabled successfully.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MW_EnterCriticalSection()

bool MW_EnterCriticalSection ( void )

Enters a critical section by disabling global interrupts.

This function reads the current global interrupt enable state and disables global interrupts. The returned state should be passed to the corresponding MW_ExitCriticalSection call to restore the interrupt state that existed before entering the critical section.

Critical sections may be nested when each call to this function is paired with MW_ExitCriticalSection using the state returned by the corresponding entry.

Note

This function prevents maskable interrupt preemption by clearing the global interrupt enable flag. It does not disable non-maskable interrupts (NMI).

Return values
trueGlobal interrupts were enabled before entering the critical section.
falseGlobal interrupts were already disabled before entering the critical section.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MW_ExitCriticalSection()

void MW_ExitCriticalSection ( bool wasInterruptEnabled)

Exits a critical section by restoring the previous global interrupt state.

This function restores only the global interrupt enable state. It does not perform the readback verification provided by MW_EnableGlobalInterrupts.

For nested critical sections, calls to this function should be made in reverse order using the state returned by the corresponding MW_EnterCriticalSection call.

Parameters
wasInterruptEnabledGlobal interrupt state returned by the corresponding MW_EnterCriticalSection call.
Note
When global interrupts are expected to remain enabled, MW_EnableGlobalInterrupts may be called periodically to re-establish and verify the global interrupt enable state within the applicable fault-handling deadline.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MW_SetIntPriority()

errFlag_t MW_SetIntPriority ( bool useRoundRobin,
uint8_t altStartVect,
uint8_t highPriorityVect )

Configures interrupt scheduling and priority scheme.

This function enables or disables round robin interrupt scheduling for normal (level 0) interrupts and selects a starting vector priority order for both static and round robin scheduling. It also optionally sets which interrupt vector has high priority (level 1) which can interrupt other normal interrupts.

Parameters
useRoundRobinEnables or disables round robin scheduling.
altStartVectSets the lowest priority vector number for static scheduling and the initial round robin schedule. Set to 0 to use default priority based on vector number.
highPriorityVectSets the high priority interrupt vector number. Set to 0 to disable this feature.
Return values
ERRORProvided interrupt vector numbers are invalid, function aborted.
NO_ERRORInterrupt priority and scheduling successfully configured.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MW_SetIntVectorLayout()

void MW_SetIntVectorLayout ( bool expectAltLoc,
bool expectCompactTable )

Configures the expected interrupt vector table location and whether the Compact Vector Table (CVT) format is used.

This function configures which interrupt vector table layout the device should expect during program execution.

Note

If the CVT setting is enabled, the interrupt vector table must be programmed in Compact Vector Table format, with separate vectors for NMI and level 1 interrupts and a shared vector for all level 0 interrupts. See the CVT bit description in CPUINT.CTRLA in the device data sheet for more information.

Note

If Flash memory is partitioned into a BOOT section and application memory, the interrupt vector table can be programmed either at the start of the BOOT section or directly after the BOOT section. The alternate location setting should be enabled if the interrupt vector table is placed at the start of the BOOT section and disabled if it is placed directly after the BOOT section. When the entire Flash is configured as a BOOT section, the alternate location setting has no effect because the interrupt vector table is always expected at the start of Flash. See the IVSEL bit description in CPUINT.CTRLA in the device data sheet for more information.

Warning
These settings should be configured before global interrupts are enabled. See

MW_EnableGlobalInterrupts.

Parameters
expectAltLocSelects whether the device should expect the interrupt vector table at the start of the BOOT section when Flash partitioning is used.
expectCompactTableSelects whether the device should expect the interrupt vector table in Compact Vector Table format.
Here is the call graph for this function:
Here is the caller graph for this function: