mbed
Fork of mbed-dev by
targets/TARGET_ONSEMI/TARGET_NCS36510/assert_onsemi.h@182:57724642e740, 2018-02-16 (annotated)
- Committer:
- AnnaBridge
- Date:
- Fri Feb 16 16:09:33 2018 +0000
- Revision:
- 182:57724642e740
- Parent:
- 149:156823d33999
mbed-dev library. Release version 159.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 149:156823d33999 | 1 | /** |
<> | 149:156823d33999 | 2 | ****************************************************************************** |
<> | 149:156823d33999 | 3 | * @file assert.h |
<> | 149:156823d33999 | 4 | * @brief Defines an assertion for debugging purposes. |
<> | 149:156823d33999 | 5 | * @internal |
<> | 149:156823d33999 | 6 | * @author ON Semiconductor |
<> | 149:156823d33999 | 7 | * $Rev: 3823 $ |
<> | 149:156823d33999 | 8 | * $Date: 2015-10-23 16:21:37 +0530 (Fri, 23 Oct 2015) $ |
<> | 149:156823d33999 | 9 | ****************************************************************************** |
<> | 149:156823d33999 | 10 | * Copyright 2016 Semiconductor Components Industries LLC (d/b/a ON Semiconductor). |
<> | 149:156823d33999 | 11 | * All rights reserved. This software and/or documentation is licensed by ON Semiconductor |
<> | 149:156823d33999 | 12 | * under limited terms and conditions. The terms and conditions pertaining to the software |
<> | 149:156823d33999 | 13 | * and/or documentation are available at http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf |
<> | 149:156823d33999 | 14 | * (ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software) and |
<> | 149:156823d33999 | 15 | * if applicable the software license agreement. Do not use this software and/or |
<> | 149:156823d33999 | 16 | * documentation unless you have carefully read and you agree to the limited terms and |
<> | 149:156823d33999 | 17 | * conditions. By using this software and/or documentation, you agree to the limited |
<> | 149:156823d33999 | 18 | * terms and conditions. |
<> | 149:156823d33999 | 19 | * |
<> | 149:156823d33999 | 20 | * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED |
<> | 149:156823d33999 | 21 | * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF |
<> | 149:156823d33999 | 22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. |
<> | 149:156823d33999 | 23 | * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, |
<> | 149:156823d33999 | 24 | * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
<> | 149:156823d33999 | 25 | * @endinternal |
<> | 149:156823d33999 | 26 | * |
<> | 149:156823d33999 | 27 | * @details |
<> | 149:156823d33999 | 28 | * While debugging, the ASSERT macro can be used to verify the expected behaviour |
<> | 149:156823d33999 | 29 | * of the source code. If the condition that is passed as a parameter to the ASSERT |
<> | 149:156823d33999 | 30 | * macro evaluates to False, execution stops. |
<> | 149:156823d33999 | 31 | * |
<> | 149:156823d33999 | 32 | * The user has the possibility to hook into the assertion through the assertCallback |
<> | 149:156823d33999 | 33 | * callback function. Note though that the callback function must not use any |
<> | 149:156823d33999 | 34 | * functionality of the RTOS, or rely on interrupts being called. Once the function |
<> | 149:156823d33999 | 35 | * returns, it's done. |
<> | 149:156823d33999 | 36 | * |
<> | 149:156823d33999 | 37 | * @ingroup debug |
<> | 149:156823d33999 | 38 | */ |
<> | 149:156823d33999 | 39 | |
<> | 149:156823d33999 | 40 | #ifndef ASSERT_H_ |
<> | 149:156823d33999 | 41 | #define ASSERT_H_ |
<> | 149:156823d33999 | 42 | |
<> | 149:156823d33999 | 43 | #ifdef __cplusplus |
<> | 149:156823d33999 | 44 | extern "C" { |
<> | 149:156823d33999 | 45 | #endif |
<> | 149:156823d33999 | 46 | |
<> | 149:156823d33999 | 47 | #ifdef DEBUG |
<> | 149:156823d33999 | 48 | |
<> | 149:156823d33999 | 49 | /** Executes when an assertion condition evaluates to false. |
<> | 149:156823d33999 | 50 | * @param filename The name of the current file (normally the __FILE__ macro). |
<> | 149:156823d33999 | 51 | * @param line The current line number (normally the __LINE__ macro). |
<> | 149:156823d33999 | 52 | */ |
<> | 149:156823d33999 | 53 | void fOnAssert(const char *filename, unsigned int line); |
<> | 149:156823d33999 | 54 | |
<> | 149:156823d33999 | 55 | /** Can be assigned to hook into the assertion. */ |
<> | 149:156823d33999 | 56 | extern void (*assertCallback)(const char *filename, unsigned int line); |
<> | 149:156823d33999 | 57 | |
<> | 149:156823d33999 | 58 | #define ASSERT(test) ((test) ? (void)0 : fOnAssert(__FILE__, __LINE__)) |
<> | 149:156823d33999 | 59 | |
<> | 149:156823d33999 | 60 | #define VERIFY(test) ASSERT(test) |
<> | 149:156823d33999 | 61 | |
<> | 149:156823d33999 | 62 | #else |
<> | 149:156823d33999 | 63 | |
<> | 149:156823d33999 | 64 | #define ASSERT(test) ((test) ? (void)0 : 1) |
<> | 149:156823d33999 | 65 | |
<> | 149:156823d33999 | 66 | #define VERIFY(test) ((void)(test)) |
<> | 149:156823d33999 | 67 | |
<> | 149:156823d33999 | 68 | #endif // DEBUG |
<> | 149:156823d33999 | 69 | |
<> | 149:156823d33999 | 70 | #ifdef __cplusplus |
<> | 149:156823d33999 | 71 | } |
<> | 149:156823d33999 | 72 | #endif |
<> | 149:156823d33999 | 73 | |
<> | 149:156823d33999 | 74 | #endif /* ASSERT_H_ */ |