Percepio Trace Recorder v4.8.0.hotfix1
Loading...
Searching...
No Matches
trcStreamPort.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* The interface definitions for trace streaming ("stream ports").
9* This "stream port" sets up the recorder to stream to a Ring Buffer.
10*/
11
12#ifndef TRC_STREAM_PORT_H
13#define TRC_STREAM_PORT_H
14
15#if (TRC_USE_TRACEALYZER_RECORDER == 1)
16
17#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
18
19#include <trcTypes.h>
20#include <trcStreamPortConfig.h>
21#include <trcRecorder.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
32#define TRC_EXTERNAL_BUFFERS 1
33
39#define TRC_SEND_NAME_ONLY_ON_DELETE 1
40
47#define TRC_USE_INTERNAL_BUFFER 0
48
49#define TRC_STREAM_PORT_BUFFER_SIZE (((uint32_t)(TRC_CFG_STREAM_PORT_BUFFER_SIZE) / sizeof(TraceUnsignedBaseType_t)) * sizeof(TraceUnsignedBaseType_t)) /* aligned */
50
54typedef struct TraceMultiCoreBuffer /* Aligned */
55{
56 TraceUnsignedBaseType_t uxSize; /* aligned */
57 uint8_t uiBuffer[TRC_STREAM_PORT_BUFFER_SIZE]; /* size is aligned */
58} TraceMultiCoreBuffer_t;
59
63typedef struct TraceRingBuffer
64{
65 uint32_t reserved0; /* alignment with START_MARKERS */
66 volatile uint8_t START_MARKERS[12];
67 TraceHeaderBuffer_t xHeaderBuffer; /* aligned */
68 TraceTimestampData_t xTimestampInfo; /* aligned */
69 TraceEntryTable_t xEntryTable; /* aligned */
70 TraceMultiCoreBuffer_t xEventBuffer; /* aligned */
71 volatile uint8_t END_MARKERS[12];
72 uint32_t reserved1; /* alignment */
73} TraceRingBuffer_t;
74
78typedef struct TraceStreamPortData
79{
80 TraceMultiCoreEventBuffer_t xMultiCoreEventBuffer;
81 TraceRingBuffer_t xRingBuffer;
82} TraceStreamPortData_t;
83
84extern TraceStreamPortData_t* pxStreamPortData;
85
90#define TRC_STREAM_PORT_DATA_BUFFER_SIZE (sizeof(TraceStreamPortData_t))
91
95typedef struct TraceStreamPortBuffer
96{
97 uint8_t buffer[(TRC_STREAM_PORT_DATA_BUFFER_SIZE)];
99
110traceResult xTraceStreamPortInitialize(TraceStreamPortBuffer_t* pxBuffer);
111
121#define xTraceStreamPortAllocate(_uiSize, _ppvData) xTraceMultiCoreEventBufferAlloc(&pxStreamPortData->xMultiCoreEventBuffer, _uiSize, _ppvData)
122
135#define xTraceStreamPortCommit(_pvData, _uiSize, _piBytesCommitted) xTraceMultiCoreEventBufferAllocCommit(&pxStreamPortData->xMultiCoreEventBuffer, _pvData, _uiSize, _piBytesCommitted)
136
147#define xTraceStreamPortWriteData(_pvData, _uiSize, _piBytesWritten) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_4((void)(_pvData), (void)(_uiSize), (void)(_piBytesWritten), TRC_SUCCESS)
148
159#define xTraceStreamPortReadData(pvData, uiSize, piBytesRead) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_4((void)(pvData), (void)(uiSize), (void)(piBytesRead), TRC_SUCCESS)
160
169#define xTraceStreamPortOnEnable(uiStartOption) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_2((void)(uiStartOption), TRC_SUCCESS)
170
177#define xTraceStreamPortOnDisable() TRC_COMMA_EXPR_TO_STATEMENT_EXPR_1(TRC_SUCCESS)
178
185traceResult xTraceStreamPortOnTraceBegin(void);
186
193#define xTraceStreamPortOnTraceEnd() TRC_COMMA_EXPR_TO_STATEMENT_EXPR_1(TRC_SUCCESS)
194
195#ifdef __cplusplus
196}
197#endif
198
199#endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/
200
201#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/
202
203#endif /* TRC_STREAM_PORT_H */
Trace Multi-Core Event Buffer Structure.
Definition: trcMultiCoreEventBuffer.h:38
A structure representing the trace stream port buffer.
Definition: trcStreamPort.h:93
Trace Timestamp Structure.
Definition: trcTimestamp.h:38
The public API of the Percepio trace recorder.