1 /***************************************************************************//**
\r
3 * @brief EFM32 peripheral API "assert" implementation.
\r
7 * By default, EFM32 library assert usage is not included in order to reduce
\r
8 * footprint and processing overhead. Further, EFM32 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 EFM32 assert statements.
\r
12 * Below are available defines for controlling EFM32 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 EFM32 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 its own EFM32
\r
19 * assert handling routine (assertEFM()).
\r
21 * As indicated above, if none of the above defines are used, EFM32 assert
\r
22 * statements are not compiled.
\r
23 *******************************************************************************
\r
25 * <b>(C) Copyright 2014 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
52 #ifndef __SILICON_LABS_EM_ASSERT_H_
\r
53 #define __SILICON_LABS_EM_ASSERT_H_
\r
59 /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
\r
61 #if defined(DEBUG_EFM) || defined(DEBUG_EFM_USER)
\r
63 /* Due to footprint considerations, we only pass file name and line number, */
\r
64 /* not the assert expression (nor function name (C99)) */
\r
65 void assertEFM(const char *file, int line);
\r
66 #define EFM_ASSERT(expr) ((expr) ? ((void)0) : assertEFM(__FILE__, __LINE__))
\r
70 #define EFM_ASSERT(expr) ((void)(expr))
\r
72 #endif /* defined(DEBUG_EFM) || defined(DEBUG_EFM_USER) */
\r
80 #endif /* __SILICON_LABS_EM_ASSERT_H_ */
\r