OS  v1.7.5
Documentation
Loading...
Searching...
No Matches

APIs to handle entry/exit actions in Critical sections. More...

Collaboration diagram for Critical:

Namespaces

namespace  qOS::critical
 OS Critical interfaces.
 

Typedefs

using qOS::int_restorer_t
 Function called by critical::exit() to restore interrupts.
 
using qOS::int_disabler_t
 Function called by critical::enter() to disable interrupts.
 

Functions

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.
 

Detailed Description

APIs to handle entry/exit actions in Critical sections.

Typedef Documentation

◆ 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]savedMaskThe interrupt configuration saved by the "Disabler" function

Function Documentation

◆ enter()

void qOS::critical::enter ( void )
noexcept

Enter a critical section. This function invokes the Disabler function if available.

Note
Please see critical::setInterruptsED()

◆ exit()

void qOS::critical::exit ( void )
noexcept

Exit a critical section. This function invokes the Enabler function if available.

Note
Please see critical::setInterruptsED()

◆ setInterruptsED()

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.

Parameters
[in]rFcnThe function with hardware specific code that enables or restores interrupts.
[in]dFcnThe function with hardware specific code that disables interrupts.
Returns
true on success. Otherwise return false.