QP/C++  7.4.0-rc.1
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qk.hpp
Go to the documentation of this file.
1//$file${include::qk.hpp} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2//
3// Model: qpcpp.qm
4// File: ${include::qk.hpp}
5//
6// This code has been generated by QM 6.1.1 <www.state-machine.com/qm>.
7// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
8//
9// This code is covered by the following QP license:
10// License # : LicenseRef-QL-dual
11// Issued to : Any user of the QP/C++ real-time embedded framework
12// Framework(s) : qpcpp
13// Support ends : 2024-12-31
14// License scope:
15//
16// Copyright (C) 2005 Quantum Leaps, LLC <state-machine.com>.
17//
18// Q u a n t u m L e a P s
19// ------------------------
20// Modern Embedded Software
21//
22// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
23//
24// This software is dual-licensed under the terms of the open source GNU
25// General Public License version 3 (or any later version), or alternatively,
26// under the terms of one of the closed source Quantum Leaps commercial
27// licenses.
28//
29// The terms of the open source GNU General Public License version 3
30// can be found at: <www.gnu.org/licenses/gpl-3.0>
31//
32// The terms of the closed source Quantum Leaps commercial licenses
33// can be found at: <www.state-machine.com/licensing>
34//
35// Redistributions in source code must retain this top-level comment block.
36// Plagiarizing this software to sidestep the license obligations is illegal.
37//
38// Contact information:
39// <www.state-machine.com/licensing>
40// <info@state-machine.com>
41//
42//$endhead${include::qk.hpp} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43#ifndef QK_HPP_
44#define QK_HPP_
45
46//$declare${QK::QSchedStatus} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
47namespace QP {
48
49//${QK::QSchedStatus} ........................................................
50using QSchedStatus = std::uint_fast8_t;
51
52} // namespace QP
53//$enddecl${QK::QSchedStatus} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54
55//$declare${QK::QK-base} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
56namespace QP {
57namespace QK {
58
59//${QK::QK-base::schedLock} ..................................................
60QSchedStatus schedLock(std::uint_fast8_t const ceiling) noexcept;
61
62//${QK::QK-base::schedUnlock} ................................................
63void schedUnlock(QSchedStatus const prevCeil) noexcept;
64
65//${QK::QK-base::onIdle} .....................................................
66void onIdle();
67
68} // namespace QK
69} // namespace QP
70//$enddecl${QK::QK-base} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
71
72extern "C" {
73//$declare${QK-extern-C} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
74
75//${QK-extern-C::QK_Attr} ....................................................
76class QK_Attr {
77public:
79 std::uint_fast8_t actPrio;
80 std::uint_fast8_t nextPrio;
81 std::uint_fast8_t actThre;
82 std::uint_fast8_t lockCeil;
83 std::uint_fast8_t intNest;
84
85#ifndef Q_UNSAFE
87#endif // ndef Q_UNSAFE
88
89#ifndef Q_UNSAFE
90 std::uint_fast8_t actPrio_dis;
91#endif // ndef Q_UNSAFE
92
93#ifndef Q_UNSAFE
94 std::uint_fast8_t nextPrio_dis;
95#endif // ndef Q_UNSAFE
96
97#ifndef Q_UNSAFE
98 std::uint_fast8_t actThre_dis;
99#endif // ndef Q_UNSAFE
100
101#ifndef Q_UNSAFE
102 std::uint_fast8_t lockCeil_dis;
103#endif // ndef Q_UNSAFE
104}; // class QK_Attr
105
106//${QK-extern-C::QK_priv_} ...................................................
107extern QK_Attr QK_priv_;
108
109//${QK-extern-C::QK_sched_} ..................................................
110std::uint_fast8_t QK_sched_() noexcept;
111
112//${QK-extern-C::QK_activate_} ...............................................
113void QK_activate_() noexcept;
114//$enddecl${QK-extern-C} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
115} // extern "C"
116
117//============================================================================
118// interface used only for internal implementation, but not in applications
119#ifdef QP_IMPL
120
121//$declare${QK-impl} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
122
123//${QK-impl::QF_SCHED_STAT_} .................................................
124#define QF_SCHED_STAT_ QSchedStatus lockStat_;
125
126//${QK-impl::QF_SCHED_LOCK_} .................................................
127#define QF_SCHED_LOCK_(ceil_) do { \
128 if (QK_ISR_CONTEXT_()) { \
129 lockStat_ = 0xFFU; \
130 } else { \
131 lockStat_ = QK::schedLock((ceil_)); \
132 } \
133} while (false)
134
135//${QK-impl::QF_SCHED_UNLOCK_} ...............................................
136#define QF_SCHED_UNLOCK_() do { \
137 if (lockStat_ != 0xFFU) { \
138 QK::schedUnlock(lockStat_); \
139 } \
140} while (false)
141
142//${QK-impl::QACTIVE_EQUEUE_WAIT_} ...........................................
143#define QACTIVE_EQUEUE_WAIT_(me_) \
144 Q_ASSERT_INCRIT(320, (me_)->m_eQueue.m_frontEvt != nullptr)
145
146//${QK-impl::QACTIVE_EQUEUE_SIGNAL_} .........................................
147#ifndef Q_UNSAFE
148#define QACTIVE_EQUEUE_SIGNAL_(me_) do { \
149 QK_priv_.readySet.insert( \
150 static_cast<std::uint_fast8_t>((me_)->m_prio)); \
151 QK_priv_.readySet.update_(&QK_priv_.readySet_dis); \
152 if (!QK_ISR_CONTEXT_()) { \
153 if (QK_sched_() != 0U) { \
154 QK_activate_(); \
155 } \
156 } \
157} while (false)
158#endif // ndef Q_UNSAFE
159
160//${QK-impl::QACTIVE_EQUEUE_SIGNAL_} .........................................
161#ifdef Q_UNSAFE
162#define QACTIVE_EQUEUE_SIGNAL_(me_) do { \
163 QK_priv_.readySet.insert( \
164 static_cast<std::uint_fast8_t>((me_)->m_prio)); \
165 if (!QK_ISR_CONTEXT_()) { \
166 if (QK_sched_() != 0U) { \
167 QK_activate_(); \
168 } \
169 } \
170} while (false)
171#endif // def Q_UNSAFE
172//$enddecl${QK-impl} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
173
174//$declare${QF_EPOOL-impl} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
175
176//${QF_EPOOL-impl::QF_EPOOL_TYPE_} ...........................................
177#define QF_EPOOL_TYPE_ QMPool
178
179//${QF_EPOOL-impl::QF_EPOOL_INIT_} ...........................................
180#define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) \
181 (p_).init((poolSto_), (poolSize_), (evtSize_))
182
183//${QF_EPOOL-impl::QF_EPOOL_EVENT_SIZE_} .....................................
184#define QF_EPOOL_EVENT_SIZE_(p_) ((p_).getBlockSize())
185
186//${QF_EPOOL-impl::QF_EPOOL_GET_} ............................................
187#define QF_EPOOL_GET_(p_, e_, m_, qsId_) \
188 ((e_) = static_cast<QEvt *>((p_).get((m_), (qsId_))))
189
190//${QF_EPOOL-impl::QF_EPOOL_PUT_} ............................................
191#define QF_EPOOL_PUT_(p_, e_, qsId_) ((p_).put((e_), (qsId_)))
192//$enddecl${QF_EPOOL-impl} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
193
194#endif // QP_IMPL
195
196#endif // QK_HPP_
Private attributes of the QK kernel.
Definition qk.hpp:76
std::uint_fast8_t actPrio_dis
Definition qk.hpp:90
std::uint_fast8_t actThre
Definition qk.hpp:81
QP::QPSet readySet
Definition qk.hpp:78
std::uint_fast8_t lockCeil_dis
Definition qk.hpp:102
QP::QPSet readySet_dis
Definition qk.hpp:86
std::uint_fast8_t nextPrio
Definition qk.hpp:80
std::uint_fast8_t actPrio
Definition qk.hpp:79
std::uint_fast8_t nextPrio_dis
Definition qk.hpp:94
std::uint_fast8_t actThre_dis
Definition qk.hpp:98
std::uint_fast8_t intNest
Definition qk.hpp:83
std::uint_fast8_t lockCeil
Definition qk.hpp:82
Set of Active Objects of up to QF_MAX_ACTIVE elements.
Definition qp.hpp:610
QSchedStatus schedLock(std::uint_fast8_t const ceiling) noexcept
Definition qk.cpp:76
void schedUnlock(QSchedStatus const prevCeil) noexcept
Definition qk.cpp:115
void onIdle()
QP/C++ framework.
Definition qequeue.hpp:50
std::uint_fast8_t QSchedStatus
Definition qk.hpp:50
void QK_activate_() noexcept
Definition qk.cpp:206
QK_Attr QK_priv_
Definition qk.cpp:158
std::uint_fast8_t QK_sched_() noexcept
Definition qk.cpp:161