diff options
author | Sivaraj R | 2018-05-10 06:21:21 -0500 |
---|---|---|
committer | prasad konnur | 2018-05-11 01:32:16 -0500 |
commit | 9c2ff6f22fb10e52a045c89321b2c34c680b587a (patch) | |
tree | 40ae77b8ed3fb2182ce7e1d6e40c2c0899eeb614 | |
parent | bf2b3607732519259a55a4c3fc200895153126cc (diff) | |
download | fvid2-9c2ff6f22fb10e52a045c89321b2c34c680b587a.tar.gz fvid2-9c2ff6f22fb10e52a045c89321b2c34c680b587a.tar.xz fvid2-9c2ff6f22fb10e52a045c89321b2c34c680b587a.zip |
Added trace implemetation
Signed-off-by: Sivaraj R <sivaraj@ti.com>
-rwxr-xr-x | fvid2_component.mk | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | include/trace.h | 22 | ||||
-rwxr-xr-x[-rw-r--r--] | src/fvid2_drvMgr.c | 4 | ||||
-rwxr-xr-x | src/makefile | 2 | ||||
-rw-r--r-- | src/trace.c | 635 |
5 files changed, 648 insertions, 16 deletions
diff --git a/fvid2_component.mk b/fvid2_component.mk index 2184d5f..2455d80 100755 --- a/fvid2_component.mk +++ b/fvid2_component.mk | |||
@@ -89,6 +89,7 @@ export fvid2_EXAMPLE_LIST | |||
89 | FVID2_CFLAGS = | 89 | FVID2_CFLAGS = |
90 | 90 | ||
91 | # Enable asserts and prints | 91 | # Enable asserts and prints |
92 | FVID2_CFLAGS += -DFVID2_CFG_TRACE_ENABLE | ||
92 | FVID2_CFLAGS += -DFVID2_CFG_ASSERT_ENABLE | 93 | FVID2_CFLAGS += -DFVID2_CFG_ASSERT_ENABLE |
93 | #TODO: Enable for A53 after semi-hosting is enabled | 94 | #TODO: Enable for A53 after semi-hosting is enabled |
94 | ifneq ($(CORE),$(filter $(CORE), mpu1_0 mpu1_1)) | 95 | ifneq ($(CORE),$(filter $(CORE), mpu1_0 mpu1_1)) |
diff --git a/include/trace.h b/include/trace.h index c44da6d..b7eef57 100644..100755 --- a/include/trace.h +++ b/include/trace.h | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | #include <ti/csl/tistdtypes.h> | 46 | #include <ti/csl/tistdtypes.h> |
47 | 47 | ||
48 | #if defined (USE_STD_ASSERT) | 48 | #if defined (FVID2_CFG_USE_STD_ASSERT) |
49 | #include <assert.h> | 49 | #include <assert.h> |
50 | #endif | 50 | #endif |
51 | 51 | ||
@@ -207,26 +207,26 @@ static inline void GT_assertLocal(uint32_t enableMask, | |||
207 | const char *fileName, | 207 | const char *fileName, |
208 | int32_t lineNum) | 208 | int32_t lineNum) |
209 | { | 209 | { |
210 | #if defined (ASSERT_ENABLE) | 210 | #if defined (FVID2_CFG_ASSERT_ENABLE) |
211 | if ((!(condition)) != 0) | 211 | if ((!(condition)) != 0) |
212 | { | 212 | { |
213 | Fvid2_printf(" Assertion @ Line: %d in %s: %s : failed !!!\n", | 213 | Fvid2_printf(" Assertion @ Line: %d in %s: %s : failed !!!\n", |
214 | lineNum, fileName, str); | 214 | lineNum, fileName, str); |
215 | #if defined (USE_STD_ASSERT) | 215 | #if defined (FVID2_CFG_USE_STD_ASSERT) |
216 | assert((!(condition)) != 0); | 216 | assert((!(condition)) != 0); |
217 | #else | 217 | #else |
218 | while (TRUE) | 218 | while (TRUE) |
219 | { | 219 | { |
220 | ; | 220 | ; |
221 | } | 221 | } |
222 | #endif /* #if defined(USE_STD_ASSERT) */ | 222 | #endif /* #if defined(FVID2_CFG_USE_STD_ASSERT) */ |
223 | } | 223 | } |
224 | #endif /* if defined(ASSERT_ENABLE) */ | 224 | #endif /* if defined(FVID2_CFG_ASSERT_ENABLE) */ |
225 | 225 | ||
226 | return; | 226 | return; |
227 | } | 227 | } |
228 | 228 | ||
229 | #if defined (TRACE_ENABLE) | 229 | #if defined (FVID2_CFG_TRACE_ENABLE) |
230 | /** \brief Function to report the FVID2 failure and log the trace. */ | 230 | /** \brief Function to report the FVID2 failure and log the trace. */ |
231 | void GT_failureReasonSet(int32_t enableMask, | 231 | void GT_failureReasonSet(int32_t enableMask, |
232 | const char *func, | 232 | const char *func, |
@@ -240,7 +240,7 @@ void GT_failureReasonSet(int32_t enableMask, | |||
240 | (const char *) __FILE__, (int32_t) __LINE__, \ | 240 | (const char *) __FILE__, (int32_t) __LINE__, \ |
241 | (status), (const char *) (msg))) | 241 | (status), (const char *) (msg))) |
242 | 242 | ||
243 | #else /* if defined (TRACE_ENABLE) */ | 243 | #else /* if defined (FVID2_CFG_TRACE_ENABLE) */ |
244 | 244 | ||
245 | /** \brief Function to report the FVID2 failure and log the trace. */ | 245 | /** \brief Function to report the FVID2 failure and log the trace. */ |
246 | #define GT_setFailureReason(maskType, classType, func, status, msg) \ | 246 | #define GT_setFailureReason(maskType, classType, func, status, msg) \ |
@@ -255,7 +255,7 @@ void GT_failureReasonSet(int32_t enableMask, | |||
255 | } \ | 255 | } \ |
256 | } while (FALSE) | 256 | } while (FALSE) |
257 | 257 | ||
258 | #endif /* if defined (TRACE_ENABLE) */ | 258 | #endif /* if defined (FVID2_CFG_TRACE_ENABLE) */ |
259 | 259 | ||
260 | /** | 260 | /** |
261 | * \brief Log the trace with zero parameters and information string. | 261 | * \brief Log the trace with zero parameters and information string. |
@@ -440,7 +440,7 @@ void GT_trace7(uint32_t maskType, | |||
440 | uint32_t param5, | 440 | uint32_t param5, |
441 | uint32_t param6); | 441 | uint32_t param6); |
442 | 442 | ||
443 | #if defined (TRACE_ENABLE) | 443 | #if defined (FVID2_CFG_TRACE_ENABLE) |
444 | /** \brief Log the trace with zero parameters and information string. */ | 444 | /** \brief Log the trace with zero parameters and information string. */ |
445 | #define GT_0trace(maskType, classType, infoString) \ | 445 | #define GT_0trace(maskType, classType, infoString) \ |
446 | (GT_trace0((maskType), (classType), \ | 446 | (GT_trace0((maskType), (classType), \ |
@@ -518,7 +518,7 @@ void GT_trace7(uint32_t maskType, | |||
518 | (uint32_t) (param5), \ | 518 | (uint32_t) (param5), \ |
519 | (uint32_t) (param6))) | 519 | (uint32_t) (param6))) |
520 | 520 | ||
521 | #else /* if defined (TRACE_ENABLE) */ | 521 | #else /* if defined (FVID2_CFG_TRACE_ENABLE) */ |
522 | 522 | ||
523 | /** \brief Log the trace with zero parameters and information string. */ | 523 | /** \brief Log the trace with zero parameters and information string. */ |
524 | #define GT_0trace(maskType, classType, infoString) | 524 | #define GT_0trace(maskType, classType, infoString) |
@@ -541,7 +541,7 @@ void GT_trace7(uint32_t maskType, | |||
541 | #define GT_7trace(maskType, classType, infoString, param0, param1, param2, \ | 541 | #define GT_7trace(maskType, classType, infoString, param0, param1, param2, \ |
542 | param3, param4, param5, param6) | 542 | param3, param4, param5, param6) |
543 | 543 | ||
544 | #endif /* if defined (TRACE_ENABLE) */ | 544 | #endif /* if defined (FVID2_CFG_TRACE_ENABLE) */ |
545 | 545 | ||
546 | #ifdef __cplusplus | 546 | #ifdef __cplusplus |
547 | } | 547 | } |
diff --git a/src/fvid2_drvMgr.c b/src/fvid2_drvMgr.c index 76fcc98..10d40d4 100644..100755 --- a/src/fvid2_drvMgr.c +++ b/src/fvid2_drvMgr.c | |||
@@ -1413,7 +1413,3 @@ static int32_t fdmFreeChannelObject(Fdm_Channel *channel) | |||
1413 | return (retVal); | 1413 | return (retVal); |
1414 | } | 1414 | } |
1415 | 1415 | ||
1416 | void Fvid2_printf(const char *format, ...) | ||
1417 | { | ||
1418 | return; | ||
1419 | } | ||
diff --git a/src/makefile b/src/makefile index 921680c..dc96e38 100755 --- a/src/makefile +++ b/src/makefile | |||
@@ -15,7 +15,7 @@ INCLUDE_EXTERNAL_INTERFACES = pdk | |||
15 | # Common source files and CFLAGS across all platforms and cores | 15 | # Common source files and CFLAGS across all platforms and cores |
16 | PACKAGE_SRCS_COMMON = . | 16 | PACKAGE_SRCS_COMMON = . |
17 | 17 | ||
18 | SRCS_COMMON += fvid2_drvMgr.c fvid2_utils.c fvid2_graph.c | 18 | SRCS_COMMON += fvid2_drvMgr.c fvid2_utils.c fvid2_graph.c trace.c |
19 | 19 | ||
20 | CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS) | 20 | CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS) |
21 | PACKAGE_SRCS_COMMON = fvid2.h fvid2_component.mk makefile .gitignore include src | 21 | PACKAGE_SRCS_COMMON = fvid2.h fvid2_component.mk makefile .gitignore include src |
diff --git a/src/trace.c b/src/trace.c new file mode 100644 index 0000000..f77600d --- /dev/null +++ b/src/trace.c | |||
@@ -0,0 +1,635 @@ | |||
1 | /* | ||
2 | * Copyright (c) Texas Instruments Incorporated 2018 | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions | ||
6 | * are met: | ||
7 | * | ||
8 | * Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * | ||
11 | * Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the | ||
14 | * distribution. | ||
15 | * | ||
16 | * Neither the name of Texas Instruments Incorporated nor the names of | ||
17 | * its contributors may be used to endorse or promote products derived | ||
18 | * from this software without specific prior written permission. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
31 | */ | ||
32 | |||
33 | /** | ||
34 | * \file trace.c | ||
35 | * | ||
36 | * \brief Trace implementation. | ||
37 | * | ||
38 | * This abstracts and implements the definitions for | ||
39 | * user side traces statements and also details | ||
40 | * of variable traces supported in existing | ||
41 | * implementation. | ||
42 | * | ||
43 | */ | ||
44 | |||
45 | /* ========================================================================== */ | ||
46 | /* Include Files */ | ||
47 | /* ========================================================================== */ | ||
48 | |||
49 | #include <stdint.h> | ||
50 | /* This is needed for vsnprintf */ | ||
51 | #include <stdio.h> | ||
52 | #include <stdarg.h> | ||
53 | |||
54 | #include <ti/csl/tistdtypes.h> | ||
55 | #include <ti/drv/fvid2/fvid2.h> | ||
56 | |||
57 | /* ========================================================================== */ | ||
58 | /* Macros & Typedefs */ | ||
59 | /* ========================================================================== */ | ||
60 | |||
61 | #define REMOTE_DEBUG_SERVER_PRINT_BUF_LEN (uint32_t) (1024U * 2U) | ||
62 | |||
63 | //TODO: Move this to OSAL | ||
64 | #define Osal_printf printf | ||
65 | |||
66 | /* ========================================================================== */ | ||
67 | /* Structure Declarations */ | ||
68 | /* ========================================================================== */ | ||
69 | |||
70 | typedef struct | ||
71 | { | ||
72 | uint32_t coreId; | ||
73 | char printBuf[REMOTE_DEBUG_SERVER_PRINT_BUF_LEN]; | ||
74 | } RemoteDebug_ServerObj; | ||
75 | |||
76 | /* ========================================================================== */ | ||
77 | /* Function Declarations */ | ||
78 | /* ========================================================================== */ | ||
79 | |||
80 | /* None */ | ||
81 | |||
82 | /* ========================================================================== */ | ||
83 | /* Global Variables */ | ||
84 | /* ========================================================================== */ | ||
85 | |||
86 | static RemoteDebug_ServerObj gRemoteDebug_serverObj = {0}; | ||
87 | |||
88 | /** \brief Global trace flag. */ | ||
89 | int32_t curTrace = 0; | ||
90 | |||
91 | /* ========================================================================== */ | ||
92 | /* Function Definitions */ | ||
93 | /* ========================================================================== */ | ||
94 | |||
95 | void Fvid2_printf(const char *format, ...) | ||
96 | { | ||
97 | va_list vaArgPtr; | ||
98 | uintptr_t cookie; | ||
99 | char *buf = NULL; | ||
100 | |||
101 | cookie = HwiP_disable(); | ||
102 | |||
103 | buf = &gRemoteDebug_serverObj.printBuf[0]; | ||
104 | va_start(vaArgPtr, format); | ||
105 | vsnprintf(buf, REMOTE_DEBUG_SERVER_PRINT_BUF_LEN, | ||
106 | (const char *) format, vaArgPtr); | ||
107 | va_end(vaArgPtr); | ||
108 | |||
109 | HwiP_restore(cookie); | ||
110 | |||
111 | Osal_printf(buf); | ||
112 | |||
113 | return; | ||
114 | } | ||
115 | |||
116 | void Fvid2_rprintf(const char *format, ...) | ||
117 | { | ||
118 | uintptr_t cookie; | ||
119 | char *buf = NULL; | ||
120 | va_list vaArgPtr; | ||
121 | |||
122 | cookie = HwiP_disable(); | ||
123 | |||
124 | buf = &gRemoteDebug_serverObj.printBuf[0]; | ||
125 | |||
126 | va_start(vaArgPtr, format); | ||
127 | vsnprintf(buf, REMOTE_DEBUG_SERVER_PRINT_BUF_LEN, | ||
128 | (const char *) format, vaArgPtr); | ||
129 | va_end(vaArgPtr); | ||
130 | |||
131 | HwiP_restore(cookie); | ||
132 | |||
133 | return; | ||
134 | } | ||
135 | |||
136 | /** | ||
137 | * \brief Function to log the trace with zero parameters and just | ||
138 | * information string. | ||
139 | * \param mask type of traces. | ||
140 | * \param classType One of three classes where this trace need | ||
141 | * to be enabed. | ||
142 | * \param fileName Where the condition has occured. | ||
143 | * \param lineNum Line number of the current file where this failure | ||
144 | * has occured. | ||
145 | * \param The debug string. | ||
146 | */ | ||
147 | void | ||
148 | GT_trace0(uint32_t maskType, | ||
149 | GT_TraceClass classType, | ||
150 | const char *fileName, | ||
151 | int32_t lineNum, | ||
152 | const char *infoString) | ||
153 | { | ||
154 | /* Check if trace is enabled. */ | ||
155 | if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT) | ||
156 | == GT_TraceState_Enable) | ||
157 | { | ||
158 | if ((classType == GT_ENTER) || (classType == GT_LEAVE)) | ||
159 | { | ||
160 | if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable) | ||
161 | { | ||
162 | Osal_printf((const char *) infoString); | ||
163 | } | ||
164 | } | ||
165 | else | ||
166 | { | ||
167 | /* Check if specified class is enabled. */ | ||
168 | if ((maskType & GT_TRACECLASS_MASK) >= classType) | ||
169 | { | ||
170 | /* Print if specified class is greater than or equal to class | ||
171 | * for this specific print. | ||
172 | */ | ||
173 | if (!((classType == GT_INFO) || (classType == GT_INFO1))) | ||
174 | { | ||
175 | Osal_printf("%s @ Line %d: ", fileName, lineNum); | ||
176 | } | ||
177 | Osal_printf((const char *) infoString); | ||
178 | } | ||
179 | } | ||
180 | } | ||
181 | } | ||
182 | |||
183 | /** | ||
184 | * \brief Function to log the trace with one additional parameter | ||
185 | * \param mask type of traces | ||
186 | * \param classType One of three classes where this trace | ||
187 | * need to be enabed. | ||
188 | * \param fileName Where the condition has occured. | ||
189 | * \param lineNum Line number of the current file where this failure | ||
190 | * has occured. | ||
191 | * \param The debug string. | ||
192 | * \param param The additional parameter which needs to be logged. | ||
193 | */ | ||
194 | void | ||
195 | GT_trace1(uint32_t maskType, | ||
196 | GT_TraceClass classType, | ||
197 | const char *fileName, | ||
198 | int32_t lineNum, | ||
199 | const char *infoString, | ||
200 | uint32_t param0) | ||
201 | { | ||
202 | /* Check if trace is enabled. */ | ||
203 | if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT) | ||
204 | == GT_TraceState_Enable) | ||
205 | { | ||
206 | if ((classType == GT_ENTER) || (classType == GT_LEAVE)) | ||
207 | { | ||
208 | if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable) | ||
209 | { | ||
210 | Osal_printf((const char *) infoString, param0); | ||
211 | } | ||
212 | } | ||
213 | else | ||
214 | { | ||
215 | /* Check if specified class is enabled. */ | ||
216 | if ((maskType & GT_TRACECLASS_MASK) >= classType) | ||
217 | { | ||
218 | /* Print if specified class is greater than or equal to class | ||
219 | * for this specific print. | ||
220 | */ | ||
221 | if (!((classType == GT_INFO) || (classType == GT_INFO1))) | ||
222 | { | ||
223 | Osal_printf("%s @ Line %d: ", fileName, lineNum); | ||
224 | } | ||
225 | Osal_printf((const char *) infoString, param0); | ||
226 | } | ||
227 | } | ||
228 | } | ||
229 | } | ||
230 | |||
231 | /** | ||
232 | * \brief Function to log the trace with two additional parameters | ||
233 | * \param mask type of traces | ||
234 | * \param classType One of three classes where this trace | ||
235 | * need to be enabed. | ||
236 | * \param fileName Where the condition has occured. | ||
237 | * \param lineNum Line number of the current file where this failure | ||
238 | * has occured. | ||
239 | * \param The debug string. | ||
240 | * \param param0 The first parameter which needs to be logged. | ||
241 | * \param param1 The second parameter which needs to be logged. | ||
242 | */ | ||
243 | void | ||
244 | GT_trace2(uint32_t maskType, | ||
245 | GT_TraceClass classType, | ||
246 | const char *fileName, | ||
247 | int32_t lineNum, | ||
248 | const char *infoString, | ||
249 | uint32_t param0, | ||
250 | uint32_t param1) | ||
251 | { | ||
252 | /* Check if trace is enabled. */ | ||
253 | if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT) | ||
254 | == GT_TraceState_Enable) | ||
255 | { | ||
256 | if ((classType == GT_ENTER) || (classType == GT_LEAVE)) | ||
257 | { | ||
258 | if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable) | ||
259 | { | ||
260 | Osal_printf((const char *) infoString, param0, param1); | ||
261 | } | ||
262 | } | ||
263 | else | ||
264 | { | ||
265 | /* Check if specified class is enabled. */ | ||
266 | if ((maskType & GT_TRACECLASS_MASK) >= classType) | ||
267 | { | ||
268 | /* Print if specified class is greater than or equal to class | ||
269 | * for this specific print. | ||
270 | */ | ||
271 | if (!((classType == GT_INFO) || (classType == GT_INFO1))) | ||
272 | { | ||
273 | Osal_printf("%s @ Line %d: ", fileName, lineNum); | ||
274 | } | ||
275 | Osal_printf((const char *) infoString, param0, param1); | ||
276 | } | ||
277 | } | ||
278 | } | ||
279 | } | ||
280 | |||
281 | /** | ||
282 | * \brief Function to log the trace with three parameters. | ||
283 | * \param mask type of traces | ||
284 | * \param classType One of three classes where this trace | ||
285 | * need to be enabed. | ||
286 | * \param fileName Where the condition has occured. | ||
287 | * \param lineNum Line number of the current file where this failure | ||
288 | * has occured. | ||
289 | * \param The debug string. | ||
290 | * \param param0 The first parameter which needs to be logged. | ||
291 | * \param param1 The second parameter which needs to be logged. | ||
292 | * \param param2 The third parameter which needs to be logged. | ||
293 | */ | ||
294 | void | ||
295 | GT_trace3(uint32_t maskType, | ||
296 | GT_TraceClass classType, | ||
297 | const char *fileName, | ||
298 | int32_t lineNum, | ||
299 | const char *infoString, | ||
300 | uint32_t param0, | ||
301 | uint32_t param1, | ||
302 | uint32_t param2) | ||
303 | { | ||
304 | /* Check if trace is enabled. */ | ||
305 | if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT) | ||
306 | == GT_TraceState_Enable) | ||
307 | { | ||
308 | if ((classType == GT_ENTER) || (classType == GT_LEAVE)) | ||
309 | { | ||
310 | if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable) | ||
311 | { | ||
312 | Osal_printf((const char *) infoString, param0, param1, | ||
313 | param2); | ||
314 | } | ||
315 | } | ||
316 | else | ||
317 | { | ||
318 | /* Check if specified class is enabled. */ | ||
319 | if ((maskType & GT_TRACECLASS_MASK) >= classType) | ||
320 | { | ||
321 | /* Print if specified class is greater than or equal to class | ||
322 | * for this specific print. | ||
323 | */ | ||
324 | if (!((classType == GT_INFO) || (classType == GT_INFO1))) | ||
325 | { | ||
326 | Osal_printf("%s @ Line %d: ", fileName, lineNum); | ||
327 | } | ||
328 | Osal_printf((const char *) infoString, param0, param1, | ||
329 | param2); | ||
330 | } | ||
331 | } | ||
332 | } | ||
333 | } | ||
334 | |||
335 | /** | ||
336 | * \brief Function to log the trace with four parameters. | ||
337 | * \param mask type of traces | ||
338 | * \param classType One of three classes where this trace | ||
339 | * need to be enabed. | ||
340 | * \param fileName Where the condition has occured. | ||
341 | * \param lineNum Line number of the current file where this failure | ||
342 | * has occured. | ||
343 | * \param The debug string. | ||
344 | * \param param0 The first parameter which needs to be logged. | ||
345 | * \param param1 The second parameter which needs to be logged. | ||
346 | * \param param2 The third parameter which needs to be logged. | ||
347 | * \param param3 The fourth parameter which needs to be logged. | ||
348 | */ | ||
349 | void | ||
350 | GT_trace4(uint32_t maskType, | ||
351 | GT_TraceClass classType, | ||
352 | const char *fileName, | ||
353 | int32_t lineNum, | ||
354 | const char *infoString, | ||
355 | uint32_t param0, | ||
356 | uint32_t param1, | ||
357 | uint32_t param2, | ||
358 | uint32_t param3) | ||
359 | { | ||
360 | /* Check if trace is enabled. */ | ||
361 | if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT) | ||
362 | == GT_TraceState_Enable) | ||
363 | { | ||
364 | if ((classType == GT_ENTER) || (classType == GT_LEAVE)) | ||
365 | { | ||
366 | if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable) | ||
367 | { | ||
368 | Osal_printf((const char *) infoString, param0, param1, | ||
369 | param2, | ||
370 | param3); | ||
371 | } | ||
372 | } | ||
373 | else | ||
374 | { | ||
375 | /* Check if specified class is enabled. */ | ||
376 | if ((maskType & GT_TRACECLASS_MASK) >= classType) | ||
377 | { | ||
378 | /* Print if specified class is greater than or equal to class | ||
379 | * for this specific print. | ||
380 | */ | ||
381 | if (!((classType == GT_INFO) || (classType == GT_INFO1))) | ||
382 | { | ||
383 | Osal_printf("%s @ Line %d: ", fileName, lineNum); | ||
384 | } | ||
385 | Osal_printf((const char *) infoString, param0, param1, | ||
386 | param2, | ||
387 | param3); | ||
388 | } | ||
389 | } | ||
390 | } | ||
391 | } | ||
392 | |||
393 | /** | ||
394 | * \brief Function to log the trace with five parameters. | ||
395 | * \param mask type of traces | ||
396 | * \param classType One of three classes where this trace | ||
397 | * need to be enabed. | ||
398 | * \param fileName Where the condition has occured. | ||
399 | * \param lineNum Line number of the current file where this failure | ||
400 | * has occured. | ||
401 | * \param The debug string. | ||
402 | * \param param0 The first parameter which needs to be logged. | ||
403 | * \param param1 The second parameter which needs to be logged. | ||
404 | * \param param2 The third parameter which needs to be logged. | ||
405 | * \param param3 The fourth parameter which needs to be logged. | ||
406 | * \param param4 The fifth parameter which needs to be logged. | ||
407 | */ | ||
408 | void | ||
409 | GT_trace5(uint32_t maskType, | ||
410 | GT_TraceClass classType, | ||
411 | const char *fileName, | ||
412 | int32_t lineNum, | ||
413 | const char *infoString, | ||
414 | uint32_t param0, | ||
415 | uint32_t param1, | ||
416 | uint32_t param2, | ||
417 | uint32_t param3, | ||
418 | uint32_t param4) | ||
419 | { | ||
420 | /* Check if trace is enabled. */ | ||
421 | if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT) | ||
422 | == GT_TraceState_Enable) | ||
423 | { | ||
424 | if ((classType == GT_ENTER) || (classType == GT_LEAVE)) | ||
425 | { | ||
426 | if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable) | ||
427 | { | ||
428 | Osal_printf((const char *) infoString, | ||
429 | param0, | ||
430 | param1, | ||
431 | param2, | ||
432 | param3, | ||
433 | param4); | ||
434 | } | ||
435 | } | ||
436 | else | ||
437 | { | ||
438 | /* Check if specified class is enabled. */ | ||
439 | if ((maskType & GT_TRACECLASS_MASK) >= classType) | ||
440 | { | ||
441 | /* Print if specified class is greater than or equal to class | ||
442 | * for this specific print. | ||
443 | */ | ||
444 | if (!((classType == GT_INFO) || (classType == GT_INFO1))) | ||
445 | { | ||
446 | Osal_printf("%s @ Line %d: ", fileName, lineNum); | ||
447 | } | ||
448 | Osal_printf((const char *) infoString, | ||
449 | param0, | ||
450 | param1, | ||
451 | param2, | ||
452 | param3, | ||
453 | param4); | ||
454 | } | ||
455 | } | ||
456 | } | ||
457 | } | ||
458 | |||
459 | /** | ||
460 | * \brief Function to log the trace with six parameters. | ||
461 | * \param mask type of traces | ||
462 | * \param classType One of three classes where this trace | ||
463 | * need to be enabed. | ||
464 | * \param fileName Where the condition has occured. | ||
465 | * \param lineNum Line number of the current file where this failure | ||
466 | * has occured. | ||
467 | * \param The debug string. | ||
468 | * \param param0 The first parameter which needs to be logged. | ||
469 | * \param param1 The second parameter which needs to be logged. | ||
470 | * \param param2 The third parameter which needs to be logged. | ||
471 | * \param param3 The fourth parameter which needs to be logged. | ||
472 | * \param param4 The fifth parameter which needs to be logged. | ||
473 | * \param param5 The sixth parameter which needs to be logged. | ||
474 | */ | ||
475 | void | ||
476 | GT_trace6(uint32_t maskType, | ||
477 | GT_TraceClass classType, | ||
478 | const char *fileName, | ||
479 | int32_t lineNum, | ||
480 | const char *infoString, | ||
481 | uint32_t param0, | ||
482 | uint32_t param1, | ||
483 | uint32_t param2, | ||
484 | uint32_t param3, | ||
485 | uint32_t param4, | ||
486 | uint32_t param5) | ||
487 | { | ||
488 | /* Check if trace is enabled. */ | ||
489 | if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT) | ||
490 | == GT_TraceState_Enable) | ||
491 | { | ||
492 | if ((classType == GT_ENTER) || (classType == GT_LEAVE)) | ||
493 | { | ||
494 | if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable) | ||
495 | { | ||
496 | Osal_printf((const char *) infoString, | ||
497 | param0, | ||
498 | param1, | ||
499 | param2, | ||
500 | param3, | ||
501 | param4, | ||
502 | param5); | ||
503 | } | ||
504 | } | ||
505 | else | ||
506 | { | ||
507 | /* Check if specified class is enabled. */ | ||
508 | if ((maskType & GT_TRACECLASS_MASK) >= classType) | ||
509 | { | ||
510 | /* Print if specified class is greater than or equal to class | ||
511 | * for this specific print. | ||
512 | */ | ||
513 | if (!((classType == GT_INFO) || (classType == GT_INFO1))) | ||
514 | { | ||
515 | Osal_printf("%s @ Line %d: ", fileName, lineNum); | ||
516 | } | ||
517 | Osal_printf((const char *) infoString, | ||
518 | param0, | ||
519 | param1, | ||
520 | param2, | ||
521 | param3, | ||
522 | param4, | ||
523 | param5); | ||
524 | } | ||
525 | } | ||
526 | } | ||
527 | } | ||
528 | |||
529 | /** | ||
530 | * \brief Function to log the trace with seven parameters. | ||
531 | * \param mask type of traces | ||
532 | * \param classType One of three classes where this trace | ||
533 | * need to be enabed. | ||
534 | * \param fileName Where the condition has occured. | ||
535 | * \param lineNum Line number of the current file where this failure | ||
536 | * has occured. | ||
537 | * \param The debug string. | ||
538 | * \param param0 The first parameter which needs to be logged. | ||
539 | * \param param1 The second parameter which needs to be logged. | ||
540 | * \param param2 The third parameter which needs to be logged. | ||
541 | * \param param3 The fourth parameter which needs to be logged. | ||
542 | * \param param4 The fifth parameter which needs to be logged. | ||
543 | * \param param5 The sixth parameter which needs to be logged. | ||
544 | * \param param6 The sixth parameter which needs to be logged. | ||
545 | */ | ||
546 | void | ||
547 | GT_trace7(uint32_t maskType, | ||
548 | GT_TraceClass classType, | ||
549 | const char *fileName, | ||
550 | int32_t lineNum, | ||
551 | const char *infoString, | ||
552 | uint32_t param0, | ||
553 | uint32_t param1, | ||
554 | uint32_t param2, | ||
555 | uint32_t param3, | ||
556 | uint32_t param4, | ||
557 | uint32_t param5, | ||
558 | uint32_t param6) | ||
559 | { | ||
560 | /* Check if trace is enabled. */ | ||
561 | if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT) | ||
562 | == GT_TraceState_Enable) | ||
563 | { | ||
564 | if ((classType == GT_ENTER) || (classType == GT_LEAVE)) | ||
565 | { | ||
566 | if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable) | ||
567 | { | ||
568 | Osal_printf((const char *) infoString, | ||
569 | param0, | ||
570 | param1, | ||
571 | param2, | ||
572 | param3, | ||
573 | param4, | ||
574 | param5, | ||
575 | param6); | ||
576 | } | ||
577 | } | ||
578 | else | ||
579 | { | ||
580 | /* Check if specified class is enabled. */ | ||
581 | if ((maskType & GT_TRACECLASS_MASK) >= classType) | ||
582 | { | ||
583 | /* Print if specified class is greater than or equal to class | ||
584 | * for this specific print. | ||
585 | */ | ||
586 | if (!((classType == GT_INFO) || (classType == GT_INFO1))) | ||
587 | { | ||
588 | Osal_printf("%s @ Line %d: ", fileName, lineNum); | ||
589 | } | ||
590 | Osal_printf((const char *) infoString, | ||
591 | param0, | ||
592 | param1, | ||
593 | param2, | ||
594 | param3, | ||
595 | param4, | ||
596 | param5, | ||
597 | param6); | ||
598 | } | ||
599 | } | ||
600 | } | ||
601 | } | ||
602 | |||
603 | /** | ||
604 | * \brief Function to report the vps failure and log the trace. This | ||
605 | * is mostly the fatal error and system can not recover without | ||
606 | * module restart. | ||
607 | * \param mask Indicates whether SetFailure is enabled. | ||
608 | * \param func Name of the function where this oc.cured | ||
609 | * \param fileName Where the condition has occured. | ||
610 | * \param lineNum Line number of the current file where this failure | ||
611 | * has occured. | ||
612 | * \param status What was the code we got/set for this failure | ||
613 | * \param msg Any additional information which can be useful for | ||
614 | * deciphering the error condition. | ||
615 | */ | ||
616 | void GT_failureReasonSet(int32_t enableMask, | ||
617 | const char *func, | ||
618 | const char *fileName, | ||
619 | int32_t lineNum, | ||
620 | uint32_t status, | ||
621 | const char *msg) | ||
622 | { | ||
623 | if ((((uint32_t) enableMask & | ||
624 | GT_TRACESETFAILURE_MASK) >> GT_TRACESETFAILURE_SHIFT) | ||
625 | == GT_TraceState_Enable) | ||
626 | { | ||
627 | Osal_printf("*** %s: %s\tError [0x%x] at Line no: %d in file %s\r\n", | ||
628 | func, | ||
629 | msg, | ||
630 | status, | ||
631 | lineNum, | ||
632 | fileName); | ||
633 | } | ||
634 | } | ||
635 | |||