-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
23,646 additions
and
12,327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
//$file${include::qequeue.hpp} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | ||
// | ||
// Model: qpcpp.qm | ||
// File: ${include::qequeue.hpp} | ||
// | ||
// This code has been generated by QM 6.2.3 <www.state-machine.com/qm>. | ||
// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. | ||
// | ||
// ____________________________________ | ||
// / / | ||
// / GGGGGGG PPPPPPPP LL / | ||
// / GG GG PP PP LL / | ||
// / GG PP PP LL / | ||
// / GG GGGGG PPPPPPPP LL / | ||
// / GG GG PP LL / | ||
// / GGGGGGG PP LLLLLLL / | ||
// /___________________________________/ | ||
// | ||
// Copyright (c) 2005 Quantum Leaps, LLC | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// | ||
// This generated code is open-source software licensed under the GNU | ||
// General Public License (GPL) as published by the Free Software Foundation | ||
// (see <https://www.gnu.org/licenses>). | ||
// | ||
// NOTE: | ||
// The GPL does NOT permit the incorporation of this code into proprietary | ||
// programs. Please contact Quantum Leaps for commercial licensing options, | ||
// which expressly supersede the GPL and are designed explicitly for licensees | ||
// interested in retaining the proprietary status of the generated code. | ||
// | ||
// Quantum Leaps contact information: | ||
// <www.state-machine.com/licensing> | ||
// <[email protected]> | ||
// | ||
//$endhead${include::qequeue.hpp} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
#ifndef QEQUEUE_HPP_ | ||
#define QEQUEUE_HPP_ | ||
|
||
#ifndef QF_EQUEUE_CTR_SIZE | ||
#define QF_EQUEUE_CTR_SIZE 1U | ||
#endif | ||
|
||
namespace QP { | ||
|
||
#if (QF_EQUEUE_CTR_SIZE == 1U) | ||
using QEQueueCtr = std::uint8_t; | ||
#elif (QF_EQUEUE_CTR_SIZE == 2U) | ||
using QEQueueCtr = std::uint16_t; | ||
#elif (QF_EQUEUE_CTR_SIZE == 4U) | ||
using QEQueueCtr = std::uint32_t; | ||
#else | ||
#error "QF_EQUEUE_CTR_SIZE defined incorrectly, expected 1U, 2U, or 4U" | ||
#endif | ||
|
||
class QEvt; // forward declaration | ||
|
||
} // namespace QP | ||
|
||
//$declare${QF::QEQueue} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | ||
namespace QP { | ||
|
||
//${QF::QEQueue} ............................................................. | ||
class QEQueue { | ||
private: | ||
QEvt const * volatile m_frontEvt; | ||
QEvt const ** m_ring; | ||
QEQueueCtr m_end; | ||
QEQueueCtr volatile m_head; | ||
QEQueueCtr volatile m_tail; | ||
QEQueueCtr volatile m_nFree; | ||
QEQueueCtr m_nMin; | ||
|
||
// friends... | ||
friend class QActive; | ||
friend class QTicker; | ||
friend class QXMutex; | ||
friend class QXThread; | ||
|
||
public: | ||
QEQueue() noexcept | ||
: m_frontEvt(nullptr), | ||
m_ring(nullptr), | ||
m_end(0U), | ||
m_head(0U), | ||
m_tail(0U), | ||
m_nFree(0U), | ||
m_nMin(0U) | ||
{} | ||
void init( | ||
QEvt const * qSto[], | ||
std::uint_fast16_t const qLen) noexcept; | ||
bool post( | ||
QEvt const * const e, | ||
std::uint_fast16_t const margin, | ||
std::uint_fast8_t const qs_id) noexcept; | ||
void postLIFO( | ||
QEvt const * const e, | ||
std::uint_fast8_t const qs_id) noexcept; | ||
QEvt const * get(std::uint_fast8_t const qs_id) noexcept; | ||
QEQueueCtr getNFree() const noexcept { | ||
return m_nFree; | ||
} | ||
QEQueueCtr getNMin() const noexcept { | ||
return m_nMin; | ||
} | ||
bool isEmpty() const noexcept { | ||
return m_frontEvt == nullptr; | ||
} | ||
|
||
private: | ||
QEQueue(QEQueue const & other) = delete; | ||
QEQueue & operator=(QEQueue const & other) = delete; | ||
}; // class QEQueue | ||
|
||
} // namespace QP | ||
//$enddecl${QF::QEQueue} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
#endif // QEQUEUE_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
//$file${include::qk.hpp} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | ||
// | ||
// Model: qpcpp.qm | ||
// File: ${include::qk.hpp} | ||
// | ||
// This code has been generated by QM 6.2.3 <www.state-machine.com/qm>. | ||
// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. | ||
// | ||
// ____________________________________ | ||
// / / | ||
// / GGGGGGG PPPPPPPP LL / | ||
// / GG GG PP PP LL / | ||
// / GG PP PP LL / | ||
// / GG GGGGG PPPPPPPP LL / | ||
// / GG GG PP LL / | ||
// / GGGGGGG PP LLLLLLL / | ||
// /___________________________________/ | ||
// | ||
// Copyright (c) 2005 Quantum Leaps, LLC | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// | ||
// This generated code is open-source software licensed under the GNU | ||
// General Public License (GPL) as published by the Free Software Foundation | ||
// (see <https://www.gnu.org/licenses>). | ||
// | ||
// NOTE: | ||
// The GPL does NOT permit the incorporation of this code into proprietary | ||
// programs. Please contact Quantum Leaps for commercial licensing options, | ||
// which expressly supersede the GPL and are designed explicitly for licensees | ||
// interested in retaining the proprietary status of the generated code. | ||
// | ||
// Quantum Leaps contact information: | ||
// <www.state-machine.com/licensing> | ||
// <[email protected]> | ||
// | ||
//$endhead${include::qk.hpp} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
#ifndef QK_HPP_ | ||
#define QK_HPP_ | ||
|
||
//$declare${QK::QSchedStatus} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | ||
namespace QP { | ||
|
||
//${QK::QSchedStatus} ........................................................ | ||
using QSchedStatus = std::uint_fast16_t; | ||
|
||
} // namespace QP | ||
//$enddecl${QK::QSchedStatus} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
//$declare${QK::QK-base} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | ||
namespace QP { | ||
namespace QK { | ||
|
||
//${QK::QK-base::schedLock} .................................................. | ||
QSchedStatus schedLock(std::uint_fast8_t const ceiling) noexcept; | ||
|
||
//${QK::QK-base::schedUnlock} ................................................ | ||
void schedUnlock(QSchedStatus const stat) noexcept; | ||
|
||
//${QK::QK-base::onIdle} ..................................................... | ||
void onIdle(); | ||
|
||
} // namespace QK | ||
} // namespace QP | ||
//$enddecl${QK::QK-base} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
extern "C" { | ||
//$declare${QK-extern-C} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | ||
|
||
//${QK-extern-C::QK_Attr} .................................................... | ||
class QK_Attr { | ||
public: | ||
QP::QPSet readySet; | ||
|
||
#ifndef Q_UNSAFE | ||
QP::QPSet readySet_dis; | ||
#endif // ndef Q_UNSAFE | ||
std::uint_fast8_t volatile actPrio; | ||
std::uint_fast8_t volatile nextPrio; | ||
std::uint_fast8_t volatile actThre; | ||
std::uint_fast8_t volatile lockCeil; | ||
std::uint_fast8_t volatile lockHolder; | ||
std::uint_fast8_t volatile intNest; | ||
}; // class QK_Attr | ||
|
||
//${QK-extern-C::QK_priv_} ................................................... | ||
extern QK_Attr QK_priv_; | ||
|
||
//${QK-extern-C::QK_sched_} .................................................. | ||
std::uint_fast8_t QK_sched_() noexcept; | ||
|
||
//${QK-extern-C::QK_activate_} ............................................... | ||
void QK_activate_() noexcept; | ||
//$enddecl${QK-extern-C} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
} // extern "C" | ||
|
||
//============================================================================ | ||
// interface used only for internal implementation, but not in applications | ||
#ifdef QP_IMPL | ||
|
||
//$declare${QK-impl} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | ||
|
||
//${QK-impl::QF_SCHED_STAT_} ................................................. | ||
#define QF_SCHED_STAT_ QSchedStatus lockStat_; | ||
|
||
//${QK-impl::QF_SCHED_LOCK_} ................................................. | ||
#define QF_SCHED_LOCK_(ceil_) do { \ | ||
if (QK_ISR_CONTEXT_()) { \ | ||
lockStat_ = 0xFFU; \ | ||
} else { \ | ||
lockStat_ = QK::schedLock((ceil_)); \ | ||
} \ | ||
} while (false) | ||
|
||
//${QK-impl::QF_SCHED_UNLOCK_} ............................................... | ||
#define QF_SCHED_UNLOCK_() do { \ | ||
if (lockStat_ != 0xFFU) { \ | ||
QK::schedUnlock(lockStat_); \ | ||
} \ | ||
} while (false) | ||
|
||
//${QK-impl::QACTIVE_EQUEUE_WAIT_} ........................................... | ||
#define QACTIVE_EQUEUE_WAIT_(me_) \ | ||
Q_ASSERT_INCRIT(320, (me_)->m_eQueue.m_frontEvt != nullptr) | ||
|
||
//${QK-impl::QACTIVE_EQUEUE_SIGNAL_} ......................................... | ||
#ifndef Q_UNSAFE | ||
#define QACTIVE_EQUEUE_SIGNAL_(me_) do { \ | ||
QK_priv_.readySet.insert( \ | ||
static_cast<std::uint_fast8_t>((me_)->m_prio)); \ | ||
QK_priv_.readySet.update_(&QK_priv_.readySet_dis); \ | ||
if (!QK_ISR_CONTEXT_()) { \ | ||
if (QK_sched_() != 0U) { \ | ||
QK_activate_(); \ | ||
} \ | ||
} \ | ||
} while (false) | ||
#endif // ndef Q_UNSAFE | ||
|
||
//${QK-impl::QACTIVE_EQUEUE_SIGNAL_} ......................................... | ||
#ifdef Q_UNSAFE | ||
#define QACTIVE_EQUEUE_SIGNAL_(me_) do { \ | ||
QK_priv_.readySet.insert( \ | ||
static_cast<std::uint_fast8_t>((me_)->m_prio)); \ | ||
if (!QK_ISR_CONTEXT_()) { \ | ||
if (QK_sched_() != 0U) { \ | ||
QK_activate_(); \ | ||
} \ | ||
} \ | ||
} while (false) | ||
#endif // def Q_UNSAFE | ||
//$enddecl${QK-impl} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
//$declare${QF_EPOOL-impl} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | ||
|
||
//${QF_EPOOL-impl::QF_EPOOL_TYPE_} ........................................... | ||
#define QF_EPOOL_TYPE_ QMPool | ||
|
||
//${QF_EPOOL-impl::QF_EPOOL_INIT_} ........................................... | ||
#define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) \ | ||
(p_).init((poolSto_), (poolSize_), (evtSize_)) | ||
|
||
//${QF_EPOOL-impl::QF_EPOOL_EVENT_SIZE_} ..................................... | ||
#define QF_EPOOL_EVENT_SIZE_(p_) ((p_).getBlockSize()) | ||
|
||
//${QF_EPOOL-impl::QF_EPOOL_GET_} ............................................ | ||
#define QF_EPOOL_GET_(p_, e_, m_, qs_id_) \ | ||
((e_) = static_cast<QEvt *>((p_).get((m_), (qs_id_)))) | ||
|
||
//${QF_EPOOL-impl::QF_EPOOL_PUT_} ............................................ | ||
#define QF_EPOOL_PUT_(p_, e_, qs_id_) ((p_).put((e_), (qs_id_))) | ||
//$enddecl${QF_EPOOL-impl} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
#endif // QP_IMPL | ||
|
||
#endif // QK_HPP_ |
Oops, something went wrong.