Print and Debug Support
2-15
Operating System Abstraction API
2.5
Print and Debug Support
2.5.1
Synopsis
The OS abstraction includes a family of compact printf() functions that print us-
ing a fixed buffer. The size of the buffer (max printf() length) is defined in the
OS abstraction layer. The code to print to the standard output device is also
provided, and this function can be modified to print or log as required.
The stack also provides another form of the printf function called DbgPrintf().
This function is used to print debug messages to a global debug log. The se-
verity threshold at which the debug message is recorded can be adjusted as
well as at what point the error causes a system shutdown.
2.5.2
Standard Print Functions
The standard set of printf functions is supported:
int printf(const char *format, ...);
int sprintf(char *s, const char *format, ...);
int vprintf(const char *format, va_list arg);
int vsprintf(char *s, const char *format, va_list arg);
2.5.3
Debug API Functions
Print a Debug Message to the Debug Log
DbgPrintf
Syntax
void DbgPrintf( int ErrLevel, char *Format,
…
);
Parameter(s)
ErrLevel
Severity level of the error
Format
Standard printf format string
Return Value
nothing
Description
This function prints a debug message to the global debug log buffer. The log
buffer is defined as follows:
#define LL_DEBUG_LOG_MAX 1024
extern char DebugLog[LL_DEBUG_LOG_MAX]; // DebugLog
Buffer
extern int DebugLogSize; // Bytes of data currently
in DebugLog
The buffer behaves like one large NULL terminated string. The contents are
cleared by setting DebugLogSize to 0.