# DBG_PRINT
[DEBUG]

Print Debug feature. More...

Collaboration diagram for DBG_PRINT:

## Defines
#define | FLAG_SHORT_SUPPORTED
| whether short type is supported
## Enumerations
enum | { S_COPY, S_PERCENT, S_FLAGS, S_WIDTH, S_DOT, S_PRECIS, S_SIZE, S_TYPE, S_MAX }
| States values.
enum | { C_OTHER, C_PERCENT, C_DOT, C_ZERO, C_DIGIT, C_FLAG, C_SIZE, C_TYPE, C_MAX }
| character type values
enum | { FLAG_SHORT = (1 << 0), FLAG_LONG = (1 << 1), FLAG_SIGNED = (1 << 2), FLAG_SIGN = (1 << 3), FLAG_SIGN_SPACE = (1 << 4), FLAG_LEFT = (1 << 5), FLAG_LEAD_ZERO = (1 << 6), FLAG_NEGATIVE = (1 << 7) }
| field_flags used to store the format information
## Functions
static uint32_t | type_get (char c)
| Function to read a particular character and map its type.
void | dbg_test_print (const char *fmt,...)
| Function formatting a string and sending it to the defined output.
## Variables
static const uint8_t | transition_table [S_MAX][C_MAX]
| Transition table.
static const char | hex_upper_table [] = "0123456789ABCDEF"
| Upper case hexadecimal table.
## Debug Print definitions
enum | dbg_mod_tag { DBG_MOD_IDX_KE = 0, DBG_MOD_IDX_DBG, DBG_MOD_IDX_IPC, DBG_MOD_IDX_DMA, DBG_MOD_IDX_MM, DBG_MOD_IDX_TX, DBG_MOD_IDX_RX, DBG_MOD_IDX_PHY, DBG_MOD_IDX_MAX }
| Module filtering macros, used only by debug module. More...
enum | dbg_sev_tag { DBG_SEV_IDX_NONE = 0, DBG_SEV_IDX_CRT, DBG_SEV_IDX_ERR, DBG_SEV_IDX_WRN, DBG_SEV_IDX_INF, DBG_SEV_IDX_VRB, DBG_SEV_IDX_MAX, DBG_SEV_ALL }
| Severity filtering macros, used only by debug module. More...
uint32_t | dbg_snprintf (char *buffer, uint32_t size, const char *fmt,...)
| Execute a pseudo snprintf function.
uint32_t | dbg_vsnprintf_offset (char *buffer, uint32_t size, uint32_t offset, const char *fmt, va_list args)
| Execute a pseudo vsnprintf function.
#define | NX_PRINT_NONE 0
| All print macro are discarded.
#define | NX_PRINT_IPC 1
| Print are sent to IPC.
#define | NX_PRINT_PRINTF 2
| Print are sent to standard printf.
#define | NX_PRINT_PRINTK 3
| Print are sent to Linux printk.
#define | D_KE "\x80"
| Prefix for Kernel.
#define | D_DBG "\x81"
| Prefix for DBG.
#define | D_IPC "\x82"
| Prefix for IPC.
#define | D_DMA "\x83"
| Prefix for DMA.
#define | D_MM "\x84"
| Prefix for LMAC management.
#define | D_TX "\x85"
| Prefix for Tx path.
#define | D_RX "\x86"
| Prefix for Rx path.
#define | D_PHY "\x87"
| Prefix for Modem / RF.
#define | D_XX0 "\x88"
| Prefix unused.
#define | D_XX1 "\x89"
| Prefix unused.
#define | D_XX2 "\x8A"
| Prefix unused.
#define | D_XX3 "\x8B"
| Prefix unused.
#define | D_XX4 "\x8C"
| Prefix unused.
#define | D_CRT "\x9A"
| Prefix for critical.
#define | D_ERR "\x9B"
| Prefix for error.
#define | D_WRN "\x9C"
| Prefix for warning.
#define | D_INF "\x9D"
| Prefix for info.
#define | D_VRB "\x9E"
| Prefix for verbose debug.
#define | DBG_MOD_MIN 0x80
| All print macro are discarded.
#define | DBG_MOD_MAX (DBG_MOD_MIN + DBG_MOD_IDX_MAX)
| All print macro are discarded.
#define | DBG_MOD_ALL 0xFFFFFFFF
| All print macro are discarded.
#define | DBG_SEV_MIN 0x9A
| All print macro are discarded.
#define | DBG_SEV_MAX 0xA0
| All print macro are discarded.
#define | dbg(fmt,...) do {} while (0)
| All print macro are discarded.
#define | dbg_vsnprintf(buffer, size, fmt, args) dbg_vsnprintf_offset(buffer, size, 0, fmt, args)
| Execute a pseudo vsnprintf function.

## Detailed Description

Print Debug feature.

## Define Documentation

#define dbg_vsnprintf | ( | buffer,
|  | size,
|  | fmt,
|  | args |  | ) | dbg_vsnprintf_offset(buffer, size, 0, fmt, args)

Execute a pseudo vsnprintf function.

Parameters:

  `[out]` | buffer | Output buffer
  `[in]` | size | Size of the output buffer
  `[in]` | fmt | Format string
  `[in]` | args | Variable list of arguments

Returns:
  Upon successful return, returns the number of characters printed (excluding the null byte used to end output to strings). If the output was truncated due to the size limit, then the return value is the number of characters (excluding the terminating null byte) which would have been written to the final string if enough space had been available. Thus, a return value of size or more means that the output was truncated.

Definition at line 154 of file dbg.h.

Referenced by dbg_snprintf().

## Enumeration Type Documentation

enum dbg_mod_tag

Module filtering macros, used only by debug module.

Enumerator:

  DBG_MOD_IDX_KE | Bit index for Kernel.
  DBG_MOD_IDX_DBG | Bit index for debug.
  DBG_MOD_IDX_IPC | Bit index for IPC.
  DBG_MOD_IDX_DMA | Bit index for DMA.
  DBG_MOD_IDX_MM | Bit index for LMAC management.
  DBG_MOD_IDX_TX | Bit index for Tx path.
  DBG_MOD_IDX_RX | Bit index for Rx path.
  DBG_MOD_IDX_PHY | Bit index for Modem / RF.
  DBG_MOD_IDX_MAX | Number of modules.

Definition at line 90 of file dbg.h.

enum dbg_sev_tag

Severity filtering macros, used only by debug module.

Enumerator:

  DBG_SEV_IDX_NONE | No print allowed.
  DBG_SEV_IDX_CRT | Critical and unspecified allowed only.
  DBG_SEV_IDX_ERR | Error allowed and above.
  DBG_SEV_IDX_WRN | Warning allowed and above.
  DBG_SEV_IDX_INF | Info allowed and above.
  DBG_SEV_IDX_VRB | All allowed.
  DBG_SEV_IDX_MAX | Number of severity levels.
  DBG_SEV_ALL | Convenient macro.

Definition at line 110 of file dbg.h.

## Function Documentation

uint32_t dbg_snprintf | ( | char * | buffer,
|  | uint32_t | size,
|  | const char * | fmt,
|  |  | ... |
| ) |  |  |

Execute a pseudo snprintf function.

Parameters:

  `[out]` | buffer | Output buffer
  `[in]` | size | Size of the output buffer
  `[in]` | fmt | Format string

Returns:
  Upon successful return, returns the number of characters printed (excluding the null byte used to end output to strings). If the output was truncated due to the size limit, then the return value is the number of characters (excluding the terminating null byte) which would have been written to the final string if enough space had been available. Thus, a return value of size or more means that the output was truncated.

Definition at line 718 of file dbg_print.c.

References dbg_vsnprintf.

void dbg_test_print | ( | const char * | fmt,
|  |  | ... |
| ) |  |  |

Function formatting a string and sending it to the defined output.

Parameters:

  `[in]` | fmt | Format string

Definition at line 647 of file dbg_print.c.

References ASSERT_ERR, CO_BIT, dbg_env, DBG_MOD_MAX, DBG_MOD_MIN, DBG_SEV_IDX_ERR, DBG_SEV_MAX, DBG_SEV_MIN, debug_env_tag::filter_module, and debug_env_tag::filter_severity.

uint32_t dbg_vsnprintf_offset | ( | char * | buffer,
|  | uint32_t | size,
|  | uint32_t | offset,
|  | const char * | fmt,
|  | va_list | args |
| ) |  |  |

Execute a pseudo vsnprintf function.

Parameters:

  `[out]` | buffer | Output buffer
  `[in]` | size | Size of the output buffer
  `[in]` | offset | Offset of final string at which the writing in buffer should start
  `[in]` | fmt | Format string
  `[in]` | args | Variable list of arguments

Returns:
  Upon successful return, returns the number of characters printed (excluding the null byte used to end output to strings). If the output was truncated due to the size limit, then the return value is the number of characters (excluding the terminating null byte) which would have been written to the final string if enough space had been available. Thus, a return value of size or more means that the output was truncated.

Definition at line 201 of file dbg_print.c.

References ASSERT_ERR, co_min(), and type_get().

static uint32_t type_get | ( | char | c | ) | `[static]`

Function to read a particular character and map its type.

This function is called to read a particular character and fetch its type

Parameters:

  `[in]` | c | Input character

Returns:
  Type of the character

Definition at line 120 of file dbg_print.c.

Referenced by dbg_vsnprintf_offset().

## Variable Documentation

const uint8_t transition_table[S_MAX][C_MAX]`[static]`

Initial value:

    {
      { S_COPY,     S_PERCENT,  S_COPY,     S_COPY,     S_COPY,     S_COPY,     S_COPY,     S_COPY  },
      { S_COPY,     S_COPY,     S_DOT,      S_FLAGS ,   S_WIDTH,    S_FLAGS ,   S_SIZE,     S_TYPE  },
      { S_COPY,     S_COPY,     S_DOT,      S_FLAGS,    S_WIDTH,    S_FLAGS,    S_SIZE,     S_TYPE  },
      { S_COPY,     S_COPY,     S_DOT,      S_WIDTH,    S_WIDTH,    S_COPY,     S_SIZE,     S_TYPE  },
      { S_COPY,     S_COPY,     S_COPY,     S_PRECIS,   S_PRECIS,   S_COPY,     S_SIZE,     S_TYPE  },
      { S_COPY,     S_COPY,     S_COPY,     S_PRECIS,   S_PRECIS,   S_COPY,     S_SIZE,     S_TYPE  },
      { S_COPY,     S_COPY,     S_COPY,     S_COPY,     S_COPY,     S_COPY,     S_COPY,     S_TYPE  },
      { S_COPY,     S_PERCENT,  S_COPY,     S_COPY,     S_COPY,     S_COPY,     S_COPY,     S_COPY  },
    }

Transition table.

Definition at line 87 of file dbg_print.c.