FLEX-FORD-OBC-BM/Source/bsw/Fbl/fbl_assert.h

130 lines
7.5 KiB
C

/***********************************************************************************************************************
* FILE DESCRIPTION
* ------------------------------------------------------------------------------------------------------------------*/
/** \file
* \brief System specific assertion defines
*
* --------------------------------------------------------------------------------------------------------------------
* COPYRIGHT
* --------------------------------------------------------------------------------------------------------------------
* \par Copyright
* \verbatim
* Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved.
*
* This software is copyright protected and proprietary to Vector Informatik GmbH.
* Vector Informatik GmbH grants to you only those rights as set out in the license conditions.
* All other rights remain with Vector Informatik GmbH.
* \endverbatim
*/
/**********************************************************************************************************************/
/***********************************************************************************************************************
* REVISION HISTORY
* --------------------------------------------------------------------------------------------------------------------
* Version Date Author Change Id Description
* --------------------------------------------------------------------------------------------------------------------
* 04.00.00 2016-02-26 visach ESCAN00088307 Rework to support FblMain 3.xx
* ESCAN00088433 Moved assertion specific code to fbl_assert.h
* 04.00.01 2016-07-15 visdlm ESCAN00091011 No changes
* 04.01.00 2016-08-18 vistns ESCAN00091531 No changes
* 04.02.00 2016-10-31 viscb ESCAN00092597 No changes
* 04.02.01 2017-05-09 visjhg ESCAN00095090 No changes
* visrie ESCAN00095204 Added assertion defines for DET
* 04.03.00 2017-07-28 viscb ESCAN00095458 No changes
* visach ESCAN00096096 No changes
* 04.04.00 2018-02-26 visdkl ESCAN00098503 No changes
* 04.04.01 2018-07-06 visdkl ESCAN00099860 No changes
* 04.04.01 2018-07-06 visdkl ESCAN00099860 No changes
* 04.05.00 2018-09-13 visrie ESCAN00100731 No changes
* 2018-11-20 visdkl ESCAN00101393 No changes
* 04.06.00 2019-12-03 visjdn FBL-999 No changes
* 05.00.00 2020-03-02 vistbe FBL-949 No changes
* ESCAN00105231 No changes
* 05.01.00 2020-04-29 vistmo FBL-1584 No changes
* 05.02.00 2020-05-08 visrie FBL-1414 No changes
* 05.03.00 2020-07-16 visrie FBL-2021 No changes
* 05.04.00 2024-05-03 visrie FBL-8515 No changes
* ESCAN00117096 No changes
* 05.05.00 2025-10-03 pharring FBL-10242 Add support for logger
* 05.06.00 2025-10-22 mpatil FBL-11533 Logical Block Meta data information is not indexed correctly
* in OTA usecase
**********************************************************************************************************************/
#ifndef FBL_ASSERT_H
#define FBL_ASSERT_H
/***********************************************************************************************************************
* DEFINITION OF ASSERTION CODES (SYSTEM)
**********************************************************************************************************************/
/* Note: System assertions are only allowed in the range from 0x00-0x7F. Others are reserved. */
#if defined( FBL_ENABLE_ASSERTION )
/* 0x00-0x1F: General FBL assertions */
# define kFblSysAssertMissingForcedRCRRP 0x00u
# define kFblSysAssertInitializationFailed 0x10u
/* 0x20-0x3F: Internal assertions */
# define kFblSysAssertServiceReqBeforeResp 0x20u
# define kFblSysAssertServiceMainHandlerInvalid 0x21u
# define kFblSysAssertDet 0x22u
/* 0x40-0x4F: Generated data assertions */
# define kFblSysAssertWdBufferOverflow 0x40u
/* 0x50-0x6F: User parameter assertions */
# define kFblSysAssertParameterOutOfRange 0x50u
# define kFblAssertIllegalReturnValue 0x51u
# define kFblSysAssertRepeatedCallOnConcludedService 0x60u
/* 0x70-0x7F: Communication wrapper assertions */
# define kFblSysAssertStateNotIdle 0x70u
# define kFblSysAssertNoBufferAvailable 0x71u
/* 0x80-0xFF: OEM specific */
# include "fbl_assert_oem.h"
# if defined( __LINE__ ) && defined( __FILE__ ) && defined( FBL_ENABLE_ASSERTION_EXTENDED_INFO )
# define FBL_DECL_ASSERT_EXTENDED_INFO(n) const vuint8* module, vuint16 line, n
# define FBL_USED_ASSERT_EXTENDED_INFO(n) __FILE__, __LINE__,(n)
# else
# define FBL_DECL_ASSERT_EXTENDED_INFO(n) n /* PRQA S 3410 */ /* MD_FblAssert_3410 */
# define FBL_USED_ASSERT_EXTENDED_INFO(n) (n) /* PRQA S 3453 */ /* MD_MSR_19.7 */
# endif /* __LINE__ && __FILE__ && FBL_ENABLE_ASSERTION_EXTENDED_INFO */
#endif /* FBL_ENABLE_ASSERTION || FBL_ENABLE_LOGGER */
/* No statement should be added to below if clauses, in order to prevent errors suggested by Misra rule 14.9 */
/* PRQA S 3412 4 */ /* MD_FblAssert_Assertion */
#if defined( FBL_ENABLE_ASSERTION )
# define assertFbl(p, e) if (!(p)) ApplFblFatalError(FBL_USED_ASSERT_EXTENDED_INFO(e)) /* PRQA S 2214 */ /* MD_FblAssert_Assertion */
# define assertFblUser(p, e) if (!(p)) ApplFblFatalError(FBL_USED_ASSERT_EXTENDED_INFO(e)) /* PRQA S 2214 */ /* MD_FblAssert_Assertion */
# define assertFblGen(p, e) if (!(p)) ApplFblFatalError(FBL_USED_ASSERT_EXTENDED_INFO(e)) /* PRQA S 2214 */ /* MD_FblAssert_Assertion */
# define assertFblInternal(p, e) if (!(p)) ApplFblFatalError(FBL_USED_ASSERT_EXTENDED_INFO(e)) /* PRQA S 2214 */ /* MD_FblAssert_Assertion */
#else
# define assertFbl(p, e)
# define assertFblUser(p, e)
# define assertFblGen(p, e)
# define assertFblInternal(p, e)
#endif /* FBL_ENABLE_ASSERTION */
/* Module specific MISRA deviations:
MD_FblAssert_Assertion:
Reason: This is an assertion macro used only for debugging in development (FBL_ENABLE_ASSERTION). There should
be no need to extend the amount of statements, so the current usage is accepted.
Risk: Unintended debugging code behavior could result, through adding further statements,
Prevention: A comment is in place to avoid that further statements are added to the if condition.
MD_FblAssert_3410:
Reason: This macro serves as function parameter type qualifier and cannot have parentheses, because this would
result in an invalid function parameter list.
Risk: Usage at not intended places and unintended code behavior due to the missing parentheses.
Prevention: Reviews must ensure that this macro is only used in function parameter lists.
*/
#endif /* FBL_ASSERT_H */
/***********************************************************************************************************************
* END OF FILE: FBL_ASSERT.H
**********************************************************************************************************************/