Added trace implemetation
authorSivaraj R <sivaraj@ti.com>
Thu, 10 May 2018 11:21:21 +0000 (16:51 +0530)
committerprasad konnur <prasadkonnur@ti.com>
Fri, 11 May 2018 06:32:16 +0000 (12:02 +0530)
Signed-off-by: Sivaraj R <sivaraj@ti.com>
fvid2_component.mk
include/trace.h [changed mode: 0644->0755]
src/fvid2_drvMgr.c [changed mode: 0644->0755]
src/makefile
src/trace.c [new file with mode: 0644]

index 2184d5f9a1a8faaea0c6eba6eeb7a8135b217aa0..2455d806b5c53d6b249bd664c7d88246b5c02e85 100755 (executable)
@@ -89,6 +89,7 @@ export fvid2_EXAMPLE_LIST
 FVID2_CFLAGS =
 
 # Enable asserts and prints
+FVID2_CFLAGS += -DFVID2_CFG_TRACE_ENABLE
 FVID2_CFLAGS += -DFVID2_CFG_ASSERT_ENABLE
 #TODO: Enable for A53 after semi-hosting is enabled
 ifneq ($(CORE),$(filter $(CORE), mpu1_0 mpu1_1))
old mode 100644 (file)
new mode 100755 (executable)
index c44da6d..b7eef57
@@ -45,7 +45,7 @@
 
 #include <ti/csl/tistdtypes.h>
 
- #if defined (USE_STD_ASSERT)
+ #if defined (FVID2_CFG_USE_STD_ASSERT)
 #include <assert.h>
 #endif
 
@@ -207,26 +207,26 @@ static inline void GT_assertLocal(uint32_t    enableMask,
                                   const char *fileName,
                                   int32_t     lineNum)
 {
-#if defined (ASSERT_ENABLE)
+#if defined (FVID2_CFG_ASSERT_ENABLE)
     if ((!(condition)) != 0)
     {
         Fvid2_printf(" Assertion @ Line: %d in %s: %s : failed !!!\n",
                    lineNum, fileName, str);
- #if defined (USE_STD_ASSERT)
+ #if defined (FVID2_CFG_USE_STD_ASSERT)
         assert((!(condition)) != 0);
  #else
         while (TRUE)
         {
             ;
         }
- #endif /* #if defined(USE_STD_ASSERT) */
+ #endif /* #if defined(FVID2_CFG_USE_STD_ASSERT) */
     }
-#endif  /* if defined(ASSERT_ENABLE) */
+#endif  /* if defined(FVID2_CFG_ASSERT_ENABLE) */
 
     return;
 }
 
-#if defined (TRACE_ENABLE)
+#if defined (FVID2_CFG_TRACE_ENABLE)
 /** \brief Function to report the FVID2 failure and log the trace. */
 void GT_failureReasonSet(int32_t      enableMask,
                          const char  *func,
@@ -240,7 +240,7 @@ void GT_failureReasonSet(int32_t      enableMask,
                          (const char *) __FILE__, (int32_t) __LINE__, \
                          (status), (const char *) (msg)))
 
-#else /* if defined (TRACE_ENABLE) */
+#else /* if defined (FVID2_CFG_TRACE_ENABLE) */
 
 /** \brief Function to report the FVID2 failure and log the trace. */
 #define GT_setFailureReason(maskType, classType, func, status, msg) \
@@ -255,7 +255,7 @@ void GT_failureReasonSet(int32_t      enableMask,
         }                                                           \
     } while (FALSE)
 
-#endif /* if defined (TRACE_ENABLE) */
+#endif /* if defined (FVID2_CFG_TRACE_ENABLE) */
 
 /**
  *  \brief Log the trace with zero parameters and information string.
@@ -440,7 +440,7 @@ void GT_trace7(uint32_t      maskType,
                uint32_t      param5,
                uint32_t      param6);
 
-#if defined (TRACE_ENABLE)
+#if defined (FVID2_CFG_TRACE_ENABLE)
 /** \brief Log the trace with zero parameters and information string. */
 #define GT_0trace(maskType, classType, infoString)        \
     (GT_trace0((maskType), (classType),                   \
@@ -518,7 +518,7 @@ void GT_trace7(uint32_t      maskType,
                (uint32_t) (param5),                                         \
                (uint32_t) (param6)))
 
-#else   /* if defined (TRACE_ENABLE) */
+#else   /* if defined (FVID2_CFG_TRACE_ENABLE) */
 
 /** \brief Log the trace with zero parameters and information string. */
 #define GT_0trace(maskType, classType, infoString)
@@ -541,7 +541,7 @@ void GT_trace7(uint32_t      maskType,
 #define GT_7trace(maskType, classType, infoString, param0, param1, param2, \
                   param3, param4, param5, param6)
 
-#endif  /* if defined (TRACE_ENABLE) */
+#endif  /* if defined (FVID2_CFG_TRACE_ENABLE) */
 
 #ifdef __cplusplus
 }
old mode 100644 (file)
new mode 100755 (executable)
index 76fcc98..10d40d4
@@ -1413,7 +1413,3 @@ static int32_t fdmFreeChannelObject(Fdm_Channel *channel)
     return (retVal);
 }
 
-void Fvid2_printf(const char *format, ...)
-{
-    return;
-}
index 921680c6927e785809c0586ccfc44003460cb572..dc96e3881f2837e2053483d4b73f63ebe715bd58 100755 (executable)
@@ -15,7 +15,7 @@ INCLUDE_EXTERNAL_INTERFACES = pdk
 # Common source files and CFLAGS across all platforms and cores
 PACKAGE_SRCS_COMMON = .
 
-SRCS_COMMON += fvid2_drvMgr.c fvid2_utils.c fvid2_graph.c
+SRCS_COMMON += fvid2_drvMgr.c fvid2_utils.c fvid2_graph.c trace.c
 
 CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS)
 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 (file)
index 0000000..f77600d
--- /dev/null
@@ -0,0 +1,635 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ *  \file       trace.c
+ *
+ *  \brief      Trace implementation.
+ *
+ *              This abstracts and implements the definitions for
+ *              user side traces statements and also details
+ *              of variable traces supported in existing
+ *              implementation.
+ *
+ */
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <stdint.h>
+/* This is needed for vsnprintf */
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <ti/csl/tistdtypes.h>
+#include <ti/drv/fvid2/fvid2.h>
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+#define REMOTE_DEBUG_SERVER_PRINT_BUF_LEN        (uint32_t) (1024U * 2U)
+
+//TODO: Move this to OSAL
+#define Osal_printf     printf
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+typedef struct
+{
+    uint32_t coreId;
+    char   printBuf[REMOTE_DEBUG_SERVER_PRINT_BUF_LEN];
+} RemoteDebug_ServerObj;
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+
+static RemoteDebug_ServerObj gRemoteDebug_serverObj = {0};
+
+/** \brief Global trace flag. */
+int32_t curTrace = 0;
+
+/* ========================================================================== */
+/*                          Function Definitions                              */
+/* ========================================================================== */
+
+void Fvid2_printf(const char *format, ...)
+{
+    va_list     vaArgPtr;
+    uintptr_t   cookie;
+    char       *buf = NULL;
+
+    cookie = HwiP_disable();
+
+    buf = &gRemoteDebug_serverObj.printBuf[0];
+    va_start(vaArgPtr, format);
+    vsnprintf(buf, REMOTE_DEBUG_SERVER_PRINT_BUF_LEN,
+              (const char *) format, vaArgPtr);
+    va_end(vaArgPtr);
+
+    HwiP_restore(cookie);
+
+    Osal_printf(buf);
+
+    return;
+}
+
+void Fvid2_rprintf(const char *format, ...)
+{
+    uintptr_t   cookie;
+    char       *buf = NULL;
+    va_list     vaArgPtr;
+
+    cookie = HwiP_disable();
+
+    buf = &gRemoteDebug_serverObj.printBuf[0];
+
+    va_start(vaArgPtr, format);
+    vsnprintf(buf, REMOTE_DEBUG_SERVER_PRINT_BUF_LEN,
+              (const char *) format, vaArgPtr);
+    va_end(vaArgPtr);
+
+    HwiP_restore(cookie);
+
+    return;
+}
+
+/**
+ *  \brief      Function to log the trace with zero parameters and just
+ *              information string.
+ *  \param      mask type of traces.
+ *  \param      classType One of three classes where this trace need
+ *              to be enabed.
+ *  \param      fileName    Where the condition has occured.
+ *  \param      lineNum     Line number of the current file where this failure
+ *                          has occured.
+ *  \param      The debug string.
+ */
+void
+GT_trace0(uint32_t        maskType,
+          GT_TraceClass classType,
+          const char   *fileName,
+          int32_t         lineNum,
+          const char   *infoString)
+{
+    /* Check if trace is enabled. */
+    if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT)
+        == GT_TraceState_Enable)
+    {
+        if ((classType == GT_ENTER) || (classType == GT_LEAVE))
+        {
+            if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable)
+            {
+                Osal_printf((const char *) infoString);
+            }
+        }
+        else
+        {
+            /* Check if specified class is enabled. */
+            if ((maskType & GT_TRACECLASS_MASK) >= classType)
+            {
+                /* Print if specified class is greater than or equal to class
+                 * for this specific print.
+                 */
+                if (!((classType == GT_INFO) || (classType == GT_INFO1)))
+                {
+                    Osal_printf("%s @ Line %d: ", fileName, lineNum);
+                }
+                Osal_printf((const char *) infoString);
+            }
+        }
+    }
+}
+
+/**
+ *  \brief      Function to log the trace with one additional parameter
+ *  \param      mask type of traces
+ *  \param      classType One of three classes where this trace
+ *              need to be enabed.
+ *  \param      fileName    Where the condition has occured.
+ *  \param      lineNum     Line number of the current file where this failure
+ *                          has occured.
+ *  \param      The debug string.
+ *  \param      param The additional parameter which needs to be logged.
+ */
+void
+GT_trace1(uint32_t        maskType,
+          GT_TraceClass classType,
+          const char   *fileName,
+          int32_t         lineNum,
+          const char   *infoString,
+          uint32_t        param0)
+{
+    /* Check if trace is enabled. */
+    if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT)
+        == GT_TraceState_Enable)
+    {
+        if ((classType == GT_ENTER) || (classType == GT_LEAVE))
+        {
+            if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable)
+            {
+                Osal_printf((const char *) infoString, param0);
+            }
+        }
+        else
+        {
+            /* Check if specified class is enabled. */
+            if ((maskType & GT_TRACECLASS_MASK) >= classType)
+            {
+                /* Print if specified class is greater than or equal to class
+                 * for this specific print.
+                 */
+                if (!((classType == GT_INFO) || (classType == GT_INFO1)))
+                {
+                    Osal_printf("%s @ Line %d: ", fileName, lineNum);
+                }
+                Osal_printf((const char *) infoString, param0);
+            }
+        }
+    }
+}
+
+/**
+ *  \brief      Function to log the trace with two additional parameters
+ *  \param      mask type of traces
+ *  \param      classType One of three classes where this trace
+ *              need to be enabed.
+ *  \param      fileName    Where the condition has occured.
+ *  \param      lineNum     Line number of the current file where this failure
+ *                          has occured.
+ *  \param      The debug string.
+ *  \param      param0 The first parameter which needs to be logged.
+ *  \param      param1 The second parameter which needs to be logged.
+ */
+void
+GT_trace2(uint32_t        maskType,
+          GT_TraceClass classType,
+          const char   *fileName,
+          int32_t         lineNum,
+          const char   *infoString,
+          uint32_t        param0,
+          uint32_t        param1)
+{
+    /* Check if trace is enabled. */
+    if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT)
+        == GT_TraceState_Enable)
+    {
+        if ((classType == GT_ENTER) || (classType == GT_LEAVE))
+        {
+            if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable)
+            {
+                Osal_printf((const char *) infoString, param0, param1);
+            }
+        }
+        else
+        {
+            /* Check if specified class is enabled. */
+            if ((maskType & GT_TRACECLASS_MASK) >= classType)
+            {
+                /* Print if specified class is greater than or equal to class
+                 * for this specific print.
+                 */
+                if (!((classType == GT_INFO) || (classType == GT_INFO1)))
+                {
+                    Osal_printf("%s @ Line %d: ", fileName, lineNum);
+                }
+                Osal_printf((const char *) infoString, param0, param1);
+            }
+        }
+    }
+}
+
+/**
+ *  \brief      Function to log the trace with three parameters.
+ *  \param      mask type of traces
+ *  \param      classType One of three classes where this trace
+ *              need to be enabed.
+ *  \param      fileName    Where the condition has occured.
+ *  \param      lineNum     Line number of the current file where this failure
+ *                          has occured.
+ *  \param      The debug string.
+ *  \param      param0 The first parameter which needs to be logged.
+ *  \param      param1 The second parameter which needs to be logged.
+ *  \param      param2 The third parameter which needs to be logged.
+ */
+void
+GT_trace3(uint32_t        maskType,
+          GT_TraceClass classType,
+          const char   *fileName,
+          int32_t         lineNum,
+          const char   *infoString,
+          uint32_t        param0,
+          uint32_t        param1,
+          uint32_t        param2)
+{
+    /* Check if trace is enabled. */
+    if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT)
+        == GT_TraceState_Enable)
+    {
+        if ((classType == GT_ENTER) || (classType == GT_LEAVE))
+        {
+            if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable)
+            {
+                Osal_printf((const char *) infoString, param0, param1,
+                               param2);
+            }
+        }
+        else
+        {
+            /* Check if specified class is enabled. */
+            if ((maskType & GT_TRACECLASS_MASK) >= classType)
+            {
+                /* Print if specified class is greater than or equal to class
+                 * for this specific print.
+                 */
+                if (!((classType == GT_INFO) || (classType == GT_INFO1)))
+                {
+                    Osal_printf("%s @ Line %d: ", fileName, lineNum);
+                }
+                Osal_printf((const char *) infoString, param0, param1,
+                               param2);
+            }
+        }
+    }
+}
+
+/**
+ *  \brief      Function to log the trace with four parameters.
+ *  \param      mask type of traces
+ *  \param      classType One of three classes where this trace
+ *              need to be enabed.
+ *  \param      fileName    Where the condition has occured.
+ *  \param      lineNum     Line number of the current file where this failure
+ *                          has occured.
+ *  \param      The debug string.
+ *  \param      param0 The first parameter which needs to be logged.
+ *  \param      param1 The second parameter which needs to be logged.
+ *  \param      param2 The third parameter which needs to be logged.
+ *  \param      param3 The fourth parameter which needs to be logged.
+ */
+void
+GT_trace4(uint32_t        maskType,
+          GT_TraceClass classType,
+          const char   *fileName,
+          int32_t         lineNum,
+          const char   *infoString,
+          uint32_t        param0,
+          uint32_t        param1,
+          uint32_t        param2,
+          uint32_t        param3)
+{
+    /* Check if trace is enabled. */
+    if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT)
+        == GT_TraceState_Enable)
+    {
+        if ((classType == GT_ENTER) || (classType == GT_LEAVE))
+        {
+            if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable)
+            {
+                Osal_printf((const char *) infoString, param0, param1,
+                               param2,
+                               param3);
+            }
+        }
+        else
+        {
+            /* Check if specified class is enabled. */
+            if ((maskType & GT_TRACECLASS_MASK) >= classType)
+            {
+                /* Print if specified class is greater than or equal to class
+                 * for this specific print.
+                 */
+                if (!((classType == GT_INFO) || (classType == GT_INFO1)))
+                {
+                    Osal_printf("%s @ Line %d: ", fileName, lineNum);
+                }
+                Osal_printf((const char *) infoString, param0, param1,
+                               param2,
+                               param3);
+            }
+        }
+    }
+}
+
+/**
+ *  \brief      Function to log the trace with five parameters.
+ *  \param      mask type of traces
+ *  \param      classType One of three classes where this trace
+ *              need to be enabed.
+ *  \param      fileName    Where the condition has occured.
+ *  \param      lineNum     Line number of the current file where this failure
+ *                          has occured.
+ *  \param      The debug string.
+ *  \param      param0 The first parameter which needs to be logged.
+ *  \param      param1 The second parameter which needs to be logged.
+ *  \param      param2 The third parameter which needs to be logged.
+ *  \param      param3 The fourth parameter which needs to be logged.
+ *  \param      param4 The fifth parameter which needs to be logged.
+ */
+void
+GT_trace5(uint32_t        maskType,
+          GT_TraceClass classType,
+          const char   *fileName,
+          int32_t         lineNum,
+          const char   *infoString,
+          uint32_t        param0,
+          uint32_t        param1,
+          uint32_t        param2,
+          uint32_t        param3,
+          uint32_t        param4)
+{
+    /* Check if trace is enabled. */
+    if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT)
+        == GT_TraceState_Enable)
+    {
+        if ((classType == GT_ENTER) || (classType == GT_LEAVE))
+        {
+            if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable)
+            {
+                Osal_printf((const char *) infoString,
+                               param0,
+                               param1,
+                               param2,
+                               param3,
+                               param4);
+            }
+        }
+        else
+        {
+            /* Check if specified class is enabled. */
+            if ((maskType & GT_TRACECLASS_MASK) >= classType)
+            {
+                /* Print if specified class is greater than or equal to class
+                 * for this specific print.
+                 */
+                if (!((classType == GT_INFO) || (classType == GT_INFO1)))
+                {
+                    Osal_printf("%s @ Line %d: ", fileName, lineNum);
+                }
+                Osal_printf((const char *) infoString,
+                               param0,
+                               param1,
+                               param2,
+                               param3,
+                               param4);
+            }
+        }
+    }
+}
+
+/**
+ *  \brief      Function to log the trace with six parameters.
+ *  \param      mask type of traces
+ *  \param      classType One of three classes where this trace
+ *              need to be enabed.
+ *  \param      fileName    Where the condition has occured.
+ *  \param      lineNum     Line number of the current file where this failure
+ *                          has occured.
+ *  \param      The debug string.
+ *  \param      param0 The first parameter which needs to be logged.
+ *  \param      param1 The second parameter which needs to be logged.
+ *  \param      param2 The third parameter which needs to be logged.
+ *  \param      param3 The fourth parameter which needs to be logged.
+ *  \param      param4 The fifth parameter which needs to be logged.
+ *  \param      param5 The sixth parameter which needs to be logged.
+ */
+void
+GT_trace6(uint32_t        maskType,
+          GT_TraceClass classType,
+          const char   *fileName,
+          int32_t         lineNum,
+          const char   *infoString,
+          uint32_t        param0,
+          uint32_t        param1,
+          uint32_t        param2,
+          uint32_t        param3,
+          uint32_t        param4,
+          uint32_t        param5)
+{
+    /* Check if trace is enabled. */
+    if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT)
+        == GT_TraceState_Enable)
+    {
+        if ((classType == GT_ENTER) || (classType == GT_LEAVE))
+        {
+            if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable)
+            {
+                Osal_printf((const char *) infoString,
+                               param0,
+                               param1,
+                               param2,
+                               param3,
+                               param4,
+                               param5);
+            }
+        }
+        else
+        {
+            /* Check if specified class is enabled. */
+            if ((maskType & GT_TRACECLASS_MASK) >= classType)
+            {
+                /* Print if specified class is greater than or equal to class
+                 * for this specific print.
+                 */
+                if (!((classType == GT_INFO) || (classType == GT_INFO1)))
+                {
+                    Osal_printf("%s @ Line %d: ", fileName, lineNum);
+                }
+                Osal_printf((const char *) infoString,
+                               param0,
+                               param1,
+                               param2,
+                               param3,
+                               param4,
+                               param5);
+            }
+        }
+    }
+}
+
+/**
+ *  \brief      Function to log the trace with seven parameters.
+ *  \param      mask type of traces
+ *  \param      classType One of three classes where this trace
+ *              need to be enabed.
+ *  \param      fileName    Where the condition has occured.
+ *  \param      lineNum     Line number of the current file where this failure
+ *                          has occured.
+ *  \param      The debug string.
+ *  \param      param0 The first parameter which needs to be logged.
+ *  \param      param1 The second parameter which needs to be logged.
+ *  \param      param2 The third parameter which needs to be logged.
+ *  \param      param3 The fourth parameter which needs to be logged.
+ *  \param      param4 The fifth parameter which needs to be logged.
+ *  \param      param5 The sixth parameter which needs to be logged.
+ *  \param      param6 The sixth parameter which needs to be logged.
+ */
+void
+GT_trace7(uint32_t        maskType,
+          GT_TraceClass classType,
+          const char   *fileName,
+          int32_t         lineNum,
+          const char   *infoString,
+          uint32_t        param0,
+          uint32_t        param1,
+          uint32_t        param2,
+          uint32_t        param3,
+          uint32_t        param4,
+          uint32_t        param5,
+          uint32_t        param6)
+{
+    /* Check if trace is enabled. */
+    if (((maskType & GT_TRACESTATE_MASK) >> GT_TRACESTATE_SHIFT)
+        == GT_TraceState_Enable)
+    {
+        if ((classType == GT_ENTER) || (classType == GT_LEAVE))
+        {
+            if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable)
+            {
+                Osal_printf((const char *) infoString,
+                               param0,
+                               param1,
+                               param2,
+                               param3,
+                               param4,
+                               param5,
+                               param6);
+            }
+        }
+        else
+        {
+            /* Check if specified class is enabled. */
+            if ((maskType & GT_TRACECLASS_MASK) >= classType)
+            {
+                /* Print if specified class is greater than or equal to class
+                 * for this specific print.
+                 */
+                if (!((classType == GT_INFO) || (classType == GT_INFO1)))
+                {
+                    Osal_printf("%s @ Line %d: ", fileName, lineNum);
+                }
+                Osal_printf((const char *) infoString,
+                               param0,
+                               param1,
+                               param2,
+                               param3,
+                               param4,
+                               param5,
+                               param6);
+            }
+        }
+    }
+}
+
+/**
+ *  \brief      Function to report the vps failure and log the trace. This
+ *              is mostly the fatal error and system can not recover without
+ *              module restart.
+ *  \param      mask        Indicates whether SetFailure is enabled.
+ *  \param      func        Name of the function where this oc.cured
+ *  \param      fileName    Where the condition has occured.
+ *  \param      lineNum     Line number of the current file where this failure
+ *                          has occured.
+ *  \param      status      What was the code we got/set for this failure
+ *  \param      msg         Any additional information which can be useful for
+ *                          deciphering the error condition.
+ */
+void GT_failureReasonSet(int32_t  enableMask,
+                         const char  *func,
+                         const char  *fileName,
+                         int32_t  lineNum,
+                         uint32_t status,
+                         const char  *msg)
+{
+    if ((((uint32_t) enableMask &
+          GT_TRACESETFAILURE_MASK) >> GT_TRACESETFAILURE_SHIFT)
+        == GT_TraceState_Enable)
+    {
+        Osal_printf("*** %s: %s\tError [0x%x] at Line no: %d in file %s\r\n",
+                       func,
+                       msg,
+                       status,
+                       lineNum,
+                       fileName);
+    }
+}
+