PDK API Guide for J7200
enet_trace.h File Reference

Introduction

This file contains the type definitions and helper macros for the Enet Trace interface.

Go to the source code of this file.

Macros

Build-Time Trace Levels

Enet LLD supports two types of trace levels: build-time and runtime. Build time trace level is specified via ENET_CFG_TRACE_LEVEL and can be any of the levels in this group. The runtime trace level is set through Enet_setTraceLevel().

The runtime trace level should be set equal to or less than the build-time trace level.

#define ENET_CFG_TRACE_LEVEL_NONE   (0U)
 All traces disabled at build-time. More...
 
#define ENET_CFG_TRACE_LEVEL_ERROR   (1U)
 Build-time error level. More...
 
#define ENET_CFG_TRACE_LEVEL_WARN   (2U)
 Build-time warning level. More...
 
#define ENET_CFG_TRACE_LEVEL_INFO   (3U)
 Build-time information level. More...
 
#define ENET_CFG_TRACE_LEVEL_DEBUG   (4U)
 Build-time debug level. More...
 
#define ENET_CFG_TRACE_LEVEL_VERBOSE   (5U)
 Build-time verbose level. More...
 
Trace Formats

The following trace formats are supported:

  • Function prefix: <func>: string
  • File and line number prefix: <func>: <line>: string
  • File, line number and function prefix: <file>: <line>: <func>: string

Any of these trace formats can also be prefixed with a timestamp.

#define ENET_CFG_TRACE_FORMAT_FUNC   (0U)
 Trace prefix: "<func>: string". More...
 
#define ENET_CFG_TRACE_FORMAT_FILE   (1U)
 Trace prefix: "<file>: <line>: string". More...
 
#define ENET_CFG_TRACE_FORMAT_FULL   (2U)
 Trace prefix: "<file>: <line>: <func>: string". More...
 
#define ENET_CFG_TRACE_FORMAT_FUNC_TS   (3U)
 Trace prefix: "<timestamp>: <func>: string". More...
 
#define ENET_CFG_TRACE_FORMAT_FILE_TS   (4U)
 Trace prefix: "<timestamp>: <file>: <line>: string". More...
 
#define ENET_CFG_TRACE_FORMAT_FULL_TS   (5U)
 Trace prefix: "<timestamp>: <file>: <line>: <func>: string". More...
 
Enet Trace Configuration Parameters

The default values of the Enet Trace configuration parameters if none is provided via enet_cfg.h.

#define ENET_CFG_TRACE_LEVEL   (ENET_CFG_TRACE_LEVEL_INFO)
 Default trace level if none is set. More...
 
#define ENET_CFG_TRACE_FORMAT   (ENET_CFG_TRACE_FORMAT_FUNC)
 Default trace format if none is specified. More...
 
Enet Trace Error Code

Enet Trace is capable of generating unique error codes from module id (Enet core, soc, per, mod, phy, etc), line number (where error code was reported) and status (error value reported by the module).

The error code is a 32-bit value which is generated as follows:

  • Bits 31:28 - Module's major number (see ENET_TRACE_MOD_ID)
  • Bits 27:20 - Module's minor number (see ENET_TRACE_MOD_ID)
  • Bits 19:8 - Line number where error was reported by the driver
  • Bits 7:0 - Status value (positive value)
Major Number Module File location
0 Enet core src/core/*.c, src/common/*.c
1 Peripherals src/per/*.c
2 Modules src/mod/*.c
3 DMA src/dma/*.c
4 Enet SoC soc/*.c
5 PHY src/phy/*.c

Each individual source file in the locations shown in previous table is considered a module and is tagged with a unique ENET_TRACE_MOD_ID, denoting the module's major (4-bit) and minor (16-bit) numbers.

#define ENET_TRACE_ERRCODE_MOD_OFFSET   (20U)
 Module id offset in the error code value. More...
 
#define ENET_TRACE_ERRCODE_MOD_MAJ_OFFSET   (28U)
 Module id (major number) offset in the error code value. More...
 
#define ENET_TRACE_ERRCODE_MOD_MIN_OFFSET   (20U)
 Module id (minor number) offset in the error code value. More...
 
#define ENET_TRACE_ERRCODE_LINE_OFFSET   (8U)
 Line number offset in the error code value. More...
 
#define ENET_TRACE_ERRCODE_STATUS_OFFSET   (0U)
 Status offset in the error code value. More...
 
#define ENET_TRACE_ERRCODE_MOD_MASK   (0xFFF00000U)
 Module id mask in the error code value. More...
 
#define ENET_TRACE_ERRCODE_MOD_MAJ_MASK   (0xF0000000U)
 Module id (major number) mask in the error code value. More...
 
#define ENET_TRACE_ERRCODE_MOD_MIN_MASK   (0x0FF00000U)
 Module id (minor number) mask in the error code value. More...
 
#define ENET_TRACE_ERRCODE_LINE_MASK   (0x000FFF00U)
 Line number mask in the error code value. More...
 
#define ENET_TRACE_ERRCODE_STATUS_MASK   (0x000000FFU)
 Status mask in the error code value. More...
 
#define ENET_TRACE_ERRCODE_MOD(x)
 Helper macro to extract the module id from the error code value. More...
 
#define ENET_TRACE_ERRCODE_MOD_MAJ(x)
 Helper macro to extract the module id (major number) from the error code value. More...
 
#define ENET_TRACE_ERRCODE_MOD_MIN(x)
 Helper macro to extract the module id (minor number) from the error code value. More...
 
#define ENET_TRACE_ERRCODE_LINE(x)
 Helper macro to extract the line number from the error code value. More...
 
#define ENET_TRACE_ERRCODE_STATUS(x)
 Helper macro to extract the status value from the error code value. More...
 

Typedefs

typedef uint64_t(* EnetTrace_TraceTsFunc) (void)
 Callback function used to get trace timestamps. More...
 
typedef void(* EnetTrace_ExtTraceFunc) (uint32_t errCode)
 Callback function called to report errors. More...
 

Enumerations

enum  EnetTrace_TraceLevel {
  ENET_TRACE_NONE = 0U, ENET_TRACE_ERROR = 1U, ENET_TRACE_WARN = 2U, ENET_TRACE_INFO = 3U,
  ENET_TRACE_DEBUG = 4U, ENET_TRACE_VERBOSE = 5U
}
 Enumerates the types of trace level. More...