QP Functional Safety (FuSa) Subsystem. More...
Go to the source code of this file.
Macros | |
#define | QF_CRIT_STAT |
#define | QF_CRIT_ENTRY() |
#define | QF_CRIT_EXIT() |
#define | Q_ASSERT_INCRIT(id_, expr_) |
#define | Q_ERROR_INCRIT(id_) |
#define | Q_ASSERT_ID(id_, expr_) |
#define | Q_ERROR_ID(id_) |
#define | Q_ASSERT(expr_) |
#define | Q_ERROR() |
#define | Q_REQUIRE_ID(id_, expr_) |
#define | Q_REQUIRE(expr_) |
#define | Q_REQUIRE_INCRIT(id_, expr_) |
#define | Q_ENSURE_ID(id_, expr_) |
#define | Q_ENSURE(expr_) |
#define | Q_ENSURE_INCRIT(id_, expr_) |
#define | Q_INVARIANT_ID(id_, expr_) |
#define | Q_INVARIANT(expr_) |
#define | Q_INVARIANT_INCRIT(id_, expr_) |
#define | Q_ASSERT_STATIC(expr_) |
#define | Q_NORETURN _Noreturn void |
#define | Q_DIM(array_) |
Functions | |
Q_NORETURN | Q_onError (char const *const module, int_t const id) |
QP Functional Safety (FuSa) Subsystem.
This header file is part of the QP Functional Safety (FuSa) Subsystem and contains the following facilities:
Definition in file qsafe.h.
#define Q_ASSERT_INCRIT | ( | id_, | |
expr_ ) |
General-purpose assertion with user-specified ID number (in critical section)
[in] | id_ | ID number (unique within the module) of the assertion |
[in] | expr_ | Boolean expression to check |
expr_
as well as calling of Q_onError() happens inside that critical section.expr_
) must be possibly simple, have no side effects, and quick to evaluate because the evaluation happens inside a critical section. Also, the expression must NOT call any functions that might use critical sections inside (because this would cause nesting of critical sections, which might not be supported).Backward Traceability
#define Q_ERROR_INCRIT | ( | id_ | ) |
Assertion with user-specified ID for a wrong path through the code (in critical section)
[in] | id_ | ID number (unique within the module) of the assertion |
Backward Traceability
#define Q_ASSERT_ID | ( | id_, | |
expr_ ) |
General-purpose assertion with user-specified ID number.
Evaluates the Boolean expression expr_
and does nothing else when it evaluates to 'true'. However, when expr_
evaluates to 'false', the Q_ASSERT_ID() macro calls the no-return function Q_onError().
[in] | id_ | ID number (unique within the module) of the assertion |
[in] | expr_ | Boolean expression to check |
expr_
as well as calling of Q_onError() happens inside the critical section.expr_
) must be possibly simple, have no side effects, and quick to evaluate because the evaluation happens inside a critical section. Also, the expression must NOT call any functions that might use critical sections inside (because this would cause nesting of critical sections, which might not be supported).Backward Traceability
#define Q_ERROR_ID | ( | id_ | ) |
Assertion with user-specified ID for a wrong path through the code
Calls the Q_onError() callback if ever executed. This assertion takes the user-supplied parameter id_
to identify the location of this assertion within the file. This avoids the volatility of using line numbers, which change whenever a line of code is added or removed upstream from the assertion.
[in] | id_ | ID number (unique within the module) of the assertion |
Backward Traceability
#define Q_ASSERT | ( | expr_ | ) |
General-purpose assertion (with LINE used as location in the file)
Equivalent to Q_ASSERT_ID(), except it uses LINE to identify the assertion within a file.
[in] | expr_ | Boolean expression to check |
Backward Traceability
#define Q_ERROR | ( | ) |
Assertion for a wrong path through the code
Calls the Q_onError() callback if ever executed.
Backward Traceability
#define Q_REQUIRE_ID | ( | id_, | |
expr_ ) |
Assertion for checking preconditions (with user-specified ID number).
Equivalent to Q_ASSERT_ID(), except the name provides a better documentation of the intention of this assertion.
[in] | id_ | ID number (unique within the module) of the assertion |
[in] | expr_ | Boolean expression |
Backward Traceability
#define Q_REQUIRE | ( | expr_ | ) |
Assertion for checking preconditions (based on LINE).
Equivalent to Q_ASSERT(), except the name provides a better documentation of the intention of this assertion.
[in] | expr_ | Boolean expression |
Backward Traceability
#define Q_REQUIRE_INCRIT | ( | id_, | |
expr_ ) |
Assertion for checking preconditions (in critical section)
Equivalent to Q_ASSERT_INCRIT(), except the name provides a better documentation of the intention of this assertion.
[in] | id_ | ID number (unique within the module) of the assertion |
[in] | expr_ | Boolean expression |
Backward Traceability
#define Q_ENSURE_ID | ( | id_, | |
expr_ ) |
Assertion for checking postconditions (with user-specified ID number).
Equivalent to Q_ASSERT_ID(), except the name provides a better documentation of the intention of this assertion.
[in] | id_ | ID number (unique within the module) of the assertion |
[in] | expr_ | Boolean expression |
#define Q_ENSURE | ( | expr_ | ) |
Assertion for checking postconditions.
Equivalent to Q_ASSERT(), except the name provides a better documentation of the intention of this assertion.
[in] | expr_ | Boolean expression |
Backward Traceability
#define Q_ENSURE_INCRIT | ( | id_, | |
expr_ ) |
Assertion for checking postconditions (in critical section)
Equivalent to Q_ASSERT_INCRIT(), except the name provides a better documentation of the intention of this assertion.
[in] | id_ | ID number (unique within the module) of the assertion |
[in] | expr_ | Boolean expression |
Backward Traceability
#define Q_INVARIANT_ID | ( | id_, | |
expr_ ) |
Assertion for checking invariants (with user-specified ID number).
Equivalent to Q_ASSERT_ID(), except the name provides a better documentation of the intention of this assertion.
[in] | id_ | ID number (unique within the module) of the assertion |
[in] | expr_ | Boolean expression |
Backward Traceability
#define Q_INVARIANT | ( | expr_ | ) |
Assertion for checking invariants.
Equivalent to Q_ASSERT(), except the name provides a better documentation of the intention of this assertion.
[in] | expr_ | Boolean expression |
Backward Traceability
#define Q_INVARIANT_INCRIT | ( | id_, | |
expr_ ) |
#define Q_ASSERT_STATIC | ( | expr_ | ) |
Static (compile-time) assertion.
This type of assertion deliberately causes a compile-time error when the expr_
Boolean expression evaluates to FALSE. The macro exploits the fact that in C/C++ a dimension of an array cannot be negative. The compile-time assertion has no runtime side effects.
[in] | expr_ | Compile-time Boolean expression |
_Static_assert()
, which should be used instead of Q_ASSERT_STATIC().Backward Traceability
#define Q_DIM | ( | array_ | ) |
Q_NORETURN Q_onError | ( | char const *const | module, |
int_t const | id ) |
Callback function invoked after detecting an error (part of QP Functional Safety (FuSa) Subsystem).
This callback function needs to be defined in the application to perform any corrective action after an unrecoverable error has been detected. The Q_onError() function is the last line of defense after the system failure and its implementation should be very carefully designed and tested under various fault conditions, including but not limited to: stack overflow/corruption, calling Q_onError() from an ISR or other hardware exception, etc.
[in] | module | name of the file/module in which the assertion failed (constant, zero-terminated C string) |
[in] | id | ID of the assertion within the module. This could be a line number or a user-specified ID-number. |
Called by the following: Q_ASSERT_ID(), Q_ERROR_ID(), Q_REQUIRE_ID(), Q_ENSURE_ID(), Q_INVARIANT_ID() as well as: Q_ASSERT(), Q_ERROR(), Q_REQUIRE(), Q_ENSURE(), and Q_INVARIANT().