33#define QP_VERSION_STR "8.1.6"
34#define QP_VERSION 816U
36#define QP_RELEASE 0x645CB1FFU
43#define QF_MAX_ACTIVE 32U
46#if (QF_MAX_ACTIVE > 64U)
47#error QF_MAX_ACTIVE exceeds the maximum of 64U;
50#ifndef QF_MAX_TICK_RATE
51#define QF_MAX_TICK_RATE 1U
54#if (QF_MAX_TICK_RATE > 15U)
55#error QF_MAX_TICK_RATE exceeds the maximum of 15U;
59#define QF_MAX_EPOOL 3U
62#if (QF_MAX_EPOOL > 15U)
63#error QF_MAX_EPOOL exceeds the maximum of 15U;
66#ifndef QF_TIMEEVT_CTR_SIZE
67#define QF_TIMEEVT_CTR_SIZE 4U
70#if (QF_TIMEEVT_CTR_SIZE != 2U) && (QF_TIMEEVT_CTR_SIZE != 4U)
71#error QF_TIMEEVT_CTR_SIZE defined incorrectly, expected 2U or 4U;
84#define Q_UNUSED_PAR(par_) (static_cast<void>(par_))
85#define Q_DIM(array_) (sizeof(array_) / sizeof((array_)[0U]))
86#define Q_UINT2PTR_CAST(type_, uint_) (reinterpret_cast<type_ *>(uint_))
98 std::uint32_t
sig : 16;
150 std::array<QActionHandler, 1> act;
162constexpr QSignal Q_USER_SIG {4U};
192 static constexpr QState Q_HANDLED() {
194 static constexpr QState Q_UNHANDLED() {
196 static constexpr QState QM_HANDLED() {
198 static constexpr QState QM_UNHANDLED() {
200 static constexpr QState QM_SUPER() {
202 static constexpr QMState
const *QM_STATE_NULL {
nullptr };
213 void const *
const e,
214 std::uint_fast8_t
const qsId) = 0;
215 virtual void init(std::uint_fast8_t
const qsId);
217 QEvt const *
const e,
218 std::uint_fast8_t
const qsId) = 0;
229 static QState top(
void *
const me,
QEvt const *
const e)
noexcept;
232 explicit QAsm() noexcept;
261 void const *
const tatbl)
noexcept
289 void const *
const e,
290 std::uint_fast8_t
const qsId)
override;
292 QEvt const *
const e,
293 std::uint_fast8_t
const qsId)
override;
304 std::array<QStateHandler, MAX_PATH_LEN_> &path,
305 std::uint_fast8_t
const qsId);
308 std::array<QStateHandler, MAX_PATH_LEN_> &path,
309 std::uint_fast8_t
const qsId);
312 std::array<QStateHandler, MAX_PATH_LEN_> &path,
313 std::size_t
const depth,
314 std::uint_fast8_t
const qsId);
328 void const *
const e,
329 std::uint_fast8_t
const qsId)
override;
331 QEvt const *
const e,
332 std::uint_fast8_t
const qsId)
override;
343 std::uint_fast8_t const qsId);
345 QMState const * const curr_state,
346 QMState const * const tran_source,
347 std::uint_fast8_t const qsId);
350 std::uint_fast8_t const qsId);
361#define Q_STATE_DECL(state_) \
362 QP::QState state_ ## _h(QP::QEvt const * const e); \
363 static QP::QState state_(void * const me, QP::QEvt const * const e)
365#define Q_STATE_DEF(subclass_, state_) \
366 QP::QState subclass_::state_(void * const me, QP::QEvt const * const e) { \
367 return static_cast<subclass_ *>(me)->state_ ## _h(e); } \
368 QP::QState subclass_::state_ ## _h(QP::QEvt const * const e)
370#define Q_EVT_CAST(subclass_) (static_cast<subclass_ const *>(e))
371#define Q_STATE_CAST(handler_) (reinterpret_cast<QP::QStateHandler>(handler_))
373#define QM_STATE_DECL(state_) \
374 QP::QState state_ ## _h(QP::QEvt const * const e); \
375 static QP::QState state_(void * const me, QP::QEvt const * const e); \
376 static QP::QMState const state_ ## _s
378#define QM_ACTION_DECL(action_) \
379 QP::QState action_ ## _h(); \
380 static QP::QState action_(void * const me)
382#define QM_STATE_DEF(subclass_, state_) \
383 QP::QState subclass_::state_(void * const me, QP::QEvt const * const e) {\
384 return static_cast<subclass_ *>(me)->state_ ## _h(e); } \
385 QP::QState subclass_::state_ ## _h(QP::QEvt const * const e)
387#define QM_ACTION_DEF(subclass_, action_) \
388 QP::QState subclass_::action_(void * const me) { \
389 return static_cast<subclass_ *>(me)->action_ ## _h(); } \
390 QP::QState subclass_::action_ ## _h()
393 #define INIT(qsId_) init((qsId_))
394 #define DISPATCH(e_, qsId_) dispatch((e_), (qsId_))
396 #define INIT(dummy) init(0U)
397 #define DISPATCH(e_, dummy) dispatch((e_), 0U)
408#if (QF_TIMEEVT_CTR_SIZE == 2U)
410#elif (QF_TIMEEVT_CTR_SIZE == 4U)
414#if (QF_MAX_ACTIVE <= 8U)
416#elif (8U < QF_MAX_ACTIVE) && (QF_MAX_ACTIVE <= 16U)
418#elif (16 < QF_MAX_ACTIVE)
430#if (QF_MAX_ACTIVE > 32U)
445 bool hasElement(std::uint_fast8_t const n) const noexcept;
446 void insert(std::uint_fast8_t const n) noexcept;
447 void remove(std::uint_fast8_t const n) noexcept;
448 std::uint_fast8_t
findMax() const noexcept;
460 friend class QActive;
487#ifdef QACTIVE_THREAD_TYPE
491#ifdef QACTIVE_OS_OBJ_TYPE
495#ifdef QACTIVE_EQUEUE_TYPE
505 void const *
const e,
506 std::uint_fast8_t
const qsId)
override;
508 QEvt const *
const e,
509 std::uint_fast8_t
const qsId)
override;
516 void const * attr2 =
nullptr);
518 QEvtPtr * const qSto, std::uint_fast16_t const qLen,
519 void * const stkSto, std::uint_fast16_t const stkSize,
520 void const * const par =
nullptr);
522#ifdef QACTIVE_CAN_STOP
528 void const * const sender) noexcept
533 bool postx_(
QEvt const *
const e,
534 std::uint_fast16_t
const margin,
535 void const *
const sender)
noexcept;
536 void postLIFO(
QEvt const *
const e)
noexcept;
537 QEvt const * get_() noexcept;
538 static std::uint16_t getQueueUse(
539 std::uint_fast8_t const prio) noexcept;
540 static std::uint16_t getQueueFree(
541 std::uint_fast8_t const prio) noexcept;
542 static std::uint16_t getQueueMin(
543 std::uint_fast8_t const prio) noexcept;
546 QSignal const maxSignal) noexcept;
547 static
void publish_(
548 QEvt const * const e,
549 void const * const sender,
550 std::uint_fast8_t const qsId) noexcept;
551 void subscribe(
QSignal const sig) const noexcept;
552 void unsubscribe(
QSignal const sig) const noexcept;
553 void unsubscribeAll() const noexcept;
556 QEvt const * const e) const noexcept;
557 bool recall(
QEQueue * const eq) noexcept;
558 std::uint16_t flushDeferred(
560 std::uint_fast16_t const num = 0xFFFFU) const noexcept;
561 std::uint8_t getPrio() const noexcept {
566#ifdef QACTIVE_THREAD_TYPE
579#ifdef QACTIVE_OS_OBJ_TYPE
591 QEvt const *
const e,
592 std::uint_fast16_t
const margin,
594 void const *
const sender)
noexcept;
597 QEvt const *
const e,
599 void const *
const sender)
noexcept;
604 QEvt const *
const e,
605 void const *
const sender);
606 static void multicast_(
607 QPSet *
const subscrSet,
608 QEvt const *
const e,
609 void const *
const sender);
612 friend class QTimeEvt;
613 friend class QTicker;
614 friend class QXThread;
615 friend class QXMutex;
616 friend class QXSemaphore;
617 friend class QMActive;
618 friend class QActiveDummy;
639 void const *
const e,
640 std::uint_fast8_t
const qsId)
override;
642 QEvt const *
const e,
643 std::uint_fast8_t
const qsId)
override;
651#if (QF_MAX_TICK_RATE > 0U)
659 std::uint8_t m_tickRate;
660 std::uint8_t m_flags;
666 std::uint_fast8_t
const tickRate = 0U)
noexcept;
668 std::uint32_t
const nTicks,
669 std::uint32_t
const interval = 0U)
noexcept;
671 bool rearm(std::uint32_t const nTicks) noexcept;
673 void const * getAct() const & {
677 void const * getAct() const &&
686 std::uint8_t getTickRate() const noexcept {
693 std::uint_fast8_t
const tickRate,
694 void const *
const sender)
noexcept;
698 std::uint_fast8_t
const tickRate,
699 void const *
const sender);
703 static void tickFromISR(
704 std::uint_fast8_t
const tickRate,
706 void const * sender)
noexcept;
708 static bool noActive(std::uint_fast8_t
const tickRate)
noexcept;
724 std::uint_fast8_t const tickRate) noexcept;
734 explicit QTicker(std::uint8_t
const tickRate)
noexcept;
737 void const *
const e,
738 std::uint_fast8_t
const qsId)
override;
740 QEvt const *
const e,
741 std::uint_fast8_t
const qsId)
override;
742 void trig_(
void const *
const sender)
noexcept;
752 QSignal const maxSignal)
noexcept
760 void const *
const sender, std::uint_fast8_t
const qsId)
noexcept
768 std::uint_fast8_t
const prio)
noexcept
774#if (QF_MAX_TICK_RATE > 0U)
777 std::uint_fast8_t
const tickRate,
778 void const *
const sender)
noexcept
788 std::uint8_t
const prio,
789 std::uint8_t
const pthre)
noexcept;
794 void *
const poolSto,
795 std::uint_fast32_t
const poolSize,
796 std::uint_fast16_t
const evtSize)
noexcept;
798std::uint16_t poolGetMaxBlockSize() noexcept;
799std::uint16_t
getPoolUse(std::uint_fast8_t const poolNum) noexcept;
800std::uint16_t
getPoolFree(std::uint_fast8_t const poolNum) noexcept;
801std::uint16_t
getPoolMin(std::uint_fast8_t const poolNum) noexcept;
803 std::uint_fast16_t const evtSize,
804 std::uint_fast16_t const margin,
806void gc(
QEvt const * const e) noexcept;
808 QEvt const * const e,
809 QEvt const * const evtRef) noexcept;
814 template<
class evtT_>
818 return static_cast<evtT_*
>(
821 template<
class evtT_>
822 inline evtT_ * q_new_x(std::uint_fast16_t
const margin,
827 return static_cast<evtT_*
>(
QP::QF::newX_(
sizeof(evtT_), margin, sig));
832 template<
class evtT_>
struct isQEvt_ {
833 static constexpr bool value =
false;
835 template<>
struct isQEvt_<QEvt> {
836 static constexpr bool value =
true;
838 template<
typename... Args>
struct isDynTag_ {
839 static constexpr bool value =
false;
841 template<>
struct isDynTag_<QEvt::DynEvt> {
842 static constexpr bool value =
true;
846 template<
class evtT_,
typename... Args>
848 static_assert(isQEvt_<evtT_>::value || !isDynTag_<Args...>::value,
849 "QEvt::DYNAMIC is only for QP::QEvt; an event class with "
850 "parameters must declare its own init()");
853 evtT_ *e =
static_cast<evtT_*
>(
858 template<
class evtT_,
typename... Args>
859 inline evtT_ *
q_new_x(std::uint_fast16_t
const margin,
860 QSignal const sig, Args... args)
862 static_assert(isQEvt_<evtT_>::value || !isDynTag_<Args...>::value,
863 "QEvt::DYNAMIC is only for QP::QEvt; an event class with "
864 "parameters must declare its own init()");
868 static_cast<evtT_*
>(
QP::QF::newX_(
sizeof(evtT_), margin, sig));
880 evtT_
const *& evtRef)
894 std::uint_fast16_t
const evtSize,
895 std::uint_fast16_t
const margin,
897void gcFromISR(
QEvt const * e)
noexcept;
905#ifdef QF_ON_CONTEXT_SW
913 #define Q_NEW(evtT_, sig_) (QP::QF::q_new<evtT_>((sig_)))
914 #define Q_NEW_X(evtT_, margin_, sig_) \
915 (QP::QF::q_new_x<evtT_>((margin_), (sig_)))
917 #define Q_NEW(evtT_, sig_, ...) \
918 (QP::QF::q_new<evtT_>((sig_), __VA_ARGS__))
919 #define Q_NEW_X(evtT_, margin_, sig_, ...) \
920 (QP::QF::q_new_x<evtT_>((margin_), (sig_), __VA_ARGS__))
923#define Q_NEW_REF(evtRef_, evtT_) (QP::QF::q_new_ref<evtT_>(e, (evtRef_)))
924#define Q_DELETE_REF(evtRef_) do { \
925 QP::QF::deleteRef_((evtRef_)); \
926 (evtRef_) = nullptr; \
930 #define PUBLISH(e_, sender_) \
931 publish_((e_), (sender_), (sender_)->getPrio())
932 #define POST(e_, sender_) post_((e_), (sender_))
933 #define POST_X(e_, margin_, sender_) \
934 postx_((e_), (margin_), (sender_))
935 #define TICK_X(tickRate_, sender_) tick((tickRate_), (sender_))
936 #define TRIG(sender_) trig_((sender_))
938 #define PUBLISH(e_, dummy) publish_((e_), nullptr, 0U)
939 #define POST(e_, dummy) post_((e_), nullptr)
940 #define POST_X(e_, margin_, dummy) postx_((e_), (margin_), nullptr)
941 #define TICK_X(tickRate_, dummy) tick((tickRate_), nullptr)
942 #define TRIG(sender_) trig_(nullptr)
945#define TICK(sender_) TICK_X(0U, (sender_))
947#ifndef QF_CRIT_EXIT_NOP
948 #define QF_CRIT_EXIT_NOP() (static_cast<void>(0))
Active Object class (based on the QP::QHsm implementation strategy).
QACTIVE_THREAD_TYPE m_thread
Port-dependent representation of the thread of the active object.
static std::uint16_t getQueueMin(std::uint_fast8_t const prio) noexcept
Obtain the minimum of free entries of the given event queue since start.
void unregister_() noexcept
Un-register the active object from the framework.
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 post_(QEvt const *const e, void const *const sender) noexcept
Posts an event e directly to the event queue of the active object using the First-In-First-Out (FIFO)...
void register_() noexcept
Register this active object to be managed by the framework.
void postFIFO_(QEvt const *const e, void const *const sender)
Internal helper function to insert event to QP::QEQueue queue.
static void publish_(QEvt const *const e, void const *const sender, std::uint_fast8_t const qsId) noexcept
Publish event to all subscribers of a given signal e->sig.
void stop()
Stops execution of an active object and removes it from the framework's supervision.
static void evtLoop_(QActive *act)
Event loop thread routine for executing an active object act (defined some in QP ports)Forward Tracea...
void setAttr(std::uint32_t attr1, void const *attr2=nullptr)
Generic setting of additional attributes (defined in some QP ports).
void dispatch(QEvt const *const e, std::uint_fast8_t const qsId) override
Dispatch an event to QActive (delegate to QP::QHsm).
bool isIn(QStateHandler const stateHndl) noexcept override
Is-in-state query in QActive (delegate to QP::QHsm).
bool postx_(QEvt const *const e, std::uint_fast16_t const margin, void const *const sender) noexcept
Posts an event e directly to the event queue of the active object using the First-In-First-Out (FIFO)...
QActive(QStateHandler const initial) noexcept
QActive constructor (abstract base class).
QACTIVE_EQUEUE_TYPE m_eQueue
Port-dependent event-queue type (often QP::QEQueue).
QStateHandler childState(QStateHandler const parentHandler) noexcept
Obtain the current active child state of a given parent in QP::QActive (delegate to QP::QHsm).
static void psInit(QSubscrList *const subscrSto, QSignal const maxSignal) noexcept
Initializes the publish-subscribe facility for the application.
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.
QStateHandler getStateHandler() const noexcept override
Get current state-handler in QActive (delegate to QP::QHsm).
std::uint8_t m_pthre
Preemption-threshold [1..QF_MAX_ACTIVE] of this AO.
QACTIVE_OS_OBJ_TYPE m_osObject
Port-dependent per-thread object.
virtual bool postFromISR(QEvt const *const e, std::uint_fast16_t const margin, void *const par, void const *const sender) noexcept
The "FromISR" variant used in the QP port to "FreeRTOS" \clearpage .
std::uint8_t m_prio
QF-priority [1..QF_MAX_ACTIVE] of this AO.
static void publishFromISR(QEvt const *const e, void *const par, void const *const sender) noexcept
The "FromISR" variant used in the QP port to "FreeRTOS" \clearpage \clearpage .
Abstract State Machine class (state machine interface).
QState qm_entry(QMState const *const s) noexcept
Internal helper function to execute state entry actions in QP::QMsm.
QAsm() noexcept
Constructor of the QP::QAsm base class.
QState qm_tran_hist(QMState const *const hist, void const *const tatbl) noexcept
Internal helper function to take a state transition to history in QP::QMsm.
QStateHandler state() const noexcept
Obtain the current active state from a state machine (read only).
static constexpr QState Q_RET_UNHANDLED
Return value from a state handler: the event was not handled due to a guard condition (Q_UNHANDLED())...
QState qm_tran(void const *const tatbl) noexcept
Internal helper function to take a state transition in QP::QMsm.
static constexpr QState Q_RET_TRAN
Return value from a state handler: a regular state transition was taken (tran()) \clearpage .
static constexpr QState Q_RET_ENTRY
Return value from an entry action: the entry action was executed (used in QP::QMsm only) \clearpage ...
QState qm_exit(QMState const *const s) noexcept
Internal helper function to execute state exit actions in QP::QMsm.
QState tran_hist(QStateHandler const hist) noexcept
Internal helper function to take a state transition to history in sublclasses of QP::QAsm.
QState super(QStateHandler const superstate) noexcept
Internal helper function to indicate superstate of a given state in sublclasses of QP::QAsm.
QState qm_tran_init(void const *const tatbl) noexcept
Internal helper function to take an initial transition in QP::QMsm.
QAsmAttr m_temp
Temporary storage for target/act-table etc.
static constexpr QState Q_RET_IGNORED
Return value from a state handler: the event was ignored (used in QP::QHsm only) \clearpage .
virtual bool isIn(QStateHandler const stateHndl)=0
Virtual function to check whether the state machine is in a given state.
static constexpr QState Q_RET_SUPER
Return value from a state handler: the event is passed to the superstate (super()).
virtual QStateHandler getStateHandler() const noexcept=0
Virtual method for getting the current state handler.
static constexpr QState Q_RET_TRAN_INIT
Return value from an initial transition: a nested initial transition was taken (used in QP::QMsm only...
static constexpr QState Q_RET_TRAN_HIST
Return value from a state handler: a transition to history was taken (tran_hist()) \clearpage .
static constexpr QState Q_RET_EXIT
Return value from an exit action: the exit action was executed (used in QP::QMsm only) \clearpage .
QMState const * stateObj() const noexcept
Obtain the current state from a MSM (read only).
static constexpr std::size_t MAX_NEST_DEPTH_
Maximum supported nesting depth of a state machine.
virtual ~QAsm()=default
Virtual destructor of the QP::QAsm abstract base class.
virtual void init(void const *const e, std::uint_fast8_t const qsId)=0
Virtual function to take the top-most initial transition in the state machine.
QState tran(QStateHandler const target) noexcept
Internal helper function to take a state transition in sublclasses of QP::QAsm.
static constexpr QSignal Q_INIT_SIG
Reserved signal sent to state handler to execute the initial transition (used in QP::QHsm only) \cle...
QAsmAttr m_state
Current state (pointer to the current state-handler function) \clearpage .
virtual void dispatch(QEvt const *const e, std::uint_fast8_t const qsId)=0
Virtual function to dispatch an event to the state machine.
static constexpr QSignal Q_ENTRY_SIG
Reserved signal sent to state handler to execute the entry case (used in QP::QHsm only) \clearpage .
static constexpr QSignal Q_EXIT_SIG
Reserved signal sent to state handler to execute the exit case (used in QP::QHsm only) \clearpage .
static constexpr QSignal Q_EMPTY_SIG
Reserved signal sent to state handler to execute the default case (used in QP::QHsm only) \clearpage...
static constexpr QState Q_RET_HANDLED
Return value from a state handler: the event was handled (Q_HANDLED()) \clearpage .
static QState top(void *const me, QEvt const *const e) noexcept
Top state handler that ignores all events.
void init(DynEvt const dummy) const noexcept
Event initialization for dynamic events.
@ DYNAMIC
Dummy parameter for dynamic event initialization (see QP::QEvt::init(DynEvt)) \clearpage .
std::uint32_t poolNum_
Event pool number of this event.
constexpr QEvt(QSignal const s) noexcept
Event constexpr constructor applicable to immutable and mutable event instances.
std::uint32_t refCtr_
Event reference counter.
QEvt()=delete
Disallowed default event constructor (documented and traced together with all constructors of QP::QEv...
void init() const =delete
Deleted initialization without arguments: compile-time check for a missing init() in event classes de...
std::uint32_t filler_
Member of QP::QEvt to make it identical size in QP/C++ and SafeQP/C++.
std::uint32_t sig
Signal of the event (see Event Signal).
std::size_t tran_complex_(std::array< QStateHandler, MAX_PATH_LEN_ > &path, std::uint_fast8_t const qsId)
Implementation of a complex state transition segment.
void enter_target_(std::array< QStateHandler, MAX_PATH_LEN_ > &path, std::size_t const depth, std::uint_fast8_t const qsId)
Implementation of entry to the target state configuration.
std::size_t tran_simple_(std::array< QStateHandler, MAX_PATH_LEN_ > &path, std::uint_fast8_t const qsId)
Implementation of a simple state transition segment.
void dispatch(QEvt const *const e, std::uint_fast8_t const qsId) override
Virtual override to dispatch an event to QHsm.
QStateHandler childState(QStateHandler const parentHndl) noexcept
Obtain the current active child state of a given parent in QP::QHsm.
void init(void const *const e, std::uint_fast8_t const qsId) override
Virtual override to take the top-most initial transition in QHsm.
QHsm(QStateHandler const initial) noexcept
Constructor of the QP::QHsm base class.
bool isIn(QStateHandler const stateHndl) noexcept override
Check whether the HSM is in a given stateHndl.
QStateHandler getStateHandler() const noexcept override
Implementation of getting the state handler in an QP::QHsm subclass.
static constexpr std::size_t MAX_PATH_LEN_
Length of the entry-path arrays in QHsm state machines.
QMActive(QStateHandler const initial) noexcept
Constructor of QP::QMActive class.
QStateHandler getStateHandler() const noexcept override
Get current state-handler in QActive (delegate to QP::QMsm).
bool isIn(QStateHandler const stateHndl) noexcept override
Is-in-state query in QActive (delegate to QP::QMsm).
void dispatch(QEvt const *const e, std::uint_fast8_t const qsId) override
Dispatch an event to QActive (delegate to QP::QMsm).
void init(void const *const e, std::uint_fast8_t const qsId) override
Take the top-most initial transition in QActive (delegate to QP::QMsm).
QMState const * childStateObj(QMState const *const parent) const noexcept
Obtain the current active child state of a given parent in QP::QMActive (delegate to QP::QMsm).
QMState const * childStateObj(QMState const *const parentHndl) const noexcept
Obtain the current active child state of a given parent in QP::QMsm.
void exitToTranSource_(QMState const *const curr_state, QMState const *const tran_source, std::uint_fast8_t const qsId)
Exit the given current-state up to the given tran-source in QP::QMsm.
QState execTatbl_(QMTranActTable const *const tatbl, std::uint_fast8_t const qsId)
Execute a transition-action table in QP::QMsm.
static QMState const * topQMState() noexcept
return top-most state object in a QP::QMsm
void dispatch(QEvt const *const e, std::uint_fast8_t const qsId) override
Implementation of dispatching events to a QP::QMsm.
QState enterHistory_(QMState const *const hist, std::uint_fast8_t const qsId)
Enter the history of a given state in QP::QMsm.
void init(void const *const e, std::uint_fast8_t const qsId) override
Implementation of the top-most initial transition in QP::QMsm.
bool isIn(QStateHandler const stateHndl) noexcept override
Tests if a given state is part of the current active state configuration.
QMsm(QStateHandler const initial) noexcept
Constructor of QP::QMsm.
QStateHandler getStateHandler() const noexcept override
Obtain the current active state from a MSM (read only).
Set of Active Objects of up to QF_MAX_ACTIVE elements.
std::uint_fast8_t findMax() const noexcept
Find the maximum element in the (non-empty) priority-set.
void remove(std::uint_fast8_t const n) noexcept
Remove element n from the priority-set (n = 1..QF_MAX_ACTIVE).
QPSetBits m_bits1
Bitmask for elements 33..64 \clearpage .
bool notEmpty() const noexcept
Find out whether the priority-set is NOT empty.
bool hasElement(std::uint_fast8_t const n) const noexcept
Find out whether the priority-set has element n.
QPSetBits m_bits0
Bitmask for elements 1..32 \clearpage .
void setEmpty() noexcept
Make the priority set empty \clearpage .
bool isEmpty() const noexcept
Find out whether the priority-set is empty.
void insert(std::uint_fast8_t const n) noexcept
Insert element n into the priority-set (n = 1..QF_MAX_ACTIVE).
Software tracing instrumentation target-resident component.
Subscriber List (for publish-subscribe).
QPSet m_set
The set of AOs that subscribed to a given event signal \clearpage .
void trig_(void const *const sender) noexcept
Asynchronously trigger the QTicker active object to perform tick processing.
void dispatch(QEvt const *const e, std::uint_fast8_t const qsId) override
Internal helper function to dispatch an event to QP::QTicker AO.
void init(void const *const e, std::uint_fast8_t const qsId) override
Internal helper function to take the top-most initial transition in QTicker AO.
QTicker(std::uint8_t const tickRate) noexcept
Constructor of the QTicker Active Object class.
static void tick(std::uint_fast8_t const tickRate, void const *const sender) noexcept
Processes all armed time events at every clock tick.
QTimeEvt * m_next
Link to the next time event in the list \clearpage .
QTimeEvt * toTimeEvt() noexcept
Get the list of newly armed time events from a head time event (as a pointer to QP::QTimeEvt).
bool disarm() noexcept
Disarm a time event.
QTimeEvt(QActive *const act, QSignal const sig, std::uint_fast8_t const tickRate=0U) noexcept
The "extended" constructor to initialize a Time Event.
static void tick1_(std::uint_fast8_t const tickRate, void const *const sender)
Processes one (the next upcoming) clock tick for QUTest.
static bool noActive(std::uint_fast8_t const tickRate) noexcept
Check if any time events are active at a given clock tick rate.
void * m_act
Active object that receives the time events \clearpage .
QActive * toActive() noexcept
Get the recipient Active Object of a time event (as a pointer to QP::QActive).
std::uint8_t getFlags() const noexcept
Get the internal status flags of a time event.
void armX(std::uint32_t const nTicks, std::uint32_t const interval=0U) noexcept
Arm a time event (extended version for one-shot or periodic time event).
QTimeEvtCtr getCtr() const noexcept
Get the current value of the down-counter of a time event.
bool rearm(std::uint32_t const nTicks) noexcept
Rearm a time event.
QTimeEvtCtr m_ctr
Down-counter of the time event.
QTimeEvtCtr m_interval
Interval for periodic time event (zero for one-shot time event).
bool wasDisarmed() noexcept
Check whether the timeout being processed is valid (not stale).
eXtended (blocking) thread of the QXK preemptive kernel
QF Active Object Framework namespace.
void deleteRef_(QEvt const *const evtRef) noexcept
Internal QF implementation of deleting event reference.
void onCleanup()
Cleanup QF callback.
QEvt const * newRef_(QEvt const *const e, QEvt const *const evtRef) noexcept
Internal QF implementation of creating new event reference.
void gc(QEvt const *const e) noexcept
Recycle a mutable (dynamic) event.
QEvt * newX_(std::uint_fast16_t const evtSize, std::uint_fast16_t const margin, QSignal const sig) noexcept
Internal QF implementation of creating new mutable (dynamic) event.
evtT_ * q_new_x(std::uint_fast16_t const margin, QSignal const sig, Args... args)
Function template to allocate a dynamic event without asserting successful allocation.
void tick(std::uint_fast8_t const tickRate, void const *const sender) noexcept
evtT_ * q_new(QSignal const sig, Args... args)
Function template to allocate a dynamic event and asserting successful allocation.
void psInit(QSubscrList *const subscrSto, QSignal const maxSignal) noexcept
void QF_INIT_CFGCHK_()
QF initialization with the configuration-specific name (QP configuration check).
std::uint16_t getPoolUse(std::uint_fast8_t const poolNum) noexcept
Obtain the number of used entries of the given event pool or of all event pools.
constexpr std::uint_fast16_t NO_MARGIN
Special value of margin that causes asserting failure in case event allocation or event posting fails...
void init()
QF initialization.
void q_new_ref(QP::QEvt const *const e, evtT_ const *&evtRef)
Create a new reference of the current event e.
std::uint16_t getPoolMin(std::uint_fast8_t const poolNum) noexcept
Obtain the minimum of free entries of the given event pool.
std::uint_fast16_t getQueueMin(std::uint_fast8_t const prio) noexcept
void q_delete_ref(evtT_ const *&evtRef)
Delete a new reference of the current event e.
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...
std::uint16_t getPoolFree(std::uint_fast8_t const poolNum) noexcept
Obtain the number of free entries of the given event pool.
void publish_(QEvt const *const e, void const *const sender, std::uint_fast8_t const qsId) noexcept
void onStartup()
Startup QF callback.
QP/C++ Framework namespace \clearpage .
std::uint32_t QTimeEvtCtr
Data type to store the time-event down-counter and interval defined based on the macro QF_TIMEEVT_CTR...
QState(*)(void *const me) QActionHandler
Pointer to an action-handler function \clearpage .
char const * version() noexcept
Version string of the Framework embedded in the binary image.
std::uint_fast8_t QF_LOG2(QP::QPSetBits const bitmask) noexcept
Generic (portable) integer log-base-2 of a QPSet bitmask.
std::uint_fast8_t QState
Type returned from state-handler functions \clearpage .
QState(*)(void *const me, QEvt const *const e) QStateHandler
Pointer to a state-handler function \clearpage .
std::uint32_t QPSetBits
Bitmask for the internal representation of QPSet elements.
std::uint16_t QSignal
The signal of event QP::QEvt.
void(*)(QXThread *const me) QXThreadHandler
Pointer to an extended-thread handler function.
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().
#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.
QP/C++ configuration check (link-time detection of a configuration mismatch between the QP/C++ Framew...
#define QF_MAX_ACTIVE
Maximum # Active Objects in the system (1..64).
#define QACTIVE_OS_OBJ_TYPE
Port-specific QActive "OS-object" type.
#define QACTIVE_EQUEUE_TYPE
Port-specific QActive event queue type.
#define QACTIVE_THREAD_TYPE
Port-specific QActive thread type.
The data type to store in the event queue ring-buffer.
State object for the QP::QMsm class (QM State Machine).
Transition-Action Table for the QP::QMsm State Machine \clearpage .
Attribute of for the QP::QAsm class (Abstract State Machine).