Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
nordic/nrf-sdk/app_common/app_error.h@61:eb36b5b876a3, 2014-09-06 (annotated)
- Committer:
- todotani
- Date:
- Sat Sep 06 00:38:57 2014 +0000
- Revision:
- 61:eb36b5b876a3
- Parent:
- 49:c941433e0eb0
Include changes for HRM1017 with library 0.1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:eff01767de02 | 1 | /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. |
bogdanm | 0:eff01767de02 | 2 | * |
bogdanm | 0:eff01767de02 | 3 | * Terms and conditions of usage are described in detail in NORDIC |
bogdanm | 0:eff01767de02 | 4 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
bogdanm | 0:eff01767de02 | 5 | * |
bogdanm | 0:eff01767de02 | 6 | * Licensees are granted free, non-transferable use of the information. NO |
bogdanm | 0:eff01767de02 | 7 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
bogdanm | 0:eff01767de02 | 8 | * the file. |
bogdanm | 0:eff01767de02 | 9 | * |
bogdanm | 0:eff01767de02 | 10 | */ |
Rohit Grover |
49:c941433e0eb0 | 11 | |
bogdanm | 0:eff01767de02 | 12 | /** @file |
bogdanm | 0:eff01767de02 | 13 | * |
bogdanm | 0:eff01767de02 | 14 | * @defgroup app_error Common application error handler |
bogdanm | 0:eff01767de02 | 15 | * @{ |
bogdanm | 0:eff01767de02 | 16 | * @ingroup app_common |
bogdanm | 0:eff01767de02 | 17 | * |
bogdanm | 0:eff01767de02 | 18 | * @brief Common application error handler and macros for utilizing a common error handler. |
bogdanm | 0:eff01767de02 | 19 | */ |
bogdanm | 0:eff01767de02 | 20 | |
bogdanm | 0:eff01767de02 | 21 | #ifndef APP_ERROR_H__ |
bogdanm | 0:eff01767de02 | 22 | #define APP_ERROR_H__ |
bogdanm | 0:eff01767de02 | 23 | |
bogdanm | 0:eff01767de02 | 24 | #include <stdint.h> |
bogdanm | 0:eff01767de02 | 25 | #include <stdbool.h> |
bogdanm | 0:eff01767de02 | 26 | #include "nrf_error.h" |
bogdanm | 0:eff01767de02 | 27 | |
Rohit Grover |
49:c941433e0eb0 | 28 | #ifdef __cplusplus |
Rohit Grover |
49:c941433e0eb0 | 29 | extern "C" { |
Rohit Grover |
49:c941433e0eb0 | 30 | #endif |
Rohit Grover |
49:c941433e0eb0 | 31 | |
Rohit Grover |
49:c941433e0eb0 | 32 | /**@brief Function for error handling, which is called when an error has occurred. |
bogdanm | 0:eff01767de02 | 33 | * |
bogdanm | 0:eff01767de02 | 34 | * @param[in] error_code Error code supplied to the handler. |
bogdanm | 0:eff01767de02 | 35 | * @param[in] line_num Line number where the handler is called. |
Rohit Grover |
49:c941433e0eb0 | 36 | * @param[in] p_file_name Pointer to the file name. |
bogdanm | 0:eff01767de02 | 37 | */ |
bogdanm | 0:eff01767de02 | 38 | void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name); |
bogdanm | 0:eff01767de02 | 39 | |
Rohit Grover |
49:c941433e0eb0 | 40 | #ifdef __cplusplus |
Rohit Grover |
49:c941433e0eb0 | 41 | } |
Rohit Grover |
49:c941433e0eb0 | 42 | #endif |
Rohit Grover |
49:c941433e0eb0 | 43 | |
Rohit Grover |
49:c941433e0eb0 | 44 | /**@brief Macro for calling error handler function. |
bogdanm | 0:eff01767de02 | 45 | * |
bogdanm | 0:eff01767de02 | 46 | * @param[in] ERR_CODE Error code supplied to the error handler. |
bogdanm | 0:eff01767de02 | 47 | */ |
bogdanm | 0:eff01767de02 | 48 | #define APP_ERROR_HANDLER(ERR_CODE) \ |
bogdanm | 0:eff01767de02 | 49 | do \ |
bogdanm | 0:eff01767de02 | 50 | { \ |
bogdanm | 0:eff01767de02 | 51 | app_error_handler((ERR_CODE), __LINE__, (uint8_t*) __FILE__); \ |
bogdanm | 0:eff01767de02 | 52 | } while (0) |
bogdanm | 0:eff01767de02 | 53 | |
Rohit Grover |
49:c941433e0eb0 | 54 | /**@brief Macro for calling error handler function if supplied error code any other than NRF_SUCCESS. |
bogdanm | 0:eff01767de02 | 55 | * |
bogdanm | 0:eff01767de02 | 56 | * @param[in] ERR_CODE Error code supplied to the error handler. |
Rohit Grover |
49:c941433e0eb0 | 57 | */ |
bogdanm | 0:eff01767de02 | 58 | #define APP_ERROR_CHECK(ERR_CODE) \ |
bogdanm | 0:eff01767de02 | 59 | do \ |
bogdanm | 0:eff01767de02 | 60 | { \ |
bogdanm | 0:eff01767de02 | 61 | const uint32_t LOCAL_ERR_CODE = (ERR_CODE); \ |
bogdanm | 0:eff01767de02 | 62 | if (LOCAL_ERR_CODE != NRF_SUCCESS) \ |
bogdanm | 0:eff01767de02 | 63 | { \ |
bogdanm | 0:eff01767de02 | 64 | APP_ERROR_HANDLER(LOCAL_ERR_CODE); \ |
bogdanm | 0:eff01767de02 | 65 | } \ |
Rohit Grover |
49:c941433e0eb0 | 66 | } while (0) |
Rohit Grover |
49:c941433e0eb0 | 67 | |
Rohit Grover |
49:c941433e0eb0 | 68 | /**@brief Macro for calling error handler function if supplied boolean value is false. |
bogdanm | 0:eff01767de02 | 69 | * |
bogdanm | 0:eff01767de02 | 70 | * @param[in] BOOLEAN_VALUE Boolean value to be evaluated. |
Rohit Grover |
49:c941433e0eb0 | 71 | */ |
bogdanm | 0:eff01767de02 | 72 | #define APP_ERROR_CHECK_BOOL(BOOLEAN_VALUE) \ |
bogdanm | 0:eff01767de02 | 73 | do \ |
bogdanm | 0:eff01767de02 | 74 | { \ |
bogdanm | 0:eff01767de02 | 75 | const bool LOCAL_BOOLEAN_VALUE = (BOOLEAN_VALUE); \ |
bogdanm | 0:eff01767de02 | 76 | if (!LOCAL_BOOLEAN_VALUE) \ |
bogdanm | 0:eff01767de02 | 77 | { \ |
bogdanm | 0:eff01767de02 | 78 | APP_ERROR_HANDLER(0); \ |
bogdanm | 0:eff01767de02 | 79 | } \ |
Rohit Grover |
49:c941433e0eb0 | 80 | } while (0) |
bogdanm | 0:eff01767de02 | 81 | |
bogdanm | 0:eff01767de02 | 82 | #endif // APP_ERROR_H__ |
bogdanm | 0:eff01767de02 | 83 | |
bogdanm | 0:eff01767de02 | 84 | /** @} */ |