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