テスト用です。

Dependencies:   mbed

Committer:
jksoft
Date:
Tue Oct 11 11:09:42 2016 +0000
Revision:
0:8468a4403fea
SB??ver;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:8468a4403fea 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
jksoft 0:8468a4403fea 2 *
jksoft 0:8468a4403fea 3 * The information contained herein is property of Nordic Semiconductor ASA.
jksoft 0:8468a4403fea 4 * Terms and conditions of usage are described in detail in NORDIC
jksoft 0:8468a4403fea 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
jksoft 0:8468a4403fea 6 *
jksoft 0:8468a4403fea 7 * Licensees are granted free, non-transferable use of the information. NO
jksoft 0:8468a4403fea 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
jksoft 0:8468a4403fea 9 * the file.
jksoft 0:8468a4403fea 10 *
jksoft 0:8468a4403fea 11 */
jksoft 0:8468a4403fea 12
jksoft 0:8468a4403fea 13 /** @file
jksoft 0:8468a4403fea 14 *
jksoft 0:8468a4403fea 15 * @defgroup ble_error_log_module Error Log Module
jksoft 0:8468a4403fea 16 * @{
jksoft 0:8468a4403fea 17 * @ingroup ble_sdk_lib
jksoft 0:8468a4403fea 18 * @brief Module for writing error and stack to flash memory.
jksoft 0:8468a4403fea 19 *
jksoft 0:8468a4403fea 20 * @details It contains functions for writing an error code, line number, filename/message and
jksoft 0:8468a4403fea 21 * the stack to the flash during an error, e.g. in the assert handler.
jksoft 0:8468a4403fea 22 *
jksoft 0:8468a4403fea 23 */
jksoft 0:8468a4403fea 24 #ifndef BLE_ERROR_LOG_H__
jksoft 0:8468a4403fea 25 #define BLE_ERROR_LOG_H__
jksoft 0:8468a4403fea 26
jksoft 0:8468a4403fea 27 #include <stdint.h>
jksoft 0:8468a4403fea 28 #include <stdbool.h>
jksoft 0:8468a4403fea 29 #include "ble_flash.h"
jksoft 0:8468a4403fea 30
jksoft 0:8468a4403fea 31 #define ERROR_MESSAGE_LENGTH 128 /**< Length of error message to stored. */
jksoft 0:8468a4403fea 32 #define STACK_DUMP_LENGTH 256 /**< Length of stack to be stored at max: 64 entries of 4 bytes each. */
jksoft 0:8468a4403fea 33 #define FLASH_PAGE_ERROR_LOG (BLE_FLASH_PAGE_END - 2) /**< Address in flash where stack trace can be stored. */
jksoft 0:8468a4403fea 34
jksoft 0:8468a4403fea 35 /**@brief Error Log Data structure.
jksoft 0:8468a4403fea 36 *
jksoft 0:8468a4403fea 37 * @details The structure contains the error, message/filename, line number as well as the current
jksoft 0:8468a4403fea 38 * stack, at the time where an error occured.
jksoft 0:8468a4403fea 39 */
jksoft 0:8468a4403fea 40 typedef struct
jksoft 0:8468a4403fea 41 {
jksoft 0:8468a4403fea 42 uint16_t failure; /**< Indication that a major failure has occurred during last execution of the application. */
jksoft 0:8468a4403fea 43 uint16_t line_number; /**< Line number indicating at which line the failure occurred. */
jksoft 0:8468a4403fea 44 uint32_t err_code; /**< Error code when failure occurred. */
jksoft 0:8468a4403fea 45 uint8_t message[ERROR_MESSAGE_LENGTH]; /**< Will just use the first 128 bytes of filename to store for debugging purposes. */
jksoft 0:8468a4403fea 46 uint32_t stack_info[STACK_DUMP_LENGTH / 4]; /**< Will contain stack information, can be manually unwinded for debug purposes. */
jksoft 0:8468a4403fea 47 } ble_error_log_data_t;
jksoft 0:8468a4403fea 48
jksoft 0:8468a4403fea 49
jksoft 0:8468a4403fea 50 /**@brief Function for writing the file name/message, line number, and current program stack
jksoft 0:8468a4403fea 51 * to flash.
jksoft 0:8468a4403fea 52 *
jksoft 0:8468a4403fea 53 * @note This function will force the writing to flash, and disregard any radio communication.
jksoft 0:8468a4403fea 54 * USE THIS FUNCTION WITH CARE.
jksoft 0:8468a4403fea 55 *
jksoft 0:8468a4403fea 56 * @param[in] err_code Error code to be logged.
jksoft 0:8468a4403fea 57 * @param[in] p_message Message to be written to the flash together with stack dump, usually
jksoft 0:8468a4403fea 58 * the file name where the error occured.
jksoft 0:8468a4403fea 59 * @param[in] line_number Line number where the error occured.
jksoft 0:8468a4403fea 60 *
jksoft 0:8468a4403fea 61 * @return NRF_SUCCESS on successful writing of the error log.
jksoft 0:8468a4403fea 62 *
jksoft 0:8468a4403fea 63 */
jksoft 0:8468a4403fea 64 uint32_t ble_error_log_write(uint32_t err_code, const uint8_t * p_message, uint16_t line_number);
jksoft 0:8468a4403fea 65
jksoft 0:8468a4403fea 66
jksoft 0:8468a4403fea 67 #endif /* BLE_ERROR_LOG_H__ */
jksoft 0:8468a4403fea 68
jksoft 0:8468a4403fea 69 /** @} */