QP/C 8.1.3
Real-Time Event Framework
Loading...
Searching...
No Matches
QV Class Reference

QV non-preemptive kernel. More...

#include <qv.h>

Static Public Member Functions

void QV_schedDisable (uint8_t const ceiling)
 QV selective scheduler disable.
void QV_schedEnable (void)
 QV scheduler enable.
void QV_onIdle (void)
 QV idle callback (customized in BSPs for QV).

Private Attributes

QPSet readySet
 Set of active-objects/threads that are ready to run in the QV kernel.
uint8_t schedCeil
QV QV_priv_

Detailed Description

QV non-preemptive kernel.

See also
Non-Preemptive Kernel

Definition at line 34 of file qv.h.

Member Function Documentation

◆ QV_schedDisable()

void QV_schedDisable ( uint8_t const ceiling)
static

QV selective scheduler disable.

Details
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 overrun the next clock tick, for example.

Parameters
[in]ceilingpreemption 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) {
QState status_;
switch (e->sig) {
//${AOs::Sporadic3::SM::active::busy::REMINDER}
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();
}
QV_schedDisable(3U); // <== disable scheduler up to given prio.
. . .
uint_fast8_t QState
Type returned from state-handler functions.
Definition qp.h:144
Event class.
Definition qp.h:100
uint32_t sig
Event signal (see Event Signal).
Definition qp.h:101
void QV_schedDisable(uint8_t const ceiling)
QV selective scheduler disable.
Definition qv.c:52

Definition at line 52 of file qv.c.

◆ QV_schedEnable()

void QV_schedEnable ( void )
static

QV scheduler enable.

Details
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) {
QTIMEEVT_TICK_X(0U, &l_SysTick_Handler); // time events at rate 0
QV_schedEnable(); // <== enable the scheduler to process next clock tick
. . .
#define QTIMEEVT_TICK_X(tickRate_, sender_)
Invoke the system clock tick processing QTimeEvt_tick_().
Definition qp.h:769
void QV_schedEnable(void)
QV scheduler enable.
Definition qv.c:72

Definition at line 72 of file qv.c.

◆ QV_onIdle()

void QV_onIdle ( void )
static

QV idle callback (customized in BSPs for QV).

Details
QV_onIdle() is called by the non-preemptive 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.

Member Data Documentation

◆ readySet

QPSet readySet
private

Set of active-objects/threads that are ready to run in the QV kernel.

Definition at line 35 of file qv.h.

◆ schedCeil

uint8_t schedCeil
private

Definition at line 36 of file qv.h.

◆ QV_priv_

QV QV_priv_
private

Definition at line 49 of file qv.h.


The documentation for this class was generated from the following files: