APIs to handle entry/exit actions in Critical sections.
More...
APIs to handle entry/exit actions in Critical sections.
◆ int_disabler_t
Function called by critical::enter() to disable interrupts.
- Note
- User should use bare-metal code to implement this function.
-
User should return the current interrupt configuration to be saved by the kernel. Example :
uint32_t BSP_InterruptDisabler( void ) {
uint32_t currentMask;
currentMask = HAL_InterruptGetMask( savedMask );
HAL_DisableInterrupts();
return currentMask;
}
- Returns
- The current interrupt configuration (mask). The kernel will retain this value until the critical section is exited
◆ int_restorer_t
Function called by critical::exit() to restore interrupts.
- Note
- User should use bare-metal code to implement this function.
-
The kernel passes the previously saved interrupt configuration as input argument. The user is responsible for taking this argument to restore the saved interrupt setup. Example :
void BSP_InterruptRestorer( uint32_t savedMask ) {
HAL_InterruptSetMask( savedMask );
HAL_EnableInterrupts();
}
- Parameters
-
| [in] | savedMask | The interrupt configuration saved by the "Disabler" function |
◆ scope()
| void qOS::critical::scope |
( |
void | | ) |
|
|
inlinenoexcept |
Enables a scoped critical section with minimal syntax overhead.
void example() {
}
}
void scope(void) noexcept
Enables a scoped critical section with minimal syntax overhead.
Definition critical.hpp:76
◆ setInterruptsED()
Set the hardware-specific code for global interrupt enable/disable. Setting this allows you to communicate safely from Interrupts using queued-notifications or queues.
- Parameters
-
| [in] | rFcn | The function with hardware specific code that enables or restores interrupts. |
| [in] | dFcn | The function with hardware specific code that disables interrupts. |
- Returns
true on success. Otherwise return false.