traceLabel prvTraceOpenSymbol(const char* name, traceLabel userEventChannel) { uint16_t result; uint8_t len; uint8_t crc; TRACE_SR_ALLOC_CRITICAL_SECTION(); len = 0; crc = 0; TRACE_ASSERT(name != NULL, "prvTraceOpenSymbol: name == NULL", (traceLabel)0); prvTraceGetChecksum(name, &crc, &len); trcCRITICAL_SECTION_BEGIN(); result = prvTraceLookupSymbolTableEntry(name, crc, len, userEventChannel); if (!result) { result = prvTraceCreateSymbolTableEntry(name, crc, len, userEventChannel); } trcCRITICAL_SECTION_END(); return result; }
/******************************************************************************* * vTraceStoreKernelCallWithParam * * Used for storing kernel calls with a handle and a numeric parameter. This is * only used for traceTASK_PRIORITY_SET at the moment. ******************************************************************************/ void vTraceStoreKernelCallWithParam(uint32_t evtcode, traceObjectClass objectClass, uint32_t objectNumber, uint8_t param) { KernelCallWithParamAndHandle * kse; uint8_t dts2; if (RecorderDataPtr->recorderActive && handle_of_last_logged_task && (! inExcludedTask || nISRactive)) { /* Check if the referenced object or the event code is excluded */ if (!prvTraceIsObjectExcluded(objectClass, objectNumber) && !GET_EVENT_CODE_FLAG_ISEXCLUDED(evtcode)) { trcCRITICAL_SECTION_BEGIN(); dts2 = (uint8_t)prvTraceGetDTS(0xFF); if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */ { kse = (KernelCallWithParamAndHandle*) xTraceNextFreeEventBufferSlot(); if (kse != NULL) { kse->dts = dts2; kse->type = (uint8_t)evtcode; kse->objHandle = (uint8_t)objectNumber; kse->param = param; prvTraceUpdateCounters(); } } trcCRITICAL_SECTION_END(); } } }
/******************************************************************************* * vTraceStoreKernelCallWithNumericParamOnly * * Used for storing kernel calls with numeric parameters only. This is * only used for traceTASK_DELAY and traceDELAY_UNTIL at the moment. ******************************************************************************/ void vTraceStoreKernelCallWithNumericParamOnly(uint32_t evtcode, uint16_t param) { KernelCallWithParam16 * kse; uint8_t dts6; if (RecorderDataPtr->recorderActive && handle_of_last_logged_task && (! inExcludedTask || nISRactive)) { /* Check if the event code is excluded */ if (!GET_EVENT_CODE_FLAG_ISEXCLUDED(evtcode)) { trcCRITICAL_SECTION_BEGIN(); dts6 = (uint8_t)prvTraceGetDTS(0xFF); if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */ { kse = (KernelCallWithParam16*) xTraceNextFreeEventBufferSlot(); if (kse != NULL) { kse->dts = dts6; kse->type = (uint8_t)evtcode; kse->param = param; prvTraceUpdateCounters(); } } trcCRITICAL_SECTION_END(); } } }
/******************************************************************************* * vTraceStoreKernelCall * * This is the main integration point for storing FreeRTOS kernel calls, and * is called by the hooks in FreeRTOS.h (see trcKernel.h for event codes). ******************************************************************************/ void vTraceStoreKernelCall(uint32_t ecode, traceObjectClass objectClass, uint32_t objectNumber) { KernelCall * kse; uint16_t dts1; if (handle_of_last_logged_task == 0) { return; } if (RecorderDataPtr->recorderActive) { /* If it is an ISR or NOT an excluded task, this kernel call will be stored in the trace */ if (nISRactive || !inExcludedTask) { /* Make sure ISRs never change the IFE flags of tasks */ if (!nISRactive) { /* This checks if this is the first kernel call after a call to vTraceTaskInstanceIsFinished. In that case, calls to this kernel service with this specific kernel object become the "instance finish event" (IFE) of the calling task.*/ if (GET_TASK_FLAG_MARKIFE(handle_of_last_logged_task)) { /* Reset the flag - this has been handled now */ CLEAR_TASK_FLAG_MARKIFE(handle_of_last_logged_task); /* Store the kernel service tagged as instance finished event */ PROPERTY_TASK_IFE_SERVICECODE(handle_of_last_logged_task) = (uint8_t)ecode; /* Store the handle of the specific kernel object */ PROPERTY_TASK_IFE_OBJHANDLE(handle_of_last_logged_task) = (objectHandleType)objectNumber; } } /* Check if the referenced object or the event code is excluded */ if (!prvTraceIsObjectExcluded(objectClass, objectNumber) && !GET_EVENT_CODE_FLAG_ISEXCLUDED(ecode)) { trcCRITICAL_SECTION_BEGIN(); dts1 = (uint16_t)prvTraceGetDTS(0xFFFF); if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */ { kse = (KernelCall*) xTraceNextFreeEventBufferSlot(); if (kse != NULL) { kse->dts = dts1; kse->type = (uint8_t)ecode; kse->objHandle = (uint8_t)objectNumber; prvTraceUpdateCounters(); } } trcCRITICAL_SECTION_END(); } } } }