QP/C  7.3.4
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qk.h
Go to the documentation of this file.
1//$file${include::qk.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2//
3// Model: qpc.qm
4// File: ${include::qk.h}
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) : qpc
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.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43#ifndef QK_H_
44#define QK_H_
45
46//$declare${QK::QK} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
47
48//${QK::QK} ..................................................................
49//! @class QK
50typedef struct QK {
51 //! @cond INTERNAL
52 uint8_t dummy;
53 //! @endcond
54} QK;
55//$enddecl${QK::QK} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56
57//$declare${QK::QSchedStatus} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
58
59//${QK::QSchedStatus} ........................................................
60typedef uint_fast8_t QSchedStatus;
61//$enddecl${QK::QSchedStatus} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
62
63//$declare${QK::QK-base} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
64
65//${QK::QK-base::Attr} .......................................................
66//! @class QK_Attr
67typedef struct {
68// private:
69
70 //! @memberof QK_Attr
72
73 //! @memberof QK_Attr
74 uint_fast8_t actPrio;
75
76 //! @memberof QK_Attr
77 uint_fast8_t nextPrio;
78
79 //! @memberof QK_Attr
80 uint_fast8_t actThre;
81
82 //! @memberof QK_Attr
83 uint_fast8_t lockCeil;
84
85 //! @memberof QK_Attr
86 uint_fast8_t intNest;
87
88#ifndef Q_UNSAFE
89 //! @memberof QK_Attr
91#endif // ndef Q_UNSAFE
92
93#ifndef Q_UNSAFE
94 //! @memberof QK_Attr
95 uint_fast8_t actPrio_dis;
96#endif // ndef Q_UNSAFE
97
98#ifndef Q_UNSAFE
99 //! @memberof QK_Attr
100 uint_fast8_t nextPrio_dis;
101#endif // ndef Q_UNSAFE
102
103#ifndef Q_UNSAFE
104 //! @memberof QK_Attr
105 uint_fast8_t actThre_dis;
106#endif // ndef Q_UNSAFE
107
108#ifndef Q_UNSAFE
109 //! @memberof QK_Attr
110 uint_fast8_t lockCeil_dis;
111#endif // ndef Q_UNSAFE
112} QK_Attr;
113
114//${QK::QK-base::priv_} ......................................................
115//! @static @private @memberof QK
117
118//${QK::QK-base::schedLock} ..................................................
119//! @static @public @memberof QK
120QSchedStatus QK_schedLock(uint_fast8_t const ceiling);
121
122//${QK::QK-base::schedUnlock} ................................................
123//! @static @public @memberof QK
124void QK_schedUnlock(QSchedStatus const prevCeil);
125
126//${QK::QK-base::onIdle} .....................................................
127//! @static @public @memberof QK
128void QK_onIdle(void);
129
130//${QK::QK-base::sched_} .....................................................
131//! @static @private @memberof QK
132uint_fast8_t QK_sched_(void);
133
134//${QK::QK-base::activate_} ..................................................
135//! @static @private @memberof QK
136void QK_activate_(void);
137//$enddecl${QK::QK-base} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
138
139//============================================================================
140// interface used only for internal implementation, but not in applications
141#ifdef QP_IMPL
142
143//$declare${QK-impl} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
144
145//${QK-impl::QF_SCHED_STAT_} .................................................
146#define QF_SCHED_STAT_ QSchedStatus lockStat_;
147
148//${QK-impl::QF_SCHED_LOCK_} .................................................
149#define QF_SCHED_LOCK_(ceil_) do { \
150 if (QK_ISR_CONTEXT_()) { \
151 lockStat_ = 0xFFU; \
152 } else { \
153 lockStat_ = QK_schedLock((ceil_)); \
154 } \
155} while (false)
156
157//${QK-impl::QF_SCHED_UNLOCK_} ...............................................
158#define QF_SCHED_UNLOCK_() do { \
159 if (lockStat_ != 0xFFU) { \
160 QK_schedUnlock(lockStat_); \
161 } \
162} while (false)
163
164//${QK-impl::QACTIVE_EQUEUE_WAIT_} ...........................................
165#define QACTIVE_EQUEUE_WAIT_(me_) \
166 Q_ASSERT_INCRIT(320, (me_)->eQueue.frontEvt != (QEvt *)0)
167
168//${QK-impl::QACTIVE_EQUEUE_SIGNAL_} .........................................
169#ifndef Q_UNSAFE
170#define QACTIVE_EQUEUE_SIGNAL_(me_) do { \
171 QPSet_insert(&QK_priv_.readySet, (uint_fast8_t)(me_)->prio); \
172 QPSet_update_(&QK_priv_.readySet, &QK_priv_.readySet_dis); \
173 if (!QK_ISR_CONTEXT_()) { \
174 if (QK_sched_() != 0U) { \
175 QK_activate_(); \
176 } \
177 } \
178} while (false)
179#endif // ndef Q_UNSAFE
180
181//${QK-impl::QACTIVE_EQUEUE_SIGNAL_} .........................................
182#ifdef Q_UNSAFE
183#define QACTIVE_EQUEUE_SIGNAL_(me_) do { \
184 QPSet_insert(&QK_priv_.readySet, (uint_fast8_t)(me_)->prio); \
185 if (!QK_ISR_CONTEXT_()) { \
186 if (QK_sched_() != 0U) { \
187 QK_activate_(); \
188 } \
189 } \
190} while (false)
191#endif // def Q_UNSAFE
192//$enddecl${QK-impl} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
193
194//$declare${QF_EPOOL-impl} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
195
196//${QF_EPOOL-impl::QF_EPOOL_TYPE_} ...........................................
197#define QF_EPOOL_TYPE_ QMPool
198
199//${QF_EPOOL-impl::QF_EPOOL_INIT_} ...........................................
200#define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) \
201 (QMPool_init(&(p_), (poolSto_), (poolSize_), (evtSize_)))
202
203//${QF_EPOOL-impl::QF_EPOOL_EVENT_SIZE_} .....................................
204#define QF_EPOOL_EVENT_SIZE_(p_) ((uint_fast16_t)(p_).blockSize)
205
206//${QF_EPOOL-impl::QF_EPOOL_GET_} ............................................
207#define QF_EPOOL_GET_(p_, e_, m_, qsId_) \
208 ((e_) = (QEvt *)QMPool_get(&(p_), (m_), (qsId_)))
209
210//${QF_EPOOL-impl::QF_EPOOL_PUT_} ............................................
211#define QF_EPOOL_PUT_(p_, e_, qsId_) \
212 (QMPool_put(&(p_), (e_), (qsId_)))
213//$enddecl${QF_EPOOL-impl} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
214
215#endif // QP_IMPL
216
217#endif // QK_H_
uint_fast8_t QSchedStatus
Definition qk.h:60
Private attributes of the QK kernel.
Definition qk.h:67
uint_fast8_t actThre
Definition qk.h:80
uint_fast8_t lockCeil
Definition qk.h:83
QPSet readySet_dis
Definition qk.h:90
QPSet readySet
Definition qk.h:71
uint_fast8_t actPrio_dis
Definition qk.h:95
uint_fast8_t intNest
Definition qk.h:86
uint_fast8_t actThre_dis
Definition qk.h:105
uint_fast8_t nextPrio_dis
Definition qk.h:100
uint_fast8_t nextPrio
Definition qk.h:77
uint_fast8_t lockCeil_dis
Definition qk.h:110
uint_fast8_t actPrio
Definition qk.h:74
QK preemptive non-blocking kernel (QK namespace emulated as a "class" in C)
Definition qk.h:50
QSchedStatus QK_schedLock(uint_fast8_t const ceiling)
void QK_onIdle(void)
QK_Attr QK_priv_
Definition qk.h:116
Set of Active Objects of up to QF_MAX_ACTIVE elements.
Definition qp.h:658