1 /* 2 * Percepio Trace Recorder for Tracealyzer v4.8.1 3 * Copyright 2023 Percepio AB 4 * www.percepio.com 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 /** 10 * @file 11 * 12 * @brief Public trace error APIs. 13 */ 14 15 #ifndef TRC_ERROR_H 16 #define TRC_ERROR_H 17 18 #if (TRC_USE_TRACEALYZER_RECORDER == 1) 19 20 #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) 21 22 #include <trcTypes.h> 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /** 29 * @defgroup trace_assert_apis Trace Asserts APIs 30 * @ingroup trace_recorder_apis 31 * @{ 32 */ 33 34 typedef struct TraceErrorData /* Aligned */ 35 { 36 uint32_t uiErrorAndWarningFlags; 37 uint32_t uiErrorCode; 38 TraceStringHandle_t xWarningChannel; 39 } TraceErrorData_t; 40 41 /** 42 * @internal Initializes the error system 43 * 44 * @param[in] pxBuffer Pointer to buffer 45 * 46 * @retval TRC_FAIL Failure 47 * @retval TRC_SUCCESS Success 48 */ 49 traceResult xTraceErrorInitialize(TraceErrorData_t* pxBuffer); 50 51 /** 52 * @brief Register a warning 53 * 54 * @param[in] uiErrorCode Label 55 * 56 * @retval TRC_FAIL Failure 57 * @retval TRC_SUCCESS Success 58 */ 59 traceResult xTraceWarning(uint32_t uiErrorCode); 60 61 /** 62 * @brief Register an error 63 * 64 * @param[in] uiErrorCode Error code 65 * 66 * @retval TRC_FAIL Failure 67 * @retval TRC_SUCCESS Success 68 */ 69 traceResult xTraceError(uint32_t uiErrorCode); 70 71 /** 72 * @brief Retrieve the string for the last error 73 * 74 * @param[out] pszError Error string pointer 75 * 76 * @retval TRC_FAIL Failure 77 * @retval TRC_SUCCESS Success 78 */ 79 traceResult xTraceErrorGetLast(const char** pszError); 80 81 /** 82 * @brief Clears any errors 83 * 84 * @retval TRC_FAIL Failure 85 * @retval TRC_SUCCESS Success 86 */ 87 traceResult xTraceErrorClear(void); 88 89 /** @} */ 90 91 #ifdef __cplusplus 92 } 93 #endif 94 95 #endif /* (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) */ 96 97 #endif /* (TRC_USE_TRACEALYZER_RECORDER == 1) */ 98 99 #endif /* TRC_ERROR_H*/ 100