]> git.sur5r.net Git - freertos/commitdiff
+ New feature added: Task notifications.
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 15 Dec 2014 14:13:03 +0000 (14:13 +0000)
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 15 Dec 2014 14:13:03 +0000 (14:13 +0000)
+ Optimise Cortex-M4F ports by inlining some critical section macros.
+ Original ports used a #define to set the path to portmacro.h - that method has been obsolete for years and now all the old definitions have been moved into a separate header files called deprecated_definitions.h.
+ Cortex-M port now check the active vector bits against 0xff when determining if a function is called from an interrupt - previously only a subset of the bits (0x1f) were checked.
+ Add in new standard demo/test files TaskNotify.c/h and include the files in the simulator demos.
+ Update trace recorder code, and some demos to use the new version (more to do).
+ Introduce uxTaskPriorityGetFromISR().
+ Minor typo corrections.
+ Update MingW simulator demo to match the MSVC simulator demo.

git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2314 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

65 files changed:
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/ConfigurationTemplate/trcConfig.h
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcBase.h
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcHardwarePort.h
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernel.h
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelHooks.h
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelPort.h
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcTypes.h
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcUser.h
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/readme.txt
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcBase.c
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcHardwarePort.c
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcKernel.c
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcKernelPort.c
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcUser.c
FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/Compiler/GCC/pack_struct_end.h
FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/Compiler/GCC/pack_struct_start.h
FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/Compiler/MSVC/pack_struct_end.h
FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/Compiler/MSVC/pack_struct_start.h
FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/Compiler/Renesas/pack_struct_end.h
FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/Compiler/Renesas/pack_struct_start.h
FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/serial.c
FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_Apps/apps/BasicSocketCommandServer/BasicSocketCommandServer.c
FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c
FreeRTOS/Demo/Common/Minimal/TaskNotify.c [new file with mode: 0644]
FreeRTOS/Demo/Common/Minimal/TimerDemo.c
FreeRTOS/Demo/Common/include/TaskNotify.h [new file with mode: 0644]
FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/Renesas-Files/cgc_set.h
FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/main.c
FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h
FreeRTOS/Demo/WIN32-MSVC/Trace_Recorder_Configuration/trcConfig.h
FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj
FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj.filters
FreeRTOS/Demo/WIN32-MSVC/main.c
FreeRTOS/Demo/WIN32-MSVC/main_blinky.c
FreeRTOS/Demo/WIN32-MSVC/main_full.c
FreeRTOS/Demo/WIN32-MingW/.project
FreeRTOS/Demo/WIN32-MingW/FreeRTOSConfig.h
FreeRTOS/Demo/WIN32-MingW/Trace_Recorder_Configuration/trcConfig.h
FreeRTOS/Demo/WIN32-MingW/main.c
FreeRTOS/Demo/WIN32-MingW/main_blinky.c
FreeRTOS/Demo/WIN32-MingW/main_full.c
FreeRTOS/Demo/links_to_doc_pages_for_these_demos.url [new file with mode: 0644]
FreeRTOS/Demo/readme.txt
FreeRTOS/License/license.txt
FreeRTOS/Source/event_groups.c
FreeRTOS/Source/include/FreeRTOS.h
FreeRTOS/Source/include/deprecated_definitions.h [new file with mode: 0644]
FreeRTOS/Source/include/portable.h
FreeRTOS/Source/include/task.h
FreeRTOS/Source/list.c
FreeRTOS/Source/portable/GCC/ARM_CA9/port.c
FreeRTOS/Source/portable/GCC/ARM_CM3/port.c
FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c
FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h
FreeRTOS/Source/portable/GCC/MicroBlazeV8/portmacro.h
FreeRTOS/Source/portable/IAR/ARM_CM3/port.c
FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c
FreeRTOS/Source/portable/IAR/ARM_CM4F/portasm.s
FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h
FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c
FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c
FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h
FreeRTOS/Source/portable/Tasking/ARM_CM4F/port.c
FreeRTOS/Source/queue.c
FreeRTOS/Source/tasks.c

index e2d22e053a764e807e148c98cd6510ae930b77dd..4f3c2e924a1b68cf2cb21e030e6a7cd4ede6eab9 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Tracealyzer v2.6.0 Recorder Library\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcConfig.h\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
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2014.\r
  * www.percepio.com\r
  ******************************************************************************/\r
 \r
 #ifndef TRCCONFIG_H\r
 #define TRCCONFIG_H\r
 \r
-/*******************************************************************************\r
- * CONFIGURATION RELATED TO CAPACITY AND ALLOCATION \r
- ******************************************************************************/\r
-\r
-/*******************************************************************************\r
- * EVENT_BUFFER_SIZE\r
- *\r
- * Macro which should be defined as an integer value.\r
- *\r
- * This defines the capacity of the event buffer, i.e., the number of records\r
- * it may store. Each registered event typically use one record (4 byte), but\r
- * vTracePrintF may use multiple records depending on the number of data args.\r
- ******************************************************************************/\r
+/******************************************************************************\r
+ * SELECTED_PORT\r
+ *\r
+ * Macro that specifies what hardware port that should be used. \r
+ * Available ports are:\r
+ *\r
+ * Port Name                                                   Code     Official       OS supported\r
+ * PORT_APPLICATION_DEFINED                            -2              -                       -                                \r
+ * PORT_NOT_SET                                                        -1              -                       -                                \r
+ * PORT_HWIndependent                                  0               Yes                     Any\r
+ * PORT_Win32                                                  1               Yes                     FreeRTOS on Win32\r
+ * PORT_Atmel_AT91SAM7                                 2               No                      Any                             \r
+ * PORT_Atmel_UC3A0                                            3               No                      Any                             \r
+ * PORT_ARM_CortexM                                            4               Yes                     Any                             \r
+ * PORT_Renesas_RX600                                  5               Yes                     Any                             \r
+ * PORT_Microchip_dsPIC_AND_PIC24              6               Yes                     Any                             \r
+ * PORT_TEXAS_INSTRUMENTS_TMS570               7               No                      Any                             \r
+ * PORT_TEXAS_INSTRUMENTS_MSP430               8               No                      Any                             \r
+ * PORT_MICROCHIP_PIC32MX                              9               Yes                     Any                             \r
+ * PORT_XILINX_PPC405                                  10              No                      FreeRTOS                 \r
+ * PORT_XILINX_PPC440                                  11              No                      FreeRTOS                 \r
+ * PORT_XILINX_MICROBLAZE                              12              No                      Any                             \r
+ * PORT_NXP_LPC210X                                            13              No                      Any                             \r
+ * PORT_MICROCHIP_PIC32MZ                              14              Yes                     Any                     \r
+ * PORT_ARM_CORTEX_A9                                  15              No                      Any\r
+ *****************************************************************************/\r
 \r
-#define EVENT_BUFFER_SIZE 4000 /* Adjust wrt. to available RAM */\r
+#ifndef WIN32\r
+       // Set the port setting here!\r
+       #define SELECTED_PORT PORT_NOT_SET\r
 \r
+       #if (SELECTED_PORT == PORT_NOT_SET)\r
+               #error "You need to define SELECTED_PORT here!"\r
+       #endif\r
+#else\r
+       // For Win32 demo projects this is set automatically\r
+       #define SELECTED_PORT PORT_Win32        \r
+#endif\r
 \r
-/*******************************************************************************\r
- * USE_LINKER_PRAGMA\r
- *\r
- * Macro which should be defined as an integer value, default is 0.\r
- *\r
- * If this is 1, the header file "recorderdata_linker_pragma.h" is included just\r
- * before the declaration of RecorderData (in trcBase.c), i.e., the trace data \r
- * structure. This allows the user to specify a pragma with linker options. \r
- *\r
- * Example (for IAR Embedded Workbench and NXP LPC17xx):\r
- * #pragma location="AHB_RAM_MEMORY"\r
+/******************************************************************************\r
+ * FREERTOS_VERSION\r
  * \r
- * This example instructs the IAR linker to place RecorderData in another RAM \r
- * bank, the AHB RAM. This can also be used for other compilers with a similar\r
- * pragmas for linker options.\r
+ * Specify what version of FreeRTOS that is used. This is necessary compensate \r
+ * for renamed symbols in the FreeRTOS kernel (does not build if incorrect).\r
  * \r
- * Note that this only applies if using static allocation, see below.\r
- ******************************************************************************/\r
-\r
-#define USE_LINKER_PRAGMA 0\r
-\r
+ * FREERTOS_VERSION_7_3_OR_7_4 (= 1)           If using FreeRTOS v7.3.0 - v7.4.2\r
+ * FREERTOS_VERSION_7_5_OR_7_6 (= 2)           If using FreeRTOS v7.5.0 - v7.6.0\r
+ * FREERTOS_VERSION_8_0_OR_LATER (= 3)         If using FreeRTOS v8.0.0 or later\r
+ *****************************************************************************/\r
+#define FREERTOS_VERSION       FREERTOS_VERSION_8_0_OR_LATER\r
 \r
-/*******************************************************************************\r
- * SYMBOL_TABLE_SIZE\r
+/******************************************************************************\r
+ * TRACE_RECORDER_STORE_MODE\r
  *\r
- * Macro which should be defined as an integer value.\r
+ * Macro which should be defined as one of:\r
+ * - TRACE_STORE_MODE_RING_BUFFER\r
+ * - TRACE_STORE_MODE_STOP_WHEN_FULL\r
+ * Default is TRACE_STORE_MODE_RING_BUFFER.\r
  *\r
- * This defines the capacity of the symbol table, in bytes. This symbol table \r
- * stores User Events labels and names of deleted tasks, queues, or other kernel\r
- * objects. Note that the names of active objects not stored here but in the \r
- * Object Table. Thus, if you don't use User Events or delete any kernel \r
- * objects you set this to a very low value, e.g. 4, but not zero (0) since \r
- * this causes a declaration of a zero-sized array, for which the C compiler\r
- * behavior is not standardized and may cause misaligned data.\r
- ******************************************************************************/\r
-#define SYMBOL_TABLE_SIZE 800\r
-\r
-#if (SYMBOL_TABLE_SIZE == 0)\r
-#error "SYMBOL_TABLE_SIZE may not be zero!"\r
-#endif\r
+ * With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the \r
+ * events are stored in a ring buffer, i.e., where the oldest events are \r
+ * overwritten when the buffer becomes full. This allows you to get the last\r
+ * events leading up to an interesting state, e.g., an error, without having \r
+ * to store the whole run since startup.\r
+ *\r
+ * When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the \r
+ * recording is stopped when the buffer becomes full. This is useful for\r
+ * recording events following a specific state, e.g., the startup sequence.\r
+ *****************************************************************************/\r
+#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_STOP_WHEN_FULL\r
 \r
 /*******************************************************************************\r
- * USE_SEPARATE_USER_EVENT_BUFFER\r
+ * TRACE_SCHEDULING_ONLY\r
  *\r
  * Macro which should be defined as an integer value.\r
- * Default is zero (0).\r
  *\r
- * This enables and disables the use of the separate user event buffer.\r
+ * If this setting is enabled (= 1), only scheduling events are recorded.\r
+ * If disabled (= 0), all events are recorded.\r
  *\r
- * Note: When using the separate user event buffer, you may get an artificial\r
- * task instance named "Unknown actor". This is added as a placeholder when the \r
- * user event history is longer than the task scheduling history.\r
- ******************************************************************************/\r
-#define USE_SEPARATE_USER_EVENT_BUFFER 0\r
-\r
-/*******************************************************************************\r
- * USER_EVENT_BUFFER_SIZE\r
+ * Users of FreeRTOS+Trace Free Edition only displays scheduling events, so this\r
+ * option can be used to avoid storing unsupported events.\r
  *\r
- * Macro which should be defined as an integer value.\r
+ * Default value is 0 (store all enabled events).\r
  *\r
- * This defines the capacity of the user event buffer, in number of slots.\r
- * A single user event can use between 1 and X slots, depending on the data.\r
- *\r
- * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
  ******************************************************************************/\r
-#define USER_EVENT_BUFFER_SIZE 10\r
+#define TRACE_SCHEDULING_ONLY 0\r
 \r
 /*******************************************************************************\r
- * USER_EVENT_CHANNELS\r
+ * EVENT_BUFFER_SIZE\r
  *\r
  * Macro which should be defined as an integer value.\r
  *\r
- * This defines the number of allowed user event channels.\r
- *\r
- * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
+ * This defines the capacity of the event buffer, i.e., the number of records\r
+ * it may store. Most events use one record (4 byte), although some events \r
+ * require multiple 4-byte records. You should adjust this to the amount of RAM\r
+ * available in the target system.\r
+ * \r
+ * Default value is 1000, which means that 4000 bytes is allocated for the\r
+ * event buffer.\r
  ******************************************************************************/\r
-#define CHANNEL_FORMAT_PAIRS 32\r
+#define EVENT_BUFFER_SIZE 1000\r
 \r
 /*******************************************************************************\r
  * NTask, NISR, NQueue, NSemaphore, NMutex\r
  *\r
- * A group of Macros which should be defined as an integer value of zero (0) \r
- * or larger.\r
+ * A group of macros which should be defined as integer values, zero or larger.\r
  *\r
- * This defines the capacity of the Object Property Table - the maximum number\r
- * of objects active at any given point within each object class.\r
+ * These define the capacity of the Object Property Table, i.e., the maximum\r
+ * number of objects active at any given point, within each object class (e.g., \r
+ * task, queue, semaphore, ...).\r
  * \r
- * NOTE: In case objects are deleted and created during runtime, this setting\r
- * does not limit the total amount of objects, only the number of concurrently\r
- * active objects. \r
+ * If tasks or other other objects are deleted in your system, this\r
+ * setting does not limit the total amount of objects created, only the number\r
+ * of objects that have been successfully created but not yet deleted.\r
  *\r
- * Using too small values will give an error message through the vTraceError\r
- * routine, which makes the error message appear when opening the trace data\r
- * in Tracealyzer. If you are using the recorder status monitor task,\r
- * any error messages are displayed in console prints, assuming that the\r
- * print macro has been defined properly (vConsolePrintMessage). \r
+ * Using too small values will cause vTraceError to be called, which stores an \r
+ * error message in the trace that is shown when opening the trace file.\r
  *\r
- * It can be wise to start with very large values for these constants, \r
+ * It can be wise to start with large values for these constants, \r
  * unless you are very confident on these numbers. Then do a recording and\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 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
+ * check the actual usage by selecting View menu -> Trace Details -> \r
+ * Resource Usage -> Object Table. \r
  ******************************************************************************/\r
-#define NTask             15\r
-#define NISR              5\r
-#define NQueue            10\r
-#define NSemaphore        10\r
-#define NMutex            10\r
-#define NTimer            2\r
-#define NEventGroup       2\r
-\r
-/* Maximum object name length for each class (includes zero termination) */\r
-#define NameLenTask       15\r
-#define NameLenISR        15\r
-#define NameLenQueue      15\r
-#define NameLenSemaphore  15\r
-#define NameLenMutex      15\r
-#define NameLenTimer      15\r
-#define NameLenEventGroup 15\r
-\r
-/******************************************************************************\r
- * TRACE_DESCRIPTION\r
- *\r
- * Macro which should be defined as a string.\r
- *\r
- * This string is stored in the trace and displayed in Tracealyzer. Can be\r
- * used to store, e.g., system version or build date. This is also used to store\r
- * internal error messages from the recorder, which if occurs overwrites the\r
- * value defined here. This may be maximum 256 chars.\r
- *****************************************************************************/\r
-#define TRACE_DESCRIPTION "Tracealyzer Recorder Test Program"\r
-\r
-/******************************************************************************\r
- * TRACE_DESCRIPTION_MAX_LENGTH\r
- *\r
- * The maximum length (including zero termination) for the TRACE_DESCRIPTION\r
- * string. Since this string also is used for internal error messages from the \r
- * recorder do not make it too short, as this may truncate the error messages.\r
- * Default is 80. \r
- * Maximum allowed length is 256 - the trace will fail to load if longer.\r
- *****************************************************************************/\r
-#define TRACE_DESCRIPTION_MAX_LENGTH 80\r
-\r
+#define NTask                  15\r
+#define NISR                   5\r
+#define NQueue                 10\r
+#define NSemaphore             10\r
+#define NMutex                 10\r
+#define NTimer                 2\r
+#define NEventGroup            2\r
 \r
 /******************************************************************************\r
- * TRACE_DATA_ALLOCATION\r
- *\r
- * This defines how to allocate the recorder data structure, i.e., using a \r
- * static declaration or using a dynamic allocation in runtime (malloc).\r
- *\r
- * Should be one of these two options:\r
- * - TRACE_DATA_ALLOCATION_STATIC (default)\r
- * - TRACE_DATA_ALLOCATION_DYNAMIC\r
- *\r
- * Using static allocation has the benefits of compile-time errors if the buffer \r
- * is too large (too large constants in trcConfig.h) and no need to call the \r
- * initialization routine (xTraceInitTraceData).\r
- *\r
- * Using dynamic allocation may give more flexibility in some cases.\r
- *****************************************************************************/\r
-\r
-#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC\r
-\r
-\r
-/******************************************************************************\r
- * CONFIGURATION REGARDING WHAT CODE/FEATURES TO INCLUDE\r
- *****************************************************************************/\r
-\r
-/******************************************************************************\r
- * USE_TRACE_ASSERT\r
- *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 0.\r
- *\r
- * If this is one (1), the TRACE_ASSERT macro will verify that a condition is \r
- * true. If the condition is false, vTraceError() will be called.\r
- *****************************************************************************/\r
-#define USE_TRACE_ASSERT 1\r
-\r
-/******************************************************************************\r
- * INCLUDE_FLOAT_SUPPORT\r
- *\r
+ * INCLUDE_MEMMANG_EVENTS\r
+ * \r
  * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
  *\r
- * If this is zero (0), all references to floating point values are removed,\r
- * in case floating point values are not supported by the platform used.\r
- * Floating point values are only used in vTracePrintF and its subroutines, to \r
- * store float (%f) or double (%lf) argments. \r
+ * This controls if malloc and free calls should be traced. Set this to zero to\r
+ * exclude malloc/free calls, or one (1) to include such events in the trace.\r
  *\r
- * Note: vTracePrintF can still be used with integer and string arguments in\r
- * either case.\r
+ * Default value is 1.\r
  *****************************************************************************/\r
-#define INCLUDE_FLOAT_SUPPORT 1\r
+#define INCLUDE_MEMMANG_EVENTS 1\r
 \r
 /******************************************************************************\r
  * INCLUDE_USER_EVENTS\r
  *\r
  * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
  *\r
  * If this is zero (0) the code for creating User Events is excluded to\r
  * reduce code size. User Events are application-generated events, like \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 User Events are not displayed in FreeRTOS+Trace Free Edition.\r
+ * Default value is 1.\r
+ *\r
+ * Note that User Events are only displayed in Professional Edition.\r
  *****************************************************************************/\r
 #define INCLUDE_USER_EVENTS 1\r
 \r
+/*****************************************************************************\r
+ * INCLUDE_ISR_TRACING\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1). \r
+ *\r
+ * If this is zero (0), the code for recording Interrupt Service Routines is \r
+ * excluded to reduce code size.\r
+ *\r
+ * Default value is 1.\r
+ * \r
+ * Note, if the kernel has no central interrupt dispatcher, recording ISRs \r
+ * require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd \r
+ * in your interrupt handlers.\r
+ *****************************************************************************/\r
+#define INCLUDE_ISR_TRACING 1\r
+\r
 /*****************************************************************************\r
  * INCLUDE_READY_EVENTS\r
  *\r
  * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
  *\r
- * If this is zero (0), the code for recording Ready events is \r
- * excluded. Note, this will make it impossible to calculate the correct\r
- * response times.\r
+ * If one (1), events are recorded when tasks enter scheduling state "ready". \r
+ * This uses a lot of space in the event buffer, so excluding "ready events" \r
+ * will allow for longer traces. Including ready events however allows for \r
+ * showing the initial pending time before tasks enter the execution state, and \r
+ * for presenting accurate response times.\r
+ *\r
+ * Default value is 1.\r
  *****************************************************************************/\r
 #define INCLUDE_READY_EVENTS 1\r
 \r
  * INCLUDE_NEW_TIME_EVENTS\r
  *\r
  * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 0.\r
  *\r
- * If this is zero (1), events will be generated whenever the os clock is\r
+ * If this is zero (1), events will be generated whenever the OS clock is\r
  * increased.\r
+ *\r
+ * Default value is 0.\r
  *****************************************************************************/\r
 #define INCLUDE_NEW_TIME_EVENTS 0\r
 \r
-/*****************************************************************************\r
- * INCLUDE_ISR_TRACING\r
+/******************************************************************************\r
+ * INCLUDE_FLOAT_SUPPORT\r
  *\r
  * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
  *\r
- * If this is zero (0), the code for recording Interrupt Service Routines is \r
- * excluded to reduce code size.\r
- * \r
- * Note, if the kernel has no central interrupt dispatcher, recording ISRs \r
- * require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd \r
- * in your interrupt handlers.\r
+ * If this is zero (0), all references to floating point values are removed,\r
+ * in case floating point values are not supported by the platform used.\r
+ * Floating point values are only used in vTracePrintF and its subroutines, to \r
+ * store float (%f) or double (%lf) arguments. \r
+ *\r
+ * vTracePrintF can be used with integer and string arguments in either case.\r
+ *\r
+ * Default value is 1.\r
  *****************************************************************************/\r
-#define INCLUDE_ISR_TRACING 1\r
+#define INCLUDE_FLOAT_SUPPORT 1\r
 \r
 /******************************************************************************\r
  * INCLUDE_OBJECT_DELETE\r
  * \r
  * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
  *\r
  * This must be enabled (1) if tasks, queues or other \r
  * traced kernel objects are deleted at runtime. If no deletes are made, this \r
  * can be set to 0 in order to exclude the delete-handling code.\r
+ *\r
+ * Default value is 1.\r
  *****************************************************************************/\r
 #define INCLUDE_OBJECT_DELETE 1\r
 \r
-/******************************************************************************\r
- * INCLUDE_MEMMANG_EVENTS\r
- * \r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
+/*******************************************************************************\r
+ * SYMBOL_TABLE_SIZE\r
  *\r
- * This controls if malloc and free calls should be traced. Set this to zero to\r
- * exclude malloc/free calls from the tracing.\r
- *****************************************************************************/\r
-#define INCLUDE_MEMMANG_EVENTS 1\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the capacity of the symbol table, in bytes. This symbol table \r
+ * stores User Events labels and names of deleted tasks, queues, or other kernel\r
+ * objects. If you don't use User Events or delete any kernel \r
+ * objects you set this to a very low value. The minimum recommended value is 4.\r
+ * A size of zero (0) is not allowed since a zero-sized array may result in a \r
+ * 32-bit pointer, i.e., using 4 bytes rather than 0.\r
+ *\r
+ * Default value is 800.\r
+ ******************************************************************************/\r
+#define SYMBOL_TABLE_SIZE 800\r
+\r
+#if (SYMBOL_TABLE_SIZE == 0)\r
+#error "SYMBOL_TABLE_SIZE may not be zero!"\r
+#endif\r
 \r
 /******************************************************************************\r
- * CONFIGURATION RELATED TO BEHAVIOR\r
+ * NameLenTask, NameLenQueue, ...\r
+ *\r
+ * Macros that specify the maximum lengths (number of characters) for names of\r
+ * kernel objects, such as tasks and queues. If longer names are used, they will\r
+ * be truncated when stored in the recorder.\r
  *****************************************************************************/\r
+#define NameLenTask                    15\r
+#define NameLenISR                     15\r
+#define NameLenQueue           15\r
+#define NameLenSemaphore       15\r
+#define NameLenMutex           15\r
+#define NameLenTimer           15\r
+#define NameLenEventGroup      15\r
 \r
 /******************************************************************************\r
- * TRACE_RECORDER_STORE_MODE\r
+ * TRACE_DATA_ALLOCATION\r
  *\r
- * Macro which should be defined as one of:\r
- * - TRACE_STORE_MODE_RING_BUFFER\r
- * - TRACE_STORE_MODE_STOP_WHEN_FULL\r
- * Default is TRACE_STORE_MODE_RING_BUFFER.\r
+ * This defines how to allocate the recorder data structure, i.e., using a \r
+ * static declaration or using a dynamic allocation in runtime (malloc).\r
+ *\r
+ * Should be one of these two options:\r
+ * - TRACE_DATA_ALLOCATION_STATIC (default)\r
+ * - TRACE_DATA_ALLOCATION_DYNAMIC\r
+ *\r
+ * Using static allocation has the benefits of compile-time errors if the buffer \r
+ * is too large (too large constants in trcConfig.h) and no need to call the \r
+ * initialization routine (xTraceInitTraceData).\r
  *\r
- * With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the events are \r
- * stored in a ring buffer, i.e., where the oldest events are overwritten when \r
- * the buffer becomes full. This allows you to get the last events leading up \r
- * to an interesting state, e.g., an error, without having a large trace buffer\r
- * for string the whole run since startup. In this mode, the recorder can run\r
- * "forever" as the buffer never gets full, i.e., in the sense that it always\r
- * has room for more events.\r
- *\r
- * To fetch the trace in mode TRACE_STORE_MODE_RING_BUFFER, you need to first halt the\r
- * system using your debugger and then do a RAM dump, or to explicitly stop the\r
- * recorder using vTraceStop() and then store/upload the trace data using a\r
- * task that you need to provide yourself. The trace data is found in the struct\r
- * RecorderData, initialized in trcBase.c.\r
- *\r
- * Note that, if you upload the trace using a RAM dump, i.e., when the system is \r
- * halted on a breakpoint or by a debugger command, there is no need to stop the \r
- * recorder first.\r
- *\r
- * When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the recording is\r
- * stopped when the buffer becomes full. When the recorder stops itself this way\r
- * vTracePortEnd() is called which allows for custom actions, such as triggering\r
- * a task that stores the trace buffer, i.e., in case taking a RAM dump\r
- * using an on-chip debugger is not possible. In the Windows port, vTracePortEnd\r
- * saves the trace to file directly, but this is not recommended in a real-time\r
- * system since the scheduler is blocked during the processing of vTracePortEnd.\r
+ * Using dynamic allocation may give more flexibility in some cases.\r
  *****************************************************************************/\r
+#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC\r
+\r
 \r
-#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER\r
 \r
 /******************************************************************************\r
- * STOP_AFTER_N_EVENTS\r
+ *** ADVANCED SETTINGS ********************************************************\r
+ ******************************************************************************\r
+ * The remaining settings are not necessary to modify but allows for optimizing\r
+ * the recorder setup for your specific needs, e.g., to exclude events that you\r
+ * are not interested in, in order to get longer traces.\r
+ *****************************************************************************/ \r
+\r
+/******************************************************************************\r
+* HEAP_SIZE_BELOW_16M\r
+*\r
+* An integer constant that can be used to reduce the buffer usage of memory\r
+* allocation events (malloc/free). This value should be 1 if the heap size is \r
+* below 16 MB (2^24 byte), and you can live with reported addresses showing the \r
+* lower 24 bits only. If 0, you get the full 32-bit addresses.\r
+*\r
+* Default value is 0.\r
+******************************************************************************/\r
+#define HEAP_SIZE_BELOW_16M 0\r
+\r
+/******************************************************************************\r
+ * USE_LINKER_PRAGMA\r
  *\r
- * Macro which should be defined as an integer value, or not defined.\r
- * Default is -1\r
+ * Macro which should be defined as an integer value, default is 0.\r
  *\r
- * STOP_AFTER_N_EVENTS is intended for tests of the ring buffer mode (when\r
- * RECORDER_STORE_MODE is STORE_MODE_RING_BUFFER). It stops the recording when\r
- * the specified number of events has been observed. This value can be larger\r
- * than the buffer size, to allow for test of the "wrapping around" that occurs\r
- * in ring buffer mode . A negative value (or no definition of this macro)\r
- * disables this feature.\r
- *****************************************************************************/\r
-#define STOP_AFTER_N_EVENTS -1\r
+ * If this is 1, the header file "recorderdata_linker_pragma.h" is included just\r
+ * before the declaration of RecorderData (in trcBase.c), i.e., the trace data \r
+ * structure. This allows the user to specify a pragma with linker options. \r
+ *\r
+ * Example (for IAR Embedded Workbench and NXP LPC17xx):\r
+ * #pragma location="AHB_RAM_MEMORY"\r
+ * \r
+ * This example instructs the IAR linker to place RecorderData in another RAM \r
+ * bank, the AHB RAM. This can also be used for other compilers with a similar\r
+ * pragmas for linker options.\r
+ * \r
+ * Note that this only applies if using static allocation, see below.\r
+ ******************************************************************************/\r
+#define USE_LINKER_PRAGMA 0\r
 \r
 /******************************************************************************\r
  * USE_IMPLICIT_IFE_RULES\r
  * Macro which should be defined as either zero (0) or one (1). \r
  * Default is 1.\r
  *\r
- * ### Instance Finish Events (IFE) ###\r
- *\r
- * For tasks with "infinite" main loops (non-terminating tasks), the concept\r
- * of a task instance has no clear definition, it is an application-specific\r
- * thing. Tracealyzer allows you to define Instance Finish Events (IFEs),\r
- * which marks the point in a cyclic task when the "task instance" ends.\r
- * The IFE is a blocking kernel call, typically in the main loop of a task\r
- * which typically reads a message queue, waits for a semaphore or performs\r
- * an explicit delay.\r
- *\r
- * If USE_IMPLICIT_IFE_RULES is one (1), the kernel macros (trcKernelPort.h)\r
- * will define what kernel calls are considered by default to be IFEs.\r
- *\r
- * However, Implicit IFEs only applies to blocking kernel calls. If a\r
- * service reads a message without blocking, it does not create a new\r
- * instance since no blocking occurred.\r
+ * Tracealyzer groups the events into actor instances, based on context-switches\r
+ * and a definition of "Instance Finish Events", or IFEs. These are kernel calls \r
+ * considered to be the last event in a task instance. Some kernel calls are \r
+ * considered IFEs by default (e.g., delay functions), but it is also possible\r
+ * to specify this individually for each task (see vTraceTaskInstanceFinish).\r
  *\r
- * Moreover, the actual IFE might sometimes be another blocking call. We \r
- * therefore allow for user-defined Explicit IFEs by calling\r
+ * If USE_IMPLICIT_IFE_RULES is one (1), the default IFEs will be enabled, which\r
+ * gives a "typical" grouping of events into instances. You can combine this \r
+ * with calls to vTraceTaskInstanceFinish for specific tasks.\r
  *\r
- *     vTraceTaskInstanceIsFinished()\r
- *\r
- * right before the kernel call considered as IFE. This does not create an\r
- * additional event but instead stores the service code and object handle\r
- * of the IFE call as properties of the task.\r
- *\r
- * If using Explicit IFEs and the task also calls an Implicit IFE, this may \r
- * result in additional incorrect task instances.\r
- * This is solved by disabling the Implicit IFEs for the task, by adding\r
- * a call to\r
- * \r
- *     vTraceTaskSkipDefaultInstanceFinishedEvents()\r
- * \r
- * in the very beginning of that task. This allows you to combine Explicit IFEs\r
- * for some tasks with Implicit IFEs for the rest of the tasks, if\r
- * USE_IMPLICIT_IFE_RULES is 1.\r
- *\r
- * By setting USE_IMPLICIT_IFE_RULES to zero (0), the implicit IFEs are disabled\r
- * for all tasks. Tasks will then be considered to have a single instance only, \r
- * covering all execution fragments, unless you define an explicit IFE in each\r
- * task by calling vTraceTaskInstanceIsFinished before the blocking call.\r
+ * If USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFEs are disabled and all\r
+ * events withing each task is then shown as a single instance, unless  you call \r
+ * vTraceTaskInstanceFinish() at suitable locations to mark the IFEs.\r
  *****************************************************************************/\r
 #define USE_IMPLICIT_IFE_RULES 1\r
 \r
-\r
 /******************************************************************************\r
  * USE_16BIT_OBJECT_HANDLES\r
  *\r
  * Macro which should be defined as either zero (0) or one (1).\r
- * Default is 0.\r
- *\r
+ * \r
  * If set to 0 (zero), the recorder uses 8-bit handles to identify kernel \r
  * objects such as tasks and queues. This limits the supported number of\r
  * concurrently active objects to 255 of each type (object class).\r
  * object property table is limited to 64 KB, the practical limit is about\r
  * 3000 objects in total. \r
  * \r
- * NOTE: An object with a high ID (> 255) will generate an extra event \r
- * (= 4 byte) in the event buffer. \r
- * \r
- * NOTE: Some internal tables in the recorder gets larger when using 16-bit \r
- * handles. The additional RAM usage is 5-10 byte plus 1 byte per kernel object\r
- *, i.e., task, queue, semaphore, mutex, etc.\r
+ * Default is 0.\r
+ *\r
+ * NOTE: An object with handle above 255 will use an extra 4-byte record in \r
+ * the event buffer whenever referenced. Moreover, some internal tables in the \r
+ * recorder gets larger when using 16-bit handles. The additional RAM usage is \r
+ * 5-10 byte plus 1 byte per kernel object i.e., task, queue, mutex, etc.\r
  *****************************************************************************/\r
 #define USE_16BIT_OBJECT_HANDLES 0\r
 \r
-/****** Port Name ******************** Code ** Official ** OS Platform ******\r
-* PORT_APPLICATION_DEFINED               -2     -           -                 \r
-* PORT_NOT_SET                           -1     -           -                 \r
-* PORT_HWIndependent                     0      Yes         Any               \r
-* PORT_Win32                             1      Yes         FreeRTOS Win32\r
-* PORT_Atmel_AT91SAM7                    2      No          Any               \r
-* PORT_Atmel_UC3A0                       3      No          Any               \r
-* PORT_ARM_CortexM                       4      Yes         Any               \r
-* PORT_Renesas_RX600                     5      Yes         Any               \r
-* PORT_Microchip_dsPIC_AND_PIC24         6      Yes         Any               \r
-* PORT_TEXAS_INSTRUMENTS_TMS570          7      No          Any               \r
-* PORT_TEXAS_INSTRUMENTS_MSP430          8      No          Any               \r
-* PORT_MICROCHIP_PIC32                   9      No          Any               \r
-* PORT_XILINX_PPC405                     10     No          FreeRTOS          \r
-* PORT_XILINX_PPC440                     11     No          FreeRTOS          \r
-* PORT_XILINX_MICROBLAZE                 12     No          Any               \r
-* PORT_NXP_LPC210X                       13     No          Any               \r
-*****************************************************************************/\r
-#define SELECTED_PORT PORT_ARM_CortexM\r
-\r
-#if (SELECTED_PORT == PORT_NOT_SET)\r
-#error "You need to define SELECTED_PORT here!"\r
-#endif\r
-\r
 /******************************************************************************\r
-* USE_PRIMASK_CS (for Cortex M devices only)\r
-*\r
-* An integer constant that selects between two options for the critical\r
-* sections of the recorder library.\r
+ * USE_TRACE_ASSERT\r
  *\r
-*   0: The default FreeRTOS critical section (BASEPRI) - default setting\r
-*   1: Always disable ALL interrupts (using PRIMASK)\r
+ * Macro which should be defined as either zero (0) or one (1). \r
+ * Default is 1.\r
  *\r
-* Option 0 uses the standard FreeRTOS macros for critical sections.\r
-* However, on Cortex-M devices they only disable interrupts with priorities \r
-* below a certain configurable level, while higher priority ISRs remain active.\r
-* Such high-priority ISRs may not use the recorder functions in this mode.\r
-*\r
-* Option 1 allows you to safely call the recorder from any ISR, independent of \r
-* the interrupt priority. This mode may however cause higher IRQ latencies\r
-* (some microseconds) since ALL configurable interrupts are disabled during \r
-* the recorder's critical sections in this mode, using the PRIMASK register.\r
+ * If this is one (1), the TRACE_ASSERT macro will verify that a condition is \r
+ * true. If the condition is false, vTraceError() will be called.\r
+ * This is used on several places in the recorder code for sanity checks on\r
+ * parameters. Can be switched off to reduce CPU usage of the tracing.\r
+ *****************************************************************************/\r
+#define USE_TRACE_ASSERT 1\r
\r
+/*******************************************************************************\r
+ * USE_SEPARATE_USER_EVENT_BUFFER\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ * Default is zero (0).\r
+ *\r
+ * This enables and disables the use of the separate user event buffer. Using \r
+ * this separate buffer has the benefit of not overwriting the user events with \r
+ * kernel events (usually generated at a much higher rate), i.e., when using \r
+ * ring-buffer mode.\r
+ *\r
+ * Note: When using the separate user event buffer, you may get an artificial\r
+ * task instance named "Unknown actor". This is added as a placeholder when the \r
+ * user event history is longer than the task scheduling history.\r
  ******************************************************************************/\r
-#define USE_PRIMASK_CS 0\r
+#define USE_SEPARATE_USER_EVENT_BUFFER 0\r
 \r
-/******************************************************************************\r
-* HEAP_SIZE_BELOW_16M\r
-*\r
-* An integer constant that can be used to reduce the buffer usage of memory\r
-* allocation events (malloc/free). This value should be 1 if the heap size is \r
-* below 16 MB (2^24 byte), and you can live with addresses truncated to the \r
-* lower 24 bit. Otherwise set it to 0 to get the full 32-bit addresses.\r
-******************************************************************************/\r
-#define HEAP_SIZE_BELOW_16M 0\r
+/*******************************************************************************\r
+ * USER_EVENT_BUFFER_SIZE\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the capacity of the user event buffer, in number of slots.\r
+ * A single user event can use between 1 and X slots, depending on the data.\r
+ *\r
+ * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
+ ******************************************************************************/\r
+#define USER_EVENT_BUFFER_SIZE 10\r
+\r
+/*******************************************************************************\r
+ * USER_EVENT_CHANNELS\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the number of allowed user event channels.\r
+ *\r
+ * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
+ ******************************************************************************/\r
+#define CHANNEL_FORMAT_PAIRS 32\r
 \r
 #endif\r
 \r
index b3e522d5136f92ed99b8d455c35009963fc1ccf9..889299688548abc21385330ee566fd3f6a85baf2 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Tracealyzer v2.6.0 Recorder Library\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcBase.h\r
@@ -31,7 +31,9 @@
  * 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
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2014.\r
  * www.percepio.com\r
  ******************************************************************************/\r
 \r
@@ -99,20 +101,20 @@ extern uint8_t excludedEventCodes[NEventCodes / 8 + 1];
  *****************************************************************************/\r
 typedef struct\r
 {\r
-    /* For each object class, the index of the next handle to allocate */\r
-    uint16_t indexOfNextAvailableHandle[ TRACE_NCLASSES ];\r
+       /* For each object class, the index of the next handle to allocate */\r
+       uint16_t indexOfNextAvailableHandle[ TRACE_NCLASSES ];\r
 \r
-    /* The lowest index of this class (constant) */\r
-    uint16_t lowestIndexOfClass[ TRACE_NCLASSES ];\r
+       /* The lowest index of this class (constant) */\r
+       uint16_t lowestIndexOfClass[ TRACE_NCLASSES ];\r
 \r
-    /* The highest index of this class (constant) */\r
-    uint16_t highestIndexOfClass[ TRACE_NCLASSES ];\r
+       /* The highest index of this class (constant) */\r
+       uint16_t highestIndexOfClass[ TRACE_NCLASSES ];\r
 \r
-    /* The highest use count for this class (for statistics) */\r
-    uint16_t handleCountWaterMarksOfClass[ TRACE_NCLASSES ];\r
+       /* The highest use count for this class (for statistics) */\r
+       uint16_t handleCountWaterMarksOfClass[ TRACE_NCLASSES ];\r
 \r
-    /* The free object handles - a set of stacks within this array */\r
-    objectHandleType objectHandles[ TRACE_KERNEL_OBJECT_COUNT ];\r
+       /* The free object handles - a set of stacks within this array */\r
+       objectHandleType objectHandles[ TRACE_KERNEL_OBJECT_COUNT ];\r
 \r
 } objectHandleStackType;\r
 \r
@@ -136,47 +138,47 @@ extern objectHandleStackType objectHandleStacks;
 \r
 typedef struct\r
 {\r
-    /* = NCLASSES */\r
-    uint32_t NumberOfObjectClasses;\r
+       /* = NCLASSES */\r
+       uint32_t NumberOfObjectClasses;\r
 \r
-    uint32_t ObjectPropertyTableSizeInBytes;\r
+       uint32_t ObjectPropertyTableSizeInBytes;\r
 \r
-    /* This is used to calculate the index in the dynamic object table\r
-    (handle - 1 - nofStaticObjects = index)*/\r
+       /* This is used to calculate the index in the dynamic object table\r
+       (handle - 1 - nofStaticObjects = index)*/\r
 #if (USE_16BIT_OBJECT_HANDLES == 1)    \r
-    objectHandleType NumberOfObjectsPerClass[2*((TRACE_NCLASSES+1)/2)];\r
+       objectHandleType NumberOfObjectsPerClass[2*((TRACE_NCLASSES+1)/2)];\r
 #else\r
        objectHandleType NumberOfObjectsPerClass[4*((TRACE_NCLASSES+3)/4)];\r
 #endif\r
 \r
-    /* Allocation size rounded up to the closest multiple of 4 */\r
-    uint8_t NameLengthPerClass[ 4*((TRACE_NCLASSES+3)/4) ];\r
+       /* Allocation size rounded up to the closest multiple of 4 */\r
+       uint8_t NameLengthPerClass[ 4*((TRACE_NCLASSES+3)/4) ];\r
 \r
-    uint8_t TotalPropertyBytesPerClass[ 4*((TRACE_NCLASSES+3)/4) ];\r
+       uint8_t TotalPropertyBytesPerClass[ 4*((TRACE_NCLASSES+3)/4) ];\r
 \r
-    /* Allocation size rounded up to the closest multiple of 2 */\r
-    uint16_t StartIndexOfClass[ 2*((TRACE_NCLASSES+1)/2) ];\r
+       /* Allocation size rounded up to the closest multiple of 2 */\r
+       uint16_t StartIndexOfClass[ 2*((TRACE_NCLASSES+1)/2) ];\r
 \r
-    /* The actual handles issued, should be Initiated to all zeros */\r
-    uint8_t objbytes[ 4*((TRACE_OBJECT_TABLE_SIZE+3)/4) ];\r
+       /* The actual handles issued, should be Initiated to all zeros */\r
+       uint8_t objbytes[ 4*((TRACE_OBJECT_TABLE_SIZE+3)/4) ];\r
 } ObjectPropertyTableType;\r
 \r
 /* Symbol table data structure */\r
 typedef struct\r
 {\r
-    /* = SYMBOL_HISTORY_TABLE_SIZE_IN_BYTES */\r
-    uint32_t symTableSize;\r
+       /* = SYMBOL_HISTORY_TABLE_SIZE_IN_BYTES */\r
+       uint32_t symTableSize;\r
 \r
-    /* Entry 0 is reserved. Any reference to entry 0 implies NULL*/\r
-    uint32_t nextFreeSymbolIndex;\r
+       /* Entry 0 is reserved. Any reference to entry 0 implies NULL*/\r
+       uint32_t nextFreeSymbolIndex;\r
 \r
-    /* Size rounded up to closest multiple of 4, to avoid alignment issues*/\r
-    uint8_t symbytes[4*((SYMBOL_TABLE_SIZE+3)/4)];\r
+       /* Size rounded up to closest multiple of 4, to avoid alignment issues*/\r
+       uint8_t symbytes[4*((SYMBOL_TABLE_SIZE+3)/4)];\r
 \r
-    /* Used for lookups - Up to 64 linked lists within the symbol table\r
-    connecting all entries with the same 6 bit checksum.\r
-    This field holds the current list heads. Should be initiated to zeros */\r
-    uint16_t latestEntryOfChecksum[64];\r
+       /* Used for lookups - Up to 64 linked lists within the symbol table\r
+       connecting all entries with the same 6 bit checksum.\r
+       This field holds the current list heads. Should be initiated to zeros */\r
+       uint16_t latestEntryOfChecksum[64];\r
 } symbolTableType;\r
 \r
 \r
@@ -186,72 +188,80 @@ typedef struct
 \r
 typedef struct\r
 {\r
-    uint8_t type;\r
-    uint8_t objHandle;\r
-    uint16_t dts;    /* differential timestamp - time since last event */\r
+       uint8_t type;\r
+       uint8_t objHandle;\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
+       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;    /* differential timestamp - time since last event */\r
+       uint8_t type;\r
+       uint8_t objHandle;\r
+       uint16_t dts;   /* differential timestamp - time since last event */\r
 } KernelCall;\r
 \r
 typedef struct\r
 {\r
-    uint8_t type;\r
-    uint8_t objHandle;\r
-    uint8_t param;\r
-    uint8_t dts;    /* differential timestamp - time since last event */\r
+       uint8_t type;\r
+       uint8_t objHandle;\r
+       uint8_t param;\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;    /* differential timestamp - time since last event */\r
-    uint16_t param;\r
+       uint8_t type;\r
+       uint8_t dts;    /* differential timestamp - time since last event */\r
+       uint16_t param;\r
 } KernelCallWithParam16;\r
 \r
 typedef struct\r
 {\r
-    uint8_t type;\r
-    uint8_t objHandle;    /* the handle of the closed object */\r
-    uint16_t symbolIndex;          /* the name of the closed object */\r
+       uint8_t type;\r
+       uint8_t objHandle;      /* the handle of the closed object */\r
+       uint16_t symbolIndex;            /* the name of the closed object */\r
 } ObjCloseNameEvent;\r
 \r
 typedef struct\r
 {\r
-    uint8_t type;\r
-    uint8_t arg1;\r
-    uint8_t arg2;\r
-    uint8_t arg3;\r
+       uint8_t type;\r
+       uint8_t arg1;\r
+       uint8_t arg2;\r
+       uint8_t arg3;\r
 } ObjClosePropEvent;\r
 \r
 typedef struct\r
 {\r
-    uint8_t type;\r
-    uint8_t dts;\r
-    uint16_t payload;         /* the name of the user event */\r
+       uint8_t type;\r
+       uint8_t unused1;\r
+       uint8_t unused2;\r
+       uint8_t dts;    \r
+} TaskInstanceStatusEvent;\r
+\r
+typedef struct\r
+{\r
+       uint8_t type;\r
+       uint8_t dts;\r
+       uint16_t payload;                /* the name of the user event */\r
 } UserEvent;\r
 \r
 typedef struct\r
 {\r
-    uint8_t type;\r
+       uint8_t type;\r
 \r
-    /* 8 bits extra for storing DTS, if it does not fit in ordinary event\r
-    (this one is always MSB if used) */\r
-    uint8_t xts_8;\r
+       /* 8 bits extra for storing DTS, if it does not fit in ordinary event\r
+       (this one is always MSB if used) */\r
+       uint8_t xts_8;\r
 \r
-    /* 16 bits extra for storing DTS, if it does not fit in ordinary event. */\r
-    uint16_t xts_16;\r
+       /* 16 bits extra for storing DTS, if it does not fit in ordinary event. */\r
+       uint16_t xts_16;\r
 } XTSEvent;\r
 \r
 typedef struct\r
@@ -309,110 +319,108 @@ typedef struct
 \r
 typedef struct\r
 {\r
-    uint8_t startmarker0;\r
-    uint8_t startmarker1;\r
-    uint8_t startmarker2;\r
-    uint8_t startmarker3;\r
-    uint8_t startmarker4;\r
-    uint8_t startmarker5;\r
-    uint8_t startmarker6;\r
-    uint8_t startmarker7;\r
-    uint8_t startmarker8;\r
-    uint8_t startmarker9;\r
-    uint8_t startmarker10;\r
-    uint8_t startmarker11;\r
-\r
-    /* Used to determine Kernel and Endianess */\r
-    uint16_t version;\r
-\r
-    /* Currently 3, since v2.6.0 */\r
-    uint8_t minor_version;\r
+       uint8_t startmarker0;\r
+       uint8_t startmarker1;\r
+       uint8_t startmarker2;\r
+       uint8_t startmarker3;\r
+       uint8_t startmarker4;\r
+       uint8_t startmarker5;\r
+       uint8_t startmarker6;\r
+       uint8_t startmarker7;\r
+       uint8_t startmarker8;\r
+       uint8_t startmarker9;\r
+       uint8_t startmarker10;\r
+       uint8_t startmarker11;\r
+\r
+       /* Used to determine Kernel and Endianess */\r
+       uint16_t version;\r
 \r
-    /* This should be 0 if lower IRQ priority values implies higher priority\r
-    levels, such as on ARM Cortex M. If the opposite scheme is used, i.e.,\r
-    if higher IRQ priority values means higher priority, this should be 1. */\r
-    uint8_t irq_priority_order;\r
+       /* Currently 3, since v2.6.0 */\r
+       uint8_t minor_version;\r
 \r
-    /* sizeof(RecorderDataType) - just for control */\r
-    uint32_t filesize;\r
+       /* This should be 0 if lower IRQ priority values implies higher priority\r
+       levels, such as on ARM Cortex M. If the opposite scheme is used, i.e.,\r
+       if higher IRQ priority values means higher priority, this should be 1. */\r
+       uint8_t irq_priority_order;\r
 \r
-    /* Current number of events recorded */\r
-    uint32_t numEvents;\r
+       /* sizeof(RecorderDataType) - just for control */\r
+       uint32_t filesize;\r
 \r
-    /* The buffer size, in number of event records */\r
-    uint32_t maxEvents;\r
+       /* Current number of events recorded */\r
+       uint32_t numEvents;\r
 \r
-    /* The event buffer index, where to write the next event */\r
-    uint32_t nextFreeIndex;\r
+       /* The buffer size, in number of event records */\r
+       uint32_t maxEvents;\r
 \r
-    /* 1 if the buffer is full, 0 otherwise */\r
-    uint32_t bufferIsFull;\r
+       /* The event buffer index, where to write the next event */\r
+       uint32_t nextFreeIndex;\r
 \r
-    /* The frequency of the clock/timer/counter used as time base */\r
-    uint32_t frequency;\r
+       /* 1 if the buffer is full, 0 otherwise */\r
+       uint32_t bufferIsFull;\r
 \r
-    /* The absolute timestamp of the last stored event, in the native\r
-    timebase, modulo frequency! */\r
-    uint32_t absTimeLastEvent;\r
+       /* The frequency of the clock/timer/counter used as time base */\r
+       uint32_t frequency;\r
 \r
-    /* The number of seconds in total - lasts for 136 years */\r
-    uint32_t absTimeLastEventSecond;\r
+       /* The absolute timestamp of the last stored event, in the native\r
+       timebase, modulo frequency! */\r
+       uint32_t absTimeLastEvent;\r
 \r
-    /* 1 if the recorder has been started, 0 if not yet started or stopped.\r
-    This is a 32 bit variable due to alignment issues. */\r
-    uint32_t recorderActive;\r
+       /* The number of seconds in total - lasts for 136 years */\r
+       uint32_t absTimeLastEventSecond;\r
 \r
-    /* Not used, remains for compatibility and future use */\r
-    uint8_t notused[28];\r
+       /* 1 if the recorder has been started, 0 if not yet started or stopped.\r
+       This is a 32 bit variable due to alignment issues. */\r
+       uint32_t recorderActive;\r
 \r
-       /* The amount of heap memory remaining at the last malloc or free event */ \r
+       /* Not used, remains for compatibility and future use */\r
+       uint8_t notused[28];\r
+       \r
+       /* The amount of heap memory remaining at the last malloc or free event */\r
        uint32_t heapMemUsage;\r
 \r
-    /* 0xF0F0F0F0 - for control only */\r
-    int32_t debugMarker0;\r
+       /* 0xF0F0F0F0 - for control only */\r
+       int32_t debugMarker0;\r
 \r
        /* Set to value of USE_16BIT_OBJECT_HANDLES */\r
        uint32_t isUsing16bitHandles;\r
 \r
-    /* The Object Property Table holds information about currently active\r
-    tasks, queues, and other recorded objects. This is updated on each\r
-    create call and includes object name and other properties. */\r
-    ObjectPropertyTableType ObjectPropertyTable;\r
+       /* The Object Property Table holds information about currently active\r
+       tasks, queues, and other recorded objects. This is updated on each\r
+       create call and includes object name and other properties. */\r
+       ObjectPropertyTableType ObjectPropertyTable;\r
 \r
-    /* 0xF1F1F1F1 - for control only */\r
-    int32_t debugMarker1;\r
+       /* 0xF1F1F1F1 - for control only */\r
+       int32_t debugMarker1;\r
 \r
-    /* The Symbol Table stores strings for User Events and is also used to\r
-    store names of deleted objects, which still may be in the trace but no\r
-    longer are available. */\r
-    symbolTableType SymbolTable;\r
+       /* The Symbol Table stores strings for User Events and is also used to\r
+       store names of deleted objects, which still may be in the trace but no\r
+       longer are available. */\r
+       symbolTableType SymbolTable;\r
 \r
-    /* For inclusion of float support, and for endian detection of floats.\r
-    The value should be (float)1 or (uint32_t)0 */\r
+       /* For inclusion of float support, and for endian detection of floats.\r
+       The value should be (float)1 or (uint32_t)0 */\r
 #if (INCLUDE_FLOAT_SUPPORT == 1)\r
-    float exampleFloatEncoding;\r
+       float exampleFloatEncoding;\r
 #else\r
-    uint32_t exampleFloatEncoding;\r
+       uint32_t exampleFloatEncoding;\r
 #endif\r
-    /* This is non-zero if an internal error occurred in the recorder, e.g., if\r
-    one of the Nxxx constants was too small. The systemInfo string will then\r
-    contain an error message that is displayed when attempting to view the\r
-    trace file. */\r
-    uint32_t internalErrorOccured;\r
+       /* This is non-zero if an internal error occurred in the recorder, e.g., if\r
+       one of the Nxxx constants was too small. The systemInfo string will then\r
+       contain an error message that is displayed when attempting to view the\r
+       trace file. */\r
+       uint32_t internalErrorOccured;\r
 \r
-    /* 0xF2F2F2F2 - for control only */\r
-    int32_t debugMarker2;\r
+       /* 0xF2F2F2F2 - for control only */\r
+       int32_t debugMarker2;\r
 \r
-    /* Generic system information string, presented in the tool. Note that this\r
-    is also used for storing any internal error messages from the recorder, so\r
-    do not make TRACE_DESCRIPTION_MAX_LENGTH too small. 80 is recommended. */\r
-    char systemInfo[TRACE_DESCRIPTION_MAX_LENGTH];\r
+       /* Error messages from the recorder. */\r
+       char systemInfo[80];\r
 \r
-    /* 0xF3F3F3F3 - for control only */\r
-    int32_t debugMarker3;\r
+       /* 0xF3F3F3F3 - for control only */\r
+       int32_t debugMarker3;\r
 \r
-    /* The event data, in 4-byte records */\r
-    uint8_t eventData[ EVENT_BUFFER_SIZE * 4 ];\r
+       /* The event data, in 4-byte records */\r
+       uint8_t eventData[ EVENT_BUFFER_SIZE * 4 ];\r
 \r
 #if (USE_SEPARATE_USER_EVENT_BUFFER == 1)\r
        UserEventBuffer userEventBuffer;\r
@@ -421,18 +429,18 @@ typedef struct
        /* This should always be 0 */\r
        uint32_t endOfSecondaryBlocks;\r
 \r
-    uint8_t endmarker0;\r
-    uint8_t endmarker1;\r
-    uint8_t endmarker2;\r
-    uint8_t endmarker3;\r
-    uint8_t endmarker4;\r
-    uint8_t endmarker5;\r
-    uint8_t endmarker6;\r
-    uint8_t endmarker7;\r
-    uint8_t endmarker8;\r
-    uint8_t endmarker9;\r
-    uint8_t endmarker10;\r
-    uint8_t endmarker11;\r
+       uint8_t endmarker0;\r
+       uint8_t endmarker1;\r
+       uint8_t endmarker2;\r
+       uint8_t endmarker3;\r
+       uint8_t endmarker4;\r
+       uint8_t endmarker5;\r
+       uint8_t endmarker6;\r
+       uint8_t endmarker7;\r
+       uint8_t endmarker8;\r
+       uint8_t endmarker9;\r
+       uint8_t endmarker10;\r
+       uint8_t endmarker11;\r
 } RecorderDataType;\r
 \r
 extern RecorderDataType* RecorderDataPtr;\r
@@ -444,14 +452,14 @@ uint16_t prvTraceGetDTS(uint16_t param_maxDTS);
 void prvTraceGetChecksum(const char *pname, uint8_t* pcrc, uint8_t* plength);\r
 \r
 traceLabel prvTraceCreateSymbolTableEntry(const char* name,\r
-                                          uint8_t crc6,\r
-                                          uint8_t len,\r
-                                          traceLabel channel);\r
+                                                                                uint8_t crc6,\r
+                                                                                uint8_t len,\r
+                                                                                traceLabel channel);\r
 \r
 traceLabel prvTraceLookupSymbolTableEntry(const char* name,\r
-                                          uint8_t crc6,\r
-                                          uint8_t len,\r
-                                          traceLabel channel);\r
+                                                                                uint8_t crc6,\r
+                                                                                uint8_t len,\r
+                                                                                traceLabel channel);\r
 \r
 traceLabel prvTraceOpenSymbol(const char* name, traceLabel userEventChannel);\r
 \r
@@ -462,11 +470,11 @@ void prvCheckDataToBeOverwrittenForMultiEntryEvents(uint8_t nEntries);
 objectHandleType xTraceGetObjectHandle(traceObjectClass objectclass);\r
 \r
 void vTraceFreeObjectHandle(traceObjectClass objectclass,\r
-                            objectHandleType handle);\r
+                                                       objectHandleType handle);\r
 \r
 void vTraceSetObjectName(traceObjectClass objectclass,\r
-                           objectHandleType handle,\r
-                           const char* name);\r
+                                                       objectHandleType handle,\r
+                                                       const char* name);\r
 \r
 void* xTraceNextFreeEventBufferSlot(void);\r
 \r
@@ -478,7 +486,7 @@ unsigned char prvTraceGet8BitHandle(objectHandleType handle);
 \r
 \r
 uint16_t uiIndexOfObject(objectHandleType objecthandle,\r
-                         uint8_t objectclass);\r
+                                                uint8_t objectclass);\r
 \r
 /*******************************************************************************\r
  * vTraceError\r
@@ -519,9 +527,6 @@ RecorderDataPtr->ObjectPropertyTable.objbytes[uiIndexOfObject(handle, objectclas
 #define TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(eventCode) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedEventCodes, eventCode)\r
 #define TRACE_GET_EVENT_CODE_FLAG_ISEXCLUDED(eventCode) TRACE_GET_FLAG_ISEXCLUDED(excludedEventCodes, eventCode)\r
 \r
-#define TRACE_INCR_HEAP_USAGE(change) {if (RecorderDataPtr != NULL) RecorderDataPtr->heapMemUsage += change;}\r
-#define TRACE_DECR_HEAP_USAGE(change) {if (RecorderDataPtr != NULL) RecorderDataPtr->heapMemUsage -= change;}\r
-\r
 /* DEBUG ASSERTS */\r
 #if defined USE_TRACE_ASSERT && USE_TRACE_ASSERT != 0\r
 #define TRACE_ASSERT(eval, msg, defRetVal) \\r
@@ -536,4 +541,8 @@ if (!(eval)) \
 \r
 #endif\r
 \r
-#endif
\ No newline at end of file
+#endif\r
+\r
+\r
+\r
+\r
index c66654e6796215f10b30cb8d7a29f1300fc68eb4..01ce3a590ecccf9fcf341c14b5bf5ceb9ed88ae7 100644 (file)
@@ -1,10 +1,10 @@
-/******************************************************************************* \r
- * Tracealyzer v2.6.0 Recorder Library\r
+/*******************************************************************************\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcHardwarePort.h\r
  *\r
- * Contains together with trcHardwarePort.c all hardware portability issues of \r
+ * Contains together with trcHardwarePort.c all hardware portability issues of\r
  * the trace recorder library.\r
  *\r
  * Terms of Use\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
+ * 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
- * Copyright Percepio AB, 2013.\r
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2014.\r
  * www.percepio.com\r
  ******************************************************************************/\r
 \r
 /* If Win32 port */\r
 #ifdef WIN32\r
 \r
-   #undef _WIN32_WINNT\r
-   #define _WIN32_WINNT 0x0600\r
+       #undef _WIN32_WINNT\r
+       #define _WIN32_WINNT 0x0600\r
 \r
-   /* Standard includes. */\r
-   #include <stdio.h>\r
-   #include <windows.h>\r
-   #include <direct.h>\r
+       /* Standard includes. */\r
+       #include <stdio.h>\r
+       #include <windows.h>\r
+       #include <direct.h>\r
 \r
 /*******************************************************************************\r
  * The Win32 port by default saves the trace to file and then kills the\r
  * program when the recorder is stopped, to facilitate quick, simple tests\r
  * of the recorder.\r
  ******************************************************************************/\r
-   #define WIN32_PORT_SAVE_WHEN_STOPPED 1\r
-   #define WIN32_PORT_EXIT_WHEN_STOPPED 1\r
+       #define WIN32_PORT_SAVE_WHEN_STOPPED 1\r
+       #define WIN32_PORT_EXIT_WHEN_STOPPED 1\r
 \r
 #endif\r
 \r
 \r
 /******************************************************************************\r
  * Supported ports\r
- * \r
+ *\r
  * PORT_HWIndependent\r
- * A hardware independent fallback option for event timestamping. Provides low \r
+ * A hardware independent fallback option for event timestamping. Provides low\r
  * resolution timestamps based on the OS tick.\r
- * This may be used on the Win32 port, but may also be used on embedded hardware \r
- * platforms. All time durations will be truncated to the OS tick frequency, \r
- * typically 1 KHz. This means that a task or ISR that executes in less than \r
+ * This may be used on the Win32 port, but may also be used on embedded hardware\r
+ * platforms. All time durations will be truncated to the OS tick frequency,\r
+ * typically 1 KHz. This means that a task or ISR that executes in less than\r
  * 1 ms get an execution time of zero.\r
  *\r
  * PORT_APPLICATION_DEFINED\r
  * Allows for defining the port macros in other source code files.\r
  *\r
  * PORT_Win32\r
- * "Accurate" timestamping based on the Windows performance counter for Win32 \r
+ * "Accurate" timestamping based on the Windows performance counter for Win32\r
  * builds. Note that this gives the host machine time, not the kernel time.\r
  *\r
  * Hardware specific ports\r
- * To get accurate timestamping, a hardware timer is necessary. Below are the \r
- * available ports. Some of these are "unofficial", meaning that \r
- * they have not yet been verified by Percepio but have been contributed by \r
- * external developers. They should work, otherwise let us know by emailing \r
- * support@percepio.com. Some work on any OS platform, while other are specific \r
+ * To get accurate timestamping, a hardware timer is necessary. Below are the\r
+ * available ports. Some of these are "unofficial", meaning that\r
+ * they have not yet been verified by Percepio but have been contributed by\r
+ * external developers. They should work, otherwise let us know by emailing\r
+ * support@percepio.com. Some work on any OS platform, while other are specific\r
  * to a certain operating system.\r
  *****************************************************************************/\r
 \r
-/****** Port Name ******************** Code ** Official ** OS Platform *******/\r
-#define PORT_APPLICATION_DEFINED       -2   /* -           -                 */\r
-#define PORT_NOT_SET                   -1   /* -           -                 */\r
-#define PORT_HWIndependent             0    /* Yes         Any               */\r
-#define PORT_Win32                     1    /* Yes         Windows (FreeRTOS)*/\r
-#define PORT_Atmel_AT91SAM7            2    /* No          Any               */\r
-#define PORT_Atmel_UC3A0               3    /* No          Any               */\r
-#define PORT_ARM_CortexM               4    /* Yes         Any               */\r
-#define PORT_Renesas_RX600             5    /* Yes         Any               */\r
-#define PORT_Microchip_dsPIC_AND_PIC24 6    /* Yes         Any               */\r
-#define PORT_TEXAS_INSTRUMENTS_TMS570  7    /* No          Any               */\r
-#define PORT_TEXAS_INSTRUMENTS_MSP430  8    /* No          Any               */\r
-#define PORT_MICROCHIP_PIC32           9    /* No          Any               */\r
-#define PORT_XILINX_PPC405             10   /* No          FreeRTOS          */\r
-#define PORT_XILINX_PPC440             11   /* No          FreeRTOS          */\r
-#define PORT_XILINX_MICROBLAZE         12   /* No          Any               */\r
-#define PORT_NXP_LPC210X               13   /* No          Any               */\r
-\r
-#include "trcConfig.h" // Where SELECTED_PORT is defined\r
+/****** Port Name ********************** Code ***** Official ** OS Platform *********/\r
+#define PORT_APPLICATION_DEFINED                       -2      /*      -                       -                                       */\r
+#define PORT_NOT_SET                                           -1      /*      -                       -                                       */\r
+#define PORT_HWIndependent                                     0       /*      Yes                     Any                                     */\r
+#define PORT_Win32                                                     1       /*      Yes                     FreeRTOS on Win32       */\r
+#define PORT_Atmel_AT91SAM7                                    2       /*      No                      Any                                     */\r
+#define PORT_Atmel_UC3A0                                       3       /*      No                      Any                                     */\r
+#define PORT_ARM_CortexM                                       4       /*      Yes                     Any                                     */\r
+#define PORT_Renesas_RX600                                     5       /*      Yes                     Any                                     */\r
+#define PORT_Microchip_dsPIC_AND_PIC24         6       /*      Yes                     Any                                     */\r
+#define PORT_TEXAS_INSTRUMENTS_TMS570          7       /*      No                      Any                                     */\r
+#define PORT_TEXAS_INSTRUMENTS_MSP430          8       /*      No                      Any                                     */\r
+#define PORT_MICROCHIP_PIC32MX                         9       /*      Yes                     Any                                     */\r
+#define PORT_XILINX_PPC405                                     10      /*      No                      FreeRTOS                        */\r
+#define PORT_XILINX_PPC440                                     11      /*      No                      FreeRTOS                        */\r
+#define PORT_XILINX_MICROBLAZE                         12      /*      No                      Any                                     */\r
+#define PORT_NXP_LPC210X                                       13      /*      No                      Any                                     */\r
+#define PORT_MICROCHIP_PIC32MZ                         14      /*      Yes                     Any                                     */\r
+#define PORT_ARM_CORTEX_A9                                     15      /*      No                      Any                                     */\r
+\r
+#include "trcConfig.h"\r
 \r
 /*******************************************************************************\r
  * IRQ_PRIORITY_ORDER\r
  *\r
  * Macro which should be defined as an integer of 0 or 1.\r
  *\r
- * This should be 0 if lower IRQ priority values implies higher priority \r
- * levels, such as on ARM Cortex M. If the opposite scheme is used, i.e., \r
+ * This should be 0 if lower IRQ priority values implies higher priority\r
+ * levels, such as on ARM Cortex M. If the opposite scheme is used, i.e.,\r
  * if higher IRQ priority values means higher priority, this should be 1.\r
  *\r
- * This setting is not critical. It is used only to sort and colorize the \r
+ * This setting is not critical. It is used only to sort and colorize the\r
  * interrupts in priority order, in case you record interrupts using\r
  * the vTraceStoreISRBegin and vTraceStoreISREnd routines.\r
  *\r
  ******************************************************************************\r
  *\r
- * HWTC Macros \r
+ * HWTC Macros\r
  *\r
- * These four HWTC macros provides a hardware isolation layer representing a \r
- * generic hardware timer/counter used for driving the operating system tick, \r
- * such as the SysTick feature of ARM Cortex M3/M4, or the PIT of the Atmel \r
+ * These four HWTC macros provides a hardware isolation layer representing a\r
+ * generic hardware timer/counter used for driving the operating system tick,\r
+ * such as the SysTick feature of ARM Cortex M3/M4, or the PIT of the Atmel\r
  * AT91SAM7X.\r
  *\r
- * HWTC_COUNT: The current value of the counter. This is expected to be reset \r
- * a each tick interrupt. Thus, when the tick handler starts, the counter has \r
+ * HWTC_COUNT: The current value of the counter. This is expected to be reset\r
+ * a each tick interrupt. Thus, when the tick handler starts, the counter has\r
  * already wrapped.\r
  *\r
  * HWTC_COUNT_DIRECTION: Should be one of:\r
  * - DIRECTION_INCREMENTING - for hardware timer/counters of incrementing type\r
- *   such as the PIT on Atmel AT91SAM7X.\r
- *   When the counter value reach HWTC_PERIOD, it is reset to zero and the\r
- *   interrupt is signaled.\r
+ *     such as the PIT on Atmel AT91SAM7X.\r
+ *     When the counter value reach HWTC_PERIOD, it is reset to zero and the\r
+ *     interrupt is signaled.\r
  * - DIRECTION_DECREMENTING - for hardware timer/counters of decrementing type\r
- *   such as the SysTick on ARM Cortex M3/M4 chips.\r
- *   When the counter value reach 0, it is reset to HWTC_PERIOD and the\r
- *   interrupt is signaled.\r
+ *     such as the SysTick on ARM Cortex M3/M4 chips.\r
+ *     When the counter value reach 0, it is reset to HWTC_PERIOD and the\r
+ *     interrupt is signaled.\r
  *\r
  * HWTC_PERIOD: The number of increments or decrements of HWTC_COUNT between\r
  * two OS tick interrupts. This should preferably be mapped to the reload\r
- * register of the hardware timer, to make it more portable between chips in the \r
+ * register of the hardware timer, to make it more portable between chips in the\r
  * same family. The macro should in most cases be (reload register + 1).\r
- * For FreeRTOS, this can in most cases be defined as \r
+ * For FreeRTOS, this can in most cases be defined as\r
  * #define HWTC_PERIOD (configCPU_CLOCK_HZ / configTICK_RATE_HZ)\r
  *\r
  * HWTC_DIVISOR: If the timer frequency is very high, like on the Cortex M chips\r
- * (where the SysTick runs at the core clock frequency), the "differential \r
- * timestamping" used in the recorder will more frequently insert extra XTS \r
- * events to store the timestamps, which increases the event buffer usage. \r
- * In such cases, to reduce the number of XTS events and thereby get longer \r
+ * (where the SysTick runs at the core clock frequency), the "differential\r
+ * timestamping" used in the recorder will more frequently insert extra XTS\r
+ * events to store the timestamps, which increases the event buffer usage.\r
+ * In such cases, to reduce the number of XTS events and thereby get longer\r
  * traces, you use HWTC_DIVISOR to scale down the timestamps and frequency.\r
  * Assuming a OS tick rate of 1 KHz, it is suggested to keep the effective timer\r
  * frequency below 65 MHz to avoid an excessive amount of XTS events. Thus, a\r
- * Cortex M chip running at 72 MHZ should use a HWTC_DIVISOR of 2, while a \r
- * faster chip require a higher HWTC_DIVISOR value. \r
+ * Cortex M chip running at 72 MHZ should use a HWTC_DIVISOR of 2, while a\r
+ * faster chip require a higher HWTC_DIVISOR value.\r
  *\r
  * The HWTC macros and vTracePortGetTimeStamp is the main porting issue\r
  * or the trace recorder library. Typically you should not need to change\r
  ******************************************************************************/\r
 \r
 #if (SELECTED_PORT == PORT_Win32)\r
-    // This can be used as a template for any free-running 32-bit counter\r
-    #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
-    #define HWTC_COUNT (ulGetRunTimeCounterValue())\r
-    #define HWTC_PERIOD 0\r
-    #define HWTC_DIVISOR 1\r
+       // This can be used as a template for any free-running 32-bit counter\r
+       #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
+       #define HWTC_COUNT (ulGetRunTimeCounterValue())\r
+       #define HWTC_PERIOD 0\r
+       #define HWTC_DIVISOR 1\r
 \r
-    // Please update according to your system...\r
-    #define IRQ_PRIORITY_ORDER 1  \r
-    \r
-#elif (SELECTED_PORT == PORT_HWIndependent) \r
-       // OS Tick only (typically 1 ms resolution)    \r
-    #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
-    #define HWTC_COUNT 0\r
-    #define HWTC_PERIOD 1\r
-    #define HWTC_DIVISOR 1\r
-    \r
        // Please update according to your system...\r
-    #define IRQ_PRIORITY_ORDER NOT_SET  \r
+       #define IRQ_PRIORITY_ORDER 1\r
+\r
+#elif (SELECTED_PORT == PORT_HWIndependent)\r
+       // OS Tick only (typically 1 ms resolution)\r
+       #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
+       #define HWTC_COUNT 0\r
+       #define HWTC_PERIOD 1\r
+       #define HWTC_DIVISOR 1\r
+\r
+       // Please update according to your system...\r
+       #define IRQ_PRIORITY_ORDER NOT_SET\r
 \r
 \r
 #elif (SELECTED_PORT == PORT_ARM_CortexM)\r
 \r
-       void prvTraceSetIRQMask(uint32_t priMask);\r
-       uint32_t prvTraceGetIRQMask(void);\r
-       \r
-       void prvTraceEnableIRQ(void);\r
-       void prvTraceDisableIRQ(void);\r
-           \r
        void prvTraceInitCortexM(void);\r
-               \r
-       #define PORT_SPECIFIC_INIT() prvTraceInitCortexM()      \r
-               \r
-       extern uint32_t DWT_CYCLES_ADDED;               \r
-       #define DWT_CTRL_REG (*((uint32_t*)0xE0001000))\r
-       #define DWT_CYCLE_COUNTER (*((uint32_t*)0xE0001004))\r
        \r
-    #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
-    #define HWTC_COUNT (DWT_CYCLE_COUNTER + DWT_CYCLES_ADDED)\r
-    #define HWTC_PERIOD 0\r
-    #define HWTC_DIVISOR 4\r
+       #define REG_DEMCR (*(volatile unsigned int*)0xE000EDFC)\r
+       #define REG_DWT_CTRL (*(volatile unsigned int*)0xE0001000)\r
+       #define REG_DWT_CYCCNT (*(volatile unsigned int*)0xE0001004)\r
+       #define REG_DWT_EXCCNT (*(volatile unsigned int*)0xE000100C)\r
+       \r
+       /* Bit mask for TRCENA bit in DEMCR - Global enable for DWT and ITM */\r
+       #define DEMCR_TRCENA (1 << 24)\r
 \r
-    #define IRQ_PRIORITY_ORDER 0  // lower IRQ priority values are more significant\r
+       /* Bit mask for NOPRFCNT bit in DWT_CTRL. If 1, DWT_EXCCNT is not supported */\r
+       #define DWT_CTRL_NOPRFCNT (1 << 24)\r
 \r
-#elif (SELECTED_PORT == PORT_Renesas_RX600)    \r
+       /* Bit mask for NOCYCCNT bit in DWT_CTRL. If 1, DWT_CYCCNT is not supported */\r
+       #define DWT_CTRL_NOCYCCNT (1 << 25)\r
 \r
-    #include "iodefine.h"\r
+       /* Bit mask for EXCEVTENA_ bit in DWT_CTRL. Set to 1 to enable DWT_EXCCNT */\r
+       #define DWT_CTRL_EXCEVTENA (1 << 18)\r
 \r
-    #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
-    #define HWTC_COUNT (CMT0.CMCNT)\r
-    #define HWTC_PERIOD (CMT0.CMCOR + 1)\r
-    #define HWTC_DIVISOR 1\r
-    #define IRQ_PRIORITY_ORDER 1  // higher IRQ priority values are more significant\r
+       /* Bit mask for EXCEVTENA_ bit in DWT_CTRL. Set to 1 to enable DWT_CYCCNT */\r
+       #define DWT_CTRL_CYCCNTENA (1)\r
+\r
+       #define PORT_SPECIFIC_INIT() prvTraceInitCortexM()\r
+\r
+       extern uint32_t DWT_CYCLES_ADDED;\r
+       \r
+       #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
+       #define HWTC_COUNT (REG_DWT_CYCCNT + DWT_CYCLES_ADDED)\r
+       #define HWTC_PERIOD 0\r
+       #define HWTC_DIVISOR 4\r
+\r
+       #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
+\r
+#elif (SELECTED_PORT == PORT_Renesas_RX600)\r
+\r
+       #include "iodefine.h"\r
+\r
+       #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
+       #define HWTC_COUNT (CMT0.CMCNT)\r
+       #define HWTC_PERIOD (CMT0.CMCOR + 1)\r
+       #define HWTC_DIVISOR 1\r
+       #define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant\r
+\r
+#elif (SELECTED_PORT == PORT_MICROCHIP_PIC32MX || PORT_MICROCHIP_PIC32MZ)\r
+       \r
+       #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
+       #define HWTC_COUNT (TMR1)\r
+       #define HWTC_PERIOD (PR1 + 1)\r
+       #define HWTC_DIVISOR 1\r
+       #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
 \r
 #elif (SELECTED_PORT == PORT_Microchip_dsPIC_AND_PIC24)\r
 \r
-    /* For Microchip PIC24 and dsPIC (16 bit) */\r
+       /* For Microchip PIC24 and dsPIC (16 bit) */\r
 \r
-    /* Note: The trace library is designed for 32-bit MCUs and is slower than \r
-       intended on 16-bit MCUs. Storing an event on a PIC24 takes about 70 usec. \r
-       In comparison, 32-bit MCUs are often 10-20 times faster. If recording overhead \r
-       becomes a problem on PIC24, use the filters to exclude less interesting tasks \r
-       or system calls. */\r
+       /* Note: The trace library is designed for 32-bit MCUs and is slower than\r
+               intended on 16-bit MCUs. Storing an event on a PIC24 takes about 70 usec.\r
+               In comparison, this is 10-20 times faster on a 32-bit MCU... */\r
 \r
-    #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
-    #define HWTC_COUNT (TMR1)\r
-    #define HWTC_PERIOD (PR1+1)\r
-    #define HWTC_DIVISOR 1\r
-    #define IRQ_PRIORITY_ORDER 0  // lower IRQ priority values are more significant\r
+       #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
+       #define HWTC_COUNT (TMR1)\r
+       #define HWTC_PERIOD (PR1+1)\r
+       #define HWTC_DIVISOR 1\r
+       #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
 \r
 #elif (SELECTED_PORT == PORT_Atmel_AT91SAM7)\r
 \r
-    /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
-       \r
-    #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
-    #define HWTC_COUNT ((uint32_t)(AT91C_BASE_PITC->PITC_PIIR & 0xFFFFF))\r
-    #define HWTC_PERIOD ((uint32_t)(AT91C_BASE_PITC->PITC_PIMR + 1))\r
-    #define HWTC_DIVISOR 1\r
-    #define IRQ_PRIORITY_ORDER 1  // higher IRQ priority values are more significant\r
+       /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
+\r
+       #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
+       #define HWTC_COUNT ((uint32_t)(AT91C_BASE_PITC->PITC_PIIR & 0xFFFFF))\r
+       #define HWTC_PERIOD ((uint32_t)(AT91C_BASE_PITC->PITC_PIMR + 1))\r
+       #define HWTC_DIVISOR 1\r
+       #define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant\r
 \r
 #elif (SELECTED_PORT == PORT_Atmel_UC3A0)\r
 \r
-    /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
-    /* For Atmel AVR32 (AT32UC3A).*/\r
-       \r
-    #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
-    #define HWTC_COUNT ((uint32_t)sysreg_read(AVR32_COUNT))\r
-    #define HWTC_PERIOD ((uint32_t)(sysreg_read(AVR32_COMPARE) + 1))\r
-    #define HWTC_DIVISOR 1\r
-    #define IRQ_PRIORITY_ORDER 1  // higher IRQ priority values are more significant\r
+       /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
+       /* For Atmel AVR32 (AT32UC3A).*/\r
+\r
+       #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
+       #define HWTC_COUNT ((uint32_t)sysreg_read(AVR32_COUNT))\r
+       #define HWTC_PERIOD ((uint32_t)(sysreg_read(AVR32_COMPARE) + 1))\r
+       #define HWTC_DIVISOR 1\r
+       #define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant\r
 \r
 #elif (SELECTED_PORT == PORT_NXP_LPC210X)\r
 \r
-    /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */   \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 *((uint32_t *)0xE0004018 )\r
-    #define HWTC_DIVISOR 1    \r
-    #define IRQ_PRIORITY_ORDER 0  // lower IRQ priority values are more significant\r
+       /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
+       /* Tested with LPC2106, but should work with most LPC21XX chips. */\r
 \r
-#elif (SELECTED_PORT == PORT_TEXAS_INSTRUMENTS_TMS570)\r
\r
-    /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
-\r
-    #define RTIFRC0 *((uint32_t *)0xFFFFFC10)\r
-    #define RTICOMP0 *((uint32_t *)0xFFFFFC50)\r
-    #define RTIUDCP0 *((uint32_t *)0xFFFFFC54)\r
-    #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
-    #define HWTC_COUNT (RTIFRC0 - (RTICOMP0 - RTIUDCP0))\r
-    #define HWTC_PERIOD (RTIUDCP0)\r
-    #define HWTC_DIVISOR 1\r
+       #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
+       #define HWTC_COUNT *((uint32_t *)0xE0004008 )\r
+       #define HWTC_PERIOD *((uint32_t *)0xE0004018 )\r
+       #define HWTC_DIVISOR 1\r
+       #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
 \r
-    #define IRQ_PRIORITY_ORDER 0  // lower IRQ priority values are more significant\r
+#elif (SELECTED_PORT == PORT_TEXAS_INSTRUMENTS_TMS570)\r
 \r
-#elif (SELECTED_PORT == PORT_TEXAS_INSTRUMENTS_MSP430)\r
+       /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
 \r
-    /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
+       #define RTIFRC0 *((uint32_t *)0xFFFFFC10)\r
+       #define RTICOMP0 *((uint32_t *)0xFFFFFC50)\r
+       #define RTIUDCP0 *((uint32_t *)0xFFFFFC54)\r
+       #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
+       #define HWTC_COUNT (RTIFRC0 - (RTICOMP0 - RTIUDCP0))\r
+       #define HWTC_PERIOD (RTIUDCP0)\r
+       #define HWTC_DIVISOR 1\r
 \r
-    #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
-    #define HWTC_COUNT (TA0R)\r
-    #define HWTC_PERIOD (((uint16_t)TACCR0)+1)\r
-    #define HWTC_DIVISOR 1\r
-    #define IRQ_PRIORITY_ORDER 1  // higher IRQ priority values are more significant\r
+       #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
 \r
-#elif (SELECTED_PORT == PORT_MICROCHIP_PIC32)\r
+#elif (SELECTED_PORT == PORT_TEXAS_INSTRUMENTS_MSP430)\r
 \r
-    /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
+       /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
 \r
-    #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
-    #define HWTC_COUNT (ReadTimer1())     /* Should be available in BSP */\r
-    #define HWTC_PERIOD (ReadPeriod1()+1) /* Should be available in BSP */\r
-    #define HWTC_DIVISOR 1\r
-    #define IRQ_PRIORITY_ORDER 0  // lower IRQ priority values are more significant\r
+       #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
+       #define HWTC_COUNT (TA0R)\r
+       #define HWTC_PERIOD (((uint16_t)TACCR0)+1)\r
+       #define HWTC_DIVISOR 1\r
+       #define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant\r
 \r
 #elif (SELECTED_PORT == PORT_XILINX_PPC405)\r
-    \r
-    /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
 \r
-    #define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING\r
-    #define HWTC_COUNT  mfspr(0x3db)   \r
+       /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
+\r
+       #define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING\r
+       #define HWTC_COUNT mfspr(0x3db)\r
        #if (defined configCPU_CLOCK_HZ && defined configTICK_RATE_HZ) // Check if FreeRTOS\r
-           /* For FreeRTOS only - found no generic OS independent solution for the PPC405 architecture. */\r
-           #define HWTC_PERIOD ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) // Same as in port.c for PPC405\r
+               /* For FreeRTOS only - found no generic OS independent solution for the PPC405 architecture. */\r
+               #define HWTC_PERIOD ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) // Same as in port.c for PPC405\r
        #else\r
-           /* Not defined for other operating systems yet */\r
-           #error HWTC_PERIOD must be defined to give the number of hardware timer ticks per OS tick.\r
-       #endif  \r
-    #define HWTC_DIVISOR 1\r
-    #define IRQ_PRIORITY_ORDER 0  // lower IRQ priority values are more significant\r
+               /* Not defined for other operating systems yet */\r
+               #error HWTC_PERIOD must be defined to give the number of hardware timer ticks per OS tick.\r
+       #endif\r
+       #define HWTC_DIVISOR 1\r
+       #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
 \r
 #elif (SELECTED_PORT == PORT_XILINX_PPC440)\r
-    \r
+\r
        /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
-    /* This should work with most PowerPC chips */    \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_COUNT mfspr(0x016)\r
        #if (defined configCPU_CLOCK_HZ && defined configTICK_RATE_HZ) // Check if FreeRTOS\r
                /* For FreeRTOS only - found no generic OS independent solution for the PPC440 architecture. */\r
                #define HWTC_PERIOD ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) // Same as in port.c for PPC440\r
                /* Not defined for other operating systems yet */\r
                #error HWTC_PERIOD must be defined to give the number of hardware timer ticks per OS tick.\r
        #endif\r
-    #define HWTC_DIVISOR 1    \r
-    #define IRQ_PRIORITY_ORDER 0  // lower IRQ priority values are more significant\r
-    \r
+       #define HWTC_DIVISOR 1\r
+       #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
+\r
 #elif (SELECTED_PORT == PORT_XILINX_MICROBLAZE)\r
 \r
-    /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
+       /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
+\r
+       /* This should work with most Microblaze configurations.\r
+        * It uses the AXI Timer 0 - the tick interrupt source.\r
+        * If an AXI Timer 0 peripheral is available on your hardware platform, no modifications are required.\r
+        */\r
+       #include "xtmrctr_l.h"\r
+\r
+       #define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING\r
+       #define HWTC_COUNT XTmrCtr_GetTimerCounterReg( XPAR_TMRCTR_0_BASEADDR, 0 )\r
+       #define HWTC_PERIOD (XTmrCtr_mGetLoadReg( XPAR_TMRCTR_0_BASEADDR, 0) + 1)\r
+       #define HWTC_DIVISOR 16\r
+       #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
+\r
+#elif (SELECTED_PORT == PORT_ARM_CORTEX_A9)\r
+\r
+       /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
+\r
+    #define CA9_MPCORE_PRIVCTR_CONTROL_PRESCALER_MASK    0x0000FF00\r
+    #define CA9_MPCORE_PRIVCTR_CONTROL_PRESCALER_SHIFT   8\r
+\r
+    #define CA9_MPCORE_PRIVCTR_PERIOD_REG       (*(volatile uint32_t*)(0xF8F00600 + 0))\r
+    #define CA9_MPCORE_PRIVCTR_COUNTER_REG      (*(volatile uint32_t*)(0xF8F00600 + 4))\r
+    #define CA9_MPCORE_PRIVCTR_CONTROL_REG      (*(volatile uint32_t*)(0xF8F00600 + 8))\r
+\r
+    #define CA9_MPCORE_PRIVCTR_PRESCALER        (((CA9_MPCORE_PRIVCTR_CONTROL_REG & CA9_MPCORE_PRIVCTR_CONTROL_PRESCALER_MASK) >> CA9_MPCORE_PRIVCTR_CONTROL_PRESCALER_SHIFT) + 1)\r
 \r
-    /* This should work with most Microblaze configurations.\r
-     * It uses the AXI Timer 0 - the tick interrupt source.\r
-     * If an AXI Timer 0 peripheral is available on your hardware platform, no modifications are required.\r
-     */\r
-    #include "xtmrctr_l.h"\r
 \r
-    #define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING\r
-    #define HWTC_COUNT XTmrCtr_GetTimerCounterReg( XPAR_TMRCTR_0_BASEADDR, 0 )\r
-       #define HWTC_PERIOD (XTmrCtr_mGetLoadReg( XPAR_TMRCTR_0_BASEADDR,  0) + 1)\r
-    #define HWTC_DIVISOR 16\r
+    #define HWTC_COUNT_DIRECTION                DIRECTION_DECREMENTING\r
+    #define HWTC_COUNT                          CA9_MPCORE_PRIVCTR_COUNTER_REG\r
+    #define HWTC_PERIOD                         ((CA9_MPCORE_PRIVCTR_PERIOD_REG * CA9_MPCORE_PRIVCTR_PRESCALER) + 1)\r
+\r
+    //NOTE: The private timer ticks with a very high frequency (half the core-clock usually),\r
+    //but offers the possibility to apply a prescaler. Depending on the prescaler you set the\r
+    //HWTC_DIVISOR may need to be raised. Refer to the notes at the beginning of this file\r
+    //for more information.\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_APPLICATION_DEFINED)\r
 \r
 #elif (SELECTED_PORT != PORT_NOT_SET)\r
 \r
-    #error "SELECTED_PORT had unsupported value!"\r
-    #define SELECTED_PORT PORT_NOT_SET\r
+       #error "SELECTED_PORT had unsupported value!"\r
+       #define SELECTED_PORT PORT_NOT_SET\r
 \r
 #endif\r
 \r
 #if (SELECTED_PORT != PORT_NOT_SET)\r
-    \r
-    #ifndef HWTC_COUNT_DIRECTION\r
-    #error "HWTC_COUNT_DIRECTION is not set!"\r
-    #endif \r
-    \r
-    #ifndef HWTC_COUNT\r
-    #error "HWTC_COUNT is not set!"    \r
-    #endif \r
-    \r
-    #ifndef HWTC_PERIOD\r
-    #error "HWTC_PERIOD is not set!"\r
-    #endif \r
-    \r
-    #ifndef HWTC_DIVISOR\r
-    #error "HWTC_DIVISOR is not set!"    \r
-    #endif \r
-    \r
-    #ifndef IRQ_PRIORITY_ORDER\r
-    #error "IRQ_PRIORITY_ORDER is not set!"\r
-    #elif (IRQ_PRIORITY_ORDER != 0) && (IRQ_PRIORITY_ORDER != 1)\r
-    #error "IRQ_PRIORITY_ORDER has bad value!"\r
-    #endif \r
-    \r
-    #if (HWTC_DIVISOR < 1)\r
-    #error "HWTC_DIVISOR must be a non-zero positive value!"\r
-    #endif \r
-       \r
+\r
+       #ifndef HWTC_COUNT_DIRECTION\r
+       #error "HWTC_COUNT_DIRECTION is not set!"\r
+       #endif\r
+\r
+       #ifndef HWTC_COUNT\r
+       #error "HWTC_COUNT is not set!"\r
+       #endif\r
+\r
+       #ifndef HWTC_PERIOD\r
+       #error "HWTC_PERIOD is not set!"\r
+       #endif\r
+\r
+       #ifndef HWTC_DIVISOR\r
+       #error "HWTC_DIVISOR is not set!"\r
+       #endif\r
+\r
+       #ifndef IRQ_PRIORITY_ORDER\r
+       #error "IRQ_PRIORITY_ORDER is not set!"\r
+       #elif (IRQ_PRIORITY_ORDER != 0) && (IRQ_PRIORITY_ORDER != 1)\r
+       #error "IRQ_PRIORITY_ORDER has bad value!"\r
+       #endif\r
+\r
+       #if (HWTC_DIVISOR < 1)\r
+       #error "HWTC_DIVISOR must be a non-zero positive value!"\r
+       #endif\r
+\r
 #endif\r
 /*******************************************************************************\r
  * vTraceConsoleMessage\r
  *\r
  * A wrapper for your system-specific console "printf" console output function.\r
- * This needs to be correctly defined to see status reports from the trace \r
+ * This needs to be correctly defined to see status reports from the trace\r
  * status monitor task (this is defined in trcUser.c).\r
- ******************************************************************************/         \r
+ ******************************************************************************/\r
 #define vTraceConsoleMessage(x)\r
 \r
 /*******************************************************************************\r
  ******************************************************************************/\r
 void vTracePortGetTimeStamp(uint32_t *puiTimestamp);\r
 \r
-/*******************************************************************************\r
- * vTracePortEnd\r
- * \r
- * This function is called when the recorder is stopped due to full buffer.\r
- * Mainly intended to show a message in the console.\r
- * This is used by the Win32 port to store the trace to a file. The file path is\r
- * set using vTracePortSetFileName.\r
- ******************************************************************************/\r
-void vTracePortEnd(void);\r
-\r
 #endif\r
index b92afa827ed60c37cb82dd43a18b5c5ac7f6ebb9..1ee5e4bf1b46a402c2a5c55425c0d6b76c12fa81 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Tracealyzer v2.6.0 Recorder Library\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcKernel.h\r
@@ -55,10 +55,10 @@ void vTraceStoreTaskswitch(objectHandleType task_handle);
 void vTraceStoreKernelCall(uint32_t eventcode, traceObjectClass objectClass, uint32_t byteParam);\r
 \r
 void vTraceStoreKernelCallWithNumericParamOnly(uint32_t evtcode,\r
-                                               uint32_t param);\r
+                                                                                               uint32_t param);\r
 \r
 void vTraceStoreKernelCallWithParam(uint32_t evtcode, traceObjectClass objectClass,\r
-                                    uint32_t objectNumber, uint32_t param);\r
+                                                                       uint32_t objectNumber, uint32_t param);\r
 \r
 void vTraceSetTaskInstanceFinished(objectHandleType handle);\r
 \r
@@ -73,18 +73,19 @@ uint8_t uiTraceGetObjectState(uint8_t objectclass, objectHandleType id);
 #if (INCLUDE_OBJECT_DELETE == 1)\r
 \r
 void vTraceStoreObjectNameOnCloseEvent(objectHandleType handle,\r
-                                       traceObjectClass objectclass);\r
+                                                                               traceObjectClass objectclass);\r
 \r
 void vTraceStoreObjectPropertiesOnCloseEvent(objectHandleType handle,\r
-                                             traceObjectClass objectclass);\r
+                                                                                        traceObjectClass objectclass);\r
 #endif\r
 \r
 /* Internal constants for task state */\r
 #define TASK_STATE_INSTANCE_NOT_ACTIVE 0\r
 #define TASK_STATE_INSTANCE_ACTIVE 1\r
-#define TASK_STATE_INSTANCE_MARKED_FINISHED 2\r
 \r
+#endif\r
 \r
 #endif\r
 \r
-#endif
\ No newline at end of file
+\r
+\r
index a029124e4459fb6d82b1aedbd3447d69daed8b09..49dd644ab45860ccb01db6253fcf63f33bd15650 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
-* Tracealyzer v2.6.0 Recorder Library\r
+* Tracealyzer v2.7.0 Recorder Library\r
 * Percepio AB, www.percepio.com\r
 *\r
 * trcKernelHooks.h\r
@@ -12,7 +12,7 @@
 * compile-time errors.\r
 *\r
 * #ifdef __ICCARM__\r
-*       #include "percepio/Include/trcKernelHooks.h"\r
+*              #include "trcKernelPort.h"\r
 * #endif\r
 *\r
 * Terms of Use\r
@@ -207,4 +207,7 @@ vTraceStoreObjectNameOnCloseEvent(TRACE_GET_TIMER_NUMBER(pxTimer), TRACE_CLASS_T
 vTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_TIMER_NUMBER(pxTimer), TRACE_CLASS_TIMER); \\r
 vTraceFreeObjectHandle(TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(pxTimer));\r
 \r
-#endif /* TRCKERNELHOOKS_H */
\ No newline at end of file
+#endif /* TRCKERNELHOOKS_H */\r
+\r
+\r
+\r
index 58d73060a0eae2d5eb508a45069f4eb3d7ce2404..59dc94bc8a3efcf7e4c65a805f085ec81575ae81 100644 (file)
@@ -1,10 +1,10 @@
 /*******************************************************************************\r
- * Tracealyzer v2.6.0 Recorder Library\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcKernelPort.h\r
  *\r
- * Kernel-specific functionality for FreeRTOS, used by the recorder library.\r
+ * Wrapper for kernel-specific port (trcKernelPort<KERNEL>.h)\r
  * \r
  * Terms of Use\r
  * This software is copyright Percepio AB. The recorder library is free for\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
-\r
-#ifndef TRCKERNELPORT_H_\r
-#define TRCKERNELPORT_H_\r
-\r
-#include "FreeRTOS.h"  // Defines configUSE_TRACE_FACILITY\r
-#include "trcHardwarePort.h"\r
-\r
-extern int uiInEventGroupSetBitsFromISR;\r
-\r
-#define USE_TRACEALYZER_RECORDER configUSE_TRACE_FACILITY\r
-\r
-#if (USE_TRACEALYZER_RECORDER == 1)\r
-\r
-/* Defines that must be set for the recorder to work properly */\r
-#define TRACE_KERNEL_VERSION 0x1AA1\r
-#define TRACE_TICK_RATE_HZ configTICK_RATE_HZ /* Defined in "FreeRTOS.h" */\r
-#define TRACE_CPU_CLOCK_HZ configCPU_CLOCK_HZ /* Defined in "FreeRTOSConfig.h" */\r
-\r
-#if ((SELECTED_PORT == PORT_ARM_CortexM) && (USE_PRIMASK_CS == 1))\r
-\r
-#define TRACE_SR_ALLOC_CRITICAL_SECTION() int __irq_status;\r
-\r
-#define TRACE_ENTER_CRITICAL_SECTION() { __irq_status = prvTraceGetIRQMask(); prvTraceDisableIRQ(); }\r
-\r
-#define TRACE_EXIT_CRITICAL_SECTION() { prvTraceSetIRQMask(__irq_status); }\r
-\r
-#define trcCRITICAL_SECTION_BEGIN_ON_CORTEX_M_ONLY trcCRITICAL_SECTION_BEGIN\r
-#define trcCRITICAL_SECTION_END_ON_CORTEX_M_ONLY trcCRITICAL_SECTION_END\r
-\r
-#else\r
-\r
-#define TRACE_ENTER_CRITICAL_SECTION() portENTER_CRITICAL()\r
-#define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL()\r
-\r
-#define trcCRITICAL_SECTION_BEGIN_ON_CORTEX_M_ONLY() recorder_busy++;\r
-#define trcCRITICAL_SECTION_END_ON_CORTEX_M_ONLY() recorder_busy--;\r
-\r
-#endif\r
-\r
-/************************************************************************/\r
-/* KERNEL SPECIFIC OBJECT CONFIGURATION                                 */\r
-/************************************************************************/\r
-#define TRACE_NCLASSES 7\r
-#define TRACE_CLASS_QUEUE ((traceObjectClass)0)\r
-#define TRACE_CLASS_SEMAPHORE ((traceObjectClass)1)\r
-#define TRACE_CLASS_MUTEX ((traceObjectClass)2)\r
-#define TRACE_CLASS_TASK ((traceObjectClass)3)\r
-#define TRACE_CLASS_ISR ((traceObjectClass)4)\r
-#define TRACE_CLASS_TIMER ((traceObjectClass)5)\r
-#define TRACE_CLASS_EVENTGROUP ((traceObjectClass)6)\r
-\r
-#define TRACE_KERNEL_OBJECT_COUNT (NQueue + NSemaphore + NMutex + NTask + NISR + NTimer + NEventGroup)\r
-\r
-/* The size of the Object Property Table entries, in bytes, per object */\r
-\r
-/* Queue properties (except name):     current number of message in queue */\r
-#define PropertyTableSizeQueue         (NameLenQueue + 1)      \r
-\r
-/* Semaphore properties (except name): state (signaled = 1, cleared = 0) */\r
-#define PropertyTableSizeSemaphore     (NameLenSemaphore + 1) \r
-\r
-/* Mutex properties (except name):     owner (task handle, 0 = free) */\r
-#define PropertyTableSizeMutex         (NameLenMutex + 1)         \r
-\r
-/* Task properties (except name):      Byte 0: Current priority\r
-                                       Byte 1: state (if already active) \r
-                                       Byte 2: legacy, not used\r
-                                       Byte 3: legacy, not used */\r
-#define PropertyTableSizeTask         (NameLenTask + 4)\r
-\r
-/* ISR properties:                     Byte 0: priority\r
-                                       Byte 1: state (if already active) */\r
-#define PropertyTableSizeISR          (NameLenISR + 2)\r
-\r
-/* NTimer properties:                  Byte 0: state (unused for now) */\r
-#define PropertyTableSizeTimer        (NameLenTimer + 1)\r
-\r
-/* NEventGroup properties:            Byte 0-3: state (unused for now)*/\r
-#define PropertyTableSizeEventGroup       (NameLenEventGroup + 4)\r
-\r
-\r
-/* The layout of the byte array representing the Object Property Table */\r
-#define StartIndexQueue            0\r
-#define StartIndexSemaphore        StartIndexQueue     + NQueue * PropertyTableSizeQueue\r
-#define StartIndexMutex            StartIndexSemaphore + NSemaphore * PropertyTableSizeSemaphore\r
-#define StartIndexTask             StartIndexMutex     + NMutex * PropertyTableSizeMutex\r
-#define StartIndexISR              StartIndexTask      + NTask * PropertyTableSizeTask\r
-#define StartIndexTimer            StartIndexISR       + NISR * PropertyTableSizeISR\r
-#define StartIndexEventGroup       StartIndexTimer     + NTimer * PropertyTableSizeTimer\r
-\r
-/* Number of bytes used by the object table */\r
-#define TRACE_OBJECT_TABLE_SIZE    StartIndexEventGroup       + NEventGroup * PropertyTableSizeEventGroup\r
-\r
-/* Includes */\r
-#include "trcConfig.h" /* Must be first, even before trcTypes.h */\r
-#include "trcHardwarePort.h"\r
-#include "trcTypes.h"\r
-#include "trcKernelHooks.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
-/* Initialization of the handle mechanism, see e.g, xTraceGetObjectHandle */\r
-void vTraceInitObjectHandleStack(void);\r
-\r
-/* Returns the "Not enough handles" error message for the specified object class */\r
-const char* pszTraceGetErrorNotEnoughHandles(traceObjectClass objectclass);\r
-\r
-/*******************************************************************************\r
- * The event codes - should match the offline config file.\r
- * \r
- * Some sections below are encoded to allow for constructions like:\r
- *\r
- *  vTraceStoreKernelCall(EVENTGROUP_CREATE + objectclass, ...\r
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
  *\r
- * The object class ID is given by the three LSB bits, in such cases. Since each \r
- * object class has a separate object property table, the class ID is needed to \r
- * know what section in the object table to use for getting an object name from\r
- * an object handle. \r
- ******************************************************************************/\r
-\r
-#define NULL_EVENT                   (0x00)  /* Ignored in the analysis*/\r
-\r
-/*******************************************************************************\r
- * EVENTGROUP_DIV\r
- *\r
- * Miscellaneous events.\r
- ******************************************************************************/\r
-#define EVENTGROUP_DIV               (NULL_EVENT + 1)                   /*0x01*/\r
-#define DIV_XPS                      (EVENTGROUP_DIV + 0)               /*0x01*/\r
-#define DIV_TASK_READY               (EVENTGROUP_DIV + 1)               /*0x02*/\r
-#define DIV_NEW_TIME                 (EVENTGROUP_DIV + 2)               /*0x03*/\r
-\r
-/*******************************************************************************\r
- * EVENTGROUP_TS\r
- *\r
- * Events for storing task-switches and interrupts. The RESUME events are \r
- * generated if the task/interrupt is already marked active.\r
- ******************************************************************************/\r
-#define EVENTGROUP_TS                (EVENTGROUP_DIV + 3)               /*0x04*/\r
-#define TS_ISR_BEGIN                 (EVENTGROUP_TS + 0)                /*0x04*/\r
-#define TS_ISR_RESUME                (EVENTGROUP_TS + 1)                /*0x05*/\r
-#define TS_TASK_BEGIN                (EVENTGROUP_TS + 2)                /*0x06*/\r
-#define TS_TASK_RESUME               (EVENTGROUP_TS + 3)                /*0x07*/\r
-\r
-/*******************************************************************************\r
- * EVENTGROUP_OBJCLOSE_NAME\r
- * \r
- * About Close Events\r
- * When an object is evicted from the object property table (object close), two \r
- * internal events are stored (EVENTGROUP_OBJCLOSE_NAME and \r
- * EVENTGROUP_OBJCLOSE_PROP), containing the handle-name mapping and object \r
- * properties valid up to this point.\r
- ******************************************************************************/\r
-#define EVENTGROUP_OBJCLOSE_NAME     (EVENTGROUP_TS + 4)                /*0x08*/\r
-\r
-/*******************************************************************************\r
- * EVENTGROUP_OBJCLOSE_PROP\r
- * \r
- * The internal event carrying properties of deleted objects\r
- * The handle and object class of the closed object is not stored in this event, \r
- * but is assumed to be the same as in the preceding CLOSE event. Thus, these \r
- * two events must be generated from within a critical section. \r
- * When queues are closed, arg1 is the "state" property (i.e., number of \r
- * buffered messages/signals).\r
- * When actors are closed, arg1 is priority, arg2 is handle of the "instance \r
- * finish" event, and arg3 is event code of the "instance finish" event. \r
- * In this case, the lower three bits is the object class of the instance finish \r
- * handle. The lower three bits are not used (always zero) when queues are \r
- * closed since the queue type is given in the previous OBJCLOSE_NAME event.\r
- ******************************************************************************/\r
-#define EVENTGROUP_OBJCLOSE_PROP     (EVENTGROUP_OBJCLOSE_NAME + 8)     /*0x10*/\r
-\r
-/*******************************************************************************\r
- * EVENTGROUP_CREATE\r
- * \r
- * The events in this group are used to log Kernel object creations.\r
- * The lower three bits in the event code gives the object class, i.e., type of\r
- * create operation (task, queue, semaphore, etc).\r
- ******************************************************************************/\r
-#define EVENTGROUP_CREATE_OBJ_SUCCESS    (EVENTGROUP_OBJCLOSE_PROP + 8)             /*0x18*/\r
-\r
-/*******************************************************************************\r
- * EVENTGROUP_SEND\r
- * \r
- * The events in this group are used to log Send/Give events on queues, \r
- * semaphores and mutexes The lower three bits in the event code gives the \r
- * object class, i.e., what type of object that is operated on (queue, semaphore \r
- * or mutex).\r
- ******************************************************************************/\r
-#define EVENTGROUP_SEND_SUCCESS      (EVENTGROUP_CREATE_OBJ_SUCCESS + 8)                    /*0x20*/\r
-\r
-/*******************************************************************************\r
- * EVENTGROUP_RECEIVE\r
- * \r
- * The events in this group are used to log Receive/Take events on queues, \r
- * semaphores and mutexes. The lower three bits in the event code gives the \r
- * object class, i.e., what type of object that is operated on (queue, semaphore\r
- * or mutex).\r
- ******************************************************************************/\r
-#define EVENTGROUP_RECEIVE_SUCCESS                       (EVENTGROUP_SEND_SUCCESS + 8)  /*0x28*/\r
-\r
-/* Send/Give operations, from ISR */\r
-#define EVENTGROUP_SEND_FROM_ISR_SUCCESS              (EVENTGROUP_RECEIVE_SUCCESS + 8)  /*0x30*/\r
-\r
-/* Receive/Take operations, from ISR */\r
-#define EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS     (EVENTGROUP_SEND_FROM_ISR_SUCCESS + 8)  /*0x38*/\r
-\r
-/* "Failed" event type versions of above (timeout, failed allocation, etc) */\r
-#define EVENTGROUP_KSE_FAILED         (EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS + 8) /*0x40*/\r
-\r
-/* Failed create calls - memory allocation failed */\r
-#define EVENTGROUP_CREATE_OBJ_FAILED                (EVENTGROUP_KSE_FAILED) /*0x40*/\r
-\r
-/* Failed send/give - timeout! */\r
-#define EVENTGROUP_SEND_FAILED           (EVENTGROUP_CREATE_OBJ_FAILED + 8) /*0x48*/\r
-\r
-/* Failed receive/take - timeout! */\r
-#define EVENTGROUP_RECEIVE_FAILED          (EVENTGROUP_SEND_FAILED + 8) /*0x50*/\r
-\r
-/* Failed non-blocking send/give - queue full */\r
-#define EVENTGROUP_SEND_FROM_ISR_FAILED (EVENTGROUP_RECEIVE_FAILED + 8) /*0x58*/\r
-\r
-/* Failed non-blocking receive/take - queue empty */\r
-#define EVENTGROUP_RECEIVE_FROM_ISR_FAILED \\r
-                                  (EVENTGROUP_SEND_FROM_ISR_FAILED + 8) /*0x60*/\r
-\r
-/* Events when blocking on receive/take */\r
-#define EVENTGROUP_RECEIVE_BLOCK \\r
-                               (EVENTGROUP_RECEIVE_FROM_ISR_FAILED + 8) /*0x68*/\r
-\r
-/* Events when blocking on send/give */\r
-#define EVENTGROUP_SEND_BLOCK     (EVENTGROUP_RECEIVE_BLOCK + 8)  /*0x70*/\r
-\r
-/* Events on queue peek (receive) */\r
-#define EVENTGROUP_PEEK_SUCCESS              (EVENTGROUP_SEND_BLOCK + 8)     /*0x78*/\r
-\r
-/* Events on object delete (vTaskDelete or vQueueDelete) */\r
-#define EVENTGROUP_DELETE_OBJ_SUCCESS            (EVENTGROUP_PEEK_SUCCESS + 8)              /*0x80*/\r
-\r
-/* Other events - object class is implied: TASK */\r
-#define EVENTGROUP_OTHERS            (EVENTGROUP_DELETE_OBJ_SUCCESS + 8)            /*0x88*/\r
-#define TASK_DELAY_UNTIL             (EVENTGROUP_OTHERS + 0)            /*0x88*/\r
-#define TASK_DELAY                   (EVENTGROUP_OTHERS + 1)            /*0x89*/\r
-#define TASK_SUSPEND                 (EVENTGROUP_OTHERS + 2)            /*0x8A*/\r
-#define TASK_RESUME                  (EVENTGROUP_OTHERS + 3)            /*0x8B*/\r
-#define TASK_RESUME_FROM_ISR         (EVENTGROUP_OTHERS + 4)            /*0x8C*/\r
-#define TASK_PRIORITY_SET            (EVENTGROUP_OTHERS + 5)            /*0x8D*/\r
-#define TASK_PRIORITY_INHERIT        (EVENTGROUP_OTHERS + 6)            /*0x8E*/\r
-#define TASK_PRIORITY_DISINHERIT     (EVENTGROUP_OTHERS + 7)            /*0x8F*/\r
-\r
-#define EVENTGROUP_MISC_PLACEHOLDER    (EVENTGROUP_OTHERS + 8)                 /*0x90*/\r
-#define PEND_FUNC_CALL (EVENTGROUP_MISC_PLACEHOLDER+0)                                 /*0x90*/\r
-#define PEND_FUNC_CALL_FROM_ISR (EVENTGROUP_MISC_PLACEHOLDER+1)                        /*0x91*/\r
-#define PEND_FUNC_CALL_FAILED (EVENTGROUP_MISC_PLACEHOLDER+2)                  /*0x92*/\r
-#define PEND_FUNC_CALL_FROM_ISR_FAILED (EVENTGROUP_MISC_PLACEHOLDER+3) /*0x93*/\r
-#define MEM_MALLOC_SIZE (EVENTGROUP_MISC_PLACEHOLDER+4)                                        /*0x94*/\r
-#define MEM_MALLOC_ADDR (EVENTGROUP_MISC_PLACEHOLDER+5)                                        /*0x95*/\r
-#define MEM_FREE_SIZE (EVENTGROUP_MISC_PLACEHOLDER+6)                                  /*0x96*/\r
-#define MEM_FREE_ADDR (EVENTGROUP_MISC_PLACEHOLDER+7)                                  /*0x97*/\r
-\r
-/* User events */\r
-#define EVENTGROUP_USEREVENT (EVENTGROUP_MISC_PLACEHOLDER + 8)        /*0x98*/\r
-#define USER_EVENT (EVENTGROUP_USEREVENT + 0)\r
-\r
-/* Allow for 0-15 arguments (the number of args is added to event code) */\r
-#define USER_EVENT_LAST (EVENTGROUP_USEREVENT + 15)                     /*0xA7*/\r
-\r
-/*******************************************************************************\r
- * XTS Event - eXtended TimeStamp events\r
- * The timestamps used in the recorder are "differential timestamps" (DTS), i.e.\r
- * the time since the last stored event. The DTS fields are either 1 or 2 bytes \r
- * in the other events, depending on the bytes available in the event struct. \r
- * If the time since the last event (the DTS) is larger than allowed for by \r
- * the DTS field of the current event, an XTS event is inserted immediately \r
- * before the original event. The XTS event contains up to 3 additional bytes \r
- * of the DTS value - the higher bytes of the true DTS value. The lower 1-2 \r
- * bytes are stored in the normal DTS field. \r
- * There are two types of XTS events, XTS8 and XTS16. An XTS8 event is stored \r
- * when there is only room for 1 byte (8 bit) DTS data in the original event, \r
- * which means a limit of 0xFF (255). The XTS16 is used when the original event \r
- * has a 16 bit DTS field and thereby can handle values up to 0xFFFF (65535).\r
- * \r
- * Using a very high frequency time base can result in many XTS events. \r
- * Preferably, the time between two OS ticks should fit in 16 bits, i.e.,\r
- * at most 65535. If your time base has a higher frequency, you can define\r
- * the TRACE\r
- ******************************************************************************/\r
-\r
-#define EVENTGROUP_SYS (EVENTGROUP_USEREVENT + 16)                      /*0xA8*/\r
-#define XTS8 (EVENTGROUP_SYS + 0)                                       /*0xA8*/\r
-#define XTS16 (EVENTGROUP_SYS + 1)                                      /*0xA9*/\r
-\r
-#define EVENT_BEING_WRITTEN (EVENTGROUP_SYS + 2)                        /*0xAA*/\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
-#define XID (EVENTGROUP_SYS + 6)                                                                               /*0xAE*/\r
-\r
-#define XTS16L (EVENTGROUP_SYS + 7)                                                                            /*0xAF*/\r
-\r
-#define EVENTGROUP_TIMER (EVENTGROUP_SYS + 8)                                                  /*0xB0*/\r
-\r
-#define TIMER_CREATE (EVENTGROUP_TIMER + 0)                                                            /*0xB0*/\r
-#define TIMER_START (EVENTGROUP_TIMER + 1)                                                             /*0xB0*/\r
-#define TIMER_RESET (EVENTGROUP_TIMER + 2)                                                             /*0xB1*/\r
-#define TIMER_STOP (EVENTGROUP_TIMER + 3)                                                              /*0xB2*/\r
-#define TIMER_CHANGE_PERIOD (EVENTGROUP_TIMER + 4)                                             /*0xB3*/\r
-#define TIMER_DELETE (EVENTGROUP_TIMER + 5)                                                            /*0xB4*/\r
-#define TIMER_START_FROM_ISR (EVENTGROUP_TIMER + 6)                                            /*0xB6*/\r
-#define TIMER_RESET_FROM_ISR (EVENTGROUP_TIMER + 7)                                            /*0xB7*/\r
-#define TIMER_STOP_FROM_ISR (EVENTGROUP_TIMER + 8)                                             /*0xB8*/\r
-\r
-#define TIMER_CREATE_FAILED (EVENTGROUP_TIMER + 9)                                             /*0xB9*/\r
-#define TIMER_START_FAILED (EVENTGROUP_TIMER + 10)                                             /*0xBA*/\r
-#define TIMER_RESET_FAILED (EVENTGROUP_TIMER + 11)                                             /*0xBB*/\r
-#define TIMER_STOP_FAILED (EVENTGROUP_TIMER + 12)                                              /*0xBC*/\r
-#define TIMER_CHANGE_PERIOD_FAILED (EVENTGROUP_TIMER + 13)                             /*0xBD*/\r
-#define TIMER_DELETE_FAILED (EVENTGROUP_TIMER + 14)                                            /*0xBE*/\r
-#define TIMER_START_FROM_ISR_FAILED (EVENTGROUP_TIMER + 15)                            /*0xBF*/\r
-#define TIMER_RESET_FROM_ISR_FAILED (EVENTGROUP_TIMER + 16)                            /*0xC0*/\r
-#define TIMER_STOP_FROM_ISR_FAILED (EVENTGROUP_TIMER + 17)                             /*0xC1*/\r
-\r
-#define EVENTGROUP_EG (EVENTGROUP_TIMER + 18)                                                  /*0xC2*/\r
-#define EVENT_GROUP_CREATE (EVENTGROUP_EG + 0)                                                 /*0xC2*/\r
-#define EVENT_GROUP_CREATE_FAILED (EVENTGROUP_EG + 1)                                  /*0xC3*/\r
-#define EVENT_GROUP_SYNC_BLOCK (EVENTGROUP_EG + 2)                                             /*0xC4*/\r
-#define EVENT_GROUP_SYNC_END (EVENTGROUP_EG + 3)                                               /*0xC5*/\r
-#define EVENT_GROUP_WAIT_BITS_BLOCK (EVENTGROUP_EG + 4)                                        /*0xC6*/\r
-#define EVENT_GROUP_WAIT_BITS_END (EVENTGROUP_EG + 5)                                  /*0xC7*/\r
-#define EVENT_GROUP_CLEAR_BITS (EVENTGROUP_EG + 6)                                             /*0xC8*/\r
-#define EVENT_GROUP_CLEAR_BITS_FROM_ISR (EVENTGROUP_EG + 7)                            /*0xC9*/\r
-#define EVENT_GROUP_SET_BITS (EVENTGROUP_EG + 8)                                               /*0xCA*/\r
-#define EVENT_GROUP_DELETE (EVENTGROUP_EG + 9)                                                 /*0xCB*/\r
-#define EVENT_GROUP_SYNC_END_FAILED (EVENTGROUP_EG + 10)                               /*0xCC*/\r
-#define EVENT_GROUP_WAIT_BITS_END_FAILED (EVENTGROUP_EG + 11)                  /*0xCD*/\r
-#define EVENT_GROUP_SET_BITS_FROM_ISR  (EVENTGROUP_EG + 12)             /*0xCE*/\r
-#define EVENT_GROUP_SET_BITS_FROM_ISR_FAILED (EVENTGROUP_EG + 13)              /*0xCF*/\r
-\r
-/************************************************************************/\r
-/* KERNEL SPECIFIC DATA AND FUNCTIONS NEEDED TO PROVIDE THE             */\r
-/* FUNCTIONALITY REQUESTED BY THE TRACE RECORDER                        */\r
-/************************************************************************/\r
-\r
-/******************************************************************************\r
- * TraceObjectClassTable\r
- * Translates a FreeRTOS QueueType into trace objects classes (TRACE_CLASS_).\r
- * This was added since we want to map both types of Mutex and both types of \r
- * Semaphores on common classes for all Mutexes and all Semaphores respectively. \r
- * \r
- * FreeRTOS Queue types\r
- * #define queueQUEUE_TYPE_BASE                  (0U) => TRACE_CLASS_QUEUE\r
- * #define queueQUEUE_TYPE_MUTEX                 (1U) => TRACE_CLASS_MUTEX\r
- * #define queueQUEUE_TYPE_COUNTING_SEMAPHORE    (2U) => TRACE_CLASS_SEMAPHORE\r
- * #define queueQUEUE_TYPE_BINARY_SEMAPHORE      (3U) => TRACE_CLASS_SEMAPHORE\r
- * #define queueQUEUE_TYPE_RECURSIVE_MUTEX       (4U) => TRACE_CLASS_MUTEX \r
+ * Copyright Percepio AB, 2014.\r
+ * www.percepio.com\r
  ******************************************************************************/\r
 \r
-extern traceObjectClass TraceObjectClassTable[5];\r
-\r
-/* These functions are implemented in the .c file since certain header files must not be included in this one */\r
-objectHandleType prvTraceGetObjectNumber(void* handle);\r
-unsigned char prvTraceGetObjectType(void* handle);\r
-objectHandleType prvTraceGetTaskNumber(void* handle);\r
-unsigned char prvTraceIsSchedulerActive(void);\r
-unsigned char prvTraceIsSchedulerSuspended(void);\r
-unsigned char prvTraceIsSchedulerStarted(void);\r
-void* prvTraceGetCurrentTaskHandle(void);\r
-\r
-#if (configUSE_TIMERS == 1)\r
-#undef INCLUDE_xTimerGetTimerDaemonTaskHandle\r
-#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1\r
-#endif\r
-\r
-/************************************************************************/\r
-/* KERNEL SPECIFIC MACROS USED BY THE TRACE RECORDER                    */\r
-/************************************************************************/\r
-\r
-#define TRACE_MALLOC(size) pvPortMalloc(size)\r
-#define TRACE_IS_SCHEDULER_ACTIVE() prvTraceIsSchedulerActive()\r
-#define TRACE_IS_SCHEDULER_STARTED() prvTraceIsSchedulerStarted()\r
-#define TRACE_IS_SCHEDULER_SUSPENDED() prvTraceIsSchedulerSuspended()\r
-#define TRACE_GET_CURRENT_TASK() prvTraceGetCurrentTaskHandle()\r
-\r
-#define TRACE_GET_TASK_PRIORITY(pxTCB) ((uint8_t)pxTCB->uxPriority)\r
-#define TRACE_GET_TASK_NAME(pxTCB) ((char*)pxTCB->pcTaskName)\r
-#define TRACE_GET_TASK_NUMBER(pxTCB) (prvTraceGetTaskNumber(pxTCB))\r
-#define TRACE_SET_TASK_NUMBER(pxTCB) pxTCB->uxTaskNumber = xTraceGetObjectHandle(TRACE_CLASS_TASK);\r
-\r
-#define TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass) TraceObjectClassTable[kernelClass]\r
-#define TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject) TRACE_GET_CLASS_TRACE_CLASS(CLASS, prvTraceGetObjectType(pxObject))\r
-\r
-#define TRACE_GET_TIMER_NUMBER(tmr) ( ( objectHandleType ) ((Timer_t*)tmr)->uxTimerNumber )\r
-#define TRACE_SET_TIMER_NUMBER(tmr) ((Timer_t*)tmr)->uxTimerNumber = xTraceGetObjectHandle(TRACE_CLASS_TIMER);\r
-#define TRACE_GET_TIMER_NAME(pxTimer) pxTimer->pcTimerName\r
-#define TRACE_GET_TIMER_PERIOD(pxTimer) pxTimer->xTimerPeriodInTicks\r
-\r
-#define TRACE_GET_EVENTGROUP_NUMBER(eg)  ( ( objectHandleType ) uxEventGroupGetNumber(eg) )\r
-#define TRACE_SET_EVENTGROUP_NUMBER(eg) ((EventGroup_t*)eg)->uxEventGroupNumber = xTraceGetObjectHandle(TRACE_CLASS_EVENTGROUP);\r
-\r
-#define TRACE_GET_OBJECT_NUMBER(CLASS, pxObject) (prvTraceGetObjectNumber(pxObject))\r
-#define TRACE_SET_OBJECT_NUMBER(CLASS, pxObject) pxObject->uxQueueNumber = xTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject));\r
-\r
-#define TRACE_GET_CLASS_EVENT_CODE(SERVICE, RESULT, CLASS, kernelClass) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass))\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) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_CLASS_TASK)\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
-#endif\r
-\r
-/* A macro that will update the tick count when returning from tickless idle */\r
-#undef traceINCREASE_TICK_COUNT\r
-/* Note: This can handle time adjustments of max 2^32 ticks, i.e., 35 seconds at 120 MHz. Thus, tick-less idle periods longer than 2^32 ticks  will appear "compressed" on the time line.*/\r
-#define traceINCREASE_TICK_COUNT( xCount ) { DWT_CYCLES_ADDED += (xCount * (TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ)); }\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
-       trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB);\r
-       \r
-/* Called on each OS tick. Will call uiPortGetTimestamp to make sure it is called at least once every OS tick. */\r
-#undef traceTASK_INCREMENT_TICK\r
-#define traceTASK_INCREMENT_TICK( xTickCount ) \\r
-    if (uxSchedulerSuspended == ( UBaseType_t ) pdTRUE || uxPendedTicks == 0) { trcKERNEL_HOOKS_INCREMENT_TICK(); } \\r
-       if (uxSchedulerSuspended == ( UBaseType_t ) pdFALSE) { trcKERNEL_HOOKS_NEW_TIME(DIV_NEW_TIME, xTickCount + 1); }\r
-\r
-/* Called on each task-switch */\r
-#undef traceTASK_SWITCHED_IN\r
-#define traceTASK_SWITCHED_IN() \\r
-       trcKERNEL_HOOKS_TASK_SWITCH(TRACE_GET_CURRENT_TASK());\r
-\r
-/* Called on vTaskSuspend */\r
-#undef traceTASK_SUSPEND\r
-#define traceTASK_SUSPEND( pxTaskToSuspend ) \\r
-       trcKERNEL_HOOKS_TASK_SUSPEND(TASK_SUSPEND, pxTaskToSuspend);    \r
-\r
-/* Called on vTaskDelay - note the use of FreeRTOS variable xTicksToDelay */\r
-#undef traceTASK_DELAY\r
-#define traceTASK_DELAY() \\r
-       trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY, pxCurrentTCB, xTicksToDelay); \\r
-       trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();   \r
-\r
-/* Called on vTaskDelayUntil - note the use of FreeRTOS variable xTimeToWake */\r
-#undef traceTASK_DELAY_UNTIL\r
-#define traceTASK_DELAY_UNTIL() \\r
-       trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY_UNTIL, pxCurrentTCB, xTimeToWake); \\r
-       trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();\r
-\r
-#if (INCLUDE_OBJECT_DELETE == 1)\r
-/* Called on vTaskDelete */\r
-#undef traceTASK_DELETE\r
-#define traceTASK_DELETE( pxTaskToDelete ) \\r
-       { TRACE_SR_ALLOC_CRITICAL_SECTION(); \\r
-       TRACE_ENTER_CRITICAL_SECTION(); \\r
-       trcKERNEL_HOOKS_TASK_DELETE(DELETE_OBJ, pxTaskToDelete); \\r
-       TRACE_EXIT_CRITICAL_SECTION(); }\r
-#endif\r
-\r
-#if (INCLUDE_OBJECT_DELETE == 1)\r
-/* Called on vQueueDelete */\r
-#undef traceQUEUE_DELETE\r
-#define traceQUEUE_DELETE( pxQueue ) \\r
-       { TRACE_SR_ALLOC_CRITICAL_SECTION(); \\r
-       TRACE_ENTER_CRITICAL_SECTION(); \\r
-       trcKERNEL_HOOKS_OBJECT_DELETE(DELETE_OBJ, UNUSED, pxQueue); \\r
-       TRACE_EXIT_CRITICAL_SECTION(); }\r
-#endif\r
-\r
-/* Called on vTaskCreate */\r
-#undef traceTASK_CREATE\r
-#define traceTASK_CREATE(pxNewTCB) \\r
-       if (pxNewTCB != NULL) \\r
-       { \\r
-               trcKERNEL_HOOKS_TASK_CREATE(CREATE_OBJ, UNUSED, pxNewTCB); \\r
-       }\r
-\r
-/* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */\r
-#undef traceTASK_CREATE_FAILED\r
-#define traceTASK_CREATE_FAILED() \\r
-       trcKERNEL_HOOKS_TASK_CREATE_FAILED(CREATE_OBJ, UNUSED); \r
-\r
-/* Called in xQueueCreate, and thereby for all other object based on queues, such as semaphores. */\r
-#undef traceQUEUE_CREATE\r
-#define traceQUEUE_CREATE( pxNewQueue )\\r
-       trcKERNEL_HOOKS_OBJECT_CREATE(CREATE_OBJ, UNUSED, pxNewQueue);  \r
-\r
-/* Called in xQueueCreate, if the queue creation fails */\r
-#undef traceQUEUE_CREATE_FAILED\r
-#define traceQUEUE_CREATE_FAILED( queueType ) \\r
-       trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(CREATE_OBJ, UNUSED, queueType);\r
-\r
-/* Called in xQueueCreateMutex, and thereby also from xSemaphoreCreateMutex and xSemaphoreCreateRecursiveMutex */\r
-#undef traceCREATE_MUTEX\r
-#define traceCREATE_MUTEX( pxNewQueue ) \\r
-       trcKERNEL_HOOKS_OBJECT_CREATE(CREATE_OBJ, UNUSED, pxNewQueue);\r
-       \r
-/* Called in xQueueCreateMutex when the operation fails (when memory allocation fails) */\r
-#undef traceCREATE_MUTEX_FAILED\r
-#define traceCREATE_MUTEX_FAILED() \\r
-       trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(CREATE_OBJ, UNUSED, queueQUEUE_TYPE_MUTEX);\r
-\r
-/* Called when the Mutex can not be given, since not holder */\r
-#undef traceGIVE_MUTEX_RECURSIVE_FAILED\r
-#define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex ) \\r
-       trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, FAILED, UNUSED, pxMutex);\r
-\r
-/* Called when a message is sent to a queue */   /* CS IS NEW ! */\r
-#undef traceQUEUE_SEND\r
-#define traceQUEUE_SEND( pxQueue ) \\r
-       trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, SUCCESS, UNUSED, pxQueue); \\r
-       trcKERNEL_HOOKS_SET_OBJECT_STATE(UNUSED, pxQueue, TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, pxQueue) == TRACE_CLASS_MUTEX ? (uint8_t)0 : (uint8_t)(pxQueue->uxMessagesWaiting + 1));\r
-\r
-/* Called when a message failed to be sent to a queue (timeout) */\r
-#undef traceQUEUE_SEND_FAILED\r
-#define traceQUEUE_SEND_FAILED( pxQueue ) \\r
-    trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, FAILED, UNUSED, pxQueue);\r
-\r
-/* Called when the task is blocked due to a send operation on a full queue */\r
-#undef traceBLOCKING_ON_QUEUE_SEND\r
-#define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) \\r
-       trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, BLOCK, UNUSED, pxQueue);\r
-\r
-/* Called when a message is received from a queue */\r
-#undef traceQUEUE_RECEIVE\r
-#define traceQUEUE_RECEIVE( pxQueue ) \\r
-       trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, SUCCESS, UNUSED, pxQueue); \\r
-       trcKERNEL_HOOKS_SET_OBJECT_STATE(UNUSED, pxQueue, TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, pxQueue) == TRACE_CLASS_MUTEX ? TRACE_GET_TASK_NUMBER(TRACE_GET_CURRENT_TASK()) : (uint8_t)(pxQueue->uxMessagesWaiting - 1));\r
-\r
-/* Called when a receive operation on a queue fails (timeout) */\r
-#undef traceQUEUE_RECEIVE_FAILED\r
-#define traceQUEUE_RECEIVE_FAILED( pxQueue ) \\r
-       trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, FAILED, UNUSED, pxQueue);\r
-\r
-/* Called when the task is blocked due to a receive operation on an empty queue */\r
-#undef traceBLOCKING_ON_QUEUE_RECEIVE\r
-#define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) \\r
-       trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, BLOCK, UNUSED, pxQueue); \\r
-       if (TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, pxQueue) != TRACE_CLASS_MUTEX) \\r
-       {trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();}\r
-\r
-/* Called on xQueuePeek */\r
-#undef traceQUEUE_PEEK\r
-#define traceQUEUE_PEEK( pxQueue ) \\r
-       trcKERNEL_HOOKS_KERNEL_SERVICE(PEEK, SUCCESS, UNUSED, pxQueue);\r
-\r
-/* Called when a message is sent from interrupt context, e.g., using xQueueSendFromISR */\r
-#undef traceQUEUE_SEND_FROM_ISR\r
-#define traceQUEUE_SEND_FROM_ISR( pxQueue ) \\r
-       trcKERNEL_HOOKS_KERNEL_SERVICE(SEND_FROM_ISR, SUCCESS, UNUSED, pxQueue); \\r
-       trcKERNEL_HOOKS_SET_OBJECT_STATE(UNUSED, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting + 1));\r
-\r
-/* Called when a message send from interrupt context fails (since the queue was full) */\r
-#undef traceQUEUE_SEND_FROM_ISR_FAILED\r
-#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) \\r
-       trcKERNEL_HOOKS_KERNEL_SERVICE(SEND_FROM_ISR, FAILED, UNUSED, pxQueue);\r
-       \r
-/* Called when a message is received in interrupt context, e.g., using xQueueReceiveFromISR */\r
-#undef traceQUEUE_RECEIVE_FROM_ISR\r
-#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) \\r
-       trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE_FROM_ISR, SUCCESS, UNUSED, pxQueue); \\r
-       trcKERNEL_HOOKS_SET_OBJECT_STATE(UNUSED, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting - 1));\r
-       \r
-/* Called when a message receive from interrupt context fails (since the queue was empty) */\r
-#undef traceQUEUE_RECEIVE_FROM_ISR_FAILED\r
-#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) \\r
-       trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE_FROM_ISR, FAILED, UNUSED, pxQueue);\r
-       \r
-/* Called in vTaskPrioritySet */\r
-#undef traceTASK_PRIORITY_SET\r
-#define traceTASK_PRIORITY_SET( pxTask, uxNewPriority ) \\r
-       trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_SET, pxTask, uxNewPriority);\r
-       \r
-/* Called in vTaskPriorityInherit, which is called by Mutex operations */\r
-#undef traceTASK_PRIORITY_INHERIT\r
-#define traceTASK_PRIORITY_INHERIT( pxTask, uxNewPriority ) \\r
-       trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_INHERIT, pxTask, uxNewPriority);\r
-       \r
-/* Called in vTaskPriorityDisinherit, which is called by Mutex operations */\r
-#undef traceTASK_PRIORITY_DISINHERIT\r
-#define traceTASK_PRIORITY_DISINHERIT( pxTask, uxNewPriority ) \\r
-       trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_DISINHERIT, pxTask, uxNewPriority);\r
-       \r
-/* Called in vTaskResume */\r
-#undef traceTASK_RESUME\r
-#define traceTASK_RESUME( pxTaskToResume ) \\r
-       trcKERNEL_HOOKS_TASK_RESUME(TASK_RESUME, pxTaskToResume);\r
-       \r
-/* Called in vTaskResumeFromISR */\r
-#undef traceTASK_RESUME_FROM_ISR\r
-#define traceTASK_RESUME_FROM_ISR( pxTaskToResume ) \\r
-       trcKERNEL_HOOKS_TASK_RESUME(TASK_RESUME_FROM_ISR, pxTaskToResume);\r
-       \r
-\r
-/* Called in timer.c - xTimerCreate */\r
-#undef traceTIMER_CREATE\r
-#define traceTIMER_CREATE(tmr) \\r
-       trcKERNEL_HOOKS_TIMER_CREATE(TIMER_CREATE, tmr);\r
-\r
-#undef traceTIMER_CREATE_FAILED\r
-#define traceTIMER_CREATE_FAILED() \\r
-       trcKERNEL_HOOKS_TIMER_EVENT(TIMER_CREATE_FAILED, 0);\r
-               \r
-/* Note that xCommandID can never be tmrCOMMAND_EXECUTE_CALLBACK (-1) since the trace macro is not called in that case */\r
-#undef traceTIMER_COMMAND_SEND\r
-#define traceTIMER_COMMAND_SEND(tmr, xCommandID, xOptionalValue, xReturn) \\r
-if (xCommandID > tmrCOMMAND_START_DONT_TRACE){\\r
-               if (xCommandID == tmrCOMMAND_CHANGE_PERIOD) vTraceStoreKernelCallWithParam((xReturn == pdPASS) ? TIMER_CHANGE_PERIOD : TIMER_CHANGE_PERIOD_FAILED, TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(tmr), xOptionalValue);\\r
-               else if ((xCommandID == tmrCOMMAND_DELETE) && (xReturn == pdPASS)){ trcKERNEL_HOOKS_TIMER_DELETE(TIMER_DELETE, tmr); } \\r
-               else {trcKERNEL_HOOKS_TIMER_EVENT(EVENTGROUP_TIMER + xCommandID + ((xReturn == pdPASS)?0:(TIMER_CREATE_FAILED - TIMER_CREATE)), tmr); }\\r
-}\r
-\r
-#undef tracePEND_FUNC_CALL\r
-#define tracePEND_FUNC_CALL(func, arg1, arg2, ret) \\r
-if (ret == pdPASS) \\r
-       vTraceStoreKernelCall(PEND_FUNC_CALL, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) ); \\r
-else \\r
-       vTraceStoreKernelCall(PEND_FUNC_CALL_FAILED, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) );\r
-       \r
-#undef tracePEND_FUNC_CALL_FROM_ISR\r
-#define tracePEND_FUNC_CALL_FROM_ISR(func, arg1, arg2, ret) \\r
-       if (! uiInEventGroupSetBitsFromISR) vTraceStoreKernelCall(PEND_FUNC_CALL_FROM_ISR, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) ); \\r
-       uiInEventGroupSetBitsFromISR = 0;\r
-\r
-#undef traceEVENT_GROUP_CREATE\r
-#define traceEVENT_GROUP_CREATE(eg) \\r
-       TRACE_SET_EVENTGROUP_NUMBER(eg); \\r
-       vTraceStoreKernelCall(EVENT_GROUP_CREATE, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg));\r
-\r
-#undef traceEVENT_GROUP_DELETE\r
-#define traceEVENT_GROUP_DELETE(eg) \\r
-       vTraceStoreKernelCall(EVENT_GROUP_DELETE, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg)); \\r
-       vTraceStoreObjectNameOnCloseEvent(TRACE_GET_EVENTGROUP_NUMBER(eg), TRACE_CLASS_EVENTGROUP); \\r
-       vTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_EVENTGROUP_NUMBER(eg), TRACE_CLASS_EVENTGROUP); \\r
-       vTraceFreeObjectHandle(TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg));\r
-\r
-#undef traceEVENT_GROUP_CREATE_FAILED\r
-#define traceEVENT_GROUP_CREATE_FAILED() \\r
-       vTraceStoreKernelCall(EVENT_GROUP_CREATE_FAILED, TRACE_CLASS_EVENTGROUP, 0);\r
-\r
-#undef traceEVENT_GROUP_SYNC_BLOCK\r
-#define traceEVENT_GROUP_SYNC_BLOCK(eg, bitsToSet, bitsToWaitFor) \\r
-       vTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_BLOCK, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor);\r
-\r
-#undef traceEVENT_GROUP_SYNC_END\r
-#define traceEVENT_GROUP_SYNC_END(eg, bitsToSet, bitsToWaitFor, wasTimeout) \\r
-       if (wasTimeout){ vTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_END_FAILED, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor);} \\r
-       else{ vTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_END, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); }\r
-\r
-#undef traceEVENT_GROUP_WAIT_BITS_BLOCK\r
-#define traceEVENT_GROUP_WAIT_BITS_BLOCK(eg, bitsToWaitFor) \\r
-       vTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_BLOCK, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); \\r
-       trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();\r
-\r
-#undef traceEVENT_GROUP_WAIT_BITS_END\r
-#define traceEVENT_GROUP_WAIT_BITS_END(eg, bitsToWaitFor, wasTimeout) \\r
-       if (wasTimeout){ vTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_END_FAILED, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); } \\r
-       else{ vTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_END, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); }\r
-       \r
-#undef traceEVENT_GROUP_CLEAR_BITS\r
-#define traceEVENT_GROUP_CLEAR_BITS(eg, bitsToClear) \\r
-       if (bitsToClear) vTraceStoreKernelCallWithParam(EVENT_GROUP_CLEAR_BITS, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToClear);\r
-\r
-#undef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR\r
-#define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR(eg, bitsToClear) \\r
-       if (bitsToClear) vTraceStoreKernelCallWithParam(EVENT_GROUP_CLEAR_BITS_FROM_ISR, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToClear);\r
-\r
-#undef traceEVENT_GROUP_SET_BITS\r
-#define traceEVENT_GROUP_SET_BITS(eg, bitsToSet) \\r
-       vTraceStoreKernelCallWithParam(EVENT_GROUP_SET_BITS, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToSet);\r
-\r
-#undef traceEVENT_GROUP_SET_BITS_FROM_ISR\r
-#define traceEVENT_GROUP_SET_BITS_FROM_ISR(eg, bitsToSet) \\r
-       vTraceStoreKernelCallWithParam(EVENT_GROUP_SET_BITS_FROM_ISR, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToSet); \\r
-       uiInEventGroupSetBitsFromISR = 1;\r
-       \r
-#if (INCLUDE_MEMMANG_EVENTS == 1)\r
-\r
-extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, uint32_t size);\r
-\r
-#undef traceMALLOC\r
-#define traceMALLOC( pvAddress, uiSize ) {vTraceStoreMemMangEvent(MEM_MALLOC_SIZE, ( uint32_t ) pvAddress, uiSize); TRACE_INCR_HEAP_USAGE(uiSize);}\r
-\r
-       \r
-#undef traceFREE\r
-#define traceFREE( pvAddress, uiSize ) {vTraceStoreMemMangEvent(MEM_FREE_SIZE, ( uint32_t ) pvAddress, uiSize); TRACE_DECR_HEAP_USAGE(uiSize);}\r
-\r
-#endif\r
-\r
-/************************************************************************/\r
-/* KERNEL SPECIFIC MACROS TO EXCLUDE OR INCLUDE THINGS IN TRACE         */\r
-/************************************************************************/\r
-\r
-/* Returns the exclude state of the object */\r
-uint8_t uiTraceIsObjectExcluded(traceObjectClass objectclass, objectHandleType handle);\r
-\r
-#define TRACE_SET_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, queueIndex)\r
-#define TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, queueIndex)\r
-#define TRACE_GET_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, queueIndex)\r
-\r
-#define TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+semaphoreIndex)\r
-#define TRACE_CLEAR_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+semaphoreIndex)\r
-#define TRACE_GET_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+semaphoreIndex)\r
-\r
-#define TRACE_SET_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+mutexIndex)\r
-#define TRACE_CLEAR_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+mutexIndex)\r
-#define TRACE_GET_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+mutexIndex)\r
-\r
-#define TRACE_SET_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+taskIndex)\r
-#define TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+taskIndex)\r
-#define TRACE_GET_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+taskIndex)\r
-\r
-#define TRACE_SET_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+timerIndex)\r
-#define TRACE_CLEAR_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+timerIndex)\r
-#define TRACE_GET_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+timerIndex)\r
-\r
-#define TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+NTimer+1+egIndex)\r
-#define TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+NTimer+1+egIndex)\r
-#define TRACE_GET_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+NTimer+1+egIndex)\r
-\r
-\r
-#define TRACE_CLEAR_OBJECT_FLAG_ISEXCLUDED(objectclass, handle) \\r
-switch (objectclass) \\r
-{ \\r
-case TRACE_CLASS_QUEUE: \\r
-       TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(handle); \\r
-       break; \\r
-case TRACE_CLASS_SEMAPHORE: \\r
-       TRACE_CLEAR_SEMAPHORE_FLAG_ISEXCLUDED(handle); \\r
-       break; \\r
-case TRACE_CLASS_MUTEX: \\r
-       TRACE_CLEAR_MUTEX_FLAG_ISEXCLUDED(handle); \\r
-       break; \\r
-case TRACE_CLASS_TASK: \\r
-       TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(handle); \\r
-       break; \\r
-case TRACE_CLASS_TIMER: \\r
-       TRACE_CLEAR_TIMER_FLAG_ISEXCLUDED(handle); \\r
-       break; \\r
-case TRACE_CLASS_EVENTGROUP: \\r
-       TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(handle); \\r
-       break; \\r
-}\r
-\r
-#define TRACE_SET_OBJECT_FLAG_ISEXCLUDED(objectclass, handle) \\r
-switch (objectclass) \\r
-{ \\r
-case TRACE_CLASS_QUEUE: \\r
-       TRACE_SET_QUEUE_FLAG_ISEXCLUDED(handle); \\r
-       break; \\r
-case TRACE_CLASS_SEMAPHORE: \\r
-       TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(handle); \\r
-       break; \\r
-case TRACE_CLASS_MUTEX: \\r
-       TRACE_SET_MUTEX_FLAG_ISEXCLUDED(handle); \\r
-       break; \\r
-case TRACE_CLASS_TASK: \\r
-       TRACE_SET_TASK_FLAG_ISEXCLUDED(handle); \\r
-       break; \\r
-case TRACE_CLASS_TIMER: \\r
-       TRACE_SET_TIMER_FLAG_ISEXCLUDED(handle); \\r
-       break; \\r
-case TRACE_CLASS_EVENTGROUP: \\r
-       TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(handle); \\r
-       break; \\r
-}\r
-\r
-/* Task */\r
-#define vTraceExcludeTaskFromTrace(handle) \\r
-TRACE_SET_TASK_FLAG_ISEXCLUDED(TRACE_GET_TASK_NUMBER(handle));\r
-\r
-#define vTraceIncludeTaskInTrace(handle) \\r
-TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(TRACE_GET_TASK_NUMBER(handle));\r
-\r
-\r
-/* Queue */\r
-#define vTraceExcludeQueueFromTrace(handle) \\r
-TRACE_SET_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle));\r
-\r
-#define vTraceIncludeQueueInTrace(handle) \\r
-TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle));\r
-\r
-\r
-/* Semaphore */\r
-#define vTraceExcludeSemaphoreFromTrace(handle) \\r
-TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle));\r
-\r
-#define vTraceIncludeSemaphoreInTrace(handle) \\r
-TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle));\r
-\r
-\r
-/* Mutex */\r
-#define vTraceExcludeMutexFromTrace(handle) \\r
-TRACE_SET_MUTEX_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle));\r
-\r
-#define vTraceIncludeMutexInTrace(handle) \\r
-TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle));\r
-\r
-/* Timer */\r
-#define vTraceExcludeTimerFromTrace(handle) \\r
-TRACE_SET_TIMER_FLAG_ISEXCLUDED(TRACE_GET_TIMER_NUMBER(handle));\r
-\r
-#define vTraceIncludeTimerInTrace(handle) \\r
-TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_TIMER_NUMBER(handle));\r
-\r
-/* Event Group */\r
-#define vTraceExcludeEventGroupFromTrace(handle) \\r
-TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(TRACE_GET_EVENTGROUP_NUMBER(handle));\r
-\r
-#define vTraceIncludeEventGroupInTrace(handle) \\r
-TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(TRACE_GET_EVENTGROUP_NUMBER(handle));\r
-\r
-\r
-/* Kernel Services */\r
-#define vTraceExcludeKernelServiceDelayFromTrace() \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY); \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY_UNTIL);\r
-\r
-#define vTraceIncludeKernelServiceDelayInTrace() \\r
-TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY); \\r
-TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY_UNTIL);\r
-\r
-/* HELPER MACROS FOR KERNEL SERVICES FOR OBJECTS */\r
-#define vTraceExcludeKernelServiceSendFromTrace_HELPER(class) \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_SUCCESS + class); \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_BLOCK + class); \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FAILED + class); \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_SUCCESS + class); \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_FAILED + class);\r
-\r
-#define vTraceIncludeKernelServiceSendInTrace_HELPER(class) \\r
-TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_SUCCESS + class); \\r
-TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_BLOCK + class); \\r
-TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FAILED + class); \\r
-TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_SUCCESS + class); \\r
-TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_FAILED + class);\r
-\r
-#define vTraceExcludeKernelServiceReceiveFromTrace_HELPER(class) \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_SUCCESS + class); \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_BLOCK + class); \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FAILED + class); \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS + class); \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_FAILED + class);\r
-\r
-#define vTraceIncludeKernelServiceReceiveInTrace_HELPER(class) \\r
-TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_SUCCESS + class); \\r
-TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_BLOCK + class); \\r
-TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FAILED + class); \\r
-TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS + class); \\r
-TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_FAILED + class);\r
-\r
-/* EXCLUDE AND INCLUDE FOR QUEUE */\r
-#define vTraceExcludeKernelServiceQueueSendFromTrace() \\r
-vTraceExcludeKernelServiceSendFromTrace_HELPER(TRACE_CLASS_QUEUE);\r
-\r
-#define vTraceIncludeKernelServiceQueueSendInTrace() \\r
-vTraceIncludeKernelServiceSendInTrace_HELPER(TRACE_CLASS_QUEUE);\r
-\r
-#define vTraceExcludeKernelServiceQueueReceiveFromTrace() \\r
-vTraceExcludeKernelServiceReceiveFromTrace_HELPER(TRACE_CLASS_QUEUE);\r
-\r
-#define vTraceIncludeKernelServiceQueueReceiveInTrace() \\r
-vTraceIncludeKernelServiceReceiveInTrace_HELPER(TRACE_CLASS_QUEUE);\r
-\r
-/* EXCLUDE AND INCLUDE FOR SEMAPHORE */\r
-#define vTraceExcludeKernelServiceSemaphoreSendFromTrace() \\r
-vTraceExcludeKernelServiceSendFromTrace_HELPER(TRACE_CLASS_SEMAPHORE);\r
-\r
-#define vTraceIncludeKernelServicSemaphoreSendInTrace() \\r
-vTraceIncludeKernelServiceSendInTrace_HELPER(TRACE_CLASS_SEMAPHORE);\r
-\r
-#define vTraceExcludeKernelServiceSemaphoreReceiveFromTrace() \\r
-vTraceExcludeKernelServiceReceiveFromTrace_HELPER(TRACE_CLASS_SEMAPHORE);\r
-\r
-#define vTraceIncludeKernelServiceSemaphoreReceiveInTrace() \\r
-vTraceIncludeKernelServiceReceiveInTrace_HELPER(TRACE_CLASS_SEMAPHORE);\r
-\r
-/* EXCLUDE AND INCLUDE FOR MUTEX */\r
-#define vTraceExcludeKernelServiceMutexSendFromTrace() \\r
-vTraceExcludeKernelServiceSendFromTrace_HELPER(TRACE_CLASS_MUTEX);\r
-\r
-#define vTraceIncludeKernelServiceMutexSendInTrace() \\r
-vTraceIncludeKernelServiceSendInTrace_HELPER(TRACE_CLASS_MUTEX);\r
-\r
-#define vTraceExcludeKernelServiceMutexReceiveFromTrace() \\r
-vTraceExcludeKernelServiceReceiveFromTrace_HELPER(TRACE_CLASS_MUTEX);\r
-\r
-#define vTraceIncludeKernelServiceMutexReceiveInTrace() \\r
-vTraceIncludeKernelServiceReceiveInTrace_HELPER(TRACE_CLASS_MUTEX);\r
-\r
-/************************************************************************/\r
-/* KERNEL SPECIFIC MACROS TO NAME OBJECTS, IF NECESSARY                 */\r
-/************************************************************************/\r
-#define vTraceSetQueueName(object, name) \\r
-vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name);\r
-\r
-#define vTraceSetSemaphoreName(object, name) \\r
-vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name);\r
-\r
-#define vTraceSetMutexName(object, name) \\r
-vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name);\r
-\r
-#define vTraceSetEventGroupName(object, name) \\r
-vTraceSetObjectName(TRACE_CLASS_EVENTGROUP, uxEventGroupGetNumber(object), name);\r
-\r
-#undef traceQUEUE_REGISTRY_ADD\r
-#define traceQUEUE_REGISTRY_ADD(object, name) vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name);\r
-#endif\r
+/* Change the included file below, if using the recorder with other kernels */\r
 \r
-#endif /* TRCKERNELPORT_H_ */
\ No newline at end of file
+#include "trcKernelPortFreeRTOS.h"\r
+/* #include "trcKernelPort<OTHERKERNEL>.h" */\r
index f1d434a98f49bcf6aac534e6617dd51b28b9a58f..41a2b0ec637b54dce8eb04646e76f4abb2970e5f 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Tracealyzer v2.6.0 Recorder Library\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcTypes.h\r
@@ -31,7 +31,9 @@
  * 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
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2014.\r
  * www.percepio.com\r
  ******************************************************************************/\r
 \r
index dba4432e6fecff356240f3ecc7ea09e3b046e57f..a2682e6814cb03816d200e4f3c01a382758cecae 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Tracealyzer v2.6.0 Recorder Library\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcUser.h\r
@@ -30,7 +30,9 @@
  * 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
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2014.\r
  * www.percepio.com\r
  ******************************************************************************/\r
 \r
@@ -82,6 +84,13 @@ void vTraceInitTraceData(void);
 void vTraceSetRecorderData(void* pRecorderData);\r
 #endif\r
 \r
+/*******************************************************************************\r
+ * vTraceSetStopHook\r
+ *\r
+ * Sets a function to be called when the recorder is stopped.\r
+ ******************************************************************************/\r
+void vTraceSetStopHook(TRACE_STOP_HOOK stopHookFunction);\r
+\r
 /*******************************************************************************\r
  * uiTraceStart\r
  *\r
@@ -154,21 +163,17 @@ void vTraceClearError(int resetErrorMessage);
  * started.\r
  *\r
  * Example:\r
- *     #define ID_ISR_TIMER1 1       // lowest valid ID is 1\r
- *     #define PRIO_OF_ISR_TIMER1 3  // the hardware priority of the interrupt\r
- *     ...\r
- *     vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);\r
- *     ...\r
- *     void ISR_handler()\r
- *     {\r
- *         portENTER_CRITICAL(); // Required if nested ISRs are allowed\r
- *         vTraceStoreISRBegin(ID_OF_ISR_TIMER1);\r
- *         portEXIT_CRITICAL();\r
- *         ...\r
- *         portENTER_CRITICAL(); // Required if nested ISRs are allowed\r
- *         vTraceStoreISREnd();\r
- *         portEXIT_CRITICAL();\r
- *     }\r
+ *      #define ID_ISR_TIMER1 1                // lowest valid ID is 1\r
+ *      #define PRIO_OF_ISR_TIMER1 3 // the hardware priority of the interrupt\r
+ *      ...\r
+ *      vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);\r
+ *      ...\r
+ *      void ISR_handler()\r
+ *      {\r
+ *              vTraceStoreISRBegin(ID_OF_ISR_TIMER1);\r
+ *              ...\r
+ *              vTraceStoreISREnd(0);\r
+ *      }\r
  ******************************************************************************/\r
 void vTraceSetISRProperties(objectHandleType handle, const char* name, char priority);\r
 \r
@@ -179,21 +184,17 @@ void vTraceSetISRProperties(objectHandleType handle, const char* name, char prio
  * If allowing nested ISRs, this must be called with interrupts disabled.\r
  *\r
  * Example:\r
- *     #define ID_ISR_TIMER1 1       // lowest valid ID is 1\r
- *     #define PRIO_OF_ISR_TIMER1 3  // the hardware priority of the interrupt\r
- *     ...\r
- *     vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);\r
- *     ...\r
- *     void ISR_handler()\r
- *     {\r
- *         portENTER_CRITICAL(); // Required if nested ISRs are allowed\r
- *         vTraceStoreISRBegin(ID_OF_ISR_TIMER1);\r
- *         portEXIT_CRITICAL();\r
- *         ...\r
- *         portENTER_CRITICAL(); // Required if nested ISRs are allowed\r
- *         vTraceStoreISREnd();\r
- *         portEXIT_CRITICAL();\r
- *     }\r
+ *      #define ID_ISR_TIMER1 1                // lowest valid ID is 1\r
+ *      #define PRIO_OF_ISR_TIMER1 3 // the hardware priority of the interrupt\r
+ *      ...\r
+ *      vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);\r
+ *      ...\r
+ *      void ISR_handler()\r
+ *      {\r
+ *              vTraceStoreISRBegin(ID_OF_ISR_TIMER1);\r
+ *              ...\r
+ *              vTraceStoreISREnd(0);\r
+ *      }\r
  *\r
  ******************************************************************************/\r
 void vTraceStoreISRBegin(objectHandleType id);\r
@@ -203,30 +204,27 @@ void vTraceStoreISRBegin(objectHandleType id);
  *\r
  * Registers the end of an Interrupt Service Routine.\r
  *\r
- * If allowing nested ISRs, this must be called with interrupts disabled.\r
+ * The parameter pendingISR indicates if the interrupt has requested a\r
+ * task-switch (= 1) or if the interrupt returns to the earlier context (= 0)\r
  *\r
  * Example:\r
- *     #define ID_ISR_TIMER1 1       // lowest valid ID is 1\r
- *     #define PRIO_OF_ISR_TIMER1 3  // the hardware priority of the interrupt\r
- *     ...\r
- *     vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);\r
- *     ...\r
- *     void ISR_handler()\r
- *     {\r
- *         portENTER_CRITICAL(); // Required if nested ISRs are allowed\r
- *         vTraceStoreISRBegin(ID_OF_ISR_TIMER1);\r
- *         portEXIT_CRITICAL();\r
- *         ...\r
- *         portENTER_CRITICAL(); // Required if nested ISRs are allowed\r
- *         vTraceStoreISREnd();\r
- *         portEXIT_CRITICAL();\r
- *     }\r
+ *      #define ID_ISR_TIMER1 1          // lowest valid ID is 1\r
+ *      #define PRIO_OF_ISR_TIMER1 3 // the hardware priority of the interrupt\r
+ *      ...\r
+ *      vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);\r
+ *      ...\r
+ *      void ISR_handler()\r
+ *      {\r
+ *              vTraceStoreISRBegin(ID_OF_ISR_TIMER1);\r
+ *              ...\r
+ *              vTraceStoreISREnd(0);\r
+ *      }\r
  *\r
  ******************************************************************************/\r
-void vTraceStoreISREnd(void);\r
+void vTraceStoreISREnd(int pendingISR);\r
 \r
 #else\r
-   /* If not including the ISR recording */\r
+       /* If not including the ISR recording */\r
 \r
 void vTraceIncreaseISRActive(void);\r
 \r
@@ -238,28 +236,59 @@ void vTraceDecreaseISRActive(void);
 \r
 #endif\r
 \r
-/*******************************************************************************\r
- * vvTraceTaskSkipDefaultInstanceFinishedEvents\r
- *\r
- * This is useful if there are implicit Instance Finish Events, such as\r
- * vTaskDelayUntil or xQueueReceive, in a task where an explicit Instance Finish\r
- * Event has been defined. This function tells the recorder that only the\r
- * explicitly defined functions (using vTraceTaskInstanceIsFinished) should be\r
- * treated as Instance Finish Events for this task. The implicit Instance Finish\r
- * Events are thus disregarded for this task.\r
- ******************************************************************************/\r
-void vTraceTaskSkipDefaultInstanceFinishedEvents(void);\r
 \r
-/*******************************************************************************\r
- * vTraceTaskInstanceIsFinished\r
+/******************************************************************************\r
+ * vTraceTaskInstanceFinish(void)\r
  *\r
- * This defines an explicit Instance Finish Event for the current task. It tells\r
- * the recorder that the current instance of this task is finished at the next\r
- * kernel call of the task, e.g., a taskDelay or a queue receive. This function\r
- * should be called right before the api function call considered to be the end\r
- * of the task instamce, i.e., the Instance Finish Event.\r
- ******************************************************************************/\r
-void vTraceTaskInstanceIsFinished(void);\r
+ * Marks the current task instance as finished on the next kernel call.\r
+ *\r
+ * If that kernel call is blocking, the instance ends after the blocking event\r
+ * and the corresponding return event is then the start of the next instance.\r
+ * If the kernel call is not blocking, the viewer instead splits the current\r
+ * fragment right before the kernel call, which makes this call the first event\r
+ * of the next instance.\r
+ *\r
+ * See also USE_IMPLICIT_IFE_RULES in trcConfig.h\r
+ *\r
+ * Example:\r
+ *\r
+ *             while(1)\r
+ *             {\r
+ *                     xQueueReceive(CommandQueue, &command, timeoutDuration);\r
+ *                     processCommand(command);\r
+ *          vTraceInstanceFinish();\r
+ *             }\r
+ *\r
+ *****************************************************************************/\r
+void vTraceTaskInstanceFinish(void);\r
+\r
+/******************************************************************************\r
+ * vTraceTaskInstanceFinishDirect(void)\r
+ *\r
+ * Marks the current task instance as finished at this very instant.\r
+ * This makes the viewer to splits the current fragment at this point and begin\r
+ * a new actor instance.\r
+ *\r
+ * See also USE_IMPLICIT_IFE_RULES in trcConfig.h\r
+ *\r
+ * Example:\r
+ *\r
+ *             This example will generate two instances for each loop iteration.\r
+ *             The first instance ends at vTraceInstanceFinishDirect(), while the second\r
+ *      instance ends at the next xQueueReceive call.\r
+ *\r
+ *             while (1)\r
+ *             {\r
+ *          xQueueReceive(CommandQueue, &command, timeoutDuration);\r
+ *                     ProcessCommand(command);\r
+ *                     vTraceInstanceFinishDirect();\r
+ *                     DoSometingElse();\r
+ *          vTraceInstanceFinish();\r
+ *      }\r
+ *\r
+ *\r
+ *****************************************************************************/\r
+void vTraceTaskInstanceFinishDirect(void);\r
 \r
 /*******************************************************************************\r
  * vTraceGetTraceBuffer\r
@@ -292,7 +321,7 @@ uint32_t uiTraceGetTraceBufferSize(void);
  * When logging a user event, a numeric handle (reference) to this string is\r
  * used to identify the event. This is obtained by calling\r
  *\r
- *     xTraceOpenLabel()\r
+ *      xTraceOpenLabel()\r
  *\r
  * whihc adds the string to the symbol table (if not already present)\r
  * and returns the corresponding handle.\r
@@ -302,15 +331,15 @@ uint32_t uiTraceGetTraceBufferSize(void);
  * 1. The handle is looked up every time, when storing the user event.\r
  *\r
  * Example:\r
- *     vTraceUserEvent(xTraceOpenLabel("MyUserEvent"));\r
+ *      vTraceUserEvent(xTraceOpenLabel("MyUserEvent"));\r
  *\r
  * 2. The label is registered just once, with the handle stored in an\r
- *  application variable - much like using a file handle.\r
+ * application variable - much like using a file handle.\r
  *\r
  * Example:\r
- *     myEventHandle = xTraceOpenLabel("MyUserEvent");\r
- *     ...\r
- *     vTraceUserEvent(myEventHandle);\r
+ *      myEventHandle = xTraceOpenLabel("MyUserEvent");\r
+ *      ...\r
+ *      vTraceUserEvent(myEventHandle);\r
  *\r
  * The second option is faster since no lookup is required on each event, and\r
  * therefore recommended for user events that are frequently\r
@@ -342,17 +371,17 @@ void vTraceUserEvent(traceLabel eventLabel);
  * User Event labels are created using xTraceOpenLabel.\r
  * Example:\r
  *\r
- *     traceLabel adc_uechannel = xTraceOpenLabel("ADC User Events");\r
- *     ...\r
- *     vTracePrint(adc_uechannel,\r
- *                 "ADC channel %d: %lf volts",\r
- *                 ch, (double)adc_reading/(double)scale);\r
+ *      traceLabel adc_uechannel = xTraceOpenLabel("ADC User Events");\r
+ *      ...\r
+ *      vTracePrint(adc_uechannel,\r
+ *                              "ADC channel %d: %lf volts",\r
+ *                              ch, (double)adc_reading/(double)scale);\r
  *\r
  * This can be combined into one line, if desired, but this is slower:\r
  *\r
- *     vTracePrint(xTraceOpenLabel("ADC User Events"),\r
- *                 "ADC channel %d: %lf volts",\r
- *                 ch, (double)adc_reading/(double)scale);\r
+ *      vTracePrint(xTraceOpenLabel("ADC User Events"),\r
+ *                              "ADC channel %d: %lf volts",\r
+ *                              ch, (double)adc_reading/(double)scale);\r
  *\r
  * Calling xTraceOpenLabel multiple times will not create duplicate entries, but\r
  * it is of course faster to just do it once, and then keep the handle for later\r
@@ -360,15 +389,15 @@ void vTraceUserEvent(traceLabel eventLabel);
  * better to use vTraceUserEvent - it is faster.\r
  *\r
  * Format specifiers supported:\r
- *  %d - 32 bit signed integer\r
- *  %u - 32 bit unsigned integer\r
- *  %f - 32 bit float\r
- *  %s - string (is copied to the recorder symbol table)\r
- *  %hd - 16 bit signed integer\r
- *  %hu - 16 bit unsigned integer\r
- *  %bd - 8 bit signed integer\r
- *  %bu - 8 bit unsigned integer\r
- *  %lf - double-precision float (Note! See below...)\r
+ * %d - 32 bit signed integer\r
+ * %u - 32 bit unsigned integer\r
+ * %f - 32 bit float\r
+ * %s - string (is copied to the recorder symbol table)\r
+ * %hd - 16 bit signed integer\r
+ * %hu - 16 bit unsigned integer\r
+ * %bd - 8 bit signed integer\r
+ * %bu - 8 bit unsigned integer\r
+ * %lf - double-precision float (Note! See below...)\r
  *\r
  * Up to 15 data arguments are allowed, with a total size of maximum 32 byte.\r
  * In case this is exceeded, the user event is changed into an error message.\r
@@ -380,7 +409,7 @@ void vTraceUserEvent(traceLabel eventLabel);
  * unless the higher precision is really necessary.\r
  *\r
  * Note that the double-precision float (%lf) assumes a 64 bit double\r
- * representation. This does not seem to be the case on e.g. PIC24F.\r
+ * representation. This does not seem to be the case on e.g. PIC24 and PIC32.\r
  * Before using a %lf argument on a 16-bit MCU, please verify that\r
  * "sizeof(double)" actually gives 8 as expected. If not, use %f instead.\r
  ******************************************************************************/\r
@@ -417,7 +446,6 @@ void vTraceChannelUserEvent(UserEventChannel channel);
 #define vTracePrintF(eventLabel,formatStr,...)\r
 #define vTraceExcludeTaskFromSchedulingTrace(name)\r
 \r
-#define vTraceTaskSkipDefaultInstanceFinishedEvents()\r
 #define vTraceSetISRProperties(handle, name, priority)\r
 #define vTraceStoreISRBegin(id)\r
 #define vTraceStoreISREnd()\r
@@ -427,6 +455,7 @@ void vTraceChannelUserEvent(UserEventChannel channel);
 #define vTraceSetSemaphoreName(a, b)\r
 #define vTraceSetEventGroupName(a, b)\r
 \r
+#define vTraceSetStopHook(a)\r
 #endif\r
 \r
 #ifdef __cplusplus\r
index 2c6c551955626362e69aa9c6ce65c06e6c8b4bf4..44b321fefc1bd69ced64984b7d104b1de865ba79 100644 (file)
@@ -4,21 +4,22 @@ Tracealyzer Trace Recorder Library
 Percepio AB\r
 www.percepio.com\r
 \r
-This directory contains the a generic trace recorder library for Tracealyzer v2.6\r
+This directory contains the a generic trace recorder library for Tracealyzer v2.7\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
+Tracealyzer, see the User Manual (e.g., http://percepio.com/docs/FreeRTOS/manual/Recorder.html)\r
 \r
 Files included\r
 --------------\r
-- trcConfig.h             - The recorder's configuration file, set your recorder configuration here!\r
-- trcUser.c/.h            - The main API towards the application (trcUser.h in the only include necessary).\r
-- trcKernel.c/.h          - Internal routines for storing kernel events.\r
-- trcBase.c/.h            - Internal routines for manipulating the data structures and calculating timestamps.\r
-- trcHardwarePort.c/.h    - The hardware interface, especially for timestamping.\r
-- trcKernelPort.c/.h      - Kernel specific implementations of macros and data.\r
-- trcKernelHooks.h        - The trace macro defines (OS independent).\r
-- trcTypes.h              - Type definitions used.\r
+- trcConfig.h                          - The recorder's configuration file, set your recorder configuration here!\r
+- trcUser.c/.h                         - The main API towards the application (trcUser.h in the only include necessary).\r
+- trcKernel.c/.h                       - Internal routines for storing kernel events.\r
+- trcBase.c/.h                         - Internal routines for manipulating the data structures and calculating timestamps.\r
+- trcHardwarePort.c/.h                 - The hardware interface, especially for timestamping.\r
+- trcKernelPort.h                              - Wrapper for trcKernelPortFreeRTOS.h (for portability).\r
+- trcKernelPortFreeRTOS.c/.h   - FreeRTOS-specific trace macros and helper functions.\r
+- trcKernelHooks.h                     - Generic trace macros (OS independent), used by trcKernelPortFreeRTOS.\r
+- trcTypes.h                           - Type definitions used.\r
 \r
 Hardware Timer Ports\r
 --------------------\r
@@ -29,17 +30,19 @@ This release contains hardware timer ports for the following hardware architectu
 - Atmel AT32UC3 (AVR32)\r
 - Renesas RX600 (e.g., RX62N)\r
 - Microchip dsPIC/PIC24\r
-- Microchip PIC32\r
+- Microchip PIC32MX\r
+- Microchip PIC32MZ\r
 - NXP LPC2106\r
 - Texas Instruments TMS570 (Cortex-R4)\r
 - Texas Instruments MSP430\r
 - Xilinx PowerPC 405\r
 - Xilinx PowerPC 440\r
 - Xilinx Microblaze\r
+- ARM Cortex-A9\r
 \r
 These are defined in trcHardwarePort.h. Some of these are "unofficial" ports, provided by external contributors.\r
 By unofficial, it means that they are not yet verified by Percepio AB. Please refer to trcHardwarePort.h for detailed information. \r
-If you use an unofficial port and beleive it is incorrect, please let us know! (support@percepio.com)\r
+If you use an unofficial port and believe it is incorrect, please let us know! (support@percepio.com)\r
 \r
 In case your MCU is not yet supported directly, developing a new port is quite easy, just a matter of defining a few macros\r
 according to your specific MCU. See trcHardwarePort.h for further information.\r
index be5f935308839f458fd6570c9d5988f59d382cd3..57afa6483f92ec6990a1a15980a828d37e20931a 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Tracealyzer v2.6.0 Recorder Library\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcBase.c\r
@@ -31,7 +31,9 @@
  * 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
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2014.\r
  * www.percepio.com\r
  ******************************************************************************/\r
 \r
  * Static data initializations\r
  ******************************************************************************/\r
 \r
-/* Structure to handle the exclude flags for all objects and tasks. We add some extra objects since index 0 is not used for each object class. */\r
+/* Tasks and kernel objects can be explicitly excluded from the trace to reduce\r
+buffer usage. This structure handles the exclude flags for all objects and tasks. \r
+Note that slot 0 is not used, since not a valid handle. */\r
 uint8_t excludedObjects[(TRACE_KERNEL_OBJECT_COUNT + TRACE_NCLASSES) / 8 + 1] = { 0 };\r
 \r
-/* Structure to handle the exclude flags for all event codes */\r
+/* Specific events can also be excluded, i.e., by the event code. This can be\r
+used to exclude kernel calls that don't refer to a kernel object, like a delay.\r
+This structure handle the exclude flags for all event codes */\r
 uint8_t excludedEventCodes[NEventCodes / 8 + 1] = { 0 };\r
 \r
-/* Keeps track of available handles */\r
+/* A set of stacks that keeps track of available object handles for each class.\r
+The stacks are empty initially, meaning that allocation of new handles will be \r
+based on a counter (for each object class). Any delete operation will\r
+return the handle to the corresponding stack, for reuse on the next allocate.*/\r
 objectHandleStackType objectHandleStacks = { { 0 }, { 0 }, { 0 }, { 0 }, { 0 } };\r
 \r
+/* Initial HWTC_COUNT value, for detecting if the time-stamping source is \r
+enabled. If using the OS periodic timer for time-stamping, this might not \r
+have been configured on the earliest events during the startup. */\r
 uint32_t init_hwtc_count;\r
 \r
 /*******************************************************************************\r
  * RecorderData\r
  *\r
- * The main data structure. This is the data read by Tracealyzer, typically\r
- * through a debugger RAM dump. The recorder access this through the pointer\r
- * RecorderDataPtr, to allow for dynamic memory allocation as well.\r
+ * The main data structure. This is the data read by the Tracealyzer tools, \r
+ * typically through a debugger RAM dump. The recorder uses the pointer \r
+ * RecorderDataPtr for accessing this, to allow for dynamic allocation.\r
  *\r
  * On the NXP LPC17xx you may use the secondary RAM bank (AHB RAM) for this\r
  * purpose. For instance, the LPC1766 has 32 KB AHB RAM which allows for\r
  * allocating a buffer size of at least 7500 events without affecting the main\r
- * RAM. To place RecorderData in this RAM bank, use the below declaration.\r
+ * RAM. To place RecorderData in this RAM bank using IAR Embedded Workbench \r
+ * for ARM, use this pragma right before the declaration:\r
  *\r
- *     #pragma location="AHB_RAM_MEMORY"\r
- *     RecorderDataType RecorderData = ...\r
+ *      #pragma location="AHB_RAM_MEMORY"\r
  *\r
  * This of course works for other hardware architectures with additional RAM\r
- * banks as well, just replace "AHB_RAM_MEMORY" with the name of the right\r
- * address section from the linker file.\r
+ * banks as well, just replace "AHB_RAM_MEMORY" with the section name from the \r
+ * linker .map file, or simply the desired address.\r
  *\r
- * However, to keep trcBase.c portable and still have a preconfigured IAR demo\r
- * using AHB RAM, we don't add the pragma directly in trcBase.c but in a header\r
- * included where the pragma should go. This is used depending on the setting\r
+ * For portability reasons, we don't add the pragma directly in trcBase.c, but \r
+ * in a header file included below. To include this header, you need to enable\r
  * USE_LINKER_PRAGMA, defined in trcConfig.h.\r
  *\r
- * If using GCC, this is instead done by adding a "section" attribute:\r
- *\r
- *     RecorderDataType RecorderData __attribute__ ((section ("name"))) = ...\r
+ * If using GCC, you need to modify the declaration as follows:\r
  *\r
+ *      RecorderDataType RecorderData __attribute__ ((section ("name"))) = ...\r
+ * \r
  * Remember to replace "name" with the correct section name.\r
  ******************************************************************************/\r
 \r
@@ -102,7 +113,7 @@ RecorderDataType* RecorderDataPtr = NULL;
 \r
 /* This version of the function dynamically allocates the trace data */\r
 void prvTraceInitTraceData()\r
-{\r
+{              \r
        init_hwtc_count = HWTC_COUNT;\r
        \r
 #if TRACE_DATA_ALLOCATION == TRACE_DATA_ALLOCATION_STATIC\r
@@ -116,62 +127,62 @@ void prvTraceInitTraceData()
 \r
        TRACE_ASSERT(RecorderDataPtr != NULL, "prvTraceInitTraceData, RecorderDataPtr == NULL", );\r
 \r
-    if (! RecorderDataPtr)\r
-    {\r
-        vTraceError("No recorder data structure allocated!");\r
-        return;\r
-    }\r
+       if (! RecorderDataPtr)\r
+       {\r
+               vTraceError("No recorder data structure allocated!");\r
+               return;\r
+       }\r
                \r
-    (void)memset(RecorderDataPtr, 0, sizeof(RecorderDataType));\r
-\r
-    RecorderDataPtr->startmarker0 = 0x00;\r
-    RecorderDataPtr->startmarker1 = 0x01;\r
-    RecorderDataPtr->startmarker2 = 0x02;\r
-    RecorderDataPtr->startmarker3 = 0x03;\r
-    RecorderDataPtr->startmarker4 = 0x70;\r
-    RecorderDataPtr->startmarker5 = 0x71;\r
-    RecorderDataPtr->startmarker6 = 0x72;\r
-    RecorderDataPtr->startmarker7 = 0x73;\r
-    RecorderDataPtr->startmarker8 = 0xF0;\r
-    RecorderDataPtr->startmarker9 = 0xF1;\r
-    RecorderDataPtr->startmarker10 = 0xF2;\r
-    RecorderDataPtr->startmarker11 = 0xF3;\r
-\r
-    RecorderDataPtr->version = TRACE_KERNEL_VERSION;\r
-    RecorderDataPtr->minor_version = TRACE_MINOR_VERSION;\r
-    RecorderDataPtr->irq_priority_order = IRQ_PRIORITY_ORDER;\r
-    RecorderDataPtr->filesize = sizeof(RecorderDataType);\r
-\r
-    RecorderDataPtr->maxEvents = EVENT_BUFFER_SIZE;\r
-\r
-    RecorderDataPtr->debugMarker0 = 0xF0F0F0F0;\r
+       (void)memset(RecorderDataPtr, 0, sizeof(RecorderDataType));\r
+\r
+       RecorderDataPtr->startmarker0 = 0x00;\r
+       RecorderDataPtr->startmarker1 = 0x01;\r
+       RecorderDataPtr->startmarker2 = 0x02;\r
+       RecorderDataPtr->startmarker3 = 0x03;\r
+       RecorderDataPtr->startmarker4 = 0x70;\r
+       RecorderDataPtr->startmarker5 = 0x71;\r
+       RecorderDataPtr->startmarker6 = 0x72;\r
+       RecorderDataPtr->startmarker7 = 0x73;\r
+       RecorderDataPtr->startmarker8 = 0xF0;\r
+       RecorderDataPtr->startmarker9 = 0xF1;\r
+       RecorderDataPtr->startmarker10 = 0xF2;\r
+       RecorderDataPtr->startmarker11 = 0xF3;\r
+\r
+       RecorderDataPtr->version = TRACE_KERNEL_VERSION;\r
+       RecorderDataPtr->minor_version = TRACE_MINOR_VERSION;\r
+       RecorderDataPtr->irq_priority_order = IRQ_PRIORITY_ORDER;\r
+       RecorderDataPtr->filesize = sizeof(RecorderDataType);\r
+\r
+       RecorderDataPtr->maxEvents = EVENT_BUFFER_SIZE;\r
+\r
+       RecorderDataPtr->debugMarker0 = 0xF0F0F0F0;\r
 \r
        RecorderDataPtr->isUsing16bitHandles = USE_16BIT_OBJECT_HANDLES;\r
 \r
        /* This function is kernel specific */\r
        vTraceInitObjectPropertyTable();\r
 \r
-    RecorderDataPtr->debugMarker1 = 0xF1F1F1F1;\r
-    RecorderDataPtr->SymbolTable.symTableSize = SYMBOL_TABLE_SIZE;\r
-    RecorderDataPtr->SymbolTable.nextFreeSymbolIndex = 1;\r
+       RecorderDataPtr->debugMarker1 = 0xF1F1F1F1;\r
+       RecorderDataPtr->SymbolTable.symTableSize = SYMBOL_TABLE_SIZE;\r
+       RecorderDataPtr->SymbolTable.nextFreeSymbolIndex = 1;\r
 #if (INCLUDE_FLOAT_SUPPORT == 1)\r
-    RecorderDataPtr->exampleFloatEncoding = (float)1.0; /* otherwise already zero */\r
+       RecorderDataPtr->exampleFloatEncoding = (float)1.0; /* otherwise already zero */\r
 #endif\r
-    RecorderDataPtr->debugMarker2 = 0xF2F2F2F2;\r
-    (void)strncpy(RecorderDataPtr->systemInfo, TRACE_DESCRIPTION, TRACE_DESCRIPTION_MAX_LENGTH);\r
-    RecorderDataPtr->debugMarker3 = 0xF3F3F3F3;\r
-    RecorderDataPtr->endmarker0 = 0x0A;\r
-    RecorderDataPtr->endmarker1 = 0x0B;\r
-    RecorderDataPtr->endmarker2 = 0x0C;\r
-    RecorderDataPtr->endmarker3 = 0x0D;\r
-    RecorderDataPtr->endmarker4 = 0x71;\r
-    RecorderDataPtr->endmarker5 = 0x72;\r
-    RecorderDataPtr->endmarker6 = 0x73;\r
-    RecorderDataPtr->endmarker7 = 0x74;\r
-    RecorderDataPtr->endmarker8 = 0xF1;\r
-    RecorderDataPtr->endmarker9 = 0xF2;\r
-    RecorderDataPtr->endmarker10 = 0xF3;\r
-    RecorderDataPtr->endmarker11 = 0xF4;\r
+       RecorderDataPtr->debugMarker2 = 0xF2F2F2F2;\r
+       (void)strncpy(RecorderDataPtr->systemInfo, "Trace Recorder Demo", 80);\r
+       RecorderDataPtr->debugMarker3 = 0xF3F3F3F3;\r
+       RecorderDataPtr->endmarker0 = 0x0A;\r
+       RecorderDataPtr->endmarker1 = 0x0B;\r
+       RecorderDataPtr->endmarker2 = 0x0C;\r
+       RecorderDataPtr->endmarker3 = 0x0D;\r
+       RecorderDataPtr->endmarker4 = 0x71;\r
+       RecorderDataPtr->endmarker5 = 0x72;\r
+       RecorderDataPtr->endmarker6 = 0x73;\r
+       RecorderDataPtr->endmarker7 = 0x74;\r
+       RecorderDataPtr->endmarker8 = 0xF1;\r
+       RecorderDataPtr->endmarker9 = 0xF2;\r
+       RecorderDataPtr->endmarker10 = 0xF3;\r
+       RecorderDataPtr->endmarker11 = 0xF4;\r
 \r
 #if USE_SEPARATE_USER_EVENT_BUFFER\r
        RecorderDataPtr->userEventBuffer.bufferID = 1;\r
@@ -215,26 +226,36 @@ char* traceErrorMessage = NULL;
 \r
 void* xTraceNextFreeEventBufferSlot(void)\r
 {\r
-    if (RecorderDataPtr->nextFreeIndex >= EVENT_BUFFER_SIZE)\r
-    {\r
-        vTraceError("Attempt to index outside event buffer!");\r
-        return NULL;\r
-    }\r
-    return (void*)(&RecorderDataPtr->eventData[RecorderDataPtr->nextFreeIndex*4]);\r
+       if (! RecorderDataPtr->recorderActive)\r
+       {\r
+               // If the associated XTS or XPS event prio to the main event has filled the buffer and store mode "stop when full".\r
+               return NULL;\r
+       }\r
+\r
+       if (RecorderDataPtr->nextFreeIndex >= EVENT_BUFFER_SIZE)\r
+       {\r
+               vTraceError("Attempt to index outside event buffer!");\r
+               return NULL;\r
+       }\r
+       return (void*)(&RecorderDataPtr->eventData[RecorderDataPtr->nextFreeIndex*4]);\r
 }\r
 \r
 uint16_t uiIndexOfObject(objectHandleType objecthandle, uint8_t objectclass)\r
 {\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
+       TRACE_ASSERT(objectclass < TRACE_NCLASSES, \r
+               "uiIndexOfObject: Invalid value for objectclass", 0);\r
+       TRACE_ASSERT(objecthandle > 0 && objecthandle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], \r
+               "uiIndexOfObject: Invalid value for objecthandle", 0);\r
 \r
-    if ((objectclass < TRACE_NCLASSES) && (objecthandle > 0) && (objecthandle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass]))\r
-    {\r
-        return (uint16_t)(RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[objectclass] + (RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[objectclass] * (objecthandle-1)));\r
-    }\r
+       if ((objectclass < TRACE_NCLASSES) && (objecthandle > 0) && \r
+               (objecthandle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass]))\r
+       {\r
+               return (uint16_t)(RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[objectclass] + \r
+                       (RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[objectclass] * (objecthandle-1)));\r
+       }\r
 \r
-    vTraceError("Object table lookup with invalid object handle or object class!");\r
-    return 0;\r
+       vTraceError("Object table lookup with invalid object handle or object class!");\r
+       return 0;\r
 }\r
 \r
 /*******************************************************************************\r
@@ -262,73 +283,76 @@ uint16_t uiIndexOfObject(objectHandleType objecthandle, uint8_t objectclass)
 \r
 objectHandleType xTraceGetObjectHandle(traceObjectClass objectclass)\r
 {\r
-    objectHandleType handle;\r
-    static int indexOfHandle;\r
-\r
-       TRACE_ASSERT(objectclass < TRACE_NCLASSES, "xTraceGetObjectHandle: Invalid value for objectclass", (objectHandleType)0);\r
-\r
-    indexOfHandle = objectHandleStacks.indexOfNextAvailableHandle[objectclass];\r
-    if (objectHandleStacks.objectHandles[indexOfHandle] == 0)\r
-    {\r
-        /* Zero is used to indicate a never before used handle, i.e.,\r
-           new slots in the handle stack. The handle slot needs to\r
-           be initialized here (starts at 1). */\r
-        objectHandleStacks.objectHandles[indexOfHandle] =\r
-            (objectHandleType)(1 + indexOfHandle -\r
-            objectHandleStacks.lowestIndexOfClass[objectclass]);\r
-    }\r
-\r
-    handle = objectHandleStacks.objectHandles[indexOfHandle];\r
-\r
-    if (objectHandleStacks.indexOfNextAvailableHandle[objectclass]\r
-        > objectHandleStacks.highestIndexOfClass[objectclass])\r
-    {\r
-        /* ERROR */\r
+       objectHandleType handle;\r
+       static int indexOfHandle;\r
+\r
+       TRACE_ASSERT(objectclass < TRACE_NCLASSES, \r
+               "xTraceGetObjectHandle: Invalid value for objectclass", (objectHandleType)0);\r
+\r
+       indexOfHandle = objectHandleStacks.indexOfNextAvailableHandle[objectclass];\r
+       if (objectHandleStacks.objectHandles[indexOfHandle] == 0)\r
+       {\r
+               /* Zero is used to indicate a never before used handle, i.e.,\r
+                       new slots in the handle stack. The handle slot needs to\r
+                       be initialized here (starts at 1). */\r
+               objectHandleStacks.objectHandles[indexOfHandle] =\r
+                       (objectHandleType)(1 + indexOfHandle -\r
+                       objectHandleStacks.lowestIndexOfClass[objectclass]);\r
+       }\r
+\r
+       handle = objectHandleStacks.objectHandles[indexOfHandle];\r
+\r
+       if (objectHandleStacks.indexOfNextAvailableHandle[objectclass]\r
+               > objectHandleStacks.highestIndexOfClass[objectclass])\r
+       {\r
+               /* ERROR */\r
                vTraceError(pszTraceGetErrorNotEnoughHandles(objectclass));\r
 \r
-        handle = 0; /* an invalid/anonymous handle - but the recorder is stopped now... */\r
-    }\r
-    else\r
-    {\r
-        int hndCount;\r
-        objectHandleStacks.indexOfNextAvailableHandle[objectclass]++;\r
+               handle = 0; /* an invalid/anonymous handle - but the recorder is stopped now... */\r
+       }\r
+       else\r
+       {\r
+               int hndCount;\r
+               objectHandleStacks.indexOfNextAvailableHandle[objectclass]++;\r
 \r
-        hndCount = objectHandleStacks.indexOfNextAvailableHandle[objectclass] -\r
-            objectHandleStacks.lowestIndexOfClass[objectclass];\r
+               hndCount = objectHandleStacks.indexOfNextAvailableHandle[objectclass] -\r
+                       objectHandleStacks.lowestIndexOfClass[objectclass];\r
 \r
-        if (hndCount >\r
-            objectHandleStacks.handleCountWaterMarksOfClass[objectclass])\r
-        {\r
-            objectHandleStacks.handleCountWaterMarksOfClass[objectclass] =\r
-                (objectHandleType)hndCount;\r
-        }\r
+               if (hndCount >\r
+                       objectHandleStacks.handleCountWaterMarksOfClass[objectclass])\r
+               {\r
+                       objectHandleStacks.handleCountWaterMarksOfClass[objectclass] =\r
+                               (objectHandleType)hndCount;\r
+               }\r
 \r
                TRACE_CLEAR_OBJECT_FLAG_ISEXCLUDED(objectclass, handle);\r
-    }\r
+       }\r
 \r
-    return handle;\r
+       return handle;\r
 }\r
 \r
 void vTraceFreeObjectHandle(traceObjectClass objectclass, objectHandleType handle)\r
 {\r
-    int indexOfHandle;\r
-\r
-    TRACE_ASSERT(objectclass < TRACE_NCLASSES, "vTraceFreeObjectHandle: Invalid value for objectclass", );\r
-    TRACE_ASSERT(handle > 0 && handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], "vTraceFreeObjectHandle: Invalid value for handle", );\r
-\r
-    /* Check that there is room to push the handle on the stack */\r
-    if ((objectHandleStacks.indexOfNextAvailableHandle[objectclass] - 1) <\r
-        objectHandleStacks.lowestIndexOfClass[objectclass])\r
-    {\r
-        /* Error */\r
-        vTraceError("Attempt to free more handles than allocated!");\r
-    }\r
-    else\r
-    {\r
-        objectHandleStacks.indexOfNextAvailableHandle[objectclass]--;\r
-        indexOfHandle = objectHandleStacks.indexOfNextAvailableHandle[objectclass];\r
-        objectHandleStacks.objectHandles[indexOfHandle] = handle;\r
-    }\r
+       int indexOfHandle;\r
+\r
+       TRACE_ASSERT(objectclass < TRACE_NCLASSES, \r
+               "vTraceFreeObjectHandle: Invalid value for objectclass", );\r
+       TRACE_ASSERT(handle > 0 && handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], \r
+               "vTraceFreeObjectHandle: Invalid value for handle", );\r
+\r
+       /* Check that there is room to push the handle on the stack */\r
+       if ((objectHandleStacks.indexOfNextAvailableHandle[objectclass] - 1) <\r
+               objectHandleStacks.lowestIndexOfClass[objectclass])\r
+       {\r
+               /* Error */\r
+               vTraceError("Attempt to free more handles than allocated!");\r
+       }\r
+       else\r
+       {\r
+               objectHandleStacks.indexOfNextAvailableHandle[objectclass]--;\r
+               indexOfHandle = objectHandleStacks.indexOfNextAvailableHandle[objectclass];\r
+               objectHandleStacks.objectHandles[indexOfHandle] = handle;\r
+       }\r
 \r
 }\r
 \r
@@ -354,67 +378,66 @@ void vTraceFreeObjectHandle(traceObjectClass objectclass, objectHandleType handl
  * recorder's Object Property Table, at the given handle and object class.\r
  ******************************************************************************/\r
 void vTraceSetObjectName(traceObjectClass objectclass,\r
-                         objectHandleType handle,\r
-                         const char* name)\r
+                                                objectHandleType handle,\r
+                                                const char* name)\r
 {\r
-    static uint16_t idx;\r
+       static uint16_t idx;\r
 \r
        TRACE_ASSERT(name != NULL, "vTraceSetObjectName: name == NULL", );\r
 \r
-    if (objectclass >= TRACE_NCLASSES)\r
-    {\r
-        vTraceError("Illegal object class in vTraceSetObjectName");\r
-        return;\r
-    }\r
-\r
-    if (handle == 0)\r
-    {\r
-        vTraceError("Illegal handle (0) in vTraceSetObjectName.");\r
-        return;\r
-    }\r
-\r
-    if (handle > RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass])\r
-    {\r
-           /* ERROR */\r
-           vTraceError(pszTraceGetErrorNotEnoughHandles(objectclass));\r
-    }\r
-    else\r
-    {\r
-        idx = uiIndexOfObject(handle, objectclass);\r
-\r
-        if (traceErrorMessage == NULL)\r
-        {\r
-            (void)strncpy((char*)&(RecorderDataPtr->ObjectPropertyTable.objbytes[idx]),\r
-                    name,\r
-                    RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[ objectclass ]);\r
-        }\r
-    }\r
+       if (objectclass >= TRACE_NCLASSES)\r
+       {\r
+               vTraceError("Illegal object class in vTraceSetObjectName");\r
+               return;\r
+       }\r
+\r
+       if (handle == 0)\r
+       {\r
+               vTraceError("Illegal handle (0) in vTraceSetObjectName.");\r
+               return;\r
+       }\r
+\r
+       if (handle > RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass])\r
+       {\r
+               /* ERROR */\r
+               vTraceError(pszTraceGetErrorNotEnoughHandles(objectclass));\r
+       }\r
+       else\r
+       {\r
+               idx = uiIndexOfObject(handle, objectclass);\r
+\r
+               if (traceErrorMessage == NULL)\r
+               {\r
+                       (void)strncpy((char*)&(RecorderDataPtr->ObjectPropertyTable.objbytes[idx]),\r
+                               name,\r
+                               RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[ objectclass ]);\r
+               }\r
+       }\r
 }\r
 \r
 traceLabel prvTraceOpenSymbol(const char* name, traceLabel userEventChannel)\r
 {\r
-    uint16_t result;\r
-    uint8_t len;\r
-    uint8_t crc;\r
+       uint16_t result;\r
+       uint8_t len;\r
+       uint8_t crc;\r
        TRACE_SR_ALLOC_CRITICAL_SECTION();\r
        \r
-    len = 0;\r
-    crc = 0;\r
-    \r
-\r
-    TRACE_ASSERT(name != NULL, "prvTraceOpenSymbol: name == NULL", (traceLabel)0);\r
+       len = 0;\r
+       crc = 0;\r
+       \r
+       TRACE_ASSERT(name != NULL, "prvTraceOpenSymbol: name == NULL", (traceLabel)0);\r
 \r
-    prvTraceGetChecksum(name, &crc, &len);\r
+       prvTraceGetChecksum(name, &crc, &len);\r
 \r
-    trcCRITICAL_SECTION_BEGIN();\r
-    result = prvTraceLookupSymbolTableEntry(name, crc, len, userEventChannel);\r
-    if (!result)\r
-    {\r
-        result = prvTraceCreateSymbolTableEntry(name, crc, len, userEventChannel);\r
-    }\r
-    trcCRITICAL_SECTION_END();\r
+       trcCRITICAL_SECTION_BEGIN();\r
+       result = prvTraceLookupSymbolTableEntry(name, crc, len, userEventChannel);\r
+       if (!result)\r
+       {\r
+               result = prvTraceCreateSymbolTableEntry(name, crc, len, userEventChannel);\r
+       }\r
+       trcCRITICAL_SECTION_END();\r
 \r
-    return result;\r
+       return result;\r
 }\r
 \r
 /*******************************************************************************\r
@@ -443,12 +466,12 @@ void vTraceError(const char* msg)
 \r
        RecorderDataPtr->recorderActive = 0;\r
 \r
-    if (traceErrorMessage == NULL)\r
-    {\r
-      traceErrorMessage = (char*)msg;\r
-      (void)strncpy(RecorderDataPtr->systemInfo, traceErrorMessage, TRACE_DESCRIPTION_MAX_LENGTH);\r
-      RecorderDataPtr->internalErrorOccured = 1;                \r
-    }\r
+       if (traceErrorMessage == NULL)\r
+       {\r
+               traceErrorMessage = (char*)msg;\r
+               (void)strncpy(RecorderDataPtr->systemInfo, traceErrorMessage, 80);\r
+               RecorderDataPtr->internalErrorOccured = 1;               \r
+       }\r
        \r
 }\r
 \r
@@ -469,40 +492,41 @@ void vTraceError(const char* msg)
 \r
 void prvCheckDataToBeOverwrittenForMultiEntryEvents(uint8_t nofEntriesToCheck)\r
 {\r
-    /* Generic "int" type is desired - should be 16 bit variable on 16 bit HW */\r
-    unsigned int i = 0;\r
-    unsigned int e = 0;\r
-\r
-    TRACE_ASSERT(nofEntriesToCheck != 0, "prvCheckDataToBeOverwrittenForMultiEntryEvents: nofEntriesToCheck == 0", );\r
-\r
-    while (i < nofEntriesToCheck)\r
-    {\r
-        e = RecorderDataPtr->nextFreeIndex + i;\r
-        if ((RecorderDataPtr->eventData[e*4] > USER_EVENT) &&\r
-            (RecorderDataPtr->eventData[e*4] < USER_EVENT + 16))\r
-        {\r
-            uint8_t nDataEvents = (uint8_t)(RecorderDataPtr->eventData[e*4] - USER_EVENT);\r
-            if ((e + nDataEvents) < RecorderDataPtr->maxEvents)\r
-            {\r
-                (void)memset(& RecorderDataPtr->eventData[e*4], 0, 4 + 4 * nDataEvents);\r
-            }\r
-        }\r
+       /* Generic "int" type is desired - should be 16 bit variable on 16 bit HW */\r
+       unsigned int i = 0;\r
+       unsigned int e = 0;\r
+\r
+       TRACE_ASSERT(nofEntriesToCheck != 0, \r
+               "prvCheckDataToBeOverwrittenForMultiEntryEvents: nofEntriesToCheck == 0", );\r
+\r
+       while (i < nofEntriesToCheck)\r
+       {\r
+               e = RecorderDataPtr->nextFreeIndex + i;\r
+               if ((RecorderDataPtr->eventData[e*4] > USER_EVENT) &&\r
+                       (RecorderDataPtr->eventData[e*4] < USER_EVENT + 16))\r
+               {\r
+                       uint8_t nDataEvents = (uint8_t)(RecorderDataPtr->eventData[e*4] - USER_EVENT);\r
+                       if ((e + nDataEvents) < RecorderDataPtr->maxEvents)\r
+                       {\r
+                               (void)memset(& RecorderDataPtr->eventData[e*4], 0, 4 + 4 * nDataEvents);\r
+                       }\r
+               }\r
                else if (RecorderDataPtr->eventData[e*4] == DIV_XPS)\r
-        {\r
-            if ((e + 1) < RecorderDataPtr->maxEvents)\r
-            {\r
+               {\r
+                       if ((e + 1) < RecorderDataPtr->maxEvents)\r
+                       {\r
                                /* Clear 8 bytes */\r
-                (void)memset(& RecorderDataPtr->eventData[e*4], 0, 4 + 4);\r
-            }\r
-            else\r
-            {\r
-                   /* Clear 8 bytes, 4 first and 4 last */\r
-                   (void)memset(& RecorderDataPtr->eventData[0], 0, 4);\r
-                   (void)memset(& RecorderDataPtr->eventData[e*4], 0, 4);\r
-            }\r
-        }\r
-        i++;\r
-    }\r
+                               (void)memset(& RecorderDataPtr->eventData[e*4], 0, 4 + 4);\r
+                       }\r
+                       else\r
+                       {\r
+                               /* Clear 8 bytes, 4 first and 4 last */\r
+                               (void)memset(& RecorderDataPtr->eventData[0], 0, 4);\r
+                               (void)memset(& RecorderDataPtr->eventData[e*4], 0, 4);\r
+                       }\r
+               }\r
+               i++;\r
+       }\r
 }\r
 \r
 /*******************************************************************************\r
@@ -513,35 +537,26 @@ void prvCheckDataToBeOverwrittenForMultiEntryEvents(uint8_t nofEntriesToCheck)
 void prvTraceUpdateCounters(void)\r
 {      \r
        if (RecorderDataPtr->recorderActive == 0)\r
-    {\r
-        return;\r
-    }\r
+       {\r
+               return;\r
+       }\r
        \r
-    RecorderDataPtr->numEvents++;\r
+       RecorderDataPtr->numEvents++;\r
 \r
-    RecorderDataPtr->nextFreeIndex++;\r
+       RecorderDataPtr->nextFreeIndex++;\r
 \r
-    if (RecorderDataPtr->nextFreeIndex >= EVENT_BUFFER_SIZE)\r
-    {\r
+       if (RecorderDataPtr->nextFreeIndex >= EVENT_BUFFER_SIZE)\r
+       {\r
 #if (TRACE_RECORDER_STORE_MODE == TRACE_STORE_MODE_RING_BUFFER)\r
-        RecorderDataPtr->bufferIsFull = 1;\r
-        RecorderDataPtr->nextFreeIndex = 0;\r
+               RecorderDataPtr->bufferIsFull = 1;\r
+               RecorderDataPtr->nextFreeIndex = 0;\r
 #else\r
-        vTraceStop();\r
+               vTraceStop();\r
 #endif\r
-    }\r
+       }\r
 \r
 #if (TRACE_RECORDER_STORE_MODE == TRACE_STORE_MODE_RING_BUFFER)\r
-    prvCheckDataToBeOverwrittenForMultiEntryEvents(1);\r
-#endif\r
-\r
-#ifdef STOP_AFTER_N_EVENTS\r
-#if (STOP_AFTER_N_EVENTS > -1)\r
-    if (RecorderDataPtr->numEvents >= STOP_AFTER_N_EVENTS)\r
-    {\r
-        vTraceStop();\r
-    }\r
-#endif\r
+       prvCheckDataToBeOverwrittenForMultiEntryEvents(1);\r
 #endif\r
 }\r
 \r
@@ -557,19 +572,19 @@ void prvTraceUpdateCounters(void)
  *****************************************************************************/\r
 uint16_t prvTraceGetDTS(uint16_t param_maxDTS)\r
 {\r
-    static uint32_t old_timestamp = 0;\r
-    XTSEvent* xts = 0;\r
-    uint32_t dts = 0;\r
-    uint32_t timestamp = 0;\r
+       static uint32_t old_timestamp = 0;\r
+       XTSEvent* xts = 0;\r
+       uint32_t dts = 0;\r
+       uint32_t timestamp = 0;\r
 \r
-    TRACE_ASSERT(param_maxDTS == 0xFF || param_maxDTS == 0xFFFF, "prvTraceGetDTS: Invalid value for param_maxDTS", 0);\r
+       TRACE_ASSERT(param_maxDTS == 0xFF || param_maxDTS == 0xFFFF, "prvTraceGetDTS: Invalid value for param_maxDTS", 0);\r
 \r
 #if (SELECTED_PORT != PORT_ARM_CortexM)\r
 \r
-    if (RecorderDataPtr->frequency == 0 && init_hwtc_count != HWTC_COUNT)\r
-    {\r
-        /* If HWTC_PERIOD is mapped to the timer reload register,\r
-        it might not be initialized    before the scheduler has been started. \r
+       if (RecorderDataPtr->frequency == 0 && init_hwtc_count != HWTC_COUNT)\r
+       {\r
+               /* If HWTC_PERIOD is mapped to the timer reload register,\r
+               it might not be initialized     before the scheduler has been started. \r
                We therefore store the frequency of the timer when the counter\r
                register has changed from its initial value. \r
                (Note that this function is called also by vTraceStart and\r
@@ -577,88 +592,88 @@ uint16_t prvTraceGetDTS(uint16_t param_maxDTS)
                has been started.) */\r
 \r
 #if (SELECTED_PORT == PORT_Win32)\r
-        RecorderDataPtr->frequency = 100000;\r
+               RecorderDataPtr->frequency = 100000;\r
 #elif (SELECTED_PORT == PORT_HWIndependent)\r
-        RecorderDataPtr->frequency = TRACE_TICK_RATE_HZ;\r
+               RecorderDataPtr->frequency = TRACE_TICK_RATE_HZ;\r
 #else\r
                RecorderDataPtr->frequency = (HWTC_PERIOD * TRACE_TICK_RATE_HZ) / (uint32_t)HWTC_DIVISOR;\r
 #endif\r
-    }\r
+       }\r
 #endif\r
-    /**************************************************************************\r
-    * The below statements read the timestamp from the timer port module.\r
-    * If necessary, whole seconds are extracted using division while the rest\r
-    * comes from the modulo operation.\r
-    **************************************************************************/\r
-    \r
-    vTracePortGetTimeStamp(&timestamp);    \r
-    \r
-    /***************************************************************************\r
-    * Since dts is unsigned the result will be correct even if timestamp has\r
+       /**************************************************************************\r
+       * The below statements read the timestamp from the timer port module.\r
+       * If necessary, whole seconds are extracted using division while the rest\r
+       * comes from the modulo operation.\r
+       **************************************************************************/\r
+       \r
+       vTracePortGetTimeStamp(&timestamp);     \r
+       \r
+       /***************************************************************************\r
+       * Since dts is unsigned the result will be correct even if timestamp has\r
        * wrapped around.\r
-    ***************************************************************************/\r
+       ***************************************************************************/\r
        dts = timestamp - old_timestamp;\r
-    old_timestamp = timestamp;\r
-\r
-    if (RecorderDataPtr->frequency > 0)\r
-    {\r
-        /* Check if dts > 1 second */\r
-        if (dts > RecorderDataPtr->frequency)\r
-        {\r
-            /* More than 1 second has passed */\r
-            RecorderDataPtr->absTimeLastEventSecond += dts / RecorderDataPtr->frequency;\r
-            /* The part that is not an entire second is added to absTimeLastEvent */\r
-            RecorderDataPtr->absTimeLastEvent += dts % RecorderDataPtr->frequency;\r
-        }\r
-        else\r
+       old_timestamp = timestamp;\r
+\r
+       if (RecorderDataPtr->frequency > 0)\r
+       {\r
+               /* Check if dts > 1 second */\r
+               if (dts > RecorderDataPtr->frequency)\r
+               {\r
+                       /* More than 1 second has passed */\r
+                       RecorderDataPtr->absTimeLastEventSecond += dts / RecorderDataPtr->frequency;\r
+                       /* The part that is not an entire second is added to absTimeLastEvent */\r
+                       RecorderDataPtr->absTimeLastEvent += dts % RecorderDataPtr->frequency;\r
+               }\r
+               else\r
+               {\r
+                       RecorderDataPtr->absTimeLastEvent += dts;\r
+               }\r
+\r
+               /* Check if absTimeLastEvent >= 1 second */\r
+               if (RecorderDataPtr->absTimeLastEvent >= RecorderDataPtr->frequency)\r
                {\r
-            RecorderDataPtr->absTimeLastEvent += dts;\r
+                       /* RecorderDataPtr->absTimeLastEvent is more than or equal to 1 second, but always less than 2 seconds */\r
+                       RecorderDataPtr->absTimeLastEventSecond++;\r
+                       RecorderDataPtr->absTimeLastEvent -= RecorderDataPtr->frequency;\r
+                       /* RecorderDataPtr->absTimeLastEvent is now less than 1 second */\r
                }\r
+       }\r
+       else\r
+       {\r
+               /* Special case if the recorder has not yet started (frequency may be uninitialized, i.e., zero) */\r
+               RecorderDataPtr->absTimeLastEvent = timestamp;\r
+       }\r
+\r
+       /* If the dts (time since last event) does not fit in event->dts (only 8 or 16 bits) */\r
+       if (dts > param_maxDTS)\r
+       {\r
+               /* Create an XTS event (eXtended TimeStamp) containing the higher dts bits*/\r
+               xts = (XTSEvent*) xTraceNextFreeEventBufferSlot();\r
 \r
-        /* Check if absTimeLastEvent >= 1 second */\r
-        if (RecorderDataPtr->absTimeLastEvent >= RecorderDataPtr->frequency)\r
-        {\r
-            /* RecorderDataPtr->absTimeLastEvent is more than or equal to 1 second, but always less than 2 seconds */\r
-            RecorderDataPtr->absTimeLastEventSecond++;\r
-            RecorderDataPtr->absTimeLastEvent -= RecorderDataPtr->frequency;\r
-            /* RecorderDataPtr->absTimeLastEvent is now less than 1 second */\r
-        }\r
-    }\r
-    else\r
-    {\r
-        /* Special case if the recorder has not yet started (frequency may be uninitialized, i.e., zero) */\r
-        RecorderDataPtr->absTimeLastEvent = timestamp;\r
-    }\r
-\r
-    /* If the dts (time since last event) does not fit in event->dts (only 8 or 16 bits) */\r
-    if (dts > param_maxDTS)\r
-    {\r
-        /* Create an XTS event (eXtended TimeStamp) containing the higher dts bits*/\r
-        xts = (XTSEvent*) xTraceNextFreeEventBufferSlot();\r
-\r
-        if (xts != NULL)\r
-        {\r
-            if (param_maxDTS == 0xFFFF)\r
-            {\r
-                xts->type = XTS16;\r
-                xts->xts_16 = (uint16_t)((dts / 0x10000) & 0xFFFF);\r
-                xts->xts_8 = 0;\r
-            }\r
-            else if (param_maxDTS == 0xFF)\r
-            {\r
-                xts->type = XTS8;\r
-                xts->xts_16 = (uint16_t)((dts / 0x100) & 0xFFFF);\r
-                xts->xts_8 = (uint8_t)((dts / 0x1000000) & 0xFF);\r
-            }\r
-            else\r
-            {\r
-                vTraceError("Bad param_maxDTS in prvTraceGetDTS");\r
-            }\r
-            prvTraceUpdateCounters();\r
-        }\r
-    }\r
-\r
-    return (uint16_t)dts & param_maxDTS;\r
+               if (xts != NULL)\r
+               {\r
+                       if (param_maxDTS == 0xFFFF)\r
+                       {\r
+                               xts->type = XTS16;\r
+                               xts->xts_16 = (uint16_t)((dts / 0x10000) & 0xFFFF);\r
+                               xts->xts_8 = 0;\r
+                       }\r
+                       else if (param_maxDTS == 0xFF)\r
+                       {\r
+                               xts->type = XTS8;\r
+                               xts->xts_16 = (uint16_t)((dts / 0x100) & 0xFFFF);\r
+                               xts->xts_8 = (uint8_t)((dts / 0x1000000) & 0xFF);\r
+                       }\r
+                       else\r
+                       {\r
+                               vTraceError("Bad param_maxDTS in prvTraceGetDTS");\r
+                       }\r
+                       prvTraceUpdateCounters();\r
+               }\r
+       }\r
+\r
+       return (uint16_t)dts & param_maxDTS;\r
 }\r
 \r
 /*******************************************************************************\r
@@ -675,33 +690,33 @@ uint16_t prvTraceGetDTS(uint16_t param_maxDTS)
  * zero-termination\r
  ******************************************************************************/\r
 traceLabel prvTraceLookupSymbolTableEntry(const char* name,\r
-                                          uint8_t crc6,\r
-                                          uint8_t len,\r
-                                          traceLabel chn)\r
+                                                                                uint8_t crc6,\r
+                                                                                uint8_t len,\r
+                                                                                traceLabel chn)\r
 {\r
-    uint16_t i = RecorderDataPtr->SymbolTable.latestEntryOfChecksum[ crc6 ];\r
+       uint16_t i = RecorderDataPtr->SymbolTable.latestEntryOfChecksum[ crc6 ];\r
 \r
        TRACE_ASSERT(name != NULL, "prvTraceLookupSymbolTableEntry: name == NULL", (traceLabel)0);\r
        TRACE_ASSERT(len != 0, "prvTraceLookupSymbolTableEntry: len == 0", (traceLabel)0);\r
 \r
-    while (i != 0)\r
-    {\r
-        if (RecorderDataPtr->SymbolTable.symbytes[i + 2] == (chn & 0x00FF))\r
-        {\r
-            if (RecorderDataPtr->SymbolTable.symbytes[i + 3] == (chn / 0x100))\r
-            {\r
-                if (RecorderDataPtr->SymbolTable.symbytes[i + 4 + len] == '\0')\r
-                {\r
-                    if (strncmp((char*)(& RecorderDataPtr->SymbolTable.symbytes[i + 4]), name, len) == 0)\r
-                    {\r
-                        break; /* found */\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        i = (uint16_t)(RecorderDataPtr->SymbolTable.symbytes[i] + (RecorderDataPtr->SymbolTable.symbytes[i + 1] * 0x100));\r
-    }\r
-    return i;\r
+       while (i != 0)\r
+       {\r
+               if (RecorderDataPtr->SymbolTable.symbytes[i + 2] == (chn & 0x00FF))\r
+               {\r
+                       if (RecorderDataPtr->SymbolTable.symbytes[i + 3] == (chn / 0x100))\r
+                       {\r
+                               if (RecorderDataPtr->SymbolTable.symbytes[i + 4 + len] == '\0')\r
+                               {\r
+                                       if (strncmp((char*)(& RecorderDataPtr->SymbolTable.symbytes[i + 4]), name, len) == 0)\r
+                                       {\r
+                                               break; /* found */\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+               i = (uint16_t)(RecorderDataPtr->SymbolTable.symbytes[i] + (RecorderDataPtr->SymbolTable.symbytes[i + 1] * 0x100));\r
+       }\r
+       return i;\r
 }\r
 \r
 /*******************************************************************************\r
@@ -718,58 +733,58 @@ traceLabel prvTraceLookupSymbolTableEntry(const char* name,
  * zero-termination\r
  ******************************************************************************/\r
 uint16_t prvTraceCreateSymbolTableEntry(const char* name,\r
-                                        uint8_t crc6,\r
-                                        uint8_t len,\r
-                                        traceLabel channel)\r
+                                                                               uint8_t crc6,\r
+                                                                               uint8_t len,\r
+                                                                               traceLabel channel)\r
 {\r
-    uint16_t ret = 0;\r
+       uint16_t ret = 0;\r
 \r
        TRACE_ASSERT(name != NULL, "prvTraceCreateSymbolTableEntry: name == NULL", 0);\r
        TRACE_ASSERT(len != 0, "prvTraceCreateSymbolTableEntry: len == 0", 0);\r
 \r
-    if (RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + len + 4 >= SYMBOL_TABLE_SIZE)\r
-    {\r
-        vTraceError("Symbol table full. Increase SYMBOL_TABLE_SIZE in trcConfig.h");\r
-        ret = 0;\r
-    }\r
-    else\r
-    {\r
+       if (RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + len + 4 >= SYMBOL_TABLE_SIZE)\r
+       {\r
+               vTraceError("Symbol table full. Increase SYMBOL_TABLE_SIZE in trcConfig.h");\r
+               ret = 0;\r
+       }\r
+       else\r
+       {\r
 \r
-        RecorderDataPtr->SymbolTable.symbytes\r
-            [ RecorderDataPtr->SymbolTable.nextFreeSymbolIndex] =\r
-            (uint8_t)(RecorderDataPtr->SymbolTable.latestEntryOfChecksum[ crc6 ] & 0x00FF);\r
+               RecorderDataPtr->SymbolTable.symbytes\r
+                       [ RecorderDataPtr->SymbolTable.nextFreeSymbolIndex] =\r
+                       (uint8_t)(RecorderDataPtr->SymbolTable.latestEntryOfChecksum[ crc6 ] & 0x00FF);\r
 \r
-        RecorderDataPtr->SymbolTable.symbytes\r
-            [ RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + 1] =\r
-            (uint8_t)(RecorderDataPtr->SymbolTable.latestEntryOfChecksum[ crc6 ] / 0x100);\r
+               RecorderDataPtr->SymbolTable.symbytes\r
+                       [ RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + 1] =\r
+                       (uint8_t)(RecorderDataPtr->SymbolTable.latestEntryOfChecksum[ crc6 ] / 0x100);\r
 \r
-        RecorderDataPtr->SymbolTable.symbytes\r
-            [ RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + 2] =\r
-            (uint8_t)(channel & 0x00FF);\r
+               RecorderDataPtr->SymbolTable.symbytes\r
+                       [ RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + 2] =\r
+                       (uint8_t)(channel & 0x00FF);\r
 \r
-        RecorderDataPtr->SymbolTable.symbytes\r
-            [ RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + 3] =\r
-            (uint8_t)(channel / 0x100);\r
+               RecorderDataPtr->SymbolTable.symbytes\r
+                       [ RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + 3] =\r
+                       (uint8_t)(channel / 0x100);\r
 \r
-        /* set name (bytes 4...4+len-1) */\r
-        (void)strncpy((char*)&(RecorderDataPtr->SymbolTable.symbytes\r
-            [ RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + 4]), name, len);\r
+               /* set name (bytes 4...4+len-1) */\r
+               (void)strncpy((char*)&(RecorderDataPtr->SymbolTable.symbytes\r
+                       [ RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + 4]), name, len);\r
 \r
-        /* Set zero termination (at offset 4+len) */\r
-        RecorderDataPtr->SymbolTable.symbytes\r
-            [RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + 4 + len] = '\0';\r
+               /* Set zero termination (at offset 4+len) */\r
+               RecorderDataPtr->SymbolTable.symbytes\r
+                       [RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + 4 + len] = '\0';\r
 \r
-        /* store index of entry (for return value, and as head of LL[crc6]) */\r
-        RecorderDataPtr->SymbolTable.latestEntryOfChecksum\r
-            [ crc6 ] = (uint16_t)RecorderDataPtr->SymbolTable.nextFreeSymbolIndex;\r
+               /* store index of entry (for return value, and as head of LL[crc6]) */\r
+               RecorderDataPtr->SymbolTable.latestEntryOfChecksum\r
+                       [ crc6 ] = (uint16_t)RecorderDataPtr->SymbolTable.nextFreeSymbolIndex;\r
 \r
-        RecorderDataPtr->SymbolTable.nextFreeSymbolIndex += (len + 5);\r
+               RecorderDataPtr->SymbolTable.nextFreeSymbolIndex += (len + 5);\r
 \r
-        ret = (uint16_t)(RecorderDataPtr->SymbolTable.nextFreeSymbolIndex -\r
-            (len + 5));\r
-    }\r
+               ret = (uint16_t)(RecorderDataPtr->SymbolTable.nextFreeSymbolIndex -\r
+                       (len + 5));\r
+       }\r
 \r
-    return ret;\r
+       return ret;\r
 }\r
 \r
 \r
@@ -781,24 +796,24 @@ uint16_t prvTraceCreateSymbolTableEntry(const char* name,
  ******************************************************************************/\r
 void prvTraceGetChecksum(const char *pname, uint8_t* pcrc, uint8_t* plength)\r
 {\r
-   unsigned char c;\r
-   int length = 1;\r
-   int crc = 0;\r
-\r
-   TRACE_ASSERT(pname != NULL, "prvTraceGetChecksum: pname == NULL", );\r
-   TRACE_ASSERT(pcrc != NULL, "prvTraceGetChecksum: pcrc == NULL", );\r
-   TRACE_ASSERT(plength != NULL, "prvTraceGetChecksum: plength == NULL", );\r
-\r
-   if (pname != (const char *) 0)\r
-   {\r
-      for (; (c = *pname++) != '\0';)\r
-      {\r
-         crc += c;\r
-         length++;\r
-      }\r
-   }\r
-   *pcrc = (uint8_t)(crc & 0x3F);\r
-   *plength = (uint8_t)length;\r
+       unsigned char c;\r
+       int length = 1;         /* Should be 1 to account for '\0' */\r
+       int crc = 0;\r
+\r
+       TRACE_ASSERT(pname != NULL, "prvTraceGetChecksum: pname == NULL", );\r
+       TRACE_ASSERT(pcrc != NULL, "prvTraceGetChecksum: pcrc == NULL", );\r
+       TRACE_ASSERT(plength != NULL, "prvTraceGetChecksum: plength == NULL", );\r
+\r
+       if (pname != (const char *) 0)\r
+       {\r
+               for (; (c = *pname++) != '\0';)\r
+               {\r
+                       crc += c;\r
+                       length++;\r
+               }\r
+       }\r
+       *pcrc = (uint8_t)(crc & 0x3F);\r
+       *plength = (uint8_t)length;\r
 }\r
 \r
 #if (USE_16BIT_OBJECT_HANDLES == 1)\r
@@ -829,7 +844,7 @@ void prvTraceStoreXID(objectHandleType handle)
                xid->type = XID;\r
 \r
                /* This function is (only) used when objectHandleType is 16 bit... */\r
-               xid->xps_16 = handle;  \r
+               xid->xps_16 = handle; \r
 \r
                prvTraceUpdateCounters();\r
        }\r
@@ -840,8 +855,8 @@ unsigned char prvTraceGet8BitHandle(objectHandleType handle)
        if (handle > 255)\r
        {               \r
                prvTraceStoreXID(handle);\r
-        /* The full handle (16 bit) is stored in the XID event. \r
-           This code (255) is used instead of zero (which is an error code).*/\r
+               /* The full handle (16 bit) is stored in the XID event. \r
+               This code (255) is used instead of zero (which is an error code).*/\r
                return 255; \r
        }\r
        return (unsigned char)(handle & 0xFF);\r
index ac4a6f263b6159c99edbb8e3897cd8b04fb7a283..7d3937b4aa92c2ce2dd28456c42d369901afe8c8 100644 (file)
@@ -1,5 +1,5 @@
 /******************************************************************************* \r
- * Tracealyzer v2.6.0 Recorder Library\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcHardwarePort.c\r
@@ -32,7 +32,9 @@
  * 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
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2014.\r
  * www.percepio.com\r
  ******************************************************************************/\r
 \r
@@ -56,36 +58,37 @@ uint32_t last_timestamp = 0;
  ******************************************************************************/\r
 uint32_t uiTraceTickCount = 0;\r
 \r
-uint32_t DWT_CYCLES_ADDED = 0;\r
+uint32_t DWT_CYCLES_ADDED = 0; /* Used on ARM Cortex-M only */\r
 \r
 #if (SELECTED_PORT == PORT_ARM_CortexM)\r
 \r
-void prvTraceEnableIRQ(void)\r
-{\r
-       asm volatile ("cpsie i");\r
-}\r
-\r
-void prvTraceDisableIRQ(void)\r
-{\r
-       asm volatile ("cpsid i");\r
-}\r
-\r
-void prvTraceSetIRQMask(uint32_t priMask)\r
+void prvTraceInitCortexM()\r
 {\r
-       asm volatile ("MSR primask, %0" : : "r" (priMask) );\r
-}\r
+       /* Make sure DWT is enabled is enabled, if supported */\r
+       REG_DEMCR |= DEMCR_TRCENA;\r
+\r
+       do{\r
+               /* Verify that DWT is supported */\r
+               if (REG_DEMCR == 0)\r
+               {\r
+                       vTraceError("DWT not supported by this chip!");\r
+                       break;\r
+               }\r
+\r
+               /* Verify that DWT_CYCCNT is supported */\r
+               if (REG_DWT_CTRL & DWT_CTRL_NOCYCCNT)\r
+               {\r
+                       vTraceError("DWT_CYCCNT not supported by this chip!");\r
+                       break;\r
+               }\r
+       \r
+               /* Reset the cycle counter */\r
+               REG_DWT_CYCCNT = 0;\r
 \r
-uint32_t prvTraceGetIRQMask(void)\r
-{\r
-       uint32_t result;\r
-       asm volatile ("MRS %0, primask" : "=r" (result) );\r
-       return result;\r
-}\r
+               /* Enable the cycle counter */\r
+               REG_DWT_CTRL |= DWT_CTRL_CYCCNTENA;\r
 \r
-void prvTraceInitCortexM()\r
-{\r
-       DWT_CTRL_REG |= 1;     /* Enable the cycle counter */\r
-       DWT_CYCLE_COUNTER = 0;\r
+       }while(0);      /* breaks above jump here */\r
        \r
        if (RecorderDataPtr->frequency == 0)\r
        {               \r
@@ -109,10 +112,10 @@ void prvTraceInitCortexM()
 void vTracePortGetTimeStamp(uint32_t *pTimestamp)\r
 {\r
        static uint32_t last_traceTickCount = 0;\r
-    static uint32_t last_hwtc_count = 0;\r
-    uint32_t traceTickCount = 0;\r
-    uint32_t hwtc_count = 0;\r
-    \r
+       static uint32_t last_hwtc_count = 0;\r
+       uint32_t traceTickCount = 0;\r
+       uint32_t hwtc_count = 0;\r
+       \r
        if (trace_disable_timestamp == 1)\r
        {\r
                if (pTimestamp)\r
@@ -120,51 +123,64 @@ void vTracePortGetTimeStamp(uint32_t *pTimestamp)
                return;\r
        }\r
                        \r
-    /* Retrieve HWTC_COUNT only once since the same value should be used all throughout this function. */\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
+       hwtc_count = HWTC_COUNT;\r
 #elif (HWTC_COUNT_DIRECTION == DIRECTION_DECREMENTING)\r
-    hwtc_count = HWTC_PERIOD - HWTC_COUNT;\r
+       hwtc_count = HWTC_PERIOD - HWTC_COUNT;\r
 #else\r
-    Junk text to cause compiler error - HWTC_COUNT_DIRECTION is not set correctly!\r
-    Should be DIRECTION_INCREMENTING or DIRECTION_DECREMENTING\r
+       Junk text to cause compiler error - HWTC_COUNT_DIRECTION is not set correctly!\r
+       Should be DIRECTION_INCREMENTING or DIRECTION_DECREMENTING\r
 #endif\r
-    \r
-    if (last_traceTickCount - uiTraceTickCount - 1 < 0x80000000)\r
-    {\r
-        /* This means last_traceTickCount is higher than uiTraceTickCount,\r
-        so we have previously compensated for a missed tick.\r
-        Therefore we use the last stored value because that is more accurate. */\r
-        traceTickCount = last_traceTickCount;\r
-    }\r
-    else\r
-    {\r
-        /* Business as usual */\r
-        traceTickCount = uiTraceTickCount;\r
-    }\r
-\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
-    /* Check if the return address is OK, then we perform the calculation. */\r
-    if (pTimestamp)\r
-    {\r
-        /* Get timestamp from trace ticks. Scale down the period to avoid unwanted overflows. */\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
+#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
+       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
+       performance counter is 64 bit wide. */\r
+       \r
+       if (last_hwtc_count > hwtc_count)\r
+       {\r
+               hwtc_count = last_hwtc_count;\r
+       }\r
+#endif\r
+\r
+       if (last_traceTickCount - uiTraceTickCount - 1 < 0x80000000)\r
+       {\r
+               /* This means last_traceTickCount is higher than uiTraceTickCount,\r
+               so we have previously compensated for a missed tick.\r
+               Therefore we use the last stored value because that is more accurate. */\r
+               traceTickCount = last_traceTickCount;\r
+       }\r
+       else\r
+       {\r
+               /* Business as usual */\r
+               traceTickCount = uiTraceTickCount;\r
+       }\r
+\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
+       /* Check if the return address is OK, then we perform the calculation. */\r
+       if (pTimestamp)\r
+       {\r
+               /* Get timestamp from trace ticks. Scale down the period to avoid unwanted overflows. */\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
-    last_traceTickCount = traceTickCount;\r
-    last_hwtc_count = hwtc_count;\r
+       }\r
+       \r
+       /* Store the previous values. */\r
+       last_traceTickCount = traceTickCount;\r
+       last_hwtc_count = hwtc_count;\r
 }\r
 \r
-#endif
\ No newline at end of file
+#endif\r
index e79294740e00ee35e7a018ba0dc0521dc0334cd5..5cf073dc1b7ab035b2dd5b68cb73a53a0c5dd037 100644 (file)
@@ -1,10 +1,10 @@
 /*******************************************************************************\r
- * Tracealyzer v2.6.0 Recorder Library\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcKernel.c\r
  *\r
- * Functions used by trcKernelHooks.h.\r
+ * Functions used by trcKernelHooks.h for storing various kernel events.\r
  *\r
  * Terms of Use\r
  * This software is copyright Percepio AB. The recorder library is free for\r
@@ -31,7 +31,9 @@
  * 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
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2014.\r
  * www.percepio.com\r
  ******************************************************************************/\r
 \r
@@ -46,7 +48,12 @@ uint8_t nISRactive = 0;
 objectHandleType handle_of_last_logged_task = 0;\r
 uint8_t inExcludedTask = 0;\r
 \r
+/* Current heap usage. Always updated. */\r
+static uint32_t heapMemUsage = 0;\r
+\r
+#if (TRACE_SCHEDULING_ONLY == 0)\r
 static uint32_t prvTraceGetParam(uint32_t, uint32_t);\r
+#endif\r
 \r
 #if !defined INCLUDE_READY_EVENTS || INCLUDE_READY_EVENTS == 1\r
 /*******************************************************************************\r
@@ -56,44 +63,47 @@ static uint32_t prvTraceGetParam(uint32_t, uint32_t);
  ******************************************************************************/\r
 void vTraceStoreTaskReady(objectHandleType handle)\r
 {\r
-    uint16_t dts3;\r
-    TREvent* tr;\r
+       uint16_t dts3;\r
+       TREvent* tr;\r
+       uint8_t hnd8;\r
+\r
        TRACE_SR_ALLOC_CRITICAL_SECTION();\r
-       \r
-       TRACE_ASSERT(handle > 0 && handle <= NTask, "vTraceStoreTaskReady: Invalid value for handle", );\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
+       if (handle == 0)\r
+       {\r
+               /*  On FreeRTOS v7.3.0, this occurs when creating tasks due to a bad\r
+               placement of the trace macro. In that case, the events are ignored. */\r
+               return;\r
+       }\r
+\r
+       TRACE_ASSERT(handle <= NTask, "vTraceStoreTaskReady: Invalid value for handle", );\r
 \r
-      vTraceError("Recorder busy - high priority ISR using syscall? (1)");\r
-      return;\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
        trcCRITICAL_SECTION_BEGIN();\r
-    if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
+       if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
        {\r
                if (!TRACE_GET_TASK_FLAG_ISEXCLUDED(handle))\r
                {\r
                        dts3 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
-                       if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
+                       hnd8 = prvTraceGet8BitHandle(handle);\r
+                       tr = (TREvent*)xTraceNextFreeEventBufferSlot();\r
+                       if (tr != NULL)\r
                        {\r
-                               uint8_t hnd8 = prvTraceGet8BitHandle(handle);\r
-\r
-                               tr = (TREvent*)xTraceNextFreeEventBufferSlot();\r
-\r
-                               if (tr != NULL)\r
-                               {\r
-                                       tr->type = DIV_TASK_READY;\r
-                                       tr->dts = dts3;\r
-                                       tr->objHandle = hnd8;\r
-\r
-                                       prvTraceUpdateCounters();\r
-                               }\r
+                               tr->type = DIV_TASK_READY;\r
+                               tr->dts = dts3;\r
+                               tr->objHandle = hnd8;\r
+                               prvTraceUpdateCounters();\r
                        }\r
                }\r
        }\r
@@ -108,38 +118,34 @@ void vTraceStoreTaskReady(objectHandleType handle)
  ******************************************************************************/\r
 void vTraceStoreLowPower(uint32_t flag)\r
 {\r
-    uint16_t dts;\r
-    LPEvent* lp;\r
+       uint16_t dts;\r
+       LPEvent* lp;\r
        TRACE_SR_ALLOC_CRITICAL_SECTION();\r
-       \r
+\r
        TRACE_ASSERT(flag <= 1, "vTraceStoreLowPower: Invalid flag value", );\r
 \r
-    if (recorder_busy)\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
+\r
                vTraceError("Recorder busy - high priority ISR using syscall? (1)");\r
                return;\r
-    }\r
-       \r
+       }\r
+\r
        trcCRITICAL_SECTION_BEGIN();\r
-    if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
+       if (RecorderDataPtr->recorderActive)\r
        {\r
                dts = (uint16_t)prvTraceGetDTS(0xFFFF);\r
-               if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
+               lp = (LPEvent*)xTraceNextFreeEventBufferSlot();\r
+               if (lp != NULL)\r
                {\r
-                       lp = (LPEvent*)xTraceNextFreeEventBufferSlot();\r
-                       if (lp != NULL)\r
-                       {\r
-                               lp->type = LOW_POWER_BEGIN + ( uint8_t ) flag; /* BEGIN or END depending on flag */\r
-                               lp->dts = dts;\r
-\r
-                               prvTraceUpdateCounters();\r
-                       }\r
+                       lp->type = LOW_POWER_BEGIN + ( uint8_t ) flag; /* BEGIN or END depending on flag */\r
+                       lp->dts = dts;\r
+                       prvTraceUpdateCounters();\r
                }\r
        }\r
        trcCRITICAL_SECTION_END();\r
@@ -149,62 +155,79 @@ void vTraceStoreLowPower(uint32_t flag)
  * vTraceStoreMemMangEvent\r
  *\r
  * This function stores malloc and free events. Each call requires two records,\r
- * for size and address respectively. The event code parameter (ecode) is applied \r
- * to the first record (size) and the following address record gets event \r
+ * for size and address respectively. The event code parameter (ecode) is applied\r
+ * to the first record (size) and the following address record gets event\r
  * code "ecode + 1", so make sure this is respected in the event code table.\r
+ * Note: On "free" calls, the signed_size parameter should be negative.\r
  ******************************************************************************/\r
 #if (INCLUDE_MEMMANG_EVENTS == 1)\r
-void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, uint32_t size)\r
-{\r
+void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t signed_size)\r
+{      \r
+#if (TRACE_SCHEDULING_ONLY == 0)\r
        uint8_t dts1;\r
        MemEventSize * ms;\r
        MemEventAddr * ma;\r
        uint16_t size_low;\r
        uint16_t addr_low;\r
        uint8_t addr_high;\r
+       uint32_t size;\r
+       \r
+       if (signed_size < 0)\r
+               size = (uint32_t)(- signed_size);\r
+       else\r
+               size = (uint32_t)(signed_size);\r
        \r
        TRACE_SR_ALLOC_CRITICAL_SECTION();\r
 \r
        trcCRITICAL_SECTION_BEGIN();\r
+       \r
+       heapMemUsage += signed_size;\r
+       \r
        if (RecorderDataPtr->recorderActive)\r
        {\r
                /* If it is an ISR or NOT an excluded task, this kernel call will be stored in the trace */\r
                if (nISRactive || !inExcludedTask)\r
                {\r
                        dts1 = (uint8_t)prvTraceGetDTS(0xFF);\r
-                       \r
                        size_low = (uint16_t)prvTraceGetParam(0xFFFF, size);\r
-                       \r
                        ms = (MemEventSize *)xTraceNextFreeEventBufferSlot();\r
+\r
                        if (ms != NULL)\r
                        {\r
                                ms->dts = dts1;\r
-                               ms->type = (uint8_t)ecode;\r
+                               ms->type = NULL_EVENT; /* Updated when all events are written */\r
                                ms->size = size_low;\r
                                prvTraceUpdateCounters();\r
-                               \r
+\r
                                /* Storing a second record with address (signals "failed" if null) */\r
                                #if (HEAP_SIZE_BELOW_16M)\r
-                                       addr_low = address & 0xFFFF;\r
+                                   /* If the heap address range is within 16 MB, i.e., the upper 8 bits\r
+                                       of addresses are constant, this optimization avoids storing an extra\r
+                                       event record by ignoring the upper 8 bit of the address */\r
+                                       addr_low = address & 0xFFFF;          \r
                                        addr_high = (address >> 16) & 0xFF;\r
                                #else\r
+                                   /* The whole 32 bit address is stored using a second event record\r
+                                       for the upper 16 bit */\r
                                        addr_low = (uint16_t)prvTraceGetParam(0xFFFF, address);\r
                                        addr_high = 0;\r
                                #endif\r
-                               \r
+\r
                                ma = (MemEventAddr *) xTraceNextFreeEventBufferSlot();\r
-                               \r
                                if (ma != NULL)\r
                                {\r
                                        ma->addr_low = addr_low;\r
                                        ma->addr_high = addr_high;\r
-                                       ma->type = ( ( uint8_t) ecode ) + 1;  /* Note this! */\r
-                                       prvTraceUpdateCounters();                               \r
+                                       ma->type = ( ( uint8_t) ecode ) + 1; /* Note this! */\r
+                                       ms->type = (uint8_t)ecode;\r
+                                       prvTraceUpdateCounters();                                       \r
+                                       RecorderDataPtr->heapMemUsage = heapMemUsage;\r
                                }\r
                        }\r
                }\r
        }\r
-       trcCRITICAL_SECTION_END();      \r
+       trcCRITICAL_SECTION_END();\r
+#endif /* TRACE_SCHEDULING_ONLY */\r
 }\r
 #endif\r
 \r
@@ -216,126 +239,123 @@ void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, uint32_t size)
  ******************************************************************************/\r
 void vTraceStoreKernelCall(uint32_t ecode, traceObjectClass objectClass, uint32_t objectNumber)\r
 {\r
-    KernelCall * kse;\r
-    uint16_t dts1;\r
-    TRACE_SR_ALLOC_CRITICAL_SECTION();\r
-\r
-    TRACE_ASSERT(ecode < 0xFF, "vTraceStoreKernelCall: ecode >= 0xFF", );\r
-    TRACE_ASSERT(objectClass < TRACE_NCLASSES, "vTraceStoreKernelCall: objectClass >= TRACE_NCLASSES", );\r
-    TRACE_ASSERT(objectNumber <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectClass], "vTraceStoreKernelCall: Invalid value for objectNumber", );\r
-\r
-    if (recorder_busy)\r
-    {\r
-        /*************************************************************************\r
-        * This may occur if a high-priority ISR is illegally using a system call,\r
-        * or creates a user event.\r
-        * Only ISRs that are disabled by TRACE_ENTER_CRITICAL_SECTION may use system calls\r
-        * or user events (see TRACE_MAX_SYSCALL_INTERRUPT_PRIORITY).\r
-        *************************************************************************/\r
-\r
-        vTraceError("Recorder busy - high priority ISR using syscall? (2)");\r
-        return;\r
-    }\r
-\r
-    if (handle_of_last_logged_task == 0)\r
-    {\r
-        return;\r
-    }\r
+#if (TRACE_SCHEDULING_ONLY == 0)\r
+       KernelCall * kse;\r
+       uint16_t dts1;\r
+       uint8_t hnd8;\r
+       TRACE_SR_ALLOC_CRITICAL_SECTION();\r
+\r
+       TRACE_ASSERT(ecode < 0xFF, "vTraceStoreKernelCall: ecode >= 0xFF", );\r
+       TRACE_ASSERT(objectClass < TRACE_NCLASSES, "vTraceStoreKernelCall: objectClass >= TRACE_NCLASSES", );\r
+       TRACE_ASSERT(objectNumber <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectClass], "vTraceStoreKernelCall: Invalid value for objectNumber", );\r
+\r
+       if (recorder_busy)\r
+       {\r
+               /*************************************************************************\r
+               * This may occur if a high-priority ISR is illegally using a system call,\r
+               * or creates a user event.\r
+               * Only ISRs that are disabled by TRACE_ENTER_CRITICAL_SECTION may use system calls\r
+               * or user events (see TRACE_MAX_SYSCALL_INTERRUPT_PRIORITY).\r
+               *************************************************************************/\r
+\r
+               vTraceError("Recorder busy - high priority ISR using syscall? (2)");\r
+               return;\r
+       }\r
+\r
+       if (handle_of_last_logged_task == 0)\r
+       {\r
+               return;\r
+       }\r
 \r
        trcCRITICAL_SECTION_BEGIN();\r
-    if (RecorderDataPtr->recorderActive)\r
-    {\r
-        /* If it is an ISR or NOT an excluded task, this kernel call will be stored in the trace */\r
-        if (nISRactive || !inExcludedTask)\r
-        {\r
-            /* Check if the referenced object or the event code is excluded */\r
-            if (!uiTraceIsObjectExcluded(objectClass, (objectHandleType)objectNumber) && !TRACE_GET_EVENT_CODE_FLAG_ISEXCLUDED(ecode))\r
-            {                \r
-                dts1 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
-\r
-                if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
-                {\r
-                                       uint8_t hnd8 = prvTraceGet8BitHandle(objectNumber);\r
-\r
-                    kse = (KernelCall*) xTraceNextFreeEventBufferSlot();\r
-                    if (kse != NULL)\r
-                    {\r
-                        kse->dts = dts1;\r
-                        kse->type = (uint8_t)ecode;\r
-                        kse->objHandle = hnd8;\r
-                        prvTraceUpdateCounters();\r
-                    }\r
-                }                \r
-            }\r
-        }\r
-    }\r
+       if (RecorderDataPtr->recorderActive)\r
+       {\r
+               /* If it is an ISR or NOT an excluded task, this kernel call will be stored in the trace */\r
+               if (nISRactive || !inExcludedTask)\r
+               {\r
+                       /* Check if the referenced object or the event code is excluded */\r
+                       if (!uiTraceIsObjectExcluded(objectClass, (objectHandleType)objectNumber) && !TRACE_GET_EVENT_CODE_FLAG_ISEXCLUDED(ecode))\r
+                       {\r
+                               dts1 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
+                               hnd8 = prvTraceGet8BitHandle(objectNumber);\r
+                               kse = (KernelCall*) xTraceNextFreeEventBufferSlot();\r
+                               if (kse != NULL)\r
+                               {\r
+                                       kse->dts = dts1;\r
+                                       kse->type = (uint8_t)ecode;\r
+                                       kse->objHandle = hnd8;\r
+                                       prvTraceUpdateCounters();\r
+                               }\r
+                       }\r
+               }\r
+       }\r
        trcCRITICAL_SECTION_END();\r
+#endif /* TRACE_SCHEDULING_ONLY */\r
 }\r
 \r
 /*******************************************************************************\r
  * vTraceStoreKernelCallWithParam\r
  *\r
- * Used for storing kernel calls with a handle and a numeric parameter. If the \r
+ * Used for storing kernel calls with a handle and a numeric parameter. If the\r
  * numeric parameter does not fit in one byte, and extra XPS event is inserted\r
  * before the kernel call event containing the three upper bytes.\r
  ******************************************************************************/\r
 void vTraceStoreKernelCallWithParam(uint32_t evtcode,\r
-                                    traceObjectClass objectClass,\r
-                                    uint32_t objectNumber,\r
-                                    uint32_t param)\r
+                                                                       traceObjectClass objectClass,\r
+                                                                       uint32_t objectNumber,\r
+                                                                       uint32_t param)\r
 {\r
-    KernelCallWithParamAndHandle * kse;\r
-    uint8_t dts2;      \r
-    TRACE_SR_ALLOC_CRITICAL_SECTION();\r
+#if (TRACE_SCHEDULING_ONLY == 0)\r
+       KernelCallWithParamAndHandle * kse;\r
+       uint8_t dts2;\r
+       uint8_t hnd8;\r
+       uint8_t p8;\r
+       TRACE_SR_ALLOC_CRITICAL_SECTION();\r
 \r
        TRACE_ASSERT(evtcode < 0xFF, "vTraceStoreKernelCall: evtcode >= 0xFF", );\r
        TRACE_ASSERT(objectClass < TRACE_NCLASSES, "vTraceStoreKernelCallWithParam: objectClass >= TRACE_NCLASSES", );\r
        TRACE_ASSERT(objectNumber <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectClass], "vTraceStoreKernelCallWithParam: Invalid value for objectNumber", );\r
 \r
        if (recorder_busy)\r
-    {\r
-        /*************************************************************************\r
-        * This may occur if a high-priority ISR is illegally using a system call,\r
-        * or creates a user event.\r
-        * Only ISRs that are disabled by TRACE_ENTER_CRITICAL_SECTION may use system calls\r
-        * or user events (see TRACE_MAX_SYSCALL_INTERRUPT_PRIORITY).\r
-        *************************************************************************/\r
-\r
-        vTraceError("Recorder busy - high priority ISR using syscall? (3)");\r
-        return;\r
-    }\r
+       {\r
+               /*************************************************************************\r
+               * This may occur if a high-priority ISR is illegally using a system call,\r
+               * or creates a user event.\r
+               * Only ISRs that are disabled by TRACE_ENTER_CRITICAL_SECTION may use system calls\r
+               * or user events (see TRACE_MAX_SYSCALL_INTERRUPT_PRIORITY).\r
+               *************************************************************************/\r
+\r
+               vTraceError("Recorder busy - high priority ISR using syscall? (3)");\r
+               return;\r
+       }\r
 \r
        trcCRITICAL_SECTION_BEGIN();\r
-    if (RecorderDataPtr->recorderActive && handle_of_last_logged_task &&\r
-        (! inExcludedTask || nISRactive))\r
-    {\r
-        \r
-        /* Check if the referenced object or the event code is excluded */\r
-        if (!uiTraceIsObjectExcluded(objectClass, (objectHandleType)objectNumber) && !TRACE_GET_EVENT_CODE_FLAG_ISEXCLUDED(evtcode))\r
-        {            \r
-            dts2 = (uint8_t)prvTraceGetDTS(0xFF);\r
-\r
-            if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
-            {\r
-                               uint8_t p8 = (uint8_t) prvTraceGetParam(0xFF, param);\r
-                               \r
-                               uint8_t hnd8 = prvTraceGet8BitHandle((objectHandleType)objectNumber);\r
-\r
-                kse = (KernelCallWithParamAndHandle*) xTraceNextFreeEventBufferSlot();\r
-                if (kse != NULL)\r
-                {\r
-                    kse->dts = dts2;\r
-                    kse->type = (uint8_t)evtcode;\r
-                    kse->objHandle = hnd8; \r
-                    kse->param = p8;\r
-                    prvTraceUpdateCounters();\r
-                }\r
-            }            \r
-        }\r
-    }\r
+       if (RecorderDataPtr->recorderActive && handle_of_last_logged_task && (! inExcludedTask || nISRactive))\r
+       {\r
+               /* Check if the referenced object or the event code is excluded */\r
+               if (!uiTraceIsObjectExcluded(objectClass, (objectHandleType)objectNumber) &&\r
+                       !TRACE_GET_EVENT_CODE_FLAG_ISEXCLUDED(evtcode))\r
+               {\r
+                       dts2 = (uint8_t)prvTraceGetDTS(0xFF);\r
+                       p8 = (uint8_t) prvTraceGetParam(0xFF, param);\r
+                       hnd8 = prvTraceGet8BitHandle((objectHandleType)objectNumber);\r
+                       kse = (KernelCallWithParamAndHandle*) xTraceNextFreeEventBufferSlot();\r
+                       if (kse != NULL)\r
+                       {\r
+                               kse->dts = dts2;\r
+                               kse->type = (uint8_t)evtcode;\r
+                               kse->objHandle = hnd8;\r
+                               kse->param = p8;\r
+                               prvTraceUpdateCounters();\r
+                       }\r
+               }\r
+       }\r
        trcCRITICAL_SECTION_END();\r
+#endif /* TRACE_SCHEDULING_ONLY */\r
 }\r
 \r
+#if (TRACE_SCHEDULING_ONLY == 0)\r
+\r
 /*******************************************************************************\r
  * prvTraceGetParam\r
  *\r
@@ -346,9 +366,10 @@ void vTraceStoreKernelCallWithParam(uint32_t evtcode,
 static uint32_t prvTraceGetParam(uint32_t param_max, uint32_t param)\r
 {\r
        XPSEvent* xps;\r
-       \r
-       TRACE_ASSERT(param_max == 0xFF || param_max == 0xFFFF, "prvTraceGetParam: Invalid value for param_max", param);\r
-       \r
+\r
+       TRACE_ASSERT(param_max == 0xFF || param_max == 0xFFFF,\r
+               "prvTraceGetParam: Invalid value for param_max", param);\r
+\r
        if (param <= param_max)\r
        {\r
                return param;\r
@@ -367,6 +388,7 @@ static uint32_t prvTraceGetParam(uint32_t param_max, uint32_t param)
                return param & param_max;\r
        }\r
 }\r
+#endif\r
 \r
 /*******************************************************************************\r
  * vTraceStoreKernelCallWithNumericParamOnly\r
@@ -376,56 +398,51 @@ static uint32_t prvTraceGetParam(uint32_t param_max, uint32_t param)
  ******************************************************************************/\r
 void vTraceStoreKernelCallWithNumericParamOnly(uint32_t evtcode, uint32_t param)\r
 {\r
-    KernelCallWithParam16 * kse;\r
-    uint8_t dts6;\r
+#if (TRACE_SCHEDULING_ONLY == 0)\r
+       KernelCallWithParam16 * kse;\r
+       uint8_t dts6;\r
        uint16_t restParam;\r
-    TRACE_SR_ALLOC_CRITICAL_SECTION();\r
+       TRACE_SR_ALLOC_CRITICAL_SECTION();\r
 \r
        restParam = 0;\r
 \r
-       TRACE_ASSERT(evtcode < 0xFF, "vTraceStoreKernelCallWithNumericParamOnly: Invalid value for evtcode", );\r
-       \r
+       TRACE_ASSERT(evtcode < 0xFF,\r
+               "vTraceStoreKernelCallWithNumericParamOnly: Invalid value for evtcode", );\r
+\r
        if (recorder_busy)\r
-    {\r
-        /*************************************************************************\r
-        * This may occur if a high-priority ISR is illegally using a system call,\r
-        * or creates a user event.\r
-        * Only ISRs that are disabled by TRACE_ENTER_CRITICAL_SECTION may use system calls\r
-        * or user events (see TRACE_MAX_SYSCALL_INTERRUPT_PRIORITY).\r
-        *************************************************************************/\r
-\r
-        vTraceError("Recorder busy - high priority ISR using syscall? (4)");\r
-        return;\r
-    }\r
-       \r
+       {\r
+               /*************************************************************************\r
+               * This may occur if a high-priority ISR is illegally using a system call,\r
+               * or creates a user event.\r
+               * Only ISRs that are disabled by TRACE_ENTER_CRITICAL_SECTION may use system calls\r
+               * or user events (see TRACE_MAX_SYSCALL_INTERRUPT_PRIORITY).\r
+               *************************************************************************/\r
+\r
+               vTraceError("Recorder busy - high priority ISR using syscall? (4)");\r
+               return;\r
+       }\r
+\r
        trcCRITICAL_SECTION_BEGIN();\r
-    if (RecorderDataPtr->recorderActive && handle_of_last_logged_task\r
-        && (! inExcludedTask || nISRactive))\r
-    {\r
-        /* Check if the event code is excluded */\r
-        if (!TRACE_GET_EVENT_CODE_FLAG_ISEXCLUDED(evtcode))\r
-        {            \r
-            dts6 = (uint8_t)prvTraceGetDTS(0xFF);\r
-\r
-            if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
-            {\r
-                               restParam = (uint16_t)prvTraceGetParam(0xFFFF, param);\r
-\r
-                               if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
-                               {\r
-                                       kse = (KernelCallWithParam16*) xTraceNextFreeEventBufferSlot();\r
-                                       if (kse != NULL)\r
-                                       {\r
-                                               kse->dts = dts6;\r
-                                               kse->type = (uint8_t)evtcode;\r
-                                               kse->param = restParam;\r
-                                               prvTraceUpdateCounters();\r
-                                       }\r
-                               }\r
-            }            \r
-        }\r
-    }\r
+       if (RecorderDataPtr->recorderActive && handle_of_last_logged_task\r
+               && (! inExcludedTask || nISRactive))\r
+       {\r
+               /* Check if the event code is excluded */\r
+               if (!TRACE_GET_EVENT_CODE_FLAG_ISEXCLUDED(evtcode))\r
+               {\r
+                       dts6 = (uint8_t)prvTraceGetDTS(0xFF);\r
+                       restParam = (uint16_t)prvTraceGetParam(0xFFFF, param);\r
+                       kse = (KernelCallWithParam16*) xTraceNextFreeEventBufferSlot();\r
+                       if (kse != NULL)\r
+                       {\r
+                               kse->dts = dts6;\r
+                               kse->type = (uint8_t)evtcode;\r
+                               kse->param = restParam;\r
+                               prvTraceUpdateCounters();\r
+                       }\r
+               }\r
+       }\r
        trcCRITICAL_SECTION_END();\r
+#endif /* TRACE_SCHEDULING_ONLY */\r
 }\r
 \r
 /*******************************************************************************\r
@@ -435,39 +452,41 @@ void vTraceStoreKernelCallWithNumericParamOnly(uint32_t evtcode, uint32_t param)
  ******************************************************************************/\r
 void vTraceStoreTaskswitch(objectHandleType task_handle)\r
 {\r
-    uint16_t dts3;\r
-    TSEvent* ts;\r
-    int8_t skipEvent;\r
+       uint16_t dts3;\r
+       TSEvent* ts;\r
+       int8_t skipEvent;\r
+       uint8_t hnd8;\r
        TRACE_SR_ALLOC_CRITICAL_SECTION();\r
-               \r
+\r
        skipEvent = 0;\r
 \r
-       TRACE_ASSERT(task_handle <= NTask, "vTraceStoreTaskswitch: Invalid value for task_handle", );\r
-       \r
-    /***************************************************************************\r
-    This is used to detect if a high-priority ISRs is illegally using the\r
-    recorder ISR trace functions (vTraceStoreISRBegin and ...End) while the\r
-    recorder is busy with a task-level event or lower priority ISR event.\r
-\r
-    If this is detected, it triggers a call to vTraceError with the error\r
-    "Illegal call to vTraceStoreISRBegin/End". If you get this error, it means\r
-    that the macro trcCRITICAL_SECTION_BEGIN does not disable this ISR, as required.\r
-\r
-    Note: Setting recorder_busy is normally handled in our macros\r
-    trcCRITICAL_SECTION_BEGIN and _END, but is needed explicitly in this\r
-    function since critical sections should not be used in the context switch\r
-    event...)\r
-    ***************************************************************************/\r
-    \r
-    /* Skip the event if the task has been excluded, using vTraceExcludeTask */\r
-    if (TRACE_GET_TASK_FLAG_ISEXCLUDED(task_handle))\r
-    {\r
-        skipEvent = 1;\r
-        inExcludedTask = 1;\r
-    }\r
-    else\r
+       TRACE_ASSERT(task_handle <= NTask,\r
+               "vTraceStoreTaskswitch: Invalid value for task_handle", );\r
+\r
+       /***************************************************************************\r
+       This is used to detect if a high-priority ISRs is illegally using the\r
+       recorder ISR trace functions (vTraceStoreISRBegin and ...End) while the\r
+       recorder is busy with a task-level event or lower priority ISR event.\r
+\r
+       If this is detected, it triggers a call to vTraceError with the error\r
+       "Illegal call to vTraceStoreISRBegin/End". If you get this error, it means\r
+       that the macro trcCRITICAL_SECTION_BEGIN does not disable this ISR, as required.\r
+\r
+       Note: Setting recorder_busy is normally handled in our macros\r
+       trcCRITICAL_SECTION_BEGIN and _END, but is needed explicitly in this\r
+       function since critical sections should not be used in the context switch\r
+       event...)\r
+       ***************************************************************************/\r
+\r
+       /* Skip the event if the task has been excluded, using vTraceExcludeTask */\r
+       if (TRACE_GET_TASK_FLAG_ISEXCLUDED(task_handle))\r
        {\r
-        inExcludedTask = 0;\r
+               skipEvent = 1;\r
+               inExcludedTask = 1;\r
+       }\r
+       else\r
+       {\r
+               inExcludedTask = 0;\r
        }\r
 \r
        trcCRITICAL_SECTION_BEGIN_ON_CORTEX_M_ONLY();\r
@@ -477,48 +496,42 @@ void vTraceStoreTaskswitch(objectHandleType task_handle)
        {\r
                skipEvent = 1;\r
        }\r
-       \r
-    if (!RecorderDataPtr->recorderActive)\r
-    {\r
-        skipEvent = 1;\r
-    }\r
-\r
-    /* If this event should be logged, log it! */\r
-    if (skipEvent == 0)\r
-    {\r
-        dts3 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
-\r
-        if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
-        {\r
-                       uint8_t hnd8;\r
-            handle_of_last_logged_task = task_handle;\r
-                       hnd8 = prvTraceGet8BitHandle(handle_of_last_logged_task);\r
-\r
-            ts = (TSEvent*)xTraceNextFreeEventBufferSlot();\r
-\r
-            if (ts != NULL)\r
-            {\r
-                if (uiTraceGetObjectState(TRACE_CLASS_TASK,\r
-                    handle_of_last_logged_task) == TASK_STATE_INSTANCE_ACTIVE)\r
-                {\r
-                    ts->type = TS_TASK_RESUME;\r
-                }\r
-                else\r
-                {\r
-                    ts->type = TS_TASK_BEGIN;\r
-                }\r
-\r
-                ts->dts = dts3;\r
-                ts->objHandle = hnd8;\r
-\r
-                vTraceSetObjectState(TRACE_CLASS_TASK,\r
-                                     handle_of_last_logged_task,\r
-                                     TASK_STATE_INSTANCE_ACTIVE);\r
-\r
-                prvTraceUpdateCounters();\r
-            }\r
-        }\r
-    }\r
+\r
+       if (!RecorderDataPtr->recorderActive)\r
+       {\r
+               skipEvent = 1;\r
+       }\r
+\r
+       /* If this event should be logged, log it! */\r
+       if (skipEvent == 0)\r
+       {\r
+               dts3 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
+               handle_of_last_logged_task = task_handle;\r
+               hnd8 = prvTraceGet8BitHandle(handle_of_last_logged_task);\r
+               ts = (TSEvent*)xTraceNextFreeEventBufferSlot();\r
+\r
+               if (ts != NULL)\r
+               {\r
+                       if (uiTraceGetObjectState(TRACE_CLASS_TASK,\r
+                               handle_of_last_logged_task) == TASK_STATE_INSTANCE_ACTIVE)\r
+                       {\r
+                               ts->type = TS_TASK_RESUME;\r
+                       }\r
+                       else\r
+                       {\r
+                               ts->type = TS_TASK_BEGIN;\r
+                       }\r
+\r
+                       ts->dts = dts3;\r
+                       ts->objHandle = hnd8;\r
+\r
+                       vTraceSetObjectState(TRACE_CLASS_TASK,\r
+                                                                       handle_of_last_logged_task,\r
+                                                                       TASK_STATE_INSTANCE_ACTIVE);\r
+\r
+                       prvTraceUpdateCounters();\r
+               }\r
+       }\r
 \r
        trcCRITICAL_SECTION_END_ON_CORTEX_M_ONLY();\r
 }\r
@@ -533,21 +546,21 @@ void vTraceStoreTaskswitch(objectHandleType task_handle)
  ******************************************************************************/\r
 #if (INCLUDE_OBJECT_DELETE == 1)\r
 void vTraceStoreObjectNameOnCloseEvent(objectHandleType handle,\r
-                                       traceObjectClass objectclass)\r
+                                                                               traceObjectClass objectclass)\r
 {\r
-    ObjCloseNameEvent * ce;\r
-    const char * name;\r
-    traceLabel idx;\r
+       ObjCloseNameEvent * ce;\r
+       const char * name;\r
+       traceLabel idx;\r
 \r
-       TRACE_ASSERT(objectclass < TRACE_NCLASSES, "vTraceStoreObjectNameOnCloseEvent: objectclass >= TRACE_NCLASSES", );\r
-       TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], "vTraceStoreObjectNameOnCloseEvent: Invalid value for handle", );\r
+       TRACE_ASSERT(objectclass < TRACE_NCLASSES,\r
+               "vTraceStoreObjectNameOnCloseEvent: objectclass >= TRACE_NCLASSES", );\r
+       TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass],\r
+               "vTraceStoreObjectNameOnCloseEvent: Invalid value for handle", );\r
 \r
-    if (RecorderDataPtr->recorderActive)\r
+       if (RecorderDataPtr->recorderActive)\r
        {\r
                uint8_t hnd8 = prvTraceGet8BitHandle(handle);\r
-\r
                name = TRACE_PROPERTY_NAME_GET(objectclass, handle);\r
-\r
                idx = prvTraceOpenSymbol(name, 0);\r
 \r
                // Interrupt disable not necessary, already done in trcHooks.h macro\r
@@ -555,7 +568,7 @@ void vTraceStoreObjectNameOnCloseEvent(objectHandleType handle,
                if (ce != NULL)\r
                {\r
                        ce->type = EVENTGROUP_OBJCLOSE_NAME + objectclass;\r
-                       ce->objHandle = hnd8; \r
+                       ce->objHandle = hnd8;\r
                        ce->symbolIndex = idx;\r
                        prvTraceUpdateCounters();\r
                }\r
@@ -563,14 +576,16 @@ void vTraceStoreObjectNameOnCloseEvent(objectHandleType handle,
 }\r
 \r
 void vTraceStoreObjectPropertiesOnCloseEvent(objectHandleType handle,\r
-                                             traceObjectClass objectclass)\r
+                                                                                        traceObjectClass objectclass)\r
 {\r
-    ObjClosePropEvent * pe;\r
-       \r
-    TRACE_ASSERT(objectclass < TRACE_NCLASSES, "vTraceStoreObjectPropertiesOnCloseEvent: objectclass >= TRACE_NCLASSES", );\r
-    TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], "vTraceStoreObjectPropertiesOnCloseEvent: Invalid value for handle", );\r
+       ObjClosePropEvent * pe;\r
+\r
+       TRACE_ASSERT(objectclass < TRACE_NCLASSES,\r
+               "vTraceStoreObjectPropertiesOnCloseEvent: objectclass >= TRACE_NCLASSES", );\r
+       TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass],\r
+               "vTraceStoreObjectPropertiesOnCloseEvent: Invalid value for handle", );\r
 \r
-    if (RecorderDataPtr->recorderActive)\r
+       if (RecorderDataPtr->recorderActive)\r
        {\r
                // Interrupt disable not necessary, already done in trcHooks.h macro\r
                pe = (ObjClosePropEvent*) xTraceNextFreeEventBufferSlot();\r
@@ -579,9 +594,9 @@ void vTraceStoreObjectPropertiesOnCloseEvent(objectHandleType handle,
                        if (objectclass == TRACE_CLASS_TASK)\r
                        {\r
                                pe->arg1 = TRACE_PROPERTY_ACTOR_PRIORITY(objectclass, handle);\r
-                               pe->arg2 = 0; // Legacy - IFE info removed.\r
-                               pe->arg3 = 0; // Legacy - IFE info removed.\r
-                       }else{\r
+                       }\r
+                       else\r
+                       {\r
                                pe->arg1 = TRACE_PROPERTY_OBJECT_STATE(objectclass, handle);\r
                        }\r
                        pe->type = EVENTGROUP_OBJCLOSE_PROP + objectclass;\r
@@ -593,43 +608,52 @@ void vTraceStoreObjectPropertiesOnCloseEvent(objectHandleType handle,
 \r
 void vTraceSetPriorityProperty(uint8_t objectclass, objectHandleType id, uint8_t value)\r
 {\r
-       TRACE_ASSERT(objectclass < TRACE_NCLASSES, "vTraceSetPriorityProperty: objectclass >= TRACE_NCLASSES", );\r
-       TRACE_ASSERT(id <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], "vTraceSetPriorityProperty: Invalid value for id", );\r
+       TRACE_ASSERT(objectclass < TRACE_NCLASSES,\r
+               "vTraceSetPriorityProperty: objectclass >= TRACE_NCLASSES", );\r
+       TRACE_ASSERT(id <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass],\r
+               "vTraceSetPriorityProperty: Invalid value for id", );\r
 \r
-    TRACE_PROPERTY_ACTOR_PRIORITY(objectclass, id) = value;\r
+       TRACE_PROPERTY_ACTOR_PRIORITY(objectclass, id) = value;\r
 }\r
 \r
 uint8_t uiTraceGetPriorityProperty(uint8_t objectclass, objectHandleType id)\r
 {\r
-       TRACE_ASSERT(objectclass < TRACE_NCLASSES, "uiTraceGetPriorityProperty: objectclass >= TRACE_NCLASSES", 0);\r
-       TRACE_ASSERT(id <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], "uiTraceGetPriorityProperty: Invalid value for id", 0);\r
+       TRACE_ASSERT(objectclass < TRACE_NCLASSES,\r
+               "uiTraceGetPriorityProperty: objectclass >= TRACE_NCLASSES", 0);\r
+       TRACE_ASSERT(id <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass],\r
+               "uiTraceGetPriorityProperty: Invalid value for id", 0);\r
 \r
-    return TRACE_PROPERTY_ACTOR_PRIORITY(objectclass, id);\r
+       return TRACE_PROPERTY_ACTOR_PRIORITY(objectclass, id);\r
 }\r
 \r
 void vTraceSetObjectState(uint8_t objectclass, objectHandleType id, uint8_t value)\r
 {\r
-       TRACE_ASSERT(objectclass < TRACE_NCLASSES, "vTraceSetObjectState: objectclass >= TRACE_NCLASSES", );\r
-       TRACE_ASSERT(id <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], "vTraceSetObjectState: Invalid value for id", );\r
-       \r
-    TRACE_PROPERTY_OBJECT_STATE(objectclass, id) = value;\r
+       TRACE_ASSERT(objectclass < TRACE_NCLASSES,\r
+               "vTraceSetObjectState: objectclass >= TRACE_NCLASSES", );\r
+       TRACE_ASSERT(id <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass],\r
+               "vTraceSetObjectState: Invalid value for id", );\r
+\r
+       TRACE_PROPERTY_OBJECT_STATE(objectclass, id) = value;\r
 }\r
 \r
 uint8_t uiTraceGetObjectState(uint8_t objectclass, objectHandleType id)\r
 {\r
-       TRACE_ASSERT(objectclass < TRACE_NCLASSES, "uiTraceGetObjectState: objectclass >= TRACE_NCLASSES", 0);\r
-       TRACE_ASSERT(id <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], "uiTraceGetObjectState: Invalid value for id", 0);\r
-       \r
-    return TRACE_PROPERTY_OBJECT_STATE(objectclass, id);\r
+       TRACE_ASSERT(objectclass < TRACE_NCLASSES,\r
+               "uiTraceGetObjectState: objectclass >= TRACE_NCLASSES", 0);\r
+       TRACE_ASSERT(id <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass],\r
+               "uiTraceGetObjectState: Invalid value for id", 0);\r
+\r
+       return TRACE_PROPERTY_OBJECT_STATE(objectclass, id);\r
 }\r
 \r
 void vTraceSetTaskInstanceFinished(objectHandleType handle)\r
 {\r
-       TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[TRACE_CLASS_TASK], "vTraceSetTaskInstanceFinished: Invalid value for handle", );\r
-       \r
+       TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[TRACE_CLASS_TASK],\r
+               "vTraceSetTaskInstanceFinished: Invalid value for handle", );\r
+\r
 #if (USE_IMPLICIT_IFE_RULES == 1)\r
-    TRACE_PROPERTY_OBJECT_STATE(TRACE_CLASS_TASK, handle) = 0;    \r
+       TRACE_PROPERTY_OBJECT_STATE(TRACE_CLASS_TASK, handle) = 0;\r
 #endif\r
 }\r
 \r
-#endif
\ No newline at end of file
+#endif\r
index a4217e071e1f96eb573c27893eea41a958d95233..ff0b427a8a9a5379a42d1d46ae30cf1840dbc38a 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Tracealyzer v2.6.0 Recorder Library\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcKernelPort.c\r
@@ -31,7 +31,9 @@
  * 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
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2014.\r
  * www.percepio.com\r
  ******************************************************************************/\r
 \r
@@ -56,13 +58,27 @@ traceObjectClass TraceObjectClassTable[5] = {
 int uiInEventGroupSetBitsFromISR = 0;\r
 \r
 extern unsigned char ucQueueGetQueueType(void*);\r
-extern BaseType_t uxQueueGetQueueNumber(void*);\r
+\r
+#if (FREERTOS_VERSION < FREERTOS_VERSION_8_0_OR_LATER)\r
+\r
+extern portBASE_TYPE ucQueueGetQueueNumber(void*);\r
+\r
+objectHandleType prvTraceGetObjectNumber(void* handle)\r
+{\r
+       return (objectHandleType) ucQueueGetQueueNumber(handle);\r
+}\r
+\r
+#else\r
+\r
+extern portBASE_TYPE uxQueueGetQueueNumber(void*);\r
 \r
 objectHandleType prvTraceGetObjectNumber(void* handle)\r
 {\r
-       return ( objectHandleType ) uxQueueGetQueueNumber(handle);      \r
+       return (objectHandleType) uxQueueGetQueueNumber(handle);\r
 }\r
 \r
+#endif\r
+\r
 unsigned char prvTraceGetObjectType(void* handle)\r
 {\r
        return ucQueueGetQueueType(handle);\r
@@ -139,7 +155,7 @@ void vTraceInitObjectHandleStack()
        objectHandleStacks.indexOfNextAvailableHandle[5] = objectHandleStacks.lowestIndexOfClass[5] = NQueue + NSemaphore + NMutex + NTask + NISR;\r
        objectHandleStacks.indexOfNextAvailableHandle[6] = objectHandleStacks.lowestIndexOfClass[6] = NQueue + NSemaphore + NMutex + NTask + NISR + NTimer;\r
 \r
-    objectHandleStacks.highestIndexOfClass[0] = NQueue - 1;\r
+       objectHandleStacks.highestIndexOfClass[0] = NQueue - 1;\r
        objectHandleStacks.highestIndexOfClass[1] = NQueue + NSemaphore - 1;\r
        objectHandleStacks.highestIndexOfClass[2] = NQueue + NSemaphore + NMutex - 1;\r
        objectHandleStacks.highestIndexOfClass[3] = NQueue + NSemaphore + NMutex + NTask - 1;\r
index 5f46a809de9879f9df94da9cc51a464e65888cd1..57c53ffbca848973f108a4a20d364ffebeb757c2 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Tracealyzer v2.6.0 Recorder Library\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcUser.c\r
@@ -31,7 +31,9 @@
  * 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
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2014.\r
  * www.percepio.com\r
  ******************************************************************************/\r
 #include "FreeRTOS.h"\r
@@ -56,7 +58,7 @@ extern uint32_t hwtc_count_sum_after_tick;
 extern uint32_t hwtc_count_sum_after_tick_counter;\r
 extern char* traceErrorMessage;\r
 \r
-/*** private functions *******************************************************/\r
+/*** Private functions *******************************************************/\r
 void vTracePrintF_Helper(traceLabel eventLabel, const char* formatStr, va_list vl);\r
 \r
 #if (USE_SEPARATE_USER_EVENT_BUFFER == 1)\r
@@ -64,8 +66,8 @@ void vTraceChannelPrintF_Helper(UserEventChannel channelPair, va_list vl);
 static void prvTraceUserEventHelper1(UserEventChannel channel, traceLabel eventLabel, traceLabel formatLabel, va_list vl);\r
 static void prvTraceUserEventHelper2(UserEventChannel channel, uint32_t* data, uint32_t noOfSlots);\r
 #endif\r
-/*****************************************************************************/\r
 \r
+static void prvTraceTaskInstanceFinish(int8_t direct);\r
 \r
 \r
 /*******************************************************************************\r
@@ -93,6 +95,16 @@ void vTraceSetRecorderData(void* pRecorderData)
 }\r
 #endif\r
 \r
+/*******************************************************************************\r
+ * vTraceSetStopHook\r
+ *\r
+ * Sets a function to be called when the recorder is stopped.\r
+ ******************************************************************************/\r
+void vTraceSetStopHook(TRACE_STOP_HOOK stopHookFunction)\r
+{\r
+       vTraceStopHookPtr = stopHookFunction;\r
+}\r
+\r
 /*******************************************************************************\r
  * vTraceClear\r
  *\r
@@ -101,17 +113,21 @@ void vTraceSetRecorderData(void* pRecorderData)
  ******************************************************************************/\r
 void vTraceClear(void)\r
 {\r
-    TRACE_SR_ALLOC_CRITICAL_SECTION();\r
-    trcCRITICAL_SECTION_BEGIN();\r
+       TRACE_SR_ALLOC_CRITICAL_SECTION();\r
+       trcCRITICAL_SECTION_BEGIN();\r
 \r
-    RecorderDataPtr->absTimeLastEvent = 0;\r
-    RecorderDataPtr->nextFreeIndex = 0;\r
-    RecorderDataPtr->numEvents = 0;\r
-    RecorderDataPtr->bufferIsFull = 0;\r
+       RecorderDataPtr->absTimeLastEventSecond = 0;\r
+\r
+       RecorderDataPtr->absTimeLastEvent = 0;\r
+       RecorderDataPtr->nextFreeIndex = 0;\r
+       RecorderDataPtr->numEvents = 0;\r
+       RecorderDataPtr->bufferIsFull = 0;\r
        traceErrorMessage = NULL;\r
        RecorderDataPtr->internalErrorOccured = 0;\r
 \r
-    trcCRITICAL_SECTION_END();\r
+       memset(RecorderDataPtr->eventData, 0, RecorderDataPtr->maxEvents * 4);\r
+\r
+       trcCRITICAL_SECTION_END();\r
 \r
 }\r
 \r
@@ -131,7 +147,7 @@ void vTraceClear(void)
 uint32_t uiTraceStart(void)\r
 {\r
        objectHandleType handle;\r
-    TRACE_SR_ALLOC_CRITICAL_SECTION();\r
+       TRACE_SR_ALLOC_CRITICAL_SECTION();\r
 \r
        handle = 0;\r
 \r
@@ -140,10 +156,11 @@ uint32_t uiTraceStart(void)
                vTraceError("RecorderDataPtr is NULL. Call vTraceInitTraceData() before starting trace.");\r
                return 0;\r
        }\r
-    if (traceErrorMessage == NULL)\r
-    {\r
-        trcCRITICAL_SECTION_BEGIN();\r
-        RecorderDataPtr->recorderActive = 1;\r
+\r
+       if (traceErrorMessage == NULL)\r
+       {\r
+               trcCRITICAL_SECTION_BEGIN();\r
+               RecorderDataPtr->recorderActive = 1;\r
 \r
                handle = TRACE_GET_TASK_NUMBER(TRACE_GET_CURRENT_TASK());\r
                if (handle == 0)\r
@@ -157,11 +174,11 @@ uint32_t uiTraceStart(void)
                        vTraceSetPriorityProperty(TRACE_CLASS_TASK, handle, 0);\r
                }\r
 \r
-        vTraceStoreTaskswitch(handle); /* Register the currently running task */\r
-        trcCRITICAL_SECTION_END();\r
-    }\r
+               vTraceStoreTaskswitch(handle); /* Register the currently running task */\r
+               trcCRITICAL_SECTION_END();\r
+       }\r
 \r
-    return RecorderDataPtr->recorderActive;\r
+       return RecorderDataPtr->recorderActive;\r
 }\r
 \r
 /*******************************************************************************\r
@@ -176,7 +193,7 @@ uint32_t uiTraceStart(void)
  ******************************************************************************/\r
 void vTraceStart(void)\r
 {\r
-    (void)uiTraceStart();\r
+       (void)uiTraceStart();\r
 }\r
 \r
 /*******************************************************************************\r
@@ -187,11 +204,11 @@ void vTraceStart(void)
  ******************************************************************************/\r
 void vTraceStop(void)\r
 {\r
-    RecorderDataPtr->recorderActive = 0;\r
-       \r
+       RecorderDataPtr->recorderActive = 0;\r
+\r
        if (vTraceStopHookPtr != (TRACE_STOP_HOOK)0)\r
        {\r
-               (*vTraceStopHookPtr)();                      /* Call an application level call back function. */\r
+               (*vTraceStopHookPtr)();                 /* An application call-back function. */\r
        }\r
 }\r
 \r
@@ -209,15 +226,15 @@ char* xTraceGetLastError(void)
 /*******************************************************************************\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
+* 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
        ( void ) resetErrorMessage;\r
-       traceErrorMessage = NULL;       \r
+       traceErrorMessage = NULL;\r
        RecorderDataPtr->internalErrorOccured = 0;\r
 }\r
 \r
@@ -231,7 +248,7 @@ void vTraceClearError(int resetErrorMessage)
  ******************************************************************************/\r
 void* vTraceGetTraceBuffer(void)\r
 {\r
-    return RecorderDataPtr;\r
+       return RecorderDataPtr;\r
 }\r
 \r
 /*******************************************************************************\r
@@ -243,23 +260,101 @@ void* vTraceGetTraceBuffer(void)
  ******************************************************************************/\r
 uint32_t uiTraceGetTraceBufferSize(void)\r
 {\r
-    return sizeof(RecorderDataType);\r
+       return sizeof(RecorderDataType);\r
+}\r
+\r
+/******************************************************************************\r
+ * prvTraceTaskInstanceFinish.\r
+ *\r
+ * Private common function for the vTraceTaskInstanceFinishXXX functions.\r
+ * \r
+ *****************************************************************************/\r
+void prvTraceTaskInstanceFinish(int8_t direct)\r
+{\r
+       TaskInstanceStatusEvent* tis;\r
+       uint8_t dts45;\r
+\r
+       TRACE_SR_ALLOC_CRITICAL_SECTION();\r
+\r
+       trcCRITICAL_SECTION_BEGIN();\r
+       if (RecorderDataPtr->recorderActive && (! inExcludedTask || nISRactive) && handle_of_last_logged_task)\r
+       {\r
+               dts45 = (uint8_t)prvTraceGetDTS(0xFF);\r
+               tis = (TaskInstanceStatusEvent*) xTraceNextFreeEventBufferSlot();\r
+               if (tis != NULL)\r
+               {\r
+                       if (direct == 0)\r
+                               tis->type = TASK_INSTANCE_FINISHED_NEXT_KSE;\r
+                       else\r
+                               tis->type = TASK_INSTANCE_FINISHED_DIRECT;\r
+\r
+                       tis->dts = dts45;\r
+                       prvTraceUpdateCounters();\r
+               }\r
+       }\r
+       trcCRITICAL_SECTION_END();\r
 }\r
 \r
 /******************************************************************************\r
- * vTraceTaskInstanceIsFinished\r
+ * vTraceTaskInstanceFinish(void)\r
+ *\r
+ * Marks the current task instance as finished on the next kernel call.\r
+ *\r
+ * If that kernel call is blocking, the instance ends after the blocking event\r
+ * and the corresponding return event is then the start of the next instance.\r
+ * If the kernel call is not blocking, the viewer instead splits the current\r
+ * fragment right before the kernel call, which makes this call the first event\r
+ * of the next instance.\r
+ *\r
+ * See also USE_IMPLICIT_IFE_RULES in trcConfig.h\r
+ *\r
+ * Example:\r
+ *\r
+ *             while(1)\r
+ *             {\r
+ *                     xQueueReceive(CommandQueue, &command, timeoutDuration);\r
+ *                     processCommand(command);\r
+ *          vTraceInstanceFinish();\r
+ *             }\r
+ *\r
+ * Note: This is only supported in Tracealyzer tools v2.7 or later\r
  *\r
- * This defines an explicit Instance Finish Event for the current task. It tells\r
- * the recorder that the current instance of this task is finished at the \r
- * context-switch. This function should be called right before the API function \r
- * call considered to be the Instance Finish Event.\r
  *****************************************************************************/\r
-void vTraceTaskInstanceIsFinished()\r
+void vTraceTaskInstanceFinish(void)\r
 {\r
-    if (handle_of_last_logged_task)\r
-    {\r
-               TRACE_PROPERTY_OBJECT_STATE(TRACE_CLASS_TASK, handle_of_last_logged_task) = 0;\r
-    }\r
+    prvTraceTaskInstanceFinish(0);\r
+}\r
+\r
+/******************************************************************************\r
+ * vTraceTaskInstanceFinishDirect(void)\r
+ *\r
+ * Marks the current task instance as finished at this very instant.\r
+ * This makes the viewer to splits the current fragment at this point and begin\r
+ * a new actor instance.\r
+ *\r
+ * See also USE_IMPLICIT_IFE_RULES in trcConfig.h\r
+ *\r
+ * Example:\r
+ *\r
+ *             This example will generate two instances for each loop iteration.\r
+ *             The first instance ends at vTraceInstanceFinishDirect(), while the second\r
+ *      instance ends at the next xQueueReceive call.\r
+ *\r
+ *             while (1)\r
+ *             {\r
+ *          xQueueReceive(CommandQueue, &command, timeoutDuration);\r
+ *                     ProcessCommand(command);\r
+ *                     vTraceInstanceFinishDirect();\r
+ *                     DoSometingElse();\r
+ *          vTraceInstanceFinish();\r
+ *      }\r
+ *\r
+ * Note: This is only supported in Tracealyzer tools v2.7 or later\r
+ *\r
+ *****************************************************************************/\r
+void vTraceTaskInstanceFinishDirect(void)\r
+{\r
+       prvTraceTaskInstanceFinish(1);\r
 }\r
 \r
 /*******************************************************************************\r
@@ -280,17 +375,17 @@ static uint8_t isrstack[MAX_ISR_NESTING];
  * started.\r
  *\r
  * Example:\r
- *     #define ID_ISR_TIMER1 1       // lowest valid ID is 1\r
- *     #define PRIO_OF_ISR_TIMER1 3  // the hardware priority of the interrupt\r
- *     ...\r
- *     vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);\r
- *     ...\r
- *     void ISR_handler()\r
- *     {\r
- *         vTraceStoreISRBegin(ID_OF_ISR_TIMER1);\r
- *         ...\r
- *         vTraceStoreISREnd();\r
- *     }\r
+ *      #define ID_ISR_TIMER1 1                // lowest valid ID is 1\r
+ *      #define PRIO_OF_ISR_TIMER1 3 // the hardware priority of the interrupt\r
+ *      ...\r
+ *      vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);\r
+ *      ...\r
+ *      void ISR_handler()\r
+ *      {\r
+ *              vTraceStoreISRBegin(ID_OF_ISR_TIMER1);\r
+ *              ...\r
+ *              vTraceStoreISREnd(0);\r
+ *      }\r
  *\r
  * NOTE: To safely record ISRs, you need to make sure that all traced\r
  * interrupts actually are disabled by trcCRITICAL_SECTION_BEGIN(). However,\r
@@ -302,10 +397,9 @@ void vTraceSetISRProperties(objectHandleType handle, const char* name, char prio
 {\r
        TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[TRACE_CLASS_ISR], "vTraceSetISRProperties: Invalid value for handle", );\r
        TRACE_ASSERT(name != NULL, "vTraceSetISRProperties: name == NULL", );\r
-       TRACE_ASSERT(priority >= 0, "vTraceSetISRProperties: Invalid value for priority", );\r
 \r
-    vTraceSetObjectName(TRACE_CLASS_ISR, handle, name);\r
-    vTraceSetPriorityProperty(TRACE_CLASS_ISR, handle, priority);\r
+       vTraceSetObjectName(TRACE_CLASS_ISR, handle, name);\r
+       vTraceSetPriorityProperty(TRACE_CLASS_ISR, handle, priority);\r
 }\r
 \r
 #if (SELECTED_PORT == PORT_ARM_CortexM)\r
@@ -314,31 +408,35 @@ void vTraceSetISRProperties(objectHandleType handle, const char* name, char prio
  *\r
  * ISR_TAILCHAINING_THRESHOLD (For Cortex-M devices only)\r
  *\r
- * ARM Cortex-M devices may execute ISRs back-to-back (tail-chained) without \r
- * resuming the previous context in between. Since this is decided in \r
+ * ARM Cortex-M devices may execute ISRs back-to-back (tail-chained) without\r
+ * resuming the previous context in between. Since this is decided in\r
  * hardware, we can only detect this indirectly, in the following manner:\r
  *\r
- * When entering vTraceStoreISRBegin, we check the number of CPU cycles since \r
+ * When entering vTraceStoreISRBegin, we check the number of CPU cycles since\r
  * the last return of vTraceStoreISREnd. If less or equal to the constant\r
  * ISR_TAILCHAINING_THRESHOLD it is assumed that the ISRs executed back-to-back\r
- * (tail-chained). In that case, the previously stored RESUME event \r
- * (pointed to by ptrLastISRExitEvent) is then deleted to avoid showing a \r
+ * (tail-chained). In that case, the previously stored RESUME event\r
+ * (pointed to by ptrLastISRExitEvent) is then deleted to avoid showing a\r
  * fragment of the previous context in between the ISR events. The delete is\r
  * made by replacing the event code with a XTS16L event, that serves to keep\r
  * the differential timestamp from the earlier event.\r
  *\r
- * The value of ISR_TAILCHAINING_THRESHOLD depends on the interrupt latency of \r
- * the processor, on the compiler and on the compiler settings, but should be \r
- * around 70 cycles. The default value is 66 cycles, which should be correct when \r
+ * The value of ISR_TAILCHAINING_THRESHOLD depends on the interrupt latency of\r
+ * the processor, on the compiler and on the compiler settings, but should be\r
+ * around 70 cycles. The default value is 66 cycles, which should be correct when\r
  * using GCC with optimizations disabled (-O0) and Cortex-M3/M4.\r
  *\r
  * To measure this value, see MEASURE_ISR_TAILCHAINING_THRESHOLD below.\r
  *\r
- * If this value set too low, tail-chained ISRs will incorrectly be shown \r
+ * If this value set too low, tail-chained ISRs will incorrectly be shown\r
  * separated, with a short fragment of the previous task or ISR in between.\r
- * If this value is set too high, you get the opposite effect - separate ISRs \r
- * will appear to execute tail-chained and will appear to have higher execution \r
+ * If this value is set too high, you get the opposite effect - separate ISRs\r
+ * will appear to execute tail-chained and will appear to have higher execution\r
  * time and response time (maximum ISR_TAILCHAINING_THRESHOLD cycles more).\r
+ *\r
+ * Read the blog post explaining this on our website:\r
+ * http://percepio.com/2014/05/06/sw-based-exc-tracing-arm-cortex-m/\r
+ *\r
  *****************************************************************************/\r
 #define ISR_TAILCHAINING_THRESHOLD 66\r
 \r
@@ -350,52 +448,55 @@ uint32_t DWTCycleCountAtLastISRExit = 0;
  *\r
  * MEASURE_ISR_TAILCHAINING_THRESHOLD (For Cortex-M devices only)\r
  *\r
- * Allows for measuring the value of ISR_TAILCHAINING_THRESHOLD (see above).\r
+ * Allows for calibrating the value of ISR_TAILCHAINING_THRESHOLD (see above).\r
  *\r
  * This is intended to measure the minimum number of clock cycles from the end\r
  * of vTraceStoreISREnd to the beginning of the following vTraceStoreISRBegin.\r
- * For this purpose, we assume a test setup using the SysTick interrupt, which \r
- * is available on most Cortex-M devices and typically used by the RTOS kernel. \r
+ * For this purpose, we assume a test setup using the SysTick interrupt, which\r
+ * is available on most Cortex-M devices and typically used by the RTOS kernel.\r
  * To do the measurement, follow these steps:\r
- * \r
+ *\r
  * 1. Make sure MEASURE_ISR_TAILCHAINING_THRESHOLD is enabled (defined as 1)\r
  *\r
  * 2. Temporarily replace your SysTick handler with the following:\r
- *    \r
- *    void xPortSysTickHandler( void )\r
- *    {\r
- *       vTraceStoreISRBegin(1); \r
- *       vTraceStoreISREnd();\r
- *    }\r
- *\r
- * 3. To make sure that the ISRs execute back-to-back, increase the OS tick \r
- *    frequency to a very high level so that the OS tick interrupt execute \r
- *    continuously with no application tasks in between. A tick frequency of \r
- *    1 MHz (1.000.000) should be sufficient.\r
- *\r
- * 4. Put a breakpoint in the highest priority task and make sure it is not \r
- *    reached. This means that the SysTick handler is executing at maximum rate\r
- *    and thereby tail-chained, where the interrupt latency is 6 cycles.\r
- *\r
- * 5. Let the system run without breakpoints and inspect the value of \r
- *    threshold_low_watermark. This is the minimum total latency observed. \r
- *    The hardware latency is 6 clock cycles due to the tail-chaining, so the \r
- *    software latency (SL) is then SL = threshold_low_watermark - 6.\r
- * \r
- * The threshold value ISR_TAILCHAINING_THRESHOLD should be SL + 2 * HL, where \r
- * HL is the normal hardware interrupt latency, i.e., the number of CPU \r
- * cycles to enter or exit the exception handler for an exception in task \r
+ *\r
+ *     void xPortSysTickHandler( void )\r
+ *     {\r
+ *             vTraceStoreISRBegin(1);\r
+ *             vTraceStoreISREnd(0);\r
+ *     }\r
+ *\r
+ * 3. To make sure that the ISRs execute back-to-back, increase the OS tick\r
+ *     frequency to a very high level so that the OS tick interrupt execute\r
+ *     continuously with no application tasks in between, e.g. 10 MHz.\r
+ *\r
+ * 4. Put a breakpoint in the highest priority task and make sure it is not\r
+ *     reached. This means that the SysTick handler is executing at maximum rate\r
+ *     and thereby tail-chained, where the interrupt latency is 6 cycles.\r
+ *\r
+ * 5. Let the system run without breakpoints and inspect the value of\r
+ *     threshold_low_watermark. This is the minimum total latency observed.\r
+ *     The hardware latency is 6 clock cycles due to the tail-chaining, so the\r
+ *     software latency (SL) is then SL = threshold_low_watermark - 6.\r
+ *\r
+ * The threshold value ISR_TAILCHAINING_THRESHOLD should be SL + 2 * HL, where\r
+ * HL is the normal hardware interrupt latency, i.e., the number of CPU\r
+ * cycles to enter or exit the exception handler for an exception in task\r
  * context. The HL value is 12-16 depending on core, as shown below.\r
- * \r
+ *\r
  * Values for ISR_TAILCHAINING_THRESHOLD, assuming SL = 42\r
- *   Cortex-M3 and M4 (HL = 12):       66 cycles\r
- *   Cortex-M0 (HL = 16):                      74 cycles\r
- *   Cortex-M0+ (HL = 15):          72 cycles\r
+ *     Cortex-M3 and M4 (HL = 12):     66 cycles\r
+ *     Cortex-M0 (HL = 16):            74 cycles\r
+ *     Cortex-M0+ (HL = 15):           72 cycles\r
  *\r
  * If the ISR_TAILCHAINING_THRESHOLD value is set too low, some tail-chained\r
- * ISRs be shown separated, with a short fragment of the previous actor. If \r
- * the value is set too high, separate ISRs will appear to execute tail-chained\r
- * and for too long time.\r
+ * ISRs be shown separated, with a short fragment of the previous context\r
+ * in between. On the other hand, if the value is set too high, ISRs that \r
+ * actually are separated may appear to execute back-to-back (tail-chained).\r
+ *\r
+ * Read the blog post explaining this on our website:\r
+ * http://percepio.com/2014/05/06/sw-based-exc-tracing-arm-cortex-m/\r
+ *\r
  *****************************************************************************/\r
 #define MEASURE_ISR_TAILCHAINING_THRESHOLD 1\r
 \r
@@ -411,94 +512,94 @@ volatile uint32_t threshold_low_watermark = 2000000000;
  * Registers the beginning of an Interrupt Service Routine.\r
  *\r
  * Example:\r
- *     #define ID_ISR_TIMER1 1       // lowest valid ID is 1\r
- *     #define PRIO_OF_ISR_TIMER1 3  // the hardware priority of the interrupt\r
- *     ...\r
- *     vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);\r
- *     ...\r
- *     void ISR_handler()\r
- *     {\r
- *         vTraceStoreISRBegin(ID_OF_ISR_TIMER1);\r
- *         ...\r
- *         vTraceStoreISREnd();\r
- *     }\r
+ *      #define ID_ISR_TIMER1 1                // lowest valid ID is 1\r
+ *      #define PRIO_OF_ISR_TIMER1 3 // the hardware priority of the interrupt\r
+ *      ...\r
+ *      vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);\r
+ *      ...\r
+ *      void ISR_handler()\r
+ *      {\r
+ *              vTraceStoreISRBegin(ID_OF_ISR_TIMER1);\r
+ *              ...\r
+ *              vTraceStoreISREnd(0);\r
+ *      }\r
  *\r
  ******************************************************************************/\r
 void vTraceStoreISRBegin(objectHandleType handle)\r
 {\r
-    uint16_t dts4;\r
+       uint16_t dts4;\r
        #if (SELECTED_PORT == PORT_ARM_CortexM)\r
-       uint32_t CPUCyclesSinceLastISRExit = DWT_CYCLE_COUNTER - DWTCycleCountAtLastISRExit;\r
-       #endif  \r
-    TSEvent* ts;\r
-    TRACE_SR_ALLOC_CRITICAL_SECTION();\r
+       uint32_t CPUCyclesSinceLastISRExit = REG_DWT_CYCCNT - DWTCycleCountAtLastISRExit;\r
+       #endif\r
+       TSEvent* ts;\r
+       TRACE_SR_ALLOC_CRITICAL_SECTION();\r
 \r
        ts = NULL;\r
 \r
 #if (SELECTED_PORT == PORT_ARM_CortexM)\r
-       if (DWTCycleCountAtLastISRExit > 0)     \r
+       if (DWTCycleCountAtLastISRExit > 0)\r
        {\r
-               #if (MEASURE_ISR_TAILCHAINING_THRESHOLD == 1)           \r
+               #if (MEASURE_ISR_TAILCHAINING_THRESHOLD == 1)\r
                /* Allows for verifying the value of ISR_TAILCHAINING_THRESHOLD */\r
                if (CPUCyclesSinceLastISRExit < threshold_low_watermark)\r
                {\r
                        threshold_low_watermark = CPUCyclesSinceLastISRExit;\r
                }\r
                #endif\r
-               \r
-               if (CPUCyclesSinceLastISRExit <= ISR_TAILCHAINING_THRESHOLD)            \r
-               {                       \r
-                       /* This is judged to be a case of ISR tail-chaining since the \r
+\r
+               if (CPUCyclesSinceLastISRExit <= ISR_TAILCHAINING_THRESHOLD)\r
+               {\r
+                       /* This is judged to be a case of ISR tail-chaining since the\r
                        number of cycles since the last vTraceStoreISREnd is shorter or equal to\r
                        the threshold (ISR_TAILCHAINING_THRESHOLD) */\r
-                       \r
+\r
                        if (ptrLastISRExitEvent != NULL)\r
-                       {                               \r
+                       {\r
                                /* Overwrite the last ISR exit event with a "neutral" event that only\r
-                   accounts for the time passed */\r
-                               *ptrLastISRExitEvent = XTS16L;                                                  \r
-                       }                       \r
+                                       accounts for the time passed */\r
+                               *ptrLastISRExitEvent = XTS16L;\r
+                       }\r
                }\r
-               \r
+\r
        }\r
 #endif\r
-       \r
-    if (recorder_busy)\r
-    {\r
-      vTraceError("Illegal call to vTraceStoreISRBegin, recorder busy!");\r
-      return;\r
-    }\r
+\r
+       if (recorder_busy)\r
+       {\r
+        vTraceError("Illegal call to vTraceStoreISRBegin, recorder busy!");\r
+        return;\r
+       }\r
        trcCRITICAL_SECTION_BEGIN();\r
-    if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
-    {\r
+       if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
+       {\r
 \r
-           TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[TRACE_CLASS_ISR], "vTraceStoreISRBegin: Invalid value for handle", );\r
+               TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[TRACE_CLASS_ISR], "vTraceStoreISRBegin: Invalid value for handle", );\r
 \r
-        dts4 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
+               dts4 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
 \r
-        if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
-        {\r
-            if (nISRactive < MAX_ISR_NESTING)\r
-            {\r
+               if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
+               {\r
+                       if (nISRactive < MAX_ISR_NESTING)\r
+                       {\r
                                uint8_t hnd8 = prvTraceGet8BitHandle(handle);\r
-                isrstack[nISRactive] = handle;\r
-                nISRactive++;\r
-                ts = (TSEvent*)xTraceNextFreeEventBufferSlot();\r
-                if (ts != NULL)\r
-                {\r
-                    ts->type = TS_ISR_BEGIN;\r
-                    ts->dts = dts4;\r
-                    ts->objHandle = hnd8;\r
-                    prvTraceUpdateCounters();\r
-                }\r
-            }\r
-            else\r
-            {\r
-                /* This should not occur unless something is very wrong */\r
-                vTraceError("Too many nested interrupts!");\r
-            }\r
-        }        \r
-    }\r
+                               isrstack[nISRactive] = handle;\r
+                               nISRactive++;\r
+                               ts = (TSEvent*)xTraceNextFreeEventBufferSlot();\r
+                               if (ts != NULL)\r
+                               {\r
+                                       ts->type = TS_ISR_BEGIN;\r
+                                       ts->dts = dts4;\r
+                                       ts->objHandle = hnd8;\r
+                                       prvTraceUpdateCounters();\r
+                               }\r
+                       }\r
+                       else\r
+                       {\r
+                               /* This should not occur unless something is very wrong */\r
+                               vTraceError("Too many nested interrupts!");\r
+                       }\r
+               }\r
+       }\r
        trcCRITICAL_SECTION_END();\r
 }\r
 \r
@@ -507,21 +608,25 @@ void vTraceStoreISRBegin(objectHandleType handle)
  *\r
  * Registers the end of an Interrupt Service Routine.\r
  *\r
+ * The parameter pendingISR indicates if the interrupt has requested a\r
+ * task-switch (= 1) or if the interrupt returns to the earlier context (= 0)\r
+ *\r
  * Example:\r
- *     #define ID_ISR_TIMER1 1       // lowest valid ID is 1\r
- *     #define PRIO_OF_ISR_TIMER1 3  // the hardware priority of the interrupt\r
- *     ...\r
- *     vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);\r
- *     ...\r
- *     void ISR_handler()\r
- *     {\r
- *         vTraceStoreISRBegin(ID_OF_ISR_TIMER1);\r
- *         ...\r
- *         vTraceStoreISREnd();\r
- *     }\r
+ *\r
+ *      #define ID_ISR_TIMER1 1                // lowest valid ID is 1\r
+ *      #define PRIO_OF_ISR_TIMER1 3 // the hardware priority of the interrupt\r
+ *      ...\r
+ *      vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);\r
+ *      ...\r
+ *      void ISR_handler()\r
+ *      {\r
+ *              vTraceStoreISRBegin(ID_OF_ISR_TIMER1);\r
+ *              ...\r
+ *              vTraceStoreISREnd(0);\r
+ *      }\r
  *\r
  ******************************************************************************/\r
-void vTraceStoreISREnd(void)\r
+void vTraceStoreISREnd(int pendingISR)\r
 {\r
        TSEvent* ts;\r
        uint16_t dts5;\r
@@ -534,13 +639,12 @@ void vTraceStoreISREnd(void)
        }\r
 \r
        trcCRITICAL_SECTION_BEGIN();\r
-       if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
-       {               \r
-               dts5 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
-\r
-               if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
+       if (pendingISR == 0)\r
+       {\r
+               if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
                {\r
                        uint8_t hnd8, type;\r
+                       dts5 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
 \r
                        if (nISRactive > 1)\r
                        {\r
@@ -556,24 +660,26 @@ void vTraceStoreISREnd(void)
                        }\r
 \r
                        ts = (TSEvent*)xTraceNextFreeEventBufferSlot();\r
-\r
                        if (ts != NULL)\r
                        {\r
                                ts->type = type;\r
                                ts->objHandle = hnd8;\r
                                ts->dts = dts5;\r
-                               nISRactive--;\r
                                prvTraceUpdateCounters();\r
                        }\r
-                                               \r
+\r
+                       #if (SELECTED_PORT == PORT_ARM_CortexM)\r
+                       /* Remember the last ISR exit event, as the event needs to be modified in case of a following ISR entry (if tail-chained ISRs) */\r
+                       ptrLastISRExitEvent = (uint8_t*)ts;\r
+                       #endif\r
                }\r
-               \r
-               #if (SELECTED_PORT == PORT_ARM_CortexM)\r
-               /* Remember the last ISR exit event, as the event needs to be modified in case of a following ISR entry (if tail-chained ISRs) */\r
-               ptrLastISRExitEvent = (uint8_t*)ts;\r
-               DWTCycleCountAtLastISRExit = DWT_CYCLE_COUNTER;\r
-               #endif  \r
        }\r
+       nISRactive--;\r
+\r
+       #if (SELECTED_PORT == PORT_ARM_CortexM)\r
+       DWTCycleCountAtLastISRExit = REG_DWT_CYCCNT;\r
+       #endif\r
+\r
        trcCRITICAL_SECTION_END();\r
 }\r
 \r
@@ -582,21 +688,21 @@ void vTraceStoreISREnd(void)
 /* ISR tracing is turned off */\r
 void vTraceIncreaseISRActive(void)\r
 {\r
-    if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
-        nISRactive++;\r
+       if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
+               nISRactive++;\r
 }\r
 \r
 void vTraceDecreaseISRActive(void)\r
 {\r
-    if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
-        nISRactive--;\r
+       if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
+               nISRactive--;\r
 }\r
 #endif\r
 \r
 \r
-/*******************************************************************************\r
- * User Event functions\r
- ******************************************************************************/\r
+/********************************************************************************/\r
+/* User Event functions                                                                                                                        */\r
+/********************************************************************************/\r
 \r
 #if (INCLUDE_USER_EVENTS == 1)\r
 \r
@@ -606,19 +712,19 @@ static uint8_t writeInt8(void * buffer, uint8_t i, uint8_t value)
 {\r
        TRACE_ASSERT(buffer != NULL, "writeInt8: buffer == NULL", 0);\r
 \r
-    if (i >= MAX_ARG_SIZE)\r
-    {\r
-        return 255;\r
-    }\r
+       if (i >= MAX_ARG_SIZE)\r
+       {\r
+               return 255;\r
+       }\r
 \r
-    ((uint8_t*)buffer)[i] = value;\r
+       ((uint8_t*)buffer)[i] = value;\r
 \r
        if (i + 1 > MAX_ARG_SIZE)\r
        {\r
                return 255;\r
        }\r
 \r
-    return i + 1;\r
+       return i + 1;\r
 }\r
 \r
 /*** Locally used in vTracePrintF ***/\r
@@ -626,26 +732,26 @@ static uint8_t writeInt16(void * buffer, uint8_t i, uint16_t value)
 {\r
        TRACE_ASSERT(buffer != NULL, "writeInt16: buffer == NULL", 0);\r
 \r
-    /* Align to multiple of 2 */\r
-    while ((i % 2) != 0)\r
-    {\r
+       /* Align to multiple of 2 */\r
+       while ((i % 2) != 0)\r
+       {\r
                if (i >= MAX_ARG_SIZE)\r
                {\r
                        return 255;\r
                }\r
 \r
-        ((uint8_t*)buffer)[i] = 0;\r
-        i++;\r
-    }\r
+               ((uint8_t*)buffer)[i] = 0;\r
+               i++;\r
+       }\r
 \r
-    if (i + 2 > MAX_ARG_SIZE)\r
-    {\r
-        return 255;\r
-    }\r
+       if (i + 2 > MAX_ARG_SIZE)\r
+       {\r
+               return 255;\r
+       }\r
 \r
-    ((uint16_t*)buffer)[i/2] = value;\r
+       ((uint16_t*)buffer)[i/2] = value;\r
 \r
-    return i + 2;\r
+       return i + 2;\r
 }\r
 \r
 /*** Locally used in vTracePrintF ***/\r
@@ -653,26 +759,26 @@ static uint8_t writeInt32(void * buffer, uint8_t i, uint32_t value)
 {\r
        TRACE_ASSERT(buffer != NULL, "writeInt32: buffer == NULL", 0);\r
 \r
-    /* A 32 bit value should begin at an even 4-byte address */\r
-    while ((i % 4) != 0)\r
-    {\r
+       /* A 32 bit value should begin at an even 4-byte address */\r
+       while ((i % 4) != 0)\r
+       {\r
                if (i >= MAX_ARG_SIZE)\r
                {\r
                        return 255;\r
                }\r
 \r
-        ((uint8_t*)buffer)[i] = 0;\r
-        i++;\r
-    }\r
+               ((uint8_t*)buffer)[i] = 0;\r
+               i++;\r
+       }\r
 \r
-    if (i + 4 > MAX_ARG_SIZE)\r
-    {\r
-        return 255;\r
-    }\r
+       if (i + 4 > MAX_ARG_SIZE)\r
+       {\r
+               return 255;\r
+       }\r
 \r
-    ((uint32_t*)buffer)[i/4] = value;\r
+       ((uint32_t*)buffer)[i/4] = value;\r
 \r
-    return i + 4;\r
+       return i + 4;\r
 }\r
 \r
 #if (INCLUDE_FLOAT_SUPPORT)\r
@@ -682,59 +788,60 @@ static uint8_t writeFloat(void * buffer, uint8_t i, float value)
 {\r
        TRACE_ASSERT(buffer != NULL, "writeFloat: buffer == NULL", 0);\r
 \r
-    /* A 32 bit value should begin at an even 4-byte address */\r
-    while ((i % 4) != 0)\r
-    {\r
+       /* A 32 bit value should begin at an even 4-byte address */\r
+       while ((i % 4) != 0)\r
+       {\r
                if (i >= MAX_ARG_SIZE)\r
                {\r
                        return 255;\r
                }\r
 \r
-        ((uint8_t*)buffer)[i] = 0;\r
-        i++;\r
-    }\r
+               ((uint8_t*)buffer)[i] = 0;\r
+               i++;\r
+       }\r
 \r
-    if (i + 4 > MAX_ARG_SIZE)\r
-    {\r
-        return 255;\r
-    }\r
+       if (i + 4 > MAX_ARG_SIZE)\r
+       {\r
+               return 255;\r
+       }\r
 \r
-    ((float*)buffer)[i/4] = value;\r
+       ((float*)buffer)[i/4] = value;\r
 \r
-    return i + 4;\r
+       return i + 4;\r
 }\r
 \r
 /*** Locally used in vTracePrintF ***/\r
 static uint8_t writeDouble(void * buffer, uint8_t i, double value)\r
 {\r
+       uint32_t * dest;\r
+       uint32_t * src = (uint32_t*)&value;\r
+\r
        TRACE_ASSERT(buffer != NULL, "writeDouble: buffer == NULL", 0);\r
 \r
-    uint32_t * dest; \r
-    uint32_t * src = (void*)&value;\r
-    /* The double is written as two 32 bit values, and should begin at an even\r
-    4-byte address (to avoid having to align with 8 byte) */\r
-    while (i % 4 != 0)\r
-    {\r
+       /* The double is written as two 32 bit values, and should begin at an even\r
+       4-byte address (to avoid having to align with 8 byte) */\r
+       while (i % 4 != 0)\r
+       {\r
                if (i >= MAX_ARG_SIZE)\r
                {\r
                        return 255;\r
                }\r
 \r
-        ((uint8_t*)buffer)[i] = 0;\r
-        i++;\r
-    }\r
+               ((uint8_t*)buffer)[i] = 0;\r
+               i++;\r
+       }\r
+\r
+       if (i + 8 > MAX_ARG_SIZE)\r
+       {\r
+               return 255;\r
+       }\r
 \r
-    if (i + 8 > MAX_ARG_SIZE)\r
-    {\r
-        return 255;\r
-    }\r
-       \r
-       dest = &(((uint32_t *)buffer)[i]);\r
+       dest = &(((uint32_t *)buffer)[i/4]);\r
 \r
-    dest[0] = src[0];\r
-    dest[1] = src[1];\r
+       dest[0] = src[0];\r
+       dest[1] = src[1];\r
 \r
-    return i + 8;\r
+       return i + 8;\r
 }\r
 \r
 #endif\r
@@ -751,40 +858,40 @@ static uint8_t prvTraceUserEventFormat(const char* formatStr, va_list vl, uint8_
        uint8_t i = byteOffset;\r
 \r
        while (formatStr[formatStrIndex] != '\0')\r
-    {\r
-        if (formatStr[formatStrIndex] == '%')\r
-        {\r
-            argCounter++;\r
+       {\r
+               if (formatStr[formatStrIndex] == '%')\r
+               {\r
+                       argCounter++;\r
 \r
-            if (argCounter > 15)\r
-            {\r
-                vTraceError("vTracePrintF - Too many arguments, max 15 allowed!");\r
-                return 0;\r
-            }\r
+                       if (argCounter > 15)\r
+                       {\r
+                               vTraceError("vTracePrintF - Too many arguments, max 15 allowed!");\r
+                               return 0;\r
+                       }\r
 \r
-/*******************************************************************************\r
-* These below code writes raw data (primitive datatypes) in the event buffer,\r
-* instead of the normal event structs (where byte 0 is event type).\r
-* These data entries must never be interpreted as real event data, as the type\r
-* field would be misleading since used for payload data.\r
-*\r
-* The correctness of this encoding depends on two mechanisms:\r
-*\r
-* 1. An initial USER_EVENT, which type code tells the number of 32-bit data\r
-* entires that follows. (code - USER_EVENT = number of data entries).\r
-* Note that a data entry corresponds to the slots that normally corresponds to\r
-* one (1) event, i.e., 32 bits. vTracePrintF may encode several pieces of data\r
-* in one data entry, e.g., two 16-bit values or four 8-bit values, one 16-bit\r
-* value followed by two 8-bit values, etc.\r
-*\r
-* 2. A two-phase commit procedure, where the USER_EVENT and data entries are\r
-* written to a local buffer at first, and when all checks are OK then copied to\r
-* the main event buffer using a fast memcpy. The event code is finalized as the\r
-* very last step. Before that step, the event code indicates an unfinished\r
-* event, which causes it to be ignored and stop the loading of the file (since\r
-* an unfinished event is the last event in the trace).\r
-*******************************************************************************/\r
-            formatStrIndex++;\r
+                       /*******************************************************************************\r
+                       * These below code writes raw data (primitive datatypes) in the event buffer,\r
+                       * instead of the normal event structs (where byte 0 is event type).\r
+                       * These data entries must never be interpreted as real event data, as the type\r
+                       * field would be misleading since used for payload data.\r
+                       *\r
+                       * The correctness of this encoding depends on two mechanisms:\r
+                       *\r
+                       * 1. An initial USER_EVENT, which type code tells the number of 32-bit data\r
+                       * entires that follows. (code - USER_EVENT = number of data entries).\r
+                       * Note that a data entry corresponds to the slots that normally corresponds to\r
+                       * one (1) event, i.e., 32 bits. vTracePrintF may encode several pieces of data\r
+                       * in one data entry, e.g., two 16-bit values or four 8-bit values, one 16-bit\r
+                       * value followed by two 8-bit values, etc.\r
+                       *\r
+                       * 2. A two-phase commit procedure, where the USER_EVENT and data entries are\r
+                       * written to a local buffer at first, and when all checks are OK then copied to\r
+                       * the main event buffer using a fast memcpy. The event code is finalized as the\r
+                       * very last step. Before that step, the event code indicates an unfinished\r
+                       * event, which causes it to be ignored and stop the loading of the file (since\r
+                       * an unfinished event is the last event in the trace).\r
+                       *******************************************************************************/\r
+                       formatStrIndex++;\r
 \r
                        while ((formatStr[formatStrIndex] >= '0' && formatStr[formatStrIndex] <= '9') || formatStr[formatStrIndex] == '#' || formatStr[formatStrIndex] == '.')\r
                                formatStrIndex++;\r
@@ -793,105 +900,107 @@ static uint8_t prvTraceUserEventFormat(const char* formatStr, va_list vl, uint8_
                        {\r
                                switch (formatStr[formatStrIndex])\r
                                {\r
-                               case 'd':    i = writeInt32(buffer,\r
+                                       case 'd':       i = writeInt32( buffer,\r
                                                                                                i,\r
                                                                                                (uint32_t)va_arg(vl, uint32_t));\r
                                                                break;\r
-                               case 'x':\r
-                               case 'X':\r
-                               case 'u':    i = writeInt32(buffer,\r
+                                       case 'x':\r
+                                       case 'X':\r
+                                       case 'u':       i = writeInt32( buffer,\r
                                                                                                i,\r
                                                                                                (uint32_t)va_arg(vl, uint32_t));\r
                                                                break;\r
-                               case 's':    i = writeInt16(buffer,\r
+                                       case 's':       i = writeInt16( buffer,\r
                                                                                                i,\r
                                                                                                (uint16_t)xTraceOpenLabel((char*)va_arg(vl, char*)));\r
                                                                break;\r
 \r
 #if (INCLUDE_FLOAT_SUPPORT)\r
-                                                               /* Yes, "double" as type also in the float\r
-                                                               case. This since "float" is promoted into "double"\r
-                                                               by the va_arg stuff. */\r
-                               case 'f':    i = writeFloat(buffer,\r
+                                       /* Yes, "double" as type also in the float\r
+                                       case. This since "float" is promoted into "double"\r
+                                       by the va_arg stuff. */\r
+                                       case 'f':       i = writeFloat( buffer,\r
                                                                                                i,\r
                                                                                                (float)va_arg(vl, double));\r
                                                                break;\r
 #else\r
-       /* No support for floats, but attempt to store a float user event\r
-       avoid a possible crash due to float reference. Instead store the\r
-       data on uint_32 format (will not be displayed anyway). This is just\r
-       to keep va_arg and i consistent. */\r
+                                       /* No support for floats, but attempt to store a float user event\r
+                                       avoid a possible crash due to float reference. Instead store the\r
+                                       data on uint_32 format (will not be displayed anyway). This is just\r
+                                       to keep va_arg and i consistent. */\r
 \r
-                               case 'f':    i = writeInt32(buffer,\r
+                                       case 'f':       i = writeInt32( buffer,\r
                                                                                                i,\r
                                                                                                (uint32_t)va_arg(vl, double));\r
                                                                break;\r
 #endif\r
-                               case 'l':\r
-                                       formatStrIndex++;\r
-                                       switch (formatStr[formatStrIndex])\r
-                                       {\r
+                                       case 'l':\r
+                                                               formatStrIndex++;\r
+                                                               switch (formatStr[formatStrIndex])\r
+                                                               {\r
 #if (INCLUDE_FLOAT_SUPPORT)\r
-                                       case 'f':     i = writeDouble(buffer,\r
-                                                                                                               i,\r
-                                                                                                               (double)va_arg(vl, double));\r
-                                                               break;\r
+                                                                       case 'f':       i = writeDouble(buffer,\r
+                                                                                                                               i,\r
+                                                                                                                               (double)va_arg(vl, double));\r
+                                                                                               break;\r
 #else\r
-       /* No support for floats, but attempt to store a float user event\r
-       avoid a possible crash due to float reference. Instead store the\r
-       data on uint_32 format (will not be displayed anyway). This is just\r
-       to keep va_arg and i consistent. */\r
-                                       case 'f':    i = writeInt32(buffer, /* In this case, the value will not be shown anyway */\r
-                                                                                                       i,\r
-                                                                                                       (uint32_t)va_arg(vl, double));\r
-                                                                       i = writeInt32(buffer, /* Do it twice, to write in total 8 bytes */\r
-                                                                                                       i,\r
-                                                                                                       (uint32_t)va_arg(vl, double));\r
-                                                               break;\r
+                                                                       /* No support for floats, but attempt to store a float user event\r
+                                                                       avoid a possible crash due to float reference. Instead store the\r
+                                                                       data on uint_32 format (will not be displayed anyway). This is just\r
+                                                                       to keep va_arg and i consistent. */\r
+                                                                       case 'f':       i = writeInt32( buffer, /* In this case, the value will not be shown anyway */\r
+                                                                                                                               i,\r
+                                                                                                                               (uint32_t)va_arg(vl, double));\r
+\r
+                                                                                               i = writeInt32( buffer, /* Do it twice, to write in total 8 bytes */\r
+                                                                                                                               i,\r
+                                                                                                                               (uint32_t)va_arg(vl, double));\r
+                                                                               break;\r
 #endif\r
 \r
-                                       }\r
-                                       break;\r
-                               case 'h':\r
-                                       formatStrIndex++;\r
-                                       switch (formatStr[formatStrIndex])\r
-                                       {\r
-                                       case 'd':    i = writeInt16(buffer,\r
-                                                                                                       i,\r
-                                                                                                       (uint16_t)va_arg(vl, uint32_t));\r
-                                                                       break;\r
-                                       case 'u':    i = writeInt16(buffer,\r
-                                                                                                       i,\r
-                                                                                                       (uint16_t)va_arg(vl, uint32_t));\r
-                                                                       break;\r
-                                       }\r
-                                       break;\r
-                               case 'b':\r
-                                       formatStrIndex++;\r
-                                       switch (formatStr[formatStrIndex])\r
-                                       {\r
-                                       case 'd':    i = writeInt8(buffer,\r
-                                                                                                       i,\r
-                                                                                                       (uint8_t)va_arg(vl, uint32_t));\r
-                                                                       break;\r
-                                       case 'u':    i = writeInt8(buffer,\r
-                                                                                                       i,\r
-                                                                                                       (uint8_t)va_arg(vl, uint32_t));\r
-                                                                       break;\r
-                                       }\r
-                                       break;\r
+                                                               }\r
+                                                               break;\r
+                                       case 'h':\r
+                                                               formatStrIndex++;\r
+                                                               switch (formatStr[formatStrIndex])\r
+                                                               {\r
+                                                                       case 'd':       i = writeInt16( buffer,\r
+                                                                                                                               i,\r
+                                                                                                                               (uint16_t)va_arg(vl, uint32_t));\r
+                                                                                               break;\r
+                                                                       case 'u':       i = writeInt16( buffer,\r
+                                                                                                                               i,\r
+                                                                                                                               (uint16_t)va_arg(vl, uint32_t));\r
+                                                                                               break;\r
+                                                               }\r
+                                                               break;\r
+                                       case 'b':\r
+                                                               formatStrIndex++;\r
+                                                               switch (formatStr[formatStrIndex])\r
+                                                               {\r
+                                                                       case 'd':       i = writeInt8(  buffer,\r
+                                                                                                                               i,\r
+                                                                                                                               (uint8_t)va_arg(vl, uint32_t));\r
+                                                                                               break;\r
+\r
+                                                                       case 'u':       i = writeInt8(  buffer,\r
+                                                                                                                               i,\r
+                                                                                                                               (uint8_t)va_arg(vl, uint32_t));\r
+                                                                                               break;\r
+                                                               }\r
+                                                               break;\r
                                }\r
                        }\r
                        else\r
                                break;\r
-        }\r
-        formatStrIndex++;\r
-        if (i == 255)\r
-        {\r
-            vTraceError("vTracePrintF - Too large arguments, max 32 byte allowed!");\r
-            return 0;\r
-        }\r
-    }\r
+               }\r
+               formatStrIndex++;\r
+               if (i == 255)\r
+               {\r
+                       vTraceError("vTracePrintF - Too large arguments, max 32 byte allowed!");\r
+                       return 0;\r
+               }\r
+       }\r
        return (i+3)/4;\r
 }\r
 \r
@@ -906,7 +1015,8 @@ static void prvTraceClearChannelBuffer(uint32_t count)
 {\r
        uint32_t slots;\r
 \r
-       TRACE_ASSERT(USER_EVENT_BUFFER_SIZE >= count, "prvTraceClearChannelBuffer: USER_EVENT_BUFFER_SIZE is too small to handle this event.", );\r
+       TRACE_ASSERT(USER_EVENT_BUFFER_SIZE >= count,\r
+               "prvTraceClearChannelBuffer: USER_EVENT_BUFFER_SIZE is too small to handle this event.", );\r
 \r
        /* Check if we're close to the end of the buffer */\r
        if (RecorderDataPtr->userEventBuffer.nextSlotToWrite + count > USER_EVENT_BUFFER_SIZE)\r
@@ -926,8 +1036,10 @@ static void prvTraceClearChannelBuffer(uint32_t count)
  ******************************************************************************/\r
 static void prvTraceCopyToDataBuffer(uint32_t* data, uint32_t count)\r
 {\r
-       TRACE_ASSERT(data != NULL, "prvTraceCopyToDataBuffer: data == NULL.", );\r
-       TRACE_ASSERT(count <= USER_EVENT_BUFFER_SIZE, "prvTraceCopyToDataBuffer: USER_EVENT_BUFFER_SIZE is too small to handle this event.", );\r
+       TRACE_ASSERT(data != NULL,\r
+               "prvTraceCopyToDataBuffer: data == NULL.", );\r
+       TRACE_ASSERT(count <= USER_EVENT_BUFFER_SIZE,\r
+               "prvTraceCopyToDataBuffer: USER_EVENT_BUFFER_SIZE is too small to handle this event.", );\r
 \r
        uint32_t slots;\r
        /* Check if we're close to the end of the buffer */\r
@@ -946,7 +1058,8 @@ static void prvTraceCopyToDataBuffer(uint32_t* data, uint32_t count)
 /*******************************************************************************\r
  * prvTraceUserEventHelper1\r
  *\r
- * Calls on prvTraceUserEventFormat() to do the actual formatting, then goes on to the next helper function.\r
+ * Calls on prvTraceUserEventFormat() to do the actual formatting, then goes on\r
+ * to the next helper function.\r
  ******************************************************************************/\r
 static void prvTraceUserEventHelper1(UserEventChannel channel, traceLabel eventLabel, traceLabel formatLabel, va_list vl)\r
 {\r
@@ -984,7 +1097,10 @@ static void prvTraceUserEventHelper2(UserEventChannel channel, uint32_t* data, u
        vTracePortGetTimeStamp(data);\r
 \r
        if (*data < old_timestamp)\r
+       {\r
                RecorderDataPtr->userEventBuffer.wraparoundCounter++;\r
+       }\r
+\r
        old_timestamp = *data;\r
 \r
        /* Start by erasing any information in the channel buffer */\r
@@ -997,9 +1113,14 @@ static void prvTraceUserEventHelper2(UserEventChannel channel, uint32_t* data, u
 \r
        /* Write to the channel buffer to indicate that this user event is ready to be used */\r
        if (channel != 0)\r
+       {\r
                RecorderDataPtr->userEventBuffer.channelBuffer[old_nextSlotToWrite] = channel;\r
+       }\r
        else\r
-               RecorderDataPtr->userEventBuffer.channelBuffer[old_nextSlotToWrite] = (UserEventChannel)0xFF;   /* 0xFF indicates that this is not a normal channel id */\r
+       {\r
+               /* 0xFF indicates that this is not a normal channel id */\r
+               RecorderDataPtr->userEventBuffer.channelBuffer[old_nextSlotToWrite] = (UserEventChannel)0xFF;\r
+       }\r
        trcCRITICAL_SECTION_END();\r
 }\r
 \r
@@ -1008,7 +1129,7 @@ static void prvTraceUserEventHelper2(UserEventChannel channel, uint32_t* data, u
  *\r
  * Attempts to create a pair of the channel and format string.\r
  *\r
- * Note: This is only available if USE_SEPARATE_USER_EVENT_BUFFER is enabled in \r
+ * Note: This is only available if USE_SEPARATE_USER_EVENT_BUFFER is enabled in\r
  * trcConfig.h\r
  ******************************************************************************/\r
 UserEventChannel xTraceRegisterChannelFormat(traceLabel channel, traceLabel formatStr)\r
@@ -1052,11 +1173,13 @@ UserEventChannel xTraceRegisterChannelFormat(traceLabel channel, traceLabel form
  ******************************************************************************/\r
 void vTraceChannelPrintF(UserEventChannel channelPair, ...)\r
 {\r
+#if (TRACE_SCHEDULING_ONLY == 0)\r
        va_list vl;\r
 \r
        va_start(vl, channelPair);\r
        vTraceChannelPrintF_Helper(channelPair, vl);\r
        va_end(vl);\r
+#endif /* TRACE_SCHEDULING_ONLY */\r
 }\r
 \r
 void vTraceChannelPrintF_Helper(UserEventChannel channelPair, va_list vl)\r
@@ -1080,16 +1203,18 @@ void vTraceChannelPrintF_Helper(UserEventChannel channelPair, va_list vl)
  ******************************************************************************/\r
 void vTraceChannelUserEvent(UserEventChannel channelPair)\r
 {\r
+#if (TRACE_SCHEDULING_ONLY == 0)\r
        uint32_t data[(3 + MAX_ARG_SIZE) / 4];\r
 \r
        TRACE_ASSERT(channelPair != 0, "vTraceChannelPrintF: channelPair == 0", );\r
        TRACE_ASSERT(channelPair <= CHANNEL_FORMAT_PAIRS, "vTraceChannelPrintF: ", );\r
 \r
        prvTraceUserEventHelper2(channelPair, data, 1); /* Only need one slot for timestamp */\r
+#endif /* TRACE_SCHEDULING_ONLY */\r
 }\r
 #endif /* USE_SEPARATE_USER_EVENT_BUFFER == 1 */\r
 \r
- /******************************************************************************\r
+/******************************************************************************\r
  * vTracePrintF\r
  *\r
  * Advanced user events (Professional Edition only)\r
@@ -1102,17 +1227,17 @@ void vTraceChannelUserEvent(UserEventChannel channelPair)
  * User Event labels are created using xTraceOpenLabel.\r
  * Example:\r
  *\r
- *     traceLabel adc_uechannel = xTraceOpenLabel("ADC User Events");\r
- *     ...\r
- *     vTracePrint(adc_uechannel,\r
- *                 "ADC channel %d: %lf volts",\r
- *                 ch, (double)adc_reading/(double)scale);\r
+ *      traceLabel adc_uechannel = xTraceOpenLabel("ADC User Events");\r
+ *      ...\r
+ *      vTracePrint(adc_uechannel,\r
+ *                              "ADC channel %d: %lf volts",\r
+ *                              ch, (double)adc_reading/(double)scale);\r
  *\r
  * This can be combined into one line, if desired, but this is slower:\r
  *\r
- *     vTracePrint(xTraceOpenLabel("ADC User Events"),\r
- *                 "ADC channel %d: %lf volts",\r
- *                 ch, (double)adc_reading/(double)scale);\r
+ *      vTracePrint(xTraceOpenLabel("ADC User Events"),\r
+ *                              "ADC channel %d: %lf volts",\r
+ *                              ch, (double)adc_reading/(double)scale);\r
  *\r
  * Calling xTraceOpenLabel multiple times will not create duplicate entries, but\r
  * it is of course faster to just do it once, and then keep the handle for later\r
@@ -1120,77 +1245,84 @@ void vTraceChannelUserEvent(UserEventChannel channelPair)
  * better to use vTraceUserEvent - it is faster.\r
  *\r
  * Format specifiers supported:\r
- *  %d - 32 bit signed integer\r
- *  %u - 32 bit unsigned integer\r
- *  %f - 32 bit float\r
- *  %s - string (is copied to the recorder symbol table)\r
- *  %hd - 16 bit signed integer\r
- *  %hu - 16 bit unsigned integer\r
- *  %bd - 8 bit signed integer\r
- *  %bu - 8 bit unsigned integer\r
- *  %lf - double-precision float\r
+ * %d - 32 bit signed integer\r
+ * %u - 32 bit unsigned integer\r
+ * %f - 32 bit float\r
+ * %s - string (is copied to the recorder symbol table)\r
+ * %hd - 16 bit signed integer\r
+ * %hu - 16 bit unsigned integer\r
+ * %bd - 8 bit signed integer\r
+ * %bu - 8 bit unsigned integer\r
+ * %lf - double-precision float (Note! See below...)\r
  *\r
  * Up to 15 data arguments are allowed, with a total size of maximum 32 byte.\r
  * In case this is exceeded, the user event is changed into an error message.\r
  *\r
  * The data is stored in trace buffer, and is packed to allow storing multiple\r
  * smaller data entries in the same 4-byte record, e.g., four 8-bit values.\r
- * A string requires two bytes, as the symbol table is limited to 64K. Storing a\r
- * double (%lf) uses two records, so this is quite costly. Use float (%f) unless\r
- * the higher precision is really necessary.\r
+ * A string requires two bytes, as the symbol table is limited to 64K. Storing\r
+ * a double (%lf) uses two records, so this is quite costly. Use float (%f)\r
+ * unless the higher precision is really necessary.\r
+ *\r
+ * Note that the double-precision float (%lf) assumes a 64 bit double\r
+ * representation. This does not seem to be the case on e.g. PIC24 and PIC32.\r
+ * Before using a %lf argument on a 16-bit MCU, please verify that\r
+ * "sizeof(double)" actually gives 8 as expected. If not, use %f instead.\r
  ******************************************************************************/\r
 \r
 void vTracePrintF(traceLabel eventLabel, const char* formatStr, ...)\r
 {\r
+#if (TRACE_SCHEDULING_ONLY == 0)\r
        va_list vl;\r
 \r
        va_start(vl, formatStr);\r
        vTracePrintF_Helper(eventLabel, formatStr, vl);\r
        va_end(vl);\r
+#endif /* TRACE_SCHEDULING_ONLY */\r
 }\r
 \r
 void vTracePrintF_Helper(traceLabel eventLabel, const char* formatStr, va_list vl)\r
 {\r
 #if (USE_SEPARATE_USER_EVENT_BUFFER == 0)\r
        uint32_t noOfSlots;\r
-    UserEvent* ue1;\r
-    uint32_t tempDataBuffer[(3 + MAX_ARG_SIZE) / 4];\r
-    TRACE_SR_ALLOC_CRITICAL_SECTION();\r
-\r
-    /**************************************************************************\r
-    * The array tempDataBuffer is a local buffer used in a two-phase commit of\r
-    * the event data, since a vTracePrintF may span over multiple slots in the\r
-    * buffer.\r
-    * This buffer can be made larger, of course, but remember the risk for\r
-    * stack overflow. Note: This should be a LOCAL buffer, must not be made\r
-    * global. That would cause data corruption when two calls to vTracePrintF\r
-    * from different tasks overlaps (interrupts are only disabled in a small\r
-    * part of this function, otherwise enabled)\r
-    ***************************************************************************/\r
+       UserEvent* ue1;\r
+       uint32_t tempDataBuffer[(3 + MAX_ARG_SIZE) / 4];\r
+       TRACE_SR_ALLOC_CRITICAL_SECTION();\r
+\r
+       /**************************************************************************\r
+       * The array tempDataBuffer is a local buffer used in a two-phase commit of\r
+       * the event data, since a vTracePrintF may span over multiple slots in the\r
+       * buffer.\r
+       * This buffer can be made larger, of course, but remember the risk for\r
+       * stack overflow. Note: This should be a LOCAL buffer, must not be made\r
+       * global. That would cause data corruption when two calls to vTracePrintF\r
+       * from different tasks overlaps (interrupts are only disabled in a small\r
+       * part of this function, otherwise enabled)\r
+       ***************************************************************************/\r
 \r
        TRACE_ASSERT(formatStr != NULL, "vTracePrintF: formatStr == NULL", );\r
 \r
        trcCRITICAL_SECTION_BEGIN();\r
-       \r
-    if (RecorderDataPtr->recorderActive && (! inExcludedTask || nISRactive) && handle_of_last_logged_task)\r
-    {\r
-        /* First, write the "primary" user event entry in the local buffer, but\r
-        let the event type be "EVENT_BEING_WRITTEN" for now...*/\r
 \r
-        ue1 = (UserEvent*)(&tempDataBuffer[0]);\r
-               \r
-        ue1->type = EVENT_BEING_WRITTEN;      /* Update this as the last step */\r
+       if (RecorderDataPtr->recorderActive && (! inExcludedTask || nISRactive) && handle_of_last_logged_task)\r
+       {\r
+               /* First, write the "primary" user event entry in the local buffer, but\r
+               let the event type be "EVENT_BEING_WRITTEN" for now...*/\r
 \r
-        noOfSlots = prvTraceUserEventFormat(formatStr, vl, (uint8_t*)tempDataBuffer, 4);\r
+               ue1 = (UserEvent*)(&tempDataBuffer[0]);\r
 \r
-        /* Store the format string, with a reference to the channel symbol */\r
-        ue1->payload = prvTraceOpenSymbol(formatStr, eventLabel);                      \r
+               ue1->type = EVENT_BEING_WRITTEN;         /* Update this as the last step */\r
+\r
+               noOfSlots = prvTraceUserEventFormat(formatStr, vl, (uint8_t*)tempDataBuffer, 4);\r
+\r
+               /* Store the format string, with a reference to the channel symbol */\r
+               ue1->payload = prvTraceOpenSymbol(formatStr, eventLabel);\r
+\r
+               ue1->dts = (uint8_t)prvTraceGetDTS(0xFF);\r
 \r
-        ue1->dts = (uint8_t)prvTraceGetDTS(0xFF);\r
-               \r
                 /* prvTraceGetDTS might stop the recorder in some cases... */\r
-        if (RecorderDataPtr->recorderActive)\r
-        {\r
+               if (RecorderDataPtr->recorderActive)\r
+               {\r
 \r
                        /* If the data does not fit in the remaining main buffer, wrap around to\r
                        0 if allowed, otherwise stop the recorder and quit). */\r
@@ -1198,21 +1330,21 @@ void vTracePrintF_Helper(traceLabel eventLabel, const char* formatStr, va_list v
                        {\r
                                #if (TRACE_RECORDER_STORE_MODE == TRACE_STORE_MODE_RING_BUFFER)\r
                                (void)memset(& RecorderDataPtr->eventData[RecorderDataPtr->nextFreeIndex * 4],\r
-                                          0,\r
-                                          (RecorderDataPtr->maxEvents - RecorderDataPtr->nextFreeIndex)*4);\r
+                                               0,\r
+                                               (RecorderDataPtr->maxEvents - RecorderDataPtr->nextFreeIndex)*4);\r
                                RecorderDataPtr->nextFreeIndex = 0;\r
                                RecorderDataPtr->bufferIsFull = 1;\r
                                #else\r
-                               \r
+\r
                                /* Stop recorder, since the event data will not fit in the\r
-                               buffer and not circular buffer in this case... */                               \r
-                               vTraceStop();                           \r
+                               buffer and not circular buffer in this case... */\r
+                               vTraceStop();\r
                                #endif\r
                        }\r
-                       \r
+\r
                        /* Check if recorder has been stopped (i.e., vTraceStop above) */\r
                        if (RecorderDataPtr->recorderActive)\r
-                       {                               \r
+                       {\r
                                /* Check that the buffer to be overwritten does not contain any user\r
                                events that would be partially overwritten. If so, they must be "killed"\r
                                by replacing the user event and following data with NULL events (i.e.,\r
@@ -1222,14 +1354,14 @@ void vTracePrintF_Helper(traceLabel eventLabel, const char* formatStr, va_list v
                                #endif\r
                                /* Copy the local buffer to the main buffer */\r
                                (void)memcpy(& RecorderDataPtr->eventData[RecorderDataPtr->nextFreeIndex * 4],\r
-                                          tempDataBuffer,\r
-                                          noOfSlots * 4);\r
+                                               tempDataBuffer,\r
+                                               noOfSlots * 4);\r
 \r
                                /* Update the event type, i.e., number of data entries following the\r
                                main USER_EVENT entry (Note: important that this is after the memcpy,\r
                                but within the critical section!)*/\r
                                RecorderDataPtr->eventData[RecorderDataPtr->nextFreeIndex * 4] =\r
-                                 (uint8_t) ( USER_EVENT + noOfSlots - 1 );\r
+                                (uint8_t) ( USER_EVENT + noOfSlots - 1 );\r
 \r
                                /* Update the main buffer event index (already checked that it fits in\r
                                the buffer, so no need to check for wrapping)*/\r
@@ -1248,21 +1380,13 @@ void vTracePrintF_Helper(traceLabel eventLabel, const char* formatStr, va_list v
                                        vTraceStop();\r
                                        #endif\r
                                }\r
-                               \r
-                               #if (STOP_AFTER_N_EVENTS > -1)\r
-                               /* Check if we have reached the desired number of events */\r
-                               if (RecorderDataPtr->numEvents >= STOP_AFTER_N_EVENTS)\r
-                               {\r
-                                       vTraceStop();\r
-                               }\r
-                               #endif        \r
                        }\r
-                       \r
+\r
                        #if (TRACE_RECORDER_STORE_MODE == TRACE_STORE_MODE_RING_BUFFER)\r
                        /* Make sure the next entry is cleared correctly */\r
                        prvCheckDataToBeOverwrittenForMultiEntryEvents(1);\r
                        #endif\r
-       \r
+\r
                }\r
        }\r
        trcCRITICAL_SECTION_END();\r
@@ -1273,10 +1397,10 @@ void vTracePrintF_Helper(traceLabel eventLabel, const char* formatStr, va_list v
        UserEventChannel channel;\r
 \r
        if (RecorderDataPtr->recorderActive && (! inExcludedTask || nISRactive) && handle_of_last_logged_task)\r
-    {\r
-           formatLabel = xTraceOpenLabel(formatStr);\r
+       {\r
+               formatLabel = xTraceOpenLabel(formatStr);\r
 \r
-           channel = xTraceRegisterChannelFormat(eventLabel, formatLabel);\r
+               channel = xTraceRegisterChannelFormat(eventLabel, formatLabel);\r
 \r
                prvTraceUserEventHelper1(channel, eventLabel, formatLabel, vl);\r
        }\r
@@ -1293,36 +1417,33 @@ void vTracePrintF_Helper(traceLabel eventLabel, const char* formatStr, va_list v
  ******************************************************************************/\r
 void vTraceUserEvent(traceLabel eventLabel)\r
 {\r
+#if (TRACE_SCHEDULING_ONLY == 0)\r
 #if (USE_SEPARATE_USER_EVENT_BUFFER == 0)\r
-    UserEvent* ue;\r
-    uint8_t dts1;\r
-    TRACE_SR_ALLOC_CRITICAL_SECTION();\r
+       UserEvent* ue;\r
+       uint8_t dts1;\r
+       TRACE_SR_ALLOC_CRITICAL_SECTION();\r
 \r
        TRACE_ASSERT(eventLabel > 0, "vTraceUserEvent: Invalid value for eventLabel", );\r
 \r
-       trcCRITICAL_SECTION_BEGIN();    \r
-    if (RecorderDataPtr->recorderActive && (! inExcludedTask || nISRactive) && handle_of_last_logged_task)\r
-    {    \r
-        dts1 = (uint8_t)prvTraceGetDTS(0xFF);\r
-\r
-        if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
-        {\r
-            ue = (UserEvent*) xTraceNextFreeEventBufferSlot();\r
-            if (ue != NULL)\r
-            {\r
-                ue->dts = dts1;\r
-                ue->type = USER_EVENT;\r
-                ue->payload = eventLabel;\r
-                prvTraceUpdateCounters();\r
-            }\r
-        }        \r
-    }\r
+       trcCRITICAL_SECTION_BEGIN();\r
+       if (RecorderDataPtr->recorderActive && (! inExcludedTask || nISRactive) && handle_of_last_logged_task)\r
+       {\r
+               dts1 = (uint8_t)prvTraceGetDTS(0xFF);\r
+               ue = (UserEvent*) xTraceNextFreeEventBufferSlot();\r
+               if (ue != NULL)\r
+               {\r
+                       ue->dts = dts1;\r
+                       ue->type = USER_EVENT;\r
+                       ue->payload = eventLabel;\r
+                       prvTraceUpdateCounters();\r
+               }\r
+       }\r
        trcCRITICAL_SECTION_END();\r
-       \r
+\r
 #elif (USE_SEPARATE_USER_EVENT_BUFFER == 1)\r
        UserEventChannel channel;\r
        uint32_t noOfSlots = 1;\r
-       uint32_t tempDataBuffer[(3 + MAX_ARG_SIZE) / 4];        \r
+       uint32_t tempDataBuffer[(3 + MAX_ARG_SIZE) / 4];\r
        if (RecorderDataPtr->recorderActive && (! inExcludedTask || nISRactive) && handle_of_last_logged_task)\r
        {\r
                channel = xTraceRegisterChannelFormat(0, eventLabel);\r
@@ -1336,8 +1457,9 @@ void vTraceUserEvent(traceLabel eventLabel)
                }\r
 \r
                prvTraceUserEventHelper2(channel, tempDataBuffer, noOfSlots);\r
-       }       \r
+       }\r
 #endif\r
+#endif /* TRACE_SCHEDULING_ONLY */\r
 }\r
 \r
 /*******************************************************************************\r
@@ -1350,7 +1472,7 @@ void vTraceUserEvent(traceLabel eventLabel)
  * When logging a user event, a numeric handle (reference) to this string is\r
  * used to identify the event. This is obtained by calling\r
  *\r
- *     xTraceOpenLabel()\r
+ *      xTraceOpenLabel()\r
  *\r
  * which adds the string to the symbol table (if not already present)\r
  * and returns the corresponding handle.\r
@@ -1360,15 +1482,15 @@ void vTraceUserEvent(traceLabel eventLabel)
  * 1. The handle is looked up every time, when storing the user event.\r
  *\r
  * Example:\r
- *     vTraceUserEvent(xTraceOpenLabel("MyUserEvent"));\r
+ *      vTraceUserEvent(xTraceOpenLabel("MyUserEvent"));\r
  *\r
  * 2. The label is registered just once, with the handle stored in an\r
- *  application variable - much like using a file handle.\r
+ * application variable - much like using a file handle.\r
  *\r
  * Example:\r
- *     myEventHandle = xTraceOpenLabel("MyUserEvent");\r
- *     ...\r
- *     vTraceUserEvent(myEventHandle);\r
+ *      myEventHandle = xTraceOpenLabel("MyUserEvent");\r
+ *      ...\r
+ *      vTraceUserEvent(myEventHandle);\r
  *\r
  * The second option is faster since no lookup is required on each event, and\r
  * therefore recommended for user events that are frequently\r
@@ -1379,9 +1501,9 @@ traceLabel xTraceOpenLabel(const char* label)
 {\r
        TRACE_ASSERT(label != NULL, "xTraceOpenLabel: label == NULL", (traceLabel)0);\r
 \r
-    return prvTraceOpenSymbol(label, 0);\r
+       return prvTraceOpenSymbol(label, 0);\r
 }\r
 \r
 #endif\r
 \r
-#endif
\ No newline at end of file
+#endif\r
index 3ae163ea35ed91a4a0b842af90052919c3cf0bc7..2ce162efd99060dbf9a2869edc8728276ab3e8c5 100644 (file)
@@ -42,7 +42,7 @@
 \r
 /*****************************************************************************\r
  *\r
- * See the following URL for an exaplanation of this file:\r
+ * See the following URL for an explanation of this file:\r
  * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/Embedded_Compiler_Porting.shtml\r
  *\r
  *****************************************************************************/\r
index 27dccd4b8a03c2edbed6fe592f3294bd2736132c..a809ba2838c5fb045884acb603346d80031b04ab 100644 (file)
@@ -42,7 +42,7 @@
 \r
 /*****************************************************************************\r
  *\r
- * See the following URL for an exaplanation of this file:\r
+ * See the following URL for an explanation of this file:\r
  * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/Embedded_Compiler_Porting.shtml\r
  *\r
  *****************************************************************************/\r
index 2dc47872b7d8ccfdfd5391b33d4c0c95da1f48dd..5cdd99bd27e3f7f1006e1b4cf983e722e266a658 100644 (file)
@@ -42,7 +42,7 @@
 \r
 /*****************************************************************************\r
  *\r
- * See the following URL for an exaplanation of this file:\r
+ * See the following URL for an explanation of this file:\r
  * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/Embedded_Compiler_Porting.shtml\r
  *\r
  *****************************************************************************/\r
index 4cf530b811cccd36e645bc3c683fcd0e0db283c5..c11e50cfc2d210faa4563df533e4d28bc5c548ed 100644 (file)
@@ -42,7 +42,7 @@
 \r
 /*****************************************************************************\r
  *\r
- * See the following URL for an exaplanation of this file:\r
+ * See the following URL for an explanation of this file:\r
  * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/Embedded_Compiler_Porting.shtml\r
  *\r
  *****************************************************************************/\r
index 5c45ccf14390056b563c90975060a80f1cd02bff..104f206dd128dd3fade49fb86a493fff0a050932 100644 (file)
@@ -42,7 +42,7 @@
 \r
 /*****************************************************************************\r
  *\r
- * See the following URL for an exaplanation of this file:\r
+ * See the following URL for an explanation of this file:\r
  * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/Embedded_Compiler_Porting.shtml\r
  *\r
  *****************************************************************************/\r
index fa574dd14a9bbecff6c2c7cf30663d04de46cde9..4390c0760c0a3406899d585cc2f07e89987f1c0d 100644 (file)
@@ -42,7 +42,7 @@
 \r
 /*****************************************************************************\r
  *\r
- * See the following URL for an exaplanation of this file:\r
+ * See the following URL for an explanation of this file:\r
  * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/Embedded_Compiler_Porting.shtml\r
  *\r
  *****************************************************************************/\r
index 7a78ae763061d85b6571b9c15223abbce0200093..6603a293730ea31fd5b907522458892b45456429 100644 (file)
@@ -132,7 +132,7 @@ BaseType_t xStatus;
 XUartPs_Config *pxConfig;\r
 \r
        /* Create the queue used to hold received characters.  NOTE THE COMMENTS AT\r
-       THE TOP OF THIS FILE REGARDING THE QUEUE OF QUEUES FOR THIS PURPSOE. */\r
+       THE TOP OF THIS FILE REGARDING THE USE OF QUEUES FOR THIS PURPSOE. */\r
        xRxQueue = xQueueCreate( uxQueueLength, sizeof( char ) );\r
        configASSERT( xRxQueue );\r
 \r
index c1658067083b91886b7c3a3428ba9fa39f89a1f3..f77b2fe61010159039dd1e16f0a3ecdb4cefe788 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
     FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd.\r
-       \r
+\r
 \r
     ***************************************************************************\r
      *                                                                       *\r
@@ -100,7 +100,7 @@ extern void vRegisterSampleCLICommands( void );
                sLocalAddr.sin_addr.s_addr = htonl(INADDR_ANY);\r
                sLocalAddr.sin_port = ntohs( ( ( unsigned short ) 23 ) );\r
 \r
-               if( lwip_bind( lSocket, ( struct sockaddr *) &sLocalAddr, sizeof( sLocalAddr ) ) < 0 ) \r
+               if( lwip_bind( lSocket, ( struct sockaddr *) &sLocalAddr, sizeof( sLocalAddr ) ) < 0 )\r
                {\r
                        lwip_close( lSocket );\r
                        vTaskDelete( NULL );\r
@@ -125,14 +125,14 @@ extern void vRegisterSampleCLICommands( void );
                                memset( cInputString, 0x00, cmdMAX_INPUT_SIZE );\r
 \r
                                do\r
-                               {                                       \r
+                               {\r
                                        lBytes = lwip_recv( lClientFd, &cInChar, sizeof( cInChar ), 0 );\r
 \r
-                                       if( lBytes > 0L ) \r
+                                       if( lBytes > 0L )\r
                                        {\r
                                                if( cInChar == '\n' )\r
                                                {\r
-                                                       /* The input string has been terminated.  Was the \r
+                                                       /* The input string has been terminated.  Was the\r
                                                        input a quit command? */\r
                                                        if( strcmp( "quit", ( const char * ) cInputString ) == 0 )\r
                                                        {\r
@@ -141,18 +141,18 @@ extern void vRegisterSampleCLICommands( void );
                                                        }\r
                                                        else\r
                                                        {\r
-                                                               /* The input string was not a quit command.  \r
+                                                               /* The input string was not a quit command.\r
                                                                Pass the string to the command interpreter. */\r
                                                                do\r
                                                                {\r
                                                                        /* Get the next output string from the command interpreter. */\r
-                                                                       xReturned = FreeRTOS_CLIProcessCommand( cInputString, cOutputString, configCOMMAND_INT_MAX_OUTPUT_SIZE );\r
+                                                                       xReturned = FreeRTOS_CLIProcessCommand( cInputString, cOutputString, cmdMAX_INPUT_SIZE );\r
                                                                        lwip_send( lClientFd, cOutputString, strlen( ( const char * ) cOutputString ), 0 );\r
 \r
                                                                } while( xReturned != pdFALSE );\r
 \r
 \r
-                                                               /* All the strings generated by the input \r
+                                                               /* All the strings generated by the input\r
                                                                command have been sent.  Clear the input\r
                                                                string ready to receive the next command. */\r
                                                                lInputIndex = 0;\r
@@ -168,7 +168,7 @@ extern void vRegisterSampleCLICommands( void );
                                                        }\r
                                                        else if( cInChar == '\b' )\r
                                                        {\r
-                                                               /* Backspace was pressed.  Erase the last \r
+                                                               /* Backspace was pressed.  Erase the last\r
                                                                character in the string - if any. */\r
                                                                if( lInputIndex > 0 )\r
                                                                {\r
@@ -194,7 +194,7 @@ extern void vRegisterSampleCLICommands( void );
 \r
                                 lwip_close( lClientFd );\r
                        }\r
-               } \r
+               }\r
        }\r
 \r
        /* Will only get here if a listening socket could not be created. */\r
index 8b2da0837e69e3355aff8e4a85655895cc7389da..108b39ee68c221865c223c89014462c1b1d0775b 100644 (file)
@@ -80,7 +80,7 @@
  * point registers.  To avoid this causing corruption it is necessary to avoid\r
  * their use.  For this reason main.c contains very basic C implementations of\r
  * the standard C library functions memset(), memcpy() and memcmp(), which are\r
- * are used by FreeRTOS itself.  Defining these functions in the project \r
+ * are used by FreeRTOS itself.  Defining these functions in the project\r
  * prevents the linker pulling them in from the library.  Any other standard C\r
  * library functions that are used by the application must likewise be defined\r
  * in C.\r
@@ -145,7 +145,7 @@ static void prvSetupHardware( void );
        extern void main_lwIP( void );\r
 #else\r
        #error Invalid mainSELECTED_APPLICATION setting.  See the comments at the top of this file and above the mainSELECTED_APPLICATION definition.\r
-#endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */\r
+#endif\r
 \r
 /*\r
  * The Xilinx projects use a BSP that do not allow the start up code to be\r
diff --git a/FreeRTOS/Demo/Common/Minimal/TaskNotify.c b/FreeRTOS/Demo/Common/Minimal/TaskNotify.c
new file mode 100644 (file)
index 0000000..b6a5ebf
--- /dev/null
@@ -0,0 +1,505 @@
+/*\r
+    FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that has become a de facto standard.             *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly and support the FreeRTOS         *\r
+     *    project by purchasing a FreeRTOS tutorial book, reference          *\r
+     *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
+     *                                                                       *\r
+     *    Thank you!                                                         *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available from the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    1 tab == 4 spaces!\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    Having a problem?  Start by reading the FAQ "My application does   *\r
+     *    not run, what could be wrong?"                                     *\r
+     *                                                                       *\r
+     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+    license and Real Time Engineers Ltd. contact details.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+\r
+/*\r
+ * Tests the behaviour of direct task notifications.\r
+ */\r
+\r
+/* Standard includes. */\r
+#include <limits.h>\r
+\r
+/* Scheduler include files. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "timers.h"\r
+\r
+/* Demo program include files. */\r
+#include "TaskNotify.h"\r
+\r
+#define notifyTASK_PRIORITY            ( tskIDLE_PRIORITY )\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * Implementation of the task that gets notified.\r
+ */\r
+static void prvNotifiedTask( void *pvParameters );\r
+\r
+/*\r
+ * Performs a few initial tests that can be done prior to creating the second\r
+ * task.\r
+ */\r
+static void prvSingleTaskTests( void );\r
+\r
+/*\r
+ * Software timer callback function from which xTaskNotify() is called.\r
+ */\r
+static void prvNotifyingTimer( TimerHandle_t xTimer );\r
+\r
+/*\r
+ * Utility function to create pseudo random numbers.\r
+ */\r
+static UBaseType_t prvRand( void );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Used to latch errors during the test's execution. */\r
+static BaseType_t xErrorStatus = pdPASS;\r
+\r
+/* Used to ensure the task has not stalled. */\r
+static volatile uint32_t ulNotifyCycleCount = 0;\r
+\r
+/* The handle of the task that receives the notifications. */\r
+static TaskHandle_t xTaskToNotify = NULL;\r
+\r
+/* Used to count the notifications sent to the task from a software timer and\r
+the number of notifications received by the task from the software timer.  The\r
+two should stay synchronised. */\r
+static uint32_t ulTimerNotificationsReceived = 0UL, ulTimerNotificationsSent = 0UL;\r
+\r
+/* The timer used to notify the task. */\r
+static TimerHandle_t xTimer = NULL;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void vStartTaskNotifyTask( void  )\r
+{\r
+       /* Create the task that performs some tests by itself, then loops around\r
+       being notified by both a software timer and an interrupt. */\r
+       xTaskCreate( prvNotifiedTask, "Notified", configMINIMAL_STACK_SIZE, NULL, notifyTASK_PRIORITY, &xTaskToNotify );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvSingleTaskTests( void )\r
+{\r
+const TickType_t xTicksToWait = pdMS_TO_TICKS( 100UL );\r
+BaseType_t xReturned;\r
+uint32_t ulNotifiedValue, ulLoop, ulNotifyingValue;\r
+TickType_t xTimeOnEntering;\r
+const uint32_t ulFirstNotifiedConst = 100001UL, ulSecondNotifiedValueConst = 5555UL, ulMaxLoops = 5UL;\r
+const uint32_t ulBit0 = 0x01UL, ulBit1 = 0x02UL;\r
+\r
+       /* -------------------------------------------------------------------------\r
+       Check blocking when there are no notifications. */\r
+       xTimeOnEntering = xTaskGetTickCount();\r
+       xReturned = xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, xTicksToWait );\r
+\r
+       /* Should have blocked for the entire block time. */\r
+       if( ( xTaskGetTickCount() - xTimeOnEntering ) < xTicksToWait )\r
+       {\r
+               xErrorStatus = pdFAIL;\r
+       }\r
+       configASSERT( xReturned == pdFAIL );\r
+       configASSERT( ulNotifiedValue == 0UL );\r
+\r
+\r
+\r
+\r
+       /* -------------------------------------------------------------------------\r
+       Check no blocking when notifications are pending.  First notify itself -\r
+       this would not be a normal thing to do and is done here for test purposes\r
+       only. */\r
+       xReturned = xTaskNotify( xTaskToNotify, ulFirstNotifiedConst, eSetValueWithoutOverwrite );\r
+\r
+       /* Even through the 'without overwrite' action was used the update should\r
+       have been successful. */\r
+       configASSERT( xReturned == pdPASS );\r
+\r
+       /* The task should now have a notification pending, and so not time out. */\r
+       xTimeOnEntering = xTaskGetTickCount();\r
+       xReturned = xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, xTicksToWait );\r
+\r
+       if( ( xTaskGetTickCount() - xTimeOnEntering ) >= xTicksToWait )\r
+       {\r
+               xErrorStatus = pdFAIL;\r
+       }\r
+\r
+       /* The task should have been notified, and the notified value should\r
+       be equal to ulFirstNotifiedConst. */\r
+       configASSERT( xReturned == pdPASS );\r
+       configASSERT( ulNotifiedValue == ulFirstNotifiedConst );\r
+\r
+       /* Incremented to show the task is still running. */\r
+       ulNotifyCycleCount++;\r
+\r
+\r
+\r
+\r
+\r
+       /*--------------------------------------------------------------------------\r
+       Check the non-overwriting functionality.  The notification is done twice\r
+       using two different notification values.  The action says don't overwrite so\r
+       only the first notification should pass and the value read back should also\r
+       be that used with the first notification. */\r
+       xReturned = xTaskNotify( xTaskToNotify, ulFirstNotifiedConst, eSetValueWithoutOverwrite );\r
+       configASSERT( xReturned == pdPASS );\r
+\r
+       xReturned = xTaskNotify( xTaskToNotify, ulSecondNotifiedValueConst, eSetValueWithoutOverwrite );\r
+       configASSERT( xReturned == pdFAIL );\r
+\r
+       /* Waiting for the notification should now return immediately so a block\r
+       time of zero is used. */\r
+       xReturned = xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, 0 );\r
+\r
+       configASSERT( xReturned == pdPASS );\r
+       configASSERT( ulNotifiedValue == ulFirstNotifiedConst );\r
+\r
+\r
+\r
+\r
+\r
+       /*--------------------------------------------------------------------------\r
+       Do the same again, only this time use the overwriting version.  This time\r
+       both notifications should pass, and the value written the second time should\r
+       overwrite the value written the first time, and so be the value that is read\r
+       back. */\r
+       xReturned = xTaskNotify( xTaskToNotify, ulFirstNotifiedConst, eSetValueWithOverwrite );\r
+       configASSERT( xReturned == pdPASS );\r
+       xReturned = xTaskNotify( xTaskToNotify, ulSecondNotifiedValueConst, eSetValueWithOverwrite );\r
+       configASSERT( xReturned == pdPASS );\r
+       xReturned = xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, 0 );\r
+       configASSERT( xReturned == pdPASS );\r
+       configASSERT( ulNotifiedValue == ulSecondNotifiedValueConst );\r
+\r
+\r
+\r
+\r
+       /*--------------------------------------------------------------------------\r
+       Check notifications with no action pass without updating the value.  Even\r
+       though ulFirstNotifiedConst is used as the value the value read back should\r
+       remain at ulSecondNotifiedConst. */\r
+       xReturned = xTaskNotify( xTaskToNotify, ulFirstNotifiedConst, eNoAction );\r
+       configASSERT( xReturned == pdPASS );\r
+       xReturned = xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, 0 );\r
+       configASSERT( ulNotifiedValue == ulSecondNotifiedValueConst );\r
+\r
+\r
+\r
+\r
+       /*--------------------------------------------------------------------------\r
+       Check incrementing values.  Send ulMaxLoop increment notifications, then\r
+       ensure the received value is as expected - which should be\r
+       ulSecondNotificationValueConst plus how ever many times to loop iterated. */\r
+       for( ulLoop = 0; ulLoop < ulMaxLoops; ulLoop++ )\r
+       {\r
+               xReturned = xTaskNotify( xTaskToNotify, 0, eIncrement );\r
+               configASSERT( xReturned == pdPASS );\r
+       }\r
+\r
+       xReturned = xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, 0 );\r
+       configASSERT( xReturned == pdPASS );\r
+       configASSERT( ulNotifiedValue == ( ulSecondNotifiedValueConst + ulMaxLoops ) );\r
+\r
+       /* Should not be any notifications pending now. */\r
+       xReturned = xTaskNotifyWait( 0, 0, &ulNotifiedValue, 0 );\r
+       configASSERT( xReturned == pdFAIL );\r
+\r
+\r
+\r
+\r
+       /*--------------------------------------------------------------------------\r
+       Check all bits can be set by notifying the task with one additional bit set\r
+       on each notification, and exiting the loop when all the bits are found to be\r
+       set.  As there are 32-bits the loop should execute 32 times before all the\r
+       bits are found to be set. */\r
+       ulNotifyingValue = 0x01;\r
+       ulLoop = 0;\r
+\r
+       /* Start with all bits clear. */\r
+       xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, 0 );\r
+\r
+       do\r
+       {\r
+               /* Set the next bit in the task's notified value. */\r
+               xTaskNotify( xTaskToNotify, ulNotifyingValue, eSetBits );\r
+\r
+               /* Wait for the notified value - which of course will already be\r
+               available.  Don't clear the bits on entry or exit as this loop is exited\r
+               when all the bits are set. */\r
+               xReturned = xTaskNotifyWait( 0, 0, &ulNotifiedValue, 0 );\r
+               configASSERT( xReturned == pdPASS );\r
+\r
+               ulLoop++;\r
+\r
+               /* Use the next bit on the next iteration around this loop. */\r
+               ulNotifyingValue <<= 1UL;\r
+\r
+       } while ( ulNotifiedValue != ULONG_MAX );\r
+\r
+       /* As a 32-bit value was used the loop should have executed 32 times before\r
+       all the bits were set. */\r
+       configASSERT( ulLoop == 32 );\r
+\r
+\r
+\r
+\r
+       /*--------------------------------------------------------------------------\r
+       Check bits are cleared on entry but not on exit when a notification fails\r
+       to arrive before timing out - both with and without a timeout value.  Wait\r
+       for the notification again - but this time it is not given by anything and\r
+       should return pdFAIL.  The parameters are set to clear bit zero on entry and\r
+       bit one on exit.  As no notification was received only the bit cleared on\r
+       entry should actually get cleared. */\r
+       xReturned = xTaskNotifyWait( ulBit0, ulBit1, &ulNotifiedValue, xTicksToWait );\r
+       configASSERT( xReturned == pdFAIL );\r
+\r
+       /* Notify the task with no action so as not to update the bits even though\r
+       ULONG_MAX is used as the notification value. */\r
+       xTaskNotify( xTaskToNotify, ULONG_MAX, eNoAction );\r
+\r
+       /* Reading back the value should should find bit 0 is clear, as this was\r
+       cleared on entry, but bit 1 is not clear as it will not have been cleared on\r
+       exit as no notification was received. */\r
+       xReturned = xTaskNotifyWait( 0x00UL, 0x00UL, &ulNotifiedValue, 0 );\r
+       configASSERT( xReturned == pdPASS );\r
+       configASSERT( ulNotifiedValue == ( ULONG_MAX & ~ulBit0 ) );\r
+\r
+\r
+\r
+\r
+\r
+       /*--------------------------------------------------------------------------\r
+       Now try clearing the bit on exit.  For that to happen a notification must be\r
+       received, so the task is notified first. */\r
+       xTaskNotify( xTaskToNotify, 0, eNoAction );\r
+       xTaskNotifyWait( 0x00, ulBit1, &ulNotifiedValue, 0 );\r
+\r
+       /* However as the bit is cleared on exit, after the returned notification\r
+       value is set, the returned notification value should not have the bit\r
+       cleared... */\r
+       configASSERT( ulNotifiedValue == ( ULONG_MAX & ~ulBit0 ) );\r
+\r
+       /* ...but reading the value back again should find that the bit was indeed\r
+       cleared internally.  The returned value should be pdFAIL however as nothing\r
+       has notified the task in the mean time. */\r
+       xReturned = xTaskNotifyWait( 0x00, 0x00, &ulNotifiedValue, 0 );\r
+       configASSERT( xReturned == pdFAIL );\r
+       configASSERT( ulNotifiedValue == ( ULONG_MAX & ~( ulBit0 | ulBit1 ) ) );\r
+\r
+\r
+\r
+       /* Incremented to show the task is still running. */\r
+       ulNotifyCycleCount++;\r
+\r
+       /* Leave all bits cleared. */\r
+       xTaskNotifyWait( ULONG_MAX, 0, NULL, 0 );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvNotifyingTimer( TimerHandle_t xTimer )\r
+{\r
+       ( void ) xTimer;\r
+\r
+       xTaskNotifyGive( xTaskToNotify );\r
+\r
+       /* This value is also incremented from an interrupt. */\r
+       taskENTER_CRITICAL();\r
+       {\r
+               ulTimerNotificationsSent++;\r
+       }\r
+       taskEXIT_CRITICAL();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvNotifiedTask( void *pvParameters )\r
+{\r
+const TickType_t xMaxPeriod = pdMS_TO_TICKS( 90 ), xMinPeriod = pdMS_TO_TICKS( 10 ), xDontBlock = 0;\r
+TickType_t xPeriod;\r
+\r
+       /* Remove compiler warnings about unused parameters. */\r
+       ( void ) pvParameters;\r
+\r
+       /* Run a few tests that can be done from a single task before entering the\r
+       main loop. */\r
+       prvSingleTaskTests();\r
+\r
+       /* Create the software timer that is used to send notifications to this\r
+       task.  Notifications are also received from an interrupt. */\r
+       xTimer = xTimerCreate( "Notifier", xMaxPeriod, pdFALSE, NULL, prvNotifyingTimer );\r
+\r
+       for( ;; )\r
+       {\r
+               /* Start the timer again with a different period.  Sometimes the period\r
+               will be higher than the tasks block time, sometimes it will be lower\r
+               than the tasks block time. */\r
+               xPeriod = prvRand() % xMaxPeriod;\r
+               if( xPeriod < xMinPeriod )\r
+               {\r
+                       xPeriod = xMinPeriod;\r
+               }\r
+\r
+               xTimerChangePeriod( xTimer, xPeriod, portMAX_DELAY );\r
+               xTimerStart( xTimer, portMAX_DELAY );\r
+\r
+               /* Block waiting for the notification again with a different period.\r
+               Sometimes the period will be higher than the tasks block time, sometimes\r
+               it will be lower than the tasks block time. */\r
+               xPeriod = prvRand() % xMaxPeriod;\r
+               if( xPeriod < xMinPeriod )\r
+               {\r
+                       xPeriod = xMinPeriod;\r
+               }\r
+\r
+               /* Block to wait for a notification but without clearing the\r
+               notification count, so only add one to the count of received\r
+               notifications as any other notifications will remain pending. */\r
+               if( ulTaskNotifyTake( pdFALSE, xPeriod ) != 0 )\r
+               {\r
+                       ulTimerNotificationsReceived++;\r
+               }\r
+\r
+\r
+               /* Take a notification without clearing again, but this time without a\r
+               block time specified. */\r
+               if( ulTaskNotifyTake( pdFALSE, xDontBlock ) != 0 )\r
+               {\r
+                       ulTimerNotificationsReceived++;\r
+               }\r
+\r
+               /* Wait for the next notification from the timer, clearing all\r
+               notifications if one is received, so this time adding the total number\r
+               of notifications that were pending as none will be left pending after\r
+               the function call. */\r
+               ulTimerNotificationsReceived += ulTaskNotifyTake( pdTRUE, xPeriod );\r
+\r
+               /* Wait for the next notification again, clearing all notifications if\r
+               one is received, but this time blocking indefinitely. */\r
+               ulTimerNotificationsReceived += ulTaskNotifyTake( pdTRUE, portMAX_DELAY );\r
+\r
+               /* Incremented to show the task is still running. */\r
+               ulNotifyCycleCount++;\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void xNotifyTaskFromISR( void )\r
+{\r
+static BaseType_t xCallCount = 0;\r
+const BaseType_t xCallInterval = pdMS_TO_TICKS( 50 );\r
+\r
+       /* The task performs some tests before starting the timer that gives the\r
+       notification from this interrupt.  If the timer has not been created yet\r
+       then the initial tests have not yet completed and the notification should\r
+       not be sent. */\r
+       if( xTimer != NULL )\r
+       {\r
+               xCallCount++;\r
+\r
+               if( xCallCount >= xCallInterval )\r
+               {\r
+                       /* It is time to 'give' the notification again. */\r
+                       xCallCount = 0;\r
+\r
+                       xTaskNotifyGiveFromISR( xTaskToNotify, NULL );\r
+                       ulTimerNotificationsSent++;\r
+               }\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* This is called to check the created tasks are still running and have not\r
+detected any errors. */\r
+BaseType_t xAreTaskNotificationTasksStillRunning( void )\r
+{\r
+static uint32_t ulLastNotifyCycleCount = 0;\r
+const uint32_t ulMaxSendReceiveDeviation = 5UL;\r
+\r
+       /* Check the cycle count is still incrementing to ensure the task is still\r
+       actually running. */\r
+       if( ulLastNotifyCycleCount == ulNotifyCycleCount )\r
+       {\r
+               xErrorStatus = pdFAIL;\r
+       }\r
+       else\r
+       {\r
+               ulLastNotifyCycleCount = ulNotifyCycleCount;\r
+       }\r
+\r
+       /* Check the count of 'takes' from the software timer is keeping track with\r
+       the amount of 'gives'. */\r
+       if( ulTimerNotificationsSent > ulTimerNotificationsSent )\r
+       {\r
+               if( ( ulTimerNotificationsSent - ulTimerNotificationsReceived ) > ulMaxSendReceiveDeviation )\r
+               {\r
+                       xErrorStatus = pdFAIL;\r
+               }\r
+       }\r
+\r
+       return xErrorStatus;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static UBaseType_t prvRand( void )\r
+{\r
+       static uint32_t ulNextRand = ( uint32_t ) prvRand;\r
+\r
+       const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL;\r
+\r
+       /* Utility function to generate a pseudo random number. */\r
+       ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;\r
+       return( ( int ) ( ulNextRand >> 16UL ) & 0x7fffUL );\r
+}\r
+/*-----------------------------------------------------------*/\r
index 6aec779272e093de98214126068827d84d1c74b8..893928e9757c98634b8839448f1c6b74cb5dfdaf 100644 (file)
@@ -739,11 +739,16 @@ static TickType_t uxTick = ( TickType_t ) -1;
        will expire when the kernel's tick count is (100 + xBasePeriod).  For this\r
        reason xMargin is used as an allowable margin for premature timer expiries\r
        as well as late timer expiries. */\r
-       const TickType_t xMargin = 6;\r
+       #ifdef _WINDOWS_\r
+               /* Windows is not real real time. */\r
+               const TickType_t xMargin = 20;\r
+       #else\r
+               const TickType_t xMargin = 6;\r
+       #endif /* _WINDOWS_ */\r
 #else\r
        #ifdef _WINDOWS_\r
                /* Windows is not real real time. */\r
-               const TickType_t xMargin = 10;\r
+               const TickType_t xMargin = 20;\r
        #else\r
                const TickType_t xMargin = 4;\r
        #endif /* _WINDOWS_ */\r
diff --git a/FreeRTOS/Demo/Common/include/TaskNotify.h b/FreeRTOS/Demo/Common/include/TaskNotify.h
new file mode 100644 (file)
index 0000000..94cd80d
--- /dev/null
@@ -0,0 +1,76 @@
+/*\r
+    FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that has become a de facto standard.             *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly and support the FreeRTOS         *\r
+     *    project by purchasing a FreeRTOS tutorial book, reference          *\r
+     *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
+     *                                                                       *\r
+     *    Thank you!                                                         *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available from the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    1 tab == 4 spaces!\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    Having a problem?  Start by reading the FAQ "My application does   *\r
+     *    not run, what could be wrong?"                                     *\r
+     *                                                                       *\r
+     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+    license and Real Time Engineers Ltd. contact details.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+#ifndef TASK_NOTIFY_H\r
+#define TASK_NOTIFY_H\r
+\r
+void vStartTaskNotifyTask( void  );\r
+BaseType_t xAreTaskNotificationTasksStillRunning( void );\r
+void xNotifyTaskFromISR( void );\r
+\r
+#endif /* TASK_NOTIFY_H */\r
+\r
+\r
+\r
index b155b1149f11b99c64a6067e4e840334babd39bc..f05b9336616c93c4ef75c962f8fc784a9203633f 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef CGC_SET_VALUES_H_\r
 #define CGC_SET_VALUES_H_\r
 \r
-/* Do not modify these macros.  These values are used to initialise  \r
+/* Do not modify these macros.  These values are used to initialise\r
    the SCKCR and SCKCR2 registers based upon the above values.      */\r
 #if   (FCLK_DIV == 64)\r
     #define FCLK_SCKCR  0x60000000L\r
     #define ICLK_SCKCR  0x01000000L\r
 #endif\r
 \r
-    \r
+\r
 #if (BCLK_PIN == 1)\r
     #define PSTOP1_SCKCR 0x00800000L\r
-#elif    \r
+#else\r
     #define PSTOP1_SCKCR 0x00000000L\r
-#endif    \r
+#endif\r
 \r
 \r
 #if   (BCLK_DIV == 64)\r
 #elif (PCLK47_DIV ==  1)\r
     #define PCLK47_SCKCR  0x00000000L\r
 #else\r
-    #define PCLK47_SCKCR  0x00000010L    \r
+    #define PCLK47_SCKCR  0x00000010L\r
 #endif\r
 \r
 \r
 #elif (PCLK03_DIV ==  1)\r
     #define PCLK03_SCKCR  0x00000000L\r
 #else\r
-    #define PCLK03_SCKCR  0x00000001L    \r
+    #define PCLK03_SCKCR  0x00000001L\r
 #endif\r
 \r
 \r
 \r
 #if (CLK_SOURCE == CLK_SOURCE_LOCO)\r
 /* Internal LOCO circuit - 125kHz*/\r
-#define     CLK_FREQUENCY       (125000L)      \r
+#define     CLK_FREQUENCY       (125000L)\r
 #define     FCLK_FREQUENCY      (CLK_FREQUENCY / FCLK_DIV)\r
 #define     ICLK_FREQUENCY      (CLK_FREQUENCY / ICLK_DIV)\r
 #define     BCLK_FREQUENCY      (CLK_FREQUENCY / BCLK_DIV)\r
 \r
 #elif (CLK_SOURCE == CLK_SOURCE_HOCO)\r
 /* Internal high speed on-chip oscillator (HOCO) */\r
-#define     CLK_FREQUENCY       (50000000L)    \r
+#define     CLK_FREQUENCY       (50000000L)\r
 #define     FCLK_FREQUENCY      (CLK_FREQUENCY / FCLK_DIV)\r
 #define     ICLK_FREQUENCY      (CLK_FREQUENCY / ICLK_DIV)\r
 #define     BCLK_FREQUENCY      (CLK_FREQUENCY / BCLK_DIV)\r
 \r
 \r
 #elif (CLK_SOURCE == CLK_SOURCE_MAIN)\r
-/* External XTAL, but not via the PLL circuit */       \r
+/* External XTAL, but not via the PLL circuit */\r
 #define     FCLK_FREQUENCY      (XTAL_FREQUENCY / FCLK_DIV)\r
 #define     ICLK_FREQUENCY      (XTAL_FREQUENCY / ICLK_DIV)\r
 #define     BCLK_FREQUENCY      (XTAL_FREQUENCY / BCLK_DIV)\r
 \r
 \r
 #elif (CLK_SOURCE == CLK_SOURCE_SUB)\r
-/* External 32khZ XTAL */      \r
+/* External 32khZ XTAL */\r
 #define     FCLK_FREQUENCY      (SUB_FREQUENCY / FCLK_DIV)\r
 #define     ICLK_FREQUENCY      (SUB_FREQUENCY / ICLK_DIV)\r
 #define     BCLK_FREQUENCY      (SUB_FREQUENCY / BCLK_DIV)\r
 \r
 #elif (CLK_SOURCE == CLK_SOURCE_PLL)\r
 /* External XTAL, but using the PLL circuit */\r
-#define     PLL_FREQUENCY       (XTAL_FREQUENCY * (PLL_MUL / PLL_INPUT_FREQ_DIV))      \r
+#define     PLL_FREQUENCY       (XTAL_FREQUENCY * (PLL_MUL / PLL_INPUT_FREQ_DIV))\r
 #define     FCLK_FREQUENCY      (PLL_FREQUENCY / FCLK_DIV)\r
 #define     ICLK_FREQUENCY      (PLL_FREQUENCY / ICLK_DIV)\r
 #define     BCLK_FREQUENCY      (PLL_FREQUENCY / BCLK_DIV)\r
index 1092a31d51e7633f77e6502baf1f93a77ca5376a..f1424d544e3bd98e9976dee3367bbbf3ad4ed656 100644 (file)
@@ -96,8 +96,8 @@
 #include "rskrx64mdef.h"\r
 \r
 /* Set option bytes */\r
-#pragma address OFS0_location 0xFFFFFF8CUL\r
-#pragma address OFS1_location 0xFFFFFF88UL\r
+#pragma address OFS0_location 0xFFFFFF8CUL\r
+#pragma address OFS1_location 0xFFFFFF88UL\r
 volatile const uint32_t OFS0_location = 0xFFFFFFFFUL;\r
 volatile const uint32_t OFS1_location = 0xFFFFFFFFUL;\r
 \r
index 2f8243118658bc3dd9a9f0da5dddcfa8a7c324fb..e4f6ce87b2275eaa9531d5effc6137983720b2bc 100644 (file)
@@ -83,7 +83,7 @@
 #define configUSE_TICK_HOOK                                            1\r
 #define configTICK_RATE_HZ                                             ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */\r
 #define configMINIMAL_STACK_SIZE                               ( ( unsigned short ) 50 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */\r
-#define configTOTAL_HEAP_SIZE                                  ( ( size_t ) ( 22 * 1024 ) )\r
+#define configTOTAL_HEAP_SIZE                                  ( ( size_t ) ( 23 * 1024 ) )\r
 #define configMAX_TASK_NAME_LEN                                        ( 12 )\r
 #define configUSE_TRACE_FACILITY                               1\r
 #define configUSE_16_BIT_TICKS                                 0\r
@@ -97,6 +97,7 @@
 #define configUSE_COUNTING_SEMAPHORES                  1\r
 #define configUSE_ALTERNATIVE_API                              1\r
 #define configUSE_QUEUE_SETS                                   1\r
+#define configUSE_TASK_NOTIFICATIONS                   1\r
 \r
 /* Software timer related configuration options. */\r
 #define configUSE_TIMERS                                               1\r
 #define configTIMER_QUEUE_LENGTH                               20\r
 #define configTIMER_TASK_STACK_DEPTH                   ( configMINIMAL_STACK_SIZE * 2 )\r
 \r
-#define configMAX_PRIORITIES                   ( 7 )\r
+#define configMAX_PRIORITIES                                   ( 7 )\r
 \r
 /* Run time stats gathering configuration options. */\r
 unsigned long ulGetRunTimeCounterValue( void ); /* Prototype of function that returns run time counter. */\r
 void vConfigureTimerForRunTimeStats( void );   /* Prototype of function that initialises the run time counter. */\r
-#define configGENERATE_RUN_TIME_STATS  1\r
+#define configGENERATE_RUN_TIME_STATS                  1\r
 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()\r
 #define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeCounterValue()\r
 \r
 /* Co-routine related configuration options. */\r
-#define configUSE_CO_ROUTINES          1\r
-#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\r
+#define configUSE_CO_ROUTINES                                  1\r
+#define configMAX_CO_ROUTINE_PRIORITIES                        ( 2 )\r
 \r
 /* This demo makes use of one or more example stats formatting functions.  These\r
 format the raw data provided by the uxTaskGetSystemState() function in to human\r
@@ -148,6 +149,8 @@ extern void vAssertCalled( unsigned long ulLine, const char * const pcFileName )
 #define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __LINE__, __FILE__ )\r
 \r
 /* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */\r
+#define TRACE_ENTER_CRITICAL_SECTION() portENTER_CRITICAL()\r
+#define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL()\r
 #include "trcKernelPort.h"\r
 \r
 #endif /* FREERTOS_CONFIG_H */\r
index 289384a284c19d48c03da29d183417a08468b9f7..7039112bfca16c76535a9c873f55f7abde3ccf34 100644 (file)
@@ -1,14 +1,14 @@
 /*******************************************************************************\r
- * Tracealyzer v2.6.0 Recorder Library\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcConfig.h\r
  *\r
- * Configuration parameters for the trace recorder library. Before using the \r
- * trace recorder library, please check that the default settings are \r
- * appropriate for your system, and if necessary adjust these. Most likely, you \r
- * will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to \r
- * reflect the number of such objects in your system. These may be \r
+ * Configuration parameters for the trace recorder library. Before using the\r
+ * trace recorder library, please check that the default settings are\r
+ * appropriate for your system, and if necessary adjust these. Most likely, you\r
+ * will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to\r
+ * reflect the number of such objects in your system. These may be\r
  * over-approximated, although larger values values implies more RAM usage.\r
  *\r
  * Terms of Use\r
  * use together with Percepio products. You may distribute the recorder library\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
- * Copyright Percepio AB, 2013.\r
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2014.\r
  * www.percepio.com\r
  ******************************************************************************/\r
 \r
 #ifndef TRCCONFIG_H\r
 #define TRCCONFIG_H\r
 \r
-/*******************************************************************************\r
- * CONFIGURATION RELATED TO CAPACITY AND ALLOCATION \r
- ******************************************************************************/\r
-\r
-/*******************************************************************************\r
- * EVENT_BUFFER_SIZE\r
- *\r
- * Macro which should be defined as an integer value.\r
- *\r
- * This defines the capacity of the event buffer, i.e., the number of records\r
- * it may store. Each registered event typically use one record (4 byte), but\r
- * vTracePrintF may use multiple records depending on the number of data args.\r
- ******************************************************************************/\r
+/******************************************************************************\r
+ * SELECTED_PORT\r
+ *\r
+ * Macro that specifies what hardware port that should be used.\r
+ * Available ports are:\r
+ *\r
+ * Port Name                                                   Code     Official       OS supported\r
+ * PORT_APPLICATION_DEFINED                            -2              -                       -\r
+ * PORT_NOT_SET                                                        -1              -                       -\r
+ * PORT_HWIndependent                                  0               Yes                     Any\r
+ * PORT_Win32                                                  1               Yes                     FreeRTOS on Win32\r
+ * PORT_Atmel_AT91SAM7                                 2               No                      Any\r
+ * PORT_Atmel_UC3A0                                            3               No                      Any\r
+ * PORT_ARM_CortexM                                            4               Yes                     Any\r
+ * PORT_Renesas_RX600                                  5               Yes                     Any\r
+ * PORT_Microchip_dsPIC_AND_PIC24              6               Yes                     Any\r
+ * PORT_TEXAS_INSTRUMENTS_TMS570               7               No                      Any\r
+ * PORT_TEXAS_INSTRUMENTS_MSP430               8               No                      Any\r
+ * PORT_MICROCHIP_PIC32MX                              9               Yes                     Any\r
+ * PORT_XILINX_PPC405                                  10              No                      FreeRTOS\r
+ * PORT_XILINX_PPC440                                  11              No                      FreeRTOS\r
+ * PORT_XILINX_MICROBLAZE                              12              No                      Any\r
+ * PORT_NXP_LPC210X                                            13              No                      Any\r
+ * PORT_MICROCHIP_PIC32MZ                              14              Yes                     Any\r
+ * PORT_ARM_CORTEX_A9                                  15              No                      Any\r
+ *****************************************************************************/\r
 \r
-#define EVENT_BUFFER_SIZE 10000 /* Adjust wrt. to available RAM */\r
+#ifndef WIN32\r
+       // Set the port setting here!\r
+       #define SELECTED_PORT PORT_NOT_SET\r
 \r
+       #if (SELECTED_PORT == PORT_NOT_SET)\r
+               #error "You need to define SELECTED_PORT here!"\r
+       #endif\r
+#else\r
+       // For Win32 demo projects this is set automatically\r
+       #define SELECTED_PORT PORT_Win32\r
+#endif\r
 \r
-/*******************************************************************************\r
- * USE_LINKER_PRAGMA\r
- *\r
- * Macro which should be defined as an integer value, default is 0.\r
+/******************************************************************************\r
+ * FREERTOS_VERSION\r
  *\r
- * If this is 1, the header file "recorderdata_linker_pragma.h" is included just\r
- * before the declaration of RecorderData (in trcBase.c), i.e., the trace data \r
- * structure. This allows the user to specify a pragma with linker options. \r
+ * Specify what version of FreeRTOS that is used. This is necessary compensate\r
+ * for renamed symbols in the FreeRTOS kernel (does not build if incorrect).\r
  *\r
- * Example (for IAR Embedded Workbench and NXP LPC17xx):\r
- * #pragma location="AHB_RAM_MEMORY"\r
- * \r
- * This example instructs the IAR linker to place RecorderData in another RAM \r
- * bank, the AHB RAM. This can also be used for other compilers with a similar\r
- * pragmas for linker options.\r
- * \r
- * Note that this only applies if using static allocation, see below.\r
- ******************************************************************************/\r
-\r
-#define USE_LINKER_PRAGMA 0\r
-\r
+ * FREERTOS_VERSION_7_3_OR_7_4 (= 1)           If using FreeRTOS v7.3.0 - v7.4.2\r
+ * FREERTOS_VERSION_7_5_OR_7_6 (= 2)           If using FreeRTOS v7.5.0 - v7.6.0\r
+ * FREERTOS_VERSION_8_0_OR_LATER (= 3)         If using FreeRTOS v8.0.0 or later\r
+ *****************************************************************************/\r
+#define FREERTOS_VERSION       FREERTOS_VERSION_8_0_OR_LATER\r
 \r
-/*******************************************************************************\r
- * SYMBOL_TABLE_SIZE\r
+/******************************************************************************\r
+ * TRACE_RECORDER_STORE_MODE\r
  *\r
- * Macro which should be defined as an integer value.\r
+ * Macro which should be defined as one of:\r
+ * - TRACE_STORE_MODE_RING_BUFFER\r
+ * - TRACE_STORE_MODE_STOP_WHEN_FULL\r
+ * Default is TRACE_STORE_MODE_RING_BUFFER.\r
  *\r
- * This defines the capacity of the symbol table, in bytes. This symbol table \r
- * stores User Events labels and names of deleted tasks, queues, or other kernel\r
- * objects. Note that the names of active objects not stored here but in the \r
- * Object Table. Thus, if you don't use User Events or delete any kernel \r
- * objects you set this to a very low value, e.g. 4, but not zero (0) since \r
- * this causes a declaration of a zero-sized array, for which the C compiler\r
- * behavior is not standardized and may cause misaligned data.\r
- ******************************************************************************/\r
-#define SYMBOL_TABLE_SIZE 5000\r
-\r
-#if (SYMBOL_TABLE_SIZE == 0)\r
-#error "SYMBOL_TABLE_SIZE may not be zero!"\r
-#endif\r
+ * With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the\r
+ * events are stored in a ring buffer, i.e., where the oldest events are\r
+ * overwritten when the buffer becomes full. This allows you to get the last\r
+ * events leading up to an interesting state, e.g., an error, without having\r
+ * to store the whole run since startup.\r
+ *\r
+ * When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the\r
+ * recording is stopped when the buffer becomes full. This is useful for\r
+ * recording events following a specific state, e.g., the startup sequence.\r
+ *****************************************************************************/\r
+#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER\r
 \r
 /*******************************************************************************\r
- * USE_SEPARATE_USER_EVENT_BUFFER\r
+ * TRACE_SCHEDULING_ONLY\r
  *\r
  * Macro which should be defined as an integer value.\r
- * Default is zero (0).\r
  *\r
- * This enables and disables the use of the separate user event buffer.\r
+ * If this setting is enabled (= 1), only scheduling events are recorded.\r
+ * If disabled (= 0), all events are recorded.\r
  *\r
- * Note: When using the separate user event buffer, you may get an artificial\r
- * task instance named "Unknown actor". This is added as a placeholder when the \r
- * user event history is longer than the task scheduling history.\r
- ******************************************************************************/\r
-#define USE_SEPARATE_USER_EVENT_BUFFER 0\r
-\r
-/*******************************************************************************\r
- * USER_EVENT_BUFFER_SIZE\r
+ * Users of FreeRTOS+Trace Free Edition only displays scheduling events, so this\r
+ * option can be used to avoid storing unsupported events.\r
  *\r
- * Macro which should be defined as an integer value.\r
+ * Default value is 0 (store all enabled events).\r
  *\r
- * This defines the capacity of the user event buffer, in number of slots.\r
- * A single user event can use between 1 and X slots, depending on the data.\r
- *\r
- * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
  ******************************************************************************/\r
-#define USER_EVENT_BUFFER_SIZE 500\r
+#define TRACE_SCHEDULING_ONLY 0\r
 \r
 /*******************************************************************************\r
- * USER_EVENT_CHANNELS\r
+ * EVENT_BUFFER_SIZE\r
  *\r
  * Macro which should be defined as an integer value.\r
  *\r
- * This defines the number of allowed user event channels.\r
+ * This defines the capacity of the event buffer, i.e., the number of records\r
+ * it may store. Most events use one record (4 byte), although some events\r
+ * require multiple 4-byte records. You should adjust this to the amount of RAM\r
+ * available in the target system.\r
  *\r
- * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
+ * Default value is 1000, which means that 4000 bytes is allocated for the\r
+ * event buffer.\r
  ******************************************************************************/\r
-#define CHANNEL_FORMAT_PAIRS 32\r
+#define EVENT_BUFFER_SIZE 15000\r
 \r
 /*******************************************************************************\r
  * NTask, NISR, NQueue, NSemaphore, NMutex\r
  *\r
- * A group of Macros which should be defined as an integer value of zero (0) \r
- * or larger.\r
+ * A group of macros which should be defined as integer values, zero or larger.\r
  *\r
- * This defines the capacity of the Object Property Table - the maximum number\r
- * of objects active at any given point within each object class.\r
- * \r
- * NOTE: In case objects are deleted and created during runtime, this setting\r
- * does not limit the total amount of objects, only the number of concurrently\r
- * active objects. \r
+ * These define the capacity of the Object Property Table, i.e., the maximum\r
+ * number of objects active at any given point, within each object class (e.g.,\r
+ * task, queue, semaphore, ...).\r
  *\r
- * Using too small values will give an error message through the vTraceError\r
- * routine, which makes the error message appear when opening the trace data\r
- * in Tracealyzer. If you are using the recorder status monitor task,\r
- * any error messages are displayed in console prints, assuming that the\r
- * print macro has been defined properly (vConsolePrintMessage). \r
+ * If tasks or other other objects are deleted in your system, this\r
+ * setting does not limit the total amount of objects created, only the number\r
+ * of objects that have been successfully created but not yet deleted.\r
  *\r
- * It can be wise to start with very large values for these constants, \r
- * unless you are very confident on these numbers. Then do a recording and\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 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
+ * Using too small values will cause vTraceError to be called, which stores an\r
+ * error message in the trace that is shown when opening the trace file.\r
  *\r
+ * It can be wise to start with large values for these constants,\r
+ * unless you are very confident on these numbers. Then do a recording and\r
+ * check the actual usage by selecting View menu -> Trace Details ->\r
+ * Resource Usage -> Object Table.\r
  ******************************************************************************/\r
-#define NTask             100\r
-#define NISR              20\r
-#define NQueue            60\r
-#define NSemaphore        60\r
-#define NMutex            60\r
-#define NTimer            200\r
-#define NEventGroup       60\r
-\r
-/* Maximum object name length for each class (includes zero termination) */\r
-#define NameLenTask       15\r
-#define NameLenISR        15\r
-#define NameLenQueue      15\r
-#define NameLenSemaphore  15\r
-#define NameLenMutex      15\r
-#define NameLenTimer      15\r
-#define NameLenEventGroup 15\r
+#define NTask                  100\r
+#define NISR                   60\r
+#define NQueue                 60\r
+#define NSemaphore             60\r
+#define NMutex                 60\r
+#define NTimer                 200\r
+#define NEventGroup            60\r
 \r
 /******************************************************************************\r
- * TRACE_DESCRIPTION\r
+ * INCLUDE_MEMMANG_EVENTS\r
  *\r
- * Macro which should be defined as a string.\r
+ * Macro which should be defined as either zero (0) or one (1).\r
  *\r
- * This string is stored in the trace and displayed in Tracealyzer. Can be\r
- * used to store, e.g., system version or build date. This is also used to store\r
- * internal error messages from the recorder, which if occurs overwrites the\r
- * value defined here. This may be maximum 256 chars.\r
- *****************************************************************************/\r
-#define TRACE_DESCRIPTION "Tracealyzer Recorder Test Program"\r
-\r
-/******************************************************************************\r
- * TRACE_DESCRIPTION_MAX_LENGTH\r
+ * This controls if malloc and free calls should be traced. Set this to zero to\r
+ * exclude malloc/free calls, or one (1) to include such events in the trace.\r
  *\r
- * The maximum length (including zero termination) for the TRACE_DESCRIPTION\r
- * string. Since this string also is used for internal error messages from the \r
- * recorder do not make it too short, as this may truncate the error messages.\r
- * Default is 80. \r
- * Maximum allowed length is 256 - the trace will fail to load if longer.\r
+ * Default value is 1.\r
  *****************************************************************************/\r
-#define TRACE_DESCRIPTION_MAX_LENGTH 80\r
-\r
+#define INCLUDE_MEMMANG_EVENTS 1\r
 \r
 /******************************************************************************\r
- * TRACE_DATA_ALLOCATION\r
- *\r
- * This defines how to allocate the recorder data structure, i.e., using a \r
- * static declaration or using a dynamic allocation in runtime (malloc).\r
- *\r
- * Should be one of these two options:\r
- * - TRACE_DATA_ALLOCATION_STATIC (default)\r
- * - TRACE_DATA_ALLOCATION_DYNAMIC\r
+ * INCLUDE_USER_EVENTS\r
  *\r
- * Using static allocation has the benefits of compile-time errors if the buffer \r
- * is too large (too large constants in trcConfig.h) and no need to call the \r
- * initialization routine (xTraceInitTraceData).\r
+ * Macro which should be defined as either zero (0) or one (1).\r
  *\r
- * Using dynamic allocation may give more flexibility in some cases.\r
- *****************************************************************************/\r
-\r
-#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC\r
-\r
-\r
-/******************************************************************************\r
- * CONFIGURATION REGARDING WHAT CODE/FEATURES TO INCLUDE\r
- *****************************************************************************/\r
-\r
-/******************************************************************************\r
- * USE_TRACE_ASSERT\r
+ * If this is zero (0) the code for creating User Events is excluded to\r
+ * reduce code size. User Events are application-generated events, like\r
+ * "printf" but for the trace log instead of console output. User Events are\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
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 0.\r
+ * Default value is 1.\r
  *\r
- * If this is one (1), the TRACE_ASSERT macro will verify that a condition is \r
- * true. If the condition is false, vTraceError() will be called.\r
+ * Note that User Events are only displayed in Professional Edition.\r
  *****************************************************************************/\r
-#define USE_TRACE_ASSERT 1\r
+#define INCLUDE_USER_EVENTS 1\r
 \r
-/******************************************************************************\r
- * INCLUDE_FLOAT_SUPPORT\r
- *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
+/*****************************************************************************\r
+ * INCLUDE_ISR_TRACING\r
  *\r
- * If this is zero (0), all references to floating point values are removed,\r
- * in case floating point values are not supported by the platform used.\r
- * Floating point values are only used in vTracePrintF and its subroutines, to \r
- * store float (%f) or double (%lf) argments. \r
+ * Macro which should be defined as either zero (0) or one (1).\r
  *\r
- * Note: vTracePrintF can still be used with integer and string arguments in\r
- * either case.\r
- *****************************************************************************/\r
-#define INCLUDE_FLOAT_SUPPORT 0\r
-\r
-/******************************************************************************\r
- * INCLUDE_USER_EVENTS\r
+ * If this is zero (0), the code for recording Interrupt Service Routines is\r
+ * excluded to reduce code size.\r
  *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
+ * Default value is 1.\r
  *\r
- * If this is zero (0) the code for creating User Events is excluded to\r
- * reduce code size. User Events are application-generated events, like \r
- * "printf" but for the trace log instead of console output. User Events are \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 User Events are not displayed in FreeRTOS+Trace Free Edition.\r
+ * Note, if the kernel has no central interrupt dispatcher, recording ISRs\r
+ * require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd\r
+ * in your interrupt handlers.\r
  *****************************************************************************/\r
-#define INCLUDE_USER_EVENTS 1\r
+#define INCLUDE_ISR_TRACING 1\r
 \r
 /*****************************************************************************\r
  * INCLUDE_READY_EVENTS\r
  *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
+ * Macro which should be defined as either zero (0) or one (1).\r
  *\r
- * If this is zero (0), the code for recording Ready events is \r
- * excluded. Note, this will make it impossible to calculate the correct\r
- * response times.\r
+ * If one (1), events are recorded when tasks enter scheduling state "ready".\r
+ * This uses a lot of space in the event buffer, so excluding "ready events"\r
+ * will allow for longer traces. Including ready events however allows for\r
+ * showing the initial pending time before tasks enter the execution state, and\r
+ * for presenting accurate response times.\r
+ *\r
+ * Default value is 1.\r
  *****************************************************************************/\r
 #define INCLUDE_READY_EVENTS 1\r
 \r
 /*****************************************************************************\r
  * INCLUDE_NEW_TIME_EVENTS\r
  *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 0.\r
+ * Macro which should be defined as either zero (0) or one (1).\r
  *\r
- * If this is zero (1), events will be generated whenever the os clock is\r
+ * If this is zero (1), events will be generated whenever the OS clock is\r
  * increased.\r
+ *\r
+ * Default value is 0.\r
  *****************************************************************************/\r
-#define INCLUDE_NEW_TIME_EVENTS 0\r
+#define INCLUDE_NEW_TIME_EVENTS 1\r
 \r
-/*****************************************************************************\r
- * INCLUDE_ISR_TRACING\r
+/******************************************************************************\r
+ * INCLUDE_FLOAT_SUPPORT\r
  *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
+ * Macro which should be defined as either zero (0) or one (1).\r
  *\r
- * If this is zero (0), the code for recording Interrupt Service Routines is \r
- * excluded to reduce code size.\r
- * \r
- * Note, if the kernel has no central interrupt dispatcher, recording ISRs \r
- * require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd \r
- * in your interrupt handlers.\r
+ * If this is zero (0), all references to floating point values are removed,\r
+ * in case floating point values are not supported by the platform used.\r
+ * Floating point values are only used in vTracePrintF and its subroutines, to\r
+ * store float (%f) or double (%lf) arguments.\r
+ *\r
+ * vTracePrintF can be used with integer and string arguments in either case.\r
+ *\r
+ * Default value is 1.\r
  *****************************************************************************/\r
-#define INCLUDE_ISR_TRACING 1\r
+#define INCLUDE_FLOAT_SUPPORT 0\r
 \r
 /******************************************************************************\r
  * INCLUDE_OBJECT_DELETE\r
- * \r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
  *\r
- * This must be enabled (1) if tasks, queues or other \r
- * traced kernel objects are deleted at runtime. If no deletes are made, this \r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * This must be enabled (1) if tasks, queues or other\r
+ * traced kernel objects are deleted at runtime. If no deletes are made, this\r
  * can be set to 0 in order to exclude the delete-handling code.\r
+ *\r
+ * Default value is 1.\r
  *****************************************************************************/\r
 #define INCLUDE_OBJECT_DELETE 1\r
 \r
-/******************************************************************************\r
- * INCLUDE_MEMMANG_EVENTS\r
- * \r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
+/*******************************************************************************\r
+ * SYMBOL_TABLE_SIZE\r
  *\r
- * This controls if malloc and free calls should be traced. Set this to zero to\r
- * exclude malloc/free calls from the tracing.\r
- *****************************************************************************/\r
-#define INCLUDE_MEMMANG_EVENTS 1\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the capacity of the symbol table, in bytes. This symbol table\r
+ * stores User Events labels and names of deleted tasks, queues, or other kernel\r
+ * objects. If you don't use User Events or delete any kernel\r
+ * objects you set this to a very low value. The minimum recommended value is 4.\r
+ * A size of zero (0) is not allowed since a zero-sized array may result in a\r
+ * 32-bit pointer, i.e., using 4 bytes rather than 0.\r
+ *\r
+ * Default value is 800.\r
+ ******************************************************************************/\r
+#define SYMBOL_TABLE_SIZE 5000\r
+\r
+#if (SYMBOL_TABLE_SIZE == 0)\r
+#error "SYMBOL_TABLE_SIZE may not be zero!"\r
+#endif\r
 \r
 /******************************************************************************\r
- * CONFIGURATION RELATED TO BEHAVIOR\r
+ * NameLenTask, NameLenQueue, ...\r
+ *\r
+ * Macros that specify the maximum lengths (number of characters) for names of\r
+ * kernel objects, such as tasks and queues. If longer names are used, they will\r
+ * be truncated when stored in the recorder.\r
  *****************************************************************************/\r
+#define NameLenTask                    15\r
+#define NameLenISR                     15\r
+#define NameLenQueue           15\r
+#define NameLenSemaphore       15\r
+#define NameLenMutex           15\r
+#define NameLenTimer           15\r
+#define NameLenEventGroup      15\r
 \r
 /******************************************************************************\r
- * TRACE_RECORDER_STORE_MODE\r
+ * TRACE_DATA_ALLOCATION\r
  *\r
- * Macro which should be defined as one of:\r
- * - TRACE_STORE_MODE_RING_BUFFER\r
- * - TRACE_STORE_MODE_STOP_WHEN_FULL\r
- * Default is TRACE_STORE_MODE_RING_BUFFER.\r
+ * This defines how to allocate the recorder data structure, i.e., using a\r
+ * static declaration or using a dynamic allocation in runtime (malloc).\r
+ *\r
+ * Should be one of these two options:\r
+ * - TRACE_DATA_ALLOCATION_STATIC (default)\r
+ * - TRACE_DATA_ALLOCATION_DYNAMIC\r
+ *\r
+ * Using static allocation has the benefits of compile-time errors if the buffer\r
+ * is too large (too large constants in trcConfig.h) and no need to call the\r
+ * initialization routine (xTraceInitTraceData).\r
  *\r
- * With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the events are \r
- * stored in a ring buffer, i.e., where the oldest events are overwritten when \r
- * the buffer becomes full. This allows you to get the last events leading up \r
- * to an interesting state, e.g., an error, without having a large trace buffer\r
- * for string the whole run since startup. In this mode, the recorder can run\r
- * "forever" as the buffer never gets full, i.e., in the sense that it always\r
- * has room for more events.\r
- *\r
- * To fetch the trace in mode TRACE_STORE_MODE_RING_BUFFER, you need to first halt the\r
- * system using your debugger and then do a RAM dump, or to explicitly stop the\r
- * recorder using vTraceStop() and then store/upload the trace data using a\r
- * task that you need to provide yourself. The trace data is found in the struct\r
- * RecorderData, initialized in trcBase.c.\r
- *\r
- * Note that, if you upload the trace using a RAM dump, i.e., when the system is \r
- * halted on a breakpoint or by a debugger command, there is no need to stop the \r
- * recorder first.\r
- *\r
- * When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the recording is\r
- * stopped when the buffer becomes full. When the recorder stops itself this way\r
- * vTracePortEnd() is called which allows for custom actions, such as triggering\r
- * a task that stores the trace buffer, i.e., in case taking a RAM dump\r
- * using an on-chip debugger is not possible. In the Windows port, vTracePortEnd\r
- * saves the trace to file directly, but this is not recommended in a real-time\r
- * system since the scheduler is blocked during the processing of vTracePortEnd.\r
+ * Using dynamic allocation may give more flexibility in some cases.\r
  *****************************************************************************/\r
+#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC\r
+\r
 \r
-#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER\r
 \r
 /******************************************************************************\r
- * STOP_AFTER_N_EVENTS\r
+ *** ADVANCED SETTINGS ********************************************************\r
+ ******************************************************************************\r
+ * The remaining settings are not necessary to modify but allows for optimizing\r
+ * the recorder setup for your specific needs, e.g., to exclude events that you\r
+ * are not interested in, in order to get longer traces.\r
+ *****************************************************************************/\r
+\r
+/******************************************************************************\r
+* HEAP_SIZE_BELOW_16M\r
+*\r
+* An integer constant that can be used to reduce the buffer usage of memory\r
+* allocation events (malloc/free). This value should be 1 if the heap size is\r
+* below 16 MB (2^24 byte), and you can live with reported addresses showing the\r
+* lower 24 bits only. If 0, you get the full 32-bit addresses.\r
+*\r
+* Default value is 0.\r
+******************************************************************************/\r
+#define HEAP_SIZE_BELOW_16M 0\r
+\r
+/******************************************************************************\r
+ * USE_LINKER_PRAGMA\r
  *\r
- * Macro which should be defined as an integer value, or not defined.\r
- * Default is -1\r
+ * Macro which should be defined as an integer value, default is 0.\r
  *\r
- * STOP_AFTER_N_EVENTS is intended for tests of the ring buffer mode (when\r
- * RECORDER_STORE_MODE is STORE_MODE_RING_BUFFER). It stops the recording when\r
- * the specified number of events has been observed. This value can be larger\r
- * than the buffer size, to allow for test of the "wrapping around" that occurs\r
- * in ring buffer mode . A negative value (or no definition of this macro)\r
- * disables this feature.\r
- *****************************************************************************/\r
-#define STOP_AFTER_N_EVENTS -1\r
+ * If this is 1, the header file "recorderdata_linker_pragma.h" is included just\r
+ * before the declaration of RecorderData (in trcBase.c), i.e., the trace data\r
+ * structure. This allows the user to specify a pragma with linker options.\r
+ *\r
+ * Example (for IAR Embedded Workbench and NXP LPC17xx):\r
+ * #pragma location="AHB_RAM_MEMORY"\r
+ *\r
+ * This example instructs the IAR linker to place RecorderData in another RAM\r
+ * bank, the AHB RAM. This can also be used for other compilers with a similar\r
+ * pragmas for linker options.\r
+ *\r
+ * Note that this only applies if using static allocation, see below.\r
+ ******************************************************************************/\r
+#define USE_LINKER_PRAGMA 0\r
 \r
 /******************************************************************************\r
  * USE_IMPLICIT_IFE_RULES\r
  *\r
- * Macro which should be defined as either zero (0) or one (1). \r
+ * Macro which should be defined as either zero (0) or one (1).\r
  * Default is 1.\r
  *\r
- * ### Instance Finish Events (IFE) ###\r
- *\r
- * For tasks with "infinite" main loops (non-terminating tasks), the concept\r
- * of a task instance has no clear definition, it is an application-specific\r
- * thing. Tracealyzer allows you to define Instance Finish Events (IFEs),\r
- * which marks the point in a cyclic task when the "task instance" ends.\r
- * The IFE is a blocking kernel call, typically in the main loop of a task\r
- * which typically reads a message queue, waits for a semaphore or performs\r
- * an explicit delay.\r
- *\r
- * If USE_IMPLICIT_IFE_RULES is one (1), the kernel macros (trcKernelPort.h)\r
- * will define what kernel calls are considered by default to be IFEs.\r
- *\r
- * However, Implicit IFEs only applies to blocking kernel calls. If a\r
- * service reads a message without blocking, it does not create a new\r
- * instance since no blocking occurred.\r
- *\r
- * Moreover, the actual IFE might sometimes be another blocking call. We \r
- * therefore allow for user-defined Explicit IFEs by calling\r
- *\r
- *     vTraceTaskInstanceIsFinished()\r
- *\r
- * right before the kernel call considered as IFE. This does not create an\r
- * additional event but instead stores the service code and object handle\r
- * of the IFE call as properties of the task.\r
- *\r
- * If using Explicit IFEs and the task also calls an Implicit IFE, this may \r
- * result in additional incorrect task instances.\r
- * This is solved by disabling the Implicit IFEs for the task, by adding\r
- * a call to\r
- * \r
- *     vTraceTaskSkipDefaultInstanceFinishedEvents()\r
- * \r
- * in the very beginning of that task. This allows you to combine Explicit IFEs\r
- * for some tasks with Implicit IFEs for the rest of the tasks, if\r
- * USE_IMPLICIT_IFE_RULES is 1.\r
- *\r
- * By setting USE_IMPLICIT_IFE_RULES to zero (0), the implicit IFEs are disabled\r
- * for all tasks. Tasks will then be considered to have a single instance only, \r
- * covering all execution fragments, unless you define an explicit IFE in each\r
- * task by calling vTraceTaskInstanceIsFinished before the blocking call.\r
+ * Tracealyzer groups the events into actor instances, based on context-switches\r
+ * and a definition of "Instance Finish Events", or IFEs. These are kernel calls\r
+ * considered to be the last event in a task instance. Some kernel calls are\r
+ * considered IFEs by default (e.g., delay functions), but it is also possible\r
+ * to specify this individually for each task (see vTraceTaskInstanceFinish).\r
+ *\r
+ * If USE_IMPLICIT_IFE_RULES is one (1), the default IFEs will be enabled, which\r
+ * gives a "typical" grouping of events into instances. You can combine this\r
+ * with calls to vTraceTaskInstanceFinish for specific tasks.\r
+ *\r
+ * If USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFEs are disabled and all\r
+ * events withing each task is then shown as a single instance, unless  you call\r
+ * vTraceTaskInstanceFinish() at suitable locations to mark the IFEs.\r
  *****************************************************************************/\r
 #define USE_IMPLICIT_IFE_RULES 1\r
 \r
-\r
 /******************************************************************************\r
  * USE_16BIT_OBJECT_HANDLES\r
  *\r
  * Macro which should be defined as either zero (0) or one (1).\r
- * Default is 0.\r
  *\r
- * If set to 0 (zero), the recorder uses 8-bit handles to identify kernel \r
+ * If set to 0 (zero), the recorder uses 8-bit handles to identify kernel\r
  * objects such as tasks and queues. This limits the supported number of\r
  * concurrently active objects to 255 of each type (object class).\r
  *\r
- * If set to 1 (one), the recorder uses 16-bit handles to identify kernel \r
+ * If set to 1 (one), the recorder uses 16-bit handles to identify kernel\r
  * objects such as tasks and queues. This limits the supported number of\r
  * concurrent objects to 65535 of each type (object class). However, since the\r
  * object property table is limited to 64 KB, the practical limit is about\r
- * 3000 objects in total. \r
- * \r
- * NOTE: An object with a high ID (> 255) will generate an extra event \r
- * (= 4 byte) in the event buffer. \r
- * \r
- * NOTE: Some internal tables in the recorder gets larger when using 16-bit \r
- * handles. The additional RAM usage is 5-10 byte plus 1 byte per kernel object\r
- *, i.e., task, queue, semaphore, mutex, etc.\r
+ * 3000 objects in total.\r
+ *\r
+ * Default is 0.\r
+ *\r
+ * NOTE: An object with handle above 255 will use an extra 4-byte record in\r
+ * the event buffer whenever referenced. Moreover, some internal tables in the\r
+ * recorder gets larger when using 16-bit handles. The additional RAM usage is\r
+ * 5-10 byte plus 1 byte per kernel object i.e., task, queue, mutex, etc.\r
  *****************************************************************************/\r
 #define USE_16BIT_OBJECT_HANDLES 0\r
 \r
-/****** Port Name ******************** Code ** Official ** OS Platform ******\r
-* PORT_APPLICATION_DEFINED               -2     -           -                 \r
-* PORT_NOT_SET                           -1     -           -                 \r
-* PORT_HWIndependent                     0      Yes         Any               \r
-* PORT_Win32                             1      Yes         FreeRTOS Win32\r
-* PORT_Atmel_AT91SAM7                    2      No          Any               \r
-* PORT_Atmel_UC3A0                       3      No          Any               \r
-* PORT_ARM_CortexM                       4      Yes         Any               \r
-* PORT_Renesas_RX600                     5      Yes         Any               \r
-* PORT_Microchip_dsPIC_AND_PIC24         6      Yes         Any               \r
-* PORT_TEXAS_INSTRUMENTS_TMS570          7      No          Any               \r
-* PORT_TEXAS_INSTRUMENTS_MSP430          8      No          Any               \r
-* PORT_MICROCHIP_PIC32                   9      No          Any               \r
-* PORT_XILINX_PPC405                     10     No          FreeRTOS          \r
-* PORT_XILINX_PPC440                     11     No          FreeRTOS          \r
-* PORT_XILINX_MICROBLAZE                 12     No          Any               \r
-* PORT_NXP_LPC210X                       13     No          Any               \r
-*****************************************************************************/\r
-#define SELECTED_PORT PORT_Win32\r
-\r
-#if (SELECTED_PORT == PORT_NOT_SET)\r
-#error "You need to define SELECTED_PORT here!"\r
-#endif\r
-\r
 /******************************************************************************\r
-* USE_PRIMASK_CS (for Cortex M devices only)\r
-*\r
-* An integer constant that selects between two options for the critical\r
-* sections of the recorder library.\r
+ * USE_TRACE_ASSERT\r
  *\r
-*   0: The default FreeRTOS critical section (BASEPRI) - default setting\r
-*   1: Always disable ALL interrupts (using PRIMASK)\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ * Default is 1.\r
  *\r
-* Option 0 uses the standard FreeRTOS macros for critical sections.\r
-* However, on Cortex-M devices they only disable interrupts with priorities \r
-* below a certain configurable level, while higher priority ISRs remain active.\r
-* Such high-priority ISRs may not use the recorder functions in this mode.\r
-*\r
-* Option 1 allows you to safely call the recorder from any ISR, independent of \r
-* the interrupt priority. This mode may however cause higher IRQ latencies\r
-* (some microseconds) since ALL configurable interrupts are disabled during \r
-* the recorder's critical sections in this mode, using the PRIMASK register.\r
+ * If this is one (1), the TRACE_ASSERT macro will verify that a condition is\r
+ * true. If the condition is false, vTraceError() will be called.\r
+ * This is used on several places in the recorder code for sanity checks on\r
+ * parameters. Can be switched off to reduce CPU usage of the tracing.\r
+ *****************************************************************************/\r
+#define USE_TRACE_ASSERT 1\r
+\r
+/*******************************************************************************\r
+ * USE_SEPARATE_USER_EVENT_BUFFER\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ * Default is zero (0).\r
+ *\r
+ * This enables and disables the use of the separate user event buffer. Using\r
+ * this separate buffer has the benefit of not overwriting the user events with\r
+ * kernel events (usually generated at a much higher rate), i.e., when using\r
+ * ring-buffer mode.\r
+ *\r
+ * Note: When using the separate user event buffer, you may get an artificial\r
+ * task instance named "Unknown actor". This is added as a placeholder when the\r
+ * user event history is longer than the task scheduling history.\r
  ******************************************************************************/\r
-#define USE_PRIMASK_CS 0\r
+#define USE_SEPARATE_USER_EVENT_BUFFER 0\r
 \r
-/******************************************************************************\r
-* HEAP_SIZE_BELOW_16M\r
-*\r
-* An integer constant that can be used to reduce the buffer usage of memory\r
-* allocation events (malloc/free). This value should be 1 if the heap size is \r
-* below 16 MB (2^24 byte), and you can live with addresses truncated to the \r
-* lower 24 bit. Otherwise set it to 0 to get the full 32-bit addresses.\r
-******************************************************************************/\r
-#define HEAP_SIZE_BELOW_16M 0\r
+/*******************************************************************************\r
+ * USER_EVENT_BUFFER_SIZE\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the capacity of the user event buffer, in number of slots.\r
+ * A single user event can use between 1 and X slots, depending on the data.\r
+ *\r
+ * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
+ ******************************************************************************/\r
+#define USER_EVENT_BUFFER_SIZE 10\r
+\r
+/*******************************************************************************\r
+ * USER_EVENT_CHANNELS\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the number of allowed user event channels.\r
+ *\r
+ * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
+ ******************************************************************************/\r
+#define CHANNEL_FORMAT_PAIRS 32\r
 \r
 #endif\r
 \r
index 5e65e3e175f365d9b101c7d77b74789bcaeede8b..39234651c17bd4290cafb6a1e127cb67071a8b63 100644 (file)
     <ClCompile Include="..\Common\Minimal\QueueOverwrite.c" />\r
     <ClCompile Include="..\Common\Minimal\QueueSet.c" />\r
     <ClCompile Include="..\Common\Minimal\semtest.c" />\r
+    <ClCompile Include="..\Common\Minimal\TaskNotify.c" />\r
     <ClCompile Include="..\Common\Minimal\timerdemo.c" />\r
     <ClCompile Include="DemosModifiedForLowTickRate\recmutex.c" />\r
     <ClCompile Include="main.c">\r
index debd11c0193d004178c69e2c7cb3d6d4d4078b4d..d4e210a8d12fc01917c3ce1acfe3b60b5de75ffd 100644 (file)
     <ClCompile Include="..\Common\Minimal\IntSemTest.c">\r
       <Filter>Demo App Source\Common Demo Tasks</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\Common\Minimal\TaskNotify.c">\r
+      <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="FreeRTOSConfig.h">\r
index 064c913757f0bf60d1fec5443f075c438ccad3be..6c10d8dde191c0d97aa283ca44bd81067c813f57 100644 (file)
@@ -113,8 +113,8 @@ being used as this demo could easily create one large heap region instead of
 multiple smaller heap regions - in which case heap_4.c would be the more\r
 appropriate choice. */\r
 #define mainREGION_1_SIZE      3001\r
-#define mainREGION_2_SIZE      18005\r
-#define mainREGION_3_SIZE      1007\r
+#define mainREGION_2_SIZE      18105\r
+#define mainREGION_3_SIZE      1407\r
 \r
 /*\r
  * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.\r
@@ -228,10 +228,10 @@ void vApplicationIdleHook( void )
        function, because it is the responsibility of the idle task to clean up\r
        memory allocated by the kernel to any task that has since been deleted. */\r
 \r
-       /* Uncomment the following code to allow the trace to be stopped with any\r
+       /* Uncomment the following code to allow the trace to be stopped with any \r
        key press.  The code is commented out by default as the kbhit() function\r
        interferes with the run time behaviour. */\r
-       /*\r
+       /* \r
                if( _kbhit() != pdFALSE )\r
                {\r
                        if( xTraceRunning == pdTRUE )\r
@@ -369,4 +369,5 @@ const HeapRegion_t xHeapRegions[] =
 \r
        vPortDefineHeapRegions( xHeapRegions );\r
 }\r
+/*-----------------------------------------------------------*/\r
 \r
index b37b5d6e0b5d8f5ab3812065e820aa15e744ae09..0dc8189026c5d8349b366b19c3a266ff3c777030 100644 (file)
 \r
 /* The rate at which data is sent to the queue.  The 200ms value is converted\r
 to ticks using the portTICK_PERIOD_MS constant. */\r
-#define mainQUEUE_SEND_FREQUENCY_MS                    ( 200 )\r
+#define mainQUEUE_SEND_FREQUENCY_MS                    ( 200 / portTICK_PERIOD_MS )\r
 \r
 /* The number of items the queue can hold.  This is 1 as the receive task\r
 will remove items as they are added, meaning the send task should always find\r
index 74fc3f29ed0e06ed5fd7e37788625679aa719fd9..85691c22517a2ceae368d48938adb213957d5afc 100644 (file)
 \r
 /* Kernel includes. */\r
 #include <FreeRTOS.h>\r
-#include "task.h"\r
-#include "queue.h"\r
-#include "timers.h"\r
-#include "semphr.h"\r
+#include <task.h>\r
+#include <queue.h>\r
+#include <timers.h>\r
+#include <semphr.h>\r
 \r
 /* Standard demo includes. */\r
 #include "BlockQ.h"\r
 #include "QueueOverwrite.h"\r
 #include "EventGroupsDemo.h"\r
 #include "IntSemTest.h"\r
+#include "TaskNotify.h"\r
 \r
 /* Priorities at which the tasks are created. */\r
 #define mainCHECK_TASK_PRIORITY                        ( configMAX_PRIORITIES - 2 )\r
@@ -196,6 +197,7 @@ int main_full( void )
        xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
 \r
        /* Create the standard demo tasks. */\r
+       vStartTaskNotifyTask();\r
        vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
        vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
        vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
@@ -265,6 +267,11 @@ const TickType_t xCycleFrequency = 2500 / portTICK_PERIOD_MS;
                }\r
                #endif\r
 \r
+               if( xAreTaskNotificationTasksStillRunning() != pdTRUE )\r
+               {\r
+                       pcStatusMessage = "Error:  Notification";\r
+               }\r
+\r
                if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )\r
                {\r
                        pcStatusMessage = "Error: IntSem";\r
@@ -379,7 +386,7 @@ void *pvAllocated;
                xMutexToDelete = NULL;\r
        }\r
 \r
-       /* Exercise heap_4 a bit.  The malloc failed hook will trap failed\r
+       /* Exercise heap_5 a bit.  The malloc failed hook will trap failed\r
        allocations so there is no need to test here. */\r
        pvAllocated = pvPortMalloc( ( rand() % 100 ) + 1 );\r
        vPortFree( pvAllocated );\r
@@ -410,6 +417,9 @@ void vFullDemoTickHookFunction( void )
 \r
        /* Exercise giving mutexes from an interrupt. */\r
        vInterruptSemaphorePeriodicTest();\r
+\r
+       /* Exercise using task notifications from an interrupt. */\r
+       xNotifyTaskFromISR();\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
index 4d3dee903ee298da868f94607b91fb64ac3b1c1d..2df612dbadb9514b52eae15b2af089e5ba0525ad 100644 (file)
@@ -56,7 +56,7 @@
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193247</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
@@ -65,7 +65,7 @@
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193247</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
@@ -74,7 +74,7 @@
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193257</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
@@ -83,7 +83,7 @@
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193257</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
@@ -92,7 +92,7 @@
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193267</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193277</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193277</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193287</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193297</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193297</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193308</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193313</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193319</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193325</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321193349</id>\r
                        <name>Standard_Demo_Tasks</name>\r
                        <type>5</type>\r
                        <matcher>\r
                                <arguments>1.0-name-matches-false-false-timerdemo.c</arguments>\r
                        </matcher>\r
                </filter>\r
+               <filter>\r
+                       <id>1418321193369</id>\r
+                       <name>Standard_Demo_Tasks</name>\r
+                       <type>5</type>\r
+                       <matcher>\r
+                               <id>org.eclipse.ui.ide.multiFilter</id>\r
+                               <arguments>1.0-name-matches-false-false-IntSemTest.c</arguments>\r
+                       </matcher>\r
+               </filter>\r
+               <filter>\r
+                       <id>1418321193379</id>\r
+                       <name>Standard_Demo_Tasks</name>\r
+                       <type>5</type>\r
+                       <matcher>\r
+                               <id>org.eclipse.ui.ide.multiFilter</id>\r
+                               <arguments>1.0-name-matches-false-false-TaskNotify.c</arguments>\r
+                       </matcher>\r
+               </filter>\r
                <filter>\r
                        <id>0</id>\r
                        <name>FreeRTOS_Source/portable</name>\r
                        </matcher>\r
                </filter>\r
                <filter>\r
-                       <id>0</id>\r
+                       <id>1418321226214</id>\r
                        <name>FreeRTOS_Source/portable/MemMang</name>\r
                        <type>5</type>\r
                        <matcher>\r
                                <id>org.eclipse.ui.ide.multiFilter</id>\r
-                               <arguments>1.0-name-matches-false-false-heap_4.c</arguments>\r
+                               <arguments>1.0-name-matches-false-false-heap_5.c</arguments>\r
                        </matcher>\r
                </filter>\r
        </filteredResources>\r
index b6e429ca90c50948020b25ac30391623e2064813..e4f6ce87b2275eaa9531d5effc6137983720b2bc 100644 (file)
@@ -83,7 +83,7 @@
 #define configUSE_TICK_HOOK                                            1\r
 #define configTICK_RATE_HZ                                             ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */\r
 #define configMINIMAL_STACK_SIZE                               ( ( unsigned short ) 50 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */\r
-#define configTOTAL_HEAP_SIZE                                  ( ( size_t ) ( 20 * 1024 ) )\r
+#define configTOTAL_HEAP_SIZE                                  ( ( size_t ) ( 23 * 1024 ) )\r
 #define configMAX_TASK_NAME_LEN                                        ( 12 )\r
 #define configUSE_TRACE_FACILITY                               1\r
 #define configUSE_16_BIT_TICKS                                 0\r
@@ -97,6 +97,7 @@
 #define configUSE_COUNTING_SEMAPHORES                  1\r
 #define configUSE_ALTERNATIVE_API                              1\r
 #define configUSE_QUEUE_SETS                                   1\r
+#define configUSE_TASK_NOTIFICATIONS                   1\r
 \r
 /* Software timer related configuration options. */\r
 #define configUSE_TIMERS                                               1\r
 #define configTIMER_QUEUE_LENGTH                               20\r
 #define configTIMER_TASK_STACK_DEPTH                   ( configMINIMAL_STACK_SIZE * 2 )\r
 \r
-#define configMAX_PRIORITIES                                   ( 8 )\r
+#define configMAX_PRIORITIES                                   ( 7 )\r
 \r
 /* Run time stats gathering configuration options. */\r
 unsigned long ulGetRunTimeCounterValue( void ); /* Prototype of function that returns run time counter. */\r
 void vConfigureTimerForRunTimeStats( void );   /* Prototype of function that initialises the run time counter. */\r
-#define configGENERATE_RUN_TIME_STATS  1\r
+#define configGENERATE_RUN_TIME_STATS                  1\r
 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()\r
 #define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeCounterValue()\r
 \r
 /* Co-routine related configuration options. */\r
-#define configUSE_CO_ROUTINES          1\r
-#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\r
+#define configUSE_CO_ROUTINES                                  1\r
+#define configMAX_CO_ROUTINE_PRIORITIES                        ( 2 )\r
 \r
 /* This demo makes use of one or more example stats formatting functions.  These\r
 format the raw data provided by the uxTaskGetSystemState() function in to human\r
@@ -147,7 +148,9 @@ uses the same semantics as the standard C assert() macro. */
 extern void vAssertCalled( unsigned long ulLine, const char * const pcFileName );\r
 #define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __LINE__, __FILE__ )\r
 \r
-\r
 /* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */\r
+#define TRACE_ENTER_CRITICAL_SECTION() portENTER_CRITICAL()\r
+#define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL()\r
 #include "trcKernelPort.h"\r
+\r
 #endif /* FREERTOS_CONFIG_H */\r
index 289384a284c19d48c03da29d183417a08468b9f7..7039112bfca16c76535a9c873f55f7abde3ccf34 100644 (file)
@@ -1,14 +1,14 @@
 /*******************************************************************************\r
- * Tracealyzer v2.6.0 Recorder Library\r
+ * Tracealyzer v2.7.0 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcConfig.h\r
  *\r
- * Configuration parameters for the trace recorder library. Before using the \r
- * trace recorder library, please check that the default settings are \r
- * appropriate for your system, and if necessary adjust these. Most likely, you \r
- * will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to \r
- * reflect the number of such objects in your system. These may be \r
+ * Configuration parameters for the trace recorder library. Before using the\r
+ * trace recorder library, please check that the default settings are\r
+ * appropriate for your system, and if necessary adjust these. Most likely, you\r
+ * will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to\r
+ * reflect the number of such objects in your system. These may be\r
  * over-approximated, although larger values values implies more RAM usage.\r
  *\r
  * Terms of Use\r
  * use together with Percepio products. You may distribute the recorder library\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
- * Copyright Percepio AB, 2013.\r
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2014.\r
  * www.percepio.com\r
  ******************************************************************************/\r
 \r
 #ifndef TRCCONFIG_H\r
 #define TRCCONFIG_H\r
 \r
-/*******************************************************************************\r
- * CONFIGURATION RELATED TO CAPACITY AND ALLOCATION \r
- ******************************************************************************/\r
-\r
-/*******************************************************************************\r
- * EVENT_BUFFER_SIZE\r
- *\r
- * Macro which should be defined as an integer value.\r
- *\r
- * This defines the capacity of the event buffer, i.e., the number of records\r
- * it may store. Each registered event typically use one record (4 byte), but\r
- * vTracePrintF may use multiple records depending on the number of data args.\r
- ******************************************************************************/\r
+/******************************************************************************\r
+ * SELECTED_PORT\r
+ *\r
+ * Macro that specifies what hardware port that should be used.\r
+ * Available ports are:\r
+ *\r
+ * Port Name                                                   Code     Official       OS supported\r
+ * PORT_APPLICATION_DEFINED                            -2              -                       -\r
+ * PORT_NOT_SET                                                        -1              -                       -\r
+ * PORT_HWIndependent                                  0               Yes                     Any\r
+ * PORT_Win32                                                  1               Yes                     FreeRTOS on Win32\r
+ * PORT_Atmel_AT91SAM7                                 2               No                      Any\r
+ * PORT_Atmel_UC3A0                                            3               No                      Any\r
+ * PORT_ARM_CortexM                                            4               Yes                     Any\r
+ * PORT_Renesas_RX600                                  5               Yes                     Any\r
+ * PORT_Microchip_dsPIC_AND_PIC24              6               Yes                     Any\r
+ * PORT_TEXAS_INSTRUMENTS_TMS570               7               No                      Any\r
+ * PORT_TEXAS_INSTRUMENTS_MSP430               8               No                      Any\r
+ * PORT_MICROCHIP_PIC32MX                              9               Yes                     Any\r
+ * PORT_XILINX_PPC405                                  10              No                      FreeRTOS\r
+ * PORT_XILINX_PPC440                                  11              No                      FreeRTOS\r
+ * PORT_XILINX_MICROBLAZE                              12              No                      Any\r
+ * PORT_NXP_LPC210X                                            13              No                      Any\r
+ * PORT_MICROCHIP_PIC32MZ                              14              Yes                     Any\r
+ * PORT_ARM_CORTEX_A9                                  15              No                      Any\r
+ *****************************************************************************/\r
 \r
-#define EVENT_BUFFER_SIZE 10000 /* Adjust wrt. to available RAM */\r
+#ifndef WIN32\r
+       // Set the port setting here!\r
+       #define SELECTED_PORT PORT_NOT_SET\r
 \r
+       #if (SELECTED_PORT == PORT_NOT_SET)\r
+               #error "You need to define SELECTED_PORT here!"\r
+       #endif\r
+#else\r
+       // For Win32 demo projects this is set automatically\r
+       #define SELECTED_PORT PORT_Win32\r
+#endif\r
 \r
-/*******************************************************************************\r
- * USE_LINKER_PRAGMA\r
- *\r
- * Macro which should be defined as an integer value, default is 0.\r
+/******************************************************************************\r
+ * FREERTOS_VERSION\r
  *\r
- * If this is 1, the header file "recorderdata_linker_pragma.h" is included just\r
- * before the declaration of RecorderData (in trcBase.c), i.e., the trace data \r
- * structure. This allows the user to specify a pragma with linker options. \r
+ * Specify what version of FreeRTOS that is used. This is necessary compensate\r
+ * for renamed symbols in the FreeRTOS kernel (does not build if incorrect).\r
  *\r
- * Example (for IAR Embedded Workbench and NXP LPC17xx):\r
- * #pragma location="AHB_RAM_MEMORY"\r
- * \r
- * This example instructs the IAR linker to place RecorderData in another RAM \r
- * bank, the AHB RAM. This can also be used for other compilers with a similar\r
- * pragmas for linker options.\r
- * \r
- * Note that this only applies if using static allocation, see below.\r
- ******************************************************************************/\r
-\r
-#define USE_LINKER_PRAGMA 0\r
-\r
+ * FREERTOS_VERSION_7_3_OR_7_4 (= 1)           If using FreeRTOS v7.3.0 - v7.4.2\r
+ * FREERTOS_VERSION_7_5_OR_7_6 (= 2)           If using FreeRTOS v7.5.0 - v7.6.0\r
+ * FREERTOS_VERSION_8_0_OR_LATER (= 3)         If using FreeRTOS v8.0.0 or later\r
+ *****************************************************************************/\r
+#define FREERTOS_VERSION       FREERTOS_VERSION_8_0_OR_LATER\r
 \r
-/*******************************************************************************\r
- * SYMBOL_TABLE_SIZE\r
+/******************************************************************************\r
+ * TRACE_RECORDER_STORE_MODE\r
  *\r
- * Macro which should be defined as an integer value.\r
+ * Macro which should be defined as one of:\r
+ * - TRACE_STORE_MODE_RING_BUFFER\r
+ * - TRACE_STORE_MODE_STOP_WHEN_FULL\r
+ * Default is TRACE_STORE_MODE_RING_BUFFER.\r
  *\r
- * This defines the capacity of the symbol table, in bytes. This symbol table \r
- * stores User Events labels and names of deleted tasks, queues, or other kernel\r
- * objects. Note that the names of active objects not stored here but in the \r
- * Object Table. Thus, if you don't use User Events or delete any kernel \r
- * objects you set this to a very low value, e.g. 4, but not zero (0) since \r
- * this causes a declaration of a zero-sized array, for which the C compiler\r
- * behavior is not standardized and may cause misaligned data.\r
- ******************************************************************************/\r
-#define SYMBOL_TABLE_SIZE 5000\r
-\r
-#if (SYMBOL_TABLE_SIZE == 0)\r
-#error "SYMBOL_TABLE_SIZE may not be zero!"\r
-#endif\r
+ * With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the\r
+ * events are stored in a ring buffer, i.e., where the oldest events are\r
+ * overwritten when the buffer becomes full. This allows you to get the last\r
+ * events leading up to an interesting state, e.g., an error, without having\r
+ * to store the whole run since startup.\r
+ *\r
+ * When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the\r
+ * recording is stopped when the buffer becomes full. This is useful for\r
+ * recording events following a specific state, e.g., the startup sequence.\r
+ *****************************************************************************/\r
+#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER\r
 \r
 /*******************************************************************************\r
- * USE_SEPARATE_USER_EVENT_BUFFER\r
+ * TRACE_SCHEDULING_ONLY\r
  *\r
  * Macro which should be defined as an integer value.\r
- * Default is zero (0).\r
  *\r
- * This enables and disables the use of the separate user event buffer.\r
+ * If this setting is enabled (= 1), only scheduling events are recorded.\r
+ * If disabled (= 0), all events are recorded.\r
  *\r
- * Note: When using the separate user event buffer, you may get an artificial\r
- * task instance named "Unknown actor". This is added as a placeholder when the \r
- * user event history is longer than the task scheduling history.\r
- ******************************************************************************/\r
-#define USE_SEPARATE_USER_EVENT_BUFFER 0\r
-\r
-/*******************************************************************************\r
- * USER_EVENT_BUFFER_SIZE\r
+ * Users of FreeRTOS+Trace Free Edition only displays scheduling events, so this\r
+ * option can be used to avoid storing unsupported events.\r
  *\r
- * Macro which should be defined as an integer value.\r
+ * Default value is 0 (store all enabled events).\r
  *\r
- * This defines the capacity of the user event buffer, in number of slots.\r
- * A single user event can use between 1 and X slots, depending on the data.\r
- *\r
- * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
  ******************************************************************************/\r
-#define USER_EVENT_BUFFER_SIZE 500\r
+#define TRACE_SCHEDULING_ONLY 0\r
 \r
 /*******************************************************************************\r
- * USER_EVENT_CHANNELS\r
+ * EVENT_BUFFER_SIZE\r
  *\r
  * Macro which should be defined as an integer value.\r
  *\r
- * This defines the number of allowed user event channels.\r
+ * This defines the capacity of the event buffer, i.e., the number of records\r
+ * it may store. Most events use one record (4 byte), although some events\r
+ * require multiple 4-byte records. You should adjust this to the amount of RAM\r
+ * available in the target system.\r
  *\r
- * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
+ * Default value is 1000, which means that 4000 bytes is allocated for the\r
+ * event buffer.\r
  ******************************************************************************/\r
-#define CHANNEL_FORMAT_PAIRS 32\r
+#define EVENT_BUFFER_SIZE 15000\r
 \r
 /*******************************************************************************\r
  * NTask, NISR, NQueue, NSemaphore, NMutex\r
  *\r
- * A group of Macros which should be defined as an integer value of zero (0) \r
- * or larger.\r
+ * A group of macros which should be defined as integer values, zero or larger.\r
  *\r
- * This defines the capacity of the Object Property Table - the maximum number\r
- * of objects active at any given point within each object class.\r
- * \r
- * NOTE: In case objects are deleted and created during runtime, this setting\r
- * does not limit the total amount of objects, only the number of concurrently\r
- * active objects. \r
+ * These define the capacity of the Object Property Table, i.e., the maximum\r
+ * number of objects active at any given point, within each object class (e.g.,\r
+ * task, queue, semaphore, ...).\r
  *\r
- * Using too small values will give an error message through the vTraceError\r
- * routine, which makes the error message appear when opening the trace data\r
- * in Tracealyzer. If you are using the recorder status monitor task,\r
- * any error messages are displayed in console prints, assuming that the\r
- * print macro has been defined properly (vConsolePrintMessage). \r
+ * If tasks or other other objects are deleted in your system, this\r
+ * setting does not limit the total amount of objects created, only the number\r
+ * of objects that have been successfully created but not yet deleted.\r
  *\r
- * It can be wise to start with very large values for these constants, \r
- * unless you are very confident on these numbers. Then do a recording and\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 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
+ * Using too small values will cause vTraceError to be called, which stores an\r
+ * error message in the trace that is shown when opening the trace file.\r
  *\r
+ * It can be wise to start with large values for these constants,\r
+ * unless you are very confident on these numbers. Then do a recording and\r
+ * check the actual usage by selecting View menu -> Trace Details ->\r
+ * Resource Usage -> Object Table.\r
  ******************************************************************************/\r
-#define NTask             100\r
-#define NISR              20\r
-#define NQueue            60\r
-#define NSemaphore        60\r
-#define NMutex            60\r
-#define NTimer            200\r
-#define NEventGroup       60\r
-\r
-/* Maximum object name length for each class (includes zero termination) */\r
-#define NameLenTask       15\r
-#define NameLenISR        15\r
-#define NameLenQueue      15\r
-#define NameLenSemaphore  15\r
-#define NameLenMutex      15\r
-#define NameLenTimer      15\r
-#define NameLenEventGroup 15\r
+#define NTask                  100\r
+#define NISR                   60\r
+#define NQueue                 60\r
+#define NSemaphore             60\r
+#define NMutex                 60\r
+#define NTimer                 200\r
+#define NEventGroup            60\r
 \r
 /******************************************************************************\r
- * TRACE_DESCRIPTION\r
+ * INCLUDE_MEMMANG_EVENTS\r
  *\r
- * Macro which should be defined as a string.\r
+ * Macro which should be defined as either zero (0) or one (1).\r
  *\r
- * This string is stored in the trace and displayed in Tracealyzer. Can be\r
- * used to store, e.g., system version or build date. This is also used to store\r
- * internal error messages from the recorder, which if occurs overwrites the\r
- * value defined here. This may be maximum 256 chars.\r
- *****************************************************************************/\r
-#define TRACE_DESCRIPTION "Tracealyzer Recorder Test Program"\r
-\r
-/******************************************************************************\r
- * TRACE_DESCRIPTION_MAX_LENGTH\r
+ * This controls if malloc and free calls should be traced. Set this to zero to\r
+ * exclude malloc/free calls, or one (1) to include such events in the trace.\r
  *\r
- * The maximum length (including zero termination) for the TRACE_DESCRIPTION\r
- * string. Since this string also is used for internal error messages from the \r
- * recorder do not make it too short, as this may truncate the error messages.\r
- * Default is 80. \r
- * Maximum allowed length is 256 - the trace will fail to load if longer.\r
+ * Default value is 1.\r
  *****************************************************************************/\r
-#define TRACE_DESCRIPTION_MAX_LENGTH 80\r
-\r
+#define INCLUDE_MEMMANG_EVENTS 1\r
 \r
 /******************************************************************************\r
- * TRACE_DATA_ALLOCATION\r
- *\r
- * This defines how to allocate the recorder data structure, i.e., using a \r
- * static declaration or using a dynamic allocation in runtime (malloc).\r
- *\r
- * Should be one of these two options:\r
- * - TRACE_DATA_ALLOCATION_STATIC (default)\r
- * - TRACE_DATA_ALLOCATION_DYNAMIC\r
+ * INCLUDE_USER_EVENTS\r
  *\r
- * Using static allocation has the benefits of compile-time errors if the buffer \r
- * is too large (too large constants in trcConfig.h) and no need to call the \r
- * initialization routine (xTraceInitTraceData).\r
+ * Macro which should be defined as either zero (0) or one (1).\r
  *\r
- * Using dynamic allocation may give more flexibility in some cases.\r
- *****************************************************************************/\r
-\r
-#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC\r
-\r
-\r
-/******************************************************************************\r
- * CONFIGURATION REGARDING WHAT CODE/FEATURES TO INCLUDE\r
- *****************************************************************************/\r
-\r
-/******************************************************************************\r
- * USE_TRACE_ASSERT\r
+ * If this is zero (0) the code for creating User Events is excluded to\r
+ * reduce code size. User Events are application-generated events, like\r
+ * "printf" but for the trace log instead of console output. User Events are\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
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 0.\r
+ * Default value is 1.\r
  *\r
- * If this is one (1), the TRACE_ASSERT macro will verify that a condition is \r
- * true. If the condition is false, vTraceError() will be called.\r
+ * Note that User Events are only displayed in Professional Edition.\r
  *****************************************************************************/\r
-#define USE_TRACE_ASSERT 1\r
+#define INCLUDE_USER_EVENTS 1\r
 \r
-/******************************************************************************\r
- * INCLUDE_FLOAT_SUPPORT\r
- *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
+/*****************************************************************************\r
+ * INCLUDE_ISR_TRACING\r
  *\r
- * If this is zero (0), all references to floating point values are removed,\r
- * in case floating point values are not supported by the platform used.\r
- * Floating point values are only used in vTracePrintF and its subroutines, to \r
- * store float (%f) or double (%lf) argments. \r
+ * Macro which should be defined as either zero (0) or one (1).\r
  *\r
- * Note: vTracePrintF can still be used with integer and string arguments in\r
- * either case.\r
- *****************************************************************************/\r
-#define INCLUDE_FLOAT_SUPPORT 0\r
-\r
-/******************************************************************************\r
- * INCLUDE_USER_EVENTS\r
+ * If this is zero (0), the code for recording Interrupt Service Routines is\r
+ * excluded to reduce code size.\r
  *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
+ * Default value is 1.\r
  *\r
- * If this is zero (0) the code for creating User Events is excluded to\r
- * reduce code size. User Events are application-generated events, like \r
- * "printf" but for the trace log instead of console output. User Events are \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 User Events are not displayed in FreeRTOS+Trace Free Edition.\r
+ * Note, if the kernel has no central interrupt dispatcher, recording ISRs\r
+ * require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd\r
+ * in your interrupt handlers.\r
  *****************************************************************************/\r
-#define INCLUDE_USER_EVENTS 1\r
+#define INCLUDE_ISR_TRACING 1\r
 \r
 /*****************************************************************************\r
  * INCLUDE_READY_EVENTS\r
  *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
+ * Macro which should be defined as either zero (0) or one (1).\r
  *\r
- * If this is zero (0), the code for recording Ready events is \r
- * excluded. Note, this will make it impossible to calculate the correct\r
- * response times.\r
+ * If one (1), events are recorded when tasks enter scheduling state "ready".\r
+ * This uses a lot of space in the event buffer, so excluding "ready events"\r
+ * will allow for longer traces. Including ready events however allows for\r
+ * showing the initial pending time before tasks enter the execution state, and\r
+ * for presenting accurate response times.\r
+ *\r
+ * Default value is 1.\r
  *****************************************************************************/\r
 #define INCLUDE_READY_EVENTS 1\r
 \r
 /*****************************************************************************\r
  * INCLUDE_NEW_TIME_EVENTS\r
  *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 0.\r
+ * Macro which should be defined as either zero (0) or one (1).\r
  *\r
- * If this is zero (1), events will be generated whenever the os clock is\r
+ * If this is zero (1), events will be generated whenever the OS clock is\r
  * increased.\r
+ *\r
+ * Default value is 0.\r
  *****************************************************************************/\r
-#define INCLUDE_NEW_TIME_EVENTS 0\r
+#define INCLUDE_NEW_TIME_EVENTS 1\r
 \r
-/*****************************************************************************\r
- * INCLUDE_ISR_TRACING\r
+/******************************************************************************\r
+ * INCLUDE_FLOAT_SUPPORT\r
  *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
+ * Macro which should be defined as either zero (0) or one (1).\r
  *\r
- * If this is zero (0), the code for recording Interrupt Service Routines is \r
- * excluded to reduce code size.\r
- * \r
- * Note, if the kernel has no central interrupt dispatcher, recording ISRs \r
- * require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd \r
- * in your interrupt handlers.\r
+ * If this is zero (0), all references to floating point values are removed,\r
+ * in case floating point values are not supported by the platform used.\r
+ * Floating point values are only used in vTracePrintF and its subroutines, to\r
+ * store float (%f) or double (%lf) arguments.\r
+ *\r
+ * vTracePrintF can be used with integer and string arguments in either case.\r
+ *\r
+ * Default value is 1.\r
  *****************************************************************************/\r
-#define INCLUDE_ISR_TRACING 1\r
+#define INCLUDE_FLOAT_SUPPORT 0\r
 \r
 /******************************************************************************\r
  * INCLUDE_OBJECT_DELETE\r
- * \r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
  *\r
- * This must be enabled (1) if tasks, queues or other \r
- * traced kernel objects are deleted at runtime. If no deletes are made, this \r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * This must be enabled (1) if tasks, queues or other\r
+ * traced kernel objects are deleted at runtime. If no deletes are made, this\r
  * can be set to 0 in order to exclude the delete-handling code.\r
+ *\r
+ * Default value is 1.\r
  *****************************************************************************/\r
 #define INCLUDE_OBJECT_DELETE 1\r
 \r
-/******************************************************************************\r
- * INCLUDE_MEMMANG_EVENTS\r
- * \r
- * Macro which should be defined as either zero (0) or one (1). \r
- * Default is 1.\r
+/*******************************************************************************\r
+ * SYMBOL_TABLE_SIZE\r
  *\r
- * This controls if malloc and free calls should be traced. Set this to zero to\r
- * exclude malloc/free calls from the tracing.\r
- *****************************************************************************/\r
-#define INCLUDE_MEMMANG_EVENTS 1\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the capacity of the symbol table, in bytes. This symbol table\r
+ * stores User Events labels and names of deleted tasks, queues, or other kernel\r
+ * objects. If you don't use User Events or delete any kernel\r
+ * objects you set this to a very low value. The minimum recommended value is 4.\r
+ * A size of zero (0) is not allowed since a zero-sized array may result in a\r
+ * 32-bit pointer, i.e., using 4 bytes rather than 0.\r
+ *\r
+ * Default value is 800.\r
+ ******************************************************************************/\r
+#define SYMBOL_TABLE_SIZE 5000\r
+\r
+#if (SYMBOL_TABLE_SIZE == 0)\r
+#error "SYMBOL_TABLE_SIZE may not be zero!"\r
+#endif\r
 \r
 /******************************************************************************\r
- * CONFIGURATION RELATED TO BEHAVIOR\r
+ * NameLenTask, NameLenQueue, ...\r
+ *\r
+ * Macros that specify the maximum lengths (number of characters) for names of\r
+ * kernel objects, such as tasks and queues. If longer names are used, they will\r
+ * be truncated when stored in the recorder.\r
  *****************************************************************************/\r
+#define NameLenTask                    15\r
+#define NameLenISR                     15\r
+#define NameLenQueue           15\r
+#define NameLenSemaphore       15\r
+#define NameLenMutex           15\r
+#define NameLenTimer           15\r
+#define NameLenEventGroup      15\r
 \r
 /******************************************************************************\r
- * TRACE_RECORDER_STORE_MODE\r
+ * TRACE_DATA_ALLOCATION\r
  *\r
- * Macro which should be defined as one of:\r
- * - TRACE_STORE_MODE_RING_BUFFER\r
- * - TRACE_STORE_MODE_STOP_WHEN_FULL\r
- * Default is TRACE_STORE_MODE_RING_BUFFER.\r
+ * This defines how to allocate the recorder data structure, i.e., using a\r
+ * static declaration or using a dynamic allocation in runtime (malloc).\r
+ *\r
+ * Should be one of these two options:\r
+ * - TRACE_DATA_ALLOCATION_STATIC (default)\r
+ * - TRACE_DATA_ALLOCATION_DYNAMIC\r
+ *\r
+ * Using static allocation has the benefits of compile-time errors if the buffer\r
+ * is too large (too large constants in trcConfig.h) and no need to call the\r
+ * initialization routine (xTraceInitTraceData).\r
  *\r
- * With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the events are \r
- * stored in a ring buffer, i.e., where the oldest events are overwritten when \r
- * the buffer becomes full. This allows you to get the last events leading up \r
- * to an interesting state, e.g., an error, without having a large trace buffer\r
- * for string the whole run since startup. In this mode, the recorder can run\r
- * "forever" as the buffer never gets full, i.e., in the sense that it always\r
- * has room for more events.\r
- *\r
- * To fetch the trace in mode TRACE_STORE_MODE_RING_BUFFER, you need to first halt the\r
- * system using your debugger and then do a RAM dump, or to explicitly stop the\r
- * recorder using vTraceStop() and then store/upload the trace data using a\r
- * task that you need to provide yourself. The trace data is found in the struct\r
- * RecorderData, initialized in trcBase.c.\r
- *\r
- * Note that, if you upload the trace using a RAM dump, i.e., when the system is \r
- * halted on a breakpoint or by a debugger command, there is no need to stop the \r
- * recorder first.\r
- *\r
- * When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the recording is\r
- * stopped when the buffer becomes full. When the recorder stops itself this way\r
- * vTracePortEnd() is called which allows for custom actions, such as triggering\r
- * a task that stores the trace buffer, i.e., in case taking a RAM dump\r
- * using an on-chip debugger is not possible. In the Windows port, vTracePortEnd\r
- * saves the trace to file directly, but this is not recommended in a real-time\r
- * system since the scheduler is blocked during the processing of vTracePortEnd.\r
+ * Using dynamic allocation may give more flexibility in some cases.\r
  *****************************************************************************/\r
+#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC\r
+\r
 \r
-#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER\r
 \r
 /******************************************************************************\r
- * STOP_AFTER_N_EVENTS\r
+ *** ADVANCED SETTINGS ********************************************************\r
+ ******************************************************************************\r
+ * The remaining settings are not necessary to modify but allows for optimizing\r
+ * the recorder setup for your specific needs, e.g., to exclude events that you\r
+ * are not interested in, in order to get longer traces.\r
+ *****************************************************************************/\r
+\r
+/******************************************************************************\r
+* HEAP_SIZE_BELOW_16M\r
+*\r
+* An integer constant that can be used to reduce the buffer usage of memory\r
+* allocation events (malloc/free). This value should be 1 if the heap size is\r
+* below 16 MB (2^24 byte), and you can live with reported addresses showing the\r
+* lower 24 bits only. If 0, you get the full 32-bit addresses.\r
+*\r
+* Default value is 0.\r
+******************************************************************************/\r
+#define HEAP_SIZE_BELOW_16M 0\r
+\r
+/******************************************************************************\r
+ * USE_LINKER_PRAGMA\r
  *\r
- * Macro which should be defined as an integer value, or not defined.\r
- * Default is -1\r
+ * Macro which should be defined as an integer value, default is 0.\r
  *\r
- * STOP_AFTER_N_EVENTS is intended for tests of the ring buffer mode (when\r
- * RECORDER_STORE_MODE is STORE_MODE_RING_BUFFER). It stops the recording when\r
- * the specified number of events has been observed. This value can be larger\r
- * than the buffer size, to allow for test of the "wrapping around" that occurs\r
- * in ring buffer mode . A negative value (or no definition of this macro)\r
- * disables this feature.\r
- *****************************************************************************/\r
-#define STOP_AFTER_N_EVENTS -1\r
+ * If this is 1, the header file "recorderdata_linker_pragma.h" is included just\r
+ * before the declaration of RecorderData (in trcBase.c), i.e., the trace data\r
+ * structure. This allows the user to specify a pragma with linker options.\r
+ *\r
+ * Example (for IAR Embedded Workbench and NXP LPC17xx):\r
+ * #pragma location="AHB_RAM_MEMORY"\r
+ *\r
+ * This example instructs the IAR linker to place RecorderData in another RAM\r
+ * bank, the AHB RAM. This can also be used for other compilers with a similar\r
+ * pragmas for linker options.\r
+ *\r
+ * Note that this only applies if using static allocation, see below.\r
+ ******************************************************************************/\r
+#define USE_LINKER_PRAGMA 0\r
 \r
 /******************************************************************************\r
  * USE_IMPLICIT_IFE_RULES\r
  *\r
- * Macro which should be defined as either zero (0) or one (1). \r
+ * Macro which should be defined as either zero (0) or one (1).\r
  * Default is 1.\r
  *\r
- * ### Instance Finish Events (IFE) ###\r
- *\r
- * For tasks with "infinite" main loops (non-terminating tasks), the concept\r
- * of a task instance has no clear definition, it is an application-specific\r
- * thing. Tracealyzer allows you to define Instance Finish Events (IFEs),\r
- * which marks the point in a cyclic task when the "task instance" ends.\r
- * The IFE is a blocking kernel call, typically in the main loop of a task\r
- * which typically reads a message queue, waits for a semaphore or performs\r
- * an explicit delay.\r
- *\r
- * If USE_IMPLICIT_IFE_RULES is one (1), the kernel macros (trcKernelPort.h)\r
- * will define what kernel calls are considered by default to be IFEs.\r
- *\r
- * However, Implicit IFEs only applies to blocking kernel calls. If a\r
- * service reads a message without blocking, it does not create a new\r
- * instance since no blocking occurred.\r
- *\r
- * Moreover, the actual IFE might sometimes be another blocking call. We \r
- * therefore allow for user-defined Explicit IFEs by calling\r
- *\r
- *     vTraceTaskInstanceIsFinished()\r
- *\r
- * right before the kernel call considered as IFE. This does not create an\r
- * additional event but instead stores the service code and object handle\r
- * of the IFE call as properties of the task.\r
- *\r
- * If using Explicit IFEs and the task also calls an Implicit IFE, this may \r
- * result in additional incorrect task instances.\r
- * This is solved by disabling the Implicit IFEs for the task, by adding\r
- * a call to\r
- * \r
- *     vTraceTaskSkipDefaultInstanceFinishedEvents()\r
- * \r
- * in the very beginning of that task. This allows you to combine Explicit IFEs\r
- * for some tasks with Implicit IFEs for the rest of the tasks, if\r
- * USE_IMPLICIT_IFE_RULES is 1.\r
- *\r
- * By setting USE_IMPLICIT_IFE_RULES to zero (0), the implicit IFEs are disabled\r
- * for all tasks. Tasks will then be considered to have a single instance only, \r
- * covering all execution fragments, unless you define an explicit IFE in each\r
- * task by calling vTraceTaskInstanceIsFinished before the blocking call.\r
+ * Tracealyzer groups the events into actor instances, based on context-switches\r
+ * and a definition of "Instance Finish Events", or IFEs. These are kernel calls\r
+ * considered to be the last event in a task instance. Some kernel calls are\r
+ * considered IFEs by default (e.g., delay functions), but it is also possible\r
+ * to specify this individually for each task (see vTraceTaskInstanceFinish).\r
+ *\r
+ * If USE_IMPLICIT_IFE_RULES is one (1), the default IFEs will be enabled, which\r
+ * gives a "typical" grouping of events into instances. You can combine this\r
+ * with calls to vTraceTaskInstanceFinish for specific tasks.\r
+ *\r
+ * If USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFEs are disabled and all\r
+ * events withing each task is then shown as a single instance, unless  you call\r
+ * vTraceTaskInstanceFinish() at suitable locations to mark the IFEs.\r
  *****************************************************************************/\r
 #define USE_IMPLICIT_IFE_RULES 1\r
 \r
-\r
 /******************************************************************************\r
  * USE_16BIT_OBJECT_HANDLES\r
  *\r
  * Macro which should be defined as either zero (0) or one (1).\r
- * Default is 0.\r
  *\r
- * If set to 0 (zero), the recorder uses 8-bit handles to identify kernel \r
+ * If set to 0 (zero), the recorder uses 8-bit handles to identify kernel\r
  * objects such as tasks and queues. This limits the supported number of\r
  * concurrently active objects to 255 of each type (object class).\r
  *\r
- * If set to 1 (one), the recorder uses 16-bit handles to identify kernel \r
+ * If set to 1 (one), the recorder uses 16-bit handles to identify kernel\r
  * objects such as tasks and queues. This limits the supported number of\r
  * concurrent objects to 65535 of each type (object class). However, since the\r
  * object property table is limited to 64 KB, the practical limit is about\r
- * 3000 objects in total. \r
- * \r
- * NOTE: An object with a high ID (> 255) will generate an extra event \r
- * (= 4 byte) in the event buffer. \r
- * \r
- * NOTE: Some internal tables in the recorder gets larger when using 16-bit \r
- * handles. The additional RAM usage is 5-10 byte plus 1 byte per kernel object\r
- *, i.e., task, queue, semaphore, mutex, etc.\r
+ * 3000 objects in total.\r
+ *\r
+ * Default is 0.\r
+ *\r
+ * NOTE: An object with handle above 255 will use an extra 4-byte record in\r
+ * the event buffer whenever referenced. Moreover, some internal tables in the\r
+ * recorder gets larger when using 16-bit handles. The additional RAM usage is\r
+ * 5-10 byte plus 1 byte per kernel object i.e., task, queue, mutex, etc.\r
  *****************************************************************************/\r
 #define USE_16BIT_OBJECT_HANDLES 0\r
 \r
-/****** Port Name ******************** Code ** Official ** OS Platform ******\r
-* PORT_APPLICATION_DEFINED               -2     -           -                 \r
-* PORT_NOT_SET                           -1     -           -                 \r
-* PORT_HWIndependent                     0      Yes         Any               \r
-* PORT_Win32                             1      Yes         FreeRTOS Win32\r
-* PORT_Atmel_AT91SAM7                    2      No          Any               \r
-* PORT_Atmel_UC3A0                       3      No          Any               \r
-* PORT_ARM_CortexM                       4      Yes         Any               \r
-* PORT_Renesas_RX600                     5      Yes         Any               \r
-* PORT_Microchip_dsPIC_AND_PIC24         6      Yes         Any               \r
-* PORT_TEXAS_INSTRUMENTS_TMS570          7      No          Any               \r
-* PORT_TEXAS_INSTRUMENTS_MSP430          8      No          Any               \r
-* PORT_MICROCHIP_PIC32                   9      No          Any               \r
-* PORT_XILINX_PPC405                     10     No          FreeRTOS          \r
-* PORT_XILINX_PPC440                     11     No          FreeRTOS          \r
-* PORT_XILINX_MICROBLAZE                 12     No          Any               \r
-* PORT_NXP_LPC210X                       13     No          Any               \r
-*****************************************************************************/\r
-#define SELECTED_PORT PORT_Win32\r
-\r
-#if (SELECTED_PORT == PORT_NOT_SET)\r
-#error "You need to define SELECTED_PORT here!"\r
-#endif\r
-\r
 /******************************************************************************\r
-* USE_PRIMASK_CS (for Cortex M devices only)\r
-*\r
-* An integer constant that selects between two options for the critical\r
-* sections of the recorder library.\r
+ * USE_TRACE_ASSERT\r
  *\r
-*   0: The default FreeRTOS critical section (BASEPRI) - default setting\r
-*   1: Always disable ALL interrupts (using PRIMASK)\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ * Default is 1.\r
  *\r
-* Option 0 uses the standard FreeRTOS macros for critical sections.\r
-* However, on Cortex-M devices they only disable interrupts with priorities \r
-* below a certain configurable level, while higher priority ISRs remain active.\r
-* Such high-priority ISRs may not use the recorder functions in this mode.\r
-*\r
-* Option 1 allows you to safely call the recorder from any ISR, independent of \r
-* the interrupt priority. This mode may however cause higher IRQ latencies\r
-* (some microseconds) since ALL configurable interrupts are disabled during \r
-* the recorder's critical sections in this mode, using the PRIMASK register.\r
+ * If this is one (1), the TRACE_ASSERT macro will verify that a condition is\r
+ * true. If the condition is false, vTraceError() will be called.\r
+ * This is used on several places in the recorder code for sanity checks on\r
+ * parameters. Can be switched off to reduce CPU usage of the tracing.\r
+ *****************************************************************************/\r
+#define USE_TRACE_ASSERT 1\r
+\r
+/*******************************************************************************\r
+ * USE_SEPARATE_USER_EVENT_BUFFER\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ * Default is zero (0).\r
+ *\r
+ * This enables and disables the use of the separate user event buffer. Using\r
+ * this separate buffer has the benefit of not overwriting the user events with\r
+ * kernel events (usually generated at a much higher rate), i.e., when using\r
+ * ring-buffer mode.\r
+ *\r
+ * Note: When using the separate user event buffer, you may get an artificial\r
+ * task instance named "Unknown actor". This is added as a placeholder when the\r
+ * user event history is longer than the task scheduling history.\r
  ******************************************************************************/\r
-#define USE_PRIMASK_CS 0\r
+#define USE_SEPARATE_USER_EVENT_BUFFER 0\r
 \r
-/******************************************************************************\r
-* HEAP_SIZE_BELOW_16M\r
-*\r
-* An integer constant that can be used to reduce the buffer usage of memory\r
-* allocation events (malloc/free). This value should be 1 if the heap size is \r
-* below 16 MB (2^24 byte), and you can live with addresses truncated to the \r
-* lower 24 bit. Otherwise set it to 0 to get the full 32-bit addresses.\r
-******************************************************************************/\r
-#define HEAP_SIZE_BELOW_16M 0\r
+/*******************************************************************************\r
+ * USER_EVENT_BUFFER_SIZE\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the capacity of the user event buffer, in number of slots.\r
+ * A single user event can use between 1 and X slots, depending on the data.\r
+ *\r
+ * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
+ ******************************************************************************/\r
+#define USER_EVENT_BUFFER_SIZE 10\r
+\r
+/*******************************************************************************\r
+ * USER_EVENT_CHANNELS\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the number of allowed user event channels.\r
+ *\r
+ * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
+ ******************************************************************************/\r
+#define CHANNEL_FORMAT_PAIRS 32\r
 \r
 #endif\r
 \r
index 657c0305a528fd3bcc5e40aa0394ba53eaea3acc..98305caf6fb220ba2bad5ff0a34ada5adf1ff837 100644 (file)
@@ -66,9 +66,9 @@
 /******************************************************************************\r
  * This project provides two demo applications.  A simple blinky style project,\r
  * and a more comprehensive test and demo application.  The\r
- * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between the two.  \r
- * The simply blinky demo is implemented and described in main_blinky.c.  The \r
- * more comprehensive test and demo application is implemented and described in \r
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between the two.\r
+ * The simply blinky demo is implemented and described in main_blinky.c.  The\r
+ * more comprehensive test and demo application is implemented and described in\r
  * main_full.c.\r
  *\r
  * This file implements the code that is not demo specific, including the\r
@@ -80,9 +80,9 @@
  * application.  It is provided as a convenient development and demonstration\r
  * test bed only.  This was tested using Windows XP on a dual core laptop.\r
  *\r
- * Windows will not be running the FreeRTOS simulator threads continuously, so \r
- * the timing information in the FreeRTOS+Trace logs have no meaningful units.  \r
- * See the documentation page for the Windows simulator for an explanation of \r
+ * Windows will not be running the FreeRTOS simulator threads continuously, so\r
+ * the timing information in the FreeRTOS+Trace logs have no meaningful units.\r
+ * See the documentation page for the Windows simulator for an explanation of\r
  * the slow timing:\r
  * http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html\r
  * - READ THE WEB DOCUMENTATION FOR THIS PORT FOR MORE INFORMATION ON USING IT -\r
 \r
 /* This project provides two demo applications.  A simple blinky style project,\r
 and a more comprehensive test and demo application.  The\r
-mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between the two.  \r
-The simply blinky demo is implemented and described in main_blinky.c.  The more \r
-comprehensive test and demo application is implemented and described in \r
+mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between the two.\r
+The simply blinky demo is implemented and described in main_blinky.c.  The more\r
+comprehensive test and demo application is implemented and described in\r
 main_full.c. */\r
-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY     1\r
+#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY     0\r
+\r
+/* This demo uses heap_5.c, and these constants define the sizes of the regions\r
+that make up the total heap.  This is only done to provide an example of heap_5\r
+being used as this demo could easily create one large heap region instead of\r
+multiple smaller heap regions - in which case heap_4.c would be the more\r
+appropriate choice. */\r
+#define mainREGION_1_SIZE      3001\r
+#define mainREGION_2_SIZE      18105\r
+#define mainREGION_3_SIZE      1107\r
 \r
 /*\r
  * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.\r
@@ -114,15 +123,28 @@ main_full.c. */
 extern void main_blinky( void );\r
 extern void main_full( void );\r
 \r
-/* Some of the RTOS hook (callback) functions only need special processing when\r
-the full demo is being used.  The simply blinky demo has no special requirements,\r
-so these functions are called from the hook functions defined in this file, but\r
-are defined in main_full.c. */\r
+/*\r
+ * Some of the RTOS hook (callback) functions only need special processing when\r
+ * the full demo is being used.  The simply blinky demo has no special\r
+ * requirements, so these functions are called from the hook functions defined\r
+ * in this file, but are defined in main_full.c.\r
+ */\r
 void vFullDemoTickHookFunction( void );\r
 void vFullDemoIdleFunction( void );\r
 \r
-/* Prototypes for the standard FreeRTOS callback/hook functions implemented\r
-within this file. */\r
+/*\r
+ * This demo uses heap_5.c, so start by defining some heap regions.  This is\r
+ * only done to provide an example as this demo could easily create one large\r
+ * heap region instead of multiple smaller heap regions - in which case heap_4.c\r
+ * would be the more appropriate choice.  No initialisation is required when\r
+ * heap_4.c is used.\r
+ */\r
+static void  prvInitialiseHeap( void );\r
+\r
+/*\r
+ * Prototypes for the standard FreeRTOS callback/hook functions implemented\r
+ * within this file.\r
+ */\r
 void vApplicationMallocFailedHook( void );\r
 void vApplicationIdleHook( void );\r
 void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );\r
@@ -145,6 +167,13 @@ static portBASE_TYPE xTraceRunning = pdTRUE;
 \r
 int main( void )\r
 {\r
+       /* This demo uses heap_5.c, so start by defining some heap regions.  This\r
+       is only done to provide an example as this demo could easily create one\r
+       large heap region instead of multiple smaller heap regions - in which case\r
+       heap_4.c would be the more appropriate choice.  No initialisation is\r
+       required when heap_4.c is used. */\r
+       prvInitialiseHeap();\r
+\r
        /* Initialise the trace recorder and create the label used to post user\r
        events to the trace recording on each tick interrupt. */\r
        vTraceInitTraceData();\r
@@ -251,10 +280,10 @@ void vApplicationTickHook( void )
        }\r
        #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */\r
 \r
-       /* Write a user event to the trace log.  \r
+       /* Write a user event to the trace log.\r
        Note tick events will not appear in the trace recording with regular period\r
        because this project runs in a Windows simulator, and does not therefore\r
-       exhibit deterministic behaviour.  Windows will run the simulator in \r
+       exhibit deterministic behaviour.  Windows will run the simulator in\r
        bursts. */\r
        vTraceUserEvent( xTickTraceUserEvent );\r
 }\r
@@ -263,26 +292,35 @@ void vApplicationTickHook( void )
 void vAssertCalled( unsigned long ulLine, const char * const pcFileName )\r
 {\r
 static portBASE_TYPE xPrinted = pdFALSE;\r
+volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;\r
 \r
        /* Parameters are not used. */\r
        ( void ) ulLine;\r
        ( void ) pcFileName;\r
 \r
-       taskDISABLE_INTERRUPTS();\r
-       __asm volatile( "int $3" );\r
-\r
-       /* Stop the trace recording. */\r
-       if( xPrinted == pdFALSE )\r
+       taskENTER_CRITICAL();\r
        {\r
-               xPrinted = pdTRUE;\r
-               if( xTraceRunning == pdTRUE )\r
+               /* Stop the trace recording. */\r
+               if( xPrinted == pdFALSE )\r
+               {\r
+                       xPrinted = pdTRUE;\r
+                       if( xTraceRunning == pdTRUE )\r
+                       {\r
+                               vTraceStop();\r
+                               prvSaveTraceFile();\r
+                       }\r
+               }\r
+\r
+               /* You can step out of this function to debug the assertion by using\r
+               the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero\r
+               value. */\r
+               while( ulSetToNonZeroInDebuggerToContinue == 0 )\r
                {\r
-               vTraceStop();\r
-               prvSaveTraceFile();\r
+                       __asm volatile( "NOP" );\r
+                       __asm volatile( "NOP" );\r
                }\r
        }\r
-\r
-       taskENABLE_INTERRUPTS();\r
+       taskEXIT_CRITICAL();\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -303,3 +341,34 @@ FILE* pxOutputFile;
                printf( "\r\nFailed to create trace dump file\r\n" );\r
        }\r
 }\r
+/*-----------------------------------------------------------*/\r
+\r
+static void  prvInitialiseHeap( void )\r
+{\r
+/* This demo uses heap_5.c, so start by defining some heap regions.  This is\r
+only done to provide an example as this demo could easily create one large heap\r
+region instead of multiple smaller heap regions - in which case heap_4.c would\r
+be the more appropriate choice.  No initialisation is required when heap_4.c is\r
+used.  The xHeapRegions structure requires the regions to be defined in order,\r
+so this just creates one big array, then populates the structure with offsets\r
+into the array - with gaps in between and messy alignment just for test\r
+purposes. */\r
+static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];\r
+volatile uint32_t ulAdditionalOffset = 19; /* Just to prevent 'condition is always true' warnings in configASSERT(). */\r
+const HeapRegion_t xHeapRegions[] =\r
+{\r
+       /* Start address with dummy offsets                                             Size */\r
+       { ucHeap + 1,                                                                                   mainREGION_1_SIZE },\r
+       { ucHeap + 15 + mainREGION_1_SIZE,                                              mainREGION_2_SIZE },\r
+       { ucHeap + 19 + mainREGION_1_SIZE + mainREGION_2_SIZE,  mainREGION_3_SIZE },\r
+       { NULL, 0 }\r
+};\r
+\r
+       /* Sanity check that the sizes and offsets defined actually fit into the\r
+       array. */\r
+       configASSERT( ( ulAdditionalOffset + mainREGION_1_SIZE + mainREGION_2_SIZE + mainREGION_3_SIZE ) < configTOTAL_HEAP_SIZE );\r
+\r
+       vPortDefineHeapRegions( xHeapRegions );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
index fa71ac8ec9f9d328baf87961affa27eebbaf9ee9..4a64748d7dec00bf2088e0649671d54b6c5562c6 100644 (file)
@@ -190,6 +190,7 @@ static void prvQueueSendTask( void *pvParameters )
 {\r
 TickType_t xNextWakeTime;\r
 const unsigned long ulValueToSend = 100UL;\r
+const TickType_t xBlockTime = pdMS_TO_TICKS( mainQUEUE_SEND_FREQUENCY_MS );\r
 \r
        /* Remove compiler warning in the case that configASSERT() is not\r
        defined. */\r
@@ -207,7 +208,7 @@ const unsigned long ulValueToSend = 100UL;
                The block time is specified in ticks, the constant used converts ticks\r
                to ms.  While in the Blocked state this task will not consume any CPU\r
                time. */\r
-               vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );\r
+               vTaskDelayUntil( &xNextWakeTime, xBlockTime );\r
 \r
                /* Send to the queue - causing the queue receive task to unblock and\r
                toggle the LED.  0 is used as the block time so the sending operation\r
index aa27e22ac4461c8910461e5f32cf065e7a3521f2..0bc7d12f8dfa4e571f2b0ef112604b5316636a30 100644 (file)
 #include "QueueSet.h"\r
 #include "QueueOverwrite.h"\r
 #include "EventGroupsDemo.h"\r
+#include "IntSemTest.h"\r
+#include "TaskNotify.h"\r
 \r
 /* Priorities at which the tasks are created. */\r
 #define mainCHECK_TASK_PRIORITY                        ( configMAX_PRIORITIES - 2 )\r
@@ -162,7 +164,7 @@ static void prvTestTask( void *pvParameters );
 static void prvDemonstrateTaskStateAndHandleGetFunctions( void );\r
 \r
 /*\r
- * Called from the idle task hook function to demonstrate the use of \r
+ * Called from the idle task hook function to demonstrate the use of\r
  * xTimerPendFunctionCall() as xTimerPendFunctionCall() is not demonstrated by\r
  * any of the standard demo tasks.\r
  */\r
@@ -195,6 +197,7 @@ int main_full( void )
        xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
 \r
        /* Create the standard demo tasks. */\r
+       vStartTaskNotifyTask();\r
        vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
        vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
        vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
@@ -209,6 +212,7 @@ int main_full( void )
        vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );\r
        xTaskCreate( prvDemoQueueSpaceFunctions, "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
        vStartEventGroupTasks();\r
+       vStartInterruptSemaphoreTasks();\r
 \r
        #if( configUSE_PREEMPTION != 0  )\r
        {\r
@@ -263,7 +267,16 @@ const TickType_t xCycleFrequency = 2500 / portTICK_PERIOD_MS;
                }\r
                #endif\r
 \r
-               if( xAreEventGroupTasksStillRunning() != pdTRUE )\r
+               if( xAreTaskNotificationTasksStillRunning() != pdTRUE )\r
+               {\r
+                       pcStatusMessage = "Error:  Notification";\r
+               }\r
+\r
+               if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )\r
+               {\r
+                       pcStatusMessage = "Error: IntSem";\r
+               }\r
+               else if( xAreEventGroupTasksStillRunning() != pdTRUE )\r
                {\r
                        pcStatusMessage = "Error: EventGroup";\r
                }\r
@@ -374,7 +387,7 @@ void *pvAllocated;
                xMutexToDelete = NULL;\r
        }\r
 \r
-       /* Exercise heap_4 a bit.  The malloc failed hook will trap failed\r
+       /* Exercise heap_5 a bit.  The malloc failed hook will trap failed\r
        allocations so there is no need to test here. */\r
        pvAllocated = pvPortMalloc( ( rand() % 100 ) + 1 );\r
        vPortFree( pvAllocated );\r
@@ -402,6 +415,12 @@ void vFullDemoTickHookFunction( void )
 \r
        /* Exercise event groups from interrupts. */\r
        vPeriodicEventGroupsProcessing();\r
+\r
+       /* Exercise giving mutexes from an interrupt. */\r
+       vInterruptSemaphorePeriodicTest();\r
+\r
+       /* Exercise using task notifications from an interrupt. */\r
+       xNotifyTaskFromISR();\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
diff --git a/FreeRTOS/Demo/links_to_doc_pages_for_these_demos.url b/FreeRTOS/Demo/links_to_doc_pages_for_these_demos.url
new file mode 100644 (file)
index 0000000..1ae5cac
--- /dev/null
@@ -0,0 +1,5 @@
+[{000214A0-0000-0000-C000-000000000046}]\r
+Prop3=19,2\r
+[InternetShortcut]\r
+URL=http://www.freertos.org/a00090.html\r
+IDList=\r
index 813c257ccaf4fce688be6717452a0b313b326c1d..8a744ffd637726f632f00fb5819eee2bbcbcef1b 100644 (file)
@@ -1,3 +1,6 @@
+Links to a documentation page for each demo are provided on the following\r
+URL: http://www.freertos.org/a00090.html\r
+\r
 Each RTOS port has a demo application to demonstrate it's use.\r
 \r
 + The Demo/Common directory contains the demo application files as described on \r
index 536423100c42c80e2e46306c3eeedb11e71bbfe9..423f3d18188c5fc71b0b700b8b4c9e03a33e615e 100644 (file)
@@ -35,8 +35,10 @@ work under terms of your choice, provided that
 \r
   + The combined work is not itself an RTOS, scheduler, kernel or related product.\r
 \r
-  + The independent modules add significant and primary functionality to FreeRTOS\r
-  and do not merely extend the existing functionality already present in FreeRTOS.\r
+  + The independent modules add significant and primary functionality that is\r
+  unrelated to multitasking, intertask communication or intertask signalling -\r
+  and therefore do not merely extend the functionality already present in\r
+  FreeRTOS.\r
 \r
 Clause 2:\r
 \r
index 25017ad6f6d14bb924518e6e72cd187d97555f2c..f82a96d02866ed318dc8e0225919392c997af900 100644 (file)
@@ -276,6 +276,7 @@ BaseType_t xTimeoutOccurred = pdFALSE;
 \r
        /* Check the user is not attempting to wait on the bits used by the kernel\r
        itself, and that at least one bit is being requested. */\r
+       configASSERT( xEventGroup );\r
        configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 );\r
        configASSERT( uxBitsToWaitFor != 0 );\r
        #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )\r
@@ -421,6 +422,7 @@ EventBits_t uxReturn;
 \r
        /* Check the user is not attempting to clear the bits used by the kernel\r
        itself. */\r
+       configASSERT( xEventGroup );\r
        configASSERT( ( uxBitsToClear & eventEVENT_BITS_CONTROL_BYTES ) == 0 );\r
 \r
        taskENTER_CRITICAL();\r
@@ -482,6 +484,7 @@ BaseType_t xMatchFound = pdFALSE;
 \r
        /* Check the user is not attempting to set the bits used by the kernel\r
        itself. */\r
+       configASSERT( xEventGroup );\r
        configASSERT( ( uxBitsToSet & eventEVENT_BITS_CONTROL_BYTES ) == 0 );\r
 \r
        pxList = &( pxEventBits->xTasksWaitingForBits );\r
index 5b9f031079c05d915c6bba2b561f9eff69e0030b..7fa5d5d103d71c964ce88f2bc71ea96e8bde2a40 100644 (file)
@@ -723,6 +723,10 @@ extern "C" {
        #define configAPPLICATION_ALLOCATED_HEAP 0\r
 #endif\r
 \r
+#ifndef configUSE_TASK_NOTIFICATIONS\r
+       #define configUSE_TASK_NOTIFICATIONS 1\r
+#endif\r
+\r
 /* Definitions to allow backward compatibility with FreeRTOS versions prior to\r
 V8 if desired. */\r
 #ifndef configENABLE_BACKWARD_COMPATIBILITY\r
diff --git a/FreeRTOS/Source/include/deprecated_definitions.h b/FreeRTOS/Source/include/deprecated_definitions.h
new file mode 100644 (file)
index 0000000..f9cd441
--- /dev/null
@@ -0,0 +1,317 @@
+/*\r
+    FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that has become a de facto standard.             *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly and support the FreeRTOS         *\r
+     *    project by purchasing a FreeRTOS tutorial book, reference          *\r
+     *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
+     *                                                                       *\r
+     *    Thank you!                                                         *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available from the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    1 tab == 4 spaces!\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    Having a problem?  Start by reading the FAQ "My application does   *\r
+     *    not run, what could be wrong?"                                     *\r
+     *                                                                       *\r
+     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+    license and Real Time Engineers Ltd. contact details.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+#ifndef DEPRECATED_DEFINITIONS_H\r
+#define DEPRECATED_DEFINITIONS_H\r
+\r
+\r
+/* Each FreeRTOS port has a unique portmacro.h header file.  Originally a\r
+pre-processor definition was used to ensure the pre-processor found the correct\r
+portmacro.h file for the port being used.  That scheme was deprecated in favour\r
+of setting the compiler's include path such that it found the correct\r
+portmacro.h file - removing the need for the constant and allowing the\r
+portmacro.h file to be located anywhere in relation to the port being used.  The\r
+definitions below remain in the code for backward compatibility only.  New\r
+projects should not use them. */\r
+\r
+#ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT\r
+       #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"\r
+       typedef void ( __interrupt __far *pxISR )();\r
+#endif\r
+\r
+#ifdef OPEN_WATCOM_FLASH_LITE_186_PORT\r
+       #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"\r
+       typedef void ( __interrupt __far *pxISR )();\r
+#endif\r
+\r
+#ifdef GCC_MEGA_AVR\r
+       #include "../portable/GCC/ATMega323/portmacro.h"\r
+#endif\r
+\r
+#ifdef IAR_MEGA_AVR\r
+       #include "../portable/IAR/ATMega323/portmacro.h"\r
+#endif\r
+\r
+#ifdef MPLAB_PIC24_PORT\r
+       #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"\r
+#endif\r
+\r
+#ifdef MPLAB_DSPIC_PORT\r
+       #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"\r
+#endif\r
+\r
+#ifdef MPLAB_PIC18F_PORT\r
+       #include "../../Source/portable/MPLAB/PIC18F/portmacro.h"\r
+#endif\r
+\r
+#ifdef MPLAB_PIC32MX_PORT\r
+       #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h"\r
+#endif\r
+\r
+#ifdef _FEDPICC\r
+       #include "libFreeRTOS/Include/portmacro.h"\r
+#endif\r
+\r
+#ifdef SDCC_CYGNAL\r
+       #include "../../Source/portable/SDCC/Cygnal/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_ARM7\r
+       #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_ARM7_ECLIPSE\r
+       #include "portmacro.h"\r
+#endif\r
+\r
+#ifdef ROWLEY_LPC23xx\r
+       #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"\r
+#endif\r
+\r
+#ifdef IAR_MSP430\r
+       #include "..\..\Source\portable\IAR\MSP430\portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_MSP430\r
+       #include "../../Source/portable/GCC/MSP430F449/portmacro.h"\r
+#endif\r
+\r
+#ifdef ROWLEY_MSP430\r
+       #include "../../Source/portable/Rowley/MSP430F449/portmacro.h"\r
+#endif\r
+\r
+#ifdef ARM7_LPC21xx_KEIL_RVDS\r
+       #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"\r
+#endif\r
+\r
+#ifdef SAM7_GCC\r
+       #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"\r
+#endif\r
+\r
+#ifdef SAM7_IAR\r
+       #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"\r
+#endif\r
+\r
+#ifdef SAM9XE_IAR\r
+       #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"\r
+#endif\r
+\r
+#ifdef LPC2000_IAR\r
+       #include "..\..\Source\portable\IAR\LPC2000\portmacro.h"\r
+#endif\r
+\r
+#ifdef STR71X_IAR\r
+       #include "..\..\Source\portable\IAR\STR71x\portmacro.h"\r
+#endif\r
+\r
+#ifdef STR75X_IAR\r
+       #include "..\..\Source\portable\IAR\STR75x\portmacro.h"\r
+#endif\r
+\r
+#ifdef STR75X_GCC\r
+       #include "..\..\Source\portable\GCC\STR75x\portmacro.h"\r
+#endif\r
+\r
+#ifdef STR91X_IAR\r
+       #include "..\..\Source\portable\IAR\STR91x\portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_H8S\r
+       #include "../../Source/portable/GCC/H8S2329/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_AT91FR40008\r
+       #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"\r
+#endif\r
+\r
+#ifdef RVDS_ARMCM3_LM3S102\r
+       #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_ARMCM3_LM3S102\r
+       #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_ARMCM3\r
+       #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"\r
+#endif\r
+\r
+#ifdef IAR_ARM_CM3\r
+       #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"\r
+#endif\r
+\r
+#ifdef IAR_ARMCM3_LM\r
+       #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"\r
+#endif\r
+\r
+#ifdef HCS12_CODE_WARRIOR\r
+       #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"\r
+#endif\r
+\r
+#ifdef MICROBLAZE_GCC\r
+       #include "../../Source/portable/GCC/MicroBlaze/portmacro.h"\r
+#endif\r
+\r
+#ifdef TERN_EE\r
+       #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_HCS12\r
+       #include "../../Source/portable/GCC/HCS12/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_MCF5235\r
+    #include "../../Source/portable/GCC/MCF5235/portmacro.h"\r
+#endif\r
+\r
+#ifdef COLDFIRE_V2_GCC\r
+       #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"\r
+#endif\r
+\r
+#ifdef COLDFIRE_V2_CODEWARRIOR\r
+       #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_PPC405\r
+       #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_PPC440\r
+       #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"\r
+#endif\r
+\r
+#ifdef _16FX_SOFTUNE\r
+       #include "..\..\Source\portable\Softune\MB96340\portmacro.h"\r
+#endif\r
+\r
+#ifdef BCC_INDUSTRIAL_PC_PORT\r
+       /* A short file name has to be used in place of the normal\r
+       FreeRTOSConfig.h when using the Borland compiler. */\r
+       #include "frconfig.h"\r
+       #include "..\portable\BCC\16BitDOS\PC\prtmacro.h"\r
+    typedef void ( __interrupt __far *pxISR )();\r
+#endif\r
+\r
+#ifdef BCC_FLASH_LITE_186_PORT\r
+       /* A short file name has to be used in place of the normal\r
+       FreeRTOSConfig.h when using the Borland compiler. */\r
+       #include "frconfig.h"\r
+       #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"\r
+    typedef void ( __interrupt __far *pxISR )();\r
+#endif\r
+\r
+#ifdef __GNUC__\r
+   #ifdef __AVR32_AVR32A__\r
+          #include "portmacro.h"\r
+   #endif\r
+#endif\r
+\r
+#ifdef __ICCAVR32__\r
+   #ifdef __CORE__\r
+      #if __CORE__ == __AVR32A__\r
+             #include "portmacro.h"\r
+      #endif\r
+   #endif\r
+#endif\r
+\r
+#ifdef __91467D\r
+       #include "portmacro.h"\r
+#endif\r
+\r
+#ifdef __96340\r
+       #include "portmacro.h"\r
+#endif\r
+\r
+\r
+#ifdef __IAR_V850ES_Fx3__\r
+       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
+#endif\r
+\r
+#ifdef __IAR_V850ES_Jx3__\r
+       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
+#endif\r
+\r
+#ifdef __IAR_V850ES_Jx3_L__\r
+       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
+#endif\r
+\r
+#ifdef __IAR_V850ES_Jx2__\r
+       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
+#endif\r
+\r
+#ifdef __IAR_V850ES_Hx2__\r
+       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
+#endif\r
+\r
+#ifdef __IAR_78K0R_Kx3__\r
+       #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
+#endif\r
+\r
+#ifdef __IAR_78K0R_Kx3L__\r
+       #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
+#endif\r
+\r
+#endif /* DEPRECATED_DEFINITIONS_H */\r
+\r
index 0fbaa51e16ef2012bf95e516477834e9f23141b3..6664ee237957c5ccb6c68af8c1d110eadee25371 100644 (file)
 #ifndef PORTABLE_H\r
 #define PORTABLE_H\r
 \r
-/* Include the macro file relevant to the port being used.\r
-NOTE:  The following definitions are *DEPRECATED* as it is preferred to instead\r
-just add the path to the correct portmacro.h header file to the compiler's\r
-include path. */\r
-#ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT\r
-       #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"\r
-       typedef void ( __interrupt __far *pxISR )();\r
-#endif\r
-\r
-#ifdef OPEN_WATCOM_FLASH_LITE_186_PORT\r
-       #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"\r
-       typedef void ( __interrupt __far *pxISR )();\r
-#endif\r
-\r
-#ifdef GCC_MEGA_AVR\r
-       #include "../portable/GCC/ATMega323/portmacro.h"\r
-#endif\r
-\r
-#ifdef IAR_MEGA_AVR\r
-       #include "../portable/IAR/ATMega323/portmacro.h"\r
-#endif\r
-\r
-#ifdef MPLAB_PIC24_PORT\r
-       #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"\r
-#endif\r
-\r
-#ifdef MPLAB_DSPIC_PORT\r
-       #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"\r
-#endif\r
-\r
-#ifdef MPLAB_PIC18F_PORT\r
-       #include "../../Source/portable/MPLAB/PIC18F/portmacro.h"\r
-#endif\r
-\r
-#ifdef MPLAB_PIC32MX_PORT\r
-       #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h"\r
-#endif\r
-\r
-#ifdef _FEDPICC\r
-       #include "libFreeRTOS/Include/portmacro.h"\r
-#endif\r
-\r
-#ifdef SDCC_CYGNAL\r
-       #include "../../Source/portable/SDCC/Cygnal/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_ARM7\r
-       #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_ARM7_ECLIPSE\r
-       #include "portmacro.h"\r
-#endif\r
-\r
-#ifdef ROWLEY_LPC23xx\r
-       #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"\r
-#endif\r
-\r
-#ifdef IAR_MSP430\r
-       #include "..\..\Source\portable\IAR\MSP430\portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_MSP430\r
-       #include "../../Source/portable/GCC/MSP430F449/portmacro.h"\r
-#endif\r
-\r
-#ifdef ROWLEY_MSP430\r
-       #include "../../Source/portable/Rowley/MSP430F449/portmacro.h"\r
-#endif\r
-\r
-#ifdef ARM7_LPC21xx_KEIL_RVDS\r
-       #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"\r
-#endif\r
-\r
-#ifdef SAM7_GCC\r
-       #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"\r
-#endif\r
-\r
-#ifdef SAM7_IAR\r
-       #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"\r
-#endif\r
-\r
-#ifdef SAM9XE_IAR\r
-       #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"\r
-#endif\r
-\r
-#ifdef LPC2000_IAR\r
-       #include "..\..\Source\portable\IAR\LPC2000\portmacro.h"\r
-#endif\r
-\r
-#ifdef STR71X_IAR\r
-       #include "..\..\Source\portable\IAR\STR71x\portmacro.h"\r
-#endif\r
-\r
-#ifdef STR75X_IAR\r
-       #include "..\..\Source\portable\IAR\STR75x\portmacro.h"\r
-#endif\r
-\r
-#ifdef STR75X_GCC\r
-       #include "..\..\Source\portable\GCC\STR75x\portmacro.h"\r
-#endif\r
-\r
-#ifdef STR91X_IAR\r
-       #include "..\..\Source\portable\IAR\STR91x\portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_H8S\r
-       #include "../../Source/portable/GCC/H8S2329/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_AT91FR40008\r
-       #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"\r
-#endif\r
-\r
-#ifdef RVDS_ARMCM3_LM3S102\r
-       #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_ARMCM3_LM3S102\r
-       #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_ARMCM3\r
-       #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"\r
-#endif\r
-\r
-#ifdef IAR_ARM_CM3\r
-       #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"\r
-#endif\r
-\r
-#ifdef IAR_ARMCM3_LM\r
-       #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"\r
-#endif\r
-\r
-#ifdef HCS12_CODE_WARRIOR\r
-       #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"\r
-#endif\r
-\r
-#ifdef MICROBLAZE_GCC\r
-       #include "../../Source/portable/GCC/MicroBlaze/portmacro.h"\r
-#endif\r
-\r
-#ifdef TERN_EE\r
-       #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_HCS12\r
-       #include "../../Source/portable/GCC/HCS12/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_MCF5235\r
-    #include "../../Source/portable/GCC/MCF5235/portmacro.h"\r
-#endif\r
-\r
-#ifdef COLDFIRE_V2_GCC\r
-       #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"\r
-#endif\r
-\r
-#ifdef COLDFIRE_V2_CODEWARRIOR\r
-       #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_PPC405\r
-       #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_PPC440\r
-       #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"\r
-#endif\r
-\r
-#ifdef _16FX_SOFTUNE\r
-       #include "..\..\Source\portable\Softune\MB96340\portmacro.h"\r
-#endif\r
-\r
-#ifdef BCC_INDUSTRIAL_PC_PORT\r
-       /* A short file name has to be used in place of the normal\r
-       FreeRTOSConfig.h when using the Borland compiler. */\r
-       #include "frconfig.h"\r
-       #include "..\portable\BCC\16BitDOS\PC\prtmacro.h"\r
-    typedef void ( __interrupt __far *pxISR )();\r
-#endif\r
-\r
-#ifdef BCC_FLASH_LITE_186_PORT\r
-       /* A short file name has to be used in place of the normal\r
-       FreeRTOSConfig.h when using the Borland compiler. */\r
-       #include "frconfig.h"\r
-       #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"\r
-    typedef void ( __interrupt __far *pxISR )();\r
-#endif\r
-\r
-#ifdef __GNUC__\r
-   #ifdef __AVR32_AVR32A__\r
-          #include "portmacro.h"\r
-   #endif\r
-#endif\r
-\r
-#ifdef __ICCAVR32__\r
-   #ifdef __CORE__\r
-      #if __CORE__ == __AVR32A__\r
-             #include "portmacro.h"\r
-      #endif\r
-   #endif\r
-#endif\r
-\r
-#ifdef __91467D\r
-       #include "portmacro.h"\r
-#endif\r
-\r
-#ifdef __96340\r
-       #include "portmacro.h"\r
-#endif\r
-\r
-\r
-#ifdef __IAR_V850ES_Fx3__\r
-       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
-#endif\r
-\r
-#ifdef __IAR_V850ES_Jx3__\r
-       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
-#endif\r
-\r
-#ifdef __IAR_V850ES_Jx3_L__\r
-       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
-#endif\r
-\r
-#ifdef __IAR_V850ES_Jx2__\r
-       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
-#endif\r
-\r
-#ifdef __IAR_V850ES_Hx2__\r
-       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
-#endif\r
-\r
-#ifdef __IAR_78K0R_Kx3__\r
-       #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
-#endif\r
-\r
-#ifdef __IAR_78K0R_Kx3L__\r
-       #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
-#endif\r
-\r
-/* Catch all to ensure portmacro.h is included in the build.  Newer demos\r
-have the path as part of the project options, rather than as relative from\r
-the project location.  If portENTER_CRITICAL() has not been defined then\r
-portmacro.h has not yet been included - as every portmacro.h provides a\r
-portENTER_CRITICAL() definition.  Check the demo application for your demo\r
-to find the path to the correct portmacro.h file. */\r
+/* Each FreeRTOS port has a unique portmacro.h header file.  Originally a\r
+pre-processor definition was used to ensure the pre-processor found the correct\r
+portmacro.h file for the port being used.  That scheme was deprecated in favour\r
+of setting the compiler's include path such that it found the correct\r
+portmacro.h file - removing the need for the constant and allowing the\r
+portmacro.h file to be located anywhere in relation to the port being used.\r
+Purely for reasons of backward compatibility the old method is still valid, but\r
+to make it clear that new projects should not use it, support for the port\r
+specific constants has been moved into the deprecated_definitions.h header\r
+file. */\r
+#include "deprecated_definitions.h"\r
+\r
+/* If portENTER_CRITICAL is not defined then including deprecated_definitions.h\r
+did not result in a portmacro.h header file being included - and it should be\r
+included here.  In this case the path to the correct portmacro.h header file\r
+must be set in the compiler's include path. */\r
 #ifndef portENTER_CRITICAL\r
        #include "portmacro.h"\r
 #endif\r
@@ -370,15 +139,15 @@ typedef struct HeapRegion
        size_t xSizeInBytes;\r
 } HeapRegion_t;\r
 \r
-/* \r
+/*\r
  * Used to define multiple heap regions for use by heap_5.c.  This function\r
  * must be called before any calls to pvPortMalloc() - not creating a task,\r
  * queue, semaphore, mutex, software timer, event group, etc. will result in\r
  * pvPortMalloc being called.\r
  *\r
  * pxHeapRegions passes in an array of HeapRegion_t structures - each of which\r
- * defines a region of memory that can be used as the heap.  The array is \r
- * terminated by a HeapRegions_t structure that has a size of 0.  The region \r
+ * defines a region of memory that can be used as the heap.  The array is\r
+ * terminated by a HeapRegions_t structure that has a size of 0.  The region\r
  * with the lowest start address must appear first in the array.\r
  */\r
 void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions );\r
index 78418da8729848a5cdd5ac1f237e07ad70b619d0..1ba9748f99988eac4cf2b95097dda3b8f6ef40ef 100644 (file)
@@ -114,13 +114,23 @@ typedef enum
        eDeleted                /* The task being queried has been deleted, but its TCB has not yet been freed. */\r
 } eTaskState;\r
 \r
+/* Actions that can be performed when vTaskNotify() is called. */\r
+typedef enum\r
+{\r
+       eNoAction,                                      /* Notify the task without updating its notify value. */\r
+       eSetBits,                                       /* Set bits in the task's notification value. */\r
+       eIncrement,                                     /* Increment the task's notification value. */\r
+       eSetValueWithOverwrite,         /* Set the task's notification value to a specific value even if the previous value has not yet been read by the task. */\r
+       eSetValueWithoutOverwrite       /* Set the task's notification value if the previous value has been read by the task. */\r
+} eNotifyAction;\r
+\r
 /*\r
  * Used internally only.\r
  */\r
 typedef struct xTIME_OUT\r
 {\r
        BaseType_t xOverflowCount;\r
-       TickType_t  xTimeOnEntering;\r
+       TickType_t xTimeOnEntering;\r
 } TimeOut_t;\r
 \r
 /*\r
@@ -1358,6 +1368,432 @@ void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unquali
  */\r
 void vTaskGetRunTimeStats( char *pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
 \r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction );</PRE>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be defined as 1 for this function to be\r
+ * available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * A notification sent to a task will remain pending until it is cleared by the\r
+ * task calling xTaskNotifyWait() or ulTaskNotifyTake().  If the task was\r
+ * already in the Blocked state to wait for a notification when the notification\r
+ * arrives then the task will automatically be removed from the Blocked state\r
+ * (unblocked) and the notification cleared.\r
+ *\r
+ * A task can use xTaskNotifyWait() to [optionally] block to wait for a\r
+ * notification to be pending, or xTaskNotifyTake() to [optionally] block\r
+ * to wait for its notification value to have a non-zero value.  The task does\r
+ * not consume any CPU time while it is in the Blocked state.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS_task_notifications.html for details of when\r
+ * it is best to use a task notification to send an event to a task compared to\r
+ * when it is best to use an intermediary object (such as a queue, semaphore,\r
+ * mutex or event group) to send an event to a task.\r
+ *\r
+ * @param xTaskToNotify The handle of the task being notified.  The handle to a\r
+ * task can be returned from the xTaskCreate() API function used to create the\r
+ * task, and the handle of the currently running task can be obtained by calling\r
+ * xTaskGetCurrentTaskHandle().\r
+ *\r
+ * @param ulValue Data that can be sent with the notification.  How the data is\r
+ * used depends on the value of the eAction parameter.\r
+ *\r
+ * @param eAction Specifies how the notification updates the task's notification\r
+ * value, if at all.  Valid values for eAction are as follows:\r
+ *\r
+ *     eSetBits -\r
+ *     The task's notification value is bitwise ORed with ulValue.  xTaskNofify()\r
+ *     always returns pdPASS in this case.\r
+ *\r
+ *     eIncrement -\r
+ *     The task's notification value is incremented.  ulValue is not used and\r
+ *     xTaskNotify() always returns pdPASS in this case.\r
+ *\r
+ *     eSetValueWithOverwrite -\r
+ *     The task's notification value is set to the value of ulValue, even if the\r
+ *     task being notified had not yet processed the previous notification (the\r
+ *     task already had a notification pending).  xTaskNotify() always returns\r
+ *     pdPASS in this case.\r
+ *\r
+ *     eSetValueWithoutOverwrite -\r
+ *     If the task being notified did not already have a notification pending then\r
+ *     the task's notification value is set to ulValue and xTaskNotify() will\r
+ *     return pdPASS.  If the task being notified already had a notification\r
+ *     pending then no action is performed and pdFAIL is returned.\r
+ *\r
+ *     eNoAction -\r
+ *     The task receives a notification without its notification value being\r
+ *     updated.  ulValue is not used and xTaskNotify() always returns pdPASS in\r
+ *     this case.\r
+ *\r
+ * @return Dependent on the value of eAction.  See the description of the\r
+ * eAction parameter.\r
+ *\r
+ * \defgroup xTaskNotify xTaskNotify\r
+ * \ingroup TaskNotifications\r
+ */\r
+BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction );\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken );</PRE>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be defined as 1 for this function to be\r
+ * available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * A version of xTaskNotify() that can be used from an interrupt service routine\r
+ * (ISR).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * A notification sent to a task will remain pending until it is cleared by the\r
+ * task calling xTaskNotifyWait() or ulTaskNotifyTake().  If the task was\r
+ * already in the Blocked state to wait for a notification when the notification\r
+ * arrives then the task will automatically be removed from the Blocked state\r
+ * (unblocked) and the notification cleared.\r
+ *\r
+ * A task can use xTaskNotifyWait() to [optionally] block to wait for a\r
+ * notification to be pending, or xTaskNotifyTake() to [optionally] block\r
+ * to wait for its notification value to have a non-zero value.  The task does\r
+ * not consume any CPU time while it is in the Blocked state.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS_task_notifications.html for details of when\r
+ * it is best to use a task notification to send an event to a task compared to\r
+ * when it is best to use an intermediary object (such as a queue, semaphore,\r
+ * mutex or event group) to send an event to a task.\r
+ *\r
+ * @param xTaskToNotify The handle of the task being notified.  The handle to a\r
+ * task can be returned from the xTaskCreate() API function used to create the\r
+ * task, and the handle of the currently running task can be obtained by calling\r
+ * xTaskGetCurrentTaskHandle().\r
+ *\r
+ * @param ulValue Data that can be sent with the notification.  How the data is\r
+ * used depends on the value of the eAction parameter.\r
+ *\r
+ * @param eAction Specifies how the notification updates the task's notification\r
+ * value, if at all.  Valid values for eAction are as follows:\r
+ *\r
+ *     eSetBits -\r
+ *     The task's notification value is bitwise ORed with ulValue.  xTaskNofify()\r
+ *     always returns pdPASS in this case.\r
+ *\r
+ *     eIncrement -\r
+ *     The task's notification value is incremented.  ulValue is not used and\r
+ *     xTaskNotify() always returns pdPASS in this case.\r
+ *\r
+ *     eSetValueWithOverwrite -\r
+ *     The task's notification value is set to the value of ulValue, even if the\r
+ *     task being notified had not yet processed the previous notification (the\r
+ *     task already had a notification pending).  xTaskNotify() always returns\r
+ *     pdPASS in this case.\r
+ *\r
+ *     eSetValueWithoutOverwrite -\r
+ *     If the task being notified did not already have a notification pending then\r
+ *     the task's notification value is set to ulValue and xTaskNotify() will\r
+ *     return pdPASS.  If the task being notified already had a notification\r
+ *     pending then no action is performed and pdFAIL is returned.\r
+ *\r
+ *     eNoAction -\r
+ *     The task receives a notification without its notification value being\r
+ *     updated.  ulValue is not used and xTaskNotify() always returns pdPASS in\r
+ *     this case.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken  xTaskNotifyFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending the notification caused the\r
+ * task to which the notification was sent to leave the Blocked state, and the\r
+ * unblocked task has a priority higher than the currently running task.  If\r
+ * xTaskNotifyFromISR() sets this value to pdTRUE then a context switch should\r
+ * be requested before the interrupt is exited.  How a context switch is\r
+ * requested from an ISR is dependent on the port - see the documentation page\r
+ * for the port in use.\r
+ *\r
+ * @return Dependent on the value of eAction.  See the description of the\r
+ * eAction parameter.\r
+ *\r
+ * \defgroup xTaskNotify xTaskNotify\r
+ * \ingroup TaskNotifications\r
+ */\r
+BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken );\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, BaseType_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait );</pre>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be defined as 1 for this function to be\r
+ * available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * A notification sent to a task will remain pending until it is cleared by the\r
+ * task calling xTaskNotifyWait() or ulTaskNotifyTake().  If the task was\r
+ * already in the Blocked state to wait for a notification when the notification\r
+ * arrives then the task will automatically be removed from the Blocked state\r
+ * (unblocked) and the notification cleared.\r
+ *\r
+ * A task can use xTaskNotifyWait() to [optionally] block to wait for a\r
+ * notification to be pending, or xTaskNotifyTake() to [optionally] block\r
+ * to wait for its notification value to have a non-zero value.  The task does\r
+ * not consume any CPU time while it is in the Blocked state.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS_task_notifications.html for details of when\r
+ * it is best to use a task notification to send an event to a task compared to\r
+ * when it is best to use an intermediary object (such as a queue, semaphore,\r
+ * mutex or event group) to send an event to a task.\r
+ *\r
+ * @param ulBitsToClearOnEntry Bits that are set in ulBitsToClearOnEntry value\r
+ * will be cleared in the calling task's notification value before the task\r
+ * checks to see if any notifications are pending, and optionally blocks if no\r
+ * notifications are pending.  Setting ulBitsToClearOnEntry to ULONG_MAX (if\r
+ * limits.h is included) or 0xffffffffUL (if limits.h is not included) will have\r
+ * the effect of resetting the task's notification value to 0.  Setting\r
+ * ulBitsToClearOnEntry to 0 will leave the task's notification value unchanged.\r
+ *\r
+ * @param ulBitsToClearOnExit If a notification is pending or received before\r
+ * the calling task exits the xTaskNotifyWait() function then the task's\r
+ * notification value (see the xTaskNotify() API function) is passed out using\r
+ * the pulNotificationValue parameter.  Then any bits that are set in\r
+ * ulBitsToClearOnExit will be cleared in the task's notification value (note\r
+ * *pulNotificationValue is set before any bits are cleared).  Setting\r
+ * ulBitsToClearOnExit to ULONG_MAX (if limits.h is included) or 0xffffffffUL\r
+ * (if limits.h is not included) will have the effect of resetting the task's\r
+ * notification value to 0 before the function exits.  Setting\r
+ * ulBitsToClearOnExit to 0 will leave the task's notification value unchanged\r
+ * when the function exits (in which case the value passed out in\r
+ * pulNotificationValue will match the task's notification value).\r
+ *\r
+ * @param pulNotificationValue Used to pass the task's notification value out\r
+ * of the function.  Note the value passed out will not be effected by the\r
+ * clearing of any bits caused by ulBitsToClearOnExit being non-zero.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time that the task should wait in\r
+ * the Blocked state for a notification to be received, should a notification\r
+ * not already be pending when xTaskNotifyWait() was called.  The task\r
+ * will not consume any processing time while it is in the Blocked state.  This\r
+ * is specified in kernel ticks, the macro pdMS_TO_TICSK( value_in_ms ) can be\r
+ * used to convert a time specified in milliseconds to a time specified in\r
+ * ticks.\r
+ *\r
+ * @return If a notification was received (including notifications that were\r
+ * already pending when xTaskNotifyWait was called) then pdPASS is\r
+ * returned.  Otherwise pdFAIL is returned.\r
+ *\r
+ * \defgroup xTaskNotifyWait xTaskNotifyWait\r
+ * \ingroup TaskNotifications\r
+ */\r
+BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, BaseType_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait );\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotifyGive( TaskHandle_t xTaskHandle, BaseType_t *pxHigherPriorityTaskWoken );\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be defined as 1 for this macro to be\r
+ * available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * xTaskNotifyGive() is a helper macro intended for use when task notifications\r
+ * are used as light weight and faster binary or counting semaphore equivalents.\r
+ * Actual FreeRTOS semaphores are given using the xSemaphoreGive() API function,\r
+ * the equivalent action that instead uses a task notification is\r
+ * xTaskNotifyGive().\r
+ *\r
+ * When task notifications are being used as a binary or counting semaphore\r
+ * equivalent then the task being notified should wait for the notification\r
+ * using the ulTaskNotificationTake() API function rather than the\r
+ * xTaskNotifyWait() API function.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS_task_notifications.html for more details.\r
+ *\r
+ * @param xTaskToNotify The handle of the task being notified.  The handle to a\r
+ * task can be returned from the xTaskCreate() API function used to create the\r
+ * task, and the handle of the currently running task can be obtained by calling\r
+ * xTaskGetCurrentTaskHandle().\r
+ *\r
+ * @return xTaskNotifyGive() is a macro that calls xTaskNotify() with the\r
+ * eAction parameter set to eIncrement - so pdPASS is always returned.\r
+ *\r
+ * \defgroup xTaskNotifyGive xTaskNotifyGive\r
+ * \ingroup TaskNotifications\r
+ */\r
+#define xTaskNotifyGive( xTaskToNotify ) xTaskNotify( ( xTaskToNotify ), 0, eIncrement );\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotifyGiveFromISR( TaskHandle_t xTaskHandle, BaseType_t *pxHigherPriorityTaskWoken );\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be defined as 1 for this macro to be\r
+ * available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * A version of xTaskNotifyGive() that can be called from an interrupt service\r
+ * routine (ISR).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * xTaskNotifyGiveFromISR() is a helper macro intended for use when task\r
+ * notifications are used as light weight and faster binary or counting\r
+ * semaphore equivalents.  Actual FreeRTOS semaphores are given from an ISR\r
+ * using the xSemaphoreGiveFromISR() API function, the equivalent action that\r
+ * instead uses a task notification is xTaskNotifyGiveFromISR().\r
+ *\r
+ * When task notifications are being used as a binary or counting semaphore\r
+ * equivalent then the task being notified should wait for the notification\r
+ * using the ulTaskNotificationTake() API function rather than the\r
+ * xTaskNotifyWait() API function.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS_task_notifications.html for more details.\r
+ *\r
+ * @param xTaskToNotify The handle of the task being notified.  The handle to a\r
+ * task can be returned from the xTaskCreate() API function used to create the\r
+ * task, and the handle of the currently running task can be obtained by calling\r
+ * xTaskGetCurrentTaskHandle().\r
+ *\r
+ * @param pxHigherPriorityTaskWoken  xTaskNotifyGiveFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending the notification caused the\r
+ * task to which the notification was sent to leave the Blocked state, and the\r
+ * unblocked task has a priority higher than the currently running task.  If\r
+ * xTaskNotifyGiveFromISR() sets this value to pdTRUE then a context switch\r
+ * should be requested before the interrupt is exited.  How a context switch is\r
+ * requested from an ISR is dependent on the port - see the documentation page\r
+ * for the port in use.\r
+ *\r
+ * @return xTaskNotifyGiveFromISR() is a macro that calls xTaskNotifyFromISR()\r
+ * with the eAction parameter set to eIncrement - so pdPASS is always returned.\r
+ *\r
+ * \defgroup xTaskNotifyWait xTaskNotifyWait\r
+ * \ingroup TaskNotifications\r
+ */\r
+#define xTaskNotifyGiveFromISR( xTaskToNotify, pxHigherPriorityTaskWoken ) xTaskNotifyFromISR( ( xTaskToNotify ), 0, eIncrement, ( pxHigherPriorityTaskWoken ) )\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait );</pre>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be defined as 1 for this function to be\r
+ * available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * ulTaskNotifyTake() is intended for use when a task notification is used as a\r
+ * faster and lighter weight binary or counting semaphore alternative.  Actual\r
+ * FreeRTOS semaphores are taken using the xSemaphoreTake() API function, the\r
+ * equivalent action that instead uses a task notification is\r
+ * xTaskNotifyTake().\r
+ *\r
+ * When a task is using its notification value as a binary or counting semaphore\r
+ * other tasks should send notifications to it using the xTaskNotifyGive()\r
+ * macro, or xTaskNotify() function with the eAction parameter set to\r
+ * eIncrement.\r
+ *\r
+ * xTaskNotifyTake() can either clear the task's notification value to\r
+ * zero on exit, in which case the notification value acts like a binary\r
+ * semaphore, or decrement the task's notification value on exit, in which case\r
+ * the notification value acts like a counting semaphore.\r
+ *\r
+ * A task can use xTaskNotifyTake() to [optionally] block to wait for a\r
+ * the tasks notification value to be non-zero.  The task does not consume any\r
+ * CPU time while it is in the Blocked state.\r
+ *\r
+ * Where as xTaskNotifyWait() will return when a notification is pending,\r
+ * xTaskNotifyTake() will return when the task's notification value is\r
+ * not zero.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS_task_notifications.html for details of when\r
+ * it is best to use a task notification to send an event to a task compared to\r
+ * when it is best to use an intermediary object (such as a queue, semaphore,\r
+ * mutex or event group) to send an event to a task.\r
+ *\r
+ * @param xClearCountOnExit if xClearCountOnExit is pdFALSE then the task's\r
+ * notification value is decremented when the function exits.  In this way the\r
+ * notification value acts like a counting semaphore.  If xClearCountOnExit is\r
+ * not pdFALSE then the task's notification value is cleared to zero when the\r
+ * function exits.  In this way the notification value acts like a binary\r
+ * semaphore.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time that the task should wait in\r
+ * the Blocked state for the task's notification value to be greater than zero,\r
+ * should the count not already be greater than zero when\r
+ * xTaskNotifyTake() was called.  The task will not consume any processing\r
+ * time while it is in the Blocked state.  This is specified in kernel ticks,\r
+ * the macro pdMS_TO_TICSK( value_in_ms ) can be used to convert a time\r
+ * specified in milliseconds to a time specified in ticks.\r
+ *\r
+ * @return The task's notification count before it is either cleared to zero or\r
+ * decremented (see the xClearCountOnExit parameter).\r
+ *\r
+ * \defgroup ulTaskNotifyTake ulTaskNotifyTake\r
+ * \ingroup TaskNotifications\r
+ */\r
+uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait );\r
+\r
 /*-----------------------------------------------------------\r
  * SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES\r
  *----------------------------------------------------------*/\r
index 01546e66efaf170c6cd6a5bd25da397ae4960629..a8d9d5b90670d5fedb59702b077960ce6e4bc566 100644 (file)
@@ -125,13 +125,12 @@ const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
 \r
        /* Insert the new list item into the list, sorted in xItemValue order.\r
 \r
-       If the list already contains a list item with the same item value then\r
-       the new list item should be placed after it.  This ensures that TCB's which\r
-       are stored in ready lists (all of which have the same xItemValue value)\r
-       get an equal share of the CPU.  However, if the xItemValue is the same as\r
-       the back marker the iteration loop below will not end.  This means we need\r
-       to guard against this by checking the value first and modifying the\r
-       algorithm slightly if necessary. */\r
+       If the list already contains a list item with the same item value then the\r
+       new list item should be placed after it.  This ensures that TCB's which are\r
+       stored in ready lists (all of which have the same xItemValue value) get a\r
+       share of the CPU.  However, if the xItemValue is the same as the back marker\r
+       the iteration loop below will not end.  Therefore the value is checked\r
+       first, and the algorithm slightly modified if necessary. */\r
        if( xValueOfInsertion == portMAX_DELAY )\r
        {\r
                pxIterator = pxList->xListEnd.pxPrevious;\r
@@ -139,27 +138,31 @@ const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
        else\r
        {\r
                /* *** NOTE ***********************************************************\r
-               If you find your application is crashing here then likely causes are:\r
+               If you find your application is crashing here then likely causes are\r
+               listed below.  In addition see http://www.freertos.org/FAQHelp.html for\r
+               more tips, and ensure configASSERT() is defined!\r
+               http://www.freertos.org/a00110.html#configASSERT\r
+\r
                        1) Stack overflow -\r
                           see http://www.freertos.org/Stacks-and-stack-overflow-checking.html\r
-                       2) Incorrect interrupt priority assignment, especially on Cortex-M3\r
+                       2) Incorrect interrupt priority assignment, especially on Cortex-M\r
                           parts where numerically high priority values denote low actual\r
                           interrupt priorities, which can seem counter intuitive.  See\r
-                          configMAX_SYSCALL_INTERRUPT_PRIORITY on http://www.freertos.org/a00110.html\r
+                          http://www.freertos.org/RTOS-Cortex-M3-M4.html and the definition\r
+                          of configMAX_SYSCALL_INTERRUPT_PRIORITY on\r
+                          http://www.freertos.org/a00110.html\r
                        3) Calling an API function from within a critical section or when\r
                           the scheduler is suspended, or calling an API function that does\r
                           not end in "FromISR" from an interrupt.\r
                        4) Using a queue or semaphore before it has been initialised or\r
                           before the scheduler has been started (are interrupts firing\r
                           before vTaskStartScheduler() has been called?).\r
-               See http://www.freertos.org/FAQHelp.html for more tips, and ensure\r
-               configASSERT() is defined!  http://www.freertos.org/a00110.html#configASSERT\r
                **********************************************************************/\r
 \r
                for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM.  This is checked and valid. */\r
                {\r
-                       /* There is nothing to do here, we are just iterating to the\r
-                       wanted insertion position. */\r
+                       /* There is nothing to do here, just iterating to the wanted\r
+                       insertion position. */\r
                }\r
        }\r
 \r
index 9ce95e6362bab77e941e32e8eb789090179f9cd5..16998062e5d1acaec346bd9d5f8645b8ad44ecbb 100644 (file)
@@ -167,8 +167,8 @@ the CPU itself before modifying certain hardware registers. */
 {                                                                                                                                      \\r
        portCPU_IRQ_DISABLE();                                                                                  \\r
        portICCPMR_PRIORITY_MASK_REGISTER = portUNMASK_VALUE;                   \\r
-       __asm(  "DSB            \n"                                                                                     \\r
-                       "ISB            \n" );                                                                          \\r
+       __asm volatile (        "DSB            \n"                                                             \\r
+                                               "ISB            \n" );                                                  \\r
        portCPU_IRQ_ENABLE();                                                                                   \\r
 }\r
 \r
index 666a09ddcbfc0c65beacc935d44b13a809e87eed..554667b7d2042718f2e1857a8c062e8239e6c5ae 100644 (file)
@@ -114,7 +114,7 @@ FreeRTOS.org versions prior to V4.4.0 did not include this definition. */
 #define portPRIGROUP_SHIFT                                     ( 8UL )\r
 \r
 /* Masks off all bits but the VECTACTIVE bits in the ICSR register. */\r
-#define portVECTACTIVE_MASK                                    ( 0x1FUL )\r
+#define portVECTACTIVE_MASK                                    ( 0xFFUL )\r
 \r
 /* Constants required to set up the initial stack. */\r
 #define portINITIAL_XPSR                                       ( 0x01000000UL )\r
index be0ef425a5e58e4a1da15f1fceaf9e8c3bfd6c75..f67f98f978895f034bd395b1b0b09ad7f426a244 100644 (file)
 #define portPRIGROUP_SHIFT                                     ( 8UL )\r
 \r
 /* Masks off all bits but the VECTACTIVE bits in the ICSR register. */\r
-#define portVECTACTIVE_MASK                                    ( 0x1FUL )\r
+#define portVECTACTIVE_MASK                                    ( 0xFFUL )\r
 \r
 /* Constants required to manipulate the VFP. */\r
 #define portFPCCR                                      ( ( volatile uint32_t * ) 0xe000ef34 ) /* Floating point context control register. */\r
@@ -384,27 +384,13 @@ void vPortEndScheduler( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void vPortYield( void )\r
-{\r
-       /* Set a PendSV to request a context switch. */\r
-       portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;\r
-\r
-       /* Barriers are normally not required but do ensure the code is completely\r
-       within the specified behaviour for the architecture. */\r
-       __asm volatile( "dsb" );\r
-       __asm volatile( "isb" );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
 void vPortEnterCritical( void )\r
 {\r
        portDISABLE_INTERRUPTS();\r
        uxCriticalNesting++;\r
-       __asm volatile( "dsb" );\r
-       __asm volatile( "isb" );\r
-       \r
+\r
        /* This is not the interrupt safe version of the enter critical function so\r
-       assert() if it is being called from an interrupt context.  Only API \r
+       assert() if it is being called from an interrupt context.  Only API\r
        functions that end in "FromISR" can be used in an interrupt.  Only assert if\r
        the critical nesting count is 1 to protect against recursive calls if the\r
        assert function also uses a critical section. */\r
@@ -426,37 +412,6 @@ void vPortExitCritical( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-__attribute__(( naked )) uint32_t ulPortSetInterruptMask( void )\r
-{\r
-       __asm volatile                                                                                                          \\r
-       (                                                                                                                                       \\r
-               "       mrs r0, basepri                                                                                 \n" \\r
-               "       mov r1, %0                                                                                              \n"     \\r
-               "       msr basepri, r1                                                                                 \n" \\r
-               "       bx lr                                                                                                   \n" \\r
-               :: "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY ) : "r0", "r1"    \\r
-       );\r
-\r
-       /* This return will not be reached but is necessary to prevent compiler\r
-       warnings. */\r
-       return 0;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-__attribute__(( naked )) void vPortClearInterruptMask( uint32_t ulNewMaskValue )\r
-{\r
-       __asm volatile                                                                                                  \\r
-       (                                                                                                                               \\r
-               "       msr basepri, r0                                                                         \n"     \\r
-               "       bx lr                                                                                           \n" \\r
-               :::"r0"                                                                                                         \\r
-       );\r
-\r
-       /* Just to avoid compiler warnings. */\r
-       ( void ) ulNewMaskValue;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
 void xPortPendSVHandler( void )\r
 {\r
        /* This is a naked function. */\r
@@ -480,6 +435,8 @@ void xPortPendSVHandler( void )
        "       stmdb sp!, {r3}                                         \n"\r
        "       mov r0, %0                                                      \n"\r
        "       msr basepri, r0                                         \n"\r
+       "       dsb                                                                     \n"\r
+       "   isb                                                                 \n"\r
        "       bl vTaskSwitchContext                           \n"\r
        "       mov r0, #0                                                      \n"\r
        "       msr basepri, r0                                         \n"\r
index 763935dce6ff7235394d7ea7e89da29186037613..41f1fbc7d22c976853400ad047e9203920f75466 100644 (file)
@@ -109,25 +109,21 @@ typedef unsigned long UBaseType_t;
 #define portBYTE_ALIGNMENT                     8\r
 /*-----------------------------------------------------------*/\r
 \r
-\r
 /* Scheduler utilities. */\r
-extern void vPortYield( void );\r
 #define portNVIC_INT_CTRL_REG          ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )\r
 #define portNVIC_PENDSVSET_BIT         ( 1UL << 28UL )\r
-#define portYIELD()                                    vPortYield()\r
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT\r
+#define portYIELD() vPortYield()\r
+#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) vPortYield()\r
 #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )\r
 /*-----------------------------------------------------------*/\r
 \r
 /* Critical section management. */\r
 extern void vPortEnterCritical( void );\r
 extern void vPortExitCritical( void );\r
-extern uint32_t ulPortSetInterruptMask( void );\r
-extern void vPortClearInterruptMask( uint32_t ulNewMaskValue );\r
-#define portSET_INTERRUPT_MASK_FROM_ISR()              ulPortSetInterruptMask()\r
-#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x)   vPortClearInterruptMask(x)\r
-#define portDISABLE_INTERRUPTS()                               ulPortSetInterruptMask()\r
-#define portENABLE_INTERRUPTS()                                        vPortClearInterruptMask(0)\r
+#define portSET_INTERRUPT_MASK_FROM_ISR()              ulPortRaiseBASEPRI()\r
+#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x)   vPortSetBASEPRI(x)\r
+#define portDISABLE_INTERRUPTS()                               ulPortRaiseBASEPRI()\r
+#define portENABLE_INTERRUPTS()                                        vPortSetBASEPRI(0)\r
 #define portENTER_CRITICAL()                                   vPortEnterCritical()\r
 #define portEXIT_CRITICAL()                                            vPortExitCritical()\r
 \r
@@ -188,6 +184,53 @@ not necessary for to use this port.  They are defined so the common demo files
 /* portNOP() is not required by this port. */\r
 #define portNOP()\r
 \r
+#ifndef portFORCE_INLINE\r
+       #define portFORCE_INLINE inline __attribute__(( always_inline))\r
+#endif\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+portFORCE_INLINE static uint32_t ulPortRaiseBASEPRI( void )\r
+{\r
+uint32_t ulOriginalBASEPRI, ulNewBASEPRI;\r
+\r
+       __asm volatile\r
+       (\r
+               "       mrs %0, basepri                                                                                 \n" \\r
+               "       mov %1, %2                                                                                              \n"     \\r
+               "       msr basepri, %1                                                                                 \n" \\r
+               "       isb                                                                                                             \n" \\r
+               "       dsb                                                                                                             \n" \\r
+               :"=r" (ulOriginalBASEPRI), "=r" (ulNewBASEPRI) : "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
+       );\r
+\r
+       /* This return will not be reached but is necessary to prevent compiler\r
+       warnings. */\r
+       return ulOriginalBASEPRI;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+portFORCE_INLINE static void vPortSetBASEPRI( uint32_t ulNewMaskValue )\r
+{\r
+       __asm volatile\r
+       (\r
+               "       msr basepri, %0 " :: "r" ( ulNewMaskValue )\r
+       );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+portFORCE_INLINE static void vPortYield( void )\r
+{\r
+       /* Set a PendSV to request a context switch. */\r
+       portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;\r
+\r
+       /* Barriers are normally not required but do ensure the code is completely\r
+       within the specified behaviour for the architecture. */\r
+       __asm volatile( "dsb" );\r
+       __asm volatile( "isb" );\r
+}\r
+\r
+\r
 #ifdef __cplusplus\r
 }\r
 #endif\r
index 528d45e2da365cd72701ce40f2d01d1c79f6d617..df14a0e795667ea3f53042780b49fa55ccfd8a0b 100644 (file)
@@ -217,7 +217,7 @@ typedef struct PORT_REGISTER_DUMP
        /* The human readable name of the task that was running at the time the\r
        exception occurred.  This is the name that was given to the task when the\r
        task was created using the FreeRTOS xTaskCreate() API function. */\r
-       int8_t *pcCurrentTaskName;\r
+       char *pcCurrentTaskName;\r
 \r
        /* The handle of the task that was running a the time the exception\r
        occurred. */\r
index 48e09c49d17cafb03e2bf77005ea93331be57973..1f4b0ab2e32b132911bf71c66f8541a60892c4d6 100644 (file)
 #define portPRIGROUP_SHIFT                                     ( 8UL )\r
 \r
 /* Masks off all bits but the VECTACTIVE bits in the ICSR register. */\r
-#define portVECTACTIVE_MASK                                    ( 0x1FUL )\r
+#define portVECTACTIVE_MASK                                    ( 0xFFUL )\r
 \r
 /* Constants required to set up the initial stack. */\r
 #define portINITIAL_XPSR                                       ( 0x01000000 )\r
@@ -327,9 +327,9 @@ void vPortEnterCritical( void )
        uxCriticalNesting++;\r
        __DSB();\r
        __ISB();\r
-       \r
+\r
        /* This is not the interrupt safe version of the enter critical function so\r
-       assert() if it is being called from an interrupt context.  Only API \r
+       assert() if it is being called from an interrupt context.  Only API\r
        functions that end in "FromISR" can be used in an interrupt.  Only assert if\r
        the critical nesting count is 1 to protect against recursive calls if the\r
        assert function also uses a critical section. */\r
index 7cef15c0abb24237376843d65ce4fc209d70eaeb..295e46902d59ef6f74605724297cd334802e50a3 100644 (file)
 #define portPRIGROUP_SHIFT                                     ( 8UL )\r
 \r
 /* Masks off all bits but the VECTACTIVE bits in the ICSR register. */\r
-#define portVECTACTIVE_MASK                                    ( 0x1FUL )\r
+#define portVECTACTIVE_MASK                                    ( 0xFFUL )\r
 \r
 /* Constants required to manipulate the VFP. */\r
 #define portFPCCR                                                      ( ( volatile uint32_t * ) 0xe000ef34 ) /* Floating point context control register. */\r
@@ -335,27 +335,13 @@ void vPortEndScheduler( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void vPortYield( void )\r
-{\r
-       /* Set a PendSV to request a context switch. */\r
-       portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;\r
-\r
-       /* Barriers are normally not required but do ensure the code is completely\r
-       within the specified behaviour for the architecture. */\r
-       __DSB();\r
-       __ISB();\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
 void vPortEnterCritical( void )\r
 {\r
        portDISABLE_INTERRUPTS();\r
        uxCriticalNesting++;\r
-       __DSB();\r
-       __ISB();\r
-       \r
+\r
        /* This is not the interrupt safe version of the enter critical function so\r
-       assert() if it is being called from an interrupt context.  Only API \r
+       assert() if it is being called from an interrupt context.  Only API\r
        functions that end in "FromISR" can be used in an interrupt.  Only assert if\r
        the critical nesting count is 1 to protect against recursive calls if the\r
        assert function also uses a critical section. */\r
index c7d07afd733f861e7d47672a60fad915940f6e56..546c95479a0bfaf06bc9f8041d9be300468e8418 100644 (file)
@@ -72,8 +72,6 @@
        EXTERN vTaskSwitchContext\r
 \r
        PUBLIC xPortPendSVHandler\r
-       PUBLIC ulPortSetInterruptMask\r
-       PUBLIC vPortClearInterruptMask\r
        PUBLIC vPortSVCHandler\r
        PUBLIC vPortStartFirstTask\r
        PUBLIC vPortEnableVFP\r
@@ -102,6 +100,8 @@ xPortPendSVHandler:
        stmdb sp!, {r3}\r
        mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY\r
        msr basepri, r0\r
+       dsb\r
+       isb\r
        bl vTaskSwitchContext\r
        mov r0, #0\r
        msr basepri, r0\r
@@ -134,20 +134,6 @@ xPortPendSVHandler:
 \r
 /*-----------------------------------------------------------*/\r
 \r
-ulPortSetInterruptMask:\r
-       mrs r0, basepri\r
-       mov r1, #configMAX_SYSCALL_INTERRUPT_PRIORITY\r
-       msr basepri, r1\r
-       bx r14\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-vPortClearInterruptMask:\r
-       msr basepri, r0\r
-       bx r14\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
 vPortSVCHandler:\r
        /* Get the location of the current TCB. */\r
        ldr     r3, =pxCurrentTCB\r
index 92f41753c827d3a210e9535d9d89ed8ce45b468d..3c3b76f2ec0be659238dd9a1da0c97310642fe70 100644 (file)
@@ -110,11 +110,10 @@ typedef unsigned long UBaseType_t;
 /*-----------------------------------------------------------*/\r
 \r
 /* Scheduler utilities. */\r
-extern void vPortYield( void );\r
 #define portNVIC_INT_CTRL_REG          ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )\r
 #define portNVIC_PENDSVSET_BIT         ( 1UL << 28UL )\r
 #define portYIELD()                                    vPortYield()\r
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT\r
+#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) vPortYield()\r
 #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -145,15 +144,13 @@ extern void vPortYield( void );
 /* Critical section management. */\r
 extern void vPortEnterCritical( void );\r
 extern void vPortExitCritical( void );\r
-extern uint32_t ulPortSetInterruptMask( void );\r
-extern void vPortClearInterruptMask( uint32_t ulNewMask );\r
 \r
-#define portDISABLE_INTERRUPTS()                               ulPortSetInterruptMask()\r
-#define portENABLE_INTERRUPTS()                                        vPortClearInterruptMask( 0 )\r
+#define portDISABLE_INTERRUPTS()                               ulPortRaiseBASEPRI()\r
+#define portENABLE_INTERRUPTS()                                        vPortSetBASEPRI( 0 )\r
 #define portENTER_CRITICAL()                                   vPortEnterCritical()\r
 #define portEXIT_CRITICAL()                                            vPortExitCritical()\r
-#define portSET_INTERRUPT_MASK_FROM_ISR()              ulPortSetInterruptMask()\r
-#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x)   vPortClearInterruptMask( x )\r
+#define portSET_INTERRUPT_MASK_FROM_ISR()              ulPortRaiseBASEPRI()\r
+#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x)   vPortSetBASEPRI( x )\r
 /*-----------------------------------------------------------*/\r
 \r
 /* Tickless idle/low power functionality. */\r
@@ -179,6 +176,51 @@ not necessary for to use this port.  They are defined so the common demo files
 /* portNOP() is not required by this port. */\r
 #define portNOP()\r
 \r
+#ifndef portFORCE_INLINE\r
+       #define portFORCE_INLINE _Pragma("inline=forced")\r
+#endif\r
+\r
+portFORCE_INLINE static void vPortYield( void )\r
+{\r
+       /* Set a PendSV to request a context switch. */\r
+       portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;\r
+\r
+       /* Barriers are normally not required but do ensure the code is completely\r
+       within the specified behaviour for the architecture. */\r
+       __DSB();\r
+       __ISB();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+portFORCE_INLINE static uint32_t ulPortRaiseBASEPRI( void )\r
+{\r
+uint32_t ulOriginalBASEPRI;\r
+\r
+       __asm volatile\r
+       (\r
+               "       mrs %0, basepri                                                                                 \n" \\r
+               "       mov r1, %1                                                                                              \n"     \\r
+               "       msr basepri, r1                                                                                 \n" \\r
+               "       isb                                                                                                             \n" \\r
+               "       dsb                                                                                                             \n" \\r
+               :"=r" (ulOriginalBASEPRI) : "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY ) : "r1"\r
+       );\r
+\r
+       /* This return will not be reached but is necessary to prevent compiler\r
+       warnings. */\r
+       return ulOriginalBASEPRI;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+portFORCE_INLINE static void vPortSetBASEPRI( uint32_t ulNewMaskValue )\r
+{\r
+       __asm volatile\r
+       (\r
+               "       msr basepri, %0 " :: "r" ( ulNewMaskValue )\r
+       );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
 /* Suppress warnings that are generated by the IAR tools, but cannot be fixed in\r
 the source code because to do so would cause other compilers to generate\r
 warnings. */\r
index 0a8323643749bf9c3bffc7031da569ed2c71300a..77610ac1d44fc4d9e51403761486939228486bcf 100644 (file)
@@ -111,7 +111,7 @@ is defined. */
 #define portNVIC_PEND_SYSTICK_CLEAR_BIT                ( 1UL << 25UL )\r
 \r
 /* Masks off all bits but the VECTACTIVE bits in the ICSR register. */\r
-#define portVECTACTIVE_MASK                                    ( 0x1FUL )\r
+#define portVECTACTIVE_MASK                                    ( 0xFFUL )\r
 \r
 #define portNVIC_PENDSV_PRI                                    ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )\r
 #define portNVIC_SYSTICK_PRI                           ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )\r
index 2b85606829b7560a76c5fb50c26588a81d463276..3628b34b347296de5d743de9c20692b533a12537 100644 (file)
@@ -124,7 +124,7 @@ is defined. */
 #define portPRIGROUP_SHIFT                                     ( 8UL )\r
 \r
 /* Masks off all bits but the VECTACTIVE bits in the ICSR register. */\r
-#define portVECTACTIVE_MASK                                    ( 0x1FUL )\r
+#define portVECTACTIVE_MASK                                    ( 0xFFUL )\r
 \r
 /* Constants required to manipulate the VFP. */\r
 #define portFPCCR                                      ( ( volatile uint32_t * ) 0xe000ef34 ) /* Floating point context control register. */\r
@@ -134,9 +134,6 @@ is defined. */
 #define portINITIAL_XPSR                       ( 0x01000000 )\r
 #define portINITIAL_EXEC_RETURN                ( 0xfffffffd )\r
 \r
-/* Constants used with memory barrier intrinsics. */\r
-#define portSY_FULL_READ_WRITE         ( 15 )\r
-\r
 /* The systick is a 24-bit counter. */\r
 #define portMAX_24_BIT_NUMBER                          ( 0xffffffUL )\r
 \r
@@ -401,24 +398,10 @@ void vPortEndScheduler( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void vPortYield( void )\r
-{\r
-       /* Set a PendSV to request a context switch. */\r
-       portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;\r
-\r
-       /* Barriers are normally not required but do ensure the code is completely\r
-       within the specified behaviour for the architecture. */\r
-       __dsb( portSY_FULL_READ_WRITE );\r
-       __isb( portSY_FULL_READ_WRITE );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
 void vPortEnterCritical( void )\r
 {\r
        portDISABLE_INTERRUPTS();\r
        uxCriticalNesting++;\r
-       __dsb( portSY_FULL_READ_WRITE );\r
-       __isb( portSY_FULL_READ_WRITE );\r
 \r
        /* This is not the interrupt safe version of the enter critical function so\r
        assert() if it is being called from an interrupt context.  Only API\r
@@ -471,6 +454,8 @@ __asm void xPortPendSVHandler( void )
        stmdb sp!, {r3}\r
        mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY\r
        msr basepri, r0\r
+       dsb\r
+       isb\r
        bl vTaskSwitchContext\r
        mov r0, #0\r
        msr basepri, r0\r
@@ -702,26 +687,6 @@ void xPortSysTickHandler( void )
 #endif /* configOVERRIDE_DEFAULT_TICK_CONFIGURATION */\r
 /*-----------------------------------------------------------*/\r
 \r
-__asm uint32_t ulPortSetInterruptMask( void )\r
-{\r
-       PRESERVE8\r
-\r
-       mrs r0, basepri\r
-       mov r1, #configMAX_SYSCALL_INTERRUPT_PRIORITY\r
-       msr basepri, r1\r
-       bx r14\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-__asm void vPortClearInterruptMask( uint32_t ulNewMask )\r
-{\r
-       PRESERVE8\r
-\r
-       msr basepri, r0\r
-       bx r14\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
 __asm uint32_t vPortGetIPSR( void )\r
 {\r
        PRESERVE8\r
index fa39a3a4e228bbdffcb7e226b2804967d87b93e2..93a055555d618ab2e424990166a2185003dc587a 100644 (file)
@@ -107,29 +107,30 @@ typedef unsigned long UBaseType_t;
 #define portSTACK_GROWTH                       ( -1 )\r
 #define portTICK_PERIOD_MS                     ( ( TickType_t ) 1000 / configTICK_RATE_HZ )\r
 #define portBYTE_ALIGNMENT                     8\r
+\r
+/* Constants used with memory barrier intrinsics. */\r
+#define portSY_FULL_READ_WRITE         ( 15 )\r
+\r
 /*-----------------------------------------------------------*/\r
 \r
 /* Scheduler utilities. */\r
-extern void vPortYield( void );\r
 #define portNVIC_INT_CTRL_REG          ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )\r
 #define portNVIC_PENDSVSET_BIT         ( 1UL << 28UL )\r
 #define portYIELD()                                    vPortYield()\r
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT\r
+#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) vPortYield()\r
 #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )\r
 /*-----------------------------------------------------------*/\r
 \r
 /* Critical section management. */\r
-extern uint32_t ulPortSetInterruptMask( void );\r
-extern void vPortClearInterruptMask( uint32_t ulNewMask );\r
 extern void vPortEnterCritical( void );\r
 extern void vPortExitCritical( void );\r
 \r
-#define portDISABLE_INTERRUPTS()                               ulPortSetInterruptMask()\r
-#define portENABLE_INTERRUPTS()                                        vPortClearInterruptMask( 0 )\r
+#define portDISABLE_INTERRUPTS()                               ulPortRaiseBASEPRI()\r
+#define portENABLE_INTERRUPTS()                                        vPortSetBASEPRI( 0 )\r
 #define portENTER_CRITICAL()                                   vPortEnterCritical()\r
 #define portEXIT_CRITICAL()                                            vPortExitCritical()\r
-#define portSET_INTERRUPT_MASK_FROM_ISR()              ulPortSetInterruptMask()\r
-#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x)   vPortClearInterruptMask(x)\r
+#define portSET_INTERRUPT_MASK_FROM_ISR()              ulPortRaiseBASEPRI()\r
+#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x)   vPortSetBASEPRI(x)\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
@@ -178,6 +179,53 @@ not necessary for to use this port.  They are defined so the common demo files
 /* portNOP() is not required by this port. */\r
 #define portNOP()\r
 \r
+#ifndef portFORCE_INLINE\r
+       #define portFORCE_INLINE __forceinline\r
+#endif\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+static portFORCE_INLINE void vPortSetBASEPRI( uint32_t ulBASEPRI )\r
+{\r
+       __asm\r
+       {\r
+               /* Barrier instructions are not used as this function is only used to\r
+               lower the BASEPRI value. */\r
+               msr basepri, ulBASEPRI\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static portFORCE_INLINE uint32_t ulPortRaiseBASEPRI( void )\r
+{\r
+uint32_t ulReturn, ulNewBASEPRI = configMAX_SYSCALL_INTERRUPT_PRIORITY;\r
+\r
+       __asm\r
+       {\r
+               /* Set BASEPRI to the max syscall priority to effect a critical\r
+               section. */\r
+               mrs ulReturn, basepri\r
+               msr basepri, ulNewBASEPRI\r
+               dsb\r
+               isb\r
+       }\r
+\r
+       return ulReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static portFORCE_INLINE void vPortYield( void )\r
+{\r
+       /* Set a PendSV to request a context switch. */\r
+       portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;\r
+\r
+       /* Barriers are normally not required but do ensure the code is completely\r
+       within the specified behaviour for the architecture. */\r
+       __dsb( portSY_FULL_READ_WRITE );\r
+       __isb( portSY_FULL_READ_WRITE );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
 #ifdef __cplusplus\r
 }\r
 #endif\r
index 35c3e8b700e55a415fef776a265462c5ab058cad..cadae7a3b9d262d6dc5b3f4f3291b9da303fdabe 100644 (file)
@@ -82,7 +82,7 @@
 #define portNVIC_SYSTICK_PRI           ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24 )\r
 \r
 /* Masks off all bits but the VECTACTIVE bits in the ICSR register. */\r
-#define portVECTACTIVE_MASK                                    ( 0x1FUL )\r
+#define portVECTACTIVE_MASK                    ( 0xFFUL )\r
 \r
 /* Constants required to manipulate the VFP. */\r
 #define portFPCCR                                      ( ( volatile uint32_t * ) 0xe000ef34 ) /* Floating point context control register. */\r
index 5ef81adc43092d65be027fbc2763229bcfe65aba..a7c6e749c54dd4cf55fc7f12fa51d127058d197d 100644 (file)
@@ -1377,8 +1377,8 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
        {\r
                taskENTER_CRITICAL();\r
                {\r
-                       /* Is there data in the queue now?  To be running we must be\r
-                       the highest priority task wanting to access the queue. */\r
+                       /* Is there data in the queue now?  To be running the calling task\r
+                       must be the highest priority task wanting to access the queue. */\r
                        if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 )\r
                        {\r
                                /* Remember the read position in case the queue is only being\r
index ddee4e4de750cd3a2f5c196b008566ff07633b9d..74edf06e1f6598dd08fbe006488707dd4daac153 100644 (file)
@@ -114,6 +114,14 @@ functions but without including stdio.h here. */
        #define taskYIELD_IF_USING_PREEMPTION() portYIELD_WITHIN_API()\r
 #endif\r
 \r
+/* Value that can be assigned to the eNotifyState member of the TCB. */\r
+typedef enum\r
+{\r
+       eNotWaitingNotification,\r
+       eWaitingNotification,\r
+       eNotified\r
+} eNotifyValue;\r
+\r
 /*\r
  * Task control block.  A task control block (TCB) is allocated for each task,\r
  * and stores task state information, including a pointer to the task's context\r
@@ -170,6 +178,11 @@ typedef struct tskTaskControlBlock
                struct  _reent xNewLib_reent;\r
        #endif\r
 \r
+       #if ( configUSE_TASK_NOTIFICATIONS == 1 )\r
+               uint32_t ulNotifiedValue;\r
+               eNotifyValue eNotifyState;\r
+       #endif\r
+\r
 } tskTCB;\r
 \r
 /* The old tskTCB name is maintained above then typedefed to the new TCB_t name\r
@@ -228,8 +241,8 @@ PRIVILEGED_DATA static UBaseType_t uxTaskNumber                                     = ( UBaseType_t ) 0U;
 PRIVILEGED_DATA static volatile TickType_t xNextTaskUnblockTime                = portMAX_DELAY;\r
 \r
 /* Context switches are held pending while the scheduler is suspended.  Also,\r
-interrupts must not manipulate the xStateListItem of a TCB, or any of the\r
-lists the xStateListItem can be referenced from, if the scheduler is suspended.\r
+interrupts must not manipulate the xGenericListItem of a TCB, or any of the\r
+lists the xGenericListItem can be referenced from, if the scheduler is suspended.\r
 If an interrupt needs to unblock a task while the scheduler is suspended then it\r
 moves the task's event list item into the xPendingReadyList, ready for the\r
 kernel to move the task from the pending ready list into the real ready list\r
@@ -515,6 +528,15 @@ static TCB_t *prvAllocateTCBAndStack( const uint16_t usStackDepth, StackType_t *
  */\r
 static void prvResetNextTaskUnblockTime( void );\r
 \r
+#if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) )\r
+\r
+       /*\r
+        * Helper function used to pad task names with spaces when printing out\r
+        * human readable tables of task information.\r
+        */\r
+       static char *prvWriteNameToBuffer( char *pcBuffer, const char *pcTaskName );\r
+\r
+#endif\r
 /*-----------------------------------------------------------*/\r
 \r
 BaseType_t xTaskGenericCreate( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, StackType_t * const puxStackBuffer, const MemoryRegion_t * const xRegions ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
@@ -995,7 +1017,7 @@ TCB_t * pxNewTCB;
                                }\r
                        #endif\r
 \r
-                       else\r
+                       else /*lint !e525 Negative indentation is intended to make use of pre-processor clearer. */\r
                        {\r
                                /* If the task is not in any other state, it must be in the\r
                                Ready (including pending ready) state. */\r
@@ -1031,6 +1053,46 @@ TCB_t * pxNewTCB;
 #endif /* INCLUDE_uxTaskPriorityGet */\r
 /*-----------------------------------------------------------*/\r
 \r
+#if ( INCLUDE_uxTaskPriorityGet == 1 )\r
+\r
+       UBaseType_t uxTaskPriorityGetFromISR( TaskHandle_t xTask )\r
+       {\r
+       TCB_t *pxTCB;\r
+       UBaseType_t uxReturn, uxSavedInterruptState;\r
+\r
+               /* RTOS ports that support interrupt nesting have the concept of a\r
+               maximum system call (or maximum API call) interrupt priority.\r
+               Interrupts that are     above the maximum system call priority are keep\r
+               permanently enabled, even when the RTOS kernel is in a critical section,\r
+               but cannot make any calls to FreeRTOS API functions.  If configASSERT()\r
+               is defined in FreeRTOSConfig.h then\r
+               portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion\r
+               failure if a FreeRTOS API function is called from an interrupt that has\r
+               been assigned a priority above the configured maximum system call\r
+               priority.  Only FreeRTOS functions that end in FromISR can be called\r
+               from interrupts that have been assigned a priority at or (logically)\r
+               below the maximum system call interrupt priority.  FreeRTOS maintains a\r
+               separate interrupt safe API to ensure interrupt entry is as fast and as\r
+               simple as possible.  More information (albeit Cortex-M specific) is\r
+               provided on the following link:\r
+               http://www.freertos.org/RTOS-Cortex-M3-M4.html */\r
+               portASSERT_IF_INTERRUPT_PRIORITY_INVALID();\r
+\r
+               uxSavedInterruptState = portSET_INTERRUPT_MASK_FROM_ISR();\r
+               {\r
+                       /* If null is passed in here then we are changing the\r
+                       priority of the calling function. */\r
+                       pxTCB = prvGetTCBFromHandle( xTask );\r
+                       uxReturn = pxTCB->uxPriority;\r
+               }\r
+               portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptState );\r
+\r
+               return uxReturn;\r
+       }\r
+\r
+#endif /* INCLUDE_uxTaskPriorityGet */\r
+/*-----------------------------------------------------------*/\r
+\r
 #if ( INCLUDE_vTaskPrioritySet == 1 )\r
 \r
        void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority )\r
@@ -1614,8 +1676,8 @@ BaseType_t xAlreadyYielded = pdFALSE;
                                        ( void ) uxListRemove( &( pxTCB->xGenericListItem ) );\r
                                        prvAddTaskToReadyList( pxTCB );\r
 \r
-                                       /* If we have moved a task that has a priority higher than\r
-                                       the current task then we should yield. */\r
+                                       /* If the moved task has a priority higher than the current\r
+                                       task then a yield must be performed. */\r
                                        if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )\r
                                        {\r
                                                xYieldPending = pdTRUE;\r
@@ -1884,7 +1946,7 @@ BaseType_t xSwitchRequired = pdFALSE;
                        /* See if this tick has made a timeout expire.  Tasks are stored in\r
                        the     queue in the order of their wake time - meaning once one task\r
                        has been found whose block time has not expired there is no need to\r
-                       look any further        down the list. */\r
+                       look any further down the list. */\r
                        if( xConstTickCount >= xNextTaskUnblockTime )\r
                        {\r
                                for( ;; )\r
@@ -2395,6 +2457,20 @@ BaseType_t xReturn;
                xReturn = pdFALSE;\r
        }\r
 \r
+       #if( configUSE_TICKLESS_IDLE == 1 )\r
+       {\r
+               /* If a task is blocked on a kernel object then xNextTaskUnblockTime\r
+               might be set to the blocked task's time out time.  If the task is\r
+               unblocked for a reason other than a timeout xNextTaskUnblockTime is\r
+               normally left unchanged, because it is automatically get reset to a new\r
+               value when the tick count equals xNextTaskUnblockTime.  However if\r
+               tickless idling is used it might be more important to enter sleep mode\r
+               at the earliest possible time - so reset xNextTaskUnblockTime here to\r
+               ensure it is updated at the earliest possible time. */\r
+               prvResetNextTaskUnblockTime();\r
+       }\r
+       #endif\r
+\r
        return xReturn;\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -2788,6 +2864,13 @@ UBaseType_t x;
        }\r
        #endif /* portUSING_MPU_WRAPPERS */\r
 \r
+       #if ( configUSE_TASK_NOTIFICATIONS == 1 )\r
+       {\r
+               pxTCB->ulNotifiedValue = 0;\r
+               pxTCB->eNotifyState = eNotWaitingNotification;\r
+       }\r
+       #endif\r
+\r
        #if ( configUSE_NEWLIB_REENTRANT == 1 )\r
        {\r
                /* Initialise this task's Newlib reent structure. */\r
@@ -3416,6 +3499,32 @@ TCB_t *pxTCB;
 #endif /* portCRITICAL_NESTING_IN_TCB */\r
 /*-----------------------------------------------------------*/\r
 \r
+#if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) )\r
+\r
+       static char *prvWriteNameToBuffer( char *pcBuffer, const char *pcTaskName )\r
+       {\r
+       BaseType_t x;\r
+\r
+               /* Start by copying the entire string. */\r
+               strcpy( pcBuffer, pcTaskName );\r
+\r
+               /* Pad the end of the string with spaces to ensure columns line up when\r
+               printed out. */\r
+               for( x = strlen( pcBuffer ); x < configMAX_TASK_NAME_LEN; x++ )\r
+               {\r
+                       pcBuffer[ x ] = ' ';\r
+               }\r
+\r
+               /* Terminate. */\r
+               pcBuffer[ x ] = 0x00;\r
+\r
+               /* Return the new end of string. */\r
+               return &( pcBuffer[ x ] );\r
+       }\r
+\r
+#endif /* ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) */\r
+/*-----------------------------------------------------------*/\r
+\r
 #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) )\r
 \r
        void vTaskList( char * pcWriteBuffer )\r
@@ -3487,7 +3596,12 @@ TCB_t *pxTCB;
                                                                        break;\r
                                }\r
 \r
-                               sprintf( pcWriteBuffer, "%s\t\t%c\t%u\t%u\t%u\r\n", pxTaskStatusArray[ x ].pcTaskName, cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );\r
+                               /* Write the task name to the string, padding with spaces so it\r
+                               can be printed in tabular form more easily. */\r
+                               pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName );\r
+\r
+                               /* Write the rest of the string. */\r
+                               sprintf( pcWriteBuffer, "\t\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );\r
                                pcWriteBuffer += strlen( pcWriteBuffer );\r
                        }\r
 \r
@@ -3573,15 +3687,20 @@ TCB_t *pxTCB;
 \r
                                        if( ulStatsAsPercentage > 0UL )\r
                                        {\r
+                                               /* Write the task name to the string, padding with\r
+                                               spaces so it can be printed in tabular form more\r
+                                               easily. */\r
+                                               pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName );\r
+\r
                                                #ifdef portLU_PRINTF_SPECIFIER_REQUIRED\r
                                                {\r
-                                                       sprintf( pcWriteBuffer, "%s\t\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );\r
+                                                       sprintf( pcWriteBuffer, "\t\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );\r
                                                }\r
                                                #else\r
                                                {\r
                                                        /* sizeof( int ) == sizeof( long ) so a smaller\r
                                                        printf() library can be used. */\r
-                                                       sprintf( pcWriteBuffer, "%s\t\t%u\t\t%u%%\r\n", pxTaskStatusArray[ x ].pcTaskName, ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );\r
+                                                       sprintf( pcWriteBuffer, "\t\t%u\t\t%u%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );\r
                                                }\r
                                                #endif\r
                                        }\r
@@ -3651,7 +3770,433 @@ TickType_t uxReturn;
        }\r
 \r
 #endif /* configUSE_MUTEXES */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( configUSE_TASK_NOTIFICATIONS == 1 )\r
+\r
+       uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait )\r
+       {\r
+       TickType_t xTimeToWake;\r
+       uint32_t ulReturn;\r
+\r
+               taskENTER_CRITICAL();\r
+               {\r
+                       /* Only block if the notification count is not already non-zero. */\r
+                       if( pxCurrentTCB->ulNotifiedValue == 0UL )\r
+                       {\r
+                               /* Mark this task as waiting for a notification. */\r
+                               pxCurrentTCB->eNotifyState = eWaitingNotification;\r
+\r
+                               if( xTicksToWait > 0 )\r
+                               {\r
+                                       /* The task is going to block.  First it must be removed\r
+                                       from the ready list. */\r
+                                       if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 )\r
+                                       {\r
+                                               /* The current task must be in a ready list, so there is\r
+                                               no need to check, and the port reset macro can be called\r
+                                               directly. */\r
+                                               portRESET_READY_PRIORITY( pxCurrentTCB->uxPriority, uxTopReadyPriority );\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               mtCOVERAGE_TEST_MARKER();\r
+                                       }\r
+\r
+                                       #if ( INCLUDE_vTaskSuspend == 1 )\r
+                                       {\r
+                                               if( xTicksToWait == portMAX_DELAY )\r
+                                               {\r
+                                                       /* Add the task to the suspended task list instead\r
+                                                       of a delayed task list to ensure the task is not\r
+                                                       woken by a timing event.  It will block\r
+                                                       indefinitely. */\r
+                                                       vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xGenericListItem ) );\r
+                                               }\r
+                                               else\r
+                                               {\r
+                                                       /* Calculate the time at which the task should be\r
+                                                       woken if no notification events occur.  This may\r
+                                                       overflow but this doesn't matter, the scheduler will\r
+                                                       handle it. */\r
+                                                       xTimeToWake = xTickCount + xTicksToWait;\r
+                                                       prvAddCurrentTaskToDelayedList( xTimeToWake );\r
+                                               }\r
+                                       }\r
+                                       #else /* INCLUDE_vTaskSuspend */\r
+                                       {\r
+                                                       /* Calculate the time at which the task should be\r
+                                                       woken if the event does not occur.  This may\r
+                                                       overflow but this doesn't matter, the scheduler will\r
+                                                       handle it. */\r
+                                                       xTimeToWake = xTickCount + xTicksToWait;\r
+                                                       prvAddCurrentTaskToDelayedList( xTimeToWake );\r
+                                       }\r
+                                       #endif /* INCLUDE_vTaskSuspend */\r
+\r
+                                       /* All ports are written to allow a yield in a critical\r
+                                       section (some will yield immediately, others wait until the\r
+                                       critical section exits) - but it is not something that\r
+                                       application code should ever do. */\r
+                                       portYIELD_WITHIN_API();\r
+                               }\r
+                               else\r
+                               {\r
+                                       mtCOVERAGE_TEST_MARKER();\r
+                               }\r
+                       }\r
+                       else\r
+                       {\r
+                               mtCOVERAGE_TEST_MARKER();\r
+                       }\r
+               }\r
+               taskEXIT_CRITICAL();\r
+\r
+               taskENTER_CRITICAL();\r
+               {\r
+                       ulReturn = pxCurrentTCB->ulNotifiedValue;\r
+\r
+                       if( ulReturn != 0 )\r
+                       {\r
+                               if( xClearCountOnExit != pdFALSE )\r
+                               {\r
+                                       pxCurrentTCB->ulNotifiedValue = 0UL;\r
+                               }\r
+                               else\r
+                               {\r
+                                       ( pxCurrentTCB->ulNotifiedValue )--;\r
+                               }\r
+                       }\r
+                       else\r
+                       {\r
+                               mtCOVERAGE_TEST_MARKER();\r
+                       }\r
+\r
+                       pxCurrentTCB->eNotifyState = eNotWaitingNotification;\r
+               }\r
+               taskEXIT_CRITICAL();\r
+\r
+               return ulReturn;\r
+       }\r
+\r
+#endif /* configUSE_TASK_NOTIFICATIONS */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( configUSE_TASK_NOTIFICATIONS == 1 )\r
+\r
+       BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, BaseType_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait )\r
+       {\r
+       TickType_t xTimeToWake;\r
+       BaseType_t xReturn;\r
+\r
+               taskENTER_CRITICAL();\r
+               {\r
+                       /* Only block if a notification is not already pending. */\r
+                       if( pxCurrentTCB->eNotifyState != eNotified )\r
+                       {\r
+                               /* Clear bits in the task's notification value as bits may get\r
+                               set     by the notifying task or interrupt.  This can be used to\r
+                               clear the value to zero. */\r
+                               pxCurrentTCB->ulNotifiedValue &= ~ulBitsToClearOnEntry;\r
+\r
+                               /* Mark this task as waiting for a notification. */\r
+                               pxCurrentTCB->eNotifyState = eWaitingNotification;\r
+\r
+                               if( xTicksToWait > 0 )\r
+                               {\r
+                                       /* The task is going to block.  First it must be removed\r
+                                       from the        ready list. */\r
+                                       if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 )\r
+                                       {\r
+                                               /* The current task must be in a ready list, so there is\r
+                                               no need to check, and the port reset macro can be called\r
+                                               directly. */\r
+                                               portRESET_READY_PRIORITY( pxCurrentTCB->uxPriority, uxTopReadyPriority );\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               mtCOVERAGE_TEST_MARKER();\r
+                                       }\r
+\r
+                                       #if ( INCLUDE_vTaskSuspend == 1 )\r
+                                       {\r
+                                               if( xTicksToWait == portMAX_DELAY )\r
+                                               {\r
+                                                       /* Add the task to the suspended task list instead\r
+                                                       of a delayed task list to ensure the task is not\r
+                                                       woken by a timing event.  It will block\r
+                                                       indefinitely. */\r
+                                                       vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xGenericListItem ) );\r
+                                               }\r
+                                               else\r
+                                               {\r
+                                                       /* Calculate the time at which the task should be\r
+                                                       woken if no notification events occur.  This may\r
+                                                       overflow but this doesn't matter, the scheduler will\r
+                                                       handle it. */\r
+                                                       xTimeToWake = xTickCount + xTicksToWait;\r
+                                                       prvAddCurrentTaskToDelayedList( xTimeToWake );\r
+                                               }\r
+                                       }\r
+                                       #else /* INCLUDE_vTaskSuspend */\r
+                                       {\r
+                                                       /* Calculate the time at which the task should be\r
+                                                       woken if the event does not occur.  This may\r
+                                                       overflow but this doesn't matter, the scheduler will\r
+                                                       handle it. */\r
+                                                       xTimeToWake = xTickCount + xTicksToWait;\r
+                                                       prvAddCurrentTaskToDelayedList( xTimeToWake );\r
+                                       }\r
+                                       #endif /* INCLUDE_vTaskSuspend */\r
+\r
+                                       /* All ports are written to allow a yield in a critical\r
+                                       section (some will yield immediately, others wait until the\r
+                                       critical section exits) - but it is not something that\r
+                                       application code should ever do. */\r
+                                       portYIELD_WITHIN_API();\r
+                               }\r
+                               else\r
+                               {\r
+                                       mtCOVERAGE_TEST_MARKER();\r
+                               }\r
+                       }\r
+                       else\r
+                       {\r
+                               mtCOVERAGE_TEST_MARKER();\r
+                       }\r
+               }\r
+               taskEXIT_CRITICAL();\r
+\r
+               taskENTER_CRITICAL();\r
+               {\r
+                       if( pulNotificationValue != NULL )\r
+                       {\r
+                               /* Output the current notification value, which may or may not\r
+                               have changed. */\r
+                               *pulNotificationValue = pxCurrentTCB->ulNotifiedValue;\r
+                       }\r
+\r
+                       /* If eNotifyValue is set then either the task never entered the\r
+                       blocked state (because a notification was already pending) or the\r
+                       task unblocked because of a notification.  Otherwise the task\r
+                       unblocked because of a timeout. */\r
+                       if( pxCurrentTCB->eNotifyState == eWaitingNotification )\r
+                       {\r
+                               /* A notification was not received. */\r
+                               xReturn = pdFALSE;\r
+                       }\r
+                       else\r
+                       {\r
+                               /* A notification was already pending or a notification was\r
+                               received while the task was waiting. */\r
+                               pxCurrentTCB->ulNotifiedValue &= ~ulBitsToClearOnExit;\r
+                               xReturn = pdTRUE;\r
+                       }\r
+\r
+                       pxCurrentTCB->eNotifyState = eNotWaitingNotification;\r
+               }\r
+               taskEXIT_CRITICAL();\r
+\r
+               return xReturn;\r
+       }\r
+\r
+#endif /* configUSE_TASK_NOTIFICATIONS */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( configUSE_TASK_NOTIFICATIONS == 1 )\r
+\r
+       BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction )\r
+       {\r
+       TCB_t * pxTCB;\r
+       eNotifyValue eOriginalNotifyState;\r
+       BaseType_t xReturn = pdPASS;\r
+\r
+               configASSERT( xTaskToNotify );\r
+               pxTCB = ( TCB_t * ) xTaskToNotify;\r
+\r
+               taskENTER_CRITICAL();\r
+               {\r
+                       eOriginalNotifyState = pxTCB->eNotifyState;\r
+\r
+                       pxTCB->eNotifyState = eNotified;\r
+\r
+                       switch( eAction )\r
+                       {\r
+                               case eSetBits   :\r
+                                       pxTCB->ulNotifiedValue |= ulValue;\r
+                                       break;\r
+\r
+                               case eIncrement :\r
+                                       ( pxTCB->ulNotifiedValue )++;\r
+                                       break;\r
+\r
+                               case eSetValueWithOverwrite     :\r
+                                       pxTCB->ulNotifiedValue = ulValue;\r
+                                       break;\r
+\r
+                               case eSetValueWithoutOverwrite :\r
+                                       if( eOriginalNotifyState != eNotified )\r
+                                       {\r
+                                               pxTCB->ulNotifiedValue = ulValue;\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               /* The value could not be written to the task. */\r
+                                               xReturn = pdFAIL;\r
+                                       }\r
+                                       break;\r
+\r
+                               default :\r
+                                       /* The task is being notified without its notify value being\r
+                                       updated. */\r
+                                       break;\r
+                       }\r
+\r
+\r
+                       /* If the task is in the blocked state specifically to wait for a\r
+                       notification then unblock it now. */\r
+                       if( eOriginalNotifyState == eWaitingNotification )\r
+                       {\r
+                               ( void ) uxListRemove( &( pxTCB->xGenericListItem ) );\r
+                               prvAddTaskToReadyList( pxTCB );\r
+\r
+                               /* The task should not have been on an event list. */\r
+                               configASSERT( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) == NULL );\r
+\r
+                               if( pxTCB->uxPriority > pxCurrentTCB->uxPriority )\r
+                               {\r
+                                       /* The notified task has a priority above the currently\r
+                                       executing task so a yield is required. */\r
+                                       portYIELD_WITHIN_API();\r
+                               }\r
+                               else\r
+                               {\r
+                                       mtCOVERAGE_TEST_MARKER();\r
+                               }\r
+                       }\r
+                       else\r
+                       {\r
+                               mtCOVERAGE_TEST_MARKER();\r
+                       }\r
+               }\r
+               taskEXIT_CRITICAL();\r
+\r
+               return xReturn;\r
+       }\r
+\r
+#endif /* configUSE_TASK_NOTIFICATIONS */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( configUSE_TASK_NOTIFICATIONS == 1 )\r
+\r
+       BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken )\r
+       {\r
+       TCB_t * pxTCB;\r
+       eNotifyValue eOriginalNotifyState;\r
+       BaseType_t xReturn = pdPASS;\r
+       UBaseType_t uxSavedInterruptStatus;\r
+\r
+               configASSERT( xTaskToNotify );\r
+\r
+               /* RTOS ports that support interrupt nesting have the concept of a\r
+               maximum system call (or maximum API call) interrupt priority.\r
+               Interrupts that are     above the maximum system call priority are keep\r
+               permanently enabled, even when the RTOS kernel is in a critical section,\r
+               but cannot make any calls to FreeRTOS API functions.  If configASSERT()\r
+               is defined in FreeRTOSConfig.h then\r
+               portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion\r
+               failure if a FreeRTOS API function is called from an interrupt that has\r
+               been assigned a priority above the configured maximum system call\r
+               priority.  Only FreeRTOS functions that end in FromISR can be called\r
+               from interrupts that have been assigned a priority at or (logically)\r
+               below the maximum system call interrupt priority.  FreeRTOS maintains a\r
+               separate interrupt safe API to ensure interrupt entry is as fast and as\r
+               simple as possible.  More information (albeit Cortex-M specific) is\r
+               provided on the following link:\r
+               http://www.freertos.org/RTOS-Cortex-M3-M4.html */\r
+               portASSERT_IF_INTERRUPT_PRIORITY_INVALID();\r
+\r
+               pxTCB = ( TCB_t * ) xTaskToNotify;\r
+\r
+               uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
+               {\r
+                       eOriginalNotifyState = pxTCB->eNotifyState;\r
+\r
+                       pxTCB->eNotifyState = eNotified;\r
+\r
+                       switch( eAction )\r
+                       {\r
+                               case eSetBits   :\r
+                                       pxTCB->ulNotifiedValue |= ulValue;\r
+                                       break;\r
+\r
+                               case eIncrement :\r
+                                       ( pxTCB->ulNotifiedValue )++;\r
+                                       break;\r
+\r
+                               case eSetValueWithOverwrite     :\r
+                                       pxTCB->ulNotifiedValue = ulValue;\r
+                                       break;\r
+\r
+                               case eSetValueWithoutOverwrite :\r
+                                       if( eOriginalNotifyState != eNotified )\r
+                                       {\r
+                                               pxTCB->ulNotifiedValue = ulValue;\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               /* The value could not be written to the task. */\r
+                                               xReturn = pdFAIL;\r
+                                       }\r
+                                       break;\r
+\r
+                               default :\r
+                                       /* The task is being notified without its notify value being\r
+                                       updated. */\r
+                                       break;\r
+                       }\r
+\r
+\r
+                       /* If the task is in the blocked state specifically to wait for a\r
+                       notification then unblock it now. */\r
+                       if( eOriginalNotifyState == eWaitingNotification )\r
+                       {\r
+                               /* The task should not have been on an event list. */\r
+                               configASSERT( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) == NULL );\r
+\r
+                               if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE )\r
+                               {\r
+                                       ( void ) uxListRemove( &( pxTCB->xGenericListItem ) );\r
+                                       prvAddTaskToReadyList( pxTCB );\r
+                               }\r
+                               else\r
+                               {\r
+                                       /* The delayed and ready lists cannot be accessed, so hold\r
+                                       this task pending until the scheduler is resumed. */\r
+                                       vListInsertEnd( &( xPendingReadyList ), &( pxTCB->xEventListItem ) );\r
+                               }\r
+\r
+                               if( pxTCB->uxPriority > pxCurrentTCB->uxPriority )\r
+                               {\r
+                                       /* The notified task has a priority above the currently\r
+                                       executing task so a yield is required. */\r
+                                       if( pxHigherPriorityTaskWoken != NULL )\r
+                                       {\r
+                                               *pxHigherPriorityTaskWoken = pdTRUE;\r
+                                       }\r
+                               }\r
+                               else\r
+                               {\r
+                                       mtCOVERAGE_TEST_MARKER();\r
+                               }\r
+                       }\r
+               }\r
+               portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );\r
+\r
+               return xReturn;\r
+       }\r
 \r
+#endif /* configUSE_TASK_NOTIFICATIONS */\r
 /*-----------------------------------------------------------*/\r
 \r
 #ifdef FREERTOS_MODULE_TEST\r