APIs to handle entry/exit actions in Critical sections.
More...
|
void | qOS::critical::enter (void) noexcept |
| Enter a critical section. This function invokes the Disabler function if available.
|
|
void | qOS::critical::exit (void) noexcept |
| Exit a critical section. This function invokes the Enabler function if available.
|
|
bool | qOS::critical::setInterruptsED (const int_restorer_t rFcn, const int_disabler_t dFcn) noexcept |
| Set the hardware-specific code for global interrupt enable/disable. Setting this allows you to communicate safely from Interrupts using queued-notifications or queues.
|
|
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 |
◆ enter()
void qOS::critical::enter |
( |
void | | ) |
|
|
noexcept |
◆ exit()
void qOS::critical::exit |
( |
void | | ) |
|
|
noexcept |
◆ 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
.