Old version

Dependents:   VNG_BLE_Basic

Fork of nRF51822 by Nordic Semiconductor

Committer:
longdh
Date:
Thu Jan 21 02:04:47 2016 +0000
Revision:
94:22533f51b97f
Parent:
0:eff01767de02
Child:
37:c29c330d942c
First commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 0:eff01767de02 1 /*
bogdanm 0:eff01767de02 2 * Copyright (c) 2006 Nordic Semiconductor. All Rights Reserved.
bogdanm 0:eff01767de02 3 *
bogdanm 0:eff01767de02 4 * The information contained herein is confidential property of Nordic Semiconductor. The use,
bogdanm 0:eff01767de02 5 * copying, transfer or disclosure of such information is prohibited except by express written
bogdanm 0:eff01767de02 6 * agreement with Nordic Semiconductor.
bogdanm 0:eff01767de02 7 *
bogdanm 0:eff01767de02 8 */
bogdanm 0:eff01767de02 9
bogdanm 0:eff01767de02 10 /** @file
bogdanm 0:eff01767de02 11 * @brief Utilities for verifying program logic
bogdanm 0:eff01767de02 12 */
bogdanm 0:eff01767de02 13
bogdanm 0:eff01767de02 14 #ifndef NRF_ASSERT_H_
bogdanm 0:eff01767de02 15 #define NRF_ASSERT_H_
bogdanm 0:eff01767de02 16
bogdanm 0:eff01767de02 17 #include <stdint.h>
bogdanm 0:eff01767de02 18 #include "nordic_global.h"
bogdanm 0:eff01767de02 19
bogdanm 0:eff01767de02 20 #if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER)
bogdanm 0:eff01767de02 21
bogdanm 0:eff01767de02 22 /** @brief Function for handling assertions.
bogdanm 0:eff01767de02 23 *
bogdanm 0:eff01767de02 24 *
bogdanm 0:eff01767de02 25 * @note
bogdanm 0:eff01767de02 26 * This function is called when an assertion has triggered.
bogdanm 0:eff01767de02 27 *
bogdanm 0:eff01767de02 28 *
bogdanm 0:eff01767de02 29 * @post
bogdanm 0:eff01767de02 30 * All hardware is put into an idle non-emitting state (in particular the radio is highly
bogdanm 0:eff01767de02 31 * important to switch off since the radio might be in a state that makes it send
bogdanm 0:eff01767de02 32 * packets continiously while a typical final infinit ASSERT loop is executing).
bogdanm 0:eff01767de02 33 *
bogdanm 0:eff01767de02 34 *
bogdanm 0:eff01767de02 35 * @param line_num The line number where the assertion is called
bogdanm 0:eff01767de02 36 * @param file_name Pointer to the file name
bogdanm 0:eff01767de02 37 */
bogdanm 0:eff01767de02 38 void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);
bogdanm 0:eff01767de02 39
bogdanm 0:eff01767de02 40 /*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */
bogdanm 0:eff01767de02 41 /*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \
bogdanm 0:eff01767de02 42
bogdanm 0:eff01767de02 43 /** @brief Function for checking intended for production code.
bogdanm 0:eff01767de02 44 *
bogdanm 0:eff01767de02 45 * Check passes if "expr" evaluates to true. */
bogdanm 0:eff01767de02 46 #define ASSERT(expr) \
bogdanm 0:eff01767de02 47 if (expr) \
bogdanm 0:eff01767de02 48 { \
bogdanm 0:eff01767de02 49 } \
bogdanm 0:eff01767de02 50 else \
bogdanm 0:eff01767de02 51 { \
bogdanm 0:eff01767de02 52 assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \
bogdanm 0:eff01767de02 53 }
bogdanm 0:eff01767de02 54 #else
bogdanm 0:eff01767de02 55 #define ASSERT(expr) //!< Assert empty when disabled
bogdanm 0:eff01767de02 56 void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);
bogdanm 0:eff01767de02 57 #endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */
bogdanm 0:eff01767de02 58
bogdanm 0:eff01767de02 59 #endif /* NRF_ASSERT_H_ */