2025-01-18 18:33:40 -05:00
|
|
|
//============================================================================
|
|
|
|
// QP/C++ Real-Time Embedded Framework (RTEF)
|
|
|
|
// Version 8.0.2
|
2022-08-11 15:36:19 -04:00
|
|
|
//
|
2024-10-15 13:15:28 -04:00
|
|
|
// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
|
2022-04-19 19:23:30 -04:00
|
|
|
//
|
2023-01-19 21:14:02 -05:00
|
|
|
// Q u a n t u m L e a P s
|
|
|
|
// ------------------------
|
|
|
|
// Modern Embedded Software
|
|
|
|
//
|
2022-04-19 19:23:30 -04:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
|
|
|
|
//
|
2025-01-18 18:33:40 -05:00
|
|
|
// This software is dual-licensed under the terms of the open-source GNU
|
|
|
|
// General Public License (GPL) or under the terms of one of the closed-
|
2024-10-15 13:15:28 -04:00
|
|
|
// source Quantum Leaps commercial licenses.
|
2022-04-19 19:23:30 -04:00
|
|
|
//
|
|
|
|
// Redistributions in source code must retain this top-level comment block.
|
|
|
|
// Plagiarizing this software to sidestep the license obligations is illegal.
|
|
|
|
//
|
2024-10-15 13:15:28 -04:00
|
|
|
// NOTE:
|
|
|
|
// The GPL does NOT permit the incorporation of this code into proprietary
|
|
|
|
// programs. Please contact Quantum Leaps for commercial licensing options,
|
|
|
|
// which expressly supersede the GPL and are designed explicitly for
|
|
|
|
// closed-source distribution.
|
|
|
|
//
|
|
|
|
// Quantum Leaps contact information:
|
2022-08-11 15:36:19 -04:00
|
|
|
// <www.state-machine.com/licensing>
|
2022-04-19 19:23:30 -04:00
|
|
|
// <info@state-machine.com>
|
2025-01-18 18:33:40 -05:00
|
|
|
//============================================================================
|
2023-01-19 21:14:02 -05:00
|
|
|
#ifndef QPCPP_HPP_
|
|
|
|
#define QPCPP_HPP_
|
2019-10-27 12:26:31 -04:00
|
|
|
|
2022-04-19 19:23:30 -04:00
|
|
|
//============================================================================
|
2023-01-19 21:14:02 -05:00
|
|
|
#include "qp_port.hpp" // QP port from the port directory
|
|
|
|
#include "qsafe.h" // QP Functional Safety (FuSa) Subsystem
|
2020-03-17 21:33:58 -04:00
|
|
|
#ifdef Q_SPY // software tracing enabled?
|
|
|
|
#include "qs_port.hpp" // QS/C++ port from the port directory
|
|
|
|
#else
|
|
|
|
#include "qs_dummy.hpp" // QS/C++ dummy (inactive) interface
|
|
|
|
#endif
|
|
|
|
|
2022-04-19 19:23:30 -04:00
|
|
|
//============================================================================
|
2019-10-27 12:26:31 -04:00
|
|
|
#ifndef QP_API_VERSION
|
2024-10-15 13:15:28 -04:00
|
|
|
#define QP_API_VERSION 0
|
2025-01-18 18:33:40 -05:00
|
|
|
#endif // QP_API_VERSION
|
2019-10-27 12:26:31 -04:00
|
|
|
|
2024-10-15 13:15:28 -04:00
|
|
|
// QP API compatibility layer...
|
2023-01-19 21:14:02 -05:00
|
|
|
//============================================================================
|
2025-01-18 18:33:40 -05:00
|
|
|
#if (QP_API_VERSION < 800)
|
2020-03-17 21:33:58 -04:00
|
|
|
|
2024-10-15 13:15:28 -04:00
|
|
|
#define QM_SM_STATE_DECL(subm_, state_) error "submachines no longer supported"
|
|
|
|
#define qm_super_sub(sm_state_) error "submachines no longer supported"
|
|
|
|
#define qm_tran_ep(tatbl_) error "submachines no longer supported"
|
|
|
|
#define qm_tran_xp(xp_, tatbl_) error "submachines no longer supported"
|
|
|
|
#define qm_sm_exit(sm_state_) error "submachines no longer supported"
|
2024-06-07 16:07:22 -04:00
|
|
|
|
|
|
|
#ifdef QEVT_DYN_CTOR
|
|
|
|
//! @deprecated #QEVT_DYN_CTOR, please use #QEVT_PAR_INIT
|
|
|
|
#define QEVT_PAR_INIT
|
|
|
|
#endif
|
2022-09-22 11:13:20 -04:00
|
|
|
|
2025-01-18 18:33:40 -05:00
|
|
|
//! @deprecated plain 'char' is no longer forbidden in MISRA-C++:2023
|
2022-04-19 19:23:30 -04:00
|
|
|
using char_t = char;
|
|
|
|
|
2023-01-19 21:14:02 -05:00
|
|
|
//! @deprecated assertion failure handler
|
|
|
|
//! Use Q_onError() instead.
|
|
|
|
#define Q_onAssert(module_, id_) Q_onError(module_, id_)
|
|
|
|
|
|
|
|
//! @deprecated #Q_NASSERT preprocessor switch to disable QP assertions
|
|
|
|
#ifdef Q_NASSERT
|
|
|
|
|
|
|
|
// #Q_UNSAFE now replaces the functionality of Q_NASSERT
|
|
|
|
#define Q_UNSAFE
|
|
|
|
|
|
|
|
//! @deprecated general purpose assertion with user-specified ID
|
|
|
|
//! number that **always** evaluates the `expr_` expression.
|
2024-10-15 13:15:28 -04:00
|
|
|
#define Q_ALLEGE_ID(id_, expr_) (static_cast<void>(expr_))
|
|
|
|
|
|
|
|
#elif defined Q_UNSAFE
|
|
|
|
|
|
|
|
//! @deprecated general purpose assertion with user-specified ID
|
|
|
|
//! number that **always** evaluates the `expr_` expression.
|
|
|
|
#define Q_ALLEGE_ID(id_, expr_) (static_cast<void>(expr_))
|
2023-01-19 21:14:02 -05:00
|
|
|
|
|
|
|
#else // QP FuSa Subsystem enabled
|
|
|
|
|
|
|
|
//! @deprecated general purpose assertion with user-specified ID
|
|
|
|
//! number that **always** evaluates the `expr_` expression.
|
|
|
|
//! @note
|
|
|
|
//! The use of this macro is no longer recommended.
|
|
|
|
#define Q_ALLEGE_ID(id_, expr_) if (!(expr_)) { \
|
|
|
|
QF_CRIT_STAT \
|
|
|
|
QF_CRIT_ENTRY(); \
|
|
|
|
Q_onError(&Q_this_module_[0], (id_)); \
|
|
|
|
QF_CRIT_EXIT(); \
|
|
|
|
} else ((void)0)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//! @deprecated general purpose assertion without ID number
|
|
|
|
//! that **always** evaluates the `expr_` expression.
|
|
|
|
//! Instead of ID number, this macro is based on the standard
|
|
|
|
//! `__LINE__` macro.
|
|
|
|
//!
|
|
|
|
//! @note The use of this macro is no longer recommended.
|
|
|
|
#define Q_ALLEGE(expr_) Q_ALLEGE_ID(__LINE__, (expr_))
|
|
|
|
|
|
|
|
//! Static (compile-time) assertion.
|
|
|
|
//! @deprecated
|
|
|
|
//! Use Q_ASSERT_STATIC() or better yet `static_assert()` instead.
|
|
|
|
#define Q_ASSERT_COMPILE(expr_) Q_ASSERT_STATIC(expr_)
|
|
|
|
|
2020-10-01 12:50:17 -04:00
|
|
|
|
2025-01-18 18:33:40 -05:00
|
|
|
#endif // QP_API_VERSION < 800
|
2019-10-27 12:26:31 -04:00
|
|
|
|
2023-01-19 21:14:02 -05:00
|
|
|
#endif // QPCPP_HPP_
|