]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcBase.h
Update to latest FreeRTOS+Trace recorder code.
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-Trace / Include / trcBase.h
index 4ffd55c6a84bf19c4e05502b14a7fec40feff125..9196f73d299a807c98598222fdf71e5a5a691b7b 100644 (file)
 /*******************************************************************************\r
- * FreeRTOS+Trace v2.3.0 Recorder Library\r
+ * Tracealyzer v2.4.1 Recorder Library\r
  * Percepio AB, www.percepio.com\r
  *\r
  * trcBase.h\r
  *\r
- * Core functionallity of the FreeRTOS+Trace recorder library.\r
+ * Core functionality of the Tracealyzer recorder library.\r
  *\r
  * Terms of Use\r
  * This software is copyright Percepio AB. The recorder library is free for\r
  * use together with Percepio products. You may distribute the recorder library\r
- * in its original form, including modifications in trcPort.c and trcPort.h\r
+ * in its original form, including modifications in trcHardwarePort.c/.h\r
  * given that these modification are clearly marked as your own modifications\r
- * and documented in the initial comment section of these source files. \r
- * This software is the intellectual property of Percepio AB and may not be \r
- * sold or in other ways commercially redistributed without explicit written \r
+ * and documented in the initial comment section of these source files.\r
+ * This software is the intellectual property of Percepio AB and may not be\r
+ * sold or in other ways commercially redistributed without explicit written\r
  * permission by Percepio AB.\r
  *\r
- * Disclaimer \r
- * The trace tool and recorder library is being delivered to you AS IS and \r
- * Percepio AB makes no warranty as to its use or performance. Percepio AB does \r
- * not and cannot warrant the performance or results you may obtain by using the \r
- * software or documentation. Percepio AB make no warranties, express or \r
- * implied, as to noninfringement of third party rights, merchantability, or \r
- * fitness for any particular purpose. In no event will Percepio AB, its \r
- * technology partners, or distributors be liable to you for any consequential, \r
- * incidental or special damages, including any lost profits or lost savings, \r
- * even if a representative of Percepio AB has been advised of the possibility \r
- * of such damages, or for any claim by any third party. Some jurisdictions do \r
- * not allow the exclusion or limitation of incidental, consequential or special \r
- * damages, or the exclusion of implied warranties or limitations on how long an \r
+ * Disclaimer\r
+ * The trace tool and recorder library is being delivered to you AS IS and\r
+ * Percepio AB makes no warranty as to its use or performance. Percepio AB does\r
+ * not and cannot warrant the performance or results you may obtain by using the\r
+ * software or documentation. Percepio AB make no warranties, express or\r
+ * implied, as to noninfringement of third party rights, merchantability, or\r
+ * fitness for any particular purpose. In no event will Percepio AB, its\r
+ * technology partners, or distributors be liable to you for any consequential,\r
+ * incidental or special damages, including any lost profits or lost savings,\r
+ * even if a representative of Percepio AB has been advised of the possibility\r
+ * of such damages, or for any claim by any third party. Some jurisdictions do\r
+ * not allow the exclusion or limitation of incidental, consequential or special\r
+ * damages, or the exclusion of implied warranties or limitations on how long an\r
  * implied warranty may last, so the above limitations may not apply to you.\r
- * \r
- * FreeRTOS+Trace is available as Free Edition and in two premium editions.\r
- * You may use the premium features during 30 days for evaluation.\r
- * Download FreeRTOS+Trace at http://www.percepio.com/products/downloads/\r
  *\r
- * Copyright Percepio AB, 2012.\r
+ * Copyright Percepio AB, 2013.\r
  * www.percepio.com\r
  ******************************************************************************/\r
 \r
 #ifndef TRCBASE_H\r
 #define TRCBASE_H\r
 \r
+#define TRACE_MINOR_VERSION 2\r
+#define TRACE_STORE_MODE_STOP_WHEN_FULL 1\r
+#define TRACE_STORE_MODE_RING_BUFFER 2\r
+#define TRACE_DATA_ALLOCATION_STATIC 1\r
+#define TRACE_DATA_ALLOCATION_DYNAMIC 2\r
+#define TRACE_DATA_ALLOCATION_CUSTOM 3\r
+\r
+#include "trcKernelPort.h"\r
+\r
+#if (USE_TRACEALYZER_RECORDER == 1)\r
+\r
 #include <stdio.h>\r
 #include <string.h>\r
 \r
-#include "FreeRTOS.h"\r
-#include "trcConfig.h"\r
-#include "trcTypes.h"\r
-#include "trcPort.h"\r
+#ifndef USE_SEPARATE_USER_EVENT_BUFFER\r
+#define USE_SEPARATE_USER_EVENT_BUFFER 0\r
+#endif\r
 \r
-extern volatile int recorder_busy;\r
+/* Max number of event codes supported */\r
+#define NEventCodes 0x100\r
 \r
-#define trcCRITICAL_SECTION_BEGIN() {taskENTER_CRITICAL(); recorder_busy++;}\r
-#define trcCRITICAL_SECTION_END() {recorder_busy--; taskEXIT_CRITICAL();}\r
+extern volatile int recorder_busy; // This is used to keep track of the recorder's critical sections, to determine if it is busy\r
+// Our local critical sections for the recorder - updates an internal busy flag\r
+#define trcCRITICAL_SECTION_BEGIN() {TRACE_ENTER_CRITICAL_SECTION(); recorder_busy++;}\r
+#define trcCRITICAL_SECTION_END() {recorder_busy--; TRACE_EXIT_CRITICAL_SECTION();}\r
 \r
-#define NCLASSES 5\r
-#define VERSION 0x1AA1\r
-#define MINOR_VERSION 1\r
-#define STORE_MODE_STOP_WHEN_FULL 1\r
-#define STORE_MODE_RING_BUFFER 2\r
-#define TRACE_DATA_ALLOCATION_STATIC 1\r
-#define TRACE_DATA_ALLOCATION_DYNAMIC 2\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
+extern uint8_t excludedObjects[(TRACE_KERNEL_OBJECT_COUNT + TRACE_NCLASSES) / 8 + 1];\r
+\r
+/* Structure to handle the exclude flags for all event codes */\r
+extern uint8_t excludedEventCodes[NEventCodes / 8 + 1];\r
+\r
+/******************************************************************************\r
+ * ObjectHandleStack\r
+ * This data-structure is used to provide a mechanism for 1-byte trace object\r
+ * handles. This way, only 1 byte is necessary instead of 4 bytes (a pointer)\r
+ * when storing a reference to an object. This allows for up to 255 objects of\r
+ * each object class active at any given moment. There can be more "historic"\r
+ * objects, that have been deleted - that number is only limited by the size of\r
+ * the symbol table.\r
+ * Note that handle zero (0) is not used, it is a code for an invalid handle.\r
+ *\r
+ * This data structure keeps track of the FREE handles, not the handles in use.\r
+ * This data structure contains one stack per object class. When a handle is\r
+ * allocated to an object, the next free handle is popped from the stack. When\r
+ * a handle is released (on object delete), it is pushed back on the stack.\r
+ * Note that there is no initialization code that pushed the free handles\r
+ * initially, that is not necessary due to the following optimization:\r
+ *\r
+ * The stack of handles (objectHandles) is initially all zeros. Since zero\r
+ * is not a valid handle, that is a signal of additional handles needed.\r
+ * If a zero is received when popping a new handle, it is replaced by the\r
+ * index of the popped handle instead.\r
+ *\r
+ *****************************************************************************/\r
+typedef struct\r
+{\r
+    /* For each object class, the index of the next handle to allocate */\r
+    int16_t indexOfNextAvailableHandle[ TRACE_NCLASSES ];\r
+\r
+    /* The lowest index of this class (constant) */\r
+    int16_t lowestIndexOfClass[ TRACE_NCLASSES ];\r
+\r
+    /* The highest index of this class (constant) */\r
+    int16_t highestIndexOfClass[ TRACE_NCLASSES ];\r
+\r
+    /* The highest use count for this class (for statistics) */\r
+    int16_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
+\r
+} objectHandleStackType;\r
+\r
+extern objectHandleStackType objectHandleStacks;\r
 \r
 /******************************************************************************\r
  * Object Property Table\r
@@ -69,96 +120,67 @@ extern volatile int recorder_busy;
  * queues, mutexes, etc). The below data structures defines the properties of\r
  * each object class and are used to cast the byte buffer into a cleaner format.\r
  *\r
- * The values in the object table are continously overwritten and always \r
- * represent the current state. If a property is changed during runtime, the OLD \r
- * value should be stored in the trace buffer, not the new value (since the new \r
+ * The values in the object table are continuously overwritten and always\r
+ * represent the current state. If a property is changed during runtime, the OLD\r
+ * value should be stored in the trace buffer, not the new value (since the new\r
  * value is found in the Object Property Table).\r
  * For close events this mechanism is the old names are stored in the symbol\r
  * table), for "priority set" (the old priority is stored in the event data)\r
- * and for "isActive", where the value decides is the taskswitch event type\r
+ * and for "isActive", where the value decides if the task switch event type\r
  * should be "new" or "resume".\r
  ******************************************************************************/\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: InstanceFinishEvent_ServiceCode\r
-                                       Byte 3: InstanceFinishEvent_ObjHandle */\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
-/* 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 DynObjTableSize            StartIndexISR       + NISR * PropertyTableSizeISR\r
-\r
 typedef struct\r
 {\r
     /* = NCLASSES */\r
     uint32_t NumberOfObjectClasses;\r
-    \r
+\r
     uint32_t ObjectPropertyTableSizeInBytes;\r
-        \r
-    /* This is used to calculate the index in the dynamic object table \r
+\r
+    /* This is used to calculate the index in the dynamic object table\r
     (handle - 1 - nofStaticObjects = index)*/\r
-    uint8_t NumberOfObjectsPerClass[ 4*((NCLASSES+3)/4)];      \r
+    uint8_t NumberOfObjectsPerClass[ 4*((TRACE_NCLASSES+3)/4)];\r
+\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
 \r
-    /* Allocation size rounded up to the closest multiple of 4 */    \r
-    uint8_t NameLengthPerClass[ 4*((NCLASSES+3)/4) ];\r
-    \r
-    uint8_t TotalPropertyBytesPerClass[ 4*((NCLASSES+3)/4) ];\r
-    \r
     /* Allocation size rounded up to the closest multiple of 2 */\r
-    uint16_t StartIndexOfClass[ 2*((NCLASSES+1)/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*((DynObjTableSize+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
-        \r
+    uint32_t symTableSize;\r
+\r
     /* Entry 0 is reserved. Any reference to entry 0 implies NULL*/\r
-    uint32_t nextFreeSymbolIndex;         \r
-        \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
-        \r
-    /* Used for lookups - Up to 64 linked lists within the symbol table \r
-    connecting all entries with the same 6 bit checksum. \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
+    uint16_t latestEntryOfChecksum[64];\r
 } symbolTableType;\r
 \r
 \r
 /*******************************************************************************\r
- * The data structures of the different events, all 4 bytes long \r
+ * The data structures of the different events, all 4 bytes long\r
  ******************************************************************************/\r
 \r
 typedef struct\r
 {\r
-    uint8_t type;                \r
+    uint8_t type;\r
     objectHandleType objHandle;\r
-    uint16_t dts;    /* differential timestamp - time since last event */            \r
+    uint16_t dts;    /* differential timestamp - time since last event */\r
 } TSEvent, TREvent;\r
 \r
 typedef struct\r
@@ -173,13 +195,13 @@ typedef struct
     uint8_t type;\r
     objectHandleType objHandle;\r
     uint8_t param;\r
-    uint8_t dts;                \r
+    uint8_t dts;\r
 } KernelCallWithParamAndHandle;\r
 \r
 typedef struct\r
 {\r
     uint8_t type;\r
-    uint8_t dts;                \r
+    uint8_t dts;\r
     uint16_t param;\r
 } KernelCallWithParam16;\r
 \r
@@ -193,37 +215,73 @@ typedef struct
 typedef struct\r
 {\r
     uint8_t type;\r
-    uint8_t arg1;            \r
-    uint8_t arg2;        \r
-    uint8_t arg3;        \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
+    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
-    \r
-    /* 8 bits extra for storing DTS, if it does not fit in ordinary event \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
-    \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
+    uint16_t xts_16;\r
 } XTSEvent;\r
 \r
+typedef struct\r
+{\r
+       uint8_t type;\r
+\r
+       uint8_t xps_8;\r
+       uint16_t xps_16;\r
+} XPSEvent;\r
 \r
 /*******************************************************************************\r
- * The main datastructure, read by FreeRTOS+Trace from the RAM dump\r
+ * The separate user event buffer structure. Can be enabled in trcConfig.h.\r
  ******************************************************************************/\r
 \r
+#if (USE_SEPARATE_USER_EVENT_BUFFER == 1)\r
 typedef struct\r
-{    \r
+{\r
+       traceLabel name;\r
+       traceLabel defaultFormat;\r
+} ChannelFormatPair;\r
+\r
+typedef struct\r
+{\r
+       uint16_t bufferID;\r
+       uint16_t version;\r
+       uint32_t wraparoundCounter;\r
+       uint32_t numberOfSlots;\r
+       uint32_t nextSlotToWrite;\r
+       uint8_t numberOfChannels;\r
+       uint8_t padding1;\r
+       uint8_t padding2;\r
+       uint8_t padding3;\r
+       ChannelFormatPair channels[CHANNEL_FORMAT_PAIRS+1];\r
+       uint8_t channelBuffer[(USER_EVENT_BUFFER_SIZE + 3) & 0xFFFFFFFC]; /* 1 byte per slot, with padding for 4 byte alignment */\r
+       uint8_t dataBuffer[USER_EVENT_BUFFER_SIZE * 4]; /* 4 bytes per slot */\r
+\r
+} UserEventBuffer;\r
+#endif\r
+\r
+/*******************************************************************************\r
+ * The main data structure, read by Tracealyzer from the RAM dump\r
+ ******************************************************************************/\r
+\r
+typedef struct\r
+{\r
     uint8_t startmarker0;\r
     uint8_t startmarker1;\r
     uint8_t startmarker2;\r
@@ -237,92 +295,99 @@ typedef struct
     uint8_t startmarker10;\r
     uint8_t startmarker11;\r
 \r
-    /* For FreeRTOS: 0x1AA1 */\r
-    uint16_t version;     \r
-    \r
+    /* Used to determine Kernel and Endianess */\r
+    uint16_t version;\r
+\r
     /* Currently 1 for v2.2.2 (0 earlier)*/\r
     uint8_t minor_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
+\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
+\r
     /* sizeof(RecorderDataType) - just for control */\r
     uint32_t filesize;\r
-            \r
+\r
     /* Current number of events recorded */\r
     uint32_t numEvents;\r
 \r
     /* The buffer size, in number of event records */\r
     uint32_t maxEvents;\r
-        \r
+\r
     /* The event buffer index, where to write the next event */\r
     uint32_t nextFreeIndex;\r
-        \r
+\r
     /* 1 if the buffer is full, 0 otherwise */\r
     uint32_t bufferIsFull;\r
 \r
     /* The frequency of the clock/timer/counter used as time base */\r
     uint32_t frequency;\r
 \r
-    /* The absolute timestamp of the last stored event, in the native \r
+    /* The absolute timestamp of the last stored event, in the native\r
     timebase, modulo frequency! */\r
-    uint32_t absTimeLastEvent;    \r
-    \r
+    uint32_t absTimeLastEvent;\r
+\r
     /* The number of seconds in total - lasts for 136 years */\r
-    uint32_t absTimeLastEventSecond;    \r
-    \r
+    uint32_t absTimeLastEventSecond;\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
+    uint32_t recorderActive;\r
 \r
     /* For storing a Team License key */\r
     uint8_t teamLicenceKey[32];\r
 \r
     /* 0xF0F0F0F0 - for control only */\r
-    int32_t debugMarker0;                    \r
+    int32_t debugMarker0;\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
 \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
+    /* 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 includsion 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 occured 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
+    /* 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
-      \r
-    /* Generic system information string, presented in the tool. Note that this \r
+\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
+    char systemInfo[TRACE_DESCRIPTION_MAX_LENGTH];\r
 \r
     /* 0xF3F3F3F3 - for control only */\r
-    int32_t debugMarker3;                    \r
+    int32_t debugMarker3;\r
 \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
+#endif\r
+\r
+       /* This should always be 0 */\r
+       uint32_t endOfSecondaryBlocks;\r
+\r
     uint8_t endmarker0;\r
     uint8_t endmarker1;\r
     uint8_t endmarker2;\r
@@ -335,103 +400,51 @@ typedef struct
     uint8_t endmarker9;\r
     uint8_t endmarker10;\r
     uint8_t endmarker11;\r
-\r
 } RecorderDataType;\r
 \r
 extern RecorderDataType* RecorderDataPtr;\r
 \r
-/******************************************************************************\r
- * ObjectHandleStack\r
- * This data-structure is used to provide a mechanism for 1-byte trace object\r
- * handles. This way, only 1 byte is necessary instead of 4 bytes (a pointer)\r
- * when storing a reference to an object. This allows for up to 255 objects of\r
- * each object class - Task, ISR, Semaphore, CountingSemaphore, Mutex and Queue,\r
- * active at any given moment. There can be more "historic" objects, that have\r
- * been deleted - that number is only limited by the size of the symbol table.\r
- * Note that handle zero (0) is not used, it is a code for an invalid handle.\r
- *\r
- * This data structure keeps track of the FREE handles, not the handles in use.\r
- * This datastructure contains one stack per object class. When a handle is\r
- * allocated to an object, the next free handle is popped from the stack. When\r
- * a handle is released (on object delete), it is pushed back on the stack.\r
- * Note that there is no initialization code that pushed the free handles\r
- * initially, that is not necessary due to the following optimization:\r
- *\r
- * The stack of handles (objectHandles) is initially all zeros. Since zero\r
- * is not a valid handle, that is a signal of additional handles needed.\r
- * If a zero is received when popping a new handle, it is replaced by the\r
- * index of the popped handle instead.\r
- *\r
- *****************************************************************************/\r
-typedef struct\r
-{\r
-    /* For each object class, the index of the next handle to allocate */\r
-    int16_t indexOfNextAvailableHandle[ NCLASSES ];              \r
-\r
-    /* The lowest index of this class (constant) */        \r
-    int16_t lowestIndexOfClass[ NCLASSES ];                    \r
-        \r
-    /* The highest index of this class (constant) */\r
-    int16_t highestIndexOfClass[ NCLASSES ];    \r
-        \r
-    /* The highest use count for this class (for statistics) */\r
-    int16_t handleCountWaterMarksOfClass[ NCLASSES ];                \r
-        \r
-    /* The free object handles - a set of stacks within this array */\r
-    objectHandleType objectHandles[ NTask+NISR+NSemaphore+NMutex+NQueue ];\r
-\r
-} objectHandleStackType;\r
-\r
-/* Internal data */\r
-\r
-extern objectHandleStackType objectHandleStacks;\r
-\r
-/* Structures to handle the exclude flags for all objects, tasks and event codes */\r
-#define NEventCodes 0x100\r
-extern uint8_t excludedFlags[(NEventCodes+NQueue+NSemaphore+NMutex+NTask) / 8 + 1];\r
-extern uint8_t ifeFlags[NTask / 8 + 1];\r
-\r
 /* Internal functions */\r
 \r
 uint16_t prvTraceGetDTS(uint16_t param_maxDTS);\r
 \r
 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 prvTraceCreateSymbolTableEntry(const char* name,\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 prvTraceLookupSymbolTableEntry(const char* name,\r
+                                          uint8_t crc6,\r
+                                          uint8_t len,\r
                                           traceLabel channel);\r
 \r
 traceLabel prvTraceOpenSymbol(const char* name, traceLabel userEventChannel);\r
 \r
 void prvTraceUpdateCounters(void);\r
 \r
-void prvCheckDataToBeOverwrittenForMultiEntryUserEvents(uint8_t nEntries);\r
+void prvCheckDataToBeOverwrittenForMultiEntryEvents(uint8_t nEntries);\r
 \r
 objectHandleType xTraceGetObjectHandle(traceObjectClass objectclass);\r
 \r
-void vTraceFreeObjectHandle(traceObjectClass objectclass, \r
+void vTraceFreeObjectHandle(traceObjectClass objectclass,\r
                             objectHandleType handle);\r
 \r
-void vTraceSetObjectName(traceObjectClass objectclass, \r
-                         objectHandleType handle, \r
-                         const char* name);\r
+void vTraceSetObjectName(traceObjectClass objectclass,\r
+                           objectHandleType handle,\r
+                           const char* name);\r
 \r
 void* xTraceNextFreeEventBufferSlot(void);\r
 \r
-uint16_t uiIndexOfObject(objectHandleType objecthandle, \r
-    uint8_t objectclass);\r
+uint16_t uiIndexOfObject(objectHandleType objecthandle,\r
+                         uint8_t objectclass);\r
 \r
 \r
 /*******************************************************************************\r
  * vTraceError\r
  *\r
- * Called by various parts in the recorder. Stops the recorder and stores a \r
+ * Called by various parts in the recorder. Stops the recorder and stores a\r
  * pointer to an error message, which is printed by the monitor task.\r
  ******************************************************************************/\r
 void vTraceError(const char* msg);\r
@@ -445,80 +458,48 @@ void vTraceError(const char* msg);
 char* xTraceGetLastError(void);\r
 \r
 /*******************************************************************************\r
- * xTraceInitTraceData\r
+ * prvTraceInitTraceData\r
  *\r
- * Allocates and initializes the recorder datastructure, based on the constants\r
+ * Allocates and initializes the recorder data structure, based on the constants\r
  * in trcConfig.h. This allows for allocating the data on the heap, instead of\r
  * using a static declaration.\r
  ******************************************************************************/\r
-RecorderDataType* xTraceInitTraceData(void);\r
+void prvTraceInitTraceData(void);\r
 \r
 /* Internal macros */\r
 \r
-#define PROPERTY_NAME_GET(objectclass, objecthandle) \\r
+#define TRACE_PROPERTY_NAME_GET(objectclass, objecthandle) \\r
 (const char*)(& RecorderDataPtr->ObjectPropertyTable.objbytes \\r
 [uiIndexOfObject(objecthandle, objectclass)])\r
 \r
-#define PROPERTY_OBJECT_STATE(objectclass, handle) \\r
+#define TRACE_PROPERTY_OBJECT_STATE(objectclass, handle) \\r
 RecorderDataPtr->ObjectPropertyTable.objbytes[uiIndexOfObject(handle, objectclass) \\r
 + RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[objectclass]]\r
 \r
-#define PROPERTY_ACTOR_PRIORITY(objectclass, handle) \\r
+#define TRACE_PROPERTY_ACTOR_PRIORITY(objectclass, handle) \\r
 RecorderDataPtr->ObjectPropertyTable.objbytes[uiIndexOfObject(handle, objectclass) \\r
 + RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[objectclass] + 1]\r
 \r
-#define PROPERTY_TASK_IFE_SERVICECODE(handle) \\r
-RecorderDataPtr->ObjectPropertyTable.objbytes \\r
-[uiIndexOfObject(handle, TRACE_CLASS_TASK) \\r
-+ RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[TRACE_CLASS_TASK]+2]\r
-\r
-#define PROPERTY_TASK_IFE_OBJHANDLE(handle) \\r
-RecorderDataPtr->ObjectPropertyTable.objbytes \\r
-[uiIndexOfObject(handle, TRACE_CLASS_TASK) \\r
-+  RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[TRACE_CLASS_TASK]+3]\r
-\r
-#define SET_FLAG_ISEXCLUDED(bitIndex) excludedFlags[(bitIndex) >> 3] |= (1 << ((bitIndex) & 7))\r
-#define CLEAR_FLAG_ISEXCLUDED(bitIndex) excludedFlags[(bitIndex) >> 3] &= ~(1 << ((bitIndex) & 7))\r
-#define GET_FLAG_ISEXCLUDED(bitIndex) (excludedFlags[(bitIndex) >> 3] & (1 << ((bitIndex) & 7)))\r
-\r
-#define SET_FLAG_MARKIFE(bitIndex) ifeFlags[(bitIndex) >> 3] |= (1 << ((bitIndex) & 7))\r
-#define CLEAR_FLAG_MARKIFE(bitIndex) ifeFlags[(bitIndex) >> 3] &= ~(1 << ((bitIndex) & 7))\r
-#define GET_FLAG_MARKIFE(bitIndex) (ifeFlags[(bitIndex) >> 3] & (1 << ((bitIndex) & 7)))\r
-\r
-#define SET_EVENT_CODE_FLAG_ISEXCLUDED(eventCode) SET_FLAG_ISEXCLUDED(eventCode)\r
-#define CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(eventCode) CLEAR_FLAG_ISEXCLUDED(eventCode)\r
-#define GET_EVENT_CODE_FLAG_ISEXCLUDED(eventCode) GET_FLAG_ISEXCLUDED(eventCode)\r
-\r
-#define SET_QUEUE_FLAG_ISEXCLUDED(queueHandle) SET_FLAG_ISEXCLUDED(NEventCodes+queueHandle-1)\r
-#define CLEAR_QUEUE_FLAG_ISEXCLUDED(queueHandle) CLEAR_FLAG_ISEXCLUDED(NEventCodes+queueHandle-1)\r
-#define GET_QUEUE_FLAG_ISEXCLUDED(queueHandle) GET_FLAG_ISEXCLUDED(NEventCodes+queueHandle-1)\r
-\r
-#define SET_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreHandle) SET_FLAG_ISEXCLUDED(NEventCodes+NQueue+semaphoreHandle-1)\r
-#define CLEAR_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreHandle) CLEAR_FLAG_ISEXCLUDED(NEventCodes+NQueue+semaphoreHandle-1)\r
-#define GET_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreHandle) GET_FLAG_ISEXCLUDED(NEventCodes+NQueue+semaphoreHandle-1)\r
-\r
-#define SET_MUTEX_FLAG_ISEXCLUDED(mutexHandle) SET_FLAG_ISEXCLUDED(NEventCodes+NQueue+NSemaphore+mutexHandle-1)\r
-#define CLEAR_MUTEX_FLAG_ISEXCLUDED(mutexHandle) CLEAR_FLAG_ISEXCLUDED(NEventCodes+NQueue+NSemaphore+mutexHandle-1)\r
-#define GET_MUTEX_FLAG_ISEXCLUDED(mutexHandle) GET_FLAG_ISEXCLUDED(NEventCodes+NQueue+NSemaphore+mutexHandle-1)\r
-\r
-#define SET_TASK_FLAG_ISEXCLUDED(taskHandle) SET_FLAG_ISEXCLUDED(NEventCodes+NQueue+NSemaphore+NMutex+taskHandle-1)\r
-#define CLEAR_TASK_FLAG_ISEXCLUDED(taskHandle) CLEAR_FLAG_ISEXCLUDED(NEventCodes+NQueue+NSemaphore+NMutex+taskHandle-1)\r
-#define GET_TASK_FLAG_ISEXCLUDED(taskHandle) GET_FLAG_ISEXCLUDED(NEventCodes+NQueue+NSemaphore+NMutex+taskHandle-1)\r
-\r
-#define SET_TASK_FLAG_MARKIFE(bitIndex) SET_FLAG_MARKIFE(bitIndex-1)\r
-#define CLEAR_TASK_FLAG_MARKIFE(bitIndex) CLEAR_FLAG_MARKIFE(bitIndex-1)\r
-#define GET_TASK_FLAG_MARKIFE(bitIndex) GET_FLAG_MARKIFE(bitIndex-1)\r
-\r
-/* For debug printouts - the names of the object classes */\r
-extern char OBJECTCLASSNAME[NCLASSES][10];\r
-/*=\r
-{\r
-        "QUEUE"\r
-        "SEMAPHORE",\r
-        "MUTEX",\r
-        "TASK",\r
-        "ISR"\r
-};*/\r
+#define TRACE_SET_FLAG_ISEXCLUDED(flags, bitIndex) flags[(bitIndex) >> 3] |= (1 << ((bitIndex) & 7))\r
+#define TRACE_CLEAR_FLAG_ISEXCLUDED(flags, bitIndex) flags[(bitIndex) >> 3] &= ~(1 << ((bitIndex) & 7))\r
+#define TRACE_GET_FLAG_ISEXCLUDED(flags, bitIndex) (flags[(bitIndex) >> 3] & (1 << ((bitIndex) & 7)))\r
+\r
+#define TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(eventCode) TRACE_SET_FLAG_ISEXCLUDED(excludedEventCodes, eventCode)\r
+#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
+/* DEBUG ASSERTS */\r
+#if defined USE_TRACE_ASSERT && USE_TRACE_ASSERT != 0\r
+#define TRACE_ASSERT(eval, msg, defRetVal) \\r
+if (!(eval)) \\r
+{ \\r
+       vTraceError("TRACE_ASSERT: " msg); \\r
+       return defRetVal; \\r
+}\r
+#else\r
+#define TRACE_ASSERT(eval, msg, defRetVal)\r
+#endif\r
 \r
 #endif\r
 \r
+#endif
\ No newline at end of file