The QXK kernel class.
More...
#include "qxk.h"
- Note
- The order and alignment of the data members in this struct might be important in QXK ports, where the members might be accessed in assembly.
Definition at line 80 of file qxk.h.
◆ QXK_Timeouts
timeout signals for extended threads
Definition at line 262 of file qxk.h.
◆ QXK_sched_()
uint_fast8_t QXK_sched_ |
( |
void |
| ) |
|
|
staticprivate |
QXK scheduler finds the highest-priority thread ready to run
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 261 of file qxk.c.
◆ QXK_activate_()
void QXK_activate_ |
( |
void |
| ) |
|
|
staticprivate |
QXK activator activates the next active object. The activated AO preempts the currently executing AOs.
QXK_activate_() activates ready-to run AOs that are above the initial active priority (QXK_attr_.actPrio).
- Precondition
qxk:700
- QXK_attr_.next must be valid and the prio must be in range
- Attention
- QXK_activate_() must be always called with interrupts disabled and returns with interrupts disabled.
Definition at line 317 of file qxk.c.
◆ QXK_current()
obtain the currently executing active-object/thread
- Returns
- pointer to the currently executing active-object/thread
- Precondition
qxk:800
- the QXK kernel must be running
- Postcondition
qxk:890
- the current thread must be valid
Definition at line 415 of file qxk.c.
◆ QXK_stackInit_()
void QXK_stackInit_ |
( |
void * |
thr, |
|
|
QXThreadHandler const |
handler, |
|
|
void *const |
stkSto, |
|
|
uint_fast16_t const |
stkSize |
|
) |
| |
|
staticprivate |
initialize the private stack of a given AO (defined in QXK port)
◆ QXK_contextSw()
void QXK_contextSw |
( |
QActive *const |
next | ) |
|
|
static |
QXK context switch management
This function performs software tracing (if Q_SPY is defined) and calls QF_onContextSw() (if QF_ON_CONTEXT_SW 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 435 of file qxk.c.
◆ QXK_onIdle()
QXK idle callback (customized in BSPs for QXK)
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 Scheduler lock
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().
- Precondition
qxk:400
- the QXK scheduler lock cannot be called from an ISR
- 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_t rnd;
rnd = l_rnd * (3U*7U*11U*13U*23U);
l_rnd = rnd;
return rnd;
}
uint_fast16_t QSchedStatus
QSchedStatus QXK_schedLock(uint_fast8_t const ceiling)
◆ QXK_schedUnlock()
QXK Scheduler unlock
This function unlocks the QXK scheduler to the previous status.
- Parameters
-
- Precondition
qxk:500
- the QXK scheduler cannot be unlocked from the ISR context
- Precondition
qxk:501
- the current lock ceiling must be greater than the previous
- 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_t rnd;
rnd = l_rnd * (3U*7U*11U*13U*23U);
l_rnd = rnd;
return rnd;
}
Definition at line 108 of file qxk.c.
◆ curr
current thread (NULL=basic)
Definition at line 81 of file qxk.h.
◆ next
next thread to run
Definition at line 82 of file qxk.h.
◆ prev
previous thread
Definition at line 83 of file qxk.h.
◆ actPrio
uint8_t volatile QXK::actPrio |
QF-prio of the active AO
Definition at line 84 of file qxk.h.
◆ lockCeil
uint8_t volatile QXK::lockCeil |
lock-ceiling (0==no-lock)
Definition at line 85 of file qxk.h.
◆ lockHolder
uint8_t volatile QXK::lockHolder |
prio of the lock holder
Definition at line 86 of file qxk.h.
◆ QXK_attr_
attributes of the QXK kernel
Definition at line 93 of file qxk.h.
The documentation for this class was generated from the following files: