]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcHardwarePort.c
Update FreeRTOS+Trace recorder code.
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-Trace / trcHardwarePort.c
index 754b3211dd18d623b41deaffec86c9fe0d5992de..6570e3553fcc28182b797cc0b52ebed6f7e1ccc0 100644 (file)
@@ -1,5 +1,5 @@
 /******************************************************************************* \r
- * Tracealyzer v2.4.1 Recorder Library\r
+ * Tracealyzer v2.5.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcHardwarePort.c\r
@@ -42,6 +42,8 @@
 \r
 #include <stdint.h>\r
 \r
+uint32_t trace_disable_timestamp = 0;\r
+uint32_t last_timestamp = 0;\r
 \r
 /*******************************************************************************\r
  * uiTraceTickCount\r
@@ -71,6 +73,13 @@ void vTracePortGetTimeStamp(uint32_t *pTimestamp)
     uint32_t traceTickCount = 0;\r
     uint32_t hwtc_count = 0;\r
     \r
+       if (trace_disable_timestamp == 1)\r
+       {\r
+               if (pTimestamp)\r
+                       *pTimestamp = last_timestamp;\r
+               return;\r
+       }\r
+                       \r
     /* Retrieve HWTC_COUNT only once since the same value should be used all throughout this function. */\r
 #if (HWTC_COUNT_DIRECTION == DIRECTION_INCREMENTING)\r
     hwtc_count = HWTC_COUNT;\r
@@ -109,6 +118,8 @@ void vTracePortGetTimeStamp(uint32_t *pTimestamp)
         *pTimestamp = traceTickCount * (HWTC_PERIOD / HWTC_DIVISOR);\r
         /* Increase timestamp by (hwtc_count + "lost hardware ticks from scaling down period") / HWTC_DIVISOR. */\r
         *pTimestamp += (hwtc_count + traceTickCount * (HWTC_PERIOD % HWTC_DIVISOR)) / HWTC_DIVISOR;\r
+               \r
+               last_timestamp = *pTimestamp;\r
     }\r
     \r
     /* Store the previous values. */\r