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 emberDebugInit(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 emberDebugAssert(const char * filename, int linenumber);
void emberDebugMemoryDump(uint8_t *start, uint8_t *end);
void emberDebugBinaryPrintf(const char * formatString, ...);
void emDebugSendVuartMessage(uint8_t *buff, uint8_t len);
//#if (DEBUG_LEVEL == FULL_DEBUG) || defined(DOXYGEN_SHOULD_SKIP_THIS)
void emberDebugError(EmberStatus code);
bool emberDebugReportOff(void);
void emberDebugReportRestore(bool state);
// Format: Same as emberSerialPrintf
// emberDebugPrintf("format string"[, parameters ...])
void emberDebugPrintf(const char * formatString, ...);
#else // (DEBUG_LEVEL >= BASIC_DEBUG) || defined(DOXYGEN_SHOULD_SKIP_THIS) || defined(UC_BUILD)
#define emberDebugAssert(filename, linenumber) do {} while (false)
#define emberDebugMemoryDump(start, end) do {} while (false)
#define emberDebugBinaryPrintf(formatstring, ...) do {} while (false)
#define emDebugSendVuartMessage(buff, len) do {} while (false)
#define emberDebugError(code) do {} while (false)
// Note the following doesn't have a do{}while(false)
// because it has a return value
#define emberDebugReportOff() (false)
#define emberDebugReportRestore(state) do {} while (false)
#define emberDebugPrintf(...) 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#
This function is obsolete and no longer required to initialize the debug system.
Functions#
Print the filename and line number to the debug serial port.
Print the contents of RAM to the debug serial port.
Print binary data to the debug channel.
Send VUART data out the debug channel.
Print an EmberStatus return code to the serial port.
Turn off all debug output.
Restore the state of the debug output.
Prints text debug messages.
Macro Definition Documentation#
emberDebugInit#
#define emberDebugInitValue:
(port)
This function is obsolete and no longer required to initialize the debug system.
42
of file stack/include/ember-debug.h
DEBUG_ROUTINES_PRESENT#
#define DEBUG_ROUTINES_PRESENT
46
of file stack/include/ember-debug.h
Function Documentation#
emberDebugAssert#
void emberDebugAssert (const char * filename, int linenumber)
Print the filename and line number to the debug serial port.
N/A | filename | The name of the file where the assert occurred. |
N/A | linenumber | The line number in the file where the assert occurred. |
54
of file stack/include/ember-debug.h
emberDebugMemoryDump#
void emberDebugMemoryDump (uint8_t * start, uint8_t * end)
Print the contents of RAM to the debug serial port.
N/A | start | The start address of the block of RAM to dump. |
N/A | end | The end address of the block of RAM to dump (address of the last byte). |
63
of file stack/include/ember-debug.h
emberDebugBinaryPrintf#
void emberDebugBinaryPrintf (const char * formatString, ... )
Print binary data to the debug channel.
N/A | formatString | 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 emberDebugPrintf(). 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 - EmberMessageBuffer.
Examples:
emberDebugBinaryPrintf("BWD", status, panId, channelMask);
emberDebugBinaryPrintf("F8p", "string example", eui64);
emberDebugBinaryPrintf("lp64fb", length, bytes, dataTable, buffer);
91
of file stack/include/ember-debug.h
emDebugSendVuartMessage#
void emDebugSendVuartMessage (uint8_t * buff, uint8_t len)
Send VUART data out the debug channel.
N/A | buff | A pointer to the data to send. |
N/A | len | The length of the data to send. |
99
of file stack/include/ember-debug.h
emberDebugError#
void emberDebugError (EmberStatus code)
Print an EmberStatus return code to the serial port.
N/A | code | The EmberStatus code to print. |
106
of file stack/include/ember-debug.h
emberDebugReportOff#
bool emberDebugReportOff (void )
Turn off all debug output.
N/A |
Returns
The current state (true for on, false for off).
112
of file stack/include/ember-debug.h
emberDebugReportRestore#
void emberDebugReportRestore (bool state)
Restore the state of the debug output.
N/A | state | The state returned from emberDebugReportOff(). This is done so that debug output is not blindly turned on. |
119
of file stack/include/ember-debug.h
emberDebugPrintf#
void emberDebugPrintf (const char * formatString, ... )
Prints text debug messages.
N/A | formatString | 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) |
138
of file stack/include/ember-debug.h