Percepio Trace Recorder  v4.6.6
trcStreamPort.h
1 /*
2  * 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  * The interface definitions for trace streaming ("stream ports").
9  * This "stream port" sets up the recorder to use XMOS xScope as a streaming channel.
10  */
11 
12 #ifndef TRC_STREAMING_PORT_H
13 #define TRC_STREAMING_PORT_H
14 
15 #if (TRC_USE_TRACEALYZER_RECORDER == 1)
16 
17 #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include <trcTypes.h>
24 #include <trcStreamPortConfig.h>
25 
26 #define TRC_USE_INTERNAL_BUFFER (TRC_CFG_STREAM_PORT_USE_INTERNAL_BUFFER)
27 
28 /* Aligned */
29 #define TRC_STREAM_PORT_INTERNAL_BUFFER_SIZE ((((TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_SIZE) + sizeof(TraceUnsignedBaseType_t) - 1) / sizeof(TraceUnsignedBaseType_t)) * sizeof(TraceUnsignedBaseType_t))
30 
34 typedef struct TraceStreamPortBuffer
35 {
36 #if (TRC_USE_INTERNAL_BUFFER == 1)
37  uint8_t uiBufferInternal[TRC_STREAM_PORT_INTERNAL_BUFFER_SIZE];
38 #endif
39  uint8_t uiBuffer[4];
41 
51 traceResult xTraceStreamPortInitialize(TraceStreamPortBuffer_t* pxBuffer);
52 
61 traceResult xTraceStreamPortOnBegin(void);
62 
71 traceResult xTraceStreamPortOnEnd(void);
72 
82 traceResult xTraceStreamPortAllocate(uint32_t uiSize, void** ppvData);
83 
96 traceResult xTraceStreamPortCommit(void* pvData, uint32_t uiSize, int32_t* piBytesCommitted);
97 
108 traceResult xTraceStreamPortWriteData(void* pvData, uint32_t uiSize, int32_t* piBytesWritten);
109 
120 traceResult xTraceStreamPortReadData(void* pvData, uint32_t uiSize, int32_t* piBytesRead);
121 
122 #define xTraceStreamPortOnEnable(uiStartOption) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_2((void)(uiStartOption), TRC_SUCCESS)
123 
124 #define xTraceStreamPortOnDisable() TRC_COMMA_EXPR_TO_STATEMENT_EXPR_1(TRC_SUCCESS)
125 
126 #define xTraceStreamPortOnTraceBegin() TRC_COMMA_EXPR_TO_STATEMENT_EXPR_1(TRC_SUCCESS)
127 
128 #define xTraceStreamPortOnTraceEnd() TRC_COMMA_EXPR_TO_STATEMENT_EXPR_1(TRC_SUCCESS)
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/
135 
136 #endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/
137 
138 #endif /* TRC_STREAMING_PORT_H */
TraceStreamPortBuffer
A structure representing the trace stream port buffer.
Definition: trcStreamPort.h:80