Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: microbit_rubber_ducky microbit_mouse_BLE microbit_mouse_BLE_daybreak_version microbit_presenter
Fork of nRF51822 by
nordic-sdk/components/libraries/util/nrf_assert.h@346:14b090482fd2, 2015-06-19 (annotated)
- Committer:
 - rgrover1
 - Date:
 - Fri Jun 19 15:55:35 2015 +0100
 - Revision:
 - 346:14b090482fd2
 - Parent:
 - 345:dfde56236c36
 - Child:
 - 361:d2405f5a4853
 
Synchronized with git rev bb88aaad
Author: Rohit Grover
renamed BLEDevice to BLE
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| rgrover1 | 346:14b090482fd2 | 1 | /* | 
| rgrover1 | 346:14b090482fd2 | 2 | * Copyright (c) Nordic Semiconductor ASA | 
| rgrover1 | 346:14b090482fd2 | 3 | * All rights reserved. | 
| rgrover1 | 346:14b090482fd2 | 4 | * | 
| rgrover1 | 346:14b090482fd2 | 5 | * Redistribution and use in source and binary forms, with or without modification, | 
| rgrover1 | 346:14b090482fd2 | 6 | * are permitted provided that the following conditions are met: | 
| rgrover1 | 346:14b090482fd2 | 7 | * | 
| rgrover1 | 346:14b090482fd2 | 8 | * 1. Redistributions of source code must retain the above copyright notice, this | 
| rgrover1 | 346:14b090482fd2 | 9 | * list of conditions and the following disclaimer. | 
| rgrover1 | 346:14b090482fd2 | 10 | * | 
| rgrover1 | 346:14b090482fd2 | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this | 
| rgrover1 | 346:14b090482fd2 | 12 | * list of conditions and the following disclaimer in the documentation and/or | 
| rgrover1 | 346:14b090482fd2 | 13 | * other materials provided with the distribution. | 
| rgrover1 | 346:14b090482fd2 | 14 | * | 
| rgrover1 | 346:14b090482fd2 | 15 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of other | 
| rgrover1 | 346:14b090482fd2 | 16 | * contributors to this software may be used to endorse or promote products | 
| rgrover1 | 346:14b090482fd2 | 17 | * derived from this software without specific prior written permission. | 
| rgrover1 | 346:14b090482fd2 | 18 | * | 
| rgrover1 | 346:14b090482fd2 | 19 | * | 
| rgrover1 | 346:14b090482fd2 | 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 
| rgrover1 | 346:14b090482fd2 | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 
| rgrover1 | 346:14b090482fd2 | 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 
| rgrover1 | 346:14b090482fd2 | 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | 
| rgrover1 | 346:14b090482fd2 | 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 
| rgrover1 | 346:14b090482fd2 | 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 
| rgrover1 | 346:14b090482fd2 | 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | 
| rgrover1 | 346:14b090482fd2 | 27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
| rgrover1 | 346:14b090482fd2 | 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 
| rgrover1 | 346:14b090482fd2 | 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
| rgrover1 | 346:14b090482fd2 | 30 | * | 
| rgrover1 | 346:14b090482fd2 | 31 | */ | 
| rgrover1 | 346:14b090482fd2 | 32 | |
| rgrover1 | 346:14b090482fd2 | 33 | /** @file | 
| rgrover1 | 346:14b090482fd2 | 34 | * @brief Utilities for verifying program logic | 
| rgrover1 | 346:14b090482fd2 | 35 | */ | 
| rgrover1 | 346:14b090482fd2 | 36 | |
| rgrover1 | 346:14b090482fd2 | 37 | #ifndef NRF_ASSERT_H_ | 
| rgrover1 | 346:14b090482fd2 | 38 | #define NRF_ASSERT_H_ | 
| rgrover1 | 346:14b090482fd2 | 39 | |
| rgrover1 | 346:14b090482fd2 | 40 | #include <stdint.h> | 
| rgrover1 | 346:14b090482fd2 | 41 | #include "compiler_abstraction.h" | 
| rgrover1 | 346:14b090482fd2 | 42 | #ifdef __cplusplus | 
| rgrover1 | 346:14b090482fd2 | 43 | extern "C" { | 
| rgrover1 | 346:14b090482fd2 | 44 | #endif | 
| rgrover1 | 346:14b090482fd2 | 45 | |
| rgrover1 | 346:14b090482fd2 | 46 | #if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) | 
| rgrover1 | 346:14b090482fd2 | 47 | |
| rgrover1 | 346:14b090482fd2 | 48 | /** @brief Function for handling assertions. | 
| rgrover1 | 346:14b090482fd2 | 49 | * | 
| rgrover1 | 346:14b090482fd2 | 50 | * | 
| rgrover1 | 346:14b090482fd2 | 51 | * @note | 
| rgrover1 | 346:14b090482fd2 | 52 | * This function is called when an assertion has triggered. | 
| rgrover1 | 346:14b090482fd2 | 53 | * | 
| rgrover1 | 346:14b090482fd2 | 54 | * | 
| rgrover1 | 346:14b090482fd2 | 55 | * @post | 
| rgrover1 | 346:14b090482fd2 | 56 | * All hardware is put into an idle non-emitting state (in particular the radio is highly | 
| rgrover1 | 346:14b090482fd2 | 57 | * important to switch off since the radio might be in a state that makes it send | 
| rgrover1 | 346:14b090482fd2 | 58 | * packets continiously while a typical final infinit ASSERT loop is executing). | 
| rgrover1 | 346:14b090482fd2 | 59 | * | 
| rgrover1 | 346:14b090482fd2 | 60 | * | 
| rgrover1 | 346:14b090482fd2 | 61 | * @param line_num The line number where the assertion is called | 
| rgrover1 | 346:14b090482fd2 | 62 | * @param file_name Pointer to the file name | 
| rgrover1 | 346:14b090482fd2 | 63 | */ | 
| rgrover1 | 346:14b090482fd2 | 64 | void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); | 
| rgrover1 | 346:14b090482fd2 | 65 | |
| rgrover1 | 346:14b090482fd2 | 66 | /*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */ | 
| rgrover1 | 346:14b090482fd2 | 67 | /*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \ | 
| rgrover1 | 346:14b090482fd2 | 68 | |
| rgrover1 | 346:14b090482fd2 | 69 | /** @brief Function for checking intended for production code. | 
| rgrover1 | 346:14b090482fd2 | 70 | * | 
| rgrover1 | 346:14b090482fd2 | 71 | * Check passes if "expr" evaluates to true. */ | 
| rgrover1 | 346:14b090482fd2 | 72 | #define ASSERT(expr) \ | 
| rgrover1 | 346:14b090482fd2 | 73 | if (expr) \ | 
| rgrover1 | 346:14b090482fd2 | 74 | { \ | 
| rgrover1 | 346:14b090482fd2 | 75 | } \ | 
| rgrover1 | 346:14b090482fd2 | 76 | else \ | 
| rgrover1 | 346:14b090482fd2 | 77 | { \ | 
| rgrover1 | 346:14b090482fd2 | 78 | assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ | 
| rgrover1 | 346:14b090482fd2 | 79 | } | 
| rgrover1 | 346:14b090482fd2 | 80 | #else | 
| rgrover1 | 346:14b090482fd2 | 81 | #define ASSERT(expr) //!< Assert empty when disabled | 
| rgrover1 | 346:14b090482fd2 | 82 | __WEAK void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); | 
| rgrover1 | 346:14b090482fd2 | 83 | #endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */ | 
| rgrover1 | 346:14b090482fd2 | 84 | |
| rgrover1 | 346:14b090482fd2 | 85 | #ifdef __cplusplus | 
| rgrover1 | 346:14b090482fd2 | 86 | } | 
| rgrover1 | 346:14b090482fd2 | 87 | #endif | 
| rgrover1 | 346:14b090482fd2 | 88 | |
| rgrover1 | 346:14b090482fd2 | 89 | #endif /* NRF_ASSERT_H_ */ | 
