QP/C++  7.3.4
Real-Time Embedded Framework
Loading...
Searching...
No Matches
QP::QV Namespace Reference

non-preemptive kernel More...

Classes

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

Functions

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

Variables

QV::Attr priv_
 

Detailed Description

non-preemptive kernel

Description
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()

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

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]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.
void schedDisable(std::uint_fast8_t const ceiling)
Definition qv.cpp:79
std::uint_fast8_t QState
Definition qp.hpp:173
#define QM_STATE_DEF(subclass_, state_)
Definition qp.hpp:514

Definition at line 79 of file qv.cpp.

◆ schedEnable()

QP::QV::schedEnable ( )

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) {
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()

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

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.

Variable Documentation

◆ priv_

QV::Attr QP::QV::priv_

Definition at line 76 of file qv.cpp.