Nordic nrf51 sdk sources. Mirrored from https://github.com/ARMmbed/nrf51-sdk.

Dependents:   nRF51822 nRF51822

Committer:
vcoubard
Date:
Thu Apr 07 17:37:40 2016 +0100
Revision:
19:47192cb9def7
Parent:
10:233fefd8162b
Child:
20:a90c48eb1d30
Synchronized with git rev 9251259f
Author: Liyou Zhou
Copy over coresponding files from nordic-sdk 9.0.0

Who changed what in which revision?

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