non-preemptive kernel
More...
non-preemptive kernel
- Details
- 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"
):
◆ schedDisable()
void QP::QV::schedDisable |
( |
std::uint_fast8_t const | ceiling | ) |
|
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] | 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:
switch (e->sig) {
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();
}
void schedDisable(std::uint_fast8_t const ceiling)
std::uint_fast8_t QState
Type returned from state-handler functions.
#define QM_STATE_DEF(subclass_, state_)
Definition at line 70 of file qv.cpp.
◆ schedEnable()
void QP::QV::schedEnable |
( |
| ) |
|
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);
Definition at line 97 of file qv.cpp.
◆ 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.
◆ priv_