| Maestro Audio Framework v 1.0 NXP Semiconductors

Macros
logging.h File Reference

Contains logging prototypes and definitions for the connected radio. More...

## Macros
#define | LOGMDL_MAX_MODULES 6
| Maximum number of modules supported.
#define | LOG_NAME_LENGTH 19
| Maximum string length for module name.
#define | LOG_ENABLED
The level of the error will be defined as:
#define | LOGLVL_CATASTROPHIC 0x01
| Serious error. More...
#define | LOGLVL_ERROR 0x02
| An error has occurred. More...
#define | LOGLVL_WARNING 0x04
| A warning about a potential problem.
#define | LOGLVL_INFO 0x08
| Information that could be useful to the user.
#define | LOGLVL_DEBUG 0x10
| For developers for debugging.
#define | LOGLVL_FUNCTION_INFO 0x20
| For developers debugging. More...
Additional level specifications used by set_debug_level()
These levels cannot be used by lprintf()
#define | LOGLVL_NONE 0x00
| No error messages reported.
#define | LOGLVL_DEFAULT 0x03
#define | LOGLVL_ALL 0xFF
| All error messages reported.
Output location for the error logs
#define | LOGPUT_NONE 0x0
| No output.
#define | LOGPUT_CONSOLE 0x1
| Output goes to the terminal window.
#define | LOGPUT_FILE 0x2
| Output goes to a file.
#define | LOGPUT_ALL 0x3
| Output to all possibilities.
The module bit field definition.
#define | LOGMDL_COMMON 0x00000001
#define | LOGMDL_OSA 0x00000002
#define | LOGMDL_APP 0x00000004
#define | LOGMDL_GUI 0x00000008
Additional level specifications used by set_debug_module()
These levels cannot be used by lprintf(). The user can also OR several modules together for a custom selection.
#define | LOGMDL_NONE 0x00000000
#define | LOGMDL_ALL 0x3FFFFFFF

## LOGGING FUNCTION PROTOTYPES
#define | LOG_ENTER(module)
| Convenience function that prints a debug level message specifically for entering a function. More...
#define | LOG_EXIT(module)
| Convenience function that prints a debug level message specifically for exiting a function. More...
void | lprintf (const uint32_t module, const uint8_t level, const uint32_t error, const char *message,...)
| The function lprintf() is used in module code in place of printf(). More...
void | dlprintf (const uint32_t module, const char *message,...)
| This function is the information-specific shortcut variant of lprintf(). More...
void | ilprintf (const uint32_t module, const char *message,...)
| This function is the information-specific shortcut variant of lprintf(). More...
void | set_debug_module (const uint32_t module)
| Sets the module of interest based on bits set in module. More...
void | set_debug_level (const uint8_t level)
| Sets the levels to display based on bits set in level. More...
void | set_debug_out (const uint8_t output)
| Indicates where the output should go: to the console, a file, etc. More...
void | clear_debug_module (const uint32_t module)
| Clears the modules set in module. More...
void | clear_debug_level (const uint8_t level)
| Clears the levels set in level. More...
void | clear_debug_out (const uint8_t output)
| Clears the output bits set in output. More...
uint32_t | add_module_name (const uint32_t module, const char *name)
| Adds a name for a module to the system. More...
uint32_t | remove_module_name (const uint32_t module)
| Removes the name for a module. More...
uint32_t | add_error_name (const uint32_t error_id, const char *text)
| Adds a text string for an error of 25 char or less to the system. More...
char * | error_name (const uint32_t error_id)
| Returns a simple name for an error code, if it was pre-set with add_error_name(). More...
void | init_logging (void)
| Initializes the module and error tables.
void | deinit_logging (void)
| Deinitializes the module.
void | get_debug_state (void)
| Prints the settings for active modules, level and output.

## Macro Definition Documentation

## ◆ LOGLVL_CATASTROPHIC

#define LOGLVL_CATASTROPHIC 0x01

System cannot recover.

## ◆ LOGLVL_ERROR

#define LOGLVL_ERROR 0x02

The system should be able to continue but an individual module may not be able to.

## ◆ LOGLVL_FUNCTION_INFO

#define LOGLVL_FUNCTION_INFO 0x20

Function Enter/Exit info.

## ◆ LOG_ENTER

#define LOG_ENTER | ( |  | module | ) |

Value:
lprintf(module, LOGLVL_FUNCTION_INFO, 0, \
"Entering: %s\n", __FUNCTION__)
lprintf
void lprintf(const uint32_t module, const uint8_t level, const uint32_t error, const char *message,...)
The function lprintf() is used in module code in place of printf().
LOGLVL_FUNCTION_INFO
#define LOGLVL_FUNCTION_INFO
For developers debugging.
Definition: logging.h:33

Parameters

  [in] | module | module id

## ◆ LOG_EXIT

#define LOG_EXIT | ( |  | module | ) |

Value:
lprintf(module, LOGLVL_FUNCTION_INFO, 0, \
"Exiting: %s\n\n", __FUNCTION__)

Parameters

  [in] | module | module id

## Function Documentation

## ◆ lprintf()

void lprintf | ( | const uint32_t | module,
|  | const uint8_t | level,
|  | const uint32_t | error,
|  | const char * | message,
|  |  | ...
| ) |  |

Different levels of information can be turned on or off at runtime for specific modules.

Parameters

  [in] | module | is an enumerated value defining the module this is used in
  [in] | level | is an enumerated value indicating the seriousness of the error
  [in] | error | is a defined error/warning code
  [in] | message | is a text message describing the error. The message can use args just as a standard printf.

## ◆ dlprintf()

void dlprintf | ( | const uint32_t | module,
|  | const char * | message,
|  |  | ...
| ) |  |

It is the same as specifying lprintf(module, LOGLVL_DEBUG, ERRCODE_NO_ERROR, ...).

Parameters

  [in] | module | is an enumerated value defining the module this is used in
  [in] | message | is a text message describing the error. The message can use args just as a standard printf.

## ◆ ilprintf()

void ilprintf | ( | const uint32_t | module,
|  | const char * | message,
|  |  | ...
| ) |  |

It is the same as specifying lprintf(module, LOGLVL_INFO, ERRCODE_NO_ERROR, ...).

Parameters

  [in] | module | is an enumerated value defining the module that this is used in
  [in] | message | is a text message describing the error. The message can use args just as a standard printf.

## ◆ set_debug_module()

void set_debug_module | ( | const uint32_t | module | ) |

Adds to any already set.

Parameters

  [in] | module | bit(s) to be added to active modules. This value is generated by or'ing the LOGMDL_* defines.

## ◆ set_debug_level()

void set_debug_level | ( | const uint8_t | level | ) |

Adds to those already set.

Parameters

  [in] | level | bit(s) to be added to active levels. This value is generated by or'ing the LOGLVL_* defines.

## ◆ set_debug_out()

void set_debug_out | ( | const uint8_t | output | ) |

Parameters

  [in] | output | bit(s) to be added to active output. This should be one of the LOGPUT_* defines.

## ◆ clear_debug_module()

void clear_debug_module | ( | const uint32_t | module | ) |

Parameters

  [in] | module | bit(s) to be cleared in active modules. This value is generated by or'ing the LOGMDL_* defines.

## ◆ clear_debug_level()

void clear_debug_level | ( | const uint8_t | level | ) |

Parameters

  [in] | level | bit(s) to be removed from active levels. This value is generated by or'ing the LOGLVL_* defines.

## ◆ clear_debug_out()

void clear_debug_out | ( | const uint8_t | output | ) |

Parameters

  [in] | output | bit(s) to be removed from active output. This should be one of the LOGPUT_* defines.

## ◆ add_module_name()

uint32_t add_module_name | ( | const uint32_t | module,
|  | const char * | name
| ) |  |

The module name will be printed with the output of lprintf().

Parameters

  [in] | module | id of a module
  [in] | name | name for the module

Returns
  an error code. The error code can be:

Return values

  ERRCODE_NO_ERROR | worked as expected
  ERRCODE_PARAMETER_EXISTS | the module id already has a name
  ERRCODE_SYSTEM_LIMIT | the system has run out of places to store module information

## ◆ remove_module_name()

uint32_t remove_module_name | ( | const uint32_t | module | ) |

Parameters

  [in] | module | id of a module

Returns
  an error code. The error code can be:

Return values

  ERRCODE_NO_ERROR | worked as expected
  ERRCODE_NOT_FOUND | no text was found for this module

## ◆ add_error_name()

uint32_t add_error_name | ( | const uint32_t | error_id,
|  | const char * | text
| ) |  |

The error text will be printed with the output of lprintf().

Parameters

  [in] | error_id | error the text will be added to
  [in] | text | error text to be printed for error_id

Returns
  an error code. The error code can be:

Return values

  ERRCODE_NO_ERROR | worked as expected
  ERRCODE_PARAMETER_EXISTS | the error id already has identifying text
  ERRCODE_SYSTEM_LIMIT | the system has run out of places to store error information

## ◆ error_name()

char* error_name | ( | const uint32_t | error_id | ) |

Parameters

  [in] | error_id | an error code indicating a particular error

Returns
  a descriptive text identification will be returned for this error id