mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-17 02:07:48 -04:00
Percepio Trace Recorder v4.6.0 (#789)
* * Percepio Trace Recorder v4.6.0 * Add space between inclusion of header and comment * Fix broken posix build - part 1 * Add percepio timer implementation * Remove delted trace recorder header file * Fix Networking demo build * Fix CLI demo * Fix visual studio version number * Fix core header check * Fix more core checks * Fix last of core checks Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Co-authored-by: Alfred Gedeon <alfred2g@hotmail.com>
This commit is contained in:
parent
aa316fc1b4
commit
c568ba8c44
143 changed files with 23823 additions and 16781 deletions
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* Percepio Trace Recorder for Tracealyzer v4.6.0
|
||||
* Copyright 2021 Percepio AB
|
||||
* www.percepio.com
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The interface for the multi-core event buffer.
|
||||
*/
|
||||
|
||||
#include <trcRecorder.h>
|
||||
|
||||
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
|
||||
|
||||
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
|
||||
|
||||
traceResult xTraceMultiCoreEventBufferInitialize(TraceMultiCoreEventBuffer_t* pxTraceMultiCoreEventBuffer, uint32_t uiOptions,
|
||||
uint8_t* puiBuffer, uint32_t uiSize)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
/* This should never fail */
|
||||
TRC_ASSERT(pxTraceMultiCoreEventBuffer != 0);
|
||||
|
||||
/* This should never fail */
|
||||
TRC_ASSERT(puiBuffer != 0);
|
||||
|
||||
uint32_t uiBufferSizePerCore = uiSize / TRC_CFG_CORE_COUNT;
|
||||
|
||||
/* This should never fail */
|
||||
TRC_ASSERT(uiBufferSizePerCore != 0);
|
||||
|
||||
for (i = 0; i < TRC_CFG_CORE_COUNT; i++)
|
||||
{
|
||||
/* Set the event buffer pointers to point into the allocated space we have been given, this ensures
|
||||
* a flat memory layout necessary for usage in streaming snaphot. */
|
||||
pxTraceMultiCoreEventBuffer->xEventBuffer[i] = (TraceEventBuffer_t*)(&puiBuffer[i * uiBufferSizePerCore]);
|
||||
|
||||
/* Initialize the event buffer structure with its memory buffer placed following its own structure data. */
|
||||
/* We need to check this */
|
||||
if (xTraceEventBufferInitialize(pxTraceMultiCoreEventBuffer->xEventBuffer[i], uiOptions,
|
||||
&puiBuffer[(i * uiBufferSizePerCore) + sizeof(TraceEventBuffer_t)],
|
||||
uiBufferSizePerCore - sizeof(TraceEventBuffer_t)) == TRC_FAIL)
|
||||
{
|
||||
return TRC_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return TRC_SUCCESS;
|
||||
}
|
||||
|
||||
#if ((TRC_CFG_USE_TRACE_ASSERT) == 1)
|
||||
|
||||
traceResult xTraceMultiCoreEventBufferPush(TraceMultiCoreEventBuffer_t* pxTraceMultiCoreEventBuffer,
|
||||
void* pvData, uint32_t uiSize, int32_t* piBytesWritten)
|
||||
{
|
||||
/* This should never fail */
|
||||
TRC_ASSERT(pxTraceMultiCoreEventBuffer != 0);
|
||||
|
||||
TRC_ASSERT((TRC_CFG_GET_CURRENT_CORE()) < (TRC_CFG_CORE_COUNT));
|
||||
|
||||
return xTraceEventBufferPush(pxTraceMultiCoreEventBuffer->xEventBuffer[TRC_CFG_GET_CURRENT_CORE()], pvData, uiSize, piBytesWritten);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
traceResult xTraceMultiCoreEventBufferTransfer(TraceMultiCoreEventBuffer_t* pxTraceMultiCoreEventBuffer, int32_t* piBytesWritten)
|
||||
{
|
||||
int32_t iBytesWritten = 0;
|
||||
uint32_t coreId;
|
||||
|
||||
/* This should never fail */
|
||||
TRC_ASSERT(pxTraceMultiCoreEventBuffer != 0);
|
||||
|
||||
/* This should never fail */
|
||||
TRC_ASSERT(piBytesWritten != 0);
|
||||
|
||||
*piBytesWritten = 0;
|
||||
|
||||
for (coreId = 0; coreId < TRC_CFG_CORE_COUNT; coreId++)
|
||||
{
|
||||
/* We need to check this */
|
||||
if (xTraceEventBufferTransfer(pxTraceMultiCoreEventBuffer->xEventBuffer[coreId], &iBytesWritten) == TRC_FAIL)
|
||||
{
|
||||
return TRC_FAIL;
|
||||
}
|
||||
|
||||
*piBytesWritten += iBytesWritten;
|
||||
}
|
||||
|
||||
return TRC_SUCCESS;
|
||||
}
|
||||
|
||||
traceResult xTraceMultiCoreEventBufferClear(TraceMultiCoreEventBuffer_t* pxTraceMultiCoreEventBuffer)
|
||||
{
|
||||
uint32_t coreId;
|
||||
|
||||
/* This should never fail */
|
||||
TRC_ASSERT(pxTraceMultiCoreEventBuffer != 0);
|
||||
|
||||
for (coreId = 0; coreId < TRC_CFG_CORE_COUNT; coreId++)
|
||||
{
|
||||
/* This should never fail */
|
||||
TRC_ASSERT_ALWAYS_EVALUATE(xTraceEventBufferClear(pxTraceMultiCoreEventBuffer->xEventBuffer[coreId]) == TRC_SUCCESS);
|
||||
}
|
||||
|
||||
return TRC_SUCCESS;
|
||||
}
|
||||
|
||||
#endif /* (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) */
|
||||
|
||||
#endif /* (TRC_USE_TRACEALYZER_RECORDER == 1) */
|
Loading…
Add table
Add a link
Reference in a new issue