Skip to content

Commit

Permalink
Add per-file debug log enable #define
Browse files Browse the repository at this point in the history
  • Loading branch information
Raptor Engineering Development Team authored and madscientist159 committed Apr 6, 2020
1 parent 0ccad09 commit dc7e4bd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
11 changes: 11 additions & 0 deletions src/hwpf/plat_trace.H
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,27 @@ extern "C"
#include "trac_interface.h"
}

#ifdef SBE_CONSOLE_SUPPORT
#include "printf.H"
#endif

// Why not a #define, why is this in the fapi2 namespace?
// To prevent problems with Cronus and the fapi1 definitions.
namespace fapi2
{
static const uint32_t MAX_ECMD_STRING_LEN = 64;
};

#if defined(SBE_CONSOLE_SUPPORT) && defined(ENABLE_CONSOLE_TRACE_IN_FILE)
#define FAPI_TRACE(_id_, _fmt_, _args_...) { \
printf(_fmt_, ##_args_); \
printf("\n\r"); \
}
#else
// Information traces (go into fast trace buffer that can wrap often)
#define FAPI_TRACE(_id_, _fmt_, _args_...) \
PK_TRACE(_fmt_, ##_args_);
#endif


/* The following is a desirous trace entry but the second line has a
Expand Down
25 changes: 19 additions & 6 deletions src/sbefw/core/sbetrace.H
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ extern "C" {
#include "pk_api.h"
#include "trac_interface.h"

#ifdef SBE_CONSOLE_SUPPORT
#include "printf.H"
#endif

#ifdef __cplusplus
}
#endif
Expand All @@ -47,6 +51,15 @@ extern "C" {
#define SBE_EXIT(args...)
#define SBE_DEBUG(args...)

#if defined(SBE_CONSOLE_SUPPORT) && defined(ENABLE_CONSOLE_TRACE_IN_FILE)
#define PK_TRACE_INTERNAL(args...) { \
printf(args); \
printf("\n\r"); \
}
#else
#define PK_TRACE_INTERNAL(args...) PK_TRACE(args)
#endif

// Levels of logging
// 0 - No tracing
// 1 - Error
Expand All @@ -55,21 +68,21 @@ extern "C" {
// 4 - Error, info, entry/exit, debug
#if (SBE_TRACE_LEVEL >= 1)
#undef SBE_ERROR
#define SBE_ERROR(args...) PK_TRACE(SBE_ERR_MRK"" args)
#define SBE_ERROR(args...) PK_TRACE_INTERNAL(SBE_ERR_MRK"" args)
#endif
#if (SBE_TRACE_LEVEL >= 2)
#undef SBE_INFO
#define SBE_INFO(args...) PK_TRACE(SBE_INF_MRK"" args)
#define SBE_INFO(args...) PK_TRACE_INTERNAL(SBE_INF_MRK"" args)
#endif
#if (SBE_TRACE_LEVEL >= 3)
#undef SBE_ENTER
#undef SBE_EXIT
#define SBE_ENTER(args...) PK_TRACE(SBE_ENTER_MRK"" args)
#define SBE_EXIT(args...) PK_TRACE(SBE_EXIT_MRK"" args)
#define SBE_ENTER(args...) PK_TRACE_INTERNAL(SBE_ENTER_MRK"" args)
#define SBE_EXIT(args...) PK_TRACE_INTERNAL(SBE_EXIT_MRK"" args)
#endif
#if (SBE_TRACE_LEVEL >= 4)
#undef SBE_DEBUG
#define SBE_DEBUG(args...) PK_TRACE(SBE_DEBUG_MRK"" args)
#define SBE_DEBUG(args...) PK_TRACE_INTERNAL(SBE_DEBUG_MRK"" args)
#endif
#define SBE_TRACE(args...) PK_TRACE(args)
#define SBE_TRACE(args...) PK_TRACE_INTERNAL(args)
#endif // __SBEFW_SBE_TRACE_H

0 comments on commit dc7e4bd

Please sign in to comment.