1 /*
2 * Trace Recorder for Tracealyzer v4.9.2
3 * Copyright 2023 Percepio AB
4 * www.percepio.com
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 *
8 * The implementation of dependencies.
9 */
10 #include <trcRecorder.h>
11 
12 #if (TRC_USE_TRACEALYZER_RECORDER == 1) && (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
13 
14 #define TRC_DEPENDENCY_STATE_INDEX_TYPE 0UL
15 
16 /*cstat !MISRAC2004-6.3 !MISRAC2012-Dir-4.6_a Suppress basic char type usage*/
xTraceDependencyRegister(const char * szName,TraceUnsignedBaseType_t uxDependencyType)17 traceResult xTraceDependencyRegister(const char* szName, TraceUnsignedBaseType_t uxDependencyType)
18 {
19 	TraceObjectHandle_t xObjectHandle;
20 	TraceUnsignedBaseType_t auxStates[TRC_ENTRY_TABLE_STATE_COUNT] = { 0UL };
21 
22 	/* This should never fail */
23 	TRC_ASSERT(xTraceIsComponentInitialized(TRC_RECORDER_COMPONENT_CORE));
24 
25 	/* This should never fail */
26 	TRC_ASSERT(szName != (void*)0);
27 
28 	/* This should never fail */
29 	TRC_ASSERT(szName[0] != (char)0); /*cstat !MISRAC2004-17.4_b Checking first character*/ /*cstat !MISRAC2004-6.3 !MISRAC2012-Dir-4.6_a Suppress basic char type usage*/
30 
31 	switch (uxDependencyType)
32 	{
33 	case TRC_DEPENDENCY_TYPE_ELF:
34 		auxStates[TRC_DEPENDENCY_STATE_INDEX_TYPE] = uxDependencyType;
35 		break;
36 	default:
37 		return TRC_FAIL;
38 	}
39 
40 	return xTraceObjectRegisterInternal(PSF_EVENT_DEPENDENCY_REGISTER, (void*)0, szName, 1u, auxStates, TRC_ENTRY_OPTION_DEPENDENCY, &xObjectHandle);
41 }
42 
43 #endif
44