The QXK kernel class.
More...
#include <qxk.h>
Definition at line 64 of file qxk.h.
◆ QXK_onContextSw()
QXK context switch callback (customized in BSPs for QXK)
- Description
- This callback function provides a mechanism to perform additional custom operations when QXK switches context from one thread to another.
- Parameters
-
[in] | prev | pointer to the previous thread (active object) (prev==0 means that prev was the QXK idle thread) |
[in] | next | pointer to the next thread (active object) (next==0) means that next is the QXK idle thread) |
- Attention
- QXK_onContextSw() is invoked with interrupts disabled and must also return with interrupts disabled.
- Note
- This callback is enabled by defining the macro QXK_ON_CONTEXT_SW.
#ifdef QXK_ON_CONTEXT_SW
(void)prev;
_impure_ptr =
next->thread;
}
}
#endif
#define QS_BEGIN_NOCRIT(rec_, qs_id_)
Active Object base class (based on QHsm implementation)
void QXK_onContextSw(struct QActive *prev, struct QActive *next)
struct QActive *volatile next
◆ QXK_onIdle()
QXK idle callback (customized in BSPs for QXK)
- Description
- 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_sched_()
uint_fast8_t QXK_sched_ |
( |
void |
| ) |
|
|
staticprivate |
QXK scheduler finds the highest-priority thread ready to run
- Description
- 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 227 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.
- Attention
- QXK_activate_() must be always called with interrupts disabled and returns with interrupts disabled.
- Note
- The activate function might enable interrupts internally, but it always returns with interrupts disabled.
Definition at line 294 of file qxk.c.
◆ QXK_current()
struct QActive * QXK_current |
( |
void |
| ) |
|
|
static |
obtain the currently executing active-object/thread
- Returns
- pointer to the currently executing active-object/thread
Definition at line 424 of file qxk.c.
◆ QXK_schedLock()
QXK Scheduler lock
- Description
- This function locks the QXK scheduler to the specified ceiling.
- Parameters
-
[in] | ceiling | priority 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_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 ceiling)
Definition at line 156 of file qxk.c.
◆ QXK_schedUnlock()
QXK Scheduler unlock
- Description
- 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().
- See also
- 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 192 of file qxk.c.
◆ curr
current thread pointer (NULL=basic)
Definition at line 65 of file qxk.h.
◆ next
next thread pointer to execute
Definition at line 66 of file qxk.h.
◆ actPrio
prio of the active AO
Definition at line 67 of file qxk.h.
◆ lockPrio
uint8_t volatile lockPrio |
lock prio (0 == no-lock)
Definition at line 68 of file qxk.h.
◆ lockHolder
uint8_t volatile lockHolder |
prio of the lock holder
Definition at line 69 of file qxk.h.
◆ intNest
ISR nesting level
Definition at line 70 of file qxk.h.
◆ idleThread
pointer to the idle thread
Definition at line 71 of file qxk.h.
◆ readySet
ready-set of all threads
Definition at line 72 of file qxk.h.
◆ QXK_attr_
global attributes of the QXK kernel
Definition at line 78 of file qxk.h.
The documentation for this class was generated from the following file: