10 #define TRC_RECORDER_H
29 #define TRC_ACKNOWLEDGED (0xABC99123)
31 #include <trcDefines.h>
32 #include <trcConfig.h>
33 #include <trcKernelPortConfig.h>
36 #ifndef TRC_CFG_TEST_MODE
37 #define TRC_CFG_TEST_MODE 0
44 #ifndef TRC_CFG_RECORDER_MODE
45 #define TRC_CFG_RECORDER_MODE TRC_RECORDER_MODE_STREAMING
48 #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)
49 #include <trcSnapshotConfig.h>
50 #include <trcKernelPortSnapshotConfig.h>
54 #define TRC_ASSERT_VOID(_assert, _err) if (! (_assert)){ prvTraceError(_err); return; }
58 #define TRC_ASSERT_RET(_assert, _err, _return) if (! (_assert)){ prvTraceError(_err); return _return; }
60 typedef uint8_t traceUBChannel;
61 typedef uint8_t traceObjectClass;
64 #if (TRC_CFG_USE_16BIT_OBJECT_HANDLES == 1)
65 typedef uint16_t traceHandle;
67 typedef uint8_t traceHandle;
70 #undef TraceISRHandle_t
71 #define TraceISRHandle_t traceHandle
73 #include <trcHardwarePort.h>
74 #include <trcKernelPort.h>
77 #define vTraceConsoleChannelPrintF(fmt, ...) (void)
78 #define xTraceConsoleChannelPrintF(fmt, ...) (void)
79 #define prvTraceStoreEvent_None(...)
80 #define prvTraceStoreEvent_Handle(...)
81 #define prvTraceStoreEvent_Param(...)
82 #define prvTraceStoreEvent_HandleParam(...)
83 #define prvTraceStoreEvent_ParamParam(...)
84 #define prvTraceStoreEvent_HandleParamParam(...)
85 #define prvTraceStoreEvent_ParamParamParam(...)
89 #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
90 #include <trcStreamingConfig.h>
91 #include <trcKernelPortStreamingConfig.h>
94 #ifndef TRC_CFG_CORE_COUNT
95 #define TRC_CFG_CORE_COUNT 1
99 #ifndef TRC_CFG_GET_CURRENT_CORE
100 #define TRC_CFG_GET_CURRENT_CORE() 0
105 #ifndef TRC_CFG_USE_GCC_STATEMENT_EXPR
106 #define TRC_CFG_USE_GCC_STATEMENT_EXPR 0
111 #define traceHandle TraceISRHandle_t
114 #define TRC_MAX_BLOB_SIZE (16 * sizeof(uint32_t))
117 #define TRC_PLATFORM_CFG_LENGTH 8
120 #define TRC_HEADER_BUFFER_SIZE (sizeof(uint32_t) + sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t) + (sizeof(char) * (TRC_PLATFORM_CFG_LENGTH)) + sizeof(uint16_t) + sizeof(uint8_t) + sizeof(uint8_t))
122 typedef struct TraceHeaderBuffer
124 uint8_t buffer[TRC_HEADER_BUFFER_SIZE];
125 } TraceHeaderBuffer_t;
127 #include <trcHardwarePort.h>
128 #include <trcKernelPort.h>
137 #include <trcStreamPort.h>
144 #include <trcUtility.h>
157 #if (TRC_USE_TRACEALYZER_RECORDER == 1)
241 traceResult xTraceEnable(uint32_t uiStartOption);
324 #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)
333 #define TRACE_GET_LOW16(value) ((uint16_t)((value) & 0x0000FFFF))
340 #define TRACE_GET_HIGH16(value) ((uint16_t)(((value) >> 16) & 0x0000FFFF))
348 #define TRACE_SET_LOW16(current, value) (((current) & 0xFFFF0000) | (value))
356 #define TRACE_SET_HIGH16(current, value) (((current) & 0x0000FFFF) | (((uint32_t)(value)) << 16))
358 #if defined (TRC_CFG_ENABLE_STACK_MONITOR) && (TRC_CFG_ENABLE_STACK_MONITOR == 1) && (TRC_CFG_SCHEDULING_ONLY == 0)
364 void prvAddTaskToStackMonitor(
void* task);
371 void prvRemoveTaskFromStackMonitor(
void* task);
376 void prvReportStackUsage(
void);
380 #define prvAddTaskToStackMonitor(task)
381 #define prvRemoveTaskFromStackMonitor(task)
382 #define prvReportStackUsage()
389 traceHandle xTraceSetISRProperties(
const char* szName, uint8_t uiPriority);
409 traceResult
xTraceISRRegister(
const char* szName, uint32_t uiPriority, TraceISRHandle_t* pxISRHandle);
437 #define vTraceStoreISRBegin(__handle) (void)xTraceISRBegin((TraceISRHandle_t)(__handle))
468 #define vTraceStoreISREnd(__pendingISR) (void)xTraceISREnd(__pendingISR)
536 #if (TRC_CFG_SCHEDULING_ONLY == 0) && (TRC_CFG_INCLUDE_USER_EVENTS == 1)
615 traceResult
xTracePrintF(TraceStringHandle_t chn,
const char* fmt, ...);
617 #define xTracePrintF(chn, fmt, ...) ((void)(chn), (void)(fmt), TRC_SUCCESS)
620 #if (TRC_CFG_SCHEDULING_ONLY == 0) && (TRC_CFG_INCLUDE_USER_EVENTS == 1)
634 traceResult
xTraceVPrintF(TraceStringHandle_t eventLabel,
const char* formatStr, va_list vl);
636 #define xTraceVPrintF(chn, formatStr, vl) ((void)(chn), (void)(formatStr), (void)(vl), TRC_SUCCESS)
639 #if (TRC_CFG_SCHEDULING_ONLY == 0) && (TRC_CFG_INCLUDE_USER_EVENTS == 1)
656 traceResult
xTracePrint(TraceStringHandle_t chn,
const char* str);
658 #define xTracePrint(chn, str) ((void)(chn), (void)(str), TRC_SUCCESS)
668 typedef void(*TRACE_STOP_HOOK)(void);
689 void vTraceClear(
void);
697 #ifndef TRC_CFG_INCLUDE_OBJECT_DELETE
698 #define TRC_CFG_INCLUDE_OBJECT_DELETE 0
701 #ifndef TRC_CFG_INCLUDE_READY_EVENTS
702 #define TRC_CFG_INCLUDE_READY_EVENTS 1
705 #ifndef TRC_CFG_INCLUDE_OSTICK_EVENTS
706 #define TRC_CFG_INCLUDE_OSTICK_EVENTS 0
710 #undef trcKERNEL_HOOKS_TASK_CREATE
711 #define trcKERNEL_HOOKS_TASK_CREATE(SERVICE, CLASS, pxTCB) \
714 TRACE_SET_OBJECT_NUMBER(TASK, pxTCB); \
715 TRACE_SET_OBJECT_FILTER(TASK, pxTCB, CurrentFilterGroup); \
716 prvTraceSetObjectName(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_NAME(pxTCB)); \
717 prvTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_PRIORITY(pxTCB)); \
718 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
719 if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \
720 prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \
725 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
727 prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, 0); \
732 #undef trcKERNEL_HOOKS_TASK_DELETE
733 #define trcKERNEL_HOOKS_TASK_DELETE(SERVICE, SERVICE_NAME, SERVICE_PROP, pxTCB) \
734 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
735 if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \
736 prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \
737 prvTraceStoreObjectNameOnCloseEvent(SERVICE_NAME, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \
738 prvTraceStoreObjectPropertiesOnCloseEvent(SERVICE_PROP, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \
739 prvTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_PRIORITY(pxTCB)); \
740 prvTraceSetObjectState(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TASK_STATE_INSTANCE_NOT_ACTIVE); \
741 prvTraceFreeObjectHandle(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));
745 #undef trcKERNEL_HOOKS_OBJECT_CREATE
746 #define trcKERNEL_HOOKS_OBJECT_CREATE(SERVICE, CLASS, pxObject) \
747 TRACE_SET_OBJECT_NUMBER(CLASS, pxObject); \
748 TRACE_SET_OBJECT_FILTER(CLASS, pxObject, CurrentFilterGroup); \
749 prvMarkObjectAsUsed(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));\
750 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
751 if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \
752 prvTraceStoreKernelCall(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \
753 prvTraceSetObjectState(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), 0);
756 #undef trcKERNEL_HOOKS_OBJECT_CREATE_FAILED
757 #define trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(SERVICE, TRACE_CLASS)\
758 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
760 prvTraceStoreKernelCall(SERVICE, TRACE_CLASS, 0); \
764 #undef trcKERNEL_HOOKS_OBJECT_DELETE
765 #define trcKERNEL_HOOKS_OBJECT_DELETE(SERVICE, SERVICE_NAME, SERVICE_PROP, CLASS, pxObject) \
766 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
767 if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \
768 prvTraceStoreKernelCall(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \
769 prvTraceStoreObjectNameOnCloseEvent(SERVICE_NAME, TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); \
770 prvTraceStoreObjectPropertiesOnCloseEvent(SERVICE_PROP, TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); \
771 prvTraceFreeObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));
774 #undef trcKERNEL_HOOKS_KERNEL_SERVICE
775 #define trcKERNEL_HOOKS_KERNEL_SERVICE(SERVICE, CLASS, pxObject) \
776 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
777 if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \
778 prvTraceStoreKernelCall(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));
781 #undef trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT
782 #define trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(SERVICE, TRACECLASS) \
783 if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
784 prvTraceStoreKernelCall(SERVICE, TRACECLASS, 0);
787 #undef trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM
788 #define trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(SERVICE, CLASS, pxObject, param) \
789 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
790 if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \
791 prvTraceStoreKernelCallWithParam(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), (uint32_t)param);
794 #undef trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_WITH_PARAM
795 #define trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_WITH_PARAM(SERVICE, TRACECLASS, param) \
796 if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
797 prvTraceStoreKernelCallWithParam(SERVICE, TRACECLASS, 0, param);
800 #undef trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY
801 #define trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(SERVICE, param) \
802 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
803 prvTraceStoreKernelCallWithNumericParamOnly(SERVICE, (uint32_t)param);
806 #undef trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR
807 #define trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(SERVICE, CLASS, pxObject) \
808 if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \
809 prvTraceStoreKernelCall(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));
812 #undef trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_FROM_ISR
813 #define trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_FROM_ISR(SERVICE, TRACECLASS) \
814 prvTraceStoreKernelCall(SERVICE, TRACECLASS, 0);
817 #undef trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM_FROM_ISR
818 #define trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM_FROM_ISR(SERVICE, CLASS, pxObject, param) \
819 if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \
820 prvTraceStoreKernelCallWithParam(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), (uint32_t)param);
823 #undef trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_WITH_PARAM_FROM_ISR
824 #define trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_WITH_PARAM_FROM_ISR(SERVICE, TRACECLASS, param) \
825 prvTraceStoreKernelCallWithParam(SERVICE, TRACECLASS, 0, param);
828 #undef trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY_FROM_ISR
829 #define trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY_FROM_ISR(SERVICE, param) \
830 prvTraceStoreKernelCallWithNumericParamOnly(SERVICE, (uint32_t)param);
833 #undef trcKERNEL_HOOKS_SET_OBJECT_STATE
834 #define trcKERNEL_HOOKS_SET_OBJECT_STATE(CLASS, pxObject, STATE) \
835 prvTraceSetObjectState(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), (uint8_t)STATE);
838 #undef trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED
839 #define trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED() \
840 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
841 prvTraceSetTaskInstanceFinished(TRACE_GET_TASK_NUMBER(TRACE_GET_CURRENT_TASK()));
843 #if (TRC_CFG_INCLUDE_READY_EVENTS == 1)
845 #undef trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE
846 #define trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB) \
847 if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \
848 prvTraceStoreTaskReady(TRACE_GET_TASK_NUMBER(pxTCB));
850 #undef trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE
851 #define trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB)
855 #undef trcKERNEL_HOOKS_INCREMENT_TICK
856 #define trcKERNEL_HOOKS_INCREMENT_TICK() \
858 extern uint32_t uiTraceTickCount; \
859 uiTraceTickCount++; \
860 prvTracePortGetTimeStamp(0); \
863 #if (TRC_CFG_INCLUDE_OSTICK_EVENTS == 1)
865 #undef trcKERNEL_HOOKS_NEW_TIME
866 #define trcKERNEL_HOOKS_NEW_TIME(SERVICE, xValue) \
867 prvTraceStoreKernelCallWithNumericParamOnly(SERVICE, xValue);
869 #undef trcKERNEL_HOOKS_NEW_TIME
870 #define trcKERNEL_HOOKS_NEW_TIME(SERVICE, xValue)
874 #undef trcKERNEL_HOOKS_TASK_SWITCH
875 #define trcKERNEL_HOOKS_TASK_SWITCH( pxTCB ) \
876 if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \
877 prvTraceStoreTaskswitch(TRACE_GET_TASK_NUMBER(pxTCB));
880 #undef trcKERNEL_HOOKS_TASK_SUSPEND
881 #define trcKERNEL_HOOKS_TASK_SUSPEND(SERVICE, pxTCB) \
882 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
883 if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \
884 prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \
885 prvTraceSetTaskInstanceFinished((uint8_t)TRACE_GET_TASK_NUMBER(pxTCB));
888 #undef trcKERNEL_HOOKS_TASK_DELAY
889 #define trcKERNEL_HOOKS_TASK_DELAY(SERVICE, pxTCB, xValue) \
890 if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \
892 prvTraceStoreKernelCallWithNumericParamOnly(SERVICE, xValue); \
893 prvTraceSetTaskInstanceFinished((uint8_t)TRACE_GET_TASK_NUMBER(pxTCB)); \
897 #undef trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE
898 #define trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(SERVICE, pxTCB, uxNewPriority) \
899 if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \
901 prvTraceStoreKernelCallWithParam(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), prvTraceGetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)));\
902 prvTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), (uint8_t)uxNewPriority); \
906 #undef trcKERNEL_HOOKS_TASK_RESUME
907 #define trcKERNEL_HOOKS_TASK_RESUME(SERVICE, pxTCB) \
908 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
909 if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \
910 prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));
913 #undef trcKERNEL_HOOKS_TASK_RESUME_FROM_ISR
914 #define trcKERNEL_HOOKS_TASK_RESUME_FROM_ISR(SERVICE, pxTCB) \
915 if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \
916 prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));
918 #if !defined TRC_CFG_INCLUDE_READY_EVENTS || TRC_CFG_INCLUDE_READY_EVENTS == 1
924 void prvTraceSetReadyEventsEnabled(uint32_t flag);
931 void prvTraceStoreTaskReady(traceHandle handle);
933 #define prvTraceSetReadyEventsEnabled(status) (void)status;
941 void prvTraceStoreLowPower(uint32_t flag);
948 void prvTraceStoreTaskswitch(traceHandle task_handle);
950 #if (TRC_CFG_SCHEDULING_ONLY == 0)
959 void prvTraceStoreKernelCall(uint32_t eventcode, traceObjectClass objectClass, uint32_t objectNumber);
967 void prvTraceStoreKernelCallWithNumericParamOnly(uint32_t evtcode, uint32_t param);
977 void prvTraceStoreKernelCallWithParam(uint32_t evtcode, traceObjectClass objectClass,
978 uint32_t objectNumber, uint32_t param);
981 #define prvTraceStoreKernelCall(eventcode, objectClass, byteParam) {}
982 #define prvTraceStoreKernelCallWithNumericParamOnly(evtcode, param) {}
983 #define prvTraceStoreKernelCallWithParam(evtcode, objectClass, objectNumber, param) {}
992 void prvTraceSetTaskInstanceFinished(traceHandle handle);
1001 void prvTraceSetPriorityProperty(uint8_t objectclass, traceHandle
id, uint8_t value);
1011 uint8_t prvTraceGetPriorityProperty(uint8_t objectclass, traceHandle
id);
1020 void prvTraceSetObjectState(uint8_t objectclass, traceHandle
id, uint8_t value);
1028 void prvMarkObjectAsUsed(traceObjectClass objectclass, traceHandle handle);
1037 void prvTraceStoreObjectNameOnCloseEvent(uint8_t evtcode, traceHandle handle,
1038 traceObjectClass objectclass);
1047 void prvTraceStoreObjectPropertiesOnCloseEvent(uint8_t evtcode, traceHandle handle,
1048 traceObjectClass objectclass);
1051 #define TASK_STATE_INSTANCE_NOT_ACTIVE 0
1052 #define TASK_STATE_INSTANCE_ACTIVE 1
1055 #if (TRC_CFG_INCLUDE_ISR_TRACING == 0)
1057 #undef vTraceSetISRProperties
1058 #define vTraceSetISRProperties(handle, name, priority) (void)(handle), (void)(name), (void)(priority)
1060 #undef vTraceStoreISRBegin
1061 #define vTraceStoreISRBegin(x) (void)(x)
1063 #undef vTraceStoreISREnd
1064 #define vTraceStoreISREnd(x) (void)(x)
1066 #undef xTraceSetISRProperties
1067 #define xTraceSetISRProperties(name, priority) ((void)(name), (void)(priority), (traceHandle)0)
1081 void* xTraceGetTraceBuffer(
void);
1092 uint32_t uiTraceGetTraceBufferSize(
void);
1094 #if (TRC_CFG_SCHEDULING_ONLY == 1)
1095 #undef TRC_CFG_INCLUDE_USER_EVENTS
1096 #define TRC_CFG_INCLUDE_USER_EVENTS 0
1099 #if ((TRC_CFG_INCLUDE_USER_EVENTS == 1) && (TRC_CFG_SCHEDULING_ONLY == 0)) && (TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER == 1)
1109 traceUBChannel xTraceRegisterUBChannel(TraceStringHandle_t channel, TraceStringHandle_t formatStr);
1117 void vTraceUBData(traceUBChannel channel, ...);
1124 void vTraceUBEvent(traceUBChannel channel);
1126 #define xTraceRegisterChannelFormat(eventLabel, formatStr) ((void)(eventLabel), (void)(formatStr), 0)
1127 #define vTraceUBData(label, ...) (void)(label)
1130 #define NEventCodes 0x100
1133 #define trcCRITICAL_SECTION_BEGIN() {TRACE_ENTER_CRITICAL_SECTION(); recorder_busy++;}
1134 #define trcCRITICAL_SECTION_END() {recorder_busy--; TRACE_EXIT_CRITICAL_SECTION();}
1136 #if (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_ARM_Cortex_M)
1137 #define trcSR_ALLOC_CRITICAL_SECTION_ON_CORTEX_M_ONLY TRACE_ALLOC_CRITICAL_SECTION
1138 #define trcCRITICAL_SECTION_BEGIN_ON_CORTEX_M_ONLY trcCRITICAL_SECTION_BEGIN
1139 #define trcCRITICAL_SECTION_END_ON_CORTEX_M_ONLY trcCRITICAL_SECTION_END
1141 #define trcSR_ALLOC_CRITICAL_SECTION_ON_CORTEX_M_ONLY() {}
1142 #define trcCRITICAL_SECTION_BEGIN_ON_CORTEX_M_ONLY() recorder_busy++;
1143 #define trcCRITICAL_SECTION_END_ON_CORTEX_M_ONLY() recorder_busy--;
1172 uint16_t indexOfNextAvailableHandle[ TRACE_NCLASSES ];
1173 uint16_t lowestIndexOfClass[ TRACE_NCLASSES ];
1174 uint16_t highestIndexOfClass[ TRACE_NCLASSES ];
1175 uint16_t handleCountWaterMarksOfClass[ TRACE_NCLASSES ];
1176 traceHandle objectHandles[ TRACE_KERNEL_OBJECT_COUNT ];
1177 } objectHandleStackType;
1179 extern objectHandleStackType objectHandleStacks;
1201 uint32_t NumberOfObjectClasses;
1202 uint32_t ObjectPropertyTableSizeInBytes;
1206 #if (TRC_CFG_USE_16BIT_OBJECT_HANDLES == 1)
1207 traceHandle NumberOfObjectsPerClass[2*((TRACE_NCLASSES+1)/2)];
1209 traceHandle NumberOfObjectsPerClass[4*((TRACE_NCLASSES+3)/4)];
1212 uint8_t NameLengthPerClass[ 4*((TRACE_NCLASSES+3)/4) ];
1215 uint8_t TotalPropertyBytesPerClass[ 4*((TRACE_NCLASSES+3)/4) ];
1218 uint16_t StartIndexOfClass[ 2*((TRACE_NCLASSES+1)/2) ];
1221 uint8_t objbytes[ 4*((TRACE_OBJECT_TABLE_SIZE+3)/4) ];
1222 } ObjectPropertyTableType;
1230 uint32_t symTableSize;
1233 uint32_t nextFreeSymbolIndex;
1236 uint8_t symbytes[4*(((TRC_CFG_SYMBOL_TABLE_SIZE)+3)/4)];
1241 uint16_t latestEntryOfChecksum[64];
1276 } KernelCallWithParamAndHandle;
1283 } KernelCallWithParam16;
1289 uint16_t symbolIndex;
1290 } ObjCloseNameEvent;
1298 } ObjClosePropEvent;
1306 } TaskInstanceStatusEvent;
1351 #if (TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER == 1)
1354 TraceStringHandle_t name;
1355 TraceStringHandle_t defaultFormat;
1356 } ChannelFormatPair;
1362 uint32_t wraparoundCounter;
1363 uint32_t numberOfSlots;
1364 uint32_t nextSlotToWrite;
1365 uint8_t numberOfChannels;
1369 ChannelFormatPair channels[(TRC_CFG_UB_CHANNELS)+1];
1370 uint8_t channelBuffer[((TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE) + 3) & 0xFFFFFFFC];
1371 uint8_t dataBuffer[(TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE) * 4];
1382 volatile uint8_t startmarker0;
1383 volatile uint8_t startmarker1;
1384 volatile uint8_t startmarker2;
1385 volatile uint8_t startmarker3;
1386 volatile uint8_t startmarker4;
1387 volatile uint8_t startmarker5;
1388 volatile uint8_t startmarker6;
1389 volatile uint8_t startmarker7;
1390 volatile uint8_t startmarker8;
1391 volatile uint8_t startmarker9;
1392 volatile uint8_t startmarker10;
1393 volatile uint8_t startmarker11;
1399 uint8_t minor_version;
1404 uint8_t irq_priority_order;
1416 uint32_t nextFreeIndex;
1419 uint32_t bufferIsFull;
1426 uint32_t absTimeLastEvent;
1429 uint32_t absTimeLastEventSecond;
1433 uint32_t recorderActive;
1441 uint32_t isrTailchainingThreshold;
1444 uint32_t heapMemMaxUsage;
1447 uint32_t heapMemUsage;
1450 int32_t debugMarker0;
1453 uint32_t isUsing16bitHandles;
1458 ObjectPropertyTableType ObjectPropertyTable;
1461 int32_t debugMarker1;
1466 symbolTableType SymbolTable;
1470 #if (TRC_CFG_INCLUDE_FLOAT_SUPPORT == 1)
1471 float exampleFloatEncoding;
1473 uint32_t exampleFloatEncoding;
1479 uint32_t internalErrorOccured;
1482 int32_t debugMarker2;
1485 char systemInfo[80];
1488 int32_t debugMarker3;
1491 uint8_t eventData[ (TRC_CFG_EVENT_BUFFER_SIZE) * 4 ];
1493 #if (TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER == 1)
1494 UserEventBuffer userEventBuffer;
1498 uint32_t endOfSecondaryBlocks;
1510 uint8_t endmarker10;
1511 uint8_t endmarker11;
1514 extern RecorderDataType* RecorderDataPtr;
1523 void prvTraceError(
const char* msg);
1537 void prvTracePortGetTimeStamp(uint32_t *puiTimestamp);
1546 traceHandle prvTraceGetObjectHandle(traceObjectClass objectclass);
1554 void prvTraceFreeObjectHandle(traceObjectClass objectclass,
1555 traceHandle handle);
1566 void prvTraceSetObjectName(traceObjectClass objectclass,
1572 #define TRACE_PROPERTY_NAME_GET(objectclass, objecthandle) \
1573 (const char*)(& RecorderDataPtr->ObjectPropertyTable.objbytes \
1574 [uiIndexOfObject(objecthandle, objectclass)])
1576 #define TRACE_PROPERTY_OBJECT_STATE(objectclass, handle) \
1577 RecorderDataPtr->ObjectPropertyTable.objbytes[uiIndexOfObject(handle, objectclass) \
1578 + RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[objectclass]]
1580 #define TRACE_PROPERTY_ACTOR_PRIORITY(objectclass, handle) \
1581 RecorderDataPtr->ObjectPropertyTable.objbytes[uiIndexOfObject(handle, objectclass) \
1582 + RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[objectclass] + 1]
1585 #if defined TRC_CFG_USE_TRACE_ASSERT && TRC_CFG_USE_TRACE_ASSERT != 0
1586 #define TRACE_ASSERT(eval, msg, defRetVal) \
1589 prvTraceError("TRACE_ASSERT: " msg); \
1593 #define TRACE_ASSERT(eval, msg, defRetVal)
1596 typedef RecorderDataType TraceRecorderDataBuffer_t;
1600 #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
1602 #ifndef TRC_EXTERNAL_BUFFERS
1603 #define TRC_EXTERNAL_BUFFERS 0
1606 typedef struct TraceRecorderData
1608 uint32_t uiSessionCounter;
1609 uint32_t uiRecorderEnabled;
1610 uint32_t uiTraceSystemState;
1612 TraceAssertBuffer_t xAssertBuffer;
1613 #if (TRC_EXTERNAL_BUFFERS == 0)
1614 TraceHeaderBuffer_t xHeaderBuffer;
1616 TraceTimestampBuffer_t xTimestampBuffer;
1619 TraceStaticBufferBuffer_t xStaticBufferBuffer;
1620 TraceEventDataBuffer_t xEventDataBuffer;
1621 TracePrintBuffer_t xPrintBuffer;
1622 TraceErrorBuffer_t xErrorBuffer;
1623 TraceISRInfoBuffer_t xISRInfoBuffer;
1625 TraceTaskInfoBuffer_t xTaskInfoBuffer;
1626 TraceStackMonitorBuffer_t xStackMonitorBuffer;
1627 TraceDiagnosticsBuffer_t xDiagnosticsBuffer;
1628 } TraceRecorderData_t;
1630 extern TraceRecorderData_t* pxTraceRecorderData;
1631 extern uint32_t RecorderInitialized;
1633 #define TRC_RECORDER_DATA_BUFFER_SIZE (sizeof(TraceRecorderData_t))
1635 typedef struct TraceRecorderDataBuffer
1637 uint8_t buffer[(TRC_RECORDER_DATA_BUFFER_SIZE)];
1638 } TraceRecorderDataBuffer_t;
1656 #define xTraceIsRecorderEnabled() (xTraceIsRecorderInitialized() & pxTraceRecorderData->uiRecorderEnabled)
1664 #define xTraceIsRecorderInitialized() xTraceIsComponentInitialized(TRC_RECORDER_COMPONENT_CORE)
1674 #define xTraceSetComponentInitialized(uiComponentBit) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_2(RecorderInitialized |= (uiComponentBit), TRC_SUCCESS)
1684 #define xTraceIsComponentInitialized(uiComponentBit) ((RecorderInitialized & (uiComponentBit)) ? 1 : 0)
1694 #define xTraceStateSet(uiState) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_2(pxTraceRecorderData->uiTraceSystemState = (uiState), TRC_SUCCESS)
1704 #define xTraceStateGet(puiState) TRC_COMMA_EXPR_TO_STATEMENT_EXPR_2(*(puiState) = pxTraceRecorderData->uiTraceSystemState, TRC_SUCCESS)
1723 #define prvTraceStoreEvent_None(_eventID) \
1725 TraceEventHandle_t _xEventHandle = 0; \
1726 if (xTraceEventBegin(_eventID, 0, &_xEventHandle) == TRC_SUCCESS) \
1728 xTraceEventEnd(_xEventHandle); \
1738 #define prvTraceStoreEvent_Handle(_eventID, _handle) \
1740 TraceEventHandle_t _xEventHandle = 0; \
1741 if (xTraceEventBegin(_eventID, sizeof(void*), &_xEventHandle) == TRC_SUCCESS) \
1743 xTraceEventAddPointer(_xEventHandle, (void*)(_handle)); \
1744 xTraceEventEnd(_xEventHandle); \
1754 #define prvTraceStoreEvent_Param(_eventID, _param1) \
1756 TraceEventHandle_t _xEventHandle = 0; \
1757 if (xTraceEventBegin(_eventID, sizeof(uint32_t), &_xEventHandle) == TRC_SUCCESS) \
1759 xTraceEventAdd32(_xEventHandle, (uint32_t)(_param1)); \
1760 xTraceEventEnd(_xEventHandle); \
1771 #define prvTraceStoreEvent_HandleParam(_eventID, _handle, _param1) \
1773 TraceEventHandle_t _xEventHandle = 0; \
1774 if (xTraceEventBegin(_eventID, sizeof(void*) + sizeof(uint32_t), &_xEventHandle) == TRC_SUCCESS) \
1776 xTraceEventAddPointer(_xEventHandle, (void*)(_handle)); \
1777 xTraceEventAdd32(_xEventHandle, (uint32_t)(_param1)); \
1778 xTraceEventEnd(_xEventHandle); \
1789 #define prvTraceStoreEvent_ParamParam(_eventID, _param1, _param2) \
1791 TraceEventHandle_t _xEventHandle = 0; \
1792 if (xTraceEventBegin(_eventID, sizeof(uint32_t) + sizeof(uint32_t), &_xEventHandle) == TRC_SUCCESS) \
1794 xTraceEventAdd32(_xEventHandle, (uint32_t)(_param1)); \
1795 xTraceEventAdd32(_xEventHandle, (uint32_t)(_param2)); \
1796 xTraceEventEnd(_xEventHandle); \
1808 #define prvTraceStoreEvent_HandleParamParam(_eventID, _handle, _param1, _param2) \
1810 TraceEventHandle_t _xEventHandle = 0; \
1811 if (xTraceEventBegin(_eventID, sizeof(void*) + sizeof(uint32_t) + sizeof(uint32_t), &_xEventHandle) == TRC_SUCCESS) \
1813 xTraceEventAddPointer(_xEventHandle, (void*)(_handle)); \
1814 xTraceEventAdd32(_xEventHandle, (uint32_t)(_param1)); \
1815 xTraceEventAdd32(_xEventHandle, (uint32_t)(_param2)); \
1816 xTraceEventEnd(_xEventHandle); \
1828 #define prvTraceStoreEvent_ParamParamParam(_eventID, _param1, _param2, _param3) \
1830 TraceEventHandle_t _xEventHandle = 0; \
1831 if (xTraceEventBegin(_eventID, sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t), &_xEventHandle) == TRC_SUCCESS) \
1833 xTraceEventAdd32(_xEventHandle, (uint32_t)(_param1)); \
1834 xTraceEventAdd32(_xEventHandle, (uint32_t)(_param2)); \
1835 xTraceEventAdd32(_xEventHandle, (uint32_t)(_param3)); \
1836 xTraceEventEnd(_xEventHandle); \
1845 #define vTraceSetStopHook(x) (void)(x)
1850 #define vTraceInitTimestamps()
1854 #if (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM)
1863 traceResult xTraceSetBuffer(TraceRecorderDataBuffer_t *pxBuffer);
1865 #define xTraceSetBuffer(p) (TRC_SUCCESS)
1881 #define xTraceInitialize() (TRC_SUCCESS)
1882 #define xTraceEnable(x) ((void)(x), TRC_SUCCESS)
1883 #define xTraceDisable() (TRC_SUCCESS)
1884 #define xTraceStringRegister(x, y) ((void)(x), (void)y, TRC_SUCCESS)
1885 #define xTracePrint(chn, ...) ((void)(chn), TRC_SUCCESS)
1886 #define xTracePrintF(chn, fmt, ...) ((void)(chn), (void)(fmt), TRC_SUCCESS)
1887 #define xTraceVPrintF(chn, formatStr, vl) ((void)(chn), (void)(formatStr), (void)(vl), TRC_SUCCESS)
1888 #define xTraceTaskInstanceFinishedNow()
1889 #define xTraceTaskInstanceFinishedNext()
1890 #define vTraceStoreISRBegin(x) (void)(x)
1891 #define vTraceStoreISREnd(x) (void)(x)
1892 #define xTraceSetISRProperties(a, b) ((void)(a), (void)(b), (traceHandle)0)
1893 #define xTraceRegisterChannelFormat(eventLabel, formatStr) ((void)(eventLabel), (void)(formatStr), 0)
1894 #define vTraceUBData(label, ...) (void)(label)
1896 #define vTraceSetFilterGroup(x) (void)(x)
1897 #define vTraceSetFilterMask(x) (void)(x)
1899 #define prvTraceSetReadyEventsEnabled(status) (void)(status)
1901 #define vTraceExcludeTask(handle) (void)(handle)
1903 #define vTraceConsoleChannelPrintF(fmt, ...) (void)(fmt)
1905 #ifndef TRC_ALLOC_CUSTOM_BUFFER
1906 #define TRC_ALLOC_CUSTOM_BUFFER(bufname)
1909 #define xTraceIsRecorderEnabled() (0)
1910 #define xTraceIsRecorderInitialized() (0)
1912 #define xTraceSetBuffer(p) (TRC_SUCCESS)
1913 #define xTraceGetEventBuffer(p) (TRC_FAIL)
1915 #define vTraceSetStopHook(x) (void)(x)
1917 #define TraceRecorderDataBuffer_t uint32_t
1924 #define vTraceInitialize (void)xTraceInitialize
1929 #define vTraceEnable (void)xTraceEnable
1934 #define vTraceStop (void)xTraceDisable
1939 #define vTraceInstanceFinishedNow (void)xTraceTaskInstanceFinishedNow
1944 #define vTraceInstanceFinishedNext (void)xTraceTaskInstanceFinishedNext
1949 #define vTracePrintF (void)xTracePrintF
1954 #define vTraceVPrintF (void)xTraceVPrintF
1959 #define vTracePrint (void)xTracePrint
1964 #define vTraceSetRecorderDataBuffer(pxBuffer) xTraceSetBuffer((TraceRecorderDataBuffer_t*)(pxBuffer))