Percepio Trace Recorder v4.11.0
Loading...
Searching...
No Matches
trcKernelPort.h
1/*
2 * 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 * For bare-metal use of Tracealyzer (no RTOS)
9 */
10
11#ifndef TRC_KERNEL_PORT_H
12#define TRC_KERNEL_PORT_H
13
14#include <trcDefines.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#define TRC_USE_TRACEALYZER_RECORDER (TRC_CFG_USE_TRACEALYZER_RECORDER) /* Allows for disabling the recorder */
21
22#if (TRC_USE_TRACEALYZER_RECORDER == 1)
23
24#undef TRC_CFG_ENABLE_STACK_MONITOR
25#define TRC_CFG_ENABLE_STACK_MONITOR 0
26
27/*** Don't change the below definitions, unless you know what you are doing! ***/
28
29#define TRACE_KERNEL_VERSION 0x1FF1
30
31/* Dummy definitions, since no RTOS */
32#define TRC_TICK_RATE_HZ 1 /* Must not be 0. */
33
38#define TRACE_CPU_CLOCK_HZ TRC_CFG_CPU_CLOCK_HZ
39
40#if (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC)
41#include <stdlib.h> /* Include malloc() */
42
46#define TRC_KERNEL_PORT_HEAP_INIT(size)
47
51#define TRC_KERNEL_PORT_HEAP_MALLOC(size) malloc(size)
52#endif
53
57
64#define TRC_PLATFORM_CFG "generic"
65
71#define TRC_PLATFORM_CFG_MAJOR 1
72
78#define TRC_PLATFORM_CFG_MINOR 0
79
85#define TRC_PLATFORM_CFG_PATCH 0
86
87#ifndef TRACE_ENTER_CRITICAL_SECTION
88 #error "This hardware port has no definition for critical sections! See https://percepio.com/how-to-define-critical-sections-for-the-recorder/"
89#endif
90
91#define TRC_KERNEL_PORT_BUFFER_SIZE (sizeof(TraceTaskHandle_t) * (TRC_CFG_CORE_COUNT))
92
96typedef struct TraceKernelPortDataBuffer /* Aligned */
97{
98 uint8_t buffer[TRC_KERNEL_PORT_BUFFER_SIZE];
99} TraceKernelPortDataBuffer_t;
100
109traceResult xTraceKernelPortInitialize(TraceKernelPortDataBuffer_t* const pxBuffer);
110
117traceResult xTraceKernelPortEnable(void);
118
127#define xTraceKernelPortDelay(uiTicks) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_2((void)uiTicks, TRC_SUCCESS)
128
135#define xTraceKernelPortIsSchedulerSuspended() (0U)
136
137/*************************************************************************/
138/* KERNEL SPECIFIC OBJECT CONFIGURATION */
139/*************************************************************************/
140
141/*******************************************************************************
142 * The event codes - should match the offline config file.
143 ******************************************************************************/
144
145/*** Event codes for streaming - should match the Tracealyzer config file *****/
146#define PSF_EVENT_NULL_EVENT 0x00UL
147
148#define PSF_EVENT_TRACE_START 0x01UL
149#define PSF_EVENT_TS_CONFIG 0x02UL
150#define PSF_EVENT_OBJ_NAME 0x03UL
151#define PSF_EVENT_TASK_PRIORITY 0x04UL
152#define PSF_EVENT_DEFINE_ISR 0x05UL
153
154#define PSF_EVENT_IFE_NEXT 0x08UL
155#define PSF_EVENT_IFE_DIRECT 0x09UL
156
157#define PSF_EVENT_TASK_CREATE 0x10UL
158#define PSF_EVENT_TASK_DELETE 0x11UL
159#define PSF_EVENT_PROCESS_CREATE 0x12UL
160#define PSF_EVENT_PROCESS_DELETE 0x13UL
161#define PSF_EVENT_THREAD_CREATE 0x14UL
162#define PSF_EVENT_THREAD_DELETE 0x15UL
163
164#define PSF_EVENT_TASK_READY 0x20UL
165#define PSF_EVENT_ISR_BEGIN 0x21UL
166#define PSF_EVENT_ISR_RESUME 0x22UL
167#define PSF_EVENT_TS_BEGIN 0x23UL
168#define PSF_EVENT_TS_RESUME 0x24UL
169#define PSF_EVENT_TASK_ACTIVATE 0x25UL
170
171#define PSF_EVENT_MALLOC 0x30UL
172#define PSF_EVENT_FREE 0x31UL
173#define PSF_EVENT_MALLOC_FAILED 0x32UL
174#define PSF_EVENT_FREE_FAILED 0x33UL
175
176#define PSF_EVENT_LOWPOWER_BEGIN 0x38UL
177#define PSF_EVENT_LOWPOWER_END 0x39UL
178
179#define PSF_EVENT_STATEMACHINE_STATE_CREATE 0x40UL
180#define PSF_EVENT_STATEMACHINE_CREATE 0x41UL
181#define PSF_EVENT_STATEMACHINE_STATECHANGE 0x42UL
182
183#define PSF_EVENT_INTERVAL_CHANNEL_CREATE 0x43UL
184#define PSF_EVENT_INTERVAL_START 0x44UL
185#define PSF_EVENT_INTERVAL_STOP 0x45UL
186#define PSF_EVENT_INTERVAL_CHANNEL_SET_CREATE 0x46UL
187
188#define PSF_EVENT_EXTENSION_CREATE 0x47UL
189
190#define PSF_EVENT_HEAP_CREATE 0x48UL
191
192#define PSF_EVENT_COUNTER_CREATE 0x49UL
193#define PSF_EVENT_COUNTER_CHANGE 0x4AUL
194#define PSF_EVENT_COUNTER_LIMIT_EXCEEDED 0x4BUL
195
196#define PSF_EVENT_DEPENDENCY_REGISTER 0x4CUL
197
198#define PSF_EVENT_RUNNABLE_REGISTER 0x4DUL
199#define PSF_EVENT_RUNNABLE_START 0x4EUL
200#define PSF_EVENT_RUNNABLE_STOP 0x4FUL
201
202#define PSF_EVENT_USER_EVENT 0x50UL
203
204#define PSF_EVENT_USER_EVENT_FIXED 0x58UL
205
206#define TRC_EVENT_LAST_ID (PSF_EVENT_USER_EVENT_FIXED + 8ul)
207
208#endif
209
210#ifdef __cplusplus
211}
212#endif
213
214#endif
A structure representing the kernel port buffer.
Definition trcKernelPort.h:97