![]() |
AVR SD Safety Framework 1.0.0
|
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. | |
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.
| void MW_DisableGlobalInterrupts | ( | void | ) |
Disables global interrupts on the device.
| 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.
When global interrupts are expected to remain enabled, this function may be called periodically to re-establish and verify the global interrupt enable state.
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.
| ERROR | Failed to enable global interrupts. |
| NO_ERROR | Global interrupts enabled successfully. |
| 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.
This function prevents maskable interrupt preemption by clearing the global interrupt enable flag. It does not disable non-maskable interrupts (NMI).
| true | Global interrupts were enabled before entering the critical section. |
| false | Global interrupts were already disabled before entering the critical section. |
| 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.
| wasInterruptEnabled | Global interrupt state returned by the corresponding MW_EnterCriticalSection call. |
| 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.
| useRoundRobin | Enables or disables round robin scheduling. |
| altStartVect | Sets 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. |
| highPriorityVect | Sets the high priority interrupt vector number. Set to 0 to disable this feature. |
| ERROR | Provided interrupt vector numbers are invalid, function aborted. |
| NO_ERROR | Interrupt priority and scheduling successfully configured. |
| 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.
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.
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.
| expectAltLoc | Selects whether the device should expect the interrupt vector table at the start of the BOOT section when Flash partitioning is used. |
| expectCompactTable | Selects whether the device should expect the interrupt vector table in Compact Vector Table format. |