RTC auf true
platform/mbed_error_hist.h@2:7aab896b1a3b, 2019-03-13 (annotated)
- Committer:
- kevman
- Date:
- Wed Mar 13 11:03:24 2019 +0000
- Revision:
- 2:7aab896b1a3b
- Parent:
- 0:38ceb79fef03
2019-03-13
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kevman | 0:38ceb79fef03 | 1 | /* mbed Microcontroller Library |
kevman | 0:38ceb79fef03 | 2 | * Copyright (c) 2006-2013 ARM Limited |
kevman | 0:38ceb79fef03 | 3 | * |
kevman | 0:38ceb79fef03 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kevman | 0:38ceb79fef03 | 5 | * you may not use this file except in compliance with the License. |
kevman | 0:38ceb79fef03 | 6 | * You may obtain a copy of the License at |
kevman | 0:38ceb79fef03 | 7 | * |
kevman | 0:38ceb79fef03 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
kevman | 0:38ceb79fef03 | 9 | * |
kevman | 0:38ceb79fef03 | 10 | * Unless required by applicable law or agreed to in writing, software |
kevman | 0:38ceb79fef03 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
kevman | 0:38ceb79fef03 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kevman | 0:38ceb79fef03 | 13 | * See the License for the specific language governing permissions and |
kevman | 0:38ceb79fef03 | 14 | * limitations under the License. |
kevman | 0:38ceb79fef03 | 15 | */ |
kevman | 0:38ceb79fef03 | 16 | #ifndef MBED_ERROR_HIST_H |
kevman | 0:38ceb79fef03 | 17 | #define MBED_ERROR_HIST_H |
kevman | 0:38ceb79fef03 | 18 | |
kevman | 0:38ceb79fef03 | 19 | #ifndef MBED_CONF_PLATFORM_ERROR_HIST_SIZE |
kevman | 0:38ceb79fef03 | 20 | #define MBED_CONF_PLATFORM_ERROR_HIST_SIZE 4 |
kevman | 0:38ceb79fef03 | 21 | #else |
kevman | 0:38ceb79fef03 | 22 | #if MBED_CONF_PLATFORM_ERROR_HIST_SIZE == 0 |
kevman | 0:38ceb79fef03 | 23 | #define MBED_CONF_PLATFORM_ERROR_HIST_SIZE 1 |
kevman | 0:38ceb79fef03 | 24 | #endif |
kevman | 0:38ceb79fef03 | 25 | #endif |
kevman | 0:38ceb79fef03 | 26 | |
kevman | 0:38ceb79fef03 | 27 | #ifdef __cplusplus |
kevman | 0:38ceb79fef03 | 28 | extern "C" { |
kevman | 0:38ceb79fef03 | 29 | #endif |
kevman | 0:38ceb79fef03 | 30 | /* |
kevman | 0:38ceb79fef03 | 31 | * Puts/Adds an error entry into the error history list |
kevman | 0:38ceb79fef03 | 32 | * |
kevman | 0:38ceb79fef03 | 33 | * @param error_ctx pointer to the mbed_error_ctx struct with the error context |
kevman | 0:38ceb79fef03 | 34 | * @return 0 or MBED_SUCCESS on success. |
kevman | 0:38ceb79fef03 | 35 | * MBED_ERROR_WRITE_FAILED if writing to file failed |
kevman | 0:38ceb79fef03 | 36 | * MBED_ERROR_INVALID_ARGUMENT if path is not valid |
kevman | 0:38ceb79fef03 | 37 | * |
kevman | 0:38ceb79fef03 | 38 | * |
kevman | 0:38ceb79fef03 | 39 | */ |
kevman | 0:38ceb79fef03 | 40 | mbed_error_status_t mbed_error_hist_put(mbed_error_ctx *error_ctx); |
kevman | 0:38ceb79fef03 | 41 | |
kevman | 0:38ceb79fef03 | 42 | /* |
kevman | 0:38ceb79fef03 | 43 | * Reads the error entry from the error list with the specified index |
kevman | 0:38ceb79fef03 | 44 | * |
kevman | 0:38ceb79fef03 | 45 | * @param index Index of the error context to be retrieved. It starts from 0 and 0 is the oldest. |
kevman | 0:38ceb79fef03 | 46 | * @param error_ctx pointer to the mbed_error_ctx struct where the error context will be filled, this should be allocated by the caller |
kevman | 0:38ceb79fef03 | 47 | * @return 0 or MBED_SUCCESS on success. |
kevman | 0:38ceb79fef03 | 48 | * MBED_ERROR_WRITE_FAILED if writing to file failed |
kevman | 0:38ceb79fef03 | 49 | * MBED_ERROR_INVALID_ARGUMENT if path is not valid |
kevman | 0:38ceb79fef03 | 50 | * |
kevman | 0:38ceb79fef03 | 51 | * |
kevman | 0:38ceb79fef03 | 52 | */ |
kevman | 0:38ceb79fef03 | 53 | mbed_error_status_t mbed_error_hist_get(int index, mbed_error_ctx *error_ctx); |
kevman | 0:38ceb79fef03 | 54 | |
kevman | 0:38ceb79fef03 | 55 | /* |
kevman | 0:38ceb79fef03 | 56 | * Gets a reference to the next error entry in the error log where in the error ctx can be filled in. |
kevman | 0:38ceb79fef03 | 57 | * Its like reserving the next error entry to fill in the error info |
kevman | 0:38ceb79fef03 | 58 | * |
kevman | 0:38ceb79fef03 | 59 | * @return Returns the pointer to the next error ctx entry |
kevman | 0:38ceb79fef03 | 60 | * |
kevman | 0:38ceb79fef03 | 61 | * |
kevman | 0:38ceb79fef03 | 62 | */ |
kevman | 0:38ceb79fef03 | 63 | mbed_error_ctx *mbed_error_hist_get_entry(void); |
kevman | 0:38ceb79fef03 | 64 | |
kevman | 0:38ceb79fef03 | 65 | /* |
kevman | 0:38ceb79fef03 | 66 | * Reads the last(latest) error entry from the error history |
kevman | 0:38ceb79fef03 | 67 | * |
kevman | 0:38ceb79fef03 | 68 | * @param error_ctx pointer to the mbed_error_ctx struct where the error context will be filled, this should be allocated by the caller |
kevman | 0:38ceb79fef03 | 69 | * @return 0 or MBED_SUCCESS on success. |
kevman | 0:38ceb79fef03 | 70 | * MBED_ERROR_WRITE_FAILED if writing to file failed |
kevman | 0:38ceb79fef03 | 71 | * MBED_ERROR_INVALID_ARGUMENT if path is not valid |
kevman | 0:38ceb79fef03 | 72 | * |
kevman | 0:38ceb79fef03 | 73 | * |
kevman | 0:38ceb79fef03 | 74 | */ |
kevman | 0:38ceb79fef03 | 75 | mbed_error_status_t mbed_error_hist_get_last_error(mbed_error_ctx *error_ctx); |
kevman | 0:38ceb79fef03 | 76 | |
kevman | 0:38ceb79fef03 | 77 | /* |
kevman | 0:38ceb79fef03 | 78 | * Returns the number of error entries in the error history list |
kevman | 0:38ceb79fef03 | 79 | * |
kevman | 0:38ceb79fef03 | 80 | * @return Number of entries in the history list |
kevman | 0:38ceb79fef03 | 81 | * |
kevman | 0:38ceb79fef03 | 82 | * |
kevman | 0:38ceb79fef03 | 83 | */ |
kevman | 0:38ceb79fef03 | 84 | int mbed_error_hist_get_count(void); |
kevman | 0:38ceb79fef03 | 85 | |
kevman | 0:38ceb79fef03 | 86 | /* |
kevman | 0:38ceb79fef03 | 87 | * Resets the error log by resetting the number of errors to 0 and clears all previous errors in the history list |
kevman | 0:38ceb79fef03 | 88 | * |
kevman | 0:38ceb79fef03 | 89 | * @return 0 or MBED_SUCCESS on success. |
kevman | 0:38ceb79fef03 | 90 | * MBED_ERROR_WRITE_FAILED if writing to file failed |
kevman | 0:38ceb79fef03 | 91 | * MBED_ERROR_INVALID_ARGUMENT if path is not valid |
kevman | 0:38ceb79fef03 | 92 | * |
kevman | 0:38ceb79fef03 | 93 | * |
kevman | 0:38ceb79fef03 | 94 | */ |
kevman | 0:38ceb79fef03 | 95 | mbed_error_status_t mbed_error_hist_reset(void); |
kevman | 0:38ceb79fef03 | 96 | |
kevman | 0:38ceb79fef03 | 97 | /* |
kevman | 0:38ceb79fef03 | 98 | * Saves the error log information to a file |
kevman | 0:38ceb79fef03 | 99 | * |
kevman | 0:38ceb79fef03 | 100 | * @param path path to the file in the filesystem |
kevman | 0:38ceb79fef03 | 101 | * @return 0 or MBED_SUCCESS on success. |
kevman | 0:38ceb79fef03 | 102 | * MBED_ERROR_WRITE_FAILED if writing to file failed |
kevman | 0:38ceb79fef03 | 103 | * MBED_ERROR_INVALID_ARGUMENT if path is not valid |
kevman | 0:38ceb79fef03 | 104 | * |
kevman | 0:38ceb79fef03 | 105 | * @note Filesystem support is required in order for this function to work. |
kevman | 0:38ceb79fef03 | 106 | * |
kevman | 0:38ceb79fef03 | 107 | */ |
kevman | 0:38ceb79fef03 | 108 | mbed_error_status_t mbed_save_error_hist(const char *path); |
kevman | 0:38ceb79fef03 | 109 | |
kevman | 0:38ceb79fef03 | 110 | #ifdef __cplusplus |
kevman | 0:38ceb79fef03 | 111 | } |
kevman | 0:38ceb79fef03 | 112 | #endif |
kevman | 0:38ceb79fef03 | 113 | |
kevman | 0:38ceb79fef03 | 114 | #endif |
kevman | 0:38ceb79fef03 | 115 | |
kevman | 0:38ceb79fef03 | 116 |