1 /*
2 * Trace Recorder for Tracealyzer v4.8.1
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)
13 
14 #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
15 
16 #define TRC_DEPENDENCY_STATE_INDEX_TYPE 0UL
17 
18 /*cstat !MISRAC2004-6.3 !MISRAC2012-Dir-4.6_a Suppress basic char type usage*/
xTraceDependencyRegister(const char * szName,TraceUnsignedBaseType_t uxDependencyType)19 traceResult xTraceDependencyRegister(const char* szName, TraceUnsignedBaseType_t uxDependencyType)
20 {
21 	TraceObjectHandle_t xObjectHandle;
22 	TraceUnsignedBaseType_t auxStates[TRC_ENTRY_TABLE_STATE_COUNT] = { 0UL };
23 
24 	/* This should never fail */
25 	TRC_ASSERT(xTraceIsComponentInitialized(TRC_RECORDER_COMPONENT_CORE));
26 
27 	/* This should never fail */
28 	TRC_ASSERT(szName != (void*)0);
29 
30 	/* This should never fail */
31 	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*/
32 
33 	switch (uxDependencyType)
34 	{
35 	case TRC_DEPENDENCY_TYPE_ELF:
36 		auxStates[TRC_DEPENDENCY_STATE_INDEX_TYPE] = uxDependencyType;
37 		break;
38 	default:
39 		return TRC_FAIL;
40 		break;
41 	}
42 
43 	return xTraceObjectRegisterInternal(PSF_EVENT_DEPENDENCY_REGISTER, (void*)0, szName, 1u, auxStates, TRC_ENTRY_OPTION_DEPENDENCY, &xObjectHandle);
44 }
45 
46 #endif
47 
48 #endif
49