1 /* 2 * Percepio Trace Recorder for Tracealyzer v4.6.6 3 * Copyright 2021 Percepio AB 4 * www.percepio.com 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 /** 10 * @file 11 * 12 * @brief Public trace interval APIs. 13 */ 14 15 #ifndef TRC_INTERVAL_H 16 #define TRC_INTERVAL_H 17 18 #if (TRC_USE_TRACEALYZER_RECORDER == 1) 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) 25 26 #include <trcTypes.h> 27 28 #define TRC_INTERVAL_CHANNEL_SET_INDEX 0 29 30 /** 31 * @defgroup trace_interval_apis Trace Interval APIs 32 * @ingroup trace_recorder_apis 33 * @{ 34 */ 35 36 /** 37 * @brief Creates trace interval channel set. 38 * 39 * @param[in] szName Name. 40 * @param[out] pxIntervalChannelSetHandle Pointer to uninitialized trace interval channel set. 41 * 42 * @retval TRC_FAIL Failure 43 * @retval TRC_SUCCESS Success 44 */ 45 traceResult xTraceIntervalChannelSetCreate(const char* szName, TraceIntervalChannelSetHandle_t* pxIntervalChannelSetHandle); 46 47 /** 48 * @brief Creates trace interval channel. 49 * 50 * @param[in] szName Name. 51 * @param[in] xIntervalChannelSetHandle Interval set that this channel belongs to. 52 * @param[out] pxIntervalChannelHandle Pointer to uninitialized trace interval channel. 53 * 54 * @retval TRC_FAIL Failure 55 * @retval TRC_SUCCESS Success 56 */ 57 traceResult xTraceIntervalChannelCreate(const char *szName, TraceIntervalChannelSetHandle_t xIntervalChannelSetHandle, TraceIntervalChannelHandle_t *pxIntervalChannelHandle); 58 59 /** 60 * @brief Starts trace interval instance. 61 * 62 * @param[in] xIntervalChannelHandle Interval handle. 63 * @param[in] uxValue Value that can be used to tell instances apart. 64 * @param[out] pxIntervalInstanceHandle Pointer to interval instance variable. 65 * 66 * @retval TRC_FAIL Failure 67 * @retval TRC_SUCCESS Success 68 */ 69 traceResult xTraceIntervalStart(TraceIntervalChannelHandle_t xIntervalChannelHandle, TraceUnsignedBaseType_t uxValue, TraceIntervalInstanceHandle_t* pxIntervalInstanceHandle); 70 71 /** 72 * @brief Stops trace interval instance. 73 * 74 * @param[in] xIntervalChannelHandle Interval handle. 75 * @param[in] xIntervalInstanceHandle Interval instance. 76 * 77 * @retval TRC_FAIL Failure 78 * @retval TRC_SUCCESS Success 79 */ 80 traceResult xTraceIntervalStop(TraceIntervalChannelHandle_t xIntervalChannelHandle, TraceIntervalInstanceHandle_t xIntervalInstanceHandle); 81 82 /** 83 * @brief Gets trace interval channel state. 84 * 85 * @param[in] xIntervalChannelHandle Pointer to initialized trace interval. 86 * @param[out] puxState State. 87 * 88 * @retval TRC_FAIL Failure 89 * @retval TRC_SUCCESS Success 90 */ 91 #define xTraceIntervalGetState(xIntervalChannelHandle, puxState) xTraceEntryGetState((TraceEntryHandle_t)(xIntervalChannelHandle), TRC_INTERVAL_CHANNEL_SET_INDEX, puxState) 92 93 /** @} */ 94 95 #else 96 97 /** 98 * @brief Disabled by TRC_CFG_RECORDER_MODE 99 */ 100 #define xTraceIntervalChannelSetCreate(__szName, __pxIntervalChannelSetHandle) ((void)(__szName), *(__pxIntervalChannelSetHandle) = 0, TRC_SUCCESS) 101 102 /** 103 * @brief Disabled by TRC_CFG_RECORDER_MODE 104 */ 105 #define xTraceIntervalChannelCreate(__szName, __xIntervalChannelSetHandle, __pxIntervalChannelHandle) ((void)(__szName), (void)(__xIntervalChannelSetHandle), *(__pxIntervalChannelHandle) = 0, TRC_SUCCESS) 106 107 /** 108 * @brief Disabled by TRC_CFG_RECORDER_MODE 109 */ 110 #define xTraceIntervalStart(__xIntervalHandle, __uxValue, __pxIntervalInstanceHandle) ((void)(__xIntervalHandle), (void)(__uxValue), *(__pxIntervalInstanceHandle) = 0, TRC_SUCCESS) 111 112 /** 113 * @brief Disabled by TRC_CFG_RECORDER_MODE 114 */ 115 #define xTraceIntervalStop(__xIntervalHandle, __xIntervalInstanceHandle) ((void)(__xIntervalHandle), (void)(__xIntervalInstanceHandle), TRC_SUCCESS) 116 117 /** 118 * @brief Disabled by TRC_CFG_RECORDER_MODE 119 */ 120 #define xTraceIntervalGetState(__xIntervalHandle, __puxState) ((void)(__xIntervalHandle), *(__puxState) = 0, TRC_SUCCESS) 121 122 #endif 123 124 #ifdef __cplusplus 125 } 126 #endif 127 128 #endif 129 130 #endif 131