Percepio Trace Recorder  v4.6.6
trcISR.h
Go to the documentation of this file.
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 
15 #ifndef TRC_ISR_H
16 #define TRC_ISR_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 
37 typedef struct TraceISRCoreInfo
38 {
39  TraceISRHandle_t handleStack[TRC_CFG_MAX_ISR_NESTING];
40  int32_t stackIndex;
41  int32_t isPendingContextSwitch;
42 } TraceISRCoreInfo_t;
43 
47 typedef struct TraceISRInfo
48 {
49  TraceISRCoreInfo_t coreInfos[TRC_CFG_CORE_COUNT]; /* ISR handles */
50 } TraceISRInfo_t;
51 
52 /* We expose this to enable faster access */
53 extern TraceISRInfo_t* pxTraceISRInfo;
54 
55 #define TRACE_ISR_INFO_BUFFER_SIZE (sizeof(TraceISRInfo_t))
56 
60 typedef struct TraceISRInfoBuffer
61 {
62  uint8_t buffer[(TRACE_ISR_INFO_BUFFER_SIZE)];
63 } TraceISRInfoBuffer_t;
64 
74 traceResult xTraceISRInitialize(TraceISRInfoBuffer_t *pxBuffer);
75 
103 traceResult xTraceISRRegister(const char* szName, uint32_t uiPriority, TraceISRHandle_t* pxISRHandle);
104 
116 traceResult xTraceISRBegin(TraceISRHandle_t xISRHandle);
117 
133 traceResult xTraceISREnd(TraceBaseType_t xIsTaskSwitchRequired);
134 
135 #if ((TRC_CFG_USE_TRACE_ASSERT) == 1)
136 
148 traceResult xTraceISRGetCurrentNesting(int32_t* puiValue);
149 
156 
165 traceResult xTraceISRGetCurrent(TraceISRHandle_t* pxISRHandle);
166 
167 #else /* ((TRC_CFG_USE_TRACE_ASSERT) == 1) */
168 
180 #define xTraceISRGetCurrentNesting(puiValue) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_2(*(puiValue) = pxTraceISRInfo->coreInfos[TRC_CFG_GET_CURRENT_CORE()].stackIndex, TRC_SUCCESS)
181 
187 #define xTraceISRGetCurrentNestingReturned() (pxTraceISRInfo->coreInfos[TRC_CFG_GET_CURRENT_CORE()].stackIndex)
188 
200 #define xTraceISRGetCurrent(pxISRHandle) (xTraceISRGetCurrentNestingReturned() >= 0 ? (*(pxISRHandle) = pxTraceISRInfo->coreInfos[TRC_CFG_GET_CURRENT_CORE()].handleStack[xTraceISRGetCurrentNestingReturned()], TRC_SUCCESS) : TRC_FAIL)
201 
202 #endif /* ((TRC_CFG_USE_TRACE_ASSERT) == 1) */
203 
205 TraceISRHandle_t xTraceSetISRProperties(const char* szName, uint32_t uiPriority);
206 
208 #define xTraceGetCurrentISRNesting(puiValue) xTraceISRGetCurrentNesting(puiValue)
209 
211 #define vTraceStoreISRBegin(xISRHandle) xTraceISRBegin(xISRHandle)
212 
214 #define vTraceStoreISREnd(xIsTaskSwitchRequired) xTraceISREnd(xIsTaskSwitchRequired)
215 
218 #ifdef __cplusplus
219 }
220 #endif
221 
222 #endif
223 
224 #endif
225 
226 #endif
xTraceISRRegister
traceResult xTraceISRRegister(const char *szName, uint32_t uiPriority, TraceISRHandle_t *pxISRHandle)
Registers trace ISR.
Definition: trcISR.c:50
xTraceISRBegin
traceResult xTraceISRBegin(TraceISRHandle_t xISRHandle)
Registers the beginning of an Interrupt Service Routine.
Definition: trcISR.c:109
xTraceISRGetCurrent
#define xTraceISRGetCurrent(pxISRHandle)
Gets current trace ISR nesting level.
Definition: trcISR.h:200
xTraceISRGetCurrentNesting
#define xTraceISRGetCurrentNesting(puiValue)
Gets current trace ISR nesting level.
Definition: trcISR.h:180
xTraceISRGetCurrentNestingReturned
#define xTraceISRGetCurrentNestingReturned()
Definition: trcISR.h:187
xTraceISREnd
traceResult xTraceISREnd(TraceBaseType_t xIsTaskSwitchRequired)
Registers the end of an Interrupt Service Routine.
Definition: trcCTI.c:1952