mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-14 08:47:45 -04:00
* Use new version of CI-CD Actions, checkout@v3 instead of checkout@v2 on all jobs * Use cSpell spell check, and use ubuntu-20.04 for formatting check * Add in bot formatting action * Update freertos_demo.yml and freertos_plus_demo.yml files to increase github log readability * Add in a Qemu demo onto the workflows.
79 lines
2.4 KiB
C
79 lines
2.4 KiB
C
/*
|
|
* Percepio Trace Recorder for Tracealyzer v4.6.0
|
|
* Copyright 2021 Percepio AB
|
|
* www.percepio.com
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* The implementation for strings.
|
|
*/
|
|
|
|
#include <trcRecorder.h>
|
|
|
|
#if ( TRC_USE_TRACEALYZER_RECORDER == 1 )
|
|
|
|
#if ( TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING )
|
|
|
|
traceResult xTraceStringRegister( const char * szString,
|
|
TraceStringHandle_t * pString )
|
|
{
|
|
TraceEntryHandle_t xEntryHandle;
|
|
TraceEventHandle_t xEventHandle = 0;
|
|
uint32_t i = 0, uiLength = 0, uiValue = 0;
|
|
|
|
/* This should never fail */
|
|
TRC_ASSERT( szString != 0 );
|
|
|
|
/* This should never fail */
|
|
TRC_ASSERT( pString != 0 );
|
|
|
|
/* We need to check this */
|
|
if( xTraceEntryCreate( &xEntryHandle ) == TRC_FAIL )
|
|
{
|
|
return TRC_FAIL;
|
|
}
|
|
|
|
/* The address to the available symbol table slot is the address we use */
|
|
/* This should never fail */
|
|
TRC_ASSERT_ALWAYS_EVALUATE( xTraceEntrySetSymbol( xEntryHandle, szString ) == TRC_SUCCESS );
|
|
|
|
*pString = ( TraceStringHandle_t ) xEntryHandle;
|
|
|
|
for( i = 0; ( szString[ i ] != 0 ) && ( i < ( TRC_ENTRY_TABLE_SLOT_SYMBOL_SIZE ) ); i++ )
|
|
{
|
|
}
|
|
|
|
uiLength = i;
|
|
|
|
/* We need to check this */
|
|
if( xTraceEventBegin( PSF_EVENT_OBJ_NAME, sizeof( void * ) + uiLength, &xEventHandle ) == TRC_SUCCESS )
|
|
{
|
|
xTraceEventAddPointer( xEventHandle, ( void * ) xEntryHandle );
|
|
xTraceEventAddData( xEventHandle, ( void * ) szString, uiLength );
|
|
|
|
/* Check if we can truncate */
|
|
xTraceEventPayloadRemaining( xEventHandle, &uiValue );
|
|
|
|
if( uiValue > 0 )
|
|
{
|
|
xTraceEventAdd8( xEventHandle, 0 );
|
|
}
|
|
|
|
xTraceEventEnd( xEventHandle );
|
|
}
|
|
|
|
return TRC_SUCCESS;
|
|
}
|
|
|
|
TraceStringHandle_t xTraceRegisterString( const char * name )
|
|
{
|
|
TraceStringHandle_t trcStr = 0;
|
|
|
|
xTraceStringRegister( name, &trcStr );
|
|
|
|
return trcStr;
|
|
}
|
|
|
|
#endif /* (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) */
|
|
|
|
#endif /* (TRC_USE_TRACEALYZER_RECORDER == 1) */
|