Patched version of nrf51822 FOTA compatible driver, with GPTIO disabled, as it clashed with the mbed definitions...

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers nrf_assert.h Source File

nrf_assert.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2006 Nordic Semiconductor. All Rights Reserved.
00003  *
00004  * The information contained herein is confidential property of Nordic Semiconductor. The use,
00005  * copying, transfer or disclosure of such information is prohibited except by express written
00006  * agreement with Nordic Semiconductor.
00007  *
00008  */
00009 
00010 /** @file
00011  * @brief Utilities for verifying program logic
00012  */
00013 
00014 #ifndef NRF_ASSERT_H_
00015 #define NRF_ASSERT_H_
00016 
00017 #include <stdint.h>
00018 #include "compiler_abstraction.h"
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022 
00023 #if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER)
00024 
00025 /** @brief Function for handling assertions.
00026  *
00027  *
00028  * @note
00029  * This function is called when an assertion has triggered.
00030  *
00031  *
00032  * @post
00033  * All hardware is put into an idle non-emitting state (in particular the radio is highly
00034  * important to switch off since the radio might be in a state that makes it send
00035  * packets continiously while a typical final infinit ASSERT loop is executing).
00036  *
00037  *
00038  * @param line_num The line number where the assertion is called
00039  * @param file_name Pointer to the file name
00040  */
00041 void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);
00042 
00043 /*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */ 
00044 /*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \
00045 
00046 /** @brief Function for checking intended for production code.
00047  *
00048  * Check passes if "expr" evaluates to true. */
00049 #define ASSERT(expr) \
00050 if (expr)                                                                     \
00051 {                                                                             \
00052 }                                                                             \
00053 else                                                                          \
00054 {                                                                             \
00055   assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__);               \
00056 }
00057 #else
00058 #define ASSERT(expr) //!< Assert empty when disabled
00059 __WEAK void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);
00060 #endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */
00061 
00062 #ifdef __cplusplus
00063 }
00064 #endif
00065 
00066 #endif /* NRF_ASSERT_H_ */