mbed library sources

Dependents:   Nucleo_blink_led

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Tue Apr 07 06:45:07 2015 +0100
Revision:
501:36015dec7d16
Synchronized with git revision 40d3a79298f37284b863f90e33e261986340964e

Full URL: https://github.com/mbedmicro/mbed/commit/40d3a79298f37284b863f90e33e261986340964e/

fixes #984: updating to v7.1 of the Nordic SDK.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 501:36015dec7d16 1 /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
mbed_official 501:36015dec7d16 2 *
mbed_official 501:36015dec7d16 3 * The information contained herein is property of Nordic Semiconductor ASA.
mbed_official 501:36015dec7d16 4 * Terms and conditions of usage are described in detail in NORDIC
mbed_official 501:36015dec7d16 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
mbed_official 501:36015dec7d16 6 *
mbed_official 501:36015dec7d16 7 * Licensees are granted free, non-transferable use of the information. NO
mbed_official 501:36015dec7d16 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
mbed_official 501:36015dec7d16 9 * the file.
mbed_official 501:36015dec7d16 10 *
mbed_official 501:36015dec7d16 11 */
mbed_official 501:36015dec7d16 12
mbed_official 501:36015dec7d16 13 /** @file
mbed_official 501:36015dec7d16 14 *
mbed_official 501:36015dec7d16 15 * @defgroup app_error Common application error handler
mbed_official 501:36015dec7d16 16 * @{
mbed_official 501:36015dec7d16 17 * @ingroup app_common
mbed_official 501:36015dec7d16 18 *
mbed_official 501:36015dec7d16 19 * @brief Common application error handler and macros for utilizing a common error handler.
mbed_official 501:36015dec7d16 20 */
mbed_official 501:36015dec7d16 21
mbed_official 501:36015dec7d16 22 #ifndef APP_ERROR_H__
mbed_official 501:36015dec7d16 23 #define APP_ERROR_H__
mbed_official 501:36015dec7d16 24
mbed_official 501:36015dec7d16 25 #include <stdint.h>
mbed_official 501:36015dec7d16 26 #include <stdbool.h>
mbed_official 501:36015dec7d16 27 #include "nrf_error.h"
mbed_official 501:36015dec7d16 28
mbed_official 501:36015dec7d16 29 /**@brief Function for error handling, which is called when an error has occurred.
mbed_official 501:36015dec7d16 30 *
mbed_official 501:36015dec7d16 31 * @param[in] error_code Error code supplied to the handler.
mbed_official 501:36015dec7d16 32 * @param[in] line_num Line number where the handler is called.
mbed_official 501:36015dec7d16 33 * @param[in] p_file_name Pointer to the file name.
mbed_official 501:36015dec7d16 34 */
mbed_official 501:36015dec7d16 35 void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name);
mbed_official 501:36015dec7d16 36
mbed_official 501:36015dec7d16 37 /**@brief Macro for calling error handler function.
mbed_official 501:36015dec7d16 38 *
mbed_official 501:36015dec7d16 39 * @param[in] ERR_CODE Error code supplied to the error handler.
mbed_official 501:36015dec7d16 40 */
mbed_official 501:36015dec7d16 41 #ifdef DEBUG
mbed_official 501:36015dec7d16 42 #define APP_ERROR_HANDLER(ERR_CODE) \
mbed_official 501:36015dec7d16 43 do \
mbed_official 501:36015dec7d16 44 { \
mbed_official 501:36015dec7d16 45 app_error_handler((ERR_CODE), __LINE__, (uint8_t*) __FILE__); \
mbed_official 501:36015dec7d16 46 } while (0)
mbed_official 501:36015dec7d16 47 #else
mbed_official 501:36015dec7d16 48 #define APP_ERROR_HANDLER(ERR_CODE) \
mbed_official 501:36015dec7d16 49 do \
mbed_official 501:36015dec7d16 50 { \
mbed_official 501:36015dec7d16 51 app_error_handler((ERR_CODE), 0, 0); \
mbed_official 501:36015dec7d16 52 } while (0)
mbed_official 501:36015dec7d16 53 #endif
mbed_official 501:36015dec7d16 54 /**@brief Macro for calling error handler function if supplied error code any other than NRF_SUCCESS.
mbed_official 501:36015dec7d16 55 *
mbed_official 501:36015dec7d16 56 * @param[in] ERR_CODE Error code supplied to the error handler.
mbed_official 501:36015dec7d16 57 */
mbed_official 501:36015dec7d16 58 #define APP_ERROR_CHECK(ERR_CODE) \
mbed_official 501:36015dec7d16 59 do \
mbed_official 501:36015dec7d16 60 { \
mbed_official 501:36015dec7d16 61 const uint32_t LOCAL_ERR_CODE = (ERR_CODE); \
mbed_official 501:36015dec7d16 62 if (LOCAL_ERR_CODE != NRF_SUCCESS) \
mbed_official 501:36015dec7d16 63 { \
mbed_official 501:36015dec7d16 64 APP_ERROR_HANDLER(LOCAL_ERR_CODE); \
mbed_official 501:36015dec7d16 65 } \
mbed_official 501:36015dec7d16 66 } while (0)
mbed_official 501:36015dec7d16 67
mbed_official 501:36015dec7d16 68 /**@brief Macro for calling error handler function if supplied boolean value is false.
mbed_official 501:36015dec7d16 69 *
mbed_official 501:36015dec7d16 70 * @param[in] BOOLEAN_VALUE Boolean value to be evaluated.
mbed_official 501:36015dec7d16 71 */
mbed_official 501:36015dec7d16 72 #define APP_ERROR_CHECK_BOOL(BOOLEAN_VALUE) \
mbed_official 501:36015dec7d16 73 do \
mbed_official 501:36015dec7d16 74 { \
mbed_official 501:36015dec7d16 75 const uint32_t LOCAL_BOOLEAN_VALUE = (BOOLEAN_VALUE); \
mbed_official 501:36015dec7d16 76 if (!LOCAL_BOOLEAN_VALUE) \
mbed_official 501:36015dec7d16 77 { \
mbed_official 501:36015dec7d16 78 APP_ERROR_HANDLER(0); \
mbed_official 501:36015dec7d16 79 } \
mbed_official 501:36015dec7d16 80 } while (0)
mbed_official 501:36015dec7d16 81
mbed_official 501:36015dec7d16 82 #endif // APP_ERROR_H__
mbed_official 501:36015dec7d16 83
mbed_official 501:36015dec7d16 84 /** @} */