QP/C  8.0.3
Real-Time Event Framework
Loading...
Searching...
No Matches
qpc.h
Go to the documentation of this file.
1//============================================================================
2// QP/C Real-Time Event Framework (RTEF)
3//
4// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
5//
6// Q u a n t u m L e a P s
7// ------------------------
8// Modern Embedded Software
9//
10// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
11//
12// This software is dual-licensed under the terms of the open-source GNU
13// General Public License (GPL) or under the terms of one of the closed-
14// source Quantum Leaps commercial licenses.
15//
16// Redistributions in source code must retain this top-level comment block.
17// Plagiarizing this software to sidestep the license obligations is illegal.
18//
19// NOTE:
20// The GPL does NOT permit the incorporation of this code into proprietary
21// programs. Please contact Quantum Leaps for commercial licensing options,
22// which expressly supersede the GPL and are designed explicitly for
23// closed-source distribution.
24//
25// Quantum Leaps contact information:
26// <www.state-machine.com/licensing>
27// <info@state-machine.com>
28//============================================================================
29#ifndef QPC_H_
30#define QPC_H_
31
32#include "qp_port.h" // QP port from the port directory
33#include "qsafe.h" // QP Functional Safety (FuSa) Subsystem
34#ifdef Q_SPY // software tracing enabled?
35 #include "qs_port.h" // QS/C port from the port directory
36#else
37 #include "qs_dummy.h" // QS/C dummy interface (inactive)
38#endif
39
40#ifndef QP_API_VERSION
41 #define QP_API_VERSION 0
42#endif // #ifndef QP_API_VERSION
43
44// QP API compatibility layer...
45//============================================================================
46#if (QP_API_VERSION < 800)
47
48#define QM_SUPER_SUB(host_) error "submachines no longer supported"
49#define QM_TRAN_EP(tatbl_) error "submachines no longer supported"
50#define QM_TRAN_XP(xp_, tatbl_) error "submachines no longer supported"
51
52#ifdef QEVT_DYN_CTOR
53//! @deprecated #QEVT_DYN_CTOR, please use #QEVT_PAR_INIT
54#define QEVT_PAR_INIT
55#endif
56
57//! @deprecated plain 'char' is no longer forbidden in MISRA-C:2023
58typedef char char_t;
59
60//! @deprecated Macro for starting an Active Object.
61//! Use QActive::QActive_start() instead.
62#define QACTIVE_START(me_, prioSpec_, qSto_, qLen_, stkSto_, stkSize_, par_) \
63 (QActive_start((QActive *)(me_), (prioSpec_), \
64 (qSto_), (qLen_), (stkSto_), (stkSize_), (par_)))
65
66//! @deprecated Macro for starting an eXtended Thread.
67//! Use QXThread::QXThread_start() instead.
68#define QXTHREAD_START(me_, prioSpec_, qSto_, qLen_, stkSto_, stkSize_, par_) \
69 (QXThread_start((QXThread *)(me_), (prioSpec_), \
70 (qSto_), (qLen_), (stkSto_), (stkSize_), (par_)))
71
72//! @deprecated Assertion failure handler.
73//! Use Q_onError() instead.
74#define Q_onAssert(module_, id_) Q_onError(module_, id_)
75
76//! @deprecated #Q_NASSERT preprocessor switch to disable QP assertions
77#ifdef Q_NASSERT
78
79 // #Q_UNSAFE now replaces the functionality of Q_NASSERT
80 #define Q_UNSAFE
81
82 //! @deprecated general purpose assertion with user-specified ID
83 //! number that **always** evaluates the `expr_` expression.
84 #define Q_ALLEGE_ID(id_, expr_) ((void)(expr_))
85
86#elif defined Q_UNSAFE
87
88 //! @deprecated general purpose assertion with user-specified ID
89 //! number that **always** evaluates the `expr_` expression.
90 #define Q_ALLEGE_ID(id_, expr_) ((void)(expr_))
91
92#else // QP FuSa Subsystem enabled
93
94 //! @deprecated general purpose assertion with user-specified ID
95 //! number that **always** evaluates the `expr_` expression.
96 //! @note
97 //! The use of this macro is no longer recommended.
98 #define Q_ALLEGE_ID(id_, expr_) if (!(expr_)) { \
99 QF_CRIT_STAT \
100 QF_CRIT_ENTRY(); \
101 Q_onError(&Q_this_module_[0], (id_)); \
102 QF_CRIT_EXIT(); \
103 } else ((void)0)
104
105#endif
106
107//! @deprecated general purpose assertion without ID number
108//! that **always** evaluates the `expr_` expression.
109//! Instead of ID number, this macro is based on the standard
110//! `__LINE__` macro.
111//!
112//! @note The use of this macro is no longer recommended.
113#define Q_ALLEGE(expr_) Q_ALLEGE_ID(__LINE__, (expr_))
114
115//! Static (compile-time) assertion.
116//! @deprecated
117//! Use Q_ASSERT_STATIC() or better yet `_Static_assert()` instead.
118#define Q_ASSERT_COMPILE(expr_) Q_ASSERT_STATIC(expr_)
119
120//! @static @public @memberof QF
121//! @deprecated
122static inline void QF_psInit(
123 QSubscrList * const subscrSto,
124 enum_t const maxSignal)
125{
126 QActive_psInit(subscrSto, maxSignal);
127}
128
129//! @deprecated instead use: QASM_INIT()
130#define QHSM_INIT(me_, par_, qsId_) QASM_INIT((me_), (par_), (qsId_))
131
132//! @deprecated instead use: QASM_DISPATCH()
133#define QHSM_DISPATCH(me_, e_, qsId_) QASM_DISPATCH((me_), (e_), (qsId_))
134
135//! @deprecated instead use: QASM_IS_IN()
136#define QHsm_isIn(me_, state_) QASM_IS_IN((QAsm *)(me_), (state_))
137
138#define QF_PUBLISH(e_, sender_) QACTIVE_PUBLISH((e_), (sender_))
139#define QF_TICK_X(tickRate_, sender_) QTIMEEVT_TICK_X((tickRate_), (sender_))
140#define QF_TICK(sender_) QTIMEEVT_TICK(sender_)
141
142//! @deprecated instead use: QActive::QActive_getQueueMin()
143#define QF_getQueueMin(prio_) (QActive_getQueueMin((prio_)))
144
145#endif // QP_API_VERSION < 800
146
147#endif // QPC_H_
static void QF_psInit(QSubscrList *const subscrSto, enum_t const maxSignal)
Definition qpc.h:122
int enum_t
Definition qp.h:92
Sample QP/C port.
char char_t
Definition qpc.h:58
QS/C dummy public interface.
Sample QS/C port.
QP Functional Safety (FuSa) Subsystem.
Subscriber List (for publish-subscribe)
Definition qp.h:495