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

QV non-preemptive kernel. More...

#include <qv.hpp>

Static Public Member Functions

static void schedDisable (std::uint8_t const ceiling) noexcept
static void schedEnable () noexcept
static void onIdle ()

Public Attributes

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

Static Public Attributes

static QV priv_

Detailed Description

QV non-preemptive kernel.

See also
Non-Preemptive Kernel

Definition at line 36 of file qv.hpp.

Member Function Documentation

◆ schedDisable()

void QP::QV::schedDisable ( std::uint8_t const ceiling)
staticnoexcept

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 overruon 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:

QM_STATE_DEF(Sporadic3, busy) {
QP::QState status_;
switch (e->sig) {
//${AOs::Sporadic3::SM::active::busy::REMINDER}
case REMINDER_SIG: {
std::uint16_t toggles = m_total - m_done;
if (toggles > m_per_rtc) {
toggles = m_per_rtc;
}
m_done += toggles;
for (; toggles > 0U; --toggles) {
BSP::d4on();
BSP::d4off();
}
// after some CPU intensive code...
QP::QV::schedDisable(3U); // <== disable scheduler up to given prio.
static void schedDisable(std::uint8_t const ceiling) noexcept
Definition qv.cpp:56
std::uint_fast8_t QState
Type returned from state-handler functions.
Definition qp.hpp:134
#define QM_STATE_DEF(subclass_, state_)
Definition qp.hpp:400

Definition at line 56 of file qv.cpp.

◆ schedEnable()

void QP::QV::schedEnable ( )
staticnoexcept

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) {
QP::QTimeEvt::TICK_X(0U, &l_SysTick_Handler); // time events at rate 0
QP::QV::schedEnable(); // <== enable the scheduler to process next clock tick
static void schedEnable() noexcept
Definition qv.cpp:75

Definition at line 75 of file qv.cpp.

◆ onIdle()

void QP::QV::onIdle ( )
static

QV idle callback (customized in BSPs for QV)

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 QP::QV::readySet

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

Definition at line 38 of file qv.hpp.

◆ schedCeil

std::uint8_t QP::QV::schedCeil

Definition at line 39 of file qv.hpp.

◆ priv_

QV QP::QV::priv_
static

Definition at line 46 of file qv.hpp.


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