QK preemptive non-blocking kernel.
More...
#include <qk.hpp>
|
| static QSchedStatus | schedLock (std::uint8_t const ceiling) noexcept |
| | QK selective scheduler lock.
|
| static void | schedUnlock (QSchedStatus const prevCeil) noexcept |
| | QK selective scheduler unlock.
|
| static void | onIdle () |
| | QK idle callback (customized in BSPs for QK).
|
| static std::uint_fast8_t | sched_ () noexcept |
| | QK scheduler finds the highest-priority AO ready to run.
|
| static std::uint_fast8_t | sched_act_ (QActive const *const act, std::uint_fast8_t const pthre_in) noexcept |
| | QK internal helper function to determine whether activation is needed.
|
| static void | activate_ () |
| | QK activator activates the next active object. The activated AO preempts the currently executing AOs.
|
|
| QP::QPSet | readySet |
| | Set of active-objects/threads that are ready to run in the QK kernel.
|
| std::uint8_t | actPrio |
| | Priority of the currently active AO.
|
| std::uint8_t | nextPrio |
| | Next AO priority scheduled by QK.
|
| std::uint8_t | actThre |
| | Preemption threshold of the currently active AO.
|
| std::uint8_t | lockCeil |
| | Scheduler lock-ceiling (0 if scheduler unlocked).
|
| std::uint8_t | intNest |
| | Up-down counter indicating current interrupt nesting (used in some QK ports).
|
QK preemptive non-blocking kernel.
- See also
- Preemptive Non-Blocking Kernel
Definition at line 38 of file qk.hpp.
◆ schedLock()
| QSchedStatus QP::QK::schedLock |
( |
std::uint8_t const | ceiling | ) |
|
|
staticnoexcept |
QK selective scheduler lock.
Details
This function locks the QK scheduler to the specified ceiling.
- Parameters
-
| [in] | ceiling | preemption ceiling to which the QK scheduler needs to be locked |
- Returns
- The previous QK Scheduler lock status, which is to be used to unlock the scheduler by restoring its previous lock status in QK::schedUnlock().
- Note
- QK::schedLock() must be always followed by the corresponding QK_schedUnlock().
- See also
- QK_schedUnlock()
Usage
The following example shows how to lock and unlock the QK scheduler:
std::uint32_t BSP::random() {
std::uint32_rnd;
. . .
return rnd;
}
static void schedUnlock(QSchedStatus const prevCeil) noexcept
QK selective scheduler unlock.
static QSchedStatus schedLock(std::uint8_t const ceiling) noexcept
QK selective scheduler lock.
std::uint8_t QSchedStatus
The scheduler lock status for QK::schedLock() and QK::schedUnlock().
Definition at line 56 of file qk.cpp.
◆ schedUnlock()
QK selective scheduler unlock.
Details
This function unlocks the QK scheduler to the previous status.
- Parameters
-
- Note
- QK::schedUnlock() must always follow the corresponding QK::schedLock().
- See also
- QK::schedLock()
Usage
The following example shows how to lock and unlock the QK scheduler:
std::uint32_t BSP::random() {
std::uint32_rnd;
. . .
return rnd;
}
Definition at line 83 of file qk.cpp.
◆ onIdle()
QK idle callback (customized in BSPs for QK).
Details
QK::onIdle() is called continuously by the QK idle loop. This callback gives the application an opportunity to enter a power-saving CPU mode, or perform some other idle processing.
- Note
- QK::onIdle() is invoked with interrupts enabled and must also return with interrupts enabled.
◆ sched_()
| std::uint_fast8_t QP::QK::sched_ |
( |
| ) |
|
|
staticnoexcept |
QK scheduler finds the highest-priority AO ready to run.
Details
The QK scheduler finds out the priority of the highest-priority AO that (1) has events to process and (2) has priority that is above the current priority.
- Returns
- The QF-priority of the next Active Object to activate, or zero if no activation of AO is needed.
- Attention
- QK::sched_() must be always called with interrupts disabled and returns with interrupts disabled.
Definition at line 115 of file qk.cpp.
◆ sched_act_()
| std::uint_fast8_t QP::QK::sched_act_ |
( |
QActive const *const | act, |
|
|
std::uint_fast8_t const | pthre_in ) |
|
staticnoexcept |
QK internal helper function to determine whether activation is needed.
Details
- Parameters
-
| [in] | act | currently executing Active Object |
| [in] | pthre_in | current priority threshold |
- Returns
- the priority of Active Object to activate or 0 if no activation needed
- Attention
- QK::act_() must be always called with interrupts disabled and returns with interrupts disabled.
Definition at line 142 of file qk.cpp.
◆ activate_()
| void QP::QK::activate_ |
( |
| ) |
|
|
static |
QK activator activates the next active object. The activated AO preempts the currently executing AOs.
Details
QK::activate_() activates ready-to run AOs that are above the initial preemption-threshold.
- Attention
- QK::activate_() must be always called with interrupts disabled and returns with interrupts disabled.
Definition at line 177 of file qk.cpp.
◆ readySet
Set of active-objects/threads that are ready to run in the QK kernel.
Definition at line 40 of file qk.hpp.
◆ actPrio
| std::uint8_t QP::QK::actPrio |
Priority of the currently active AO.
Definition at line 41 of file qk.hpp.
◆ nextPrio
| std::uint8_t QP::QK::nextPrio |
Next AO priority scheduled by QK.
Definition at line 42 of file qk.hpp.
◆ actThre
| std::uint8_t QP::QK::actThre |
Preemption threshold of the currently active AO.
Definition at line 43 of file qk.hpp.
◆ lockCeil
| std::uint8_t QP::QK::lockCeil |
Scheduler lock-ceiling (0 if scheduler unlocked).
Definition at line 44 of file qk.hpp.
◆ intNest
| std::uint8_t QP::QK::intNest |
Up-down counter indicating current interrupt nesting (used in some QK ports).
Definition at line 45 of file qk.hpp.
◆ priv_
The documentation for this class was generated from the following files: