QP/C++  7.4.0-rc.1
Real-Time Embedded Framework
No Matches
QP::QV Namespace Reference

non-preemptive kernel More...


class  Attr
 Private attributes of the QV kernel. More...


void schedDisable (std::uint_fast8_t const ceiling)
void schedEnable ()
void onIdle ()


QV::Attr priv_

Detailed Description

non-preemptive kernel

The QV namespace contains only QV facilities callable from C++. The following other QV facilities are defined in the global namespace to be callable from assembly (as extern "C"):
  • QV_Attr

Function Documentation

◆ schedDisable()

void QP::QV::schedDisable ( std::uint_fast8_t const ceiling)

QV selective scheduler disable

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.
[in]ceilingpreemption ceiling upto which the QV scheduler needs to be disabled
QV::schedDisable() must be unlocked with QV::schedEnable() at some point, but this is typically done in the system clock tick ISR.
See also
The following example shows how to disable the QV scheduler:
QM_STATE_DEF(Sporadic3, busy) {
QP::QState status_;
switch (e->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) {
// after some CPU intensive code...
QP::QV::schedDisable(3U); // <== disable scheduler up to given prio.
void schedDisable(std::uint_fast8_t const ceiling)
Definition qv.cpp:79
std::uint_fast8_t QState
Definition qp.hpp:171
#define QM_STATE_DEF(subclass_, state_)
Definition qp.hpp:512

Definition at line 79 of file qv.cpp.

◆ schedEnable()

void QP::QV::schedEnable ( )

QV scheduler enable

This function re-enables the QV scheduler previously disabled with QV::schedDisable().
QV::schedEnable() must be called (typically from the system clock tick ISR) when the application ever uses QV::schedDisable().
See also
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
void schedEnable()
Definition qv.cpp:106

Definition at line 106 of file qv.cpp.

◆ onIdle()

void QP::QV::onIdle ( )

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).

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.

Variable Documentation

◆ priv_

QV::Attr QP::QV::priv_

Definition at line 76 of file qv.cpp.