QP/C++  8.0.0
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qf_act.cpp
Go to the documentation of this file.
1//$file${src::qf::qf_act.cpp} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2//
3// Model: qpcpp.qm
4// File: ${src::qf::qf_act.cpp}
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${src::qf::qf_act.cpp} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35#define QP_IMPL // this is QP implementation
36#include "qp_port.hpp" // QP port
37#include "qp_pkg.hpp" // QP package-scope interface
38#include "qsafe.h" // QP Functional Safety (FuSa) Subsystem
39#ifdef Q_SPY // QS software tracing enabled?
40 #include "qs_port.hpp" // QS port
41 #include "qs_pkg.hpp" // QS facilities for pre-defined trace records
42#else
43 #include "qs_dummy.hpp" // disable the QS software tracing
44#endif // Q_SPY
45
46// unnamed namespace for local definitions with internal linkage
47namespace {
48//Q_DEFINE_THIS_MODULE("qf_act")
49} // unnamed namespace
50
51//$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
52// Check for the minimum required QP version
53#if (QP_VERSION < 730U) || (QP_VERSION != ((QP_RELEASE^4294967295U)%0x2710U))
54#error qpcpp version 7.3.0 or higher required
55#endif
56//$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57//$define${QF::QActive::registry_[QF_MAX_ACTIVE + 1U]} vvvvvvvvvvvvvvvvvvvvvvv
58namespace QP {
59QActive * QActive::registry_[QF_MAX_ACTIVE + 1U];
60
61} // namespace QP
62//$enddef${QF::QActive::registry_[QF_MAX_ACTIVE + 1U]} ^^^^^^^^^^^^^^^^^^^^^^^
63
64//$define${QF::QF-pkg} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
65namespace QP {
66namespace QF {
67
68//${QF::QF-pkg::priv_} .......................................................
70
71//${QF::QF-pkg::bzero_} ......................................................
72void bzero_(
73 void * const start,
74 std::uint_fast16_t const len) noexcept
75{
76 std::uint8_t *ptr = static_cast<std::uint8_t *>(start);
77 for (std::uint_fast16_t n = len; n > 0U; --n) {
78 *ptr = 0U;
79 ++ptr;
80 }
81}
82
83} // namespace QF
84} // namespace QP
85//$enddef${QF::QF-pkg} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86//$define${QF::types::QF_LOG2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
87namespace QP {
88
89//${QF::types::QF_LOG2} ......................................................
90#ifndef QF_LOG2
91std::uint_fast8_t QF_LOG2(QP::QPSetBits x) noexcept {
92 static std::uint8_t const log2LUT[16] = {
93 0U, 1U, 2U, 2U, 3U, 3U, 3U, 3U,
94 4U, 4U, 4U, 4U, 4U, 4U, 4U, 4U
95 };
96 std::uint_fast8_t n = 0U;
98
99 #if (QF_MAX_ACTIVE > 16U)
100 t = static_cast<QP::QPSetBits>(x >> 16U);
101 if (t != 0U) {
102 n += 16U;
103 x = t;
104 }
105 #endif
106 #if (QF_MAX_ACTIVE > 8U)
107 t = (x >> 8U);
108 if (t != 0U) {
109 n += 8U;
110 x = t;
111 }
112 #endif
113 t = (x >> 4U);
114 if (t != 0U) {
115 n += 4U;
116 x = t;
117 }
118 return n + log2LUT[x];
119}
120#endif // ndef QF_LOG2
121
122} // namespace QP
123//$enddef${QF::types::QF_LOG2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
124#ifndef Q_UNSAFE
125//$define${QF::types::QPtrDis} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
126namespace QP {
127
128//${QF::types::QPtrDis} ......................................................
129
130//${QF::types::QPtrDis::QPtrDis} .............................................
131QPtrDis::QPtrDis(void const * const ptr) noexcept
132 : m_ptr_dis(static_cast<std::uintptr_t>(~Q_PTR2UINT_CAST_(ptr)))
133{}
134
135} // namespace QP
136//$enddef${QF::types::QPtrDis} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
137#endif
static QActive * registry_[QF_MAX_ACTIVE+1U]
Definition qp.hpp:725
Private attributes of the QF framework.
Definition qp_pkg.hpp:43
QPtrDis(void const *const ptr=nullptr) noexcept
Definition qf_act.cpp:131
QF Active Object Framework namespace.
void bzero_(void *const start, std::uint_fast16_t const len) noexcept
Definition qf_act.cpp:72
QF::Attr priv_
Definition qf_act.cpp:69
QP/C++ framework.
Definition qequeue.hpp:42
std::uint_fast8_t QF_LOG2(QP::QPSetBits x) noexcept
Definition qf_act.cpp:91
std::uint32_t QPSetBits
Definition qp.hpp:563
#define QF_MAX_ACTIVE
Maximum # Active Objects in the system (1..64)
Internal (package scope) QP/C++ interface.
#define Q_PTR2UINT_CAST_(ptr_)
Internal helper macro to cast pointers to integers.
Definition qp_pkg.hpp:72
Sample QP/C++ port.
QS/C++ port to a 32-bit CPU, generic C++ compiler.
QP Functional Safety (FuSa) Subsystem.