Percepio Trace Recorder v4.11.0
Loading...
Searching...
No Matches
trcISR.h
Go to the documentation of this file.
1/*
2* Percepio Trace Recorder for Tracealyzer v4.11.0
3* Copyright 2025 Percepio AB
4* www.percepio.com
5*
6* SPDX-License-Identifier: Apache-2.0
7*/
8
14
15#ifndef TRC_ISR_H
16#define TRC_ISR_H
17
18#if (TRC_USE_TRACEALYZER_RECORDER == 1)
19
20#include <trcTypes.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
31
35typedef struct TraceISRCoreData /* Aligned */
36{
37 TraceISRHandle_t handleStack[TRC_CFG_MAX_ISR_NESTING];
38 int32_t stackIndex;
39 uint32_t isPendingContextSwitch;
40} TraceISRCoreData_t;
41
45typedef struct TraceISRData /* Aligned */
46{
47 TraceISRCoreData_t cores[TRC_CFG_CORE_COUNT]; /* ISR handles */
48} TraceISRData_t;
49
50/* We expose this to enable faster access */
51extern TraceISRData_t* pxTraceISRData;
52
62traceResult xTraceISRInitialize(TraceISRData_t *pxBuffer);
63
91traceResult xTraceISRRegister(const char* szName, uint32_t uiPriority, TraceISRHandle_t* pxISRHandle);
92
104traceResult xTraceISRBegin(TraceISRHandle_t xISRHandle);
105
121traceResult xTraceISREnd(TraceBaseType_t xIsTaskSwitchRequired);
122
123#if ((TRC_CFG_USE_TRACE_ASSERT) == 1)
124
136traceResult xTraceISRGetCurrentNesting(int32_t* puiValue);
137
144
153traceResult xTraceISRGetCurrent(TraceISRHandle_t* pxISRHandle);
154
155#else /* ((TRC_CFG_USE_TRACE_ASSERT) == 1) */
156
168#define xTraceISRGetCurrentNesting(puiValue) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_2(*(puiValue) = pxTraceISRData->cores[TRC_CFG_GET_CURRENT_CORE()].stackIndex, TRC_SUCCESS)
169
175#define xTraceISRGetCurrentNestingReturned() (pxTraceISRData->cores[TRC_CFG_GET_CURRENT_CORE()].stackIndex)
176
188#define xTraceISRGetCurrent(pxISRHandle) (xTraceISRGetCurrentNestingReturned() >= 0 ? (*(pxISRHandle) = pxTraceISRData->cores[TRC_CFG_GET_CURRENT_CORE()].handleStack[xTraceISRGetCurrentNestingReturned()], TRC_SUCCESS) : TRC_FAIL)
189
190#endif /* ((TRC_CFG_USE_TRACE_ASSERT) == 1) */
191
193TraceISRHandle_t xTraceSetISRProperties(const char* szName, uint32_t uiPriority);
194
196#define xTraceGetCurrentISRNesting(puiValue) xTraceISRGetCurrentNesting(puiValue)
197
199#define vTraceStoreISRBegin(xISRHandle) xTraceISRBegin(xISRHandle)
200
202#define vTraceStoreISREnd(xIsTaskSwitchRequired) xTraceISREnd(xIsTaskSwitchRequired)
203
205
206#ifdef __cplusplus
207}
208#endif
209
210#else
211
212#define xTraceISRRegister(_szName, _uiPriority, _pxISRHandle) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_4((void)(_szName), (void)(_uiPriority), (void)(_pxISRHandle), TRC_SUCCESS)
213
214#define xTraceISRBegin(_xISRHandle) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_2((void)(_xISRHandle), TRC_SUCCESS)
215
216#define xTraceISREnd(_xIsTaskSwitchRequired) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_2((void)(_xIsTaskSwitchRequired), TRC_SUCCESS)
217
218#define xTraceISRGetCurrentNesting(_puiValue) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_2((void)(_puiValue), 0)
219
220#define xTraceISRGetCurrentNestingReturned() (1)
221
222#define xTraceISRGetCurrent(_pxISRHandle) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_2((void)(_pxISRHandle), TRC_SUCCESS)
223
225#define xTraceSetISRProperties(_szName, _uiPriority) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_3((void)(_szName), (void)(_uiPriority), TRC_SUCCESS)
226
228#define xTraceGetCurrentISRNesting(_puiValue) xTraceISRGetCurrentNesting(_puiValue)
229
231#define vTraceStoreISRBegin(_xISRHandle) xTraceISRBegin(_xISRHandle)
232
234#define vTraceStoreISREnd(_xIsTaskSwitchRequired) xTraceISREnd(_xIsTaskSwitchRequired)
235
236#endif
237
238#endif
#define xTraceISRGetCurrentNesting(puiValue)
Gets current trace ISR nesting level.
Definition trcISR.h:168
traceResult xTraceISRRegister(const char *szName, uint32_t uiPriority, TraceISRHandle_t *pxISRHandle)
Registers trace ISR.
Definition trcISR.c:70
traceResult xTraceISREnd(TraceBaseType_t xIsTaskSwitchRequired)
Registers the end of an Interrupt Service Routine.
Definition trcCTI.c:1211
traceResult xTraceISRBegin(TraceISRHandle_t xISRHandle)
Registers the beginning of an Interrupt Service Routine.
Definition trcISR.c:117
#define xTraceISRGetCurrent(pxISRHandle)
Gets current trace ISR nesting level.
Definition trcISR.h:188
#define xTraceISRGetCurrentNestingReturned()
Definition trcISR.h:175