summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4e2bc46)
raw | patch | inline | side by side (parent: 4e2bc46)
author | Sivaraj R <sivaraj@ti.com> | |
Mon, 24 Sep 2018 11:14:38 +0000 (16:44 +0530) | ||
committer | Sivaraj R <sivaraj@ti.com> | |
Fri, 28 Sep 2018 14:04:23 +0000 (19:34 +0530) |
- Added fix for print disable for A53
- Fully revamed the trace function to not depend on stdio
- Removed unwanted features
- Added function pointer for print callback registeration
Signed-off-by: Sivaraj R <sivaraj@ti.com>
- Fully revamed the trace function to not depend on stdio
- Removed unwanted features
- Added function pointer for print callback registeration
Signed-off-by: Sivaraj R <sivaraj@ti.com>
diff --git a/fvid2_component.mk b/fvid2_component.mk
index 2455d806b5c53d6b249bd664c7d88246b5c02e85..68e45220b7c79e583aecf0d869b34dffb988dbc6 100755 (executable)
--- a/fvid2_component.mk
+++ b/fvid2_component.mk
# 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))
- FVID2_CFLAGS += -DFVID2_CFG_USE_STD_ASSERT
- FVID2_CFLAGS += -DFVID2_CFG_PRINT_ENABLE
-endif
export FVID2_CFLAGS
diff --git a/include/fvid2_api.h b/include/fvid2_api.h
index eceacb824c12a3409f82f5ce943a6222a3cc1759..c46a2ecbd0a7cc453ff4acf4725f358b1b2c6557 100644 (file)
--- a/include/fvid2_api.h
+++ b/include/fvid2_api.h
*/
typedef uint64_t (*Fvid2_TimeStampFxn)(void *args);
+/**
+ * \brief FVID2 info/debug print function prototype.
+ *
+ * This function is used by the driver to print info/debug messages.
+ *
+ * \param format [OUT] Info string to print.
+ */
+typedef void (*Fvid2_PrintFxn)(const char *format, ...);
+
/**
* \name FVID2 Max limits
* @{
*/
typedef struct
{
- Fvid2_TimeStampFxn timeStampFxn;
+ Fvid2_TimeStampFxn timeStampFxn;
/**< By default, OSAL (BIOS) API is used to time stamp frames.
*
* Applications could over-ride the same, by providing a
/**< Not used now. Set to zero. */
} Fvid2_TimeStampParams;
+/**
+ * \brief FVID2 initialization parameters.
+ */
+typedef struct
+{
+ Fvid2_PrintFxn printFxn;
+ /**< If not NULL, this function will be called to print debug/info message
+ * with appropriate string. */
+} Fvid2_InitPrms;
+
/* ========================================================================== */
/* Function Declarations */
/* ========================================================================== */
* This function should be called before calling any of FVID2 API's and
* should be called only once.
*
- * \param args [IN] Not used currently. Set to NULL.
+ * \param initPrms [IN] FVID2 Initialization parameters.
+ * If NULL is passed, the default parameters will be
+ * assumed - no print will be enabled
*
* \return FVID2_SOK on success else appropriate FVID2 error code on failure.
*/
-int32_t Fvid2_init(void *args);
+int32_t Fvid2_init(const Fvid2_InitPrms *initPrms);
/**
* \brief FVID2 deinit function.
*/
static inline int32_t Fvid2_getFormat(Fvid2_Handle handle, Fvid2_Format *fmt);
+/*
+ * Structure Init functions
+ */
+/**
+ * \brief Fvid2_InitPrms structure init function.
+ *
+ * \param initPrms [IN] Pointer to #Fvid2_InitPrms structure.
+ *
+ */
+static inline void Fvid2InitPrms_init(Fvid2_InitPrms *initPrms);
+
/**
* \brief Fvid2_CbParams structure init function.
*
return Fvid2_control(handle, FVID2_GET_FORMAT, fmt, NULL);
}
+static inline void Fvid2InitPrms_init(Fvid2_InitPrms *initPrms)
+{
+ if (NULL != initPrms)
+ {
+ initPrms->printFxn = NULL;
+ }
+
+ return;
+}
+
static inline void Fvid2CbParams_init(Fvid2_CbParams *cbPrms)
{
if (NULL != cbPrms)
diff --git a/include/fvid2_utils.h b/include/fvid2_utils.h
index 03b828aa5884bda99afe148d9610a304d74b3751..5b7c33cc7962a6cfe83440dc29ce2d7c76541f9c 100755 (executable)
--- a/include/fvid2_utils.h
+++ b/include/fvid2_utils.h
/* Macros & Typedefs */
/* ========================================================================== */
-/** \brief Log enable for FVID2 Utils. */
-#define Fvid2Trace (GT_DEFAULT_MASK)
-
/** \brief Number of timestamps. */
#define FVID2UTILS_NUM_TIMESTAMP_LOG (100U)
diff --git a/include/trace.h b/include/trace.h
index b7eef57e564efb863bc6afd818dc3fdbb396162b..ec3c77d57ff15fd993b70acc1a2c8426b2293abd 100755 (executable)
--- a/include/trace.h
+++ b/include/trace.h
#include <ti/csl/tistdtypes.h>
- #if defined (FVID2_CFG_USE_STD_ASSERT)
-#include <assert.h>
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
-/** \brief The global trace variable containing current trace configuration. */
-extern int32_t curTrace;
-
/*!
* @def GT_TRACESTATE_MASK
* @brief Trace state mask
*/
-#define GT_TRACESTATE_MASK 0x0000000FU
-
+#define GT_TRACESTATE_MASK (0x0000000FU)
/*!
* @def GT_TRACESTATE_SHIFT
* @brief Bit shift for trace state
*/
-#define GT_TRACESTATE_SHIFT 0U
-
-/*!
- * @def GT_TRACEENTER_MASK
- * @brief Trace enter mask
- */
-#define GT_TRACEENTER_MASK 0x000000F0U
-
-/*!
- * @def GT_TRACEENTER_SHIFT
- * @brief Bit shift for trace enter
- */
-#define GT_TRACEENTER_SHIFT 4U
-
-/*!
- * @def GT_TRACESETFAILURE_MASK
- * @brief Trace Set Failure Reason mask
- */
-#define GT_TRACESETFAILURE_MASK 0x00000F00U
-
-/*!
- * @def GT_TRACESETFAILURE_SHIFT
- * @brief Bit shift for trace Set Failure Reason
- */
-#define GT_TRACESETFAILURE_SHIFT 8U
-
+#define GT_TRACESTATE_SHIFT (0U)
/*!
* @def GT_TRACECLASS_MASK
* @brief GT class mask
*/
-#define GT_TRACECLASS_MASK 0x000F0000U
-
+#define GT_TRACECLASS_MASK (0x000F0000U)
/*!
* @def GT_TRACECLASS_SHIFT
* @brief Bit shift for GT class mask
*/
-#define GT_TRACECLASS_SHIFT 16U
+#define GT_TRACECLASS_SHIFT (16U)
/*!
* @brief Default Mask to use with GT_assert
*/
-#define GT_DEFAULT_MASK (GT_ERR | GT_TraceState_Enable)
+#define GT_DEFAULT_MASK (GT_ERR | GT_TraceState_Enable)
/*!
* @brief Enumerates the types of states of trace (enable/disable)
*values for this enum */
} GT_TraceState;
-/*!
- * @brief Enumerates the states of enter/leave trace (enable/disable)
- */
-typedef enum {
- GT_TraceEnter_Disable = 0x00000000U,
- /*!< Disable GT_ENTER trace prints */
- GT_TraceEnter_Enable = 0x00000010U,
- /*!< Enable GT_ENTER trace prints */
- GT_TraceEnter_EndValue = 0x00000020U
- /*!< End delimiter indicating start of invalid
- *values for this enum */
-} GT_TraceEnter;
-
-/*!
- * @brief Enumerates the states of SetFailureReason trace (enable/disable)
- */
-typedef enum {
- GT_TraceSetFailure_Disable = 0x00000000U,
- /*!< Disable Set Failure trace prints */
- GT_TraceSetFailure_Enable = 0x00000100U,
- /*!< Enable Set Failure trace prints */
- GT_TraceSetFailure_EndValue = 0x00000200U
- /*!< End delimiter indicating start of invalid
- *values for this enum */
-} GT_TraceSetFailure;
-
/*!
* @brief Enumerates the types of trace classes
*/
/*!< Indicates a function leave class of trace */
} GT_TraceClass;
+/** \brief Log enable for FVID2 Utils. */
+#define Fvid2Trace (GT_DEFAULT_MASK)
+
/**
* \brief Prints to Shared memory and CCS console
*
*/
void Fvid2_printf(const char *format, ...);
-/**
- * \brief Prints to Shared memory only
- *
- * This function prints the provided formatted string to shared memory only
- *
- * \param format [IN] Formatted string followed by variable arguments
- *
- */
-void Fvid2_rprintf(const char *format, ...);
+#if defined (FVID2_CFG_ASSERT_ENABLE)
/** \brief assert function. */
-static inline void GT_assertLocal(uint32_t enableMask,
- uint32_t condition,
- const char *str,
- const char *fileName,
- int32_t lineNum);
+void GT_assertLocal(uint32_t enableMask,
+ uint32_t condition,
+ const char *str,
+ const char *fileName,
+ int32_t lineNum);
/** \brief GT_assert */
#define GT_assert(x, y) \
(GT_assertLocal((uint32_t) (x), (uint32_t) (y), (const char *) # y, \
(const char *) __FILE__, (int32_t) __LINE__))
-static inline void GT_assertLocal(uint32_t enableMask,
- uint32_t condition,
- const char *str,
- const char *fileName,
- int32_t lineNum)
-{
-#if defined (FVID2_CFG_ASSERT_ENABLE)
- if ((!(condition)) != 0)
- {
- Fvid2_printf(" Assertion @ Line: %d in %s: %s : failed !!!\n",
- lineNum, fileName, str);
- #if defined (FVID2_CFG_USE_STD_ASSERT)
- assert((!(condition)) != 0);
- #else
- while (TRUE)
- {
- ;
- }
- #endif /* #if defined(FVID2_CFG_USE_STD_ASSERT) */
- }
-#endif /* if defined(FVID2_CFG_ASSERT_ENABLE) */
-
- return;
-}
+#else
-#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,
- const char *fileName,
- int32_t lineNum,
- uint32_t status,
- const char *msg);
-/** \brief Function to report the FVID2 failure and log the trace. */
-#define GT_setFailureReason(maskType, classType, func, status, msg) \
- (GT_failureReasonSet((maskType), (const char *) (func), \
- (const char *) __FILE__, (int32_t) __LINE__, \
- (status), (const char *) (msg)))
-
-#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) \
- do { \
- if (maskType) { \
- } \
- if (classType) { \
- } \
- if (status) { \
- } \
- if ((uint32_t) (msg)) { \
- } \
- } while (FALSE)
-
-#endif /* if defined (FVID2_CFG_TRACE_ENABLE) */
+#define GT_assert(x, y)
+
+#endif
/**
* \brief Log the trace with zero parameters and information string.
diff --git a/src/fvid2_drvMgr.c b/src/fvid2_drvMgr.c
index c6fb7231b6c059ff66c2ff789dddddce59aa8d9f..c709238313b250bc43614af4880a5b9382e7e9d3 100755 (executable)
--- a/src/fvid2_drvMgr.c
+++ b/src/fvid2_drvMgr.c
/* Include Files */
/* ========================================================================== */
+/* This is needed for vsnprintf */
+#include <stdio.h>
+#include <stdarg.h>
#include <ti/drv/fvid2/include/fvid2_drvMgr.h>
/* ========================================================================== */
#define FDM_NUM_STD_STR_ENTRIES (sizeof (gFdmStdStrTable) / \
sizeof (Fdm_StdString))
+#if defined (FVID2_CFG_TRACE_ENABLE)
+#define REMOTE_DEBUG_SERVER_PRINT_BUF_LEN (uint32_t) (1024U * 2U)
+#endif
+
/* ========================================================================== */
/* Structure Declarations */
/* ========================================================================== */
/**< Semaphore to protect function calls and other memory allocation. */
} Fdm_Object;
+#if defined (FVID2_CFG_TRACE_ENABLE)
+typedef struct
+{
+ uint32_t coreId;
+ char printBuf[REMOTE_DEBUG_SERVER_PRINT_BUF_LEN];
+} RemoteDebug_ServerObj;
+#endif
+
/* ========================================================================== */
/* Function Declarations */
/* ========================================================================== */
/* Global Variables */
/* ========================================================================== */
+#if defined (FVID2_CFG_TRACE_ENABLE)
+static RemoteDebug_ServerObj gRemoteDebug_serverObj = {0};
+#endif
+
+/** \brief FDM init params. */
+static Fvid2_InitPrms gFdmInitPrms = {NULL};
+
/** \brief FDM objects. */
static Fdm_Object gFdmObj;
*
* \return Returns 0 on success else returns error value.
*/
-int32_t Fvid2_init(void *args)
+int32_t Fvid2_init(const Fvid2_InitPrms *initPrms)
{
uint32_t cnt;
int32_t retVal = FVID2_SOK;
int32_t initValue;
SemaphoreP_Params params;
+ Fvid2InitPrms_init(&gFdmInitPrms);
+ if (NULL != initPrms)
+ {
+ Fvid2Utils_memcpy(&gFdmInitPrms, initPrms, sizeof (gFdmInitPrms));
+ }
+
/* Init all global variables to zero */
Fvid2Utils_memset(&gFdmObj, 0U, sizeof (gFdmObj));
gFdmObj.lockSem = SemaphoreP_create(initValue, ¶ms);
if (NULL == gFdmObj.lockSem)
{
- Fvid2_printf("FVID2 semaphore create failed!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "FVID2 semaphore create failed!!\r\n");
retVal = FVID2_EALLOC;
}
if (drvOps->drvId == gFdmObj.fdmDriverObjects[cnt].drvOps->drvId)
{
- Fvid2_printf("Driver with same id already registered!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR,
+ "Driver with same id already registered!!\r\n");
retVal = FVID2_EDRIVER_INUSE;
break;
}
}
else
{
- Fvid2_printf("Alloc driver object failed!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Alloc driver object failed!!\r\n");
retVal = FVID2_EALLOC;
}
}
}
else
{
- Fvid2_printf("Driver Ops not supported!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Driver Ops not supported!!\r\n");
}
if (NULL != drvHandle)
}
else
{
- Fvid2_printf("Driver create failed!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Driver create failed!!\r\n");
/* Free the allocated channel object */
fdmFreeChannelObject(channel);
}
else
{
- Fvid2_printf("EALLOC: Invalid driver ID!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "EALLOC: Invalid driver ID!!\r\n");
}
SemaphoreP_post(gFdmObj.lockSem);
}
else
{
- Fvid2_printf("Driver Ops not supported!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Driver Ops not supported!!\r\n");
}
channel->drv->numOpens--;
}
else
{
- Fvid2_printf("EBADARGS: NULL pointer!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "EBADARGS: NULL pointer!!\r\n");
retVal = FVID2_EBADARGS;
}
}
else
{
- Fvid2_printf("Driver Ops not supported!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Driver Ops not supported!!\r\n");
retVal = FVID2_EUNSUPPORTED_OPS;
}
}
else
{
- Fvid2_printf("EBADARGS: NULL pointer!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "EBADARGS: NULL pointer!!\r\n");
retVal = FVID2_EBADARGS;
}
}
else
{
- Fvid2_printf("Driver Ops not supported!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Driver Ops not supported!!\r\n");
retVal = FVID2_EUNSUPPORTED_OPS;
}
}
else
{
- Fvid2_printf("EBADARGS: NULL pointer!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "EBADARGS: NULL pointer!!\r\n");
retVal = FVID2_EBADARGS;
}
}
else
{
- Fvid2_printf("Driver Ops not supported!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Driver Ops not supported!!\r\n");
retVal = FVID2_EUNSUPPORTED_OPS;
}
}
else
{
- Fvid2_printf("EBADARGS: NULL pointer!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "EBADARGS: NULL pointer!!\r\n");
retVal = FVID2_EBADARGS;
}
}
else
{
- Fvid2_printf("Driver Ops not supported!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Driver Ops not supported!!\r\n");
retVal = FVID2_EUNSUPPORTED_OPS;
}
}
else
{
- Fvid2_printf("EBADARGS: NULL pointer!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "EBADARGS: NULL pointer!!\r\n");
retVal = FVID2_EBADARGS;
}
}
else
{
- Fvid2_printf("Driver Ops not supported!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Driver Ops not supported!!\r\n");
retVal = FVID2_EUNSUPPORTED_OPS;
}
}
else
{
- Fvid2_printf("EBADARGS: NULL pointer!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "EBADARGS: NULL pointer!!\r\n");
retVal = FVID2_EBADARGS;
}
if (NULL == matchedEntry)
{
- Fvid2_printf("Unsupported standard!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Unsupported standard!!\r\n");
retVal = FVID2_EINVALID_PARAMS;
}
else
}
else
{
- Fvid2_printf("EBADARGS: NULL pointer!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "EBADARGS: NULL pointer!!\r\n");
retVal = FVID2_EBADARGS;
}
/* Check for NULL pointer */
if (NULL == frameList)
{
- Fvid2_printf("EBADARGS: NULL pointer!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "EBADARGS: NULL pointer!!\r\n");
retVal = FVID2_EBADARGS;
}
else
/* Check whether num frames is within range */
if (frameList->numFrames > maxFrames)
{
- Fvid2_printf("Number of frames exceeds max!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Number of frames exceeds max!!\r\n");
retVal = FVID2_EOUT_OF_RANGE;
}
/* Check whether num frames is within range */
if (frameList->numFrames > FVID2_MAX_FRAME_PTR)
{
- Fvid2_printf("Number of frames exceeds FVID2 max!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR,
+ "Number of frames exceeds FVID2 max!!\r\n");
retVal = FVID2_EOUT_OF_RANGE;
}
/* Check whether num frames is zero */
if (0U == frameList->numFrames)
{
- Fvid2_printf("Number of frames is zero!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Number of frames is zero!!\r\n");
retVal = FVID2_EOUT_OF_RANGE;
}
/* Check for NULL pointer */
if (NULL == frameList->frames[frmCnt])
{
- Fvid2_printf("EBADARGS: NULL pointer!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR,
+ "EBADARGS: NULL pointer!!\r\n");
retVal = FVID2_EBADARGS;
break;
}
/* Check for NULL pointer */
if (NULL == frameList)
{
- Fvid2_printf("EBADARGS: NULL pointer!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "EBADARGS: NULL pointer!!\r\n");
retVal = FVID2_EBADARGS;
}
else
/* Check whether max frames is within range */
if (maxFrames > FVID2_MAX_FRAME_PTR)
{
- Fvid2_printf("Number of frames exceeds FVID2 max!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR,
+ "Number of frames exceeds FVID2 max!!\r\n");
retVal = FVID2_EOUT_OF_RANGE;
}
}
}
else
{
- Fvid2_printf("Driver in use!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Driver in use!!\r\n");
retVal = FVID2_EDEVICE_INUSE;
}
break;
if (FVID2_EFAIL == retVal)
{
- Fvid2_printf("Driver ops not found!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR, "Driver ops not found!!\r\n");
}
return (retVal);
}
else
{
- Fvid2_printf("Freeing a channel object not in use!!\r\n");
+ GT_0trace(Fvid2Trace, GT_ERR,
+ "Freeing a channel object not in use!!\r\n");
}
return (retVal);
}
+void Fvid2_printf(const char *format, ...)
+{
+#if defined (FVID2_CFG_TRACE_ENABLE)
+ 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);
+
+ if(gFdmInitPrms.printFxn != NULL)
+ {
+ gFdmInitPrms.printFxn(buf);
+ }
+#endif
+ return;
+}
diff --git a/src/makefile b/src/makefile
index dc96e3881f2837e2053483d4b73f63ebe715bd58..c7110b18d70a3d78f3fc2c55df841e20cc91c374 100755 (executable)
--- a/src/makefile
+++ b/src/makefile
SRCS_COMMON += fvid2_drvMgr.c fvid2_utils.c fvid2_graph.c trace.c
-CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS)
+CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS) $(FVID2_CFLAGS)
PACKAGE_SRCS_COMMON = fvid2.h fvid2_component.mk makefile .gitignore include src
PACKAGE_SRCS_COMMON += config_mk.bld package.bld package.xdc package.xs
PACKAGE_SRCS_COMMON += Settings.xdc.xdt fvid2ver.h fvid2ver.h.xdt
diff --git a/src/trace.c b/src/trace.c
index f77600d0dc6a78dc976af4c53660106995c551f1..9097882c154d017892c0de317b0578dcb45fb299 100644 (file)
--- a/src/trace.c
+++ b/src/trace.c
/* ========================================================================== */
#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
+/* None */
/* ========================================================================== */
/* Structure Declarations */
/* ========================================================================== */
-typedef struct
-{
- uint32_t coreId;
- char printBuf[REMOTE_DEBUG_SERVER_PRINT_BUF_LEN];
-} RemoteDebug_ServerObj;
+/* None */
/* ========================================================================== */
/* Function Declarations */
/* Global Variables */
/* ========================================================================== */
-static RemoteDebug_ServerObj gRemoteDebug_serverObj = {0};
-
-/** \brief Global trace flag. */
-int32_t curTrace = 0;
+/* None */
/* ========================================================================== */
/* 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;
-}
-
+#if defined (FVID2_CFG_TRACE_ENABLE)
/**
* \brief Function to log the trace with zero parameters and just
* information string.
* \param The debug string.
*/
void
-GT_trace0(uint32_t maskType,
+GT_trace0(uint32_t maskType,
GT_TraceClass classType,
const char *fileName,
- int32_t lineNum,
+ 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))
+ /* Check if specified class is enabled. */
+ if ((maskType & GT_TRACECLASS_MASK) >= classType)
{
- if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable)
+ /* Print if specified class is greater than or equal to class
+ * for this specific print.
+ */
+ if (!((classType == GT_INFO) || (classType == GT_INFO1)))
{
- 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);
+ Fvid2_printf("%s @ Line %d: ", fileName, lineNum);
}
+ Fvid2_printf((const char *) infoString);
}
}
}
* \param param The additional parameter which needs to be logged.
*/
void
-GT_trace1(uint32_t maskType,
+GT_trace1(uint32_t maskType,
GT_TraceClass classType,
const char *fileName,
- int32_t lineNum,
+ int32_t lineNum,
const char *infoString,
- uint32_t param0)
+ 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)
{
- /* 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)))
{
- /* 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);
+ Fvid2_printf("%s @ Line %d: ", fileName, lineNum);
}
+ Fvid2_printf((const char *) infoString, param0);
}
}
}
* \param param1 The second parameter which needs to be logged.
*/
void
-GT_trace2(uint32_t maskType,
+GT_trace2(uint32_t maskType,
GT_TraceClass classType,
const char *fileName,
- int32_t lineNum,
+ int32_t lineNum,
const char *infoString,
- uint32_t param0,
- uint32_t param1)
+ 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)
{
- /* 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)))
{
- /* 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);
+ Fvid2_printf("%s @ Line %d: ", fileName, lineNum);
}
+ Fvid2_printf((const char *) infoString, param0, param1);
}
}
}
* \param param2 The third parameter which needs to be logged.
*/
void
-GT_trace3(uint32_t maskType,
+GT_trace3(uint32_t maskType,
GT_TraceClass classType,
const char *fileName,
- int32_t lineNum,
+ int32_t lineNum,
const char *infoString,
- uint32_t param0,
- uint32_t param1,
- uint32_t param2)
+ 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))
+ /* Check if specified class is enabled. */
+ if ((maskType & GT_TRACECLASS_MASK) >= classType)
{
- if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable)
+ /* Print if specified class is greater than or equal to class
+ * for this specific print.
+ */
+ if (!((classType == GT_INFO) || (classType == GT_INFO1)))
{
- 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);
+ Fvid2_printf("%s @ Line %d: ", fileName, lineNum);
}
+ Fvid2_printf((const char *) infoString, param0, param1, param2);
}
}
}
* \param param3 The fourth parameter which needs to be logged.
*/
void
-GT_trace4(uint32_t maskType,
+GT_trace4(uint32_t maskType,
GT_TraceClass classType,
const char *fileName,
- int32_t lineNum,
+ int32_t lineNum,
const char *infoString,
- uint32_t param0,
- uint32_t param1,
- uint32_t param2,
- uint32_t param3)
+ 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))
+ /* Check if specified class is enabled. */
+ if ((maskType & GT_TRACECLASS_MASK) >= classType)
{
- if ((maskType & GT_TRACEENTER_MASK) == GT_TraceEnter_Enable)
+ /* Print if specified class is greater than or equal to class
+ * for this specific print.
+ */
+ if (!((classType == GT_INFO) || (classType == GT_INFO1)))
{
- 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);
+ Fvid2_printf("%s @ Line %d: ", fileName, lineNum);
}
+ Fvid2_printf(
+ (const char *) infoString, param0, param1, param2, param3);
}
}
}
* \param param4 The fifth parameter which needs to be logged.
*/
void
-GT_trace5(uint32_t maskType,
+GT_trace5(uint32_t maskType,
GT_TraceClass classType,
const char *fileName,
- int32_t lineNum,
+ int32_t lineNum,
const char *infoString,
- uint32_t param0,
- uint32_t param1,
- uint32_t param2,
- uint32_t param3,
- uint32_t param4)
+ 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)
{
- /* 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)))
{
- /* 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);
+ Fvid2_printf("%s @ Line %d: ", fileName, lineNum);
}
+ Fvid2_printf(
+ (const char *) infoString,
+ param0, param1, param2, param3, param4);
}
}
}
* \param param5 The sixth parameter which needs to be logged.
*/
void
-GT_trace6(uint32_t maskType,
+GT_trace6(uint32_t maskType,
GT_TraceClass classType,
const char *fileName,
- int32_t lineNum,
+ 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 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)
{
- /* 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)))
{
- /* 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);
+ Fvid2_printf("%s @ Line %d: ", fileName, lineNum);
}
+ Fvid2_printf(
+ (const char *) infoString,
+ param0, param1, param2, param3, param4, param5);
}
}
}
* \param param6 The sixth parameter which needs to be logged.
*/
void
-GT_trace7(uint32_t maskType,
+GT_trace7(uint32_t maskType,
GT_TraceClass classType,
const char *fileName,
- int32_t lineNum,
+ 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)
+ 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)
{
- /* 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)))
{
- /* 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);
+ Fvid2_printf("%s @ Line %d: ", fileName, lineNum);
}
+ Fvid2_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)
+#endif
+
+#if defined (FVID2_CFG_ASSERT_ENABLE)
+void GT_assertLocal(uint32_t enableMask,
+ uint32_t condition,
+ const char *str,
+ const char *fileName,
+ int32_t lineNum)
{
- if ((((uint32_t) enableMask &
- GT_TRACESETFAILURE_MASK) >> GT_TRACESETFAILURE_SHIFT)
- == GT_TraceState_Enable)
+ if ((!(condition)) != 0)
{
- Osal_printf("*** %s: %s\tError [0x%x] at Line no: %d in file %s\r\n",
- func,
- msg,
- status,
- lineNum,
- fileName);
+ GT_3trace(
+ Fvid2Trace, GT_ERR,
+ " Assertion @ Line: %d in %s: %s : failed !!!\n",
+ lineNum, fileName, str);
+ while (TRUE)
+ {
+ ;
+ }
}
-}
+ return;
+}
+#endif /* if defined(FVID2_CFG_ASSERT_ENABLE) */