-/******************************************************************************* \r
- * Tracealyzer v2.7.0 Recorder Library\r
+/*******************************************************************************\r
+ * Tracealyzer v2.7.7 Recorder Library\r
* Percepio AB, www.percepio.com\r
*\r
- * trcHardwarePort.c\r
+ * trcBase.c\r
*\r
- * Contains together with trcHardwarePort.h all hardware portability issues of \r
- * the trace recorder library.\r
+ * Core functionality of the trace recorder library.\r
*\r
* Terms of Use\r
* This software is copyright Percepio AB. The recorder library is free for\r
* use together with Percepio products. You may distribute the recorder library\r
- * in its original form, including modifications in trcPort.c and trcPort.h\r
+ * in its original form, including modifications in trcHardwarePort.c/.h\r
* given that these modification are clearly marked as your own modifications\r
- * and documented in the initial comment section of these source files. \r
- * This software is the intellectual property of Percepio AB and may not be \r
- * sold or in other ways commercially redistributed without explicit written \r
+ * and documented in the initial comment section of these source files.\r
+ * This software is the intellectual property of Percepio AB and may not be\r
+ * sold or in other ways commercially redistributed without explicit written\r
* permission by Percepio AB.\r
*\r
- * Disclaimer \r
- * The trace tool and recorder library is being delivered to you AS IS and \r
- * Percepio AB makes no warranty as to its use or performance. Percepio AB does \r
- * not and cannot warrant the performance or results you may obtain by using the \r
- * software or documentation. Percepio AB make no warranties, express or \r
- * implied, as to noninfringement of third party rights, merchantability, or \r
- * fitness for any particular purpose. In no event will Percepio AB, its \r
- * technology partners, or distributors be liable to you for any consequential, \r
- * incidental or special damages, including any lost profits or lost savings, \r
- * even if a representative of Percepio AB has been advised of the possibility \r
- * of such damages, or for any claim by any third party. Some jurisdictions do \r
- * not allow the exclusion or limitation of incidental, consequential or special \r
- * damages, or the exclusion of implied warranties or limitations on how long an \r
+ * Disclaimer\r
+ * The trace tool and recorder library is being delivered to you AS IS and\r
+ * Percepio AB makes no warranty as to its use or performance. Percepio AB does\r
+ * not and cannot warrant the performance or results you may obtain by using the\r
+ * software or documentation. Percepio AB make no warranties, express or\r
+ * implied, as to noninfringement of third party rights, merchantability, or\r
+ * fitness for any particular purpose. In no event will Percepio AB, its\r
+ * technology partners, or distributors be liable to you for any consequential,\r
+ * incidental or special damages, including any lost profits or lost savings,\r
+ * even if a representative of Percepio AB has been advised of the possibility\r
+ * of such damages, or for any claim by any third party. Some jurisdictions do\r
+ * not allow the exclusion or limitation of incidental, consequential or special\r
+ * damages, or the exclusion of implied warranties or limitations on how long an\r
* implied warranty may last, so the above limitations may not apply to you.\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2014.\r
+ * Copyright Percepio AB, 2012-2015.\r
* www.percepio.com\r
******************************************************************************/\r
\r
/*******************************************************************************\r
* uiTraceTickCount\r
*\r
- * This variable is should be updated by the Kernel tick interrupt. This does \r
- * not need to be modified when developing a new timer port. It is preferred to \r
- * keep any timer port changes in the HWTC macro definitions, which typically \r
+ * This variable is should be updated by the Kernel tick interrupt. This does\r
+ * not need to be modified when developing a new timer port. It is preferred to\r
+ * keep any timer port changes in the HWTC macro definitions, which typically\r
* give sufficient flexibility.\r
******************************************************************************/\r
uint32_t uiTraceTickCount = 0;\r
vTraceError("DWT_CYCCNT not supported by this chip!");\r
break;\r
}\r
- \r
+\r
/* Reset the cycle counter */\r
REG_DWT_CYCCNT = 0;\r
\r
REG_DWT_CTRL |= DWT_CTRL_CYCCNTENA;\r
\r
}while(0); /* breaks above jump here */\r
- \r
+\r
if (RecorderDataPtr->frequency == 0)\r
- { \r
+ {\r
RecorderDataPtr->frequency = TRACE_CPU_CLOCK_HZ / HWTC_DIVISOR;\r
}\r
}\r
static uint32_t last_hwtc_count = 0;\r
uint32_t traceTickCount = 0;\r
uint32_t hwtc_count = 0;\r
- \r
+\r
if (trace_disable_timestamp == 1)\r
{\r
if (pTimestamp)\r
*pTimestamp = last_timestamp;\r
return;\r
}\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
#endif\r
\r
#if (SELECTED_PORT == PORT_Win32)\r
- /* The Win32 port uses ulGetRunTimeCounterValue for timestamping, which in turn \r
- uses QueryPerformanceCounter. That function is not always reliable when used over \r
+ /* The Win32 port uses ulGetRunTimeCounterValue for timestamping, which in turn\r
+ uses QueryPerformanceCounter. That function is not always reliable when used over\r
multiple threads. We must therefore handle rare cases where the timestamp is less\r
- than the previous. In practice, the Win32 should "never" roll over since the \r
+ than the previous. In practice, the Win32 should "never" roll over since the\r
performance counter is 64 bit wide. */\r
- \r
+\r
if (last_hwtc_count > hwtc_count)\r
{\r
hwtc_count = last_hwtc_count;\r
traceTickCount = uiTraceTickCount;\r
}\r
\r
- /* Check for overflow. May occur if the update of uiTraceTickCount has been \r
+ /* Check for overflow. May occur if the update of uiTraceTickCount has been\r
delayed due to disabled interrupts. */\r
if (traceTickCount == last_traceTickCount && hwtc_count < last_hwtc_count)\r
{\r
/* A trace tick has occurred but not been executed by the kernel, so we compensate manually. */\r
traceTickCount++;\r
}\r
- \r
+\r
/* Check if the return address is OK, then we perform the calculation. */\r
if (pTimestamp)\r
{\r
*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
+\r
last_timestamp = *pTimestamp;\r
}\r
- \r
+\r
/* Store the previous values. */\r
last_traceTickCount = traceTickCount;\r
last_hwtc_count = hwtc_count;\r