Percepio Trace Recorder v4.8.0.hotfix1
Loading...
Searching...
No Matches
trcInternalEventBuffer.h
Go to the documentation of this file.
1/*
2 * Percepio 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
15#ifndef TRC_INTERNAL_BUFFER_H
16#define TRC_INTERNAL_BUFFER_H
17
18#if (TRC_USE_TRACEALYZER_RECORDER == 1)
19
20#include <trcDefines.h>
21
22#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
23
24#ifndef TRC_USE_INTERNAL_BUFFER
25#define TRC_USE_INTERNAL_BUFFER 1
26#endif
27
28#ifndef TRC_INTERNAL_EVENT_BUFFER_WRITE_MODE
29#define TRC_INTERNAL_EVENT_BUFFER_WRITE_MODE TRC_INTERNAL_EVENT_BUFFER_OPTION_WRITE_MODE_DIRECT
30#endif
31
32#ifndef TRC_INTERNAL_EVENT_BUFFER_TRANSFER_MODE
33#define TRC_INTERNAL_EVENT_BUFFER_TRANSFER_MODE TRC_INTERNAL_EVENT_BUFFER_OPTION_TRANSFER_MODE_ALL
34#endif
35
36#ifndef TRC_INTERNAL_BUFFER_CHUNK_SIZE
37#define TRC_INTERNAL_BUFFER_CHUNK_SIZE 1024UL
38#endif
39
40#ifndef TRC_INTERNAL_BUFFER_PAGE_SIZE
41#define TRC_INTERNAL_BUFFER_PAGE_SIZE 1024UL
42#endif
43
44#ifndef TRC_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT
45#define TRC_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT (TRC_INTERNAL_BUFFER_PAGE_SIZE / 2UL)
46#endif
47
48#ifndef TRC_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT
49#define TRC_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT (5UL)
50#endif
51
52#if (TRC_USE_INTERNAL_BUFFER == 1)
53
54#include <trcTypes.h>
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
75traceResult xTraceInternalEventBufferInitialize(uint8_t* puiBuffer, uint32_t uiSize);
76
86traceResult xTraceInternalEventBufferAlloc(uint32_t uiSize, void **ppvData);
87
104traceResult xTraceInternalEventBufferAllocCommit(void *pvData, uint32_t uiSize, int32_t *piBytesWritten);
105
116traceResult xTraceInternalEventBufferPush(void *pvData, uint32_t uiSize, int32_t *piBytesWritten);
117
118#if (TRC_INTERNAL_EVENT_BUFFER_TRANSFER_MODE == TRC_INTERNAL_EVENT_BUFFER_OPTION_TRANSFER_MODE_ALL)
119#define xTraceInternalEventBufferTransfer xTraceInternalEventBufferTransferAll
120#else
121#define xTraceInternalEventBufferTransfer xTraceInternalEventBufferTransferChunk
122#endif
123
138
156
164
167#ifdef __cplusplus
168}
169#endif
170
171#else /* (TRC_USE_INTERNAL_BUFFER == 1)*/
172
173#define xTraceInternalEventBufferInitialize(puiBuffer, uiSize) ((void)(uiSize), (puiBuffer) != 0 ? TRC_SUCCESS : TRC_FAIL)
174#define xTraceInternalEventBufferAlloc(ppvData, uiSize) ((void)(uiSize), (ppvData) != 0 ? TRC_SUCCESS : TRC_FAIL)
175#define xTraceInternalEventBufferAllocCommit(pvData, uiSize, piBytesWritten) ((void)(pvData), (void)(uiSize), (void)(piBytesWritten), TRC_SUCCESS)
176#define xTraceInternalEventBufferPush(pvData, uiSize, piBytesWritten) ((void)(uiSize), (void)(piBytesWritten), (pvData) != 0 ? TRC_SUCCESS : TRC_FAIL)
177#define xTraceInternalEventBufferTransfer() (void)(TRC_SUCCESS)
178#define xTraceInternalEventBufferTransferChunk(piBytesWritten, uiChunkSize) ((void)(piBytesWritten), (void)(uiChunkSize), TRC_SUCCESS)
179#define xTraceInternalEventBufferClear() (void)(TRC_SUCCESS)
180
181#endif /* (TRC_USE_INTERNAL_BUFFER == 1)*/
182
183#endif /* (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) */
184
185#endif /* (TRC_USE_TRACEALYZER_RECORDER == 1) */
186
187#endif /* TRC_INTERNAL_BUFFER_H */
traceResult xTraceInternalEventBufferAlloc(uint32_t uiSize, void **ppvData)
Allocates a data slot directly from the internal event buffer.
traceResult xTraceInternalEventBufferTransferChunk(void)
Transfer internal trace event buffer data through streamport.
traceResult xTraceInternalEventBufferPush(void *pvData, uint32_t uiSize, int32_t *piBytesWritten)
Pushes data to the internal trace event buffer.
traceResult xTraceInternalEventBufferAllocCommit(void *pvData, uint32_t uiSize, int32_t *piBytesWritten)
Commits the last allocated block to the internal event buffer.
traceResult xTraceInternalEventBufferClear(void)
Clears all trace events in the internal trace event buffer.
traceResult xTraceInternalEventBufferTransferAll(void)
Transfers all internal trace event buffer data using the function xTraceStreamPortWriteData(....