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