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 use USB CDC as streaming channel.
10 * The example is for STM32 using STM32Cube.
11 */
12
13#ifndef TRC_STREAM_PORT_H
14#define TRC_STREAM_PORT_H
15
16#include <trcTypes.h>
17#include <trcStreamPortConfig.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#define TRC_USE_INTERNAL_BUFFER 1
24
25#define TRC_INTERNAL_EVENT_BUFFER_WRITE_MODE (TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_WRITE_MODE)
26
27#define TRC_INTERNAL_EVENT_BUFFER_TRANSFER_MODE (TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_TRANSFER_MODE)
28
29#define TRC_INTERNAL_BUFFER_CHUNK_SIZE (TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_SIZE)
30
31#define TRC_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT (TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT)
32
33#define TRC_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT (TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT)
34
35#define TRC_STREAM_PORT_USB_BUFFER_SIZE ((((TRC_CFG_STREAM_PORT_USB_BUFFER_SIZE) + sizeof(TraceUnsignedBaseType_t) - 1) / sizeof(TraceUnsignedBaseType_t)) * sizeof(TraceUnsignedBaseType_t))
36#define TRC_STREAM_PORT_INTERNAL_BUFFER_SIZE ((((TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_SIZE) + sizeof(TraceUnsignedBaseType_t) - 1) / sizeof(TraceUnsignedBaseType_t)) * sizeof(TraceUnsignedBaseType_t))
37
38typedef struct TraceStreamPortBuffer /* Aligned */
39{
40 uint8_t buffer[(TRC_STREAM_PORT_USB_BUFFER_SIZE) + (TRC_STREAM_PORT_INTERNAL_BUFFER_SIZE) + sizeof(TraceUnsignedBaseType_t)];
42
43traceResult prvTraceCDCReceive(void* data, uint32_t uiSize, int32_t* piBytesReceived);
44
45traceResult prvTraceCDCTransmit(void* pvData, uint32_t uiSize, int32_t* piBytesSent);
46
57traceResult xTraceStreamPortInitialize(TraceStreamPortBuffer_t* pxBuffer);
58
68#define xTraceStreamPortAllocate xTraceInternalEventBufferAlloc
69
82#define xTraceStreamPortCommit xTraceInternalEventBufferAllocCommit
83
94#define xTraceStreamPortWriteData prvTraceCDCTransmit
95
106#define xTraceStreamPortReadData prvTraceCDCReceive
107
108#define xTraceStreamPortOnEnable(uiStartOption) ((void)(uiStartOption), TRC_SUCCESS)
109
110#define xTraceStreamPortOnDisable() (TRC_SUCCESS)
111
112#define xTraceStreamPortOnTraceBegin() (TRC_SUCCESS)
113
114#define xTraceStreamPortOnTraceEnd() (TRC_SUCCESS)
115
116#ifdef __cplusplus
117}
118#endif
119
120#endif /* TRC_STREAM_PORT_H */
A structure representing the trace stream port buffer.
Definition: trcStreamPort.h:93