From: rtel Date: Wed, 12 Aug 2015 10:34:30 +0000 (+0000) Subject: Final preparation for new release: X-Git-Tag: V8.2.2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2f17b305aa63e9728696543c68c2b1994c8c4f96;p=freertos Final preparation for new release: FreeRTOS+Trace: - Add trace macros for task notifications. - Update to the latest trace recorder library. Demo projects: - Only include the CLI command to show run time states if configGENERATE_RUN_TIME_STATS is set to 1. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2366 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c index 700d84cc4..0b06ac00b 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c @@ -110,7 +110,9 @@ static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferL /* * Implements the run-time-stats command. */ -static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ); +#if( configGENERATE_RUN_TIME_STATS == 1 ) + static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ); +#endif /* configGENERATE_RUN_TIME_STATS */ /* * Implements the echo-three-parameters command. @@ -136,16 +138,6 @@ static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBuf static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ); #endif -/* Structure that defines the "run-time-stats" command line command. This -generates a table that shows how much run time each task has */ -static const CLI_Command_Definition_t xRunTimeStats = -{ - "run-time-stats", /* The command string to type. */ - "\r\nrun-time-stats:\r\n Displays a table showing how much processing time each FreeRTOS task has used\r\n", - prvRunTimeStatsCommand, /* The function to run. */ - 0 /* No parameters are expected. */ -}; - /* Structure that defines the "task-stats" command line command. This generates a table that gives information on each task in the system. */ static const CLI_Command_Definition_t xTaskStats = @@ -178,6 +170,18 @@ static const CLI_Command_Definition_t xParameterEcho = -1 /* The user can enter any number of commands. */ }; +#if( configGENERATE_RUN_TIME_STATS == 1 ) + /* Structure that defines the "run-time-stats" command line command. This + generates a table that shows how much run time each task has */ + static const CLI_Command_Definition_t xRunTimeStats = + { + "run-time-stats", /* The command string to type. */ + "\r\nrun-time-stats:\r\n Displays a table showing how much processing time each FreeRTOS task has used\r\n", + prvRunTimeStatsCommand, /* The function to run. */ + 0 /* No parameters are expected. */ + }; +#endif /* configGENERATE_RUN_TIME_STATS */ + #if( configINCLUDE_QUERY_HEAP_COMMAND == 1 ) /* Structure that defines the "query_heap" command line command. */ static const CLI_Command_Definition_t xQueryHeap = @@ -206,11 +210,16 @@ static const CLI_Command_Definition_t xParameterEcho = void vRegisterSampleCLICommands( void ) { /* Register all the command line commands defined immediately above. */ - FreeRTOS_CLIRegisterCommand( &xTaskStats ); - FreeRTOS_CLIRegisterCommand( &xRunTimeStats ); + FreeRTOS_CLIRegisterCommand( &xTaskStats ); FreeRTOS_CLIRegisterCommand( &xThreeParameterEcho ); FreeRTOS_CLIRegisterCommand( &xParameterEcho ); + #if( configGENERATE_RUN_TIME_STATS == 1 ) + { + FreeRTOS_CLIRegisterCommand( &xRunTimeStats ); + } + #endif + #if( configINCLUDE_QUERY_HEAP_COMMAND == 1 ) { FreeRTOS_CLIRegisterCommand( &xQueryHeap ); @@ -283,43 +292,47 @@ BaseType_t xSpacePadding; #endif /* configINCLUDE_QUERY_HEAP */ /*-----------------------------------------------------------*/ -static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ) -{ -const char * const pcHeader = " Abs Time % Time\r\n****************************************\r\n"; -BaseType_t xSpacePadding; +#if( configGENERATE_RUN_TIME_STATS == 1 ) + + static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ) + { + const char * const pcHeader = " Abs Time % Time\r\n****************************************\r\n"; + BaseType_t xSpacePadding; - /* Remove compile time warnings about unused parameters, and check the - write buffer is not NULL. NOTE - for simplicity, this example assumes the - write buffer length is adequate, so does not check for buffer overflows. */ - ( void ) pcCommandString; - ( void ) xWriteBufferLen; - configASSERT( pcWriteBuffer ); + /* Remove compile time warnings about unused parameters, and check the + write buffer is not NULL. NOTE - for simplicity, this example assumes the + write buffer length is adequate, so does not check for buffer overflows. */ + ( void ) pcCommandString; + ( void ) xWriteBufferLen; + configASSERT( pcWriteBuffer ); - /* Generate a table of task stats. */ - strcpy( pcWriteBuffer, "Task" ); - pcWriteBuffer += strlen( pcWriteBuffer ); + /* Generate a table of task stats. */ + strcpy( pcWriteBuffer, "Task" ); + pcWriteBuffer += strlen( pcWriteBuffer ); - /* Pad the string "task" with however many bytes necessary to make it the - length of a task name. Minus three for the null terminator and half the - number of characters in "Task" so the column lines up with the centre of - the heading. */ - for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ ) - { - /* Add a space to align columns after the task's name. */ - *pcWriteBuffer = ' '; - pcWriteBuffer++; + /* Pad the string "task" with however many bytes necessary to make it the + length of a task name. Minus three for the null terminator and half the + number of characters in "Task" so the column lines up with the centre of + the heading. */ + for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ ) + { + /* Add a space to align columns after the task's name. */ + *pcWriteBuffer = ' '; + pcWriteBuffer++; - /* Ensure always terminated. */ - *pcWriteBuffer = 0x00; - } + /* Ensure always terminated. */ + *pcWriteBuffer = 0x00; + } - strcpy( pcWriteBuffer, pcHeader ); - vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) ); + strcpy( pcWriteBuffer, pcHeader ); + vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) ); - /* There is no more data to return after this single string, so return - pdFALSE. */ - return pdFALSE; -} + /* There is no more data to return after this single string, so return + pdFALSE. */ + return pdFALSE; + } + +#endif /* configGENERATE_RUN_TIME_STATS */ /*-----------------------------------------------------------*/ static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ) diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_Reliance_Edge_and_CLI_Windows_Simulator/Instructions_ReadMe.url b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_Reliance_Edge_and_CLI_Windows_Simulator/Instructions_ReadMe.url index 277474be2..9aca2c69e 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_Reliance_Edge_and_CLI_Windows_Simulator/Instructions_ReadMe.url +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_Reliance_Edge_and_CLI_Windows_Simulator/Instructions_ReadMe.url @@ -1,5 +1,6 @@ [{000214A0-0000-0000-C000-000000000046}] Prop3=19,2 [InternetShortcut] -URL=http://www.freertos.org/FreeRTOS-Plus/Fail_Safe_File_System/Reliance_Edge_Fail_Safe_File_System.shtml +URL=http://www.freertos.org/FreeRTOS-Plus/Fail_Safe_File_System/Fail_Safe_Embedded_File_System_demo.shtml IDList= +HotKey=0 diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_Reliance_Edge_and_CLI_Windows_Simulator/main.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_Reliance_Edge_and_CLI_Windows_Simulator/main.c index 0a7028d3c..687e05029 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_Reliance_Edge_and_CLI_Windows_Simulator/main.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_Reliance_Edge_and_CLI_Windows_Simulator/main.c @@ -71,7 +71,7 @@ * * This demo is described on the following web page: * TODO: This link describes the FAT version of this demo. - * http://FreeRTOS-Plus/Fail_Safe_File_System/Fail_Safe_Embedded_File_System_demo.shtml + * http://www.freertos.org/FreeRTOS-Plus/Fail_Safe_File_System/Fail_Safe_Embedded_File_System_demo.shtml * ******************************************************************************/ @@ -112,7 +112,10 @@ extern void vUDPCommandInterpreterTask( void *pvParameters ); extern void vCreateAndVerifySampleFiles( void ); /*-----------------------------------------------------------*/ -#pragma warning - add link to documentation page + +/* See http://www.freertos.org/FreeRTOS-Plus/Fail_Safe_File_System/Fail_Safe_Embedded_File_System_demo.shtml +for instructions. */ + int main( void ) { const uint32_t ulLongTime_ms = 250UL; diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/ConfigurationTemplate/trcConfig.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/ConfigurationTemplate/trcConfig.h index 4f3c2e924..4a08f47f9 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/ConfigurationTemplate/trcConfig.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/ConfigurationTemplate/trcConfig.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Tracealyzer v2.7.0 Recorder Library + * Tracealyzer v2.7.7 Recorder Library * Percepio AB, www.percepio.com * * trcConfig.h @@ -38,7 +38,7 @@ * * Tabs are used for indent in this file (1 tab = 4 spaces) * - * Copyright Percepio AB, 2014. + * Copyright Percepio AB, 2012-2015. * www.percepio.com ******************************************************************************/ @@ -70,18 +70,20 @@ * PORT_NXP_LPC210X 13 No Any * PORT_MICROCHIP_PIC32MZ 14 Yes Any * PORT_ARM_CORTEX_A9 15 No Any + * PORT_ARM_CORTEX_M0 16 Yes Any *****************************************************************************/ -#ifndef WIN32 - // Set the port setting here! - #define SELECTED_PORT PORT_NOT_SET +// Set the port setting here! +#define SELECTED_PORT PORT_NOT_SET - #if (SELECTED_PORT == PORT_NOT_SET) - #error "You need to define SELECTED_PORT here!" - #endif -#else - // For Win32 demo projects this is set automatically - #define SELECTED_PORT PORT_Win32 +#if (SELECTED_PORT == PORT_ARM_CortexM) + /* For ARM Cortex-M: make sure ARM's CMSIS library is included here, which + is used for accessing the PRIMASK register. e.g. #include "board.h" */ +#endif + + +#if (SELECTED_PORT == PORT_NOT_SET) + #error "You need to define SELECTED_PORT here!" #endif /****************************************************************************** diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcHardwarePort.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcHardwarePort.h index 7c93d4ef4..e307a01a6 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcHardwarePort.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcHardwarePort.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Tracealyzer v2.7.0 Recorder Library + * Tracealyzer v2.7.7 Recorder Library * Percepio AB, www.percepio.com * * trcHardwarePort.h @@ -34,7 +34,7 @@ * * Tabs are used for indent in this file (1 tab = 4 spaces) * - * Copyright Percepio AB, 2014. + * Copyright Percepio AB, 2012-2015. * www.percepio.com ******************************************************************************/ @@ -112,6 +112,7 @@ #define PORT_NXP_LPC210X 13 /* No Any */ #define PORT_MICROCHIP_PIC32MZ 14 /* Yes Any */ #define PORT_ARM_CORTEX_A9 15 /* No Any */ +#define PORT_ARM_CORTEX_M0 16 /* Yes Any */ #include "trcConfig.h" @@ -199,12 +200,12 @@ #elif (SELECTED_PORT == PORT_ARM_CortexM) void prvTraceInitCortexM(void); - + #define REG_DEMCR (*(volatile unsigned int*)0xE000EDFC) #define REG_DWT_CTRL (*(volatile unsigned int*)0xE0001000) #define REG_DWT_CYCCNT (*(volatile unsigned int*)0xE0001004) #define REG_DWT_EXCCNT (*(volatile unsigned int*)0xE000100C) - + /* Bit mask for TRCENA bit in DEMCR - Global enable for DWT and ITM */ #define DEMCR_TRCENA (1 << 24) @@ -223,7 +224,7 @@ #define PORT_SPECIFIC_INIT() prvTraceInitCortexM() extern uint32_t DWT_CYCLES_ADDED; - + #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING #define HWTC_COUNT (REG_DWT_CYCCNT + DWT_CYCLES_ADDED) #define HWTC_PERIOD 0 @@ -231,6 +232,14 @@ #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant +#elif (SELECTED_PORT == PORT_ARM_CORTEX_M0) + #define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING + #define HWTC_COUNT (*((uint32_t*)0xE000E018)) + #define HWTC_PERIOD ((*(uint32_t*)0xE000E014) + 1) + #define HWTC_DIVISOR 2 + + #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant + #elif (SELECTED_PORT == PORT_Renesas_RX600) #include "iodefine.h" @@ -241,8 +250,8 @@ #define HWTC_DIVISOR 1 #define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant -#elif (SELECTED_PORT == PORT_MICROCHIP_PIC32MX || SELECTED_PORT == PORT_MICROCHIP_PIC32MZ) - +#elif ((SELECTED_PORT == PORT_MICROCHIP_PIC32MX) || (SELECTED_PORT == PORT_MICROCHIP_PIC32MZ)) + #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING #define HWTC_COUNT (TMR1) #define HWTC_PERIOD (PR1 + 1) @@ -299,11 +308,11 @@ /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */ - #define RTIFRC0 *((uint32_t *)0xFFFFFC10) - #define RTICOMP0 *((uint32_t *)0xFFFFFC50) - #define RTIUDCP0 *((uint32_t *)0xFFFFFC54) + #define TRC_RTIFRC0 *((uint32_t *)0xFFFFFC10) + #define TRC_RTICOMP0 *((uint32_t *)0xFFFFFC50) + #define TRC_RTIUDCP0 *((uint32_t *)0xFFFFFC54) #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING - #define HWTC_COUNT (RTIFRC0 - (RTICOMP0 - RTIUDCP0)) + #define HWTC_COUNT (TRC_RTIFRC0 - (TRC_RTICOMP0 - TRC_RTIUDCP0)) #define HWTC_PERIOD (RTIUDCP0) #define HWTC_DIVISOR 1 diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernel.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernel.h index 1ee5e4bf1..7be877070 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernel.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernel.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Tracealyzer v2.7.0 Recorder Library + * Tracealyzer v2.7.7 Recorder Library * Percepio AB, www.percepio.com * * trcKernel.h @@ -31,7 +31,7 @@ * damages, or the exclusion of implied warranties or limitations on how long an * implied warranty may last, so the above limitations may not apply to you. * - * Copyright Percepio AB, 2013. + * Copyright Percepio AB, 2012-2015. * www.percepio.com ******************************************************************************/ @@ -45,7 +45,10 @@ /* Internal functions */ #if !defined INCLUDE_READY_EVENTS || INCLUDE_READY_EVENTS == 1 -void vTraceStoreTaskReady(objectHandleType handle); + void vTraceSetReadyEventsEnabled(int status); + void vTraceStoreTaskReady(objectHandleType handle); +#else + #define vTraceSetReadyEventsEnabled(status) #endif void vTraceStoreLowPower(uint32_t flag); diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelPort.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelPort.h index 59dc94bc8..904258606 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelPort.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelPort.h @@ -1,43 +1,1074 @@ /******************************************************************************* - * Tracealyzer v2.7.0 Recorder Library + * Tracealyzer v2.7.7 Recorder Library * Percepio AB, www.percepio.com * - * trcKernelPort.h + * trcKernelPortFreeRTOS.h + * + * Kernel-specific functionality for FreeRTOS, used by the recorder library. * - * Wrapper for kernel-specific port (trcKernelPort.h) - * * Terms of Use * This software is copyright Percepio AB. The recorder library is free for * use together with Percepio products. You may distribute the recorder library * in its original form, including modifications in trcHardwarePort.c/.h * given that these modification are clearly marked as your own modifications - * and documented in the initial comment section of these source files. - * This software is the intellectual property of Percepio AB and may not be - * sold or in other ways commercially redistributed without explicit written + * and documented in the initial comment section of these source files. + * This software is the intellectual property of Percepio AB and may not be + * sold or in other ways commercially redistributed without explicit written * permission by Percepio AB. * - * Disclaimer - * The trace tool and recorder library is being delivered to you AS IS and - * Percepio AB makes no warranty as to its use or performance. Percepio AB does - * not and cannot warrant the performance or results you may obtain by using the - * software or documentation. Percepio AB make no warranties, express or - * implied, as to noninfringement of third party rights, merchantability, or - * fitness for any particular purpose. In no event will Percepio AB, its - * technology partners, or distributors be liable to you for any consequential, - * incidental or special damages, including any lost profits or lost savings, - * even if a representative of Percepio AB has been advised of the possibility - * of such damages, or for any claim by any third party. Some jurisdictions do - * not allow the exclusion or limitation of incidental, consequential or special - * damages, or the exclusion of implied warranties or limitations on how long an + * Disclaimer + * The trace tool and recorder library is being delivered to you AS IS and + * Percepio AB makes no warranty as to its use or performance. Percepio AB does + * not and cannot warrant the performance or results you may obtain by using the + * software or documentation. Percepio AB make no warranties, express or + * implied, as to noninfringement of third party rights, merchantability, or + * fitness for any particular purpose. In no event will Percepio AB, its + * technology partners, or distributors be liable to you for any consequential, + * incidental or special damages, including any lost profits or lost savings, + * even if a representative of Percepio AB has been advised of the possibility + * of such damages, or for any claim by any third party. Some jurisdictions do + * not allow the exclusion or limitation of incidental, consequential or special + * damages, or the exclusion of implied warranties or limitations on how long an * implied warranty may last, so the above limitations may not apply to you. * * Tabs are used for indent in this file (1 tab = 4 spaces) * - * Copyright Percepio AB, 2014. + * Copyright Percepio AB, 2012-2015. * www.percepio.com ******************************************************************************/ -/* Change the included file below, if using the recorder with other kernels */ -#include "trcKernelPortFreeRTOS.h" -/* #include "trcKernelPort.h" */ +#ifndef TRCKERNELPORTFREERTOS_H +#define TRCKERNELPORTFREERTOS_H + +#include "FreeRTOS.h" /* Defines configUSE_TRACE_FACILITY */ +#include "trcHardwarePort.h" + +extern int uiInEventGroupSetBitsFromISR; + +#define USE_TRACEALYZER_RECORDER configUSE_TRACE_FACILITY + +#if (USE_TRACEALYZER_RECORDER == 1) + +/* Defines that must be set for the recorder to work properly */ +#define TRACE_KERNEL_VERSION 0x1AA1 +#define TRACE_TICK_RATE_HZ configTICK_RATE_HZ /* Defined in "FreeRTOS.h" */ +#define TRACE_CPU_CLOCK_HZ configCPU_CLOCK_HZ /* Defined in "FreeRTOSConfig.h" */ + +#if (SELECTED_PORT == PORT_ARM_CortexM) + + /* If you get warnings regarding __get_PRIMASK and __set_PRIMASK, make sure that ARM's CMSIS API is included + by the recorder using your chip vendor header file (e.g., "board.h", "stm32f4xx.h", "lpc17xx.h") */ + + #define TRACE_SR_ALLOC_CRITICAL_SECTION() int __irq_status; + #define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = __get_PRIMASK(); __set_PRIMASK(1);} + #define TRACE_EXIT_CRITICAL_SECTION() {__set_PRIMASK(__irq_status);} + +#endif + +#if ((SELECTED_PORT == PORT_ARM_CORTEX_A9) || (SELECTED_PORT == PORT_Renesas_RX600) || (SELECTED_PORT == PORT_MICROCHIP_PIC32MX) || (SELECTED_PORT == PORT_MICROCHIP_PIC32MZ)) + #define TRACE_SR_ALLOC_CRITICAL_SECTION() int __irq_status; + #define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = portSET_INTERRUPT_MASK_FROM_ISR();} + #define TRACE_EXIT_CRITICAL_SECTION() {portCLEAR_INTERRUPT_MASK_FROM_ISR(__irq_status);} +#endif + +#if (SELECTED_PORT == PORT_Win32) + /* In the Win32 port, there are no real interrupts, so we can use the normal critical sections */ + #define TRACE_SR_ALLOC_CRITICAL_SECTION() + #define TRACE_ENTER_CRITICAL_SECTION() portENTER_CRITICAL() + #define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL() +#endif + +#ifndef TRACE_ENTER_CRITICAL_SECTION + #error "This port has no valid definition for critical sections! See http://percepio.com/2014/10/27/how-to-define-critical-sections-for-the-recorder/" +#endif + +#if (SELECTED_PORT == PORT_ARM_CortexM) + #define trcCRITICAL_SECTION_BEGIN_ON_CORTEX_M_ONLY trcCRITICAL_SECTION_BEGIN + #define trcCRITICAL_SECTION_END_ON_CORTEX_M_ONLY trcCRITICAL_SECTION_END +#else + #define trcCRITICAL_SECTION_BEGIN_ON_CORTEX_M_ONLY() recorder_busy++; + #define trcCRITICAL_SECTION_END_ON_CORTEX_M_ONLY() recorder_busy--; +#endif + +/*************************************************************************/ +/* KERNEL SPECIFIC OBJECT CONFIGURATION */ +/*************************************************************************/ +#define TRACE_NCLASSES 7 +#define TRACE_CLASS_QUEUE ((traceObjectClass)0) +#define TRACE_CLASS_SEMAPHORE ((traceObjectClass)1) +#define TRACE_CLASS_MUTEX ((traceObjectClass)2) +#define TRACE_CLASS_TASK ((traceObjectClass)3) +#define TRACE_CLASS_ISR ((traceObjectClass)4) +#define TRACE_CLASS_TIMER ((traceObjectClass)5) +#define TRACE_CLASS_EVENTGROUP ((traceObjectClass)6) + +#define TRACE_KERNEL_OBJECT_COUNT (NQueue + NSemaphore + NMutex + NTask + NISR + NTimer + NEventGroup) + +/* The size of the Object Property Table entries, in bytes, per object */ + +/* Queue properties (except name): current number of message in queue */ +#define PropertyTableSizeQueue (NameLenQueue + 1) + +/* Semaphore properties (except name): state (signaled = 1, cleared = 0) */ +#define PropertyTableSizeSemaphore (NameLenSemaphore + 1) + +/* Mutex properties (except name): owner (task handle, 0 = free) */ +#define PropertyTableSizeMutex (NameLenMutex + 1) + +/* Task properties (except name): Byte 0: Current priority + Byte 1: state (if already active) + Byte 2: legacy, not used + Byte 3: legacy, not used */ +#define PropertyTableSizeTask (NameLenTask + 4) + +/* ISR properties: Byte 0: priority + Byte 1: state (if already active) */ +#define PropertyTableSizeISR (NameLenISR + 2) + +/* NTimer properties: Byte 0: state (unused for now) */ +#define PropertyTableSizeTimer (NameLenTimer + 1) + +/* NEventGroup properties: Byte 0-3: state (unused for now)*/ +#define PropertyTableSizeEventGroup (NameLenEventGroup + 4) + + +/* The layout of the byte array representing the Object Property Table */ +#define StartIndexQueue 0 +#define StartIndexSemaphore StartIndexQueue + NQueue * PropertyTableSizeQueue +#define StartIndexMutex StartIndexSemaphore + NSemaphore * PropertyTableSizeSemaphore +#define StartIndexTask StartIndexMutex + NMutex * PropertyTableSizeMutex +#define StartIndexISR StartIndexTask + NTask * PropertyTableSizeTask +#define StartIndexTimer StartIndexISR + NISR * PropertyTableSizeISR +#define StartIndexEventGroup StartIndexTimer + NTimer * PropertyTableSizeTimer + +/* Number of bytes used by the object table */ +#define TRACE_OBJECT_TABLE_SIZE StartIndexEventGroup + NEventGroup * PropertyTableSizeEventGroup + +#define FREERTOS_VERSION_NOT_SET 0 +#define FREERTOS_VERSION_7_3_OR_7_4 1 +#define FREERTOS_VERSION_7_5_OR_7_6 2 +#define FREERTOS_VERSION_8_0_OR_LATER 3 + +/* Includes */ +#include "trcConfig.h" /* Must be first, even before trcTypes.h */ +#include "trcHardwarePort.h" +#include "trcTypes.h" +#include "trcKernelHooks.h" +#include "trcBase.h" +#include "trcKernel.h" +#include "trcUser.h" + +#if (INCLUDE_NEW_TIME_EVENTS == 1 && configUSE_TICKLESS_IDLE != 0) +#error "NewTime events can not be used in combination with tickless idle!" +#endif + +/* Initialization of the object property table */ +void vTraceInitObjectPropertyTable(void); + +/* Initialization of the handle mechanism, see e.g, xTraceGetObjectHandle */ +void vTraceInitObjectHandleStack(void); + +/* Returns the "Not enough handles" error message for the specified object class */ +const char* pszTraceGetErrorNotEnoughHandles(traceObjectClass objectclass); + +/******************************************************************************* + * The event codes - should match the offline config file. + * + * Some sections below are encoded to allow for constructions like: + * + * vTraceStoreKernelCall(EVENTGROUP_CREATE + objectclass, ... + * + * The object class ID is given by the three LSB bits, in such cases. Since each + * object class has a separate object property table, the class ID is needed to + * know what section in the object table to use for getting an object name from + * an object handle. + ******************************************************************************/ + +#define NULL_EVENT (0x00) /* Ignored in the analysis*/ + +/******************************************************************************* + * EVENTGROUP_DIV + * + * Miscellaneous events. + ******************************************************************************/ +#define EVENTGROUP_DIV (NULL_EVENT + 1) /*0x01*/ +#define DIV_XPS (EVENTGROUP_DIV + 0) /*0x01*/ +#define DIV_TASK_READY (EVENTGROUP_DIV + 1) /*0x02*/ +#define DIV_NEW_TIME (EVENTGROUP_DIV + 2) /*0x03*/ + +/******************************************************************************* + * EVENTGROUP_TS + * + * Events for storing task-switches and interrupts. The RESUME events are + * generated if the task/interrupt is already marked active. + ******************************************************************************/ +#define EVENTGROUP_TS (EVENTGROUP_DIV + 3) /*0x04*/ +#define TS_ISR_BEGIN (EVENTGROUP_TS + 0) /*0x04*/ +#define TS_ISR_RESUME (EVENTGROUP_TS + 1) /*0x05*/ +#define TS_TASK_BEGIN (EVENTGROUP_TS + 2) /*0x06*/ +#define TS_TASK_RESUME (EVENTGROUP_TS + 3) /*0x07*/ + +/******************************************************************************* + * EVENTGROUP_OBJCLOSE_NAME + * + * About Close Events + * When an object is evicted from the object property table (object close), two + * internal events are stored (EVENTGROUP_OBJCLOSE_NAME and + * EVENTGROUP_OBJCLOSE_PROP), containing the handle-name mapping and object + * properties valid up to this point. + ******************************************************************************/ +#define EVENTGROUP_OBJCLOSE_NAME (EVENTGROUP_TS + 4) /*0x08*/ + +/******************************************************************************* + * EVENTGROUP_OBJCLOSE_PROP + * + * The internal event carrying properties of deleted objects + * The handle and object class of the closed object is not stored in this event, + * but is assumed to be the same as in the preceding CLOSE event. Thus, these + * two events must be generated from within a critical section. + * When queues are closed, arg1 is the "state" property (i.e., number of + * buffered messages/signals). + * When actors are closed, arg1 is priority, arg2 is handle of the "instance + * finish" event, and arg3 is event code of the "instance finish" event. + * In this case, the lower three bits is the object class of the instance finish + * handle. The lower three bits are not used (always zero) when queues are + * closed since the queue type is given in the previous OBJCLOSE_NAME event. + ******************************************************************************/ +#define EVENTGROUP_OBJCLOSE_PROP (EVENTGROUP_OBJCLOSE_NAME + 8) /*0x10*/ + +/******************************************************************************* + * EVENTGROUP_CREATE + * + * The events in this group are used to log Kernel object creations. + * The lower three bits in the event code gives the object class, i.e., type of + * create operation (task, queue, semaphore, etc). + ******************************************************************************/ +#define EVENTGROUP_CREATE_OBJ_SUCCESS (EVENTGROUP_OBJCLOSE_PROP + 8) /*0x18*/ + +/******************************************************************************* + * EVENTGROUP_SEND + * + * The events in this group are used to log Send/Give events on queues, + * semaphores and mutexes The lower three bits in the event code gives the + * object class, i.e., what type of object that is operated on (queue, semaphore + * or mutex). + ******************************************************************************/ +#define EVENTGROUP_SEND_SUCCESS (EVENTGROUP_CREATE_OBJ_SUCCESS + 8) /*0x20*/ + +/******************************************************************************* + * EVENTGROUP_RECEIVE + * + * The events in this group are used to log Receive/Take events on queues, + * semaphores and mutexes. The lower three bits in the event code gives the + * object class, i.e., what type of object that is operated on (queue, semaphore + * or mutex). + ******************************************************************************/ +#define EVENTGROUP_RECEIVE_SUCCESS (EVENTGROUP_SEND_SUCCESS + 8) /*0x28*/ + +/* Send/Give operations, from ISR */ +#define EVENTGROUP_SEND_FROM_ISR_SUCCESS \ + (EVENTGROUP_RECEIVE_SUCCESS + 8) /*0x30*/ + +/* Receive/Take operations, from ISR */ +#define EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS \ + (EVENTGROUP_SEND_FROM_ISR_SUCCESS + 8) /*0x38*/ + +/* "Failed" event type versions of above (timeout, failed allocation, etc) */ +#define EVENTGROUP_KSE_FAILED \ + (EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS + 8) /*0x40*/ + +/* Failed create calls - memory allocation failed */ +#define EVENTGROUP_CREATE_OBJ_FAILED (EVENTGROUP_KSE_FAILED) /*0x40*/ + +/* Failed send/give - timeout! */ +#define EVENTGROUP_SEND_FAILED (EVENTGROUP_CREATE_OBJ_FAILED + 8) /*0x48*/ + +/* Failed receive/take - timeout! */ +#define EVENTGROUP_RECEIVE_FAILED (EVENTGROUP_SEND_FAILED + 8) /*0x50*/ + +/* Failed non-blocking send/give - queue full */ +#define EVENTGROUP_SEND_FROM_ISR_FAILED (EVENTGROUP_RECEIVE_FAILED + 8) /*0x58*/ + +/* Failed non-blocking receive/take - queue empty */ +#define EVENTGROUP_RECEIVE_FROM_ISR_FAILED \ + (EVENTGROUP_SEND_FROM_ISR_FAILED + 8) /*0x60*/ + +/* Events when blocking on receive/take */ +#define EVENTGROUP_RECEIVE_BLOCK \ + (EVENTGROUP_RECEIVE_FROM_ISR_FAILED + 8) /*0x68*/ + +/* Events when blocking on send/give */ +#define EVENTGROUP_SEND_BLOCK (EVENTGROUP_RECEIVE_BLOCK + 8) /*0x70*/ + +/* Events on queue peek (receive) */ +#define EVENTGROUP_PEEK_SUCCESS (EVENTGROUP_SEND_BLOCK + 8) /*0x78*/ + +/* Events on object delete (vTaskDelete or vQueueDelete) */ +#define EVENTGROUP_DELETE_OBJ_SUCCESS (EVENTGROUP_PEEK_SUCCESS + 8) /*0x80*/ + +/* Other events - object class is implied: TASK */ +#define EVENTGROUP_OTHERS (EVENTGROUP_DELETE_OBJ_SUCCESS + 8) /*0x88*/ +#define TASK_DELAY_UNTIL (EVENTGROUP_OTHERS + 0) /*0x88*/ +#define TASK_DELAY (EVENTGROUP_OTHERS + 1) /*0x89*/ +#define TASK_SUSPEND (EVENTGROUP_OTHERS + 2) /*0x8A*/ +#define TASK_RESUME (EVENTGROUP_OTHERS + 3) /*0x8B*/ +#define TASK_RESUME_FROM_ISR (EVENTGROUP_OTHERS + 4) /*0x8C*/ +#define TASK_PRIORITY_SET (EVENTGROUP_OTHERS + 5) /*0x8D*/ +#define TASK_PRIORITY_INHERIT (EVENTGROUP_OTHERS + 6) /*0x8E*/ +#define TASK_PRIORITY_DISINHERIT (EVENTGROUP_OTHERS + 7) /*0x8F*/ + +#define EVENTGROUP_MISC_PLACEHOLDER (EVENTGROUP_OTHERS + 8) /*0x90*/ +#define PEND_FUNC_CALL (EVENTGROUP_MISC_PLACEHOLDER+0) /*0x90*/ +#define PEND_FUNC_CALL_FROM_ISR (EVENTGROUP_MISC_PLACEHOLDER+1) /*0x91*/ +#define PEND_FUNC_CALL_FAILED (EVENTGROUP_MISC_PLACEHOLDER+2) /*0x92*/ +#define PEND_FUNC_CALL_FROM_ISR_FAILED (EVENTGROUP_MISC_PLACEHOLDER+3) /*0x93*/ +#define MEM_MALLOC_SIZE (EVENTGROUP_MISC_PLACEHOLDER+4) /*0x94*/ +#define MEM_MALLOC_ADDR (EVENTGROUP_MISC_PLACEHOLDER+5) /*0x95*/ +#define MEM_FREE_SIZE (EVENTGROUP_MISC_PLACEHOLDER+6) /*0x96*/ +#define MEM_FREE_ADDR (EVENTGROUP_MISC_PLACEHOLDER+7) /*0x97*/ + +/* User events */ +#define EVENTGROUP_USEREVENT (EVENTGROUP_MISC_PLACEHOLDER + 8) /*0x98*/ +#define USER_EVENT (EVENTGROUP_USEREVENT + 0) + +/* Allow for 0-15 arguments (the number of args is added to event code) */ +#define USER_EVENT_LAST (EVENTGROUP_USEREVENT + 15) /*0xA7*/ + +/******************************************************************************* + * XTS Event - eXtended TimeStamp events + * The timestamps used in the recorder are "differential timestamps" (DTS), i.e. + * the time since the last stored event. The DTS fields are either 1 or 2 bytes + * in the other events, depending on the bytes available in the event struct. + * If the time since the last event (the DTS) is larger than allowed for by + * the DTS field of the current event, an XTS event is inserted immediately + * before the original event. The XTS event contains up to 3 additional bytes + * of the DTS value - the higher bytes of the true DTS value. The lower 1-2 + * bytes are stored in the normal DTS field. + * There are two types of XTS events, XTS8 and XTS16. An XTS8 event is stored + * when there is only room for 1 byte (8 bit) DTS data in the original event, + * which means a limit of 0xFF (255). The XTS16 is used when the original event + * has a 16 bit DTS field and thereby can handle values up to 0xFFFF (65535). + * + * Using a very high frequency time base can result in many XTS events. + * Preferably, the time between two OS ticks should fit in 16 bits, i.e., + * at most 65535. If your time base has a higher frequency, you can define + * the TRACE + ******************************************************************************/ + +#define EVENTGROUP_SYS (EVENTGROUP_USEREVENT + 16) /*0xA8*/ +#define XTS8 (EVENTGROUP_SYS + 0) /*0xA8*/ +#define XTS16 (EVENTGROUP_SYS + 1) /*0xA9*/ +#define EVENT_BEING_WRITTEN (EVENTGROUP_SYS + 2) /*0xAA*/ +#define RESERVED_DUMMY_CODE (EVENTGROUP_SYS + 3) /*0xAB*/ +#define LOW_POWER_BEGIN (EVENTGROUP_SYS + 4) /*0xAC*/ +#define LOW_POWER_END (EVENTGROUP_SYS + 5) /*0xAD*/ +#define XID (EVENTGROUP_SYS + 6) /*0xAE*/ +#define XTS16L (EVENTGROUP_SYS + 7) /*0xAF*/ + +#define EVENTGROUP_TIMER (EVENTGROUP_SYS + 8) /*0xB0*/ +#define TIMER_CREATE (EVENTGROUP_TIMER + 0) /*0xB0*/ +#define TIMER_START (EVENTGROUP_TIMER + 1) /*0xB1*/ +#define TIMER_RST (EVENTGROUP_TIMER + 2) /*0xB2*/ +#define TIMER_STOP (EVENTGROUP_TIMER + 3) /*0xB3*/ +#define TIMER_CHANGE_PERIOD (EVENTGROUP_TIMER + 4) /*0xB4*/ +#define TIMER_DELETE (EVENTGROUP_TIMER + 5) /*0xB5*/ +#define TIMER_START_FROM_ISR (EVENTGROUP_TIMER + 6) /*0xB6*/ +#define TIMER_RESET_FROM_ISR (EVENTGROUP_TIMER + 7) /*0xB7*/ +#define TIMER_STOP_FROM_ISR (EVENTGROUP_TIMER + 8) /*0xB8*/ + +#define TIMER_CREATE_FAILED (EVENTGROUP_TIMER + 9) /*0xB9*/ +#define TIMER_START_FAILED (EVENTGROUP_TIMER + 10) /*0xBA*/ +#define TIMER_RESET_FAILED (EVENTGROUP_TIMER + 11) /*0xBB*/ +#define TIMER_STOP_FAILED (EVENTGROUP_TIMER + 12) /*0xBC*/ +#define TIMER_CHANGE_PERIOD_FAILED (EVENTGROUP_TIMER + 13) /*0xBD*/ +#define TIMER_DELETE_FAILED (EVENTGROUP_TIMER + 14) /*0xBE*/ +#define TIMER_START_FROM_ISR_FAILED (EVENTGROUP_TIMER + 15) /*0xBF*/ +#define TIMER_RESET_FROM_ISR_FAILED (EVENTGROUP_TIMER + 16) /*0xC0*/ +#define TIMER_STOP_FROM_ISR_FAILED (EVENTGROUP_TIMER + 17) /*0xC1*/ + +#define EVENTGROUP_EG (EVENTGROUP_TIMER + 18) /*0xC2*/ +#define EVENT_GROUP_CREATE (EVENTGROUP_EG + 0) /*0xC2*/ +#define EVENT_GROUP_CREATE_FAILED (EVENTGROUP_EG + 1) /*0xC3*/ +#define EVENT_GROUP_SYNC_BLOCK (EVENTGROUP_EG + 2) /*0xC4*/ +#define EVENT_GROUP_SYNC_END (EVENTGROUP_EG + 3) /*0xC5*/ +#define EVENT_GROUP_WAIT_BITS_BLOCK (EVENTGROUP_EG + 4) /*0xC6*/ +#define EVENT_GROUP_WAIT_BITS_END (EVENTGROUP_EG + 5) /*0xC7*/ +#define EVENT_GROUP_CLEAR_BITS (EVENTGROUP_EG + 6) /*0xC8*/ +#define EVENT_GROUP_CLEAR_BITS_FROM_ISR (EVENTGROUP_EG + 7) /*0xC9*/ +#define EVENT_GROUP_SET_BITS (EVENTGROUP_EG + 8) /*0xCA*/ +#define EVENT_GROUP_DELETE (EVENTGROUP_EG + 9) /*0xCB*/ +#define EVENT_GROUP_SYNC_END_FAILED (EVENTGROUP_EG + 10) /*0xCC*/ +#define EVENT_GROUP_WAIT_BITS_END_FAILED (EVENTGROUP_EG + 11) /*0xCD*/ +#define EVENT_GROUP_SET_BITS_FROM_ISR (EVENTGROUP_EG + 12) /*0xCE*/ +#define EVENT_GROUP_SET_BITS_FROM_ISR_FAILED (EVENTGROUP_EG + 13) /*0xCF*/ + +#define TASK_INSTANCE_FINISHED_NEXT_KSE (EVENTGROUP_EG + 14) /*0xD0*/ +#define TASK_INSTANCE_FINISHED_DIRECT (EVENTGROUP_EG + 15) /*0xD1*/ + +#define TRACE_TASK_NOTIFY_GROUP (EVENTGROUP_EG + 16) /*0xD2*/ +#define TRACE_TASK_NOTIFY (TRACE_TASK_NOTIFY_GROUP + 0) /*0xD2*/ +#define TRACE_TASK_NOTIFY_TAKE (TRACE_TASK_NOTIFY_GROUP + 1) /*0xD3*/ +#define TRACE_TASK_NOTIFY_TAKE_BLOCK (TRACE_TASK_NOTIFY_GROUP + 2) /*0xD4*/ +#define TRACE_TASK_NOTIFY_TAKE_FAILED (TRACE_TASK_NOTIFY_GROUP + 3) /*0xD5*/ +#define TRACE_TASK_NOTIFY_WAIT (TRACE_TASK_NOTIFY_GROUP + 4) /*0xD6*/ +#define TRACE_TASK_NOTIFY_WAIT_BLOCK (TRACE_TASK_NOTIFY_GROUP + 5) /*0xD7*/ +#define TRACE_TASK_NOTIFY_WAIT_FAILED (TRACE_TASK_NOTIFY_GROUP + 6) /*0xD8*/ +#define TRACE_TASK_NOTIFY_FROM_ISR (TRACE_TASK_NOTIFY_GROUP + 7) /*0xD9*/ +#define TRACE_TASK_NOTIFY_GIVE_FROM_ISR (TRACE_TASK_NOTIFY_GROUP + 8) /*0xDA*/ + +/************************************************************************/ +/* KERNEL SPECIFIC DATA AND FUNCTIONS NEEDED TO PROVIDE THE */ +/* FUNCTIONALITY REQUESTED BY THE TRACE RECORDER */ +/************************************************************************/ + +/****************************************************************************** + * TraceObjectClassTable + * Translates a FreeRTOS QueueType into trace objects classes (TRACE_CLASS_). + * This was added since we want to map both types of Mutex and both types of + * Semaphores on common classes for all Mutexes and all Semaphores respectively. + * + * FreeRTOS Queue types + * #define queueQUEUE_TYPE_BASE (0U) => TRACE_CLASS_QUEUE + * #define queueQUEUE_TYPE_MUTEX (1U) => TRACE_CLASS_MUTEX + * #define queueQUEUE_TYPE_COUNTING_SEMAPHORE (2U) => TRACE_CLASS_SEMAPHORE + * #define queueQUEUE_TYPE_BINARY_SEMAPHORE (3U) => TRACE_CLASS_SEMAPHORE + * #define queueQUEUE_TYPE_RECURSIVE_MUTEX (4U) => TRACE_CLASS_MUTEX + ******************************************************************************/ + +extern traceObjectClass TraceObjectClassTable[5]; + +/* These functions are implemented in the .c file since certain header files +must not be included in this one */ +objectHandleType prvTraceGetObjectNumber(void* handle); +unsigned char prvTraceGetObjectType(void* handle); +objectHandleType prvTraceGetTaskNumber(void* handle); +unsigned char prvTraceIsSchedulerActive(void); +unsigned char prvTraceIsSchedulerSuspended(void); +unsigned char prvTraceIsSchedulerStarted(void); +void* prvTraceGetCurrentTaskHandle(void); + +#if (configUSE_TIMERS == 1) +#undef INCLUDE_xTimerGetTimerDaemonTaskHandle +#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1 +#endif + +/************************************************************************/ +/* KERNEL SPECIFIC MACROS USED BY THE TRACE RECORDER */ +/************************************************************************/ + +#define TRACE_MALLOC(size) pvPortMalloc(size) +#define TRACE_IS_SCHEDULER_ACTIVE() prvTraceIsSchedulerActive() +#define TRACE_IS_SCHEDULER_STARTED() prvTraceIsSchedulerStarted() +#define TRACE_IS_SCHEDULER_SUSPENDED() prvTraceIsSchedulerSuspended() +#define TRACE_GET_CURRENT_TASK() prvTraceGetCurrentTaskHandle() + +#define TRACE_GET_TASK_PRIORITY(pxTCB) ((uint8_t)pxTCB->uxPriority) +#define TRACE_GET_TASK_NAME(pxTCB) ((char*)pxTCB->pcTaskName) +#define TRACE_GET_TASK_NUMBER(pxTCB) (prvTraceGetTaskNumber(pxTCB)) +#define TRACE_SET_TASK_NUMBER(pxTCB) pxTCB->uxTaskNumber = xTraceGetObjectHandle(TRACE_CLASS_TASK); + +#define TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass) TraceObjectClassTable[kernelClass] +#define TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject) TRACE_GET_CLASS_TRACE_CLASS(CLASS, prvTraceGetObjectType(pxObject)) + +/* Note: Timer tracing only supported on FreeRTOS v8 or later, so "Timer_t" is safe to use! */ +#define TRACE_GET_TIMER_NUMBER(tmr) ( ( objectHandleType ) ((Timer_t*)tmr)->uxTimerNumber ) +#define TRACE_SET_TIMER_NUMBER(tmr) ((Timer_t*)tmr)->uxTimerNumber = xTraceGetObjectHandle(TRACE_CLASS_TIMER); +#define TRACE_GET_TIMER_NAME(pxTimer) pxTimer->pcTimerName +#define TRACE_GET_TIMER_PERIOD(pxTimer) pxTimer->xTimerPeriodInTicks + +#define TRACE_GET_EVENTGROUP_NUMBER(eg) ( ( objectHandleType ) uxEventGroupGetNumber(eg) ) +#define TRACE_SET_EVENTGROUP_NUMBER(eg) ((EventGroup_t*)eg)->uxEventGroupNumber = xTraceGetObjectHandle(TRACE_CLASS_EVENTGROUP); + +#define TRACE_GET_OBJECT_NUMBER(CLASS, pxObject) (prvTraceGetObjectNumber(pxObject)) + +#if (FREERTOS_VERSION < FREERTOS_VERSION_8_0_OR_LATER) + #define TRACE_SET_OBJECT_NUMBER(CLASS, pxObject) pxObject->ucQueueNumber = xTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); +#else + #define TRACE_SET_OBJECT_NUMBER(CLASS, pxObject) pxObject->uxQueueNumber = xTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); +#endif + +#define TRACE_GET_CLASS_EVENT_CODE(SERVICE, RESULT, CLASS, kernelClass) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass)) +#define TRACE_GET_OBJECT_EVENT_CODE(SERVICE, RESULT, CLASS, pxObject) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)) +#define TRACE_GET_TASK_EVENT_CODE(SERVICE, RESULT, CLASS, pxTCB) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_CLASS_TASK) + +/************************************************************************/ +/* KERNEL SPECIFIC WRAPPERS THAT SHOULD BE CALLED BY THE KERNEL */ +/************************************************************************/ + +#if (configUSE_TICKLESS_IDLE != 0) + +#undef traceLOW_POWER_IDLE_BEGIN +#define traceLOW_POWER_IDLE_BEGIN() \ + { \ + extern uint32_t trace_disable_timestamp; \ + vTraceStoreLowPower(0); \ + trace_disable_timestamp = 1; \ + } + +#undef traceLOW_POWER_IDLE_END +#define traceLOW_POWER_IDLE_END() \ + { \ + extern uint32_t trace_disable_timestamp; \ + trace_disable_timestamp = 0; \ + vTraceStoreLowPower(1); \ + } + +#endif + +/* A macro that will update the tick count when returning from tickless idle */ +#undef traceINCREASE_TICK_COUNT +/* 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.*/ +#define traceINCREASE_TICK_COUNT( xCount ) { DWT_CYCLES_ADDED += (xCount * (TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ)); } + +/* Called for each task that becomes ready */ +#undef traceMOVED_TASK_TO_READY_STATE +#define traceMOVED_TASK_TO_READY_STATE( pxTCB ) \ + trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB); + +/* Called on each OS tick. Will call uiPortGetTimestamp to make sure it is called at least once every OS tick. */ +#undef traceTASK_INCREMENT_TICK + +#if (FREERTOS_VERSION == FREERTOS_VERSION_7_3_OR_7_4) + +#define traceTASK_INCREMENT_TICK( xTickCount ) \ + if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxMissedTicks == 0) { trcKERNEL_HOOKS_INCREMENT_TICK(); } \ + if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE) { trcKERNEL_HOOKS_NEW_TIME(DIV_NEW_TIME, xTickCount + 1); } + +#else + +#define traceTASK_INCREMENT_TICK( xTickCount ) \ + if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxPendedTicks == 0) { trcKERNEL_HOOKS_INCREMENT_TICK(); } \ + if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE) { trcKERNEL_HOOKS_NEW_TIME(DIV_NEW_TIME, xTickCount + 1); } + +#endif + +/* Called on each task-switch */ +#undef traceTASK_SWITCHED_IN +#define traceTASK_SWITCHED_IN() \ + trcKERNEL_HOOKS_TASK_SWITCH(TRACE_GET_CURRENT_TASK()); + +/* Called on vTaskSuspend */ +#undef traceTASK_SUSPEND +#define traceTASK_SUSPEND( pxTaskToSuspend ) \ + trcKERNEL_HOOKS_TASK_SUSPEND(TASK_SUSPEND, pxTaskToSuspend); + +/* Called on vTaskDelay - note the use of FreeRTOS variable xTicksToDelay */ +#undef traceTASK_DELAY +#define traceTASK_DELAY() \ + trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY, pxCurrentTCB, xTicksToDelay); \ + trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); + +/* Called on vTaskDelayUntil - note the use of FreeRTOS variable xTimeToWake */ +#undef traceTASK_DELAY_UNTIL +#define traceTASK_DELAY_UNTIL() \ + trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY_UNTIL, pxCurrentTCB, xTimeToWake); \ + trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); + +#if (INCLUDE_OBJECT_DELETE == 1) +/* Called on vTaskDelete */ +#undef traceTASK_DELETE +#define traceTASK_DELETE( pxTaskToDelete ) \ + { TRACE_SR_ALLOC_CRITICAL_SECTION(); \ + TRACE_ENTER_CRITICAL_SECTION(); \ + trcKERNEL_HOOKS_TASK_DELETE(DELETE_OBJ, pxTaskToDelete); \ + TRACE_EXIT_CRITICAL_SECTION(); } +#endif + +#if (INCLUDE_OBJECT_DELETE == 1) +/* Called on vQueueDelete */ +#undef traceQUEUE_DELETE +#define traceQUEUE_DELETE( pxQueue ) \ + { TRACE_SR_ALLOC_CRITICAL_SECTION(); \ + TRACE_ENTER_CRITICAL_SECTION(); \ + trcKERNEL_HOOKS_OBJECT_DELETE(DELETE_OBJ, UNUSED, pxQueue); \ + TRACE_EXIT_CRITICAL_SECTION(); } +#endif + +/* Called on vTaskCreate */ +#undef traceTASK_CREATE +#define traceTASK_CREATE(pxNewTCB) \ + if (pxNewTCB != NULL) \ + { \ + trcKERNEL_HOOKS_TASK_CREATE(CREATE_OBJ, UNUSED, pxNewTCB); \ + } + +/* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */ +#undef traceTASK_CREATE_FAILED +#define traceTASK_CREATE_FAILED() \ + trcKERNEL_HOOKS_TASK_CREATE_FAILED(CREATE_OBJ, UNUSED); + +/* Called in xQueueCreate, and thereby for all other object based on queues, such as semaphores. */ +#undef traceQUEUE_CREATE +#define traceQUEUE_CREATE( pxNewQueue )\ + trcKERNEL_HOOKS_OBJECT_CREATE(CREATE_OBJ, UNUSED, pxNewQueue); + +/* Called in xQueueCreate, if the queue creation fails */ +#undef traceQUEUE_CREATE_FAILED +#define traceQUEUE_CREATE_FAILED( queueType ) \ + trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(CREATE_OBJ, UNUSED, queueType); + +/* Called in xQueueCreateMutex, and thereby also from xSemaphoreCreateMutex and xSemaphoreCreateRecursiveMutex */ +#undef traceCREATE_MUTEX +#define traceCREATE_MUTEX( pxNewQueue ) \ + trcKERNEL_HOOKS_OBJECT_CREATE(CREATE_OBJ, UNUSED, pxNewQueue); + +/* Called in xQueueCreateMutex when the operation fails (when memory allocation fails) */ +#undef traceCREATE_MUTEX_FAILED +#define traceCREATE_MUTEX_FAILED() \ + trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(CREATE_OBJ, UNUSED, queueQUEUE_TYPE_MUTEX); + +/* Called when the Mutex can not be given, since not holder */ +#undef traceGIVE_MUTEX_RECURSIVE_FAILED +#define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex ) \ + trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, FAILED, UNUSED, pxMutex); + +/* Called when a message is sent to a queue */ /* CS IS NEW ! */ +#undef traceQUEUE_SEND +#define traceQUEUE_SEND( pxQueue ) \ + trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, SUCCESS, UNUSED, pxQueue); \ + 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)); + +/* Called when a message failed to be sent to a queue (timeout) */ +#undef traceQUEUE_SEND_FAILED +#define traceQUEUE_SEND_FAILED( pxQueue ) \ + trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, FAILED, UNUSED, pxQueue); + +/* Called when the task is blocked due to a send operation on a full queue */ +#undef traceBLOCKING_ON_QUEUE_SEND +#define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) \ + trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, BLOCK, UNUSED, pxQueue); + +/* Called when a message is received from a queue */ +#undef traceQUEUE_RECEIVE +#define traceQUEUE_RECEIVE( pxQueue ) \ + trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, SUCCESS, UNUSED, pxQueue); \ + 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)); + +/* Called when a receive operation on a queue fails (timeout) */ +#undef traceQUEUE_RECEIVE_FAILED +#define traceQUEUE_RECEIVE_FAILED( pxQueue ) \ + trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, FAILED, UNUSED, pxQueue); + +/* Called when the task is blocked due to a receive operation on an empty queue */ +#undef traceBLOCKING_ON_QUEUE_RECEIVE +#define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) \ + trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, BLOCK, UNUSED, pxQueue); \ + if (TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, pxQueue) != TRACE_CLASS_MUTEX) \ + {trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();} + +/* Called on xQueuePeek */ +#undef traceQUEUE_PEEK +#define traceQUEUE_PEEK( pxQueue ) \ + trcKERNEL_HOOKS_KERNEL_SERVICE(PEEK, SUCCESS, UNUSED, pxQueue); + +/* Called when a message is sent from interrupt context, e.g., using xQueueSendFromISR */ +#undef traceQUEUE_SEND_FROM_ISR +#define traceQUEUE_SEND_FROM_ISR( pxQueue ) \ + trcKERNEL_HOOKS_KERNEL_SERVICE(SEND_FROM_ISR, SUCCESS, UNUSED, pxQueue); \ + trcKERNEL_HOOKS_SET_OBJECT_STATE(UNUSED, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting + 1)); + +/* Called when a message send from interrupt context fails (since the queue was full) */ +#undef traceQUEUE_SEND_FROM_ISR_FAILED +#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) \ + trcKERNEL_HOOKS_KERNEL_SERVICE(SEND_FROM_ISR, FAILED, UNUSED, pxQueue); + +/* Called when a message is received in interrupt context, e.g., using xQueueReceiveFromISR */ +#undef traceQUEUE_RECEIVE_FROM_ISR +#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) \ + trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE_FROM_ISR, SUCCESS, UNUSED, pxQueue); \ + trcKERNEL_HOOKS_SET_OBJECT_STATE(UNUSED, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting - 1)); + +/* Called when a message receive from interrupt context fails (since the queue was empty) */ +#undef traceQUEUE_RECEIVE_FROM_ISR_FAILED +#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) \ + trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE_FROM_ISR, FAILED, UNUSED, pxQueue); + +/* Called in vTaskPrioritySet */ +#undef traceTASK_PRIORITY_SET +#define traceTASK_PRIORITY_SET( pxTask, uxNewPriority ) \ + trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_SET, pxTask, uxNewPriority); + +/* Called in vTaskPriorityInherit, which is called by Mutex operations */ +#undef traceTASK_PRIORITY_INHERIT +#define traceTASK_PRIORITY_INHERIT( pxTask, uxNewPriority ) \ + trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_INHERIT, pxTask, uxNewPriority); + +/* Called in vTaskPriorityDisinherit, which is called by Mutex operations */ +#undef traceTASK_PRIORITY_DISINHERIT +#define traceTASK_PRIORITY_DISINHERIT( pxTask, uxNewPriority ) \ + trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_DISINHERIT, pxTask, uxNewPriority); + +/* Called in vTaskResume */ +#undef traceTASK_RESUME +#define traceTASK_RESUME( pxTaskToResume ) \ + trcKERNEL_HOOKS_TASK_RESUME(TASK_RESUME, pxTaskToResume); + +/* Called in vTaskResumeFromISR */ +#undef traceTASK_RESUME_FROM_ISR +#define traceTASK_RESUME_FROM_ISR( pxTaskToResume ) \ + trcKERNEL_HOOKS_TASK_RESUME(TASK_RESUME_FROM_ISR, pxTaskToResume); + + +#if (FREERTOS_VERSION >= FREERTOS_VERSION_8_0_OR_LATER) + +#if (INCLUDE_MEMMANG_EVENTS == 1) + +extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t size); + +#undef traceMALLOC +#define traceMALLOC( pvAddress, uiSize ) {if (pvAddress != 0) vTraceStoreMemMangEvent(MEM_MALLOC_SIZE, ( uint32_t ) pvAddress, (int32_t)uiSize); } + +#undef traceFREE +#define traceFREE( pvAddress, uiSize ) {vTraceStoreMemMangEvent(MEM_FREE_SIZE, ( uint32_t ) pvAddress, (int32_t)(-uiSize)); } + +#endif + +/* Called in timer.c - xTimerCreate */ +#undef traceTIMER_CREATE +#define traceTIMER_CREATE(tmr) \ + trcKERNEL_HOOKS_TIMER_CREATE(TIMER_CREATE, tmr); + +#undef traceTIMER_CREATE_FAILED +#define traceTIMER_CREATE_FAILED() \ + trcKERNEL_HOOKS_TIMER_EVENT(TIMER_CREATE_FAILED, 0); + +/* Note that xCommandID can never be tmrCOMMAND_EXECUTE_CALLBACK (-1) since the trace macro is not called in that case */ +#undef traceTIMER_COMMAND_SEND +#define traceTIMER_COMMAND_SEND(tmr, xCommandID, xOptionalValue, xReturn) \ +if (xCommandID > tmrCOMMAND_START_DONT_TRACE){\ + if (xCommandID == tmrCOMMAND_CHANGE_PERIOD) vTraceStoreKernelCallWithParam((xReturn == pdPASS) ? TIMER_CHANGE_PERIOD : TIMER_CHANGE_PERIOD_FAILED, TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(tmr), xOptionalValue);\ + else if ((xCommandID == tmrCOMMAND_DELETE) && (xReturn == pdPASS)){ trcKERNEL_HOOKS_TIMER_DELETE(TIMER_DELETE, tmr); } \ + else {trcKERNEL_HOOKS_TIMER_EVENT(EVENTGROUP_TIMER + xCommandID + ((xReturn == pdPASS)?0:(TIMER_CREATE_FAILED - TIMER_CREATE)), tmr); }\ +} + +#undef tracePEND_FUNC_CALL +#define tracePEND_FUNC_CALL(func, arg1, arg2, ret) \ +if (ret == pdPASS) \ + vTraceStoreKernelCall(PEND_FUNC_CALL, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) ); \ +else \ + vTraceStoreKernelCall(PEND_FUNC_CALL_FAILED, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) ); + +#undef tracePEND_FUNC_CALL_FROM_ISR +#define tracePEND_FUNC_CALL_FROM_ISR(func, arg1, arg2, ret) \ + if (! uiInEventGroupSetBitsFromISR) vTraceStoreKernelCall(PEND_FUNC_CALL_FROM_ISR, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) ); \ + uiInEventGroupSetBitsFromISR = 0; +#endif + +#undef traceEVENT_GROUP_CREATE +#define traceEVENT_GROUP_CREATE(eg) \ + TRACE_SET_EVENTGROUP_NUMBER(eg); \ + vTraceStoreKernelCall(EVENT_GROUP_CREATE, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg)); + +#undef traceEVENT_GROUP_DELETE +#define traceEVENT_GROUP_DELETE(eg) \ + vTraceStoreKernelCall(EVENT_GROUP_DELETE, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg)); \ + vTraceStoreObjectNameOnCloseEvent(TRACE_GET_EVENTGROUP_NUMBER(eg), TRACE_CLASS_EVENTGROUP); \ + vTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_EVENTGROUP_NUMBER(eg), TRACE_CLASS_EVENTGROUP); \ + vTraceFreeObjectHandle(TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg)); + +#undef traceEVENT_GROUP_CREATE_FAILED +#define traceEVENT_GROUP_CREATE_FAILED() \ + vTraceStoreKernelCall(EVENT_GROUP_CREATE_FAILED, TRACE_CLASS_EVENTGROUP, 0); + +#undef traceEVENT_GROUP_SYNC_BLOCK +#define traceEVENT_GROUP_SYNC_BLOCK(eg, bitsToSet, bitsToWaitFor) \ + vTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_BLOCK, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); + +#undef traceEVENT_GROUP_SYNC_END +#define traceEVENT_GROUP_SYNC_END(eg, bitsToSet, bitsToWaitFor, wasTimeout) \ + if (wasTimeout){ vTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_END_FAILED, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor);} \ + else{ vTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_END, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); } + +#undef traceEVENT_GROUP_WAIT_BITS_BLOCK +#define traceEVENT_GROUP_WAIT_BITS_BLOCK(eg, bitsToWaitFor) \ + vTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_BLOCK, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); \ + trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); + +#undef traceEVENT_GROUP_WAIT_BITS_END +#define traceEVENT_GROUP_WAIT_BITS_END(eg, bitsToWaitFor, wasTimeout) \ + if (wasTimeout){ vTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_END_FAILED, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); } \ + else{ vTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_END, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); } + +#undef traceEVENT_GROUP_CLEAR_BITS +#define traceEVENT_GROUP_CLEAR_BITS(eg, bitsToClear) \ + if (bitsToClear) vTraceStoreKernelCallWithParam(EVENT_GROUP_CLEAR_BITS, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToClear); + +#undef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR +#define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR(eg, bitsToClear) \ + if (bitsToClear) vTraceStoreKernelCallWithParam(EVENT_GROUP_CLEAR_BITS_FROM_ISR, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToClear); + +#undef traceEVENT_GROUP_SET_BITS +#define traceEVENT_GROUP_SET_BITS(eg, bitsToSet) \ + vTraceStoreKernelCallWithParam(EVENT_GROUP_SET_BITS, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToSet); + +#undef traceEVENT_GROUP_SET_BITS_FROM_ISR +#define traceEVENT_GROUP_SET_BITS_FROM_ISR(eg, bitsToSet) \ + vTraceStoreKernelCallWithParam(EVENT_GROUP_SET_BITS_FROM_ISR, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToSet); \ + uiInEventGroupSetBitsFromISR = 1; + +#undef traceTASK_NOTIFY_TAKE +#define traceTASK_NOTIFY_TAKE() \ + if (pxCurrentTCB->eNotifyState == eNotified) \ + vTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_TAKE, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \ + else \ + vTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_TAKE_FAILED, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); + +#undef traceTASK_NOTIFY_TAKE_BLOCK +#define traceTASK_NOTIFY_TAKE_BLOCK() \ + vTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_TAKE_BLOCK, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \ + trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); + +#undef traceTASK_NOTIFY_WAIT +#define traceTASK_NOTIFY_WAIT() \ + if (pxCurrentTCB->eNotifyState == eNotified) \ + vTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \ + else \ + vTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_FAILED, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); + +#undef traceTASK_NOTIFY_WAIT_BLOCK +#define traceTASK_NOTIFY_WAIT_BLOCK() \ + vTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_BLOCK, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \ + trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); + +#undef traceTASK_NOTIFY +#define traceTASK_NOTIFY() \ + vTraceStoreKernelCall(TRACE_TASK_NOTIFY, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTaskToNotify)); + +#undef traceTASK_NOTIFY_FROM_ISR +#define traceTASK_NOTIFY_FROM_ISR() \ + vTraceStoreKernelCall(TRACE_TASK_NOTIFY_FROM_ISR, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTaskToNotify)); + +#undef traceTASK_NOTIFY_GIVE_FROM_ISR +#define traceTASK_NOTIFY_GIVE_FROM_ISR() \ + vTraceStoreKernelCall(TRACE_TASK_NOTIFY_GIVE_FROM_ISR, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTaskToNotify)); + +/************************************************************************/ +/* KERNEL SPECIFIC MACROS TO EXCLUDE OR INCLUDE THINGS IN TRACE */ +/************************************************************************/ + +/* Returns the exclude state of the object */ +uint8_t uiTraceIsObjectExcluded(traceObjectClass objectclass, objectHandleType handle); + +#define TRACE_SET_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, queueIndex) +#define TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, queueIndex) +#define TRACE_GET_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, queueIndex) + +#define TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+semaphoreIndex) +#define TRACE_CLEAR_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+semaphoreIndex) +#define TRACE_GET_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+semaphoreIndex) + +#define TRACE_SET_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+mutexIndex) +#define TRACE_CLEAR_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+mutexIndex) +#define TRACE_GET_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+mutexIndex) + +#define TRACE_SET_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+taskIndex) +#define TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+taskIndex) +#define TRACE_GET_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+taskIndex) + +#define TRACE_SET_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+timerIndex) +#define TRACE_CLEAR_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+timerIndex) +#define TRACE_GET_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+timerIndex) + +#define TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+NTimer+1+egIndex) +#define TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+NTimer+1+egIndex) +#define TRACE_GET_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+NTimer+1+egIndex) + + +#define TRACE_CLEAR_OBJECT_FLAG_ISEXCLUDED(objectclass, handle) \ +switch (objectclass) \ +{ \ +case TRACE_CLASS_QUEUE: \ + TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(handle); \ + break; \ +case TRACE_CLASS_SEMAPHORE: \ + TRACE_CLEAR_SEMAPHORE_FLAG_ISEXCLUDED(handle); \ + break; \ +case TRACE_CLASS_MUTEX: \ + TRACE_CLEAR_MUTEX_FLAG_ISEXCLUDED(handle); \ + break; \ +case TRACE_CLASS_TASK: \ + TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(handle); \ + break; \ +case TRACE_CLASS_TIMER: \ + TRACE_CLEAR_TIMER_FLAG_ISEXCLUDED(handle); \ + break; \ +case TRACE_CLASS_EVENTGROUP: \ + TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(handle); \ + break; \ +} + +#define TRACE_SET_OBJECT_FLAG_ISEXCLUDED(objectclass, handle) \ +switch (objectclass) \ +{ \ +case TRACE_CLASS_QUEUE: \ + TRACE_SET_QUEUE_FLAG_ISEXCLUDED(handle); \ + break; \ +case TRACE_CLASS_SEMAPHORE: \ + TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(handle); \ + break; \ +case TRACE_CLASS_MUTEX: \ + TRACE_SET_MUTEX_FLAG_ISEXCLUDED(handle); \ + break; \ +case TRACE_CLASS_TASK: \ + TRACE_SET_TASK_FLAG_ISEXCLUDED(handle); \ + break; \ +case TRACE_CLASS_TIMER: \ + TRACE_SET_TIMER_FLAG_ISEXCLUDED(handle); \ + break; \ +case TRACE_CLASS_EVENTGROUP: \ + TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(handle); \ + break; \ +} + +/* Task */ +#define vTraceExcludeTaskFromTrace(handle) \ +TRACE_SET_TASK_FLAG_ISEXCLUDED(TRACE_GET_TASK_NUMBER(handle)); + +#define vTraceIncludeTaskInTrace(handle) \ +TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(TRACE_GET_TASK_NUMBER(handle)); + + +/* Queue */ +#define vTraceExcludeQueueFromTrace(handle) \ +TRACE_SET_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle)); + +#define vTraceIncludeQueueInTrace(handle) \ +TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle)); + + +/* Semaphore */ +#define vTraceExcludeSemaphoreFromTrace(handle) \ +TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle)); + +#define vTraceIncludeSemaphoreInTrace(handle) \ +TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle)); + + +/* Mutex */ +#define vTraceExcludeMutexFromTrace(handle) \ +TRACE_SET_MUTEX_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle)); + +#define vTraceIncludeMutexInTrace(handle) \ +TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle)); + +/* Timer */ +#define vTraceExcludeTimerFromTrace(handle) \ +TRACE_SET_TIMER_FLAG_ISEXCLUDED(TRACE_GET_TIMER_NUMBER(handle)); + +#define vTraceIncludeTimerInTrace(handle) \ +TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_TIMER_NUMBER(handle)); + +/* Event Group */ +#define vTraceExcludeEventGroupFromTrace(handle) \ +TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(TRACE_GET_EVENTGROUP_NUMBER(handle)); + +#define vTraceIncludeEventGroupInTrace(handle) \ +TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(TRACE_GET_EVENTGROUP_NUMBER(handle)); + + +/* Kernel Services */ +#define vTraceExcludeKernelServiceDelayFromTrace() \ +TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY); \ +TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY_UNTIL); + +#define vTraceIncludeKernelServiceDelayInTrace() \ +TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY); \ +TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY_UNTIL); + +/* HELPER MACROS FOR KERNEL SERVICES FOR OBJECTS */ +#define vTraceExcludeKernelServiceSendFromTrace_HELPER(class) \ +TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_SUCCESS + class); \ +TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_BLOCK + class); \ +TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FAILED + class); \ +TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_SUCCESS + class); \ +TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_FAILED + class); + +#define vTraceIncludeKernelServiceSendInTrace_HELPER(class) \ +TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_SUCCESS + class); \ +TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_BLOCK + class); \ +TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FAILED + class); \ +TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_SUCCESS + class); \ +TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_FAILED + class); + +#define vTraceExcludeKernelServiceReceiveFromTrace_HELPER(class) \ +TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_SUCCESS + class); \ +TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_BLOCK + class); \ +TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FAILED + class); \ +TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS + class); \ +TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_FAILED + class); + +#define vTraceIncludeKernelServiceReceiveInTrace_HELPER(class) \ +TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_SUCCESS + class); \ +TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_BLOCK + class); \ +TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FAILED + class); \ +TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS + class); \ +TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_FAILED + class); + +/* EXCLUDE AND INCLUDE FOR QUEUE */ +#define vTraceExcludeKernelServiceQueueSendFromTrace() \ +vTraceExcludeKernelServiceSendFromTrace_HELPER(TRACE_CLASS_QUEUE); + +#define vTraceIncludeKernelServiceQueueSendInTrace() \ +vTraceIncludeKernelServiceSendInTrace_HELPER(TRACE_CLASS_QUEUE); + +#define vTraceExcludeKernelServiceQueueReceiveFromTrace() \ +vTraceExcludeKernelServiceReceiveFromTrace_HELPER(TRACE_CLASS_QUEUE); + +#define vTraceIncludeKernelServiceQueueReceiveInTrace() \ +vTraceIncludeKernelServiceReceiveInTrace_HELPER(TRACE_CLASS_QUEUE); + +/* EXCLUDE AND INCLUDE FOR SEMAPHORE */ +#define vTraceExcludeKernelServiceSemaphoreSendFromTrace() \ +vTraceExcludeKernelServiceSendFromTrace_HELPER(TRACE_CLASS_SEMAPHORE); + +#define vTraceIncludeKernelServicSemaphoreSendInTrace() \ +vTraceIncludeKernelServiceSendInTrace_HELPER(TRACE_CLASS_SEMAPHORE); + +#define vTraceExcludeKernelServiceSemaphoreReceiveFromTrace() \ +vTraceExcludeKernelServiceReceiveFromTrace_HELPER(TRACE_CLASS_SEMAPHORE); + +#define vTraceIncludeKernelServiceSemaphoreReceiveInTrace() \ +vTraceIncludeKernelServiceReceiveInTrace_HELPER(TRACE_CLASS_SEMAPHORE); + +/* EXCLUDE AND INCLUDE FOR MUTEX */ +#define vTraceExcludeKernelServiceMutexSendFromTrace() \ +vTraceExcludeKernelServiceSendFromTrace_HELPER(TRACE_CLASS_MUTEX); + +#define vTraceIncludeKernelServiceMutexSendInTrace() \ +vTraceIncludeKernelServiceSendInTrace_HELPER(TRACE_CLASS_MUTEX); + +#define vTraceExcludeKernelServiceMutexReceiveFromTrace() \ +vTraceExcludeKernelServiceReceiveFromTrace_HELPER(TRACE_CLASS_MUTEX); + +#define vTraceIncludeKernelServiceMutexReceiveInTrace() \ +vTraceIncludeKernelServiceReceiveInTrace_HELPER(TRACE_CLASS_MUTEX); + +/************************************************************************/ +/* KERNEL SPECIFIC MACROS TO NAME OBJECTS, IF NECESSARY */ +/************************************************************************/ +#define vTraceSetQueueName(object, name) \ +vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name); + +#define vTraceSetSemaphoreName(object, name) \ +vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name); + +#define vTraceSetMutexName(object, name) \ +vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name); + +#define vTraceSetEventGroupName(object, name) \ +vTraceSetObjectName(TRACE_CLASS_EVENTGROUP, (objectHandleType)uxEventGroupGetNumber(object), name); + +#undef traceQUEUE_REGISTRY_ADD +#define traceQUEUE_REGISTRY_ADD(object, name) vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name); +#endif + +#endif /* TRCKERNELPORTFREERTOS_H_ */ + + + + + + + + diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelPortFreeRTOS.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelPortFreeRTOS.h deleted file mode 100644 index a3d8b2f5f..000000000 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelPortFreeRTOS.h +++ /dev/null @@ -1,1023 +0,0 @@ -/******************************************************************************* - * Tracealyzer v2.7.0 Recorder Library - * Percepio AB, www.percepio.com - * - * trcKernelPortFreeRTOS.h - * - * Kernel-specific functionality for FreeRTOS, used by the recorder library. - * - * Terms of Use - * This software is copyright Percepio AB. The recorder library is free for - * use together with Percepio products. You may distribute the recorder library - * in its original form, including modifications in trcHardwarePort.c/.h - * given that these modification are clearly marked as your own modifications - * and documented in the initial comment section of these source files. - * This software is the intellectual property of Percepio AB and may not be - * sold or in other ways commercially redistributed without explicit written - * permission by Percepio AB. - * - * Disclaimer - * The trace tool and recorder library is being delivered to you AS IS and - * Percepio AB makes no warranty as to its use or performance. Percepio AB does - * not and cannot warrant the performance or results you may obtain by using the - * software or documentation. Percepio AB make no warranties, express or - * implied, as to noninfringement of third party rights, merchantability, or - * fitness for any particular purpose. In no event will Percepio AB, its - * technology partners, or distributors be liable to you for any consequential, - * incidental or special damages, including any lost profits or lost savings, - * even if a representative of Percepio AB has been advised of the possibility - * of such damages, or for any claim by any third party. Some jurisdictions do - * not allow the exclusion or limitation of incidental, consequential or special - * damages, or the exclusion of implied warranties or limitations on how long an - * implied warranty may last, so the above limitations may not apply to you. - * - * Tabs are used for indent in this file (1 tab = 4 spaces) - * - * Copyright Percepio AB, 2014. - * www.percepio.com - ******************************************************************************/ - - -#ifndef TRCKERNELPORTFREERTOS_H -#define TRCKERNELPORTFREERTOS_H - -#include "FreeRTOS.h" /* Defines configUSE_TRACE_FACILITY */ -#include "trcHardwarePort.h" - -extern int uiInEventGroupSetBitsFromISR; - -#define USE_TRACEALYZER_RECORDER configUSE_TRACE_FACILITY - -#if (USE_TRACEALYZER_RECORDER == 1) - -/* Defines that must be set for the recorder to work properly */ -#define TRACE_KERNEL_VERSION 0x1AA1 -#define TRACE_TICK_RATE_HZ configTICK_RATE_HZ /* Defined in "FreeRTOS.h" */ -#define TRACE_CPU_CLOCK_HZ configCPU_CLOCK_HZ /* Defined in "FreeRTOSConfig.h" */ - -#if (SELECTED_PORT == PORT_ARM_CortexM) - - #include "board.h" // Uses CMSIS API - - #define TRACE_SR_ALLOC_CRITICAL_SECTION() int __irq_status; - #define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = __get_PRIMASK(); __set_PRIMASK(1);} - #define TRACE_EXIT_CRITICAL_SECTION() {__set_PRIMASK(__irq_status);} - -#endif - -#if ((SELECTED_PORT == PORT_ARM_CORTEX_A9) || (SELECTED_PORT == PORT_Renesas_RX600) || (SELECTED_PORT == PORT_MICROCHIP_PIC32MX) || (SELECTED_PORT == PORT_MICROCHIP_PIC32MZ)) - #define TRACE_SR_ALLOC_CRITICAL_SECTION() int __irq_status; - #define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = portSET_INTERRUPT_MASK_FROM_ISR();} - #define TRACE_EXIT_CRITICAL_SECTION() {portCLEAR_INTERRUPT_MASK_FROM_ISR(__irq_status);} -#endif - -#ifndef TRACE_ENTER_CRITICAL_SECTION - #error "This port has no valid definition for critical sections! See http://percepio.com/2014/10/27/how-to-define-critical-sections-for-the-recorder/" -#endif - -#ifndef TRACE_EXIT_CRITICAL_SECTION - #error "This port has no valid definition for critical sections! See http://percepio.com/2014/10/27/how-to-define-critical-sections-for-the-recorder/" -#endif - -#if (SELECTED_PORT == PORT_ARM_CortexM) - #define trcCRITICAL_SECTION_BEGIN_ON_CORTEX_M_ONLY trcCRITICAL_SECTION_BEGIN - #define trcCRITICAL_SECTION_END_ON_CORTEX_M_ONLY trcCRITICAL_SECTION_END -#else - #define trcCRITICAL_SECTION_BEGIN_ON_CORTEX_M_ONLY() recorder_busy++; - #define trcCRITICAL_SECTION_END_ON_CORTEX_M_ONLY() recorder_busy--; -#endif - -/*************************************************************************/ -/* KERNEL SPECIFIC OBJECT CONFIGURATION */ -/*************************************************************************/ -#define TRACE_NCLASSES 7 -#define TRACE_CLASS_QUEUE ((traceObjectClass)0) -#define TRACE_CLASS_SEMAPHORE ((traceObjectClass)1) -#define TRACE_CLASS_MUTEX ((traceObjectClass)2) -#define TRACE_CLASS_TASK ((traceObjectClass)3) -#define TRACE_CLASS_ISR ((traceObjectClass)4) -#define TRACE_CLASS_TIMER ((traceObjectClass)5) -#define TRACE_CLASS_EVENTGROUP ((traceObjectClass)6) - -#define TRACE_KERNEL_OBJECT_COUNT (NQueue + NSemaphore + NMutex + NTask + NISR + NTimer + NEventGroup) - -/* The size of the Object Property Table entries, in bytes, per object */ - -/* Queue properties (except name): current number of message in queue */ -#define PropertyTableSizeQueue (NameLenQueue + 1) - -/* Semaphore properties (except name): state (signaled = 1, cleared = 0) */ -#define PropertyTableSizeSemaphore (NameLenSemaphore + 1) - -/* Mutex properties (except name): owner (task handle, 0 = free) */ -#define PropertyTableSizeMutex (NameLenMutex + 1) - -/* Task properties (except name): Byte 0: Current priority - Byte 1: state (if already active) - Byte 2: legacy, not used - Byte 3: legacy, not used */ -#define PropertyTableSizeTask (NameLenTask + 4) - -/* ISR properties: Byte 0: priority - Byte 1: state (if already active) */ -#define PropertyTableSizeISR (NameLenISR + 2) - -/* NTimer properties: Byte 0: state (unused for now) */ -#define PropertyTableSizeTimer (NameLenTimer + 1) - -/* NEventGroup properties: Byte 0-3: state (unused for now)*/ -#define PropertyTableSizeEventGroup (NameLenEventGroup + 4) - - -/* The layout of the byte array representing the Object Property Table */ -#define StartIndexQueue 0 -#define StartIndexSemaphore StartIndexQueue + NQueue * PropertyTableSizeQueue -#define StartIndexMutex StartIndexSemaphore + NSemaphore * PropertyTableSizeSemaphore -#define StartIndexTask StartIndexMutex + NMutex * PropertyTableSizeMutex -#define StartIndexISR StartIndexTask + NTask * PropertyTableSizeTask -#define StartIndexTimer StartIndexISR + NISR * PropertyTableSizeISR -#define StartIndexEventGroup StartIndexTimer + NTimer * PropertyTableSizeTimer - -/* Number of bytes used by the object table */ -#define TRACE_OBJECT_TABLE_SIZE StartIndexEventGroup + NEventGroup * PropertyTableSizeEventGroup - -#define FREERTOS_VERSION_NOT_SET 0 -#define FREERTOS_VERSION_7_3_OR_7_4 1 -#define FREERTOS_VERSION_7_5_OR_7_6 2 -#define FREERTOS_VERSION_8_0_OR_LATER 3 - -/* Includes */ -#include "trcConfig.h" /* Must be first, even before trcTypes.h */ -#include "trcHardwarePort.h" -#include "trcTypes.h" -#include "trcKernelHooks.h" -#include "trcBase.h" -#include "trcKernel.h" -#include "trcUser.h" - -#if (INCLUDE_NEW_TIME_EVENTS == 1 && configUSE_TICKLESS_IDLE != 0) -#error "NewTime events can not be used in combination with tickless idle!" -#endif - -/* Initialization of the object property table */ -void vTraceInitObjectPropertyTable(void); - -/* Initialization of the handle mechanism, see e.g, xTraceGetObjectHandle */ -void vTraceInitObjectHandleStack(void); - -/* Returns the "Not enough handles" error message for the specified object class */ -const char* pszTraceGetErrorNotEnoughHandles(traceObjectClass objectclass); - -/******************************************************************************* - * The event codes - should match the offline config file. - * - * Some sections below are encoded to allow for constructions like: - * - * vTraceStoreKernelCall(EVENTGROUP_CREATE + objectclass, ... - * - * The object class ID is given by the three LSB bits, in such cases. Since each - * object class has a separate object property table, the class ID is needed to - * know what section in the object table to use for getting an object name from - * an object handle. - ******************************************************************************/ - -#define NULL_EVENT (0x00) /* Ignored in the analysis*/ - -/******************************************************************************* - * EVENTGROUP_DIV - * - * Miscellaneous events. - ******************************************************************************/ -#define EVENTGROUP_DIV (NULL_EVENT + 1) /*0x01*/ -#define DIV_XPS (EVENTGROUP_DIV + 0) /*0x01*/ -#define DIV_TASK_READY (EVENTGROUP_DIV + 1) /*0x02*/ -#define DIV_NEW_TIME (EVENTGROUP_DIV + 2) /*0x03*/ - -/******************************************************************************* - * EVENTGROUP_TS - * - * Events for storing task-switches and interrupts. The RESUME events are - * generated if the task/interrupt is already marked active. - ******************************************************************************/ -#define EVENTGROUP_TS (EVENTGROUP_DIV + 3) /*0x04*/ -#define TS_ISR_BEGIN (EVENTGROUP_TS + 0) /*0x04*/ -#define TS_ISR_RESUME (EVENTGROUP_TS + 1) /*0x05*/ -#define TS_TASK_BEGIN (EVENTGROUP_TS + 2) /*0x06*/ -#define TS_TASK_RESUME (EVENTGROUP_TS + 3) /*0x07*/ - -/******************************************************************************* - * EVENTGROUP_OBJCLOSE_NAME - * - * About Close Events - * When an object is evicted from the object property table (object close), two - * internal events are stored (EVENTGROUP_OBJCLOSE_NAME and - * EVENTGROUP_OBJCLOSE_PROP), containing the handle-name mapping and object - * properties valid up to this point. - ******************************************************************************/ -#define EVENTGROUP_OBJCLOSE_NAME (EVENTGROUP_TS + 4) /*0x08*/ - -/******************************************************************************* - * EVENTGROUP_OBJCLOSE_PROP - * - * The internal event carrying properties of deleted objects - * The handle and object class of the closed object is not stored in this event, - * but is assumed to be the same as in the preceding CLOSE event. Thus, these - * two events must be generated from within a critical section. - * When queues are closed, arg1 is the "state" property (i.e., number of - * buffered messages/signals). - * When actors are closed, arg1 is priority, arg2 is handle of the "instance - * finish" event, and arg3 is event code of the "instance finish" event. - * In this case, the lower three bits is the object class of the instance finish - * handle. The lower three bits are not used (always zero) when queues are - * closed since the queue type is given in the previous OBJCLOSE_NAME event. - ******************************************************************************/ -#define EVENTGROUP_OBJCLOSE_PROP (EVENTGROUP_OBJCLOSE_NAME + 8) /*0x10*/ - -/******************************************************************************* - * EVENTGROUP_CREATE - * - * The events in this group are used to log Kernel object creations. - * The lower three bits in the event code gives the object class, i.e., type of - * create operation (task, queue, semaphore, etc). - ******************************************************************************/ -#define EVENTGROUP_CREATE_OBJ_SUCCESS (EVENTGROUP_OBJCLOSE_PROP + 8) /*0x18*/ - -/******************************************************************************* - * EVENTGROUP_SEND - * - * The events in this group are used to log Send/Give events on queues, - * semaphores and mutexes The lower three bits in the event code gives the - * object class, i.e., what type of object that is operated on (queue, semaphore - * or mutex). - ******************************************************************************/ -#define EVENTGROUP_SEND_SUCCESS (EVENTGROUP_CREATE_OBJ_SUCCESS + 8) /*0x20*/ - -/******************************************************************************* - * EVENTGROUP_RECEIVE - * - * The events in this group are used to log Receive/Take events on queues, - * semaphores and mutexes. The lower three bits in the event code gives the - * object class, i.e., what type of object that is operated on (queue, semaphore - * or mutex). - ******************************************************************************/ -#define EVENTGROUP_RECEIVE_SUCCESS (EVENTGROUP_SEND_SUCCESS + 8) /*0x28*/ - -/* Send/Give operations, from ISR */ -#define EVENTGROUP_SEND_FROM_ISR_SUCCESS \ - (EVENTGROUP_RECEIVE_SUCCESS + 8) /*0x30*/ - -/* Receive/Take operations, from ISR */ -#define EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS \ - (EVENTGROUP_SEND_FROM_ISR_SUCCESS + 8) /*0x38*/ - -/* "Failed" event type versions of above (timeout, failed allocation, etc) */ -#define EVENTGROUP_KSE_FAILED \ - (EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS + 8) /*0x40*/ - -/* Failed create calls - memory allocation failed */ -#define EVENTGROUP_CREATE_OBJ_FAILED (EVENTGROUP_KSE_FAILED) /*0x40*/ - -/* Failed send/give - timeout! */ -#define EVENTGROUP_SEND_FAILED (EVENTGROUP_CREATE_OBJ_FAILED + 8) /*0x48*/ - -/* Failed receive/take - timeout! */ -#define EVENTGROUP_RECEIVE_FAILED (EVENTGROUP_SEND_FAILED + 8) /*0x50*/ - -/* Failed non-blocking send/give - queue full */ -#define EVENTGROUP_SEND_FROM_ISR_FAILED (EVENTGROUP_RECEIVE_FAILED + 8) /*0x58*/ - -/* Failed non-blocking receive/take - queue empty */ -#define EVENTGROUP_RECEIVE_FROM_ISR_FAILED \ - (EVENTGROUP_SEND_FROM_ISR_FAILED + 8) /*0x60*/ - -/* Events when blocking on receive/take */ -#define EVENTGROUP_RECEIVE_BLOCK \ - (EVENTGROUP_RECEIVE_FROM_ISR_FAILED + 8) /*0x68*/ - -/* Events when blocking on send/give */ -#define EVENTGROUP_SEND_BLOCK (EVENTGROUP_RECEIVE_BLOCK + 8) /*0x70*/ - -/* Events on queue peek (receive) */ -#define EVENTGROUP_PEEK_SUCCESS (EVENTGROUP_SEND_BLOCK + 8) /*0x78*/ - -/* Events on object delete (vTaskDelete or vQueueDelete) */ -#define EVENTGROUP_DELETE_OBJ_SUCCESS (EVENTGROUP_PEEK_SUCCESS + 8) /*0x80*/ - -/* Other events - object class is implied: TASK */ -#define EVENTGROUP_OTHERS (EVENTGROUP_DELETE_OBJ_SUCCESS + 8) /*0x88*/ -#define TASK_DELAY_UNTIL (EVENTGROUP_OTHERS + 0) /*0x88*/ -#define TASK_DELAY (EVENTGROUP_OTHERS + 1) /*0x89*/ -#define TASK_SUSPEND (EVENTGROUP_OTHERS + 2) /*0x8A*/ -#define TASK_RESUME (EVENTGROUP_OTHERS + 3) /*0x8B*/ -#define TASK_RESUME_FROM_ISR (EVENTGROUP_OTHERS + 4) /*0x8C*/ -#define TASK_PRIORITY_SET (EVENTGROUP_OTHERS + 5) /*0x8D*/ -#define TASK_PRIORITY_INHERIT (EVENTGROUP_OTHERS + 6) /*0x8E*/ -#define TASK_PRIORITY_DISINHERIT (EVENTGROUP_OTHERS + 7) /*0x8F*/ - -#define EVENTGROUP_MISC_PLACEHOLDER (EVENTGROUP_OTHERS + 8) /*0x90*/ -#define PEND_FUNC_CALL (EVENTGROUP_MISC_PLACEHOLDER+0) /*0x90*/ -#define PEND_FUNC_CALL_FROM_ISR (EVENTGROUP_MISC_PLACEHOLDER+1) /*0x91*/ -#define PEND_FUNC_CALL_FAILED (EVENTGROUP_MISC_PLACEHOLDER+2) /*0x92*/ -#define PEND_FUNC_CALL_FROM_ISR_FAILED (EVENTGROUP_MISC_PLACEHOLDER+3) /*0x93*/ -#define MEM_MALLOC_SIZE (EVENTGROUP_MISC_PLACEHOLDER+4) /*0x94*/ -#define MEM_MALLOC_ADDR (EVENTGROUP_MISC_PLACEHOLDER+5) /*0x95*/ -#define MEM_FREE_SIZE (EVENTGROUP_MISC_PLACEHOLDER+6) /*0x96*/ -#define MEM_FREE_ADDR (EVENTGROUP_MISC_PLACEHOLDER+7) /*0x97*/ - -/* User events */ -#define EVENTGROUP_USEREVENT (EVENTGROUP_MISC_PLACEHOLDER + 8) /*0x98*/ -#define USER_EVENT (EVENTGROUP_USEREVENT + 0) - -/* Allow for 0-15 arguments (the number of args is added to event code) */ -#define USER_EVENT_LAST (EVENTGROUP_USEREVENT + 15) /*0xA7*/ - -/******************************************************************************* - * XTS Event - eXtended TimeStamp events - * The timestamps used in the recorder are "differential timestamps" (DTS), i.e. - * the time since the last stored event. The DTS fields are either 1 or 2 bytes - * in the other events, depending on the bytes available in the event struct. - * If the time since the last event (the DTS) is larger than allowed for by - * the DTS field of the current event, an XTS event is inserted immediately - * before the original event. The XTS event contains up to 3 additional bytes - * of the DTS value - the higher bytes of the true DTS value. The lower 1-2 - * bytes are stored in the normal DTS field. - * There are two types of XTS events, XTS8 and XTS16. An XTS8 event is stored - * when there is only room for 1 byte (8 bit) DTS data in the original event, - * which means a limit of 0xFF (255). The XTS16 is used when the original event - * has a 16 bit DTS field and thereby can handle values up to 0xFFFF (65535). - * - * Using a very high frequency time base can result in many XTS events. - * Preferably, the time between two OS ticks should fit in 16 bits, i.e., - * at most 65535. If your time base has a higher frequency, you can define - * the TRACE - ******************************************************************************/ - -#define EVENTGROUP_SYS (EVENTGROUP_USEREVENT + 16) /*0xA8*/ -#define XTS8 (EVENTGROUP_SYS + 0) /*0xA8*/ -#define XTS16 (EVENTGROUP_SYS + 1) /*0xA9*/ -#define EVENT_BEING_WRITTEN (EVENTGROUP_SYS + 2) /*0xAA*/ -#define RESERVED_DUMMY_CODE (EVENTGROUP_SYS + 3) /*0xAB*/ -#define LOW_POWER_BEGIN (EVENTGROUP_SYS + 4) /*0xAC*/ -#define LOW_POWER_END (EVENTGROUP_SYS + 5) /*0xAD*/ -#define XID (EVENTGROUP_SYS + 6) /*0xAE*/ -#define XTS16L (EVENTGROUP_SYS + 7) /*0xAF*/ - -#define EVENTGROUP_TIMER (EVENTGROUP_SYS + 8) /*0xB0*/ -#define TIMER_CREATE (EVENTGROUP_TIMER + 0) /*0xB0*/ -#define TIMER_START (EVENTGROUP_TIMER + 1) /*0xB1*/ -#define TIMER_RST (EVENTGROUP_TIMER + 2) /*0xB2*/ -#define TIMER_STOP (EVENTGROUP_TIMER + 3) /*0xB3*/ -#define TIMER_CHANGE_PERIOD (EVENTGROUP_TIMER + 4) /*0xB4*/ -#define TIMER_DELETE (EVENTGROUP_TIMER + 5) /*0xB5*/ -#define TIMER_START_FROM_ISR (EVENTGROUP_TIMER + 6) /*0xB6*/ -#define TIMER_RESET_FROM_ISR (EVENTGROUP_TIMER + 7) /*0xB7*/ -#define TIMER_STOP_FROM_ISR (EVENTGROUP_TIMER + 8) /*0xB8*/ - -#define TIMER_CREATE_FAILED (EVENTGROUP_TIMER + 9) /*0xB9*/ -#define TIMER_START_FAILED (EVENTGROUP_TIMER + 10) /*0xBA*/ -#define TIMER_RESET_FAILED (EVENTGROUP_TIMER + 11) /*0xBB*/ -#define TIMER_STOP_FAILED (EVENTGROUP_TIMER + 12) /*0xBC*/ -#define TIMER_CHANGE_PERIOD_FAILED (EVENTGROUP_TIMER + 13) /*0xBD*/ -#define TIMER_DELETE_FAILED (EVENTGROUP_TIMER + 14) /*0xBE*/ -#define TIMER_START_FROM_ISR_FAILED (EVENTGROUP_TIMER + 15) /*0xBF*/ -#define TIMER_RESET_FROM_ISR_FAILED (EVENTGROUP_TIMER + 16) /*0xC0*/ -#define TIMER_STOP_FROM_ISR_FAILED (EVENTGROUP_TIMER + 17) /*0xC1*/ - -#define EVENTGROUP_EG (EVENTGROUP_TIMER + 18) /*0xC2*/ -#define EVENT_GROUP_CREATE (EVENTGROUP_EG + 0) /*0xC2*/ -#define EVENT_GROUP_CREATE_FAILED (EVENTGROUP_EG + 1) /*0xC3*/ -#define EVENT_GROUP_SYNC_BLOCK (EVENTGROUP_EG + 2) /*0xC4*/ -#define EVENT_GROUP_SYNC_END (EVENTGROUP_EG + 3) /*0xC5*/ -#define EVENT_GROUP_WAIT_BITS_BLOCK (EVENTGROUP_EG + 4) /*0xC6*/ -#define EVENT_GROUP_WAIT_BITS_END (EVENTGROUP_EG + 5) /*0xC7*/ -#define EVENT_GROUP_CLEAR_BITS (EVENTGROUP_EG + 6) /*0xC8*/ -#define EVENT_GROUP_CLEAR_BITS_FROM_ISR (EVENTGROUP_EG + 7) /*0xC9*/ -#define EVENT_GROUP_SET_BITS (EVENTGROUP_EG + 8) /*0xCA*/ -#define EVENT_GROUP_DELETE (EVENTGROUP_EG + 9) /*0xCB*/ -#define EVENT_GROUP_SYNC_END_FAILED (EVENTGROUP_EG + 10) /*0xCC*/ -#define EVENT_GROUP_WAIT_BITS_END_FAILED (EVENTGROUP_EG + 11) /*0xCD*/ -#define EVENT_GROUP_SET_BITS_FROM_ISR (EVENTGROUP_EG + 12) /*0xCE*/ -#define EVENT_GROUP_SET_BITS_FROM_ISR_FAILED (EVENTGROUP_EG + 13) /*0xCF*/ - -#define TASK_INSTANCE_FINISHED_NEXT_KSE (EVENTGROUP_EG + 14) /*0xD0*/ -#define TASK_INSTANCE_FINISHED_DIRECT (EVENTGROUP_EG + 15) /*0xD1*/ - -/************************************************************************/ -/* KERNEL SPECIFIC DATA AND FUNCTIONS NEEDED TO PROVIDE THE */ -/* FUNCTIONALITY REQUESTED BY THE TRACE RECORDER */ -/************************************************************************/ - -/****************************************************************************** - * TraceObjectClassTable - * Translates a FreeRTOS QueueType into trace objects classes (TRACE_CLASS_). - * This was added since we want to map both types of Mutex and both types of - * Semaphores on common classes for all Mutexes and all Semaphores respectively. - * - * FreeRTOS Queue types - * #define queueQUEUE_TYPE_BASE (0U) => TRACE_CLASS_QUEUE - * #define queueQUEUE_TYPE_MUTEX (1U) => TRACE_CLASS_MUTEX - * #define queueQUEUE_TYPE_COUNTING_SEMAPHORE (2U) => TRACE_CLASS_SEMAPHORE - * #define queueQUEUE_TYPE_BINARY_SEMAPHORE (3U) => TRACE_CLASS_SEMAPHORE - * #define queueQUEUE_TYPE_RECURSIVE_MUTEX (4U) => TRACE_CLASS_MUTEX - ******************************************************************************/ - -extern traceObjectClass TraceObjectClassTable[5]; - -/* These functions are implemented in the .c file since certain header files -must not be included in this one */ -objectHandleType prvTraceGetObjectNumber(void* handle); -unsigned char prvTraceGetObjectType(void* handle); -objectHandleType prvTraceGetTaskNumber(void* handle); -unsigned char prvTraceIsSchedulerActive(void); -unsigned char prvTraceIsSchedulerSuspended(void); -unsigned char prvTraceIsSchedulerStarted(void); -void* prvTraceGetCurrentTaskHandle(void); - -#if (configUSE_TIMERS == 1) -#undef INCLUDE_xTimerGetTimerDaemonTaskHandle -#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1 -#endif - -/************************************************************************/ -/* KERNEL SPECIFIC MACROS USED BY THE TRACE RECORDER */ -/************************************************************************/ - -#define TRACE_MALLOC(size) pvPortMalloc(size) -#define TRACE_IS_SCHEDULER_ACTIVE() prvTraceIsSchedulerActive() -#define TRACE_IS_SCHEDULER_STARTED() prvTraceIsSchedulerStarted() -#define TRACE_IS_SCHEDULER_SUSPENDED() prvTraceIsSchedulerSuspended() -#define TRACE_GET_CURRENT_TASK() prvTraceGetCurrentTaskHandle() - -#define TRACE_GET_TASK_PRIORITY(pxTCB) ((uint8_t)pxTCB->uxPriority) -#define TRACE_GET_TASK_NAME(pxTCB) ((char*)pxTCB->pcTaskName) -#define TRACE_GET_TASK_NUMBER(pxTCB) (prvTraceGetTaskNumber(pxTCB)) -#define TRACE_SET_TASK_NUMBER(pxTCB) pxTCB->uxTaskNumber = xTraceGetObjectHandle(TRACE_CLASS_TASK); - -#define TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass) TraceObjectClassTable[kernelClass] -#define TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject) TRACE_GET_CLASS_TRACE_CLASS(CLASS, prvTraceGetObjectType(pxObject)) - -#define TRACE_GET_TIMER_NUMBER(tmr) ( ( objectHandleType ) ((Timer_t*)tmr)->uxTimerNumber ) -#define TRACE_SET_TIMER_NUMBER(tmr) ((Timer_t*)tmr)->uxTimerNumber = xTraceGetObjectHandle(TRACE_CLASS_TIMER); -#define TRACE_GET_TIMER_NAME(pxTimer) pxTimer->pcTimerName -#define TRACE_GET_TIMER_PERIOD(pxTimer) pxTimer->xTimerPeriodInTicks - -#define TRACE_GET_EVENTGROUP_NUMBER(eg) ( ( objectHandleType ) uxEventGroupGetNumber(eg) ) -#define TRACE_SET_EVENTGROUP_NUMBER(eg) ((EventGroup_t*)eg)->uxEventGroupNumber = xTraceGetObjectHandle(TRACE_CLASS_EVENTGROUP); - -#define TRACE_GET_OBJECT_NUMBER(CLASS, pxObject) (prvTraceGetObjectNumber(pxObject)) - -#if (FREERTOS_VERSION < FREERTOS_VERSION_8_0_OR_LATER) - #define TRACE_SET_OBJECT_NUMBER(CLASS, pxObject) pxObject->ucQueueNumber = xTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); -#else - #define TRACE_SET_OBJECT_NUMBER(CLASS, pxObject) pxObject->uxQueueNumber = xTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); -#endif - -#define TRACE_GET_CLASS_EVENT_CODE(SERVICE, RESULT, CLASS, kernelClass) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass)) -#define TRACE_GET_OBJECT_EVENT_CODE(SERVICE, RESULT, CLASS, pxObject) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)) -#define TRACE_GET_TASK_EVENT_CODE(SERVICE, RESULT, CLASS, pxTCB) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_CLASS_TASK) - -/************************************************************************/ -/* KERNEL SPECIFIC WRAPPERS THAT SHOULD BE CALLED BY THE KERNEL */ -/************************************************************************/ - -#if (configUSE_TICKLESS_IDLE != 0) - -#undef traceLOW_POWER_IDLE_BEGIN -#define traceLOW_POWER_IDLE_BEGIN() \ - { \ - extern uint32_t trace_disable_timestamp; \ - vTraceStoreLowPower(0); \ - trace_disable_timestamp = 1; \ - } - -#undef traceLOW_POWER_IDLE_END -#define traceLOW_POWER_IDLE_END() \ - { \ - extern uint32_t trace_disable_timestamp; \ - trace_disable_timestamp = 0; \ - vTraceStoreLowPower(1); \ - } - -#endif - -/* A macro that will update the tick count when returning from tickless idle */ -#undef traceINCREASE_TICK_COUNT -/* 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.*/ -#define traceINCREASE_TICK_COUNT( xCount ) { DWT_CYCLES_ADDED += (xCount * (TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ)); } - -/* Called for each task that becomes ready */ -#undef traceMOVED_TASK_TO_READY_STATE -#define traceMOVED_TASK_TO_READY_STATE( pxTCB ) \ - trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB); - -/* Called on each OS tick. Will call uiPortGetTimestamp to make sure it is called at least once every OS tick. */ -#undef traceTASK_INCREMENT_TICK - -#if (FREERTOS_VERSION == FREERTOS_VERSION_7_3_OR_7_4) - -#define traceTASK_INCREMENT_TICK( xTickCount ) \ - if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxMissedTicks == 0) { trcKERNEL_HOOKS_INCREMENT_TICK(); } \ - if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE) { trcKERNEL_HOOKS_NEW_TIME(DIV_NEW_TIME, xTickCount + 1); } - -#else - -#define traceTASK_INCREMENT_TICK( xTickCount ) \ - if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxPendedTicks == 0) { trcKERNEL_HOOKS_INCREMENT_TICK(); } \ - if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE) { trcKERNEL_HOOKS_NEW_TIME(DIV_NEW_TIME, xTickCount + 1); } - -#endif - -/* Called on each task-switch */ -#undef traceTASK_SWITCHED_IN -#define traceTASK_SWITCHED_IN() \ - trcKERNEL_HOOKS_TASK_SWITCH(TRACE_GET_CURRENT_TASK()); - -/* Called on vTaskSuspend */ -#undef traceTASK_SUSPEND -#define traceTASK_SUSPEND( pxTaskToSuspend ) \ - trcKERNEL_HOOKS_TASK_SUSPEND(TASK_SUSPEND, pxTaskToSuspend); - -/* Called on vTaskDelay - note the use of FreeRTOS variable xTicksToDelay */ -#undef traceTASK_DELAY -#define traceTASK_DELAY() \ - trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY, pxCurrentTCB, xTicksToDelay); \ - trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); - -/* Called on vTaskDelayUntil - note the use of FreeRTOS variable xTimeToWake */ -#undef traceTASK_DELAY_UNTIL -#define traceTASK_DELAY_UNTIL() \ - trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY_UNTIL, pxCurrentTCB, xTimeToWake); \ - trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); - -#if (INCLUDE_OBJECT_DELETE == 1) -/* Called on vTaskDelete */ -#undef traceTASK_DELETE -#define traceTASK_DELETE( pxTaskToDelete ) \ - { TRACE_SR_ALLOC_CRITICAL_SECTION(); \ - TRACE_ENTER_CRITICAL_SECTION(); \ - trcKERNEL_HOOKS_TASK_DELETE(DELETE_OBJ, pxTaskToDelete); \ - TRACE_EXIT_CRITICAL_SECTION(); } -#endif - -#if (INCLUDE_OBJECT_DELETE == 1) -/* Called on vQueueDelete */ -#undef traceQUEUE_DELETE -#define traceQUEUE_DELETE( pxQueue ) \ - { TRACE_SR_ALLOC_CRITICAL_SECTION(); \ - TRACE_ENTER_CRITICAL_SECTION(); \ - trcKERNEL_HOOKS_OBJECT_DELETE(DELETE_OBJ, UNUSED, pxQueue); \ - TRACE_EXIT_CRITICAL_SECTION(); } -#endif - -/* Called on vTaskCreate */ -#undef traceTASK_CREATE -#define traceTASK_CREATE(pxNewTCB) \ - if (pxNewTCB != NULL) \ - { \ - trcKERNEL_HOOKS_TASK_CREATE(CREATE_OBJ, UNUSED, pxNewTCB); \ - } - -/* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */ -#undef traceTASK_CREATE_FAILED -#define traceTASK_CREATE_FAILED() \ - trcKERNEL_HOOKS_TASK_CREATE_FAILED(CREATE_OBJ, UNUSED); - -/* Called in xQueueCreate, and thereby for all other object based on queues, such as semaphores. */ -#undef traceQUEUE_CREATE -#define traceQUEUE_CREATE( pxNewQueue )\ - trcKERNEL_HOOKS_OBJECT_CREATE(CREATE_OBJ, UNUSED, pxNewQueue); - -/* Called in xQueueCreate, if the queue creation fails */ -#undef traceQUEUE_CREATE_FAILED -#define traceQUEUE_CREATE_FAILED( queueType ) \ - trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(CREATE_OBJ, UNUSED, queueType); - -/* Called in xQueueCreateMutex, and thereby also from xSemaphoreCreateMutex and xSemaphoreCreateRecursiveMutex */ -#undef traceCREATE_MUTEX -#define traceCREATE_MUTEX( pxNewQueue ) \ - trcKERNEL_HOOKS_OBJECT_CREATE(CREATE_OBJ, UNUSED, pxNewQueue); - -/* Called in xQueueCreateMutex when the operation fails (when memory allocation fails) */ -#undef traceCREATE_MUTEX_FAILED -#define traceCREATE_MUTEX_FAILED() \ - trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(CREATE_OBJ, UNUSED, queueQUEUE_TYPE_MUTEX); - -/* Called when the Mutex can not be given, since not holder */ -#undef traceGIVE_MUTEX_RECURSIVE_FAILED -#define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex ) \ - trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, FAILED, UNUSED, pxMutex); - -/* Called when a message is sent to a queue */ /* CS IS NEW ! */ -#undef traceQUEUE_SEND -#define traceQUEUE_SEND( pxQueue ) \ - trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, SUCCESS, UNUSED, pxQueue); \ - 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)); - -/* Called when a message failed to be sent to a queue (timeout) */ -#undef traceQUEUE_SEND_FAILED -#define traceQUEUE_SEND_FAILED( pxQueue ) \ - trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, FAILED, UNUSED, pxQueue); - -/* Called when the task is blocked due to a send operation on a full queue */ -#undef traceBLOCKING_ON_QUEUE_SEND -#define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) \ - trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, BLOCK, UNUSED, pxQueue); - -/* Called when a message is received from a queue */ -#undef traceQUEUE_RECEIVE -#define traceQUEUE_RECEIVE( pxQueue ) \ - trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, SUCCESS, UNUSED, pxQueue); \ - 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)); - -/* Called when a receive operation on a queue fails (timeout) */ -#undef traceQUEUE_RECEIVE_FAILED -#define traceQUEUE_RECEIVE_FAILED( pxQueue ) \ - trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, FAILED, UNUSED, pxQueue); - -/* Called when the task is blocked due to a receive operation on an empty queue */ -#undef traceBLOCKING_ON_QUEUE_RECEIVE -#define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) \ - trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, BLOCK, UNUSED, pxQueue); \ - if (TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, pxQueue) != TRACE_CLASS_MUTEX) \ - {trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();} - -/* Called on xQueuePeek */ -#undef traceQUEUE_PEEK -#define traceQUEUE_PEEK( pxQueue ) \ - trcKERNEL_HOOKS_KERNEL_SERVICE(PEEK, SUCCESS, UNUSED, pxQueue); - -/* Called when a message is sent from interrupt context, e.g., using xQueueSendFromISR */ -#undef traceQUEUE_SEND_FROM_ISR -#define traceQUEUE_SEND_FROM_ISR( pxQueue ) \ - trcKERNEL_HOOKS_KERNEL_SERVICE(SEND_FROM_ISR, SUCCESS, UNUSED, pxQueue); \ - trcKERNEL_HOOKS_SET_OBJECT_STATE(UNUSED, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting + 1)); - -/* Called when a message send from interrupt context fails (since the queue was full) */ -#undef traceQUEUE_SEND_FROM_ISR_FAILED -#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) \ - trcKERNEL_HOOKS_KERNEL_SERVICE(SEND_FROM_ISR, FAILED, UNUSED, pxQueue); - -/* Called when a message is received in interrupt context, e.g., using xQueueReceiveFromISR */ -#undef traceQUEUE_RECEIVE_FROM_ISR -#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) \ - trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE_FROM_ISR, SUCCESS, UNUSED, pxQueue); \ - trcKERNEL_HOOKS_SET_OBJECT_STATE(UNUSED, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting - 1)); - -/* Called when a message receive from interrupt context fails (since the queue was empty) */ -#undef traceQUEUE_RECEIVE_FROM_ISR_FAILED -#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) \ - trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE_FROM_ISR, FAILED, UNUSED, pxQueue); - -/* Called in vTaskPrioritySet */ -#undef traceTASK_PRIORITY_SET -#define traceTASK_PRIORITY_SET( pxTask, uxNewPriority ) \ - trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_SET, pxTask, uxNewPriority); - -/* Called in vTaskPriorityInherit, which is called by Mutex operations */ -#undef traceTASK_PRIORITY_INHERIT -#define traceTASK_PRIORITY_INHERIT( pxTask, uxNewPriority ) \ - trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_INHERIT, pxTask, uxNewPriority); - -/* Called in vTaskPriorityDisinherit, which is called by Mutex operations */ -#undef traceTASK_PRIORITY_DISINHERIT -#define traceTASK_PRIORITY_DISINHERIT( pxTask, uxNewPriority ) \ - trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_DISINHERIT, pxTask, uxNewPriority); - -/* Called in vTaskResume */ -#undef traceTASK_RESUME -#define traceTASK_RESUME( pxTaskToResume ) \ - trcKERNEL_HOOKS_TASK_RESUME(TASK_RESUME, pxTaskToResume); - -/* Called in vTaskResumeFromISR */ -#undef traceTASK_RESUME_FROM_ISR -#define traceTASK_RESUME_FROM_ISR( pxTaskToResume ) \ - trcKERNEL_HOOKS_TASK_RESUME(TASK_RESUME_FROM_ISR, pxTaskToResume); - - -#if (FREERTOS_VERSION >= FREERTOS_VERSION_8_0_OR_LATER) - -#if (INCLUDE_MEMMANG_EVENTS == 1) - -extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t size); - -#undef traceMALLOC -#define traceMALLOC( pvAddress, uiSize ) {if (pvAddress != 0) vTraceStoreMemMangEvent(MEM_MALLOC_SIZE, ( uint32_t ) pvAddress, (int32_t)uiSize); } - -#undef traceFREE -#define traceFREE( pvAddress, uiSize ) {vTraceStoreMemMangEvent(MEM_FREE_SIZE, ( uint32_t ) pvAddress, (int32_t)(-uiSize)); } - -#endif - -/* Called in timer.c - xTimerCreate */ -#undef traceTIMER_CREATE -#define traceTIMER_CREATE(tmr) \ - trcKERNEL_HOOKS_TIMER_CREATE(TIMER_CREATE, tmr); - -#undef traceTIMER_CREATE_FAILED -#define traceTIMER_CREATE_FAILED() \ - trcKERNEL_HOOKS_TIMER_EVENT(TIMER_CREATE_FAILED, 0); - -/* Note that xCommandID can never be tmrCOMMAND_EXECUTE_CALLBACK (-1) since the trace macro is not called in that case */ -#undef traceTIMER_COMMAND_SEND -#define traceTIMER_COMMAND_SEND(tmr, xCommandID, xOptionalValue, xReturn) \ -if (xCommandID > tmrCOMMAND_START_DONT_TRACE){\ - if (xCommandID == tmrCOMMAND_CHANGE_PERIOD) vTraceStoreKernelCallWithParam((xReturn == pdPASS) ? TIMER_CHANGE_PERIOD : TIMER_CHANGE_PERIOD_FAILED, TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(tmr), xOptionalValue);\ - else if ((xCommandID == tmrCOMMAND_DELETE) && (xReturn == pdPASS)){ trcKERNEL_HOOKS_TIMER_DELETE(TIMER_DELETE, tmr); } \ - else {trcKERNEL_HOOKS_TIMER_EVENT(EVENTGROUP_TIMER + xCommandID + ((xReturn == pdPASS)?0:(TIMER_CREATE_FAILED - TIMER_CREATE)), tmr); }\ -} - -#undef tracePEND_FUNC_CALL -#define tracePEND_FUNC_CALL(func, arg1, arg2, ret) \ -if (ret == pdPASS) \ - vTraceStoreKernelCall(PEND_FUNC_CALL, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) ); \ -else \ - vTraceStoreKernelCall(PEND_FUNC_CALL_FAILED, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) ); - -#undef tracePEND_FUNC_CALL_FROM_ISR -#define tracePEND_FUNC_CALL_FROM_ISR(func, arg1, arg2, ret) \ - if (! uiInEventGroupSetBitsFromISR) vTraceStoreKernelCall(PEND_FUNC_CALL_FROM_ISR, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) ); \ - uiInEventGroupSetBitsFromISR = 0; -#endif - -#undef traceEVENT_GROUP_CREATE -#define traceEVENT_GROUP_CREATE(eg) \ - TRACE_SET_EVENTGROUP_NUMBER(eg); \ - vTraceStoreKernelCall(EVENT_GROUP_CREATE, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg)); - -#undef traceEVENT_GROUP_DELETE -#define traceEVENT_GROUP_DELETE(eg) \ - vTraceStoreKernelCall(EVENT_GROUP_DELETE, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg)); \ - vTraceStoreObjectNameOnCloseEvent(TRACE_GET_EVENTGROUP_NUMBER(eg), TRACE_CLASS_EVENTGROUP); \ - vTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_EVENTGROUP_NUMBER(eg), TRACE_CLASS_EVENTGROUP); \ - vTraceFreeObjectHandle(TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg)); - -#undef traceEVENT_GROUP_CREATE_FAILED -#define traceEVENT_GROUP_CREATE_FAILED() \ - vTraceStoreKernelCall(EVENT_GROUP_CREATE_FAILED, TRACE_CLASS_EVENTGROUP, 0); - -#undef traceEVENT_GROUP_SYNC_BLOCK -#define traceEVENT_GROUP_SYNC_BLOCK(eg, bitsToSet, bitsToWaitFor) \ - vTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_BLOCK, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); - -#undef traceEVENT_GROUP_SYNC_END -#define traceEVENT_GROUP_SYNC_END(eg, bitsToSet, bitsToWaitFor, wasTimeout) \ - if (wasTimeout){ vTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_END_FAILED, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor);} \ - else{ vTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_END, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); } - -#undef traceEVENT_GROUP_WAIT_BITS_BLOCK -#define traceEVENT_GROUP_WAIT_BITS_BLOCK(eg, bitsToWaitFor) \ - vTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_BLOCK, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); \ - trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); - -#undef traceEVENT_GROUP_WAIT_BITS_END -#define traceEVENT_GROUP_WAIT_BITS_END(eg, bitsToWaitFor, wasTimeout) \ - if (wasTimeout){ vTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_END_FAILED, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); } \ - else{ vTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_END, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); } - -#undef traceEVENT_GROUP_CLEAR_BITS -#define traceEVENT_GROUP_CLEAR_BITS(eg, bitsToClear) \ - if (bitsToClear) vTraceStoreKernelCallWithParam(EVENT_GROUP_CLEAR_BITS, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToClear); - -#undef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR -#define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR(eg, bitsToClear) \ - if (bitsToClear) vTraceStoreKernelCallWithParam(EVENT_GROUP_CLEAR_BITS_FROM_ISR, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToClear); - -#undef traceEVENT_GROUP_SET_BITS -#define traceEVENT_GROUP_SET_BITS(eg, bitsToSet) \ - vTraceStoreKernelCallWithParam(EVENT_GROUP_SET_BITS, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToSet); - -#undef traceEVENT_GROUP_SET_BITS_FROM_ISR -#define traceEVENT_GROUP_SET_BITS_FROM_ISR(eg, bitsToSet) \ - vTraceStoreKernelCallWithParam(EVENT_GROUP_SET_BITS_FROM_ISR, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToSet); \ - uiInEventGroupSetBitsFromISR = 1; - - -/************************************************************************/ -/* KERNEL SPECIFIC MACROS TO EXCLUDE OR INCLUDE THINGS IN TRACE */ -/************************************************************************/ - -/* Returns the exclude state of the object */ -uint8_t uiTraceIsObjectExcluded(traceObjectClass objectclass, objectHandleType handle); - -#define TRACE_SET_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, queueIndex) -#define TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, queueIndex) -#define TRACE_GET_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, queueIndex) - -#define TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+semaphoreIndex) -#define TRACE_CLEAR_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+semaphoreIndex) -#define TRACE_GET_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+semaphoreIndex) - -#define TRACE_SET_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+mutexIndex) -#define TRACE_CLEAR_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+mutexIndex) -#define TRACE_GET_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+mutexIndex) - -#define TRACE_SET_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+taskIndex) -#define TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+taskIndex) -#define TRACE_GET_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+taskIndex) - -#define TRACE_SET_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+timerIndex) -#define TRACE_CLEAR_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+timerIndex) -#define TRACE_GET_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+timerIndex) - -#define TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+NTimer+1+egIndex) -#define TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+NTimer+1+egIndex) -#define TRACE_GET_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+NTimer+1+egIndex) - - -#define TRACE_CLEAR_OBJECT_FLAG_ISEXCLUDED(objectclass, handle) \ -switch (objectclass) \ -{ \ -case TRACE_CLASS_QUEUE: \ - TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(handle); \ - break; \ -case TRACE_CLASS_SEMAPHORE: \ - TRACE_CLEAR_SEMAPHORE_FLAG_ISEXCLUDED(handle); \ - break; \ -case TRACE_CLASS_MUTEX: \ - TRACE_CLEAR_MUTEX_FLAG_ISEXCLUDED(handle); \ - break; \ -case TRACE_CLASS_TASK: \ - TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(handle); \ - break; \ -case TRACE_CLASS_TIMER: \ - TRACE_CLEAR_TIMER_FLAG_ISEXCLUDED(handle); \ - break; \ -case TRACE_CLASS_EVENTGROUP: \ - TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(handle); \ - break; \ -} - -#define TRACE_SET_OBJECT_FLAG_ISEXCLUDED(objectclass, handle) \ -switch (objectclass) \ -{ \ -case TRACE_CLASS_QUEUE: \ - TRACE_SET_QUEUE_FLAG_ISEXCLUDED(handle); \ - break; \ -case TRACE_CLASS_SEMAPHORE: \ - TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(handle); \ - break; \ -case TRACE_CLASS_MUTEX: \ - TRACE_SET_MUTEX_FLAG_ISEXCLUDED(handle); \ - break; \ -case TRACE_CLASS_TASK: \ - TRACE_SET_TASK_FLAG_ISEXCLUDED(handle); \ - break; \ -case TRACE_CLASS_TIMER: \ - TRACE_SET_TIMER_FLAG_ISEXCLUDED(handle); \ - break; \ -case TRACE_CLASS_EVENTGROUP: \ - TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(handle); \ - break; \ -} - -/* Task */ -#define vTraceExcludeTaskFromTrace(handle) \ -TRACE_SET_TASK_FLAG_ISEXCLUDED(TRACE_GET_TASK_NUMBER(handle)); - -#define vTraceIncludeTaskInTrace(handle) \ -TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(TRACE_GET_TASK_NUMBER(handle)); - - -/* Queue */ -#define vTraceExcludeQueueFromTrace(handle) \ -TRACE_SET_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle)); - -#define vTraceIncludeQueueInTrace(handle) \ -TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle)); - - -/* Semaphore */ -#define vTraceExcludeSemaphoreFromTrace(handle) \ -TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle)); - -#define vTraceIncludeSemaphoreInTrace(handle) \ -TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle)); - - -/* Mutex */ -#define vTraceExcludeMutexFromTrace(handle) \ -TRACE_SET_MUTEX_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle)); - -#define vTraceIncludeMutexInTrace(handle) \ -TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle)); - -/* Timer */ -#define vTraceExcludeTimerFromTrace(handle) \ -TRACE_SET_TIMER_FLAG_ISEXCLUDED(TRACE_GET_TIMER_NUMBER(handle)); - -#define vTraceIncludeTimerInTrace(handle) \ -TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_TIMER_NUMBER(handle)); - -/* Event Group */ -#define vTraceExcludeEventGroupFromTrace(handle) \ -TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(TRACE_GET_EVENTGROUP_NUMBER(handle)); - -#define vTraceIncludeEventGroupInTrace(handle) \ -TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(TRACE_GET_EVENTGROUP_NUMBER(handle)); - - -/* Kernel Services */ -#define vTraceExcludeKernelServiceDelayFromTrace() \ -TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY); \ -TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY_UNTIL); - -#define vTraceIncludeKernelServiceDelayInTrace() \ -TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY); \ -TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY_UNTIL); - -/* HELPER MACROS FOR KERNEL SERVICES FOR OBJECTS */ -#define vTraceExcludeKernelServiceSendFromTrace_HELPER(class) \ -TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_SUCCESS + class); \ -TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_BLOCK + class); \ -TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FAILED + class); \ -TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_SUCCESS + class); \ -TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_FAILED + class); - -#define vTraceIncludeKernelServiceSendInTrace_HELPER(class) \ -TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_SUCCESS + class); \ -TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_BLOCK + class); \ -TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FAILED + class); \ -TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_SUCCESS + class); \ -TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_FAILED + class); - -#define vTraceExcludeKernelServiceReceiveFromTrace_HELPER(class) \ -TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_SUCCESS + class); \ -TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_BLOCK + class); \ -TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FAILED + class); \ -TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS + class); \ -TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_FAILED + class); - -#define vTraceIncludeKernelServiceReceiveInTrace_HELPER(class) \ -TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_SUCCESS + class); \ -TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_BLOCK + class); \ -TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FAILED + class); \ -TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS + class); \ -TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_FAILED + class); - -/* EXCLUDE AND INCLUDE FOR QUEUE */ -#define vTraceExcludeKernelServiceQueueSendFromTrace() \ -vTraceExcludeKernelServiceSendFromTrace_HELPER(TRACE_CLASS_QUEUE); - -#define vTraceIncludeKernelServiceQueueSendInTrace() \ -vTraceIncludeKernelServiceSendInTrace_HELPER(TRACE_CLASS_QUEUE); - -#define vTraceExcludeKernelServiceQueueReceiveFromTrace() \ -vTraceExcludeKernelServiceReceiveFromTrace_HELPER(TRACE_CLASS_QUEUE); - -#define vTraceIncludeKernelServiceQueueReceiveInTrace() \ -vTraceIncludeKernelServiceReceiveInTrace_HELPER(TRACE_CLASS_QUEUE); - -/* EXCLUDE AND INCLUDE FOR SEMAPHORE */ -#define vTraceExcludeKernelServiceSemaphoreSendFromTrace() \ -vTraceExcludeKernelServiceSendFromTrace_HELPER(TRACE_CLASS_SEMAPHORE); - -#define vTraceIncludeKernelServicSemaphoreSendInTrace() \ -vTraceIncludeKernelServiceSendInTrace_HELPER(TRACE_CLASS_SEMAPHORE); - -#define vTraceExcludeKernelServiceSemaphoreReceiveFromTrace() \ -vTraceExcludeKernelServiceReceiveFromTrace_HELPER(TRACE_CLASS_SEMAPHORE); - -#define vTraceIncludeKernelServiceSemaphoreReceiveInTrace() \ -vTraceIncludeKernelServiceReceiveInTrace_HELPER(TRACE_CLASS_SEMAPHORE); - -/* EXCLUDE AND INCLUDE FOR MUTEX */ -#define vTraceExcludeKernelServiceMutexSendFromTrace() \ -vTraceExcludeKernelServiceSendFromTrace_HELPER(TRACE_CLASS_MUTEX); - -#define vTraceIncludeKernelServiceMutexSendInTrace() \ -vTraceIncludeKernelServiceSendInTrace_HELPER(TRACE_CLASS_MUTEX); - -#define vTraceExcludeKernelServiceMutexReceiveFromTrace() \ -vTraceExcludeKernelServiceReceiveFromTrace_HELPER(TRACE_CLASS_MUTEX); - -#define vTraceIncludeKernelServiceMutexReceiveInTrace() \ -vTraceIncludeKernelServiceReceiveInTrace_HELPER(TRACE_CLASS_MUTEX); - -/************************************************************************/ -/* KERNEL SPECIFIC MACROS TO NAME OBJECTS, IF NECESSARY */ -/************************************************************************/ -#define vTraceSetQueueName(object, name) \ -vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name); - -#define vTraceSetSemaphoreName(object, name) \ -vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name); - -#define vTraceSetMutexName(object, name) \ -vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name); - -#define vTraceSetEventGroupName(object, name) \ -vTraceSetObjectName(TRACE_CLASS_EVENTGROUP, (objectHandleType)uxEventGroupGetNumber(object), name); - -#undef traceQUEUE_REGISTRY_ADD -#define traceQUEUE_REGISTRY_ADD(object, name) vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name); -#endif - -#endif /* TRCKERNELPORTFREERTOS_H_ */ - - - - - - - - diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcUser.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcUser.h index a2682e681..6b99c970c 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcUser.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcUser.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Tracealyzer v2.7.0 Recorder Library + * Tracealyzer v2.7.7 Recorder Library * Percepio AB, www.percepio.com * * trcUser.h @@ -32,7 +32,7 @@ * * Tabs are used for indent in this file (1 tab = 4 spaces) * - * Copyright Percepio AB, 2014. + * Copyright Percepio AB, 2012-2015. * www.percepio.com ******************************************************************************/ @@ -448,7 +448,7 @@ void vTraceChannelUserEvent(UserEventChannel channel); #define vTraceSetISRProperties(handle, name, priority) #define vTraceStoreISRBegin(id) -#define vTraceStoreISREnd() +#define vTraceStoreISREnd(flag) #define vTraceExcludeTaskFromTrace(handle) #define vTraceSetQueueName(a, b) #define vTraceSetMutexName(a, b) diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcKernel.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcKernel.c index 5cf073dc1..cf624c850 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcKernel.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcKernel.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Tracealyzer v2.7.0 Recorder Library + * Tracealyzer v2.7.7 Recorder Library * Percepio AB, www.percepio.com * * trcKernel.c @@ -33,7 +33,7 @@ * * Tabs are used for indent in this file (1 tab = 4 spaces) * - * Copyright Percepio AB, 2014. + * Copyright Percepio AB, 2012-2015. * www.percepio.com ******************************************************************************/ @@ -44,18 +44,28 @@ #include /* Internal variables */ -uint8_t nISRactive = 0; +int8_t nISRactive = 0; objectHandleType handle_of_last_logged_task = 0; uint8_t inExcludedTask = 0; +#if (INCLUDE_MEMMANG_EVENTS == 1) /* Current heap usage. Always updated. */ static uint32_t heapMemUsage = 0; +#endif #if (TRACE_SCHEDULING_ONLY == 0) static uint32_t prvTraceGetParam(uint32_t, uint32_t); #endif #if !defined INCLUDE_READY_EVENTS || INCLUDE_READY_EVENTS == 1 + +static int readyEventsEnabled = 1; + +void vTraceSetReadyEventsEnabled(int status) +{ + readyEventsEnabled = status; +} + /******************************************************************************* * vTraceStoreTaskReady * @@ -75,6 +85,14 @@ void vTraceStoreTaskReady(objectHandleType handle) placement of the trace macro. In that case, the events are ignored. */ return; } + + if (! readyEventsEnabled) + { + /* When creating tasks, ready events are also created. If creating + a "hidden" (not traced) task, we must therefore disable recording + of ready events to avoid an undesired ready event... */ + return; + } TRACE_ASSERT(handle <= NTask, "vTraceStoreTaskReady: Invalid value for handle", ); @@ -171,13 +189,15 @@ void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t signed_si uint16_t addr_low; uint8_t addr_high; uint32_t size; + TRACE_SR_ALLOC_CRITICAL_SECTION(); + + if (RecorderDataPtr == NULL) // This happens in vTraceInitTraceData, if using dynamic allocation... + return; if (signed_size < 0) size = (uint32_t)(- signed_size); else size = (uint32_t)(signed_size); - - TRACE_SR_ALLOC_CRITICAL_SECTION(); trcCRITICAL_SECTION_BEGIN(); @@ -619,9 +639,9 @@ void vTraceSetPriorityProperty(uint8_t objectclass, objectHandleType id, uint8_t uint8_t uiTraceGetPriorityProperty(uint8_t objectclass, objectHandleType id) { TRACE_ASSERT(objectclass < TRACE_NCLASSES, - "uiTraceGetPriorityProperty: objectclass >= TRACE_NCLASSES", 0); + "uiTraceGetPriorityProperty: Invalid objectclass number (>= TRACE_NCLASSES)", 0); TRACE_ASSERT(id <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], - "uiTraceGetPriorityProperty: Invalid value for id", 0); + "uiTraceGetPriorityProperty: Task handle exceeds NTask. You may need to increase this constant in trcConfig.h.", 0); return TRACE_PROPERTY_ACTOR_PRIORITY(objectclass, id); } diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcUser.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcUser.c index 57c53ffbc..f2d212c3e 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcUser.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcUser.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Tracealyzer v2.7.0 Recorder Library + * Tracealyzer v2.7.7 Recorder Library * Percepio AB, www.percepio.com * * trcUser.c @@ -33,7 +33,7 @@ * * Tabs are used for indent in this file (1 tab = 4 spaces) * - * Copyright Percepio AB, 2014. + * Copyright Percepio AB, 2012-2015. * www.percepio.com ******************************************************************************/ #include "FreeRTOS.h" @@ -50,7 +50,7 @@ TRACE_STOP_HOOK vTraceStopHookPtr = (TRACE_STOP_HOOK)0; extern uint8_t inExcludedTask; -extern uint8_t nISRactive; +extern int8_t nISRactive; extern objectHandleType handle_of_last_logged_task; extern uint32_t dts_min; extern uint32_t hwtc_count_max_after_tick; @@ -127,6 +127,8 @@ void vTraceClear(void) memset(RecorderDataPtr->eventData, 0, RecorderDataPtr->maxEvents * 4); + handle_of_last_logged_task = 0; + trcCRITICAL_SECTION_END(); } @@ -632,47 +634,55 @@ void vTraceStoreISREnd(int pendingISR) uint16_t dts5; TRACE_SR_ALLOC_CRITICAL_SECTION(); + if (! RecorderDataPtr->recorderActive || ! handle_of_last_logged_task) + { + return; + } + if (recorder_busy) { vTraceError("Illegal call to vTraceStoreISREnd, recorder busy!"); return; } + + if (nISRactive == 0) + { + vTraceError("Unmatched call to vTraceStoreISREnd (nISRactive == 0, expected > 0)"); + return; + } trcCRITICAL_SECTION_BEGIN(); if (pendingISR == 0) { - if (RecorderDataPtr->recorderActive && handle_of_last_logged_task) - { - uint8_t hnd8, type; - dts5 = (uint16_t)prvTraceGetDTS(0xFFFF); - - if (nISRactive > 1) - { - /* return to another isr */ - type = TS_ISR_RESUME; - hnd8 = prvTraceGet8BitHandle(isrstack[nISRactive]); - } - else - { - /* return to task */ - type = TS_TASK_RESUME; - hnd8 = prvTraceGet8BitHandle(handle_of_last_logged_task); - } + uint8_t hnd8, type; + dts5 = (uint16_t)prvTraceGetDTS(0xFFFF); - ts = (TSEvent*)xTraceNextFreeEventBufferSlot(); - if (ts != NULL) - { - ts->type = type; - ts->objHandle = hnd8; - ts->dts = dts5; - prvTraceUpdateCounters(); - } + if (nISRactive > 1) + { + /* return to another isr */ + type = TS_ISR_RESUME; + hnd8 = prvTraceGet8BitHandle(isrstack[nISRactive]); + } + else + { + /* return to task */ + type = TS_TASK_RESUME; + hnd8 = prvTraceGet8BitHandle(handle_of_last_logged_task); + } - #if (SELECTED_PORT == PORT_ARM_CortexM) - /* Remember the last ISR exit event, as the event needs to be modified in case of a following ISR entry (if tail-chained ISRs) */ - ptrLastISRExitEvent = (uint8_t*)ts; - #endif + ts = (TSEvent*)xTraceNextFreeEventBufferSlot(); + if (ts != NULL) + { + ts->type = type; + ts->objHandle = hnd8; + ts->dts = dts5; + prvTraceUpdateCounters(); } + + #if (SELECTED_PORT == PORT_ARM_CortexM) + /* Remember the last ISR exit event, as the event needs to be modified in case of a following ISR entry (if tail-chained ISRs) */ + ptrLastISRExitEvent = (uint8_t*)ts; + #endif } nISRactive--; diff --git a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/.cproject b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/.cproject index ee8957dd9..329453521 100644 --- a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/.cproject +++ b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/.cproject @@ -65,22 +65,6 @@ - - - - diff --git a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/.project b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/.project index e7ec93029..02878e7a3 100644 --- a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/.project +++ b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/.project @@ -55,21 +55,21 @@ - 1438277863568 + 1438864614809 Full_Demo/Standard_Demo_Tasks 9 org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-include + 1.0-name-matches-false-false-Minimal - 1438277863618 + 1438864614839 Full_Demo/Standard_Demo_Tasks 9 org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-Minimal + 1.0-name-matches-false-false-include @@ -91,7 +91,7 @@ - 1438278034257 + 1438864777066 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -100,7 +100,7 @@ - 1438278034267 + 1438864777076 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -109,16 +109,16 @@ - 1438278034287 + 1438864777126 Full_Demo/Standard_Demo_Tasks/Minimal 5 org.eclipse.ui.ide.multiFilter - 1.0-name-matches-true-false-countsem.c + 1.0-name-matches-false-false-countsem.c - 1438278034297 + 1438864777146 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -127,7 +127,7 @@ - 1438278034307 + 1438864777146 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -136,7 +136,7 @@ - 1438278034317 + 1438864777156 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -145,7 +145,7 @@ - 1438278034327 + 1438864777166 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -154,7 +154,7 @@ - 1438278034337 + 1438864777166 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -163,7 +163,7 @@ - 1438278034347 + 1438864777176 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -172,7 +172,7 @@ - 1438278034357 + 1438864777186 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -181,7 +181,7 @@ - 1438278034367 + 1438864777206 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -190,7 +190,7 @@ - 1438278034367 + 1438864777206 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -199,7 +199,7 @@ - 1438278034377 + 1438864777216 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -208,7 +208,7 @@ - 1438278034387 + 1438864777226 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -217,7 +217,7 @@ - 1438278034397 + 1438864777226 Full_Demo/Standard_Demo_Tasks/Minimal 5 @@ -226,7 +226,7 @@ - 1438278034407 + 1438864777236 Full_Demo/Standard_Demo_Tasks/Minimal 5 diff --git a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/.settings/language.settings.xml b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/.settings/language.settings.xml index 4218c77f8..2e531ad18 100644 --- a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/.settings/language.settings.xml +++ b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewd b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewd index 1488d1af9..f1be6d40a 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewd +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewd @@ -10,7 +10,7 @@ 1 C-SPY - 4 + 5 27 1 @@ -57,7 +57,7 @@ @@ -339,7 +355,7 @@ - $TOOLKIT_DIR$\plugins\Lcd\lcd.ewplugin + $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 @@ -358,10 +374,6 @@ $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 - - $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin - 0 - $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 @@ -408,7 +420,7 @@ 1 C-SPY - 4 + 5 27 1 @@ -551,7 +563,7 @@ 430FET 1 - 26 + 29 1 1 + + + + @@ -737,7 +765,7 @@ - $TOOLKIT_DIR$\plugins\Lcd\lcd.ewplugin + $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 @@ -756,10 +784,6 @@ $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 - - $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin - 0 - $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 @@ -806,7 +830,7 @@ 1 C-SPY - 4 + 5 27 1 @@ -949,7 +973,7 @@ 430FET 1 - 26 + 29 1 1 + + + + @@ -1135,7 +1175,7 @@ - $TOOLKIT_DIR$\plugins\Lcd\lcd.ewplugin + $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 @@ -1154,10 +1194,6 @@ $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 - - $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin - 0 - $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 @@ -1204,7 +1240,7 @@ 1 C-SPY - 4 + 5 27 1 @@ -1347,7 +1383,7 @@ 430FET 1 - 26 + 29 1 1 + + + + @@ -1533,7 +1585,7 @@ - $TOOLKIT_DIR$\plugins\Lcd\lcd.ewplugin + $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 @@ -1552,10 +1604,6 @@ $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 - - $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin - 0 - $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewp b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewp index 2bb3bd35a..0febc9540 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewp +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewp @@ -10,9 +10,9 @@ 1 General - 14 + 17 - 32 + 33 1 1 + + @@ -707,6 +716,7 @@ + 0 @@ -726,7 +736,7 @@ XLINK 4 - 27 + 29 1 1 + + + + + + + + + + @@ -1089,9 +1139,9 @@ 1 General - 14 + 17 - 32 + 33 1 1 + + @@ -1786,6 +1845,7 @@ + 0 @@ -1805,7 +1865,7 @@ XLINK 4 - 27 + 29 1 1 + + + + + + + + + + @@ -2168,9 +2268,9 @@ 1 General - 14 + 17 - 32 + 33 1 1 + + @@ -2865,6 +2974,7 @@ + 0 @@ -2884,7 +2994,7 @@ XLINK 4 - 27 + 29 1 1 + + + + + + + + + + @@ -3247,9 +3397,9 @@ 1 General - 14 + 17 - 32 + 33 1 1 + + @@ -3944,6 +4103,7 @@ + 0 @@ -3963,7 +4123,7 @@ XLINK 4 - 27 + 29 1 1 + + + + + + + + + + diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewt b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewt index 55b6aadb4..dc2795286 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewt +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewt @@ -8,6 +8,970 @@ MSP430 1 + + C-STAT + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Release_Large_Data_Model @@ -15,6 +979,970 @@ MSP430 1 + + C-STAT + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Debug_Small_Data_Model @@ -22,6 +1950,970 @@ MSP430 1 + + C-STAT + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Debug_Medium_Data_Model @@ -29,6 +2921,970 @@ MSP430 1 + + C-STAT + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + F5XX_6XX_Core_Lib diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/settings/RTOSDemo.dni b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/settings/RTOSDemo.dni index 650e12acc..2f40e79fd 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/settings/RTOSDemo.dni +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/settings/RTOSDemo.dni @@ -85,6 +85,12 @@ UnspecRange=1 ActionState=1 [Simulator] Freq=1000000 +[EEM Sequencer] +Buffer=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +[EEM Cycle Counter 0] +Counter0=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +[EEM Cycle Counter 1] +Counter1=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA [Breakpoints] Count=0 [FET] diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/settings/RTOSDemo.wsdt b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/settings/RTOSDemo.wsdt index 27f558a50..9eae4ffea 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/settings/RTOSDemo.wsdt +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/settings/RTOSDemo.wsdt @@ -25,7 +25,7 @@ - + TabID-18858-27566 @@ -37,7 +37,7 @@ - 0TabID-15348-8476BuildBuildTabID-12693-9958Debug LogDebug-Log0 + 0TabID-15348-8476BuildBuildTabID-12693-9958Debug LogDebug-Log0 @@ -50,7 +50,7 @@ - iaridepm.enu1-2-2611409-2-2331268197024272358244643622967-2-23291682-2-216843311002381336382119048203252 + iaridepm.enu1-2-2611409-2-2331268197024272358244643622967-2-23291682-2-216843311002381336382119048203252 diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/Instructions_ReadMe.url b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/Instructions_ReadMe.url new file mode 100644 index 000000000..87e9ab5e4 --- /dev/null +++ b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/Instructions_ReadMe.url @@ -0,0 +1,5 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +URL=http://www.freertos.org/RTOS-Xilinx-SDK-BSP.html +IDList= diff --git a/FreeRTOS/Source/include/FreeRTOS.h b/FreeRTOS/Source/include/FreeRTOS.h index ae01cdb99..d8f969d9f 100644 --- a/FreeRTOS/Source/include/FreeRTOS.h +++ b/FreeRTOS/Source/include/FreeRTOS.h @@ -617,6 +617,34 @@ extern "C" { #define traceQUEUE_REGISTRY_ADD(xQueue, pcQueueName) #endif +#ifndef traceTASK_NOTIFY_TAKE_BLOCK + #define traceTASK_NOTIFY_TAKE_BLOCK() +#endif + +#ifndef traceTASK_NOTIFY_TAKE + #define traceTASK_NOTIFY_TAKE() +#endif + +#ifndef traceTASK_NOTIFY_WAIT_BLOCK + #define traceTASK_NOTIFY_WAIT_BLOCK() +#endif + +#ifndef traceTASK_NOTIFY_WAIT + #define traceTASK_NOTIFY_WAIT() +#endif + +#ifndef traceTASK_NOTIFY + #define traceTASK_NOTIFY() +#endif + +#ifndef traceTASK_NOTIFY_FROM_ISR + #define traceTASK_NOTIFY_FROM_ISR() +#endif + +#ifndef traceTASK_NOTIFY_GIVE_FROM_ISR + #define traceTASK_NOTIFY_GIVE_FROM_ISR() +#endif + #ifndef configGENERATE_RUN_TIME_STATS #define configGENERATE_RUN_TIME_STATS 0 #endif diff --git a/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h b/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h index 05252fead..8f22da6d9 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h +++ b/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h @@ -113,10 +113,8 @@ typedef unsigned short UBaseType_t; /*-----------------------------------------------------------*/ /* Critical section management. */ -#define portINTERRUPT_BITS ( ( uint16_t ) configKERNEL_INTERRUPT_PRIORITY << ( uint16_t ) 5 ) - -#define portDISABLE_INTERRUPTS() SR |= portINTERRUPT_BITS; __asm volatile ( "NOP" ) -#define portENABLE_INTERRUPTS() SR &= ~portINTERRUPT_BITS +#define portDISABLE_INTERRUPTS() SET_CPU_IPL( configKERNEL_INTERRUPT_PRIORITY ); __asm volatile ( "NOP" ) +#define portENABLE_INTERRUPTS() SET_CPU_IPL( 0 ) /* Note that exiting a critical sectino will set the IPL bits to 0, nomatter what their value was prior to entering the critical section. */ diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c index 683aa529c..4e6b29d88 100644 --- a/FreeRTOS/Source/tasks.c +++ b/FreeRTOS/Source/tasks.c @@ -1062,8 +1062,8 @@ StackType_t *pxTopOfStack; taskENTER_CRITICAL(); { - /* If null is passed in here then we are changing the - priority of the calling function. */ + /* If null is passed in here then it is the priority of the that + called uxTaskPriorityGet() that is being queried. */ pxTCB = prvGetTCBFromHandle( xTask ); uxReturn = pxTCB->uxPriority; } @@ -3960,6 +3960,8 @@ TickType_t uxReturn; } #endif /* INCLUDE_vTaskSuspend */ + traceTASK_NOTIFY_TAKE_BLOCK(); + /* All ports are written to allow a yield in a critical section (some will yield immediately, others wait until the critical section exits) - but it is not something that @@ -3980,6 +3982,7 @@ TickType_t uxReturn; taskENTER_CRITICAL(); { + traceTASK_NOTIFY_TAKE(); ulReturn = pxCurrentTCB->ulNotifiedValue; if( ulReturn != 0UL ) @@ -4075,6 +4078,8 @@ TickType_t uxReturn; } #endif /* INCLUDE_vTaskSuspend */ + traceTASK_NOTIFY_WAIT_BLOCK(); + /* All ports are written to allow a yield in a critical section (some will yield immediately, others wait until the critical section exits) - but it is not something that @@ -4095,6 +4100,8 @@ TickType_t uxReturn; taskENTER_CRITICAL(); { + traceTASK_NOTIFY_WAIT(); + if( pulNotificationValue != NULL ) { /* Output the current notification value, which may or may not @@ -4183,6 +4190,7 @@ TickType_t uxReturn; break; } + traceTASK_NOTIFY(); /* If the task is in the blocked state specifically to wait for a notification then unblock it now. */ @@ -4307,7 +4315,8 @@ TickType_t uxReturn; break; } - + traceTASK_NOTIFY_FROM_ISR(); + /* If the task is in the blocked state specifically to wait for a notification then unblock it now. */ if( eOriginalNotifyState == eWaitingNotification ) @@ -4388,6 +4397,8 @@ TickType_t uxReturn; /* 'Giving' is equivalent to incrementing a count in a counting semaphore. */ ( pxTCB->ulNotifiedValue )++; + + traceTASK_NOTIFY_GIVE_FROM_ISR(); /* If the task is in the blocked state specifically to wait for a notification then unblock it now. */