QV non-preemptive, cooperative kernel (QV namespace emulated as a "class" in C)
More...
#include "qv.h"
QV non-preemptive, cooperative kernel (QV namespace emulated as a "class" in C)
Definition at line 50 of file qv.h.
◆ QV_schedDisable()
QV::QV_schedDisable |
( |
uint_fast8_t const |
ceiling | ) |
|
|
static |
QV selective scheduler disable
- Description
- This function disables the QV scheduler from scheduling threads below the specified ceiling. The main purpose of disabling the QV scheduler is to avoid scheduling threads that might take too long and overruon the next clock tick, for example.
- Parameters
-
[in] | ceiling | preemption ceiling upto which the QV scheduler needs to be disabled |
- Note
- QV_schedDisable() must be unlocked with QV_schedEnable() at some point, but this is typically done in the system clock tick ISR.
- See also
- QV_schedEnable()
- Usage
- The following example shows how to disable the QV scheduler:
static QState Sporadic3_busy(Sporadic3 *
const me,
QEvt const *
const e) {
case REMINDER_SIG: {
uint16_t toggles = me->total - me->done;
if (toggles > me->per_rtc) {
toggles = me->per_rtc;
}
me->done += toggles;
for (; toggles > 0U; --toggles) {
BSP_d4on();
BSP_d4off();
}
. . .
void QV_schedDisable(uint_fast8_t const ceiling)
◆ QV_schedEnable()
QV::QV_schedEnable |
( |
void |
| ) |
|
|
static |
QV scheduler enable
- Description
- This function re-enables the QV scheduler previously disabled with QV_schedDisable().
- Note
- QV_schedEnable() must be called (typically from the system clock tick ISR) when the application ever uses QV_schedDisable().
- See also
- QV_schedDisable()
- Usage
- The following example shows how to enable the QV scheduler:
void SysTick_Handler(void) {
. . .
#define QTIMEEVT_TICK_X(tickRate_, sender_)
void QV_schedEnable(void)
Definition at line 103 of file qv.c.
◆ QV_onIdle()
QV idle callback (customized in BSPs for QV)
QV_onIdle() is called by the cooperative QV kernel (from QF_run()) when the scheduler detects that no events are available for active objects (the idle condition). This callback gives the application an opportunity to enter a power-saving CPU mode, or perform some other idle processing (such as QS software tracing output).
- Attention
- QV_onIdle() is invoked with interrupts DISABLED because the idle condition can be asynchronously changed at any time by an interrupt. QV_onIdle() MUST enable the interrupts internally, but not before putting the CPU into the low-power mode. (Ideally, enabling interrupts and low-power mode should happen atomically). At the very least, the function MUST enable interrupts, otherwise interrupts will remain disabled permanently.
◆ QV_priv_
Definition at line 83 of file qv.h.
The documentation for this class was generated from the following files: