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