1 /***************************************************************************//**
\r
3 * @brief Emlib peripheral API "assert" implementation.
\r
7 * By default, emlib library assert usage is not included in order to reduce
\r
8 * footprint and processing overhead. Further, emlib assert usage is decoupled
\r
9 * from ISO C assert handling (NDEBUG usage), to allow a user to use ISO C
\r
10 * assert without including emlib assert statements.
\r
12 * Below are available defines for controlling emlib assert inclusion. The defines
\r
13 * are typically defined for a project to be used by the preprocessor.
\r
15 * @li If DEBUG_EFM is defined, the internal emlib library assert handling will
\r
16 * be used, which may be a quite rudimentary implementation.
\r
18 * @li If DEBUG_EFM_USER is defined instead, the user must provide their own
\r
19 * assert handling routine (assertEFM()).
\r
21 * As indicated above, if none of the above defines are used, emlib assert
\r
22 * statements are not compiled.
\r
23 *******************************************************************************
\r
25 * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
\r
26 *******************************************************************************
\r
28 * Permission is granted to anyone to use this software for any purpose,
\r
29 * including commercial applications, and to alter it and redistribute it
\r
30 * freely, subject to the following restrictions:
\r
32 * 1. The origin of this software must not be misrepresented; you must not
\r
33 * claim that you wrote the original software.
\r
34 * 2. Altered source versions must be plainly marked as such, and must not be
\r
35 * misrepresented as being the original software.
\r
36 * 3. This notice may not be removed or altered from any source distribution.
\r
38 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
\r
39 * obligation to support this Software. Silicon Labs is providing the
\r
40 * Software "AS IS", with no express or implied warranties of any kind,
\r
41 * including, but not limited to, any implied warranties of merchantability
\r
42 * or fitness for any particular purpose or warranties against infringement
\r
43 * of any proprietary rights of a third party.
\r
45 * Silicon Labs will not be liable for any consequential, incidental, or
\r
46 * special damages, or any other relief, or for any claim by any third party,
\r
47 * arising from your use of this Software.
\r
49 ******************************************************************************/
\r
51 #ifndef __SILICON_LABS_EM_ASSERT_H__
\r
52 #define __SILICON_LABS_EM_ASSERT_H__
\r
58 /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
\r
60 #if defined(DEBUG_EFM) || defined(DEBUG_EFM_USER)
\r
62 /* Due to footprint considerations, we only pass file name and line number, */
\r
63 /* not the assert expression (nor function name (C99)) */
\r
64 void assertEFM(const char *file, int line);
\r
65 #define EFM_ASSERT(expr) ((expr) ? ((void)0) : assertEFM(__FILE__, __LINE__))
\r
69 #define EFM_ASSERT(expr) ((void)(expr))
\r
71 #endif /* defined(DEBUG_EFM) || defined(DEBUG_EFM_USER) */
\r
79 #endif /* __SILICON_LABS_EM_ASSERT_H__ */
\r