project for nrf51822 qfab
Dependencies: eddystone_URL mbed
Fork of eddystone_URL by
nRF51822/nordic/nrf-sdk/nrf_assert.h@5:267bdacf5508, 2017-11-23 (annotated)
- Committer:
- tridung141196
- Date:
- Thu Nov 23 15:38:48 2017 +0000
- Revision:
- 5:267bdacf5508
- Parent:
- 0:76dfa9657d9d
ibeacon
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:76dfa9657d9d | 1 | /* |
jksoft | 0:76dfa9657d9d | 2 | * Copyright (c) 2006 Nordic Semiconductor. All Rights Reserved. |
jksoft | 0:76dfa9657d9d | 3 | * |
jksoft | 0:76dfa9657d9d | 4 | * The information contained herein is confidential property of Nordic Semiconductor. The use, |
jksoft | 0:76dfa9657d9d | 5 | * copying, transfer or disclosure of such information is prohibited except by express written |
jksoft | 0:76dfa9657d9d | 6 | * agreement with Nordic Semiconductor. |
jksoft | 0:76dfa9657d9d | 7 | * |
jksoft | 0:76dfa9657d9d | 8 | */ |
jksoft | 0:76dfa9657d9d | 9 | |
jksoft | 0:76dfa9657d9d | 10 | /** @file |
jksoft | 0:76dfa9657d9d | 11 | * @brief Utilities for verifying program logic |
jksoft | 0:76dfa9657d9d | 12 | */ |
jksoft | 0:76dfa9657d9d | 13 | |
jksoft | 0:76dfa9657d9d | 14 | #ifndef NRF_ASSERT_H_ |
jksoft | 0:76dfa9657d9d | 15 | #define NRF_ASSERT_H_ |
jksoft | 0:76dfa9657d9d | 16 | |
jksoft | 0:76dfa9657d9d | 17 | #include <stdint.h> |
jksoft | 0:76dfa9657d9d | 18 | |
jksoft | 0:76dfa9657d9d | 19 | #ifdef __cplusplus |
jksoft | 0:76dfa9657d9d | 20 | extern "C" { |
jksoft | 0:76dfa9657d9d | 21 | #endif |
jksoft | 0:76dfa9657d9d | 22 | |
jksoft | 0:76dfa9657d9d | 23 | #if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) |
jksoft | 0:76dfa9657d9d | 24 | |
jksoft | 0:76dfa9657d9d | 25 | /** @brief Function for handling assertions. |
jksoft | 0:76dfa9657d9d | 26 | * |
jksoft | 0:76dfa9657d9d | 27 | * |
jksoft | 0:76dfa9657d9d | 28 | * @note |
jksoft | 0:76dfa9657d9d | 29 | * This function is called when an assertion has triggered. |
jksoft | 0:76dfa9657d9d | 30 | * |
jksoft | 0:76dfa9657d9d | 31 | * |
jksoft | 0:76dfa9657d9d | 32 | * @post |
jksoft | 0:76dfa9657d9d | 33 | * All hardware is put into an idle non-emitting state (in particular the radio is highly |
jksoft | 0:76dfa9657d9d | 34 | * important to switch off since the radio might be in a state that makes it send |
jksoft | 0:76dfa9657d9d | 35 | * packets continiously while a typical final infinit ASSERT loop is executing). |
jksoft | 0:76dfa9657d9d | 36 | * |
jksoft | 0:76dfa9657d9d | 37 | * |
jksoft | 0:76dfa9657d9d | 38 | * @param line_num The line number where the assertion is called |
jksoft | 0:76dfa9657d9d | 39 | * @param file_name Pointer to the file name |
jksoft | 0:76dfa9657d9d | 40 | */ |
jksoft | 0:76dfa9657d9d | 41 | void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); |
jksoft | 0:76dfa9657d9d | 42 | |
jksoft | 0:76dfa9657d9d | 43 | /*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */ |
jksoft | 0:76dfa9657d9d | 44 | /*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \ |
jksoft | 0:76dfa9657d9d | 45 | |
jksoft | 0:76dfa9657d9d | 46 | /** @brief Function for checking intended for production code. |
jksoft | 0:76dfa9657d9d | 47 | * |
jksoft | 0:76dfa9657d9d | 48 | * Check passes if "expr" evaluates to true. */ |
jksoft | 0:76dfa9657d9d | 49 | #define ASSERT(expr) \ |
jksoft | 0:76dfa9657d9d | 50 | if (expr) \ |
jksoft | 0:76dfa9657d9d | 51 | { \ |
jksoft | 0:76dfa9657d9d | 52 | } \ |
jksoft | 0:76dfa9657d9d | 53 | else \ |
jksoft | 0:76dfa9657d9d | 54 | { \ |
jksoft | 0:76dfa9657d9d | 55 | assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ |
jksoft | 0:76dfa9657d9d | 56 | } |
jksoft | 0:76dfa9657d9d | 57 | #else |
jksoft | 0:76dfa9657d9d | 58 | #define ASSERT(expr) //!< Assert empty when disabled |
jksoft | 0:76dfa9657d9d | 59 | void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); |
jksoft | 0:76dfa9657d9d | 60 | #endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */ |
jksoft | 0:76dfa9657d9d | 61 | |
jksoft | 0:76dfa9657d9d | 62 | #ifdef __cplusplus |
jksoft | 0:76dfa9657d9d | 63 | } |
jksoft | 0:76dfa9657d9d | 64 | #endif |
jksoft | 0:76dfa9657d9d | 65 | |
jksoft | 0:76dfa9657d9d | 66 | #endif /* NRF_ASSERT_H_ */ |