Dependents:   BLE_MIDI

Fork of nRF51822 by Nordic Semiconductor

Committer:
Rohit Grover
Date:
Mon Jul 07 13:43:31 2014 +0100
Revision:
37:c29c330d942c
Parent:
0:eff01767de02
Child:
49:c941433e0eb0
changes required to upgrade to V7 of the soft-device

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
bogdanm 0:eff01767de02 19 #if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER)
bogdanm 0:eff01767de02 20
bogdanm 0:eff01767de02 21 /** @brief Function for handling assertions.
bogdanm 0:eff01767de02 22 *
bogdanm 0:eff01767de02 23 *
bogdanm 0:eff01767de02 24 * @note
bogdanm 0:eff01767de02 25 * This function is called when an assertion has triggered.
bogdanm 0:eff01767de02 26 *
bogdanm 0:eff01767de02 27 *
bogdanm 0:eff01767de02 28 * @post
bogdanm 0:eff01767de02 29 * All hardware is put into an idle non-emitting state (in particular the radio is highly
bogdanm 0:eff01767de02 30 * important to switch off since the radio might be in a state that makes it send
bogdanm 0:eff01767de02 31 * packets continiously while a typical final infinit ASSERT loop is executing).
bogdanm 0:eff01767de02 32 *
bogdanm 0:eff01767de02 33 *
bogdanm 0:eff01767de02 34 * @param line_num The line number where the assertion is called
bogdanm 0:eff01767de02 35 * @param file_name Pointer to the file name
bogdanm 0:eff01767de02 36 */
bogdanm 0:eff01767de02 37 void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);
bogdanm 0:eff01767de02 38
bogdanm 0:eff01767de02 39 /*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */
bogdanm 0:eff01767de02 40 /*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \
bogdanm 0:eff01767de02 41
bogdanm 0:eff01767de02 42 /** @brief Function for checking intended for production code.
bogdanm 0:eff01767de02 43 *
bogdanm 0:eff01767de02 44 * Check passes if "expr" evaluates to true. */
bogdanm 0:eff01767de02 45 #define ASSERT(expr) \
bogdanm 0:eff01767de02 46 if (expr) \
bogdanm 0:eff01767de02 47 { \
bogdanm 0:eff01767de02 48 } \
bogdanm 0:eff01767de02 49 else \
bogdanm 0:eff01767de02 50 { \
bogdanm 0:eff01767de02 51 assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \
bogdanm 0:eff01767de02 52 }
bogdanm 0:eff01767de02 53 #else
bogdanm 0:eff01767de02 54 #define ASSERT(expr) //!< Assert empty when disabled
bogdanm 0:eff01767de02 55 void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);
bogdanm 0:eff01767de02 56 #endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */
bogdanm 0:eff01767de02 57
bogdanm 0:eff01767de02 58 #endif /* NRF_ASSERT_H_ */