/*******************************************************************************\r
- * Tracealyzer v2.4.1 Recorder Library\r
+ * Tracealyzer v2.5.0 Recorder Library\r
* Percepio AB, www.percepio.com\r
*\r
* trcConfig.h\r
* check the actual usage in Tracealyzer. This is shown by selecting\r
* View -> Trace Details -> Resource Usage -> Object Table\r
* \r
- * NOTE 2: Remember to account for all tasks created by the kernel, such as the \r
- * IDLE task, timer task, and any tasks created by other 3rd party \r
- * software components, such as communication stacks. The recorder also has an \r
- * optional monitor task to account for, if this is used.\r
+ * NOTE 2: Remember to account for all tasks and other objects created by \r
+ * the kernel, such as the IDLE task, any timer tasks, and any tasks created \r
+ * by other 3rd party software components, such as communication stacks.\r
* Moreover, one task slot is used to indicate "(startup)", i.e., a fictive \r
* task that represent the time before the scheduler starts. \r
* NTask should thus be at least 2-3 slots larger than your application task count.\r
******************************************************************************/\r
#define NTask 15\r
#define NISR 5\r
-#define NQueue 5\r
-#define NSemaphore 5\r
-#define NMutex 5\r
+#define NQueue 10\r
+#define NSemaphore 10\r
+#define NMutex 10\r
\r
/* Maximum object name length for each class (includes zero termination) */\r
#define NameLenTask 15\r
* much faster than a printf and can therefore be used in timing critical code.\r
* See vTraceUserEvent() and vTracePrintF() in trcUser.h\r
* \r
- * Note that Tracealyzer Standard Edition or Professional Edition is required\r
- * for User Events, they are not displayed in Tracealyzer Free Edition.\r
+ * Note that Tracealyzer Professional Edition is required for User Events, \r
+ * they are not displayed in Tracealyzer Free Edition.\r
*****************************************************************************/\r
#define INCLUDE_USER_EVENTS 1\r
\r
#define INCLUDE_SAVE_TO_FILE 0\r
#endif\r
\r
-/******************************************************************************\r
- * TRACE_PROGRESS_MONITOR_TASK_PRIORITY\r
- *\r
- * Macro which sets the priority of the "recorder status monitor" task.\r
- *\r
- * This task, vTraceMonitorTask in trcUser.c, periodically writes\r
- * the recorder status using the vTraceConsoleMessage macro, which is to\r
- * be mapped to your console "printf" routine. The task is named TraceMon but \r
- * is intentionally excluded from the demo trace.\r
- *\r
- * Default is tskIDLE_PRIORITY + 1\r
- * Note that if your system constantly has a high CPU load from high-priority \r
- * tasks, this might not be get a chance to execute.\r
- * \r
- * See vTraceMonitorTask in trcUser.c\r
- *****************************************************************************/\r
-#define TRACE_PROGRESS_MONITOR_TASK_PRIORITY (tskIDLE_PRIORITY + 1)\r
-\r
-/******************************************************************************\r
- * TRACE_PROGRESS_MONITOR_TASK_STACKSIZE\r
- *\r
- * Macro which sets the stack size of the "recorder status monitor" task.\r
- *\r
- * This task, vTraceMonitorTask in trcUser.c, periodically writes\r
- * the recorder status using the vTraceConsoleMessage macro, which is to\r
- * be mapped to your console "printf" routine. The task is intentionally \r
- * excluded from the demo trace.\r
- *\r
- * See vTraceMonitorTask in trcUser.c\r
- *****************************************************************************/\r
-#define TRACE_PROGRESS_MONITOR_TASK_STACKSIZE 500\r
-\r
-/******************************************************************************\r
- * TRACE_PROGRESS_MONITOR_TASK_PERIOD\r
- *\r
- * Macro which sets the period of the "recorder status monitor" task.\r
- *\r
- * This task, vTraceMonitorTask in trcUser.c, periodically writes\r
- * the recorder status using the vTraceConsoleMessage macro, which is to\r
- * be mapped to your console "printf" routine. The task is named TraceMon but \r
- * is intentionally excluded from the demo trace.\r
- *\r
- * Default is 1000 ticks (typically 1 second). On the Windows port, a lower \r
- * value is suggested since the Windows port runs very slowly, often 20-40\r
- * times slower than the simulated time.\r
- *\r
- * See vTraceMonitorTask in trcUser.c\r
- *****************************************************************************/\r
-#ifdef WIN32\r
- #define TRACE_PROGRESS_MONITOR_TASK_PERIOD 100\r
-#else\r
- #define TRACE_PROGRESS_MONITOR_TASK_PERIOD 1000\r
-#endif\r
-\r
/******************************************************************************\r
* TEAM_LICENSE_CODE\r
*\r
/******************************************************************************* \r
- * Tracealyzer v2.4.1 Recorder Library\r
+ * Tracealyzer v2.5.0 Recorder Library\r
* Percepio AB, www.percepio.com\r
*\r
* trcHardwarePort.h\r
* 1 ms get an execution time of zero.\r
*\r
* PORT_Win32\r
- * "Accurate" timestamping based on the Windows performance counter. Note that\r
- * this gives the host machine time.\r
+ * "Accurate" timestamping based on the Windows performance counter for Win32 builds.\r
+ * Note that this gives the host machine time, not the kernel time.\r
*\r
* Officially supported hardware timer ports:\r
* - PORT_Atmel_AT91SAM7\r
#define IRQ_PRIORITY_ORDER 1 // Please update according to your hardware...\r
\r
#elif (SELECTED_PORT == PORT_Atmel_AT91SAM7)\r
+#error HWTC_PERIOD must point to the reload register! Not verified for this hardware port!\r
\r
/* HWTC_PERIOD is hardcoded for AT91SAM7X256-EK Board (48 MHz)\r
A more generic solution is to get the period from pxPIT->PITC_PIMR */\r
\r
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
#define HWTC_COUNT (AT91C_BASE_PITC->PITC_PIIR & 0xFFFFF)\r
- #define HWTC_PERIOD 2995 \r
+ #define HWTC_PERIOD (AT91C_BASE_PITC->PITC_PIMR + 1)\r
#define HWTC_DIVISOR 1\r
\r
#define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant\r
\r
-#elif (SELECTED_PORT == PORT_Atmel_UC3A0) \r
+#elif (SELECTED_PORT == PORT_Atmel_UC3A0)\r
+#error HWTC_PERIOD must point to the reload register! Not yet updated for this hardware port!\r
\r
/* For Atmel AVR32 (AT32UC3A) */\r
- \r
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
#define HWTC_COUNT sysreg_read(AVR32_COUNT)\r
- #define HWTC_PERIOD ( TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ )\r
+ #define HWTC_PERIOD \r
#define HWTC_DIVISOR 1 \r
\r
#define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant\r
\r
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
#define HWTC_COUNT (CMT0.CMCNT)\r
- #define HWTC_PERIOD ((((TRACE_PERIPHERAL_CLOCK_HZ/TRACE_TICK_RATE_HZ)-1)/8))\r
+ #define HWTC_PERIOD (CMT0.CMCOR + 1)\r
#define HWTC_DIVISOR 1\r
\r
#define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant\r
\r
-#elif (SELECTED_PORT == PORT_Microchip_dsPIC_AND_PIC24) \r
+#elif (SELECTED_PORT == PORT_Microchip_dsPIC_AND_PIC24)\r
\r
/* For Microchip PIC24 and dsPIC (16 bit) */\r
\r
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
\r
#elif (SELECTED_PORT == PORT_NXP_LPC210X)\r
+#error HWTC_PERIOD must point to the reload register! Not yet updated for this hardware port!\r
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
\r
/* Tested with LPC2106, but should work with most LPC21XX chips. */\r
\r
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
#define HWTC_COUNT *((uint32_t *)0xE0004008 )\r
- #define HWTC_PERIOD ( TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ ) \r
+ #define HWTC_PERIOD \r
#define HWTC_DIVISOR 1 \r
\r
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
\r
#elif (SELECTED_PORT == PORT_TEXAS_INSTRUMENTS_TMS570)\r
+#error HWTC_PERIOD must point to the reload register! Not verified for this hardware port!\r
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
\r
#define RTIFRC0 *((uint32_t *)0xFFFFFC10)\r
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
\r
#elif (SELECTED_PORT == PORT_TEXAS_INSTRUMENTS_MSP430)\r
+#error HWTC_PERIOD must point to the reload register! Not verified for this hardware port!\r
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
\r
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
\r
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
\r
-#elif (SELECTED_PORT == PORT_XILINX_PPC405) \r
+#elif (SELECTED_PORT == PORT_XILINX_PPC405)\r
+#error HWTC_PERIOD must point to the reload register! Not verified for this hardware port!\r
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
\r
#define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING\r
#define HWTC_COUNT mfspr( 0x3db)\r
- #define HWTC_PERIOD ( TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ )\r
+ #define HWTC_PERIOD \r
#define HWTC_DIVISOR 1\r
\r
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
\r
-#elif (SELECTED_PORT == PORT_XILINX_PPC440) \r
+#elif (SELECTED_PORT == PORT_XILINX_PPC440)\r
+#error HWTC_PERIOD must point to the reload register! Not verified for this hardware port!\r
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
\r
/* This should work with most PowerPC chips */\r
\r
#define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING\r
#define HWTC_COUNT mfspr( 0x016 )\r
- #define HWTC_PERIOD ( TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ )\r
+ #define HWTC_PERIOD \r
#define HWTC_DIVISOR 1 \r
\r
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
\r
#elif (SELECTED_PORT == PORT_XILINX_MICROBLAZE)\r
+#error HWTC_PERIOD must point to the reload register! Not verified for this hardware port!\r
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
\r
/* This should work with most Microblaze configurations.\r
\r
#define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING\r
#define HWTC_COUNT XTmrCtr_GetTimerCounterReg( XPAR_TMRCTR_0_BASEADDR, 0 )\r
- #define HWTC_PERIOD ( TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ )\r
+ #define HWTC_PERIOD \r
#define HWTC_DIVISOR 16\r
\r
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
******************************************************************************/\r
void vTracePortEnd(void);\r
\r
-#if (INCLUDE_SAVE_TO_FILE == 1)\r
-\r
-/*******************************************************************************\r
- * vTracePortSetOutFile\r
- *\r
- * Sets the filename/path used in vTracePortSave.\r
- * This is set in a separate function, since the Win32 port calls vTracePortSave\r
- * in vTracePortEnd if WIN32_PORT_SAVE_WHEN_STOPPED is set.\r
- ******************************************************************************/\r
-void vTracePortSetOutFile(char* path);\r
-\r
-/******************************************************************************\r
- * vTracePortSave\r
- *\r
- * Saves the trace to a file on a target-side file system. The path is set in a \r
- * separate function, vTracePortSetOutFile, since the Win32 port may call\r
- * vTracePortSave in vTracePortEnd, if using WIN32_PORT_SAVE_WHEN_STOPPED.\r
- ******************************************************************************/\r
-void vTracePortSave(void);\r
-\r
-#else\r
-\r
-#define vTraceConsoleMessage(x)\r
-#define vTracePortSetOutFile(path)\r
-#define vTracePortSave(void)\r
-\r
-#endif\r
-\r
#endif\r
/*******************************************************************************\r
- * Tracealyzer v2.4.1 Recorder Library\r
+ * Tracealyzer v2.5.0 Recorder Library\r
* Percepio AB, www.percepio.com\r
*\r
* trcBase.h\r
uint16_t dts; /* differential timestamp - time since last event */\r
} TSEvent, TREvent;\r
\r
+typedef struct\r
+{\r
+ uint8_t type;\r
+ uint8_t dummy;\r
+ uint16_t dts; /* differential timestamp - time since last event */\r
+} LPEvent;\r
+\r
typedef struct\r
{\r
uint8_t type;\r
uint8_t objHandle;\r
- uint16_t dts;\r
+ uint16_t dts; /* differential timestamp - time since last event */\r
} KernelCall;\r
\r
typedef struct\r
uint8_t type;\r
objectHandleType objHandle;\r
uint8_t param;\r
- uint8_t dts;\r
+ uint8_t dts; /* differential timestamp - time since last event */\r
} KernelCallWithParamAndHandle;\r
\r
typedef struct\r
{\r
uint8_t type;\r
- uint8_t dts;\r
+ uint8_t dts; /* differential timestamp - time since last event */\r
uint16_t param;\r
} KernelCallWithParam16;\r
\r
******************************************************************************/\r
void vTraceError(const char* msg);\r
\r
-/*******************************************************************************\r
- * xTraceGetLastError\r
- *\r
- * Gives the last error message, if any. NULL if no error message is stored.\r
- * The message is cleared on read.\r
- ******************************************************************************/\r
-char* xTraceGetLastError(void);\r
-\r
/*******************************************************************************\r
* prvTraceInitTraceData\r
*\r
+++ /dev/null
-/*******************************************************************************\r
-* Tracealyzer v2.4.1 Recorder Library\r
-* Percepio AB, www.percepio.com\r
-*\r
-* trcKernelHooks.h\r
-*\r
-* The kernel integration hooks.\r
-*\r
-* NOTE:\r
-* For IAR Embedded Workbench for ARM, you need to have a preprocessor condition\r
-* on the include, to except it from the assembler step which otherwise give\r
-* compile-time errors.\r
-*\r
-* #ifdef __ICCARM__\r
-* #include "percepio/Include/trcKernelHooks.h"\r
-* #endif\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
-* 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
-* 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
-* implied warranty may last, so the above limitations may not apply to you.\r
-*\r
-* Copyright Percepio AB, 2013.\r
-* www.percepio.com\r
-******************************************************************************/\r
-\r
-#ifndef TRCKERNELHOOKS_H\r
-#define TRCKERNELHOOKS_H\r
-\r
-#if (USE_TRACEALYZER_RECORDER == 1)\r
-\r
-#undef INCLUDE_xTaskGetSchedulerState\r
-#define INCLUDE_xTaskGetSchedulerState 1\r
-\r
-#undef INCLUDE_xTaskGetCurrentTaskHandle\r
-#define INCLUDE_xTaskGetCurrentTaskHandle 1\r
-\r
-#ifndef INCLUDE_OBJECT_DELETE\r
-#define INCLUDE_OBJECT_DELETE 0\r
-#endif\r
-\r
-#ifndef INCLUDE_READY_EVENTS\r
-#define INCLUDE_READY_EVENTS 1\r
-#endif\r
-\r
-#ifndef INCLUDE_NEW_TIME_EVENTS\r
-#define INCLUDE_NEW_TIME_EVENTS 0\r
-#endif\r
-\r
-#if (INCLUDE_OBJECT_DELETE == 1)\r
-/* This macro will remove the task and store it in the event buffer */\r
-#undef trcKERNEL_HOOKS_TASK_DELETE\r
-#define trcKERNEL_HOOKS_TASK_DELETE(SERVICE, pxTCB) \\r
- vTraceStoreKernelCall(TRACE_GET_TASK_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxTCB), TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \\r
- vTraceStoreObjectNameOnCloseEvent(TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \\r
- vTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \\r
- vTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_PRIORITY(pxTCB)); \\r
- vTraceSetObjectState(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TASK_STATE_INSTANCE_NOT_ACTIVE); \\r
- vTraceFreeObjectHandle(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));\r
-#else\r
-#undef trcKERNEL_HOOKS_TASK_DELETE\r
-#define trcKERNEL_HOOKS_TASK_DELETE(SERVICE, pxTCB)\r
-#endif\r
-\r
-#if (INCLUDE_OBJECT_DELETE == 1)\r
-/* This macro will remove the object and store it in the event buffer */\r
-#undef trcKERNEL_HOOKS_OBJECT_DELETE\r
-#define trcKERNEL_HOOKS_OBJECT_DELETE(SERVICE, CLASS, pxObject) \\r
- vTraceStoreKernelCall(TRACE_GET_OBJECT_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \\r
- vTraceStoreObjectNameOnCloseEvent(TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); \\r
- vTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); \\r
- vTraceFreeObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));\r
-#else\r
-#undef trcKERNEL_HOOKS_OBJECT_DELETE\r
-#define trcKERNEL_HOOKS_OBJECT_DELETE(SERVICE, CLASS, pxObject)\r
-#endif\r
-\r
-/* This macro will create a task in the object table */\r
-#undef trcKERNEL_HOOKS_TASK_CREATE\r
-#define trcKERNEL_HOOKS_TASK_CREATE(SERVICE, pxTCB) \\r
- TRACE_SET_TASK_NUMBER(pxTCB) \\r
- vTraceSetObjectName(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_NAME(pxTCB)); \\r
- vTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_PRIORITY(pxTCB)); \\r
- vTraceStoreKernelCall(TRACE_GET_TASK_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxTCB), TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));\r
-\r
-/* This macro will create a failed create call to create a task */\r
-#undef trcKERNEL_HOOKS_TASK_CREATE_FAILED\r
-#define trcKERNEL_HOOKS_TASK_CREATE_FAILED(SERVICE) \\r
- vTraceStoreKernelCall(TRACE_GET_TASK_EVENT_CODE(SERVICE, FAILED, CLASS, pxTCB), TRACE_CLASS_TASK, 0);\r
-\r
-/* This macro will setup a task in the object table */\r
-#undef trcKERNEL_HOOKS_OBJECT_CREATE\r
-#define trcKERNEL_HOOKS_OBJECT_CREATE(SERVICE, CLASS, pxObject)\\r
- TRACE_SET_OBJECT_NUMBER(CLASS, pxObject);\\r
- vTraceStoreKernelCall(TRACE_GET_OBJECT_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \\r
- vTraceSetObjectState(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), 0);\r
-\r
-/* This macro will create a failed create call to create an object */\r
-#undef trcKERNEL_HOOKS_OBJECT_CREATE_FAILED\r
-#define trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(SERVICE, CLASS, kernelClass) \\r
- vTraceStoreKernelCall(TRACE_GET_CLASS_EVENT_CODE(SERVICE, FAILED, CLASS, kernelClass), TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass), 0);\r
-\r
-/* This macro will create a call to a kernel service with a certain result, with an object as parameter */\r
-#undef trcKERNEL_HOOKS_KERNEL_SERVICE\r
-#define trcKERNEL_HOOKS_KERNEL_SERVICE(SERVICE, RESULT, CLASS, pxObject) \\r
- vTraceStoreKernelCall(TRACE_GET_OBJECT_EVENT_CODE(SERVICE, RESULT, CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));\r
-\r
-/* This macro will set the state for an object */\r
-#undef trcKERNEL_HOOKS_SET_OBJECT_STATE\r
-#define trcKERNEL_HOOKS_SET_OBJECT_STATE(CLASS, pxObject, STATE) \\r
- vTraceSetObjectState(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), STATE);\r
-\r
-/* This macro will flag a certain task as a finished instance */\r
-#undef trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED\r
-#define trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(CLASS, pxObject) \\r
- vTraceSetTaskInstanceFinished(TRACE_GET_TASK_NUMBER(TRACE_GET_CURRENT_TASK()));\r
-\r
-#if INCLUDE_READY_EVENTS == 1\r
-/* This macro will create an event to indicate that a task became Ready */\r
-#undef trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE\r
-#define trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB) \\r
- vTraceStoreTaskReady(TRACE_GET_TASK_NUMBER(pxTCB));\r
-#else\r
-#undef trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE\r
-#define trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB)\r
-#endif\r
-\r
-/* This macro will update the internal tick counter and call vTracePortGetTimeStamp(0) to update the internal counters */\r
-#undef trcKERNEL_HOOKS_INCREMENT_TICK\r
-#define trcKERNEL_HOOKS_INCREMENT_TICK() \\r
- { extern uint32_t uiTraceTickCount; uiTraceTickCount++; vTracePortGetTimeStamp(0); }\r
-\r
-#if INCLUDE_NEW_TIME_EVENTS == 1\r
-/* This macro will create an event indicating that the OS tick count has increased */\r
-#undef trcKERNEL_HOOKS_NEW_TIME\r
-#define trcKERNEL_HOOKS_NEW_TIME(SERVICE, xValue) \\r
- vTraceStoreKernelCallWithNumericParamOnly(SERVICE, xValue);\r
-#else\r
-#undef trcKERNEL_HOOKS_NEW_TIME\r
-#define trcKERNEL_HOOKS_NEW_TIME(SERVICE, xValue)\r
-#endif\r
-\r
-/* This macro will create a task switch event to the currently executing task */\r
-#undef trcKERNEL_HOOKS_TASK_SWITCH\r
-#define trcKERNEL_HOOKS_TASK_SWITCH( pxTCB ) \\r
- vTraceStoreTaskswitch(TRACE_GET_TASK_NUMBER(pxTCB));\r
-\r
-/* This macro will create an event to indicate that the task has been suspended */\r
-#undef trcKERNEL_HOOKS_TASK_SUSPEND\r
-#define trcKERNEL_HOOKS_TASK_SUSPEND(SERVICE, pxTCB) \\r
- vTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \\r
- vTraceSetTaskInstanceFinished((uint8_t)TRACE_GET_TASK_NUMBER(pxTCB));\r
-\r
-/* This macro will create an event to indicate that a task has called a wait/delay function */\r
-#undef trcKERNEL_HOOKS_TASK_DELAY\r
-#define trcKERNEL_HOOKS_TASK_DELAY(SERVICE, pxTCB, xValue) \\r
- vTraceStoreKernelCallWithNumericParamOnly(SERVICE, xValue); \\r
- vTraceSetTaskInstanceFinished((uint8_t)TRACE_GET_TASK_NUMBER(pxTCB));\r
-\r
-/* This macro will create an event to indicate that a task has gotten its priority changed */\r
-#undef trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE\r
-#define trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(SERVICE, pxTCB, uxNewPriority) \\r
- vTraceStoreKernelCallWithParam(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), uiTraceGetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)));\\r
- vTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), (uint8_t)uxNewPriority);\r
-\r
-/* This macro will create an event to indicate that the task has been resumed */\r
-#undef trcKERNEL_HOOKS_TASK_RESUME\r
-#define trcKERNEL_HOOKS_TASK_RESUME(SERVICE, pxTCB) \\r
- vTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));\r
-\r
-#endif\r
-\r
-#endif /* TRCKERNELHOOKS_H */\r
/*******************************************************************************\r
- * Tracealyzer v2.4.1 Recorder Library\r
+ * Tracealyzer v2.5.0 Recorder Library\r
* Percepio AB, www.percepio.com\r
*\r
* trcKernel.h\r
void vTraceStoreTaskReady(objectHandleType handle);\r
#endif\r
\r
+void vTraceStoreLowPower(uint32_t flag);\r
+\r
void vTraceStoreTaskswitch(objectHandleType task_handle);\r
\r
void vTraceStoreKernelCall(uint32_t eventcode, traceObjectClass objectClass, uint32_t byteParam);\r
--- /dev/null
+/*******************************************************************************\r
+* Tracealyzer v2.5.0 Recorder Library\r
+* Percepio AB, www.percepio.com\r
+*\r
+* trcKernelHooks.h\r
+*\r
+* The kernel integration hooks.\r
+*\r
+* NOTE:\r
+* For IAR Embedded Workbench for ARM, you need to have a preprocessor condition\r
+* on the include, to except it from the assembler step which otherwise give\r
+* compile-time errors.\r
+*\r
+* #ifdef __ICCARM__\r
+* #include "percepio/Include/trcKernelHooks.h"\r
+* #endif\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
+* 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
+* 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
+* implied warranty may last, so the above limitations may not apply to you.\r
+*\r
+* Copyright Percepio AB, 2013.\r
+* www.percepio.com\r
+******************************************************************************/\r
+\r
+#ifndef TRCKERNELHOOKS_H\r
+#define TRCKERNELHOOKS_H\r
+\r
+#if (USE_TRACEALYZER_RECORDER == 1)\r
+\r
+#undef INCLUDE_xTaskGetSchedulerState\r
+#define INCLUDE_xTaskGetSchedulerState 1\r
+\r
+#undef INCLUDE_xTaskGetCurrentTaskHandle\r
+#define INCLUDE_xTaskGetCurrentTaskHandle 1\r
+\r
+#ifndef INCLUDE_OBJECT_DELETE\r
+#define INCLUDE_OBJECT_DELETE 0\r
+#endif\r
+\r
+#ifndef INCLUDE_READY_EVENTS\r
+#define INCLUDE_READY_EVENTS 1\r
+#endif\r
+\r
+#ifndef INCLUDE_NEW_TIME_EVENTS\r
+#define INCLUDE_NEW_TIME_EVENTS 0\r
+#endif\r
+\r
+#if (INCLUDE_OBJECT_DELETE == 1)\r
+/* This macro will remove the task and store it in the event buffer */\r
+#undef trcKERNEL_HOOKS_TASK_DELETE\r
+#define trcKERNEL_HOOKS_TASK_DELETE(SERVICE, pxTCB) \\r
+ vTraceStoreKernelCall(TRACE_GET_TASK_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxTCB), TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \\r
+ vTraceStoreObjectNameOnCloseEvent(TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \\r
+ vTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \\r
+ vTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_PRIORITY(pxTCB)); \\r
+ vTraceSetObjectState(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TASK_STATE_INSTANCE_NOT_ACTIVE); \\r
+ vTraceFreeObjectHandle(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));\r
+#else\r
+#undef trcKERNEL_HOOKS_TASK_DELETE\r
+#define trcKERNEL_HOOKS_TASK_DELETE(SERVICE, pxTCB)\r
+#endif\r
+\r
+#if (INCLUDE_OBJECT_DELETE == 1)\r
+/* This macro will remove the object and store it in the event buffer */\r
+#undef trcKERNEL_HOOKS_OBJECT_DELETE\r
+#define trcKERNEL_HOOKS_OBJECT_DELETE(SERVICE, CLASS, pxObject) \\r
+ vTraceStoreKernelCall(TRACE_GET_OBJECT_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \\r
+ vTraceStoreObjectNameOnCloseEvent(TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); \\r
+ vTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); \\r
+ vTraceFreeObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));\r
+#else\r
+#undef trcKERNEL_HOOKS_OBJECT_DELETE\r
+#define trcKERNEL_HOOKS_OBJECT_DELETE(SERVICE, CLASS, pxObject)\r
+#endif\r
+\r
+/* This macro will create a task in the object table */\r
+#undef trcKERNEL_HOOKS_TASK_CREATE\r
+#define trcKERNEL_HOOKS_TASK_CREATE(SERVICE, pxTCB) \\r
+ TRACE_SET_TASK_NUMBER(pxTCB) \\r
+ vTraceSetObjectName(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_NAME(pxTCB)); \\r
+ vTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_PRIORITY(pxTCB)); \\r
+ vTraceStoreKernelCall(TRACE_GET_TASK_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxTCB), TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));\r
+\r
+/* This macro will create a failed create call to create a task */\r
+#undef trcKERNEL_HOOKS_TASK_CREATE_FAILED\r
+#define trcKERNEL_HOOKS_TASK_CREATE_FAILED(SERVICE) \\r
+ vTraceStoreKernelCall(TRACE_GET_TASK_EVENT_CODE(SERVICE, FAILED, CLASS, pxTCB), TRACE_CLASS_TASK, 0);\r
+\r
+/* This macro will setup a task in the object table */\r
+#undef trcKERNEL_HOOKS_OBJECT_CREATE\r
+#define trcKERNEL_HOOKS_OBJECT_CREATE(SERVICE, CLASS, pxObject)\\r
+ TRACE_SET_OBJECT_NUMBER(CLASS, pxObject);\\r
+ vTraceStoreKernelCall(TRACE_GET_OBJECT_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \\r
+ vTraceSetObjectState(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), 0);\r
+\r
+/* This macro will create a failed create call to create an object */\r
+#undef trcKERNEL_HOOKS_OBJECT_CREATE_FAILED\r
+#define trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(SERVICE, CLASS, kernelClass) \\r
+ vTraceStoreKernelCall(TRACE_GET_CLASS_EVENT_CODE(SERVICE, FAILED, CLASS, kernelClass), TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass), 0);\r
+\r
+/* This macro will create a call to a kernel service with a certain result, with an object as parameter */\r
+#undef trcKERNEL_HOOKS_KERNEL_SERVICE\r
+#define trcKERNEL_HOOKS_KERNEL_SERVICE(SERVICE, RESULT, CLASS, pxObject) \\r
+ vTraceStoreKernelCall(TRACE_GET_OBJECT_EVENT_CODE(SERVICE, RESULT, CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));\r
+\r
+/* This macro will set the state for an object */\r
+#undef trcKERNEL_HOOKS_SET_OBJECT_STATE\r
+#define trcKERNEL_HOOKS_SET_OBJECT_STATE(CLASS, pxObject, STATE) \\r
+ vTraceSetObjectState(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), STATE);\r
+\r
+/* This macro will flag a certain task as a finished instance */\r
+#undef trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED\r
+#define trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(CLASS, pxObject) \\r
+ vTraceSetTaskInstanceFinished(TRACE_GET_TASK_NUMBER(TRACE_GET_CURRENT_TASK()));\r
+\r
+#if INCLUDE_READY_EVENTS == 1\r
+/* This macro will create an event to indicate that a task became Ready */\r
+#undef trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE\r
+#define trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB) \\r
+ vTraceStoreTaskReady(TRACE_GET_TASK_NUMBER(pxTCB));\r
+#else\r
+#undef trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE\r
+#define trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB)\r
+#endif\r
+\r
+/* This macro will update the internal tick counter and call vTracePortGetTimeStamp(0) to update the internal counters */\r
+#undef trcKERNEL_HOOKS_INCREMENT_TICK\r
+#define trcKERNEL_HOOKS_INCREMENT_TICK() \\r
+ { extern uint32_t uiTraceTickCount; uiTraceTickCount++; vTracePortGetTimeStamp(0); }\r
+\r
+#if INCLUDE_NEW_TIME_EVENTS == 1\r
+/* This macro will create an event indicating that the OS tick count has increased */\r
+#undef trcKERNEL_HOOKS_NEW_TIME\r
+#define trcKERNEL_HOOKS_NEW_TIME(SERVICE, xValue) \\r
+ vTraceStoreKernelCallWithNumericParamOnly(SERVICE, xValue);\r
+#else\r
+#undef trcKERNEL_HOOKS_NEW_TIME\r
+#define trcKERNEL_HOOKS_NEW_TIME(SERVICE, xValue)\r
+#endif\r
+\r
+/* This macro will create a task switch event to the currently executing task */\r
+#undef trcKERNEL_HOOKS_TASK_SWITCH\r
+#define trcKERNEL_HOOKS_TASK_SWITCH( pxTCB ) \\r
+ vTraceStoreTaskswitch(TRACE_GET_TASK_NUMBER(pxTCB));\r
+\r
+/* This macro will create an event to indicate that the task has been suspended */\r
+#undef trcKERNEL_HOOKS_TASK_SUSPEND\r
+#define trcKERNEL_HOOKS_TASK_SUSPEND(SERVICE, pxTCB) \\r
+ vTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \\r
+ vTraceSetTaskInstanceFinished((uint8_t)TRACE_GET_TASK_NUMBER(pxTCB));\r
+\r
+/* This macro will create an event to indicate that a task has called a wait/delay function */\r
+#undef trcKERNEL_HOOKS_TASK_DELAY\r
+#define trcKERNEL_HOOKS_TASK_DELAY(SERVICE, pxTCB, xValue) \\r
+ vTraceStoreKernelCallWithNumericParamOnly(SERVICE, xValue); \\r
+ vTraceSetTaskInstanceFinished((uint8_t)TRACE_GET_TASK_NUMBER(pxTCB));\r
+\r
+/* This macro will create an event to indicate that a task has gotten its priority changed */\r
+#undef trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE\r
+#define trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(SERVICE, pxTCB, uxNewPriority) \\r
+ vTraceStoreKernelCallWithParam(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), uiTraceGetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)));\\r
+ vTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), (uint8_t)uxNewPriority);\r
+\r
+/* This macro will create an event to indicate that the task has been resumed */\r
+#undef trcKERNEL_HOOKS_TASK_RESUME\r
+#define trcKERNEL_HOOKS_TASK_RESUME(SERVICE, pxTCB) \\r
+ vTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));\r
+\r
+#endif\r
+\r
+#endif /* TRCKERNELHOOKS_H */\r
/*******************************************************************************\r
- * Tracealyzer v2.4.1 Recorder Library\r
+ * Tracealyzer v2.5.0 Recorder Library\r
* Percepio AB, www.percepio.com\r
*\r
* trcKernelPort.h\r
\r
/* Defines that must be set for the recorder to work properly */\r
#define TRACE_KERNEL_VERSION 0x1AA1\r
-#define TRACE_CPU_CLOCK_HZ configCPU_CLOCK_HZ /* Defined in "FreeRTOS.h" */\r
-#define TRACE_PERIPHERAL_CLOCK_HZ configPERIPHERAL_CLOCK_HZ /* Defined in "FreeRTOS.h" */\r
#define TRACE_TICK_RATE_HZ configTICK_RATE_HZ /* Defined in "FreeRTOS.h" */\r
-#define TRACE_CPU_CLOCKS_PER_TICK configCPU_CLOCKS_PER_TICK /* Defined in "FreeRTOS.h" */\r
\r
/************************************************************************/\r
/* KERNEL SPECIFIC OBJECT CONFIGURATION */\r
/* Includes */\r
#include "trcTypes.h"\r
#include "trcConfig.h"\r
-#include "trcHooks.h"\r
+#include "trcKernelHooks.h"\r
#include "trcHardwarePort.h"\r
#include "trcBase.h"\r
#include "trcKernel.h"\r
#include "trcUser.h"\r
\r
+#if (INCLUDE_NEW_TIME_EVENTS == 1 && configUSE_TICKLESS_IDLE != 0)\r
+#error "NewTime events can not be used in combination with tickless idle!"\r
+#endif\r
+\r
/* Initialization of the object property table */\r
void vTraceInitObjectPropertyTable(void);\r
\r
\r
#define RESERVED_DUMMY_CODE (EVENTGROUP_SYS + 3) /*0xAB*/\r
\r
+#define LOW_POWER_BEGIN (EVENTGROUP_SYS + 4) /*0xAC*/\r
+#define LOW_POWER_END (EVENTGROUP_SYS + 5) /*0xAD*/\r
+\r
\r
\r
/************************************************************************/\r
#define TRACE_GET_OBJECT_EVENT_CODE(SERVICE, RESULT, CLASS, pxObject) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject))\r
#define TRACE_GET_TASK_EVENT_CODE(SERVICE, RESULT, CLASS, pxTCB) (EVENTGROUP_##SERVICE##_##RESULT + TRACE_CLASS_TASK)\r
\r
-\r
-\r
/************************************************************************/\r
/* KERNEL SPECIFIC WRAPPERS THAT SHOULD BE CALLED BY THE KERNEL */\r
/************************************************************************/\r
\r
+#if (configUSE_TICKLESS_IDLE != 0)\r
+\r
+#undef traceLOW_POWER_IDLE_BEGIN\r
+#define traceLOW_POWER_IDLE_BEGIN() \\r
+ { \\r
+ extern uint32_t trace_disable_timestamp; \\r
+ vTraceStoreLowPower(0); \\r
+ trace_disable_timestamp = 1; \\r
+ } \r
+\r
+#undef traceLOW_POWER_IDLE_END\r
+#define traceLOW_POWER_IDLE_END() \\r
+ { \\r
+ extern uint32_t trace_disable_timestamp; \\r
+ trace_disable_timestamp = 0; \\r
+ vTraceStoreLowPower(1); \\r
+ }\r
+\r
+/* A macro that will update the tick count when returning from tickless idle */\r
+#undef traceINCREASE_TICK_COUNT( xCount )\r
+#define traceINCREASE_TICK_COUNT( xCount ) { extern uint32_t uiTraceTickCount; uiTraceTickCount += xTickCount; }\r
+\r
+#endif\r
+\r
/* Called for each task that becomes ready */\r
#undef traceMOVED_TASK_TO_READY_STATE\r
#define traceMOVED_TASK_TO_READY_STATE( pxTCB ) \\r
/*******************************************************************************\r
- * Tracealyzer v2.4.1 Recorder Library\r
+ * Tracealyzer v2.5.0 Recorder Library\r
* Percepio AB, www.percepio.com\r
*\r
* trcTypes.h\r
/*******************************************************************************\r
- * Tracealyzer v2.4.1 Recorder Library\r
+ * Tracealyzer v2.5.0 Recorder Library\r
* Percepio AB, www.percepio.com\r
*\r
* trcUser.h\r
******************************************************************************/\r
void vTraceStart(void);\r
\r
-/*******************************************************************************\r
- * vTraceStartStatusMonitor\r
- *\r
- * This starts a task to monitor the status of the recorder module.\r
- * This task periodically prints a line to the console window, which shows the\r
- * recorder status, the number of events recorded and the latest timestamp.\r
- * This task calls vTracePortEnd (trcHardwarePort.c) when it detects that the\r
- * recorder has been stopped. This allows for adding custom actions, e.g., to\r
- * store the trace to a file in case a file system is available on the device.\r
- ******************************************************************************/\r
-void vTraceStartStatusMonitor(void);\r
-\r
/*******************************************************************************\r
* vTraceStop\r
*\r
******************************************************************************/\r
void vTraceStop(void);\r
\r
+/*******************************************************************************\r
+ * xTraceGetLastError\r
+ *\r
+ * Gives the last error message, if any. NULL if no error message is stored.\r
+ * Any error message is also presented when opening a trace file.\r
+ ******************************************************************************/\r
+char* xTraceGetLastError(void);\r
+\r
/*******************************************************************************\r
* vTraceClear\r
*\r
******************************************************************************/\r
void vTraceClear(void);\r
\r
+/*******************************************************************************\r
+* vTraceClearError\r
+*\r
+* Removes any previous error message generated by recorder calling vTraceError.\r
+* By calling this function, it may be possible to start/restart the trace\r
+* despite errors in the recorder, but there is no guarantee that the trace\r
+* recorder will work correctly in that case, depending on the type of error.\r
+******************************************************************************/\r
+void vTraceClearError(int resetErrorMessage);\r
+\r
#if (INCLUDE_ISR_TRACING == 1)\r
\r
/*******************************************************************************\r
Percepio AB\r
www.percepio.com\r
\r
-This directory contains the a generic trace recorder library for Tracealyzer v2.4. \r
+This directory contains the a generic trace recorder library for Tracealyzer v2.5. \r
\r
For information on how to upload the trace data from your target system RAM to \r
Tracealyzer, see "debugger trace upload.txt"\r
/*******************************************************************************\r
- * Tracealyzer v2.4.1 Recorder Library\r
+ * Tracealyzer v2.5.0 Recorder Library\r
* Percepio AB, www.percepio.com\r
*\r
* trcBase.c\r
/* Keeps track of available handles */\r
objectHandleStackType objectHandleStacks = { { 0 }, { 0 }, { 0 }, { 0 }, { 0 } };\r
\r
+uint32_t init_hwtc_count;\r
+\r
/*******************************************************************************\r
* RecorderData\r
*\r
/* This version of the function dynamically allocates the trace data */\r
void prvTraceInitTraceData()\r
{\r
+ init_hwtc_count = HWTC_COUNT;\r
+ \r
#if TRACE_DATA_ALLOCATION == TRACE_DATA_ALLOCATION_STATIC\r
RecorderDataPtr = &RecorderData;\r
#elif TRACE_DATA_ALLOCATION == TRACE_DATA_ALLOCATION_DYNAMIC\r
TRACE_ASSERT(objectclass < TRACE_NCLASSES, "uiIndexOfObject: Invalid value for objectclass", 0);\r
TRACE_ASSERT(objecthandle > 0 && objecthandle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], "uiIndexOfObject: Invalid value for objecthandle", 0);\r
\r
- if ((objectclass < TRACE_NCLASSES) && (objecthandle > 0) && (objecthandle <=\r
- RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass]))\r
+ if ((objectclass < TRACE_NCLASSES) && (objecthandle > 0) && (objecthandle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass]))\r
{\r
- return (uint16_t)(RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[objectclass] +\r
- (RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[objectclass] * (objecthandle-1)));\r
+ return (uint16_t)(RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[objectclass] + (RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[objectclass] * (objecthandle-1)));\r
}\r
\r
vTraceError("Object table lookup with invalid object handle or object class!");\r
\r
TRACE_ASSERT(param_maxDTS == 0xFF || param_maxDTS == 0xFFFF, "prvTraceGetDTS: Invalid value for param_maxDTS", 0);\r
\r
- if (RecorderDataPtr->frequency == 0)\r
+ if (RecorderDataPtr->frequency == 0 && init_hwtc_count != HWTC_COUNT)\r
{\r
/* If HWTC_PERIOD is mapped to the timer reload register,\r
such as in the Cortex M port, it might not be initialized\r
before the Kernel scheduler has been started has been\r
- started. We therefore store the frequency of the timer at\r
- the first timestamped event after the scheduler has started.\r
- (Note that this function is called also by vTraceStart and\r
- uiTraceStart, which might be called before the scheduler\r
- has been started.) */\r
+ started. We therefore store the frequency of the timer\r
+ once the counter register has changed. */\r
\r
#if (SELECTED_PORT == PORT_Win32)\r
RecorderDataPtr->frequency = 100000;\r
#elif (SELECTED_PORT == PORT_HWIndependent)\r
RecorderDataPtr->frequency = TRACE_TICK_RATE_HZ;\r
#else\r
- RecorderDataPtr->frequency = TRACE_CPU_CLOCK_HZ / (uint32_t)HWTC_DIVISOR;\r
+ RecorderDataPtr->frequency = (HWTC_PERIOD * TRACE_TICK_RATE_HZ) / (uint32_t)HWTC_DIVISOR;\r
#endif\r
}\r
\r
/******************************************************************************* \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
\r
#include <stdint.h>\r
\r
+uint32_t trace_disable_timestamp = 0;\r
+uint32_t last_timestamp = 0;\r
\r
/*******************************************************************************\r
* uiTraceTickCount\r
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
*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
/*******************************************************************************\r
- * Tracealyzer v2.4.1 Recorder Library\r
+ * Tracealyzer v2.5.0 Recorder Library\r
* Percepio AB, www.percepio.com\r
*\r
* trcKernel.c\r
}\r
#endif\r
\r
+/*******************************************************************************\r
+ * vTraceStoreLowPower\r
+ *\r
+ * This function stores a low power state.\r
+ ******************************************************************************/\r
+void vTraceStoreLowPower(uint32_t flag)\r
+{\r
+ uint16_t dts;\r
+ LPEvent* lp;\r
+ \r
+ TRACE_ASSERT(flag <= 1, "vTraceStoreLowPower: Invalid flag value", );\r
+\r
+ if (recorder_busy)\r
+ {\r
+ /***********************************************************************\r
+ * This should never occur, as the tick- and kernel call ISR is on lowest\r
+ * interrupt priority and always are disabled during the critical sections\r
+ * of the recorder.\r
+ ***********************************************************************/\r
+ \r
+ vTraceError("Recorder busy - high priority ISR using syscall? (1)");\r
+ return;\r
+ }\r
+\r
+ if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
+ {\r
+ dts = (uint16_t)prvTraceGetDTS(0xFFFF);\r
+ if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
+ {\r
+ lp = (LPEvent*)xTraceNextFreeEventBufferSlot();\r
+ if (lp != NULL)\r
+ {\r
+ lp->type = LOW_POWER_BEGIN + flag; /* BEGIN or END depending on flag */\r
+ lp->dts = dts;\r
+\r
+ prvTraceUpdateCounters();\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
/*******************************************************************************\r
* vTraceStoreKernelCall\r
*\r
/*******************************************************************************\r
- * Tracealyzer v2.4.1 Recorder Library\r
+ * Tracealyzer v2.5.0 Recorder Library\r
* Percepio AB, www.percepio.com\r
*\r
* trcKernelPort.c\r
/*******************************************************************************\r
- * Tracealyzer v2.4.1 Recorder Library\r
+ * Tracealyzer v2.5.0 Recorder Library\r
* Percepio AB, www.percepio.com\r
*\r
* trcUser.c\r
* xTraceGetLastError\r
*\r
* Gives the last error message, if any. NULL if no error message is stored.\r
- * The message is cleared on read.\r
* Any error message is also presented when opening a trace file.\r
******************************************************************************/\r
char* xTraceGetLastError(void)\r
return traceErrorMessage;\r
}\r
\r
+/*******************************************************************************\r
+* vTraceClearError\r
+*\r
+* Removes any previous error message generated by recorder calling vTraceError. \r
+* By calling this function, it may be possible to start/restart the trace \r
+* despite errors in the recorder, but there is no guarantee that the trace \r
+* recorder will work correctly in that case, depending on the type of error.\r
+******************************************************************************/\r
+void vTraceClearError(int resetErrorMessage)\r
+{\r
+ traceErrorMessage = NULL; \r
+ RecorderDataPtr->internalErrorOccured = 0;\r
+}\r
+\r
/*******************************************************************************\r
* vTraceGetTraceBuffer\r
*\r