QP/C  8.0.0
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qf_act.c
Go to the documentation of this file.
1//$file${src::qf::qf_act.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2//
3// Model: qpc.qm
4// File: ${src::qf::qf_act.c}
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 GNU
18// 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.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35#define QP_IMPL // this is QP implementation
36#include "qp_port.h" // QP port
37#include "qp_pkg.h" // 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.h" // QS port
41 #include "qs_pkg.h" // QS facilities for pre-defined trace records
42#else
43 #include "qs_dummy.h" // disable the QS software tracing
44#endif // Q_SPY
45
46//Q_DEFINE_THIS_MODULE("qf_act")
47
48//$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
49// Check for the minimum required QP version
50#if (QP_VERSION < 730U) || (QP_VERSION != ((QP_RELEASE^4294967295U)%0x2710U))
51#error qpc version 7.3.0 or higher required
52#endif
53//$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54//$define${QF::QActive::registry_[QF_MAX_ACTIVE + 1U]} vvvvvvvvvvvvvvvvvvvvvvv
55//! @static @private @memberof QActive
56QActive * QActive_registry_[QF_MAX_ACTIVE + 1U];
57//$enddef${QF::QActive::registry_[QF_MAX_ACTIVE + 1U]} ^^^^^^^^^^^^^^^^^^^^^^^
58
59//$define${QF::QF-pkg} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
60
61//${QF::QF-pkg::priv_} .......................................................
63
64//${QF::QF-pkg::bzero_} ......................................................
65//! @static @private @memberof QF
66void QF_bzero_(
67 void * const start,
68 uint_fast16_t const len)
69{
70 uint8_t *ptr = (uint8_t *)start;
71 for (uint_fast16_t n = len; n > 0U; --n) {
72 *ptr = 0U;
73 ++ptr;
74 }
75}
76//$enddef${QF::QF-pkg} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
77
78//$define${QF::types::QF_LOG2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
79
80//${QF::types::QF_LOG2} ......................................................
81#ifndef QF_LOG2
82uint_fast8_t QF_LOG2(QPSetBits const bitmask) {
83 static uint8_t const log2LUT[16] = {
84 0U, 1U, 2U, 2U, 3U, 3U, 3U, 3U,
85 4U, 4U, 4U, 4U, 4U, 4U, 4U, 4U
86 };
87 uint_fast8_t n = 0U;
88 QPSetBits tmp;
89 QPSetBits x = bitmask;
90
91 #if (QF_MAX_ACTIVE > 16U)
92 tmp = (x >> 16U);
93 if (tmp != 0U) {
94 n += 16U;
95 x = tmp;
96 }
97 #endif
98 #if (QF_MAX_ACTIVE > 8U)
99 tmp = (x >> 8U);
100 if (tmp != 0U) {
101 n += 8U;
102 x = tmp;
103 }
104 #endif
105 tmp = (x >> 4U);
106 if (tmp != 0U) {
107 n += 4U;
108 x = tmp;
109 }
110 return n + log2LUT[x];
111}
112#endif // ndef QF_LOG2
113//$enddef${QF::types::QF_LOG2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
QF_Attr QF_priv_
Definition qf_act.c:62
uint_fast8_t QF_LOG2(QPSetBits const bitmask)
Log-base-2 calculation when hardware acceleration is NOT provided (QF_LOG2 not defined)
Definition qf_act.c:82
uint32_t QPSetBits
Bitmask for the internal representation of QPSet elements.
Definition qp.h:624
#define QF_MAX_ACTIVE
Maximum # Active Objects in the system (1..64)
Definition qp_config.h:123
Internal (package scope) QP/C interface.
Sample QP/C port.
Sample QS/C port.
QP Functional Safety (FuSa) Subsystem.
Active object class (based on the QHsm implementation strategy)
Definition qp.h:779
Private attributes of the QF framework.
Definition qp_pkg.h:42