QXK dual-mode (non-blocking / blocking) kernel.
More...
#include <qxk.hpp>
QXK dual-mode (non-blocking / blocking) kernel.
- See also
- Preemptive Dual-Mode Kernel The QXK class is related to the following classes:
Definition at line 40 of file qxk.hpp.
◆ schedLock()
| QSchedStatus QP::QXK::schedLock |
( |
std::uint8_t const | ceiling | ) |
|
|
staticnoexcept |
QXK Scheduler lock.
Details
This function locks the QXK scheduler to the specified ceiling.
- Parameters
-
| [in] | ceiling | preemption ceiling to which the QXK scheduler needs to be locked |
- Returns
- The previous QXK Scheduler lock status, which is to be used to unlock the scheduler by restoring its previous lock status in QXK_schedUnlock().
- Note
- A QXK scheduler can be locked from both basic threads (AOs) and extended threads and the scheduler locks can nest.
-
QXK::schedLock() must be always followed by the corresponding QXK::schedUnlock().
- Attention
- QXK will fire an assertion if a thread holding the lock attempts to block.
- See also
- QXK::schedUnlock()
Usage
The following example shows how to lock and unlock the QXK scheduler:
std::uint32_t BSP::random() {
std::uint32_rnd = ...
. . .
return rnd;
}
static QSchedStatus schedLock(std::uint8_t const ceiling) noexcept
QXK Scheduler lock.
static void schedUnlock(QSchedStatus const stat) noexcept
QXK Scheduler unlock.
std::uint8_t QSchedStatus
The scheduler lock status for QK::schedLock() and QK::schedUnlock().
Definition at line 53 of file qxk.cpp.
◆ schedUnlock()
QXK Scheduler unlock.
Details
This function unlocks the QXK scheduler to the previous status.
- Parameters
-
| [in] | stat | previous QXK Scheduler lock status returned from QXK_schedLock() |
- Note
- A QXK scheduler can be locked from both basic threads (AOs) and extended threads and the scheduler locks can nest.
-
QXK::schedUnlock() must always follow the corresponding QXK::schedLock().
Usage
The following example shows how to lock and unlock the QXK scheduler:
std::uint32_t BSP::random() {
std::uint32_rnd = ...
. . .
return rnd;
}
Definition at line 87 of file qxk.cpp.
◆ onIdle()
QXK idle callback (customized in BSPs for QXK).
Details
QXK::onIdle() is called continuously by the QXK idle thread. This callback gives the application an opportunity to enter a power-saving CPU mode, or perform some other idle processing.
- Note
- QXK::onIdle() is invoked with interrupts enabled and must also return with interrupts enabled.
◆ current()
◆ sched_()
| std::uint_fast8_t QP::QXK::sched_ |
( |
| ) |
|
|
staticnoexcept |
QXK scheduler finds the highest-priority thread ready to run.
Details
The QXK scheduler finds the priority of the highest-priority thread that is ready to run.
- Returns
- the 1-based priority of the the thread (basic or extended) run next, or zero if no eligible thread is found.
- Attention
- QXK::sched_() must be always called with interrupts disabled and returns with interrupts disabled. QXK::sched_() is defined with the "C" linkage (extern "C").
Definition at line 174 of file qxk.cpp.
◆ threadExit_()
| void QP::QXK::threadExit_ |
( |
| ) |
|
|
staticnoexcept |
Called when QP::QXThread exits.
Details
Called when the extended-thread handler function returns.
- Note
- Most thread handler functions are structured as endless loops that never return. But it is also possible to structure threads as one-shot functions that perform their job and return. In that case this function performs cleanup after the thread.
Definition at line 326 of file qxk.cpp.
◆ activate_()
| void QP::QXK::activate_ |
( |
| ) |
|
|
static |
QXK activator activates the next active object. The activated AO preempts the currently executing AOs.
Details
QXK::activate_() activates ready-to run AOs that are above the initial active priority (QXK_priv_.actPrio).
- Attention
- QXK::activate_() must be always called with interrupts disabled and returns with interrupts disabled. QXK::activate_() is defined with the "C" linkage (extern "C").
Definition at line 222 of file qxk.cpp.
◆ qmstate_cast_()
| QMState * QP::QXK::qmstate_cast_ |
( |
void * | ptr | ) |
|
|
inlinestatic |
◆ curr
◆ next
◆ prev
◆ actPrio
| std::uint8_t QP::QXK::actPrio |
◆ lockCeil
| std::uint8_t QP::QXK::lockCeil |
◆ lockHolder
| std::uint8_t QP::QXK::lockHolder |
◆ intNest
| std::uint8_t QP::QXK::intNest |
◆ readySet
Set of active-objects/threads that are ready to run in the QXK kernel.
Definition at line 51 of file qxk.hpp.
◆ DELAY_SIG
◆ TIMEOUT_SIG
The documentation for this class was generated from the following files: