/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v4.1.1\r
+ * Trace Recorder Library for Tracealyzer v4.1.5\r
* Percepio AB, www.percepio.com\r
*\r
* trcStreamingRecorder.c\r
\r
#if (TRC_USE_TRACEALYZER_RECORDER == 1)\r
\r
+#include <stdio.h>\r
+#include <stdarg.h>\r
+\r
typedef struct{\r
uint16_t EventID;\r
uint16_t EventCount;\r
/* The number of events stored. Used as event sequence number. */\r
static uint32_t eventCounter = 0;\r
\r
-/* The user event channel for recorder warnings, defined in trcKernelPort.c */\r
-extern char* trcWarningChannel;\r
-\r
/* Remembers if an earlier ISR in a sequence of adjacent ISRs has triggered a task switch.\r
In that case, vTraceStoreISREnd does not store a return to the previously executing task. */\r
int32_t isPendingContextSwitch = 0;\r
prvTraceStoreSimpleStringEventHelper(chn, str);\r
}\r
\r
+\r
+/*******************************************************************************\r
+* vTraceConsoleChannelPrintF\r
+*\r
+* Wrapper for vTracePrint, using the default channel. Can be used as a drop-in\r
+* replacement for printf and similar functions, e.g. in a debug logging macro.\r
+*\r
+* Example:\r
+*\r
+* // Old: #define LogString debug_console_printf\r
+*\r
+* // New, log to Tracealyzer instead:\r
+* #define LogString vTraceConsoleChannelPrintF\r
+* ...\r
+* LogString("My value is: %d", myValue);\r
+******************************************************************************/\r
+void vTraceConsoleChannelPrintF(const char* fmt, ...)\r
+{\r
+ va_list vl;\r
+ char tempBuf[60];\r
+ static traceString consoleChannel = NULL;\r
+\r
+ if (consoleChannel == NULL)\r
+ consoleChannel = xTraceRegisterString("Debug Console");\r
+\r
+ va_start(vl, fmt);\r
+ vsnprintf(tempBuf, 60, fmt, vl);\r
+ vTracePrint(consoleChannel, tempBuf);\r
+ va_end(vl);\r
+}\r
+\r
/******************************************************************************\r
* vTracePrintF\r
*\r