See Debugging Utilities for documentation.

License#

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.

/***************************************************************************/
#ifndef SILABS_EMBER_DEBUG_H
#define SILABS_EMBER_DEBUG_H

#ifndef UC_BUILD
// Define the values for DEBUG_LEVEL
#define NO_DEBUG    0
#define BASIC_DEBUG 1
#define FULL_DEBUG  2
#endif // UC_BUILD

#define sl_zigbee_debug_init(port) do {} while (false)

#if (defined(DEBUG_LEVEL) && defined(BASIC_DEBUG) && (DEBUG_LEVEL >= BASIC_DEBUG)) || defined(DOXYGEN_SHOULD_SKIP_THIS) || defined(UC_BUILD)

#define DEBUG_ROUTINES_PRESENT

void sl_zigbee_debug_assert(const char * filename, int linenumber);

void sl_zigbee_debug_memory_dump(uint8_t *start, uint8_t *end);

void sl_zigbee_debug_binary_printf(const char * formatString, ...);

void sli_util_debug_send_vuart_message(uint8_t *buff, uint8_t len);

//#if (DEBUG_LEVEL == FULL_DEBUG) || defined(DOXYGEN_SHOULD_SKIP_THIS)
void sl_zigbee_debug_error(sl_status_t code);

bool sl_zigbee_debug_report_off(void);

void sl_zigbee_debug_report_restore(bool state);

// Format: Same as sli_legacy_serial_printf
// sl_zigbee_debug_printf("format string"[, parameters ...])
void sl_zigbee_debug_printf(const char * formatString, ...);

#else // (DEBUG_LEVEL >= BASIC_DEBUG) || defined(DOXYGEN_SHOULD_SKIP_THIS) || defined(UC_BUILD)
  #define sl_zigbee_debug_assert(filename, linenumber) do {} while (false)
  #define sl_zigbee_debug_memory_dump(start, end) do {} while (false)
  #define sl_zigbee_debug_binary_printf(formatstring, ...) do {} while (false)
  #define sli_util_debug_send_vuart_message(buff, len) do {} while (false)
  #define sl_zigbee_debug_error(code) do {} while (false)
// Note the following doesn't have a do{}while(false)
//   because it has a return value
  #define sl_zigbee_debug_report_off() (false)
  #define sl_zigbee_debug_report_restore(state) do {} while (false)
  #define sl_zigbee_debug_printf(...) do {} while (false)
#endif // (defined(DEBUG_LEVEL) && defined(BASIC_DEBUG) && (DEBUG_LEVEL >= BASIC_DEBUG)) || defined(DOXYGEN_SHOULD_SKIP_THIS) || defined(UC_BUILD)

#endif // SILABS_EMBER_DEBUG_H

Macros#

#define

This function is obsolete and no longer required to initialize the debug system.

Functions#

void
sl_zigbee_debug_assert(const char *filename, int linenumber)

Print the filename and line number to the debug serial port.

void
sl_zigbee_debug_memory_dump(uint8_t *start, uint8_t *end)

Print the contents of RAM to the debug serial port.

void
sl_zigbee_debug_binary_printf(const char *formatString,...)

Print binary data to the debug channel.

void
sli_util_debug_send_vuart_message(uint8_t *buff, uint8_t len)

Send VUART data out the debug channel.

void
sl_zigbee_debug_error(sl_status_t code)

Print an ::sl_status_t return code to the serial port.

bool

Turn off all debug output.

void

Restore the state of the debug output.

void
sl_zigbee_debug_printf(const char *formatString,...)

Prints text debug messages.

Macro Definition Documentation#

sl_zigbee_debug_init#

#define sl_zigbee_debug_init
Value:
(port)

This function is obsolete and no longer required to initialize the debug system.


Definition at line 42 of file stack/include/sl_zigbee_debug.h

DEBUG_ROUTINES_PRESENT#

#define DEBUG_ROUTINES_PRESENT

Definition at line 46 of file stack/include/sl_zigbee_debug.h

Function Documentation#

sl_zigbee_debug_assert#

void sl_zigbee_debug_assert (const char * filename, int linenumber)

Print the filename and line number to the debug serial port.

Parameters
N/Afilename

The name of the file where the assert occurred.

N/Alinenumber

The line number in the file where the assert occurred.


Definition at line 54 of file stack/include/sl_zigbee_debug.h

sl_zigbee_debug_memory_dump#

void sl_zigbee_debug_memory_dump (uint8_t * start, uint8_t * end)

Print the contents of RAM to the debug serial port.

Parameters
N/Astart

The start address of the block of RAM to dump.

N/Aend

The end address of the block of RAM to dump (address of the last byte).


Definition at line 63 of file stack/include/sl_zigbee_debug.h

sl_zigbee_debug_binary_printf#

void sl_zigbee_debug_binary_printf (const char * formatString, ... )

Print binary data to the debug channel.

Parameters
N/AformatString

A string of conversion specification characters describing the arguments to be printed.

N/A

The arguments to be printed.

This function does not use the normal printf format conventions. To print text debug messages, use sl_zigbee_debug_printf(). The format string must contain only these conversion specification characters:

  • B - uint8_t value.

  • W - uint16_t value, printed least significant byte first.

  • D - uint32_t value, printed least significant byte first.

  • F - pointer to null terminated string in Flash (const char *).

  • xxxp - pointer to RAM, length is xxx (max 255).

  • lp - pointer to RAM, length is uint8_t argument.

  • xxxf - pointer to Flash (const char *), length is xxx (max 255).

  • lf - pointer to Flash (const char *), length is uint8_t argument.

  • b - sli_buffer_manager_buffer_t.

Examples:

sl_zigbee_debug_binary_printf("BWD", status, panId, channelMask);
sl_zigbee_debug_binary_printf("F8p", "string example", eui64);
sl_zigbee_debug_binary_printf("lp64fb", length, bytes, dataTable, buffer);

Definition at line 91 of file stack/include/sl_zigbee_debug.h

sli_util_debug_send_vuart_message#

void sli_util_debug_send_vuart_message (uint8_t * buff, uint8_t len)

Send VUART data out the debug channel.

Parameters
N/Abuff

A pointer to the data to send.

N/Alen

The length of the data to send.


Definition at line 99 of file stack/include/sl_zigbee_debug.h

sl_zigbee_debug_error#

void sl_zigbee_debug_error (sl_status_t code)

Print an ::sl_status_t return code to the serial port.

Parameters
N/Acode

The ::sl_status_t code to print.


Definition at line 106 of file stack/include/sl_zigbee_debug.h

sl_zigbee_debug_report_off#

bool sl_zigbee_debug_report_off (void )

Turn off all debug output.

Parameters
N/A

Returns

  • The current state (true for on, false for off).


Definition at line 112 of file stack/include/sl_zigbee_debug.h

sl_zigbee_debug_report_restore#

void sl_zigbee_debug_report_restore (bool state)

Restore the state of the debug output.

Parameters
N/Astate

The state returned from sl_zigbee_debug_report_off(). This is done so that debug output is not blindly turned on.


Definition at line 119 of file stack/include/sl_zigbee_debug.h

sl_zigbee_debug_printf#

void sl_zigbee_debug_printf (const char * formatString, ... )

Prints text debug messages.

Parameters
N/AformatString

Takes the following:

N/A

%%

Percent sign

%c

Single-byte char

%s

RAM string

%p

Flash string (does not follow the printf standard)

%u

Two-byte unsigned decimal

%d

Two-byte signed decimal

%x, %%2x, %%4x

1-, 2-, 4-byte hex value (always 0 padded; does not follow the printf standard)


Definition at line 138 of file stack/include/sl_zigbee_debug.h