hpw422移植新的sdk
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
/*!
|
||||
* \file hal_assert.h
|
||||
*
|
||||
* \brief The header of hal_assert.c
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
#ifndef HAL_ASSERT_H
|
||||
#define HAL_ASSERT_H
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Macros
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* HAL_ASSERT( expression ) - The given expression must evaluate as "true" or else the assert
|
||||
* handler is called. From here, the call stack feature of the debugger can pinpoint where
|
||||
* the problem occurred.
|
||||
*
|
||||
* HAL_ASSERT_FORCED( ) - If asserts are in use, immediately calls the assert handler.
|
||||
*
|
||||
* HAL_ASSERT_STATEMENT( statement ) - Inserts the given C statement but only when asserts
|
||||
* are in use. This macros allows debug code that is not part of an expression.
|
||||
*
|
||||
* HAL_ASSERT_DECLARATION( declaration ) - Inserts the given C declaration but only when asserts
|
||||
* are in use. This macros allows debug code that is not part of an expression.
|
||||
*
|
||||
* Asserts can be disabled for optimum performance and minimum code size (ideal for
|
||||
* finalized, debugged production code). To disable, define the preprocessor
|
||||
* symbol HALNODEBUG at the project level.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HALNODEBUG
|
||||
#define HAL_ASSERT(expr)
|
||||
#define HAL_ASSERT_FORCED()
|
||||
#define HAL_ASSERT_STATEMENT(statement)
|
||||
#define HAL_ASSERT_DECLARATION(declaration)
|
||||
#else
|
||||
#define HAL_ASSERT(expr) st( if (!( expr )) halAssertHandler(); )
|
||||
#define HAL_ASSERT_FORCED() halAssertHandler()
|
||||
#define HAL_ASSERT_STATEMENT(statement) st( statement )
|
||||
#define HAL_ASSERT_DECLARATION(declaration) declaration
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* This macro compares the size of the first parameter to the integer value
|
||||
* of the second parameter. If they do not match, a compile time error for
|
||||
* negative array size occurs (even gnu chokes on negative array size).
|
||||
*
|
||||
* This compare is done by creating a typedef for an array. No variables are
|
||||
* created and no memory is consumed with this check. The created type is
|
||||
* used for checking only and is not for use by any other code. The value
|
||||
* of 10 in this macro is arbitrary, it just needs to be a value larger
|
||||
* than one to result in a positive number for the array size.
|
||||
*/
|
||||
#define HAL_ASSERT_SIZE(x,y) typedef char x ## _assert_size_t[-1+10*(sizeof(x) == (y))]
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Prototypes
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
void halAssertHandler(void);
|
||||
|
||||
|
||||
/**************************************************************************************************
|
||||
*/
|
||||
|
||||
/**************************************************************************************************
|
||||
* FUNCTIONS - API
|
||||
**************************************************************************************************/
|
||||
|
||||
|
||||
extern void halAssertHazardLights(void);
|
||||
#endif
|
||||
Reference in New Issue
Block a user