This commit is contained in:
MMS 2025-01-31 12:23:01 -05:00
parent 081154412d
commit b9b4986fb3
11 changed files with 51 additions and 81 deletions

@ -1 +1 @@
Subproject commit f8e601d60a88d04bd49e01bb725efd6e13131c1a
Subproject commit 0230ec1ea67f0f4b9d4f25a51fb38db6e1a134ad

View File

@ -1,6 +1,6 @@
//============================================================================
// QP/C++ Real-Time Embedded Framework (RTEF)
// Version 8.0.2
// Version 8.0.3
//
// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
//
@ -76,11 +76,6 @@ private:
QMPoolCtr volatile m_nFree;
QMPoolCtr m_nMin;
#ifndef Q_UNSAFE
std::uintptr_t m_freeHead_dis;
QMPoolCtr m_nFree_dis;
#endif // ndef Q_UNSAFE
public:
QMPool()
: m_start(nullptr),
@ -90,10 +85,6 @@ public:
m_nTot(0U),
m_nFree(0U),
m_nMin(0U)
#ifndef Q_UNSAFE
,m_freeHead_dis(static_cast<std::uintptr_t>(~0U)),
m_nFree_dis(static_cast<QEQueueCtr>(~0U))
#endif
{}
void init(
void * const poolSto,

View File

@ -180,7 +180,7 @@ constexpr enum_t Q_USER_SIG {4};
//============================================================================
class QAsm {
protected:
public:
QAsmAttr m_state;
QAsmAttr m_temp;
@ -242,8 +242,8 @@ public:
virtual void dispatch(
QEvt const * const e,
std::uint_fast8_t const qsId) = 0;
virtual bool isIn(QStateHandler const state) noexcept {
static_cast<void>(state);
virtual bool isIn(QStateHandler const stateHndl) noexcept {
Q_UNUSED_PAR(stateHndl);
return false;
}
QStateHandler state() const noexcept {
@ -342,8 +342,8 @@ public:
void dispatch(
QEvt const * const e,
std::uint_fast8_t const qsId) override;
bool isIn(QStateHandler const state) noexcept override;
QStateHandler childState(QStateHandler const parent) noexcept;
bool isIn(QStateHandler const stateHndl) noexcept override;
QStateHandler childState(QStateHandler const parentHndl) noexcept;
#ifdef Q_SPY
QStateHandler getStateHandler() noexcept override {
@ -387,8 +387,9 @@ public:
return m_state.obj->stateHandler;
}
#endif // def Q_SPY
bool isIn(QStateHandler const state) noexcept override;
QMState const * childStateObj(QMState const * const parent) const noexcept;
bool isIn(QStateHandler const stateHndl) noexcept override;
QMState const * childStateObj(QMState const * const parentHndl)
const noexcept;
private:
QState execTatbl_(
@ -565,24 +566,12 @@ private:
}; // class QSubscrList
//============================================================================
class QPtrDis {
private:
std::uintptr_t m_ptr_dis;
// friends...
friend class QTimeEvt;
friend class QXThread;
public:
QPtrDis(void const * const ptr = nullptr) noexcept;
}; // class QPtrDis
class QEQueue; // forward declaration
//============================================================================
class QActive : public QP::QAsm {
protected:
private:
std::uint8_t m_prio;
std::uint8_t m_pthre;
@ -640,11 +629,11 @@ public:
{
reinterpret_cast<QHsm *>(this)->QHsm::dispatch(e, qsId);
}
bool isIn(QStateHandler const state) noexcept override {
return reinterpret_cast<QHsm *>(this)->QHsm::isIn(state);
bool isIn(QStateHandler const stateHndl) noexcept override {
return reinterpret_cast<QHsm *>(this)->QHsm::isIn(stateHndl);
}
QStateHandler childState(QStateHandler const parent) noexcept {
return reinterpret_cast<QHsm *>(this)->QHsm::childState(parent);
QStateHandler childState(QStateHandler const parentHandler) noexcept {
return reinterpret_cast<QHsm *>(this)->QHsm::childState(parentHandler);
}
void setAttr(
std::uint32_t attr1,
@ -755,7 +744,7 @@ private:
//============================================================================
class QMActive : public QP::QActive {
protected:
QMActive(QStateHandler const initial) noexcept;
explicit QMActive(QStateHandler const initial) noexcept;
public:
void init(
@ -773,8 +762,8 @@ public:
{
reinterpret_cast<QMsm *>(this)->QMsm::dispatch(e, qsId);
}
bool isIn(QStateHandler const state) noexcept override {
return reinterpret_cast<QMsm *>(this)->QMsm::isIn(state);
bool isIn(QStateHandler const stateHndl) noexcept override {
return reinterpret_cast<QMsm *>(this)->QMsm::isIn(stateHndl);
}
#ifdef Q_SPY

View File

@ -1,7 +1,7 @@
10c35486e20dc82668e4a77ec1a4cc427ba92b21 *include/qequeue.hpp
2af472589274db820aa2a3e7928d7100d2f87cb3 *include/qk.hpp
7394e76571868dfaea3c297e9d00e9f429cbdc3c *include/qmpool.hpp
acc36cf4768e1707256f9891edb39850ad754ab0 *include/qp.hpp
116b187384720d8bac7a2ea85d8bf9d43bda52c0 *include/qmpool.hpp
246f820de07881b85335a0d277037028c324f0bb *include/qp.hpp
4a28afe5b5fabfa5ce45c2eb07c63388d8cd92b1 *include/qp_pkg.hpp
c8c44d7959d255f98aac76f6040433aaa20956b6 *include/qpcpp.hpp
0b4b406267c65182e40565ce01f510554827f005 *include/qs.hpp
@ -13,20 +13,20 @@ cf142966637ce4c4ae831017e8a77fb1fe3a678a *include/qsafe.h
1cb8c24e0188d17c3c0ca4c12fe88f8c04a9e1e7 *include/qxk.hpp
0199f3eeb6c02b8cc890ee4c6f6d344569a0858f *include/README.md
71899ce74eeb04f333ed00d53f87719f722a39ab *src/qf/CMakeLists.txt
750abbc6caf645de293f5107b10fba3fdbb107c9 *src/qf/qep_hsm.cpp
875f0a15305079a6d5861d66fbcceb8333e9b75b *src/qf/qep_msm.cpp
43eef9ea75c14b1378fc01772bf5e4bdc0621ba2 *src/qf/qf_act.cpp
e6584130267023ead98f82b7976fa739d1c0274f *src/qf/qep_hsm.cpp
01811d7d8d296efe06657e0249b58fa23f1f458b *src/qf/qep_msm.cpp
04196e8b69e1c718e362a6477a663f876e3edd2b *src/qf/qf_act.cpp
a8608d5b17afbe82161b01bf0a2edfdc8bbc5a44 *src/qf/qf_actq.cpp
42aa87da9938aea033cda394b2677743d9733149 *src/qf/qf_defer.cpp
19e4d2302186284364543182f6f5af5133516827 *src/qf/qf_dyn.cpp
f811fc2c6447a9b30f5717be9e2677ea9df979c9 *src/qf/qf_dyn.cpp
a06e9252217812cebd30b93fee4c0e4892b7e8e3 *src/qf/qf_mem.cpp
91de7f212c546469f0b7ac9127ccc02860bd6abe *src/qf/qf_ps.cpp
dffd53a967ea218a38c23e71d1aec228a5641b66 *src/qf/qf_qact.cpp
1171eac0c4d4a69a1994e0e9461b785d5ce9803b *src/qf/qf_qeq.cpp
c560d3e16d509e1a72425449fed5fadcb82bc6c4 *src/qf/qf_qeq.cpp
06a3f2fc2b976f7948cac34a434b00ebfbf4a198 *src/qf/qf_qmact.cpp
685aaac6419b8e86e8d6a8029bd2210bb582322c *src/qf/qf_time.cpp
7cdab433e81612862fd27f0cf792d38e1197d064 *src/qk/CMakeLists.txt
5c7393e1bf2f1f336ffda9b4ccfda7849bae6842 *src/qk/qk.cpp
4d2c45a363a12039cb22c0f815e27a21e7112a32 *src/qk/qk.cpp
eb28260d471fc752ca54b2c1e2d763f28432c2c1 *src/qs/CMakeLists.txt
450e30ae7919195dc76d934297e3bacd39eed7dc *src/qs/qs.cpp
a49e4cc82d27458d880e3cea5edf7111228b5c83 *src/qs/qs_64bit.cpp
@ -35,8 +35,8 @@ a79389856629896857f68345a0aa908c07d5ac92 *src/qs/qs_fp.cpp
6e68d4e35a2743c33c45792c922ce065639b8bf5 *src/qs/qstamp.cpp
b4a201fc64467596edadda63dd7f0c8e8344f99d *src/qs/qutest.cpp
b6d93a16f5b176d3da4888a7efb265730337f46d *src/qv/CMakeLists.txt
1588af3ba142febd147eace532cd1993c53a0d11 *src/qv/qv.cpp
2242492063a43fbb9d1725bc243ab30018634bfc *src/qxk/qxk.cpp
9cfb58b7ad43abc68a6099c116583b326aac2e55 *src/qv/qv.cpp
d17bcf9b161a8a10aa0086ef9df3b493d710a1a6 *src/qxk/qxk.cpp
97f0a0bd72757e02e422d1a1d7ecb53343295942 *src/qxk/qxk_mutex.cpp
7081b032e0db0675840a6c8b75edf4d47d13c9c7 *src/qxk/qxk_sema.cpp
70982d9277482d775c967aaf745e9c4c442aef19 *src/qxk/qxk_xthr.cpp

View File

@ -183,7 +183,7 @@ void QHsm::init(
QF_CRIT_EXIT();
// execute the top-most initial tran.
QState r = (*m_temp.fun)(this, Q_EVT_CAST(QEvt));
QState const r = (*m_temp.fun)(this, Q_EVT_CAST(QEvt));
QF_CRIT_ENTRY();
// the top-most initial tran. must be taken
@ -308,14 +308,14 @@ void QHsm::dispatch(
}
//............................................................................
bool QHsm::isIn(QStateHandler const state) noexcept {
bool QHsm::isIn(QStateHandler const stateHndl) noexcept {
bool inState = false; // assume that this HSM is not in 'state'
// scan the state hierarchy bottom-up
QStateHandler s = m_state.fun;
QState r = Q_RET_SUPER;
while (r != Q_RET_IGNORED) {
if (s == state) { // do the states match?
if (s == stateHndl) { // do the states match?
inState = true; // 'true' means that match found
break; // break out of the for-loop
}
@ -326,7 +326,7 @@ bool QHsm::isIn(QStateHandler const state) noexcept {
}
//............................................................................
QStateHandler QHsm::childState(QStateHandler const parent) noexcept {
QStateHandler QHsm::childState(QStateHandler const parentHndl) noexcept {
#ifndef Q_UNSAFE
bool isFound = false; // assume the child state NOT found
#endif
@ -336,7 +336,7 @@ QStateHandler QHsm::childState(QStateHandler const parent) noexcept {
QState r = Q_RET_SUPER;
while (r != Q_RET_IGNORED) {
// have the parent of the current child?
if (m_temp.fun == parent) {
if (m_temp.fun == parentHndl) {
#ifndef Q_UNSAFE
isFound = true; // indicate that child state was found
#endif

View File

@ -232,7 +232,7 @@ void QMsm::dispatch(
t->stateHandler, hist->stateHandler);
// save the tran-action table before it gets clobbered
QMTranActTable const *tatbl = m_temp.tatbl;
QMTranActTable const * const tatbl = m_temp.tatbl;
exitToTranSource_(s, t, qsId);
static_cast<void>(execTatbl_(tatbl, qsId));
r = enterHistory_(hist, qsId);
@ -242,7 +242,7 @@ void QMsm::dispatch(
while (r >= Q_RET_TRAN) {
// save the tran-action table before it gets clobbered
QMTranActTable const *tatbl = m_temp.tatbl;
QMTranActTable const * const tatbl = m_temp.tatbl;
m_temp.obj = nullptr; // clear
exitToTranSource_(s, t, qsId);
r = execTatbl_(tatbl, qsId);
@ -271,12 +271,12 @@ void QMsm::dispatch(
}
//............................................................................
bool QMsm::isIn(QStateHandler const state) noexcept {
bool QMsm::isIn(QStateHandler const stateHndl) noexcept {
bool inState = false; // assume that this SM is not in 'state'
QMState const *s = m_state.obj;
while (s != nullptr) {
if (s->stateHandler == state) { // match found?
if (s->stateHandler == stateHndl) { // match found?
inState = true;
break;
}
@ -287,7 +287,7 @@ bool QMsm::isIn(QStateHandler const state) noexcept {
}
//............................................................................
QMState const * QMsm::childStateObj(QMState const * const parent)
QMState const * QMsm::childStateObj(QMState const * const parentHndl)
const noexcept
{
QMState const *s = m_state.obj; // start with current state
@ -295,7 +295,7 @@ QMState const * QMsm::childStateObj(QMState const * const parent)
bool isFound = false; // assume the child NOT found
while (s != nullptr) {
if (s == parent) {
if (s == parentHndl) {
isFound = true; // child is found
break;
}

View File

@ -1,6 +1,6 @@
//============================================================================
// QP/C++ Real-Time Embedded Framework (RTEF)
// Version 8.0.2
// Version 8.0.3
//
// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
//
@ -101,12 +101,5 @@ std::uint_fast8_t QF_LOG2(QP::QPSetBits const bitmask) noexcept {
}
#endif // ndef QF_LOG2
//............................................................................
#ifndef Q_UNSAFE
QPtrDis::QPtrDis(void const * const ptr) noexcept
: m_ptr_dis(static_cast<std::uintptr_t>(~Q_PTR2UINT_CAST_(ptr)))
{}
#endif
} // namespace QP

View File

@ -138,7 +138,7 @@ QEvt * newX_(
QF_CRIT_EXIT();
// get event `e` out of the event pool (port-dependent)...
QEvt *e = nullptr;
QEvt *e;
#ifdef Q_SPY
QF_EPOOL_GET_(priv_.ePool_[poolNum - 1U], e,
((margin != NO_MARGIN) ? margin : 0U),

View File

@ -88,7 +88,7 @@ bool QEQueue::post(
QEQueueCtr tmp = m_nFree; // get volatile into temporary
// can the queue accept the event?
bool status = ((margin == QF::NO_MARGIN) && (tmp > 0U))
bool const status = ((margin == QF::NO_MARGIN) && (tmp > 0U))
|| (tmp > static_cast<QEQueueCtr>(margin));
if (status) {
// is it a mutable event?

View File

@ -304,18 +304,13 @@ void stop() {
//............................................................................
int_t run() {
QF_INT_DISABLE();
#ifdef Q_SPY
// produce the QS_QF_RUN trace record
QF_INT_DISABLE();
QS::beginRec_(QS_REC_NUM_(QS_QF_RUN));
QS::endRec_();
QF_INT_ENABLE();
#endif // Q_SPY
onStartup(); // application-specific startup callback
QF_INT_DISABLE();
#ifdef QK_START
QK_START(); // port-specific startup of the QK kernel
#endif
@ -334,6 +329,8 @@ int_t run() {
QF_INT_ENABLE();
onStartup(); // app. callback: configure and enable interrupts
for (;;) { // QK idle loop...
QK::onIdle(); // application-specific QK on-idle callback
}

View File

@ -113,18 +113,13 @@ void stop() {
//${QV::QF-cust::run} ........................................................
int_t run() {
QF_INT_DISABLE();
#ifdef Q_SPY
// produce the QS_QF_RUN trace record
QF_INT_DISABLE();
QS::beginRec_(QS_REC_NUM_(QS_QF_RUN));
QS::endRec_();
QF_INT_ENABLE();
#endif // Q_SPY
onStartup(); // application-specific startup callback
QF_INT_DISABLE();
#ifdef QV_START
QV_START(); // port-specific startup of the QV kernel
#endif
@ -139,6 +134,11 @@ int_t run() {
#endif // (defined QF_ON_CONTEXT_SW) || (defined Q_SPY)
QF_INT_ENABLE();
onStartup(); // app. callback: configure and enable interrupts
QF_INT_DISABLE();
for (;;) { // QV event loop...
// find the maximum prio. AO ready to run
std::uint_fast8_t const p = (QV::priv_.readySet.notEmpty()