qpcpp/include/qsafe.h
MMS 80d9bcd6fb 7.3.0
Added QP Functional Safety (FuSa) Subsystem
Memory Isolation with MPU
Added QAsm abstract state machine base class
Added memory marker to QEvt and rearranged memory layout
Updated: QP-FreeRTOS, QP-ESP-IDF,QP-Zephyr
Added drift-free ticking for QP-POSIX
Reorganized documentation
Updated 3rd_party
2023-09-14 17:11:45 -04:00

182 lines
6.4 KiB
C

//$file${include::qsafe.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//
// Model: qpc.qm
// File: ${include::qsafe.h}
//
// This code has been generated by QM 5.3.0 <www.state-machine.com/qm>.
// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
//
// This code is covered by the following QP license:
// License # : LicenseRef-QL-dual
// Issued to : Any user of the QP/C real-time embedded framework
// Framework(s) : qpc
// Support ends : 2024-12-31
// License scope:
//
// Copyright (C) 2005 Quantum Leaps, LLC <state-machine.com>.
//
// Q u a n t u m L e a P s
// ------------------------
// Modern Embedded Software
//
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
//
// This software is dual-licensed under the terms of the open source GNU
// General Public License version 3 (or any later version), or alternatively,
// under the terms of one of the closed source Quantum Leaps commercial
// licenses.
//
// The terms of the open source GNU General Public License version 3
// can be found at: <www.gnu.org/licenses/gpl-3.0>
//
// The terms of the closed source Quantum Leaps commercial licenses
// can be found at: <www.state-machine.com/licensing>
//
// Redistributions in source code must retain this top-level comment block.
// Plagiarizing this software to sidestep the license obligations is illegal.
//
// Contact information:
// <www.state-machine.com/licensing>
// <info@state-machine.com>
//
//$endhead${include::qsafe.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#ifndef QSAFE_H_
#define QSAFE_H_
#ifdef __cplusplus
extern "C" {
#endif
// QF-FuSa enabled ===========================================================
#ifndef Q_UNSAFE
#ifndef QF_CRIT_STAT
#define QF_CRIT_STAT
#endif
#ifndef QF_CRIT_ENTRY
#define QF_CRIT_ENTRY() ((void)0)
#endif
#ifndef QF_CRIT_EXIT
#define QF_CRIT_EXIT() ((void)0)
#endif
//$declare${QP-FuSa::enabled} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//${QP-FuSa::enabled::Q_DEFINE_THIS_MODULE} ..................................
#define Q_DEFINE_THIS_MODULE(name_) \
static char const Q_this_module_[] = name_;
//${QP-FuSa::enabled::Q_ASSERT_INCRIT} .......................................
#define Q_ASSERT_INCRIT(id_, expr_) \
((expr_) ? ((void)0) : Q_onError(&Q_this_module_[0], (id_)))
//${QP-FuSa::enabled::Q_ERROR_INCRIT} ........................................
#define Q_ERROR_INCRIT(id_) \
(Q_onError(&Q_this_module_[0], (id_)))
//${QP-FuSa::enabled::Q_ASSERT_ID} ...........................................
#define Q_ASSERT_ID(id_, expr_) do { \
QF_CRIT_STAT \
QF_CRIT_ENTRY(); \
(expr_) ? ((void)0) : Q_onError(&Q_this_module_[0], (id_)); \
QF_CRIT_EXIT(); \
} while (false)
//${QP-FuSa::enabled::Q_ERROR_ID} ............................................
#define Q_ERROR_ID(id_) do { \
QF_CRIT_STAT \
QF_CRIT_ENTRY(); \
Q_onError(&Q_this_module_[0], (id_)); \
QF_CRIT_EXIT(); \
} while (false)
//$enddecl${QP-FuSa::enabled} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// QF-FuSa disabled ==========================================================
#else
//$declare${QP-FuSa::disabled} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//${QP-FuSa::disabled::Q_DEFINE_THIS_MODULE} .................................
#define Q_DEFINE_THIS_MODULE(name_)
//${QP-FuSa::disabled::Q_ASSERT_INCRIT} ......................................
#define Q_ASSERT_INCRIT(id_, expr_) ((void)0)
//${QP-FuSa::disabled::Q_ERROR_INCRIT} .......................................
#define Q_ERROR_INCRIT(id_) ((void)0)
//${QP-FuSa::disabled::Q_ASSERT_ID} ..........................................
#define Q_ASSERT_ID(id_, expr_) ((void)0)
//${QP-FuSa::disabled::Q_ERROR_ID} ...........................................
#define Q_ERROR_ID(id_) ((void)0)
//$enddecl${QP-FuSa::disabled} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#endif
//============================================================================
//$declare1${QP-FuSa} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//${QP-FuSa::Q_DEFINE_THIS_FILE} .............................................
#define Q_DEFINE_THIS_FILE Q_DEFINE_THIS_MODULE(__FILE__)
//${QP-FuSa::Q_ASSERT} .......................................................
#define Q_ASSERT(expr_) Q_ASSERT_ID(__LINE__, (expr_))
//${QP-FuSa::Q_ERROR} ........................................................
#define Q_ERROR() Q_ERROR_ID(__LINE__)
//${QP-FuSa::Q_REQUIRE_ID} ...................................................
#define Q_REQUIRE_ID(id_, expr_) Q_ASSERT_ID((id_), (expr_))
//${QP-FuSa::Q_REQUIRE} ......................................................
#define Q_REQUIRE(expr_) Q_ASSERT(expr_)
//${QP-FuSa::Q_REQUIRE_INCRIT} ...............................................
#define Q_REQUIRE_INCRIT(id_, expr_) Q_ASSERT_INCRIT((id_), (expr_))
//${QP-FuSa::Q_ENSURE_ID} ....................................................
#define Q_ENSURE_ID(id_, expr_) Q_ASSERT_ID((id_), (expr_))
//${QP-FuSa::Q_ENSURE} .......................................................
#define Q_ENSURE(expr_) Q_ASSERT(expr_)
//${QP-FuSa::Q_ENSURE_INCRIT} ................................................
#define Q_ENSURE_INCRIT(id_, expr_) Q_ASSERT_INCRIT((id_), (expr_))
//${QP-FuSa::Q_INVARIANT_ID} .................................................
#define Q_INVARIANT_ID(id_, expr_) Q_ASSERT_ID((id_), (expr_))
//${QP-FuSa::Q_INVARIANT} ....................................................
#define Q_INVARIANT(expr_) Q_ASSERT(expr_)
//${QP-FuSa::Q_ASSERT_STATIC} ................................................
#define Q_ASSERT_STATIC(expr_) extern char Q_static_assert_[(expr_) ? 1 : -1]
//${QP-FuSa::Q_NORETURN} .....................................................
#ifndef Q_NORETURN
#define Q_NORETURN _Noreturn void
#endif // ndef Q_NORETURN
//${QP-FuSa::int_t} ..........................................................
#ifndef QP_VERSION
typedef int int_t;
#endif // ndef QP_VERSION
//${QP-FuSa::Q_onError} ......................................................
Q_NORETURN Q_onError(
char const * const module,
int_t const id);
//${QP-FuSa::Q_DIM} ..........................................................
#ifndef QP_VERSION
#define Q_DIM(array_) (sizeof(array_) / sizeof((array_)[0U]))
#endif // ndef QP_VERSION
//$enddecl${QP-FuSa} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#ifdef __cplusplus
}
#endif
#endif // QSAFE_H_