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