Percepio Trace Recorder v4.8.0.hotfix1
Loading...
Searching...
No Matches
trcKernelPort.h
1/*
2 * Trace Recorder for Tracealyzer v4.8.0.hotfix1
3 * Copyright 2023 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
54#define TRC_PLATFORM_CFG "nokernel"
55#define TRC_PLATFORM_CFG_MAJOR 1
56#define TRC_PLATFORM_CFG_MINOR 0
57#define TRC_PLATFORM_CFG_PATCH 0
58
59#ifndef TRACE_ENTER_CRITICAL_SECTION
60 #error "This hardware port has no definition for critical sections! See http://percepio.com/2014/10/27/how-to-define-critical-sections-for-the-recorder/"
61#endif
62
63#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
64#define TRC_KERNEL_PORT_BUFFER_SIZE (sizeof(TraceTaskHandle_t) * (TRC_CFG_CORE_COUNT))
65#else
66#define TRC_KERNEL_PORT_BUFFER_SIZE (sizeof(TraceUnsignedBaseType_t) * (TRC_CFG_CORE_COUNT))
67#endif
68
72typedef struct TraceKernelPortDataBuffer /* Aligned */
73{
74 uint8_t buffer[TRC_KERNEL_PORT_BUFFER_SIZE];
76
85traceResult xTraceKernelPortInitialize(TraceKernelPortDataBuffer_t* const pxBuffer);
86
93traceResult xTraceKernelPortEnable(void);
94
103#define xTraceKernelPortDelay(uiTicks) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_2((void)uiTicks, TRC_SUCCESS)
104
111#define xTraceKernelPortIsSchedulerSuspended() (0U)
112
113/******************************************************************************/
114/*** Definitions for Snapshot mode ********************************************/
115/******************************************************************************/
116#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)
117
118#endif
119
120/******************************************************************************/
121/*** Definitions for Streaming mode *******************************************/
122/******************************************************************************/
123#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
124
125/*************************************************************************/
126/* KERNEL SPECIFIC OBJECT CONFIGURATION */
127/*************************************************************************/
128
129/*******************************************************************************
130 * The event codes - should match the offline config file.
131 ******************************************************************************/
132
133/*** Event codes for streaming - should match the Tracealyzer config file *****/
134#define PSF_EVENT_NULL_EVENT 0x00UL
135
136#define PSF_EVENT_TRACE_START 0x01UL
137#define PSF_EVENT_TS_CONFIG 0x02UL
138#define PSF_EVENT_OBJ_NAME 0x03UL
139#define PSF_EVENT_TASK_PRIORITY 0x04UL
140#define PSF_EVENT_DEFINE_ISR 0x05UL
141
142#define PSF_EVENT_IFE_NEXT 0x08UL
143#define PSF_EVENT_IFE_DIRECT 0x09UL
144
145#define PSF_EVENT_TASK_CREATE 0x10UL
146#define PSF_EVENT_TASK_DELETE 0x11UL
147
148#define PSF_EVENT_TASK_READY 0x20UL
149#define PSF_EVENT_ISR_BEGIN 0x21UL
150#define PSF_EVENT_ISR_RESUME 0x22UL
151#define PSF_EVENT_TS_BEGIN 0x23UL
152#define PSF_EVENT_TS_RESUME 0x24UL
153#define PSF_EVENT_TASK_ACTIVATE 0x25UL
154
155#define PSF_EVENT_MALLOC 0x30UL
156#define PSF_EVENT_FREE 0x31UL
157#define PSF_EVENT_MALLOC_FAILED 0x32UL
158#define PSF_EVENT_FREE_FAILED 0x33UL
159
160#define PSF_EVENT_LOWPOWER_BEGIN 0x38UL
161#define PSF_EVENT_LOWPOWER_END 0x39UL
162
163#define PSF_EVENT_STATEMACHINE_STATE_CREATE 0x40UL
164#define PSF_EVENT_STATEMACHINE_CREATE 0x41UL
165#define PSF_EVENT_STATEMACHINE_STATECHANGE 0x42UL
166
167#define PSF_EVENT_INTERVAL_CHANNEL_CREATE 0x43UL
168#define PSF_EVENT_INTERVAL_START 0x44UL
169#define PSF_EVENT_INTERVAL_STOP 0x45UL
170#define PSF_EVENT_INTERVAL_CHANNEL_SET_CREATE 0x46UL
171
172#define PSF_EVENT_EXTENSION_CREATE 0x47UL
173
174#define PSF_EVENT_HEAP_CREATE 0x48UL
175
176#define PSF_EVENT_COUNTER_CREATE 0x49UL
177#define PSF_EVENT_COUNTER_CHANGE 0x4AUL
178#define PSF_EVENT_COUNTER_LIMIT_EXCEEDED 0x4BUL
179
180#define PSF_EVENT_DEPENDENCY_REGISTER 0x4CUL
181
182#define PSF_EVENT_RUNNABLE_REGISTER 0x4DUL
183#define PSF_EVENT_RUNNABLE_START 0x4EUL
184#define PSF_EVENT_RUNNABLE_STOP 0x4FUL
185
186#define PSF_EVENT_USER_EVENT 0x50UL
187
188#define PSF_EVENT_USER_EVENT_FIXED 0x58UL
189
190#define TRC_EVENT_LAST_ID (PSF_EVENT_DEPENDENCY_REGISTER)
191
192#endif
193
194#endif
195
196#ifdef __cplusplus
197}
198#endif
199
200#endif /* TRC_KERNEL_PORT_H */
A structure representing the kernel port buffer.
Definition: trcKernelPort.h:73