QXK dual-mode kernel (QXK namespace emulated as a "class" in C).
More...
#include <qxk.h>
|
| uint_fast8_t | QXK_sched_ (void) |
| | QXK scheduler finds the highest-priority thread ready to run.
|
| void | QXK_activate_ (void) |
| | QXK activator activates the next AO that preempts the currently executing AOs.
|
| void | QXK_threadExit_ (void) |
| | called right before QXThread exits
|
QXK dual-mode kernel (QXK namespace emulated as a "class" in C).
- See also
- Preemptive Non-Blocking Kernel The QXK class is related to the following classes:
Definition at line 33 of file qxk.h.
◆ QXK_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.
◆ QXK_schedLock()
QXK selective 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:
uint32_t BSP_random(void) {
uint32_rnd;
. . .
return rnd;
}
uint_fast16_t QSchedStatus
void QXK_schedUnlock(QSchedStatus const stat)
QXK selective scheduler unlock.
QSchedStatus QXK_schedLock(uint8_t const ceiling)
QXK selective scheduler lock.
Definition at line 51 of file qxk.c.
◆ QXK_schedUnlock()
QXK selective scheduler unlock.
Details
This function unlocks the QXK scheduler to the previous status.
- Parameters
-
- 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:
uint32_t BSP_random(void) {
uint32_rnd;
. . .
return rnd;
}
Definition at line 84 of file qxk.c.
◆ QXK_current()
Obtain the currently executing active-object/thread.
Details
- Returns
- pointer to the currently executing active-object/thread
Definition at line 119 of file qxk.c.
◆ QXK_sched_()
| uint_fast8_t QXK_sched_ |
( |
void | | ) |
|
|
staticprivate |
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.
Definition at line 138 of file qxk.c.
◆ QXK_activate_()
| void QXK_activate_ |
( |
void | | ) |
|
|
staticprivate |
QXK activator activates the next AO that 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.
Definition at line 190 of file qxk.c.
◆ QXK_contextSw_()
| void QXK_contextSw_ |
( |
QActive *const | next | ) |
|
|
static |
QXK context switch management.
Details
This internal function handles context switch. It calls QF_onContextSw() (if QF_ON_CONTEXT_SW is defined and performs software tracing (if Q_SPY is defined).
- Parameters
-
| [in] | next | pointer to the next thread (NULL for basic-thread) |
- Attention
- QXK_contextSw_() is invoked with interrupts disabled and must also return with interrupts disabled.
Definition at line 294 of file qxk.c.
◆ QXK_threadExit_()
| void QXK_threadExit_ |
( |
void | | ) |
|
|
staticprivate |
called right before 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 322 of file qxk.c.
◆ QXK_priv_
Definition at line 59 of file qxk.h.
The documentation for this class was generated from the following files: