1 /* 2 * Percepio Trace Recorder SDK for Tracealyzer v4.5.1 3 * Copyright 2021 Percepio AB 4 * www.percepio.com 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 * 8 * The interface for the internal buffer. 9 */ 10 11 #ifndef TRC_INTERNAL_BUFFER_H 12 #define TRC_INTERNAL_BUFFER_H 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 #include "trcRecorder.h" 19 20 21 #if (TRC_USE_TRACEALYZER_RECORDER == 1) && (TRC_STREAM_PORT_USE_INTERNAL_BUFFER == 1) 22 23 /** 24 * @brief Initializes the paged event buffer used by certain stream ports. 25 * 26 * @param buffer Pointer to previously allocated memory buffer 27 */ 28 void prvPagedEventBufferInit(char* buffer); 29 30 /** 31 * @brief Retrieve a pointer to an available location in the buffer able 32 * to store the requested size. 33 * 34 * @param sizeOfEvent Size of the event that is to be placed in the buffer. 35 * @return void* Pointer to free buffer memory area. 36 */ 37 void* prvPagedEventBufferGetWritePointer(int sizeOfEvent); 38 39 /** 40 * @brief Transfers one buffer page of trace data, if a full page is available, 41 * using the macro TRC_STREAM_PORT_WRITE_DATA as defined in trcStreamingPort.h. 42 * 43 * This function is intended to be called the periodic TzCtrl task with a 44 * suitable delay (e.g. 10-100 ms). 45 * 46 * In case of errors from the streaming interface, it registers a warning 47 * (PSF_WARNING_STREAM_PORT_WRITE) provided by xTraceGetLastError(). 48 * 49 * @return uint32_t The number of bytes sent. If non-zero, it is good to call this 50 * again, in order to send any additional data waiting in the buffer. 51 * If zero, wait a while before calling again. 52 */ 53 uint32_t prvPagedEventBufferTransfer(void); 54 55 #endif /*(TRC_USE_TRACEALYZER_RECORDER == 1) && (TRC_STREAM_PORT_USE_INTERNAL_BUFFER == 1)*/ 56 57 #ifdef __cplusplus 58 } 59 #endif 60 61 #endif /* TRC_INTERNAL_BUFFER_H */ 62