42 #error Source file included in a project NOT based on the QK kernel
45Q_DEFINE_THIS_MODULE(
"qk")
60 if (ceiling > QK_priv_.lockCeil) {
71 QK_priv_.lockCeil = (uint8_t)ceiling;
82 if (prevCeil != 0xFFU) {
100 QK_priv_.lockCeil = (uint8_t)prevCeil;
117 if (QPSet_notEmpty(&QK_priv_.readySet)) {
119 p = (uint8_t)QPSet_findMax(&QK_priv_.readySet);
122 if (p <= QK_priv_.actThre) {
127 if (p <= QK_priv_.lockCeil) {
131 QK_priv_.nextPrio = p;
143 uint_fast8_t
const pthre_in)
147 uint8_t p = act->
prio;
149 QPSet_remove(&QK_priv_.readySet, p);
152 if (QPSet_isEmpty(&QK_priv_.readySet)) {
157 p = (uint8_t)QPSet_findMax(&QK_priv_.readySet);
166 if (p <= QK_priv_.lockCeil) {
180 uint8_t
const prio_in = QK_priv_.actPrio;
181 uint8_t p = QK_priv_.nextPrio;
189#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY)
190 uint8_t pprev = prio_in;
193 QK_priv_.nextPrio = 0U;
195 uint8_t pthre_in = 0U;
197 QActive const *
const a = QActive_registry_[prio_in];
207 QActive *
const a = QActive_registry_[p];
211 uint8_t
const pthre = a->
pthre;
214 QK_priv_.actPrio = p;
215 QK_priv_.actThre = pthre;
217#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY)
225#ifdef QF_ON_CONTEXT_SW
226 QF_onContextSw(QActive_registry_[pprev], a);
235 QEvt const *
const e = QActive_get_(a);
239#if (QF_MAX_EPOOL > 0U)
252 QK_priv_.actPrio = prio_in;
253 QK_priv_.actThre = pthre_in;
255#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY)
263#ifdef QF_ON_CONTEXT_SW
264 QF_onContextSw(QActive_registry_[pprev],
265 QActive_registry_[prio_in]);
274#ifdef QF_ON_CONTEXT_SW
275 QF_onContextSw(QActive_registry_[pprev], (
QActive *)0);
288#if (QF_MAX_TICK_RATE > 0U)
318 QK_priv_.lockCeil = 0U;
320#ifdef QF_ON_CONTEXT_SW
322 QF_onContextSw((
QActive *)0, QActive_registry_[QK_priv_.nextPrio]);
326 if (QK_sched_() != 0U) {
343void QActive_start(
QActive *
const me,
346 uint_fast16_t
const qLen,
348 uint_fast16_t
const stkSize,
349 void const *
const par)
364 me->
prio = (uint8_t)(prioSpec & 0xFFU);
365 me->
pthre = (uint8_t)(prioSpec >> 8U);
366 QActive_register_(me);
368 QEQueue_init(&me->
eQueue, qSto, qLen);
375 if (QK_sched_() != 0U) {
uint_fast8_t QSchedStatus
The scheduler lock status for QK_schedLock() and QK_schedUnlock() \clearpage .
#define QASM_INIT(me_, par_, qsId_)
Virtual call to the top-most initial transition in a state machine.
#define Q_UNUSED_PAR(par_)
Helper macro to mark unused parameters of functions.
int int_t
Alias for assertion-ID numbers in QP assertions and return from QF_run() \clearpage .
#define QASM_DISPATCH(me_, e_, qsId_)
Virtual call to dispatch an event to a state machine.
uint16_t QPrioSpec
Priority specification for Active Objects in QP.
#define QF_MAX_ACTIVE
Maximum # Active Objects in the system (1..64).
QP/C Framework in C internal (package-scope) interface.
#define QK_ISR_CONTEXT_()
Port-specific method to check if the QK kernel executes in the ISR context (used internally in QK onl...
#define QF_CRIT_ENTRY()
Port-specific critical section entry.
#define QF_INT_DISABLE()
Port-specific interrupt disable.
#define QF_INT_ENABLE()
Port-specific interrupt enable.
#define QF_CRIT_EXIT()
Port-specific critical section exit.
#define QF_CRIT_STAT
Define the critical section status that was present before entering the critical section.
@ QS_QF_RUN
QF_run() was entered.
@ QS_SCHED_IDLE
scheduler restored the idle task
@ QS_SCHED_LOCK
scheduler was locked
@ QS_SCHED_UNLOCK
scheduler was unlocked
@ QS_SCHED_NEXT
scheduler started next task
QS (QP/Spy software tracing) internal (package-scope) interface. \clearpage .
#define QS_2U8_PRE(data1_, data2_)
Output two pre-formatted unsigned 8-bit integer data elements.
#define QS_U8_PRE(data_)
Output pre-formatted unsigned 8-bit integer data element.
#define QS_END_PRE()
Pre-formatted QS trace record end.
#define QS_BEGIN_PRE(rec_, qsId_)
Pre-formatted QS trace record begin.
QP Functional Safety (FuSa) Subsystem (fault detection).
#define Q_ASSERT_INCRIT(id_, expr_)
General-purpose assertion with user-specified ID number (in critical section).
#define Q_REQUIRE_INCRIT(id_, expr_)
Assertion for checking a precondition (in critical section).
Active Object class (based on the QHsm implementation strategy).
QACTIVE_EQUEUE_TYPE eQueue
Port-dependent event-queue type (often QEQueue).
uint8_t prio
QF-priority [1..QF_MAX_ACTIVE] of this AO.
uint8_t pthre
Preemption-threshold [1..QF_MAX_ACTIVE] of this AO.
struct QAsmVtable const * vptr
Virtual pointer inherited by all QAsm subclasses (see also [SAS_QP_TECH_20]).
Virtual table for the QAsm class.
The data type to store in the event queue ring-buffer.
QK preemptive non-blocking kernel (QK namespace emulated as a "class" in C.
QSchedStatus QK_schedLock(uint8_t const ceiling)
QK selective scheduler lock.
uint_fast8_t QK_sched_(void)
QK scheduler finds the highest-priority AO ready to run.
void QK_activate_(void)
QK activator activates the next active object. The activated AO preempts the currently executing AOs.
uint_fast8_t QK_sched_act_(QActive const *const act, uint_fast8_t const pthre_in)
QK internal helper function to determine whether activation is needed.
void QK_schedUnlock(QSchedStatus const prevCeil)
QK selective scheduler unlock.