37 #include "qs_dummy.hpp"
42 #error Source file included in a project NOT based on the QK kernel
47Q_DEFINE_THIS_MODULE(
"qk")
73 if (ceiling > priv_.lockCeil) {
84 priv_.lockCeil =
static_cast<std::uint8_t
>(ceiling);
94 if (prevCeil != 0xFFU) {
108 static_cast<std::uint8_t
>(prevCeil));
112 priv_.lockCeil =
static_cast<std::uint8_t
>(prevCeil);
128 if (priv_.readySet.notEmpty()) {
130 p =
static_cast<std::uint8_t
>(priv_.readySet.findMax());
133 if (p <= priv_.actThre) {
138 if (p <= priv_.lockCeil) {
153 std::uint_fast8_t
const pthre_in)
noexcept
157 std::uint8_t p = act->m_prio;
158 if (act->m_eQueue.isEmpty()) {
159 priv_.readySet.remove(p);
162 if (priv_.readySet.isEmpty()) {
167 p =
static_cast<std::uint8_t
>(priv_.readySet.findMax());
176 if (p <= priv_.lockCeil) {
189 std::uint8_t
const prio_in = priv_.actPrio;
190 std::uint8_t p = priv_.nextPrio;
199#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY)
200 std::uint8_t pprev = prio_in;
205 std::uint8_t pthre_in = 0U;
221 std::uint8_t
const pthre = a->
m_pthre;
225 priv_.actThre = pthre;
227#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY)
235#ifdef QF_ON_CONTEXT_SW
247#if (QF_MAX_EPOOL > 0U)
255 p =
static_cast<std::uint8_t
>(
sched_act_(a, pthre_in));
260 priv_.actPrio = prio_in;
261 priv_.actThre = pthre_in;
263#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY)
271#ifdef QF_ON_CONTEXT_SW
282#ifdef QF_ON_CONTEXT_SW
313 QS::beginRec_(
static_cast<std::uint_fast8_t
>(
QS_QF_RUN));
321 QK::priv_.lockCeil = 0U;
323#ifdef QF_ON_CONTEXT_SW
350 std::uint_fast16_t
const qLen,
352 std::uint_fast16_t
const stkSize,
353 void const *
const par)
366 m_prio =
static_cast<std::uint8_t
>(prioSpec & 0xFFU);
367 m_pthre =
static_cast<std::uint8_t
>(prioSpec >> 8U);
Active Object class (based on the QP::QHsm implementation strategy).
void init(void const *const e, std::uint_fast8_t const qsId) override
Take the top-most initial transition in QActive (delegate to QP::QHsm).
void register_() noexcept
Register this active object to be managed by the framework.
void dispatch(QEvt const *const e, std::uint_fast8_t const qsId) override
Dispatch an event to QActive (delegate to QP::QHsm).
QACTIVE_EQUEUE_TYPE m_eQueue
Port-dependent event-queue type (often QP::QEQueue).
QEvt const * get_() noexcept
Get an event from the event queue of an active object.
void start(QPrioSpec const prioSpec, QEvtPtr *const qSto, std::uint_fast16_t const qLen, void *const stkSto, std::uint_fast16_t const stkSize, void const *const par=nullptr)
Starts execution of an active object and registers the object with the framework.
std::uint8_t m_pthre
Preemption-threshold [1..QF_MAX_ACTIVE] of this AO.
std::uint8_t m_prio
QF-priority [1..QF_MAX_ACTIVE] of this AO.
QK preemptive non-blocking kernel.
static std::uint_fast8_t sched_act_(QActive const *const act, std::uint_fast8_t const pthre_in) noexcept
QK internal helper function to determine whether activation is needed.
static void schedUnlock(QSchedStatus const prevCeil) noexcept
QK selective scheduler unlock.
static std::uint_fast8_t sched_() noexcept
QK scheduler finds the highest-priority AO ready to run.
static QSchedStatus schedLock(std::uint8_t const ceiling) noexcept
QK selective scheduler lock.
static void activate_()
QK activator activates the next active object. The activated AO preempts the currently executing AOs.
static void onIdle()
QK idle callback (customized in BSPs for QK).
QF Active Object Framework namespace \clearpage .
void onCleanup()
Cleanup QF callback.
void gc(QEvt const *const e) noexcept
Recycle a mutable (mutable) event.
void init()
QF initialization.
int_t run()
Transfers control to QF to run the application.
void stop()
Invoked by the application layer to stop the QF framework and return control to the OS/Kernel (used i...
void onStartup()
Startup QF callback.
QP/C++ Framework namespace \clearpage .
@ QS_SCHED_LOCK
scheduler was locked
@ QS_QF_RUN
QF_run() was entered.
@ QS_SCHED_NEXT
scheduler started next task
@ QS_SCHED_UNLOCK
scheduler was unlocked
@ QS_SCHED_IDLE
scheduler restored the idle task
std::uint_fast8_t QSchedStatus
The scheduler lock status for QK::schedLock() and QK::schedUnlock() \clearpage .
std::array< QActive *, QF_MAX_ACTIVE+1U > QActive_registry_
Internal array of pointers to the registered Active Objects.
std::uint16_t QPrioSpec
Priority specification for Active Objects in QP.
int int_t
Alias for assertion-ID numbers in QP assertions and return from QP::QF::run() \clearpage .
#define Q_UNUSED_PAR(par_)
Helper macro to mark unused parameters of functions.
void QF_onContextSw(QP::QActive *prev, QP::QActive *next)
QF context switch callback used in built-in kernels (QV/QK/QXK).
#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 (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.
#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).
The data type to store in the event queue ring-buffer.