#define NUM_LOG_LEVEL 10 /*!< \brief the number of message levels users have with LOG */
/* @}*/
/** @defgroup _logIt logIt function
* @ingroup _macro
* @brief Macro used to call tr_log_full_ex with file, function and line information
* @{*/
#ifdef USER_MODE
//#define logIt(component, level, format, args...) do {logRecord(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args);} while(0);
#ifdef LOG_NO_THREAD
#define logIt(component, level, format, args...) logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args)
#else //default
#define logIt(component, level, format, args...) logRecord(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args)
#endif
#else
#ifdef LOG_NO_THREAD
#define logIt(component, level, format, args...) logRecord_mt(NULL, __FUNCTION__, __LINE__, component, level, format, ##args)
#else // default
#define logIt(component, level, format, args...) logRecord(NULL, __FUNCTION__, __LINE__, component, level, format, ##args)
#endif
#endif
/* @}*/
/** @defgroup _debugging debugging macros
* @ingroup _macro
* @brief Macro used to call logIt function with different message levels
* @{*/
// debugging macros
#ifdef USER_MODE
# if T_TRACER
# include "T.h"
# define LOG_I(c, x...) T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x))
# define LOG_W(c, x...) T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x))
# define LOG_E(c, x...) T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x))
# define LOG_D(c, x...) T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x))
# define LOG_T(c, x...) T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x))
# define LOG_G(c, x...) /* */
# define LOG_A(c, x...) /* */
# define LOG_C(c, x...) /* */
# define LOG_N(c, x...) /* */
# define LOG_F(c, x...) /* */
# else /* T_TRACER */
# define LOG_G(c, x...) logIt(c, LOG_EMERG, x)
# define LOG_A(c, x...) logIt(c, LOG_ALERT, x)
# define LOG_C(c, x...) logIt(c, LOG_CRIT, x)
# define LOG_E(c, x...) logIt(c, LOG_ERR, x)
# define LOG_W(c, x...) logIt(c, LOG_WARNING, x)
# define LOG_N(c, x...) logIt(c, LOG_NOTICE, x)
# define LOG_I(c, x...) logIt(c, LOG_INFO, x)
# define LOG_D(c, x...) logIt(c, LOG_DEBUG, x)
# define LOG_F(c, x...) logIt(c, LOG_FILE, x) // log to a file, useful for the MSC chart generation
# define LOG_T(c, x...) logIt(c, LOG_TRACE, x)
# endif /* T_TRACER */
#else /* USER_MODE */
# define LOG_G(c, x...) printk(x)
# define LOG_A(c, x...) printk(x)
# define LOG_C(c, x...) printk(x)
# define LOG_E(c, x...) printk(x)
# define LOG_W(c, x...) printk(x)
# define LOG_N(c, x...) printk(x)
# define LOG_I(c, x...) printk(x)
# define LOG_D(c, x...) printk(x)
# define LOG_T(c, x...) printk(x)
#endif
/* @}*/
/** @defgroup _useful_functions useful functions in LOG
* @ingroup _macro
* @brief Macro of some useful functions defined by LOG
* @{*/
#define LOG_ENTER(c) do {LOG_T(c, "Entering\n");}while(0) /*!< \brief Macro to log a message with severity DEBUG when entering a function */
#define LOG_EXIT(c) do {LOG_T(c,"Exiting\n"); return;}while(0) /*!< \brief Macro to log a message with severity TRACE when exiting a function */
#define LOG_RETURN(c,x) do {uint32_t __rv;__rv=(unsigned int)(x);LOG_T(c,"Returning %08x\n", __rv);return((typeof(x))__rv);}while(0) /*!< \brief Macro to log a function exit, including integer value, then to return a value to the calling function */
* @brief Macro used to call tr_log_full_ex with file, function and line information
* @{*/
#ifdef USER_MODE
//#define logIt(component, level, format, args...) do {logRecord(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args);} while(0);
#ifdef LOG_NO_THREAD
#define logIt(component, level, format, args...) logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args)
#else //default
#define logIt(component, level, format, args...) logRecord(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args)
#endif
#else
#ifdef LOG_NO_THREAD
#define logIt(component, level, format, args...) logRecord_mt(NULL, __FUNCTION__, __LINE__, component, level, format, ##args)
#else // default
#define logIt(component, level, format, args...) logRecord(NULL, __FUNCTION__, __LINE__, component, level, format, ##args)
#endif
#endif
/* @}*/
/** @defgroup _debugging debugging macros
* @ingroup _macro
* @brief Macro used to call logIt function with different message levels
* @{*/
// debugging macros
#ifdef USER_MODE
# if T_TRACER
# include "T.h"
# define LOG_I(c, x...) T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x))
# define LOG_W(c, x...) T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x))
# define LOG_E(c, x...) T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x))
# define LOG_D(c, x...) T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x))
# define LOG_T(c, x...) T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x))
# define LOG_G(c, x...) /* */
# define LOG_A(c, x...) /* */
# define LOG_C(c, x...) /* */
# define LOG_N(c, x...) /* */
# define LOG_F(c, x...) /* */
# else /* T_TRACER */
# define LOG_G(c, x...) logIt(c, LOG_EMERG, x)
# define LOG_A(c, x...) logIt(c, LOG_ALERT, x)
# define LOG_C(c, x...) logIt(c, LOG_CRIT, x)
# define LOG_E(c, x...) logIt(c, LOG_ERR, x)
# define LOG_W(c, x...) logIt(c, LOG_WARNING, x)
# define LOG_N(c, x...) logIt(c, LOG_NOTICE, x)
# define LOG_I(c, x...) logIt(c, LOG_INFO, x)
# define LOG_D(c, x...) logIt(c, LOG_DEBUG, x)
# define LOG_F(c, x...) logIt(c, LOG_FILE, x) // log to a file, useful for the MSC chart generation
# define LOG_T(c, x...) logIt(c, LOG_TRACE, x)
# endif /* T_TRACER */
#else /* USER_MODE */
# define LOG_G(c, x...) printk(x)
# define LOG_A(c, x...) printk(x)
# define LOG_C(c, x...) printk(x)
# define LOG_E(c, x...) printk(x)
# define LOG_W(c, x...) printk(x)
# define LOG_N(c, x...) printk(x)
# define LOG_I(c, x...) printk(x)
# define LOG_D(c, x...) printk(x)
# define LOG_T(c, x...) printk(x)
#endif
/* @}*/
/** @defgroup _useful_functions useful functions in LOG
* @ingroup _macro
* @brief Macro of some useful functions defined by LOG
* @{*/
#define LOG_ENTER(c) do {LOG_T(c, "Entering\n");}while(0) /*!< \brief Macro to log a message with severity DEBUG when entering a function */
#define LOG_EXIT(c) do {LOG_T(c,"Exiting\n"); return;}while(0) /*!< \brief Macro to log a message with severity TRACE when exiting a function */
#define LOG_RETURN(c,x) do {uint32_t __rv;__rv=(unsigned int)(x);LOG_T(c,"Returning %08x\n", __rv);return((typeof(x))__rv);}while(0) /*!< \brief Macro to log a function exit, including integer value, then to return a value to the calling function */