--- /dev/null
+/*\r
+ FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.\r
+ All rights reserved\r
+\r
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+ ***************************************************************************\r
+ >>! NOTE: The modification to the GPL is included to allow you to !<<\r
+ >>! distribute a combined work that includes FreeRTOS without being !<<\r
+ >>! obliged to provide the source code for proprietary components !<<\r
+ >>! outside of the FreeRTOS kernel. !<<\r
+ ***************************************************************************\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE. Full license text is available on the following\r
+ link: http://www.freertos.org/a00114.html\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that is more than just the market leader, it *\r
+ * is the industry's de facto standard. *\r
+ * *\r
+ * Help yourself get started quickly while simultaneously helping *\r
+ * to support the FreeRTOS project by purchasing a FreeRTOS *\r
+ * tutorial book, reference manual, or both: *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading\r
+ the FAQ page "My application does not run, what could be wrong?". Have you\r
+ defined configASSERT()?\r
+\r
+ http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+ embedded software for free we request you assist our global community by\r
+ participating in the support forum.\r
+\r
+ http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+ be as productive as possible as early as possible. Now you can receive\r
+ FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+ Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+ http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+ Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+ http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+ Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
+ mission critical applications that require provable dependability.\r
+\r
+ 1 tab == 4 spaces!\r
+*/\r
+\r
+/*\r
+ * FreeRTOS tasks are used with FreeRTOS+TCP to create a TCP echo server on the\r
+ * standard echo port number (7).\r
+ *\r
+ * See the following web page for essential demo usage and configuration\r
+ * details:\r
+ * http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Echo_Server.html\r
+ */\r
+\r
+/* Standard includes. */\r
+#include <stdint.h>\r
+#include <stdio.h>\r
+\r
+/* FreeRTOS includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "semphr.h"\r
+\r
+/* FreeRTOS+TCP includes. */\r
+#include "FreeRTOS_IP.h"\r
+#include "FreeRTOS_Sockets.h"\r
+\r
+/* Remove the whole file if FreeRTOSIPConfig.h is set to exclude TCP. */\r
+#if( ipconfigUSE_TCP == 1 )\r
+\r
+/* The maximum time to wait for a closing socket to close. */\r
+#define tcpechoSHUTDOWN_DELAY ( pdMS_TO_TICKS( 5000 ) )\r
+\r
+/* The standard echo port number. */\r
+#define tcpechoPORT_NUMBER 7\r
+\r
+/* If ipconfigUSE_TCP_WIN is 1 then the Tx sockets will use a buffer size set by\r
+ipconfigTCP_TX_BUFFER_LENGTH, and the Tx window size will be\r
+configECHO_SERVER_TX_WINDOW_SIZE times the buffer size. Note\r
+ipconfigTCP_TX_BUFFER_LENGTH is set in FreeRTOSIPConfig.h as it is a standard TCP/IP\r
+stack constant, whereas configECHO_SERVER_TX_WINDOW_SIZE is set in\r
+FreeRTOSConfig.h as it is a demo application constant. */\r
+#ifndef configECHO_SERVER_TX_WINDOW_SIZE\r
+ #define configECHO_SERVER_TX_WINDOW_SIZE 2\r
+#endif\r
+\r
+/* If ipconfigUSE_TCP_WIN is 1 then the Rx sockets will use a buffer size set by\r
+ipconfigTCP_RX_BUFFER_LENGTH, and the Rx window size will be\r
+configECHO_SERVER_RX_WINDOW_SIZE times the buffer size. Note\r
+ipconfigTCP_RX_BUFFER_LENGTH is set in FreeRTOSIPConfig.h as it is a standard TCP/IP\r
+stack constant, whereas configECHO_SERVER_RX_WINDOW_SIZE is set in\r
+FreeRTOSConfig.h as it is a demo application constant. */\r
+#ifndef configECHO_SERVER_RX_WINDOW_SIZE\r
+ #define configECHO_SERVER_RX_WINDOW_SIZE 2\r
+#endif\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * Uses FreeRTOS+TCP to listen for incoming echo connections, creating a task\r
+ * to handle each connection.\r
+ */\r
+static void prvConnectionListeningTask( void *pvParameters );\r
+\r
+/*\r
+ * Created by the connection listening task to handle a single connection.\r
+ */\r
+static void prvServerConnectionInstance( void *pvParameters );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Stores the stack size passed into vStartSimpleTCPServerTasks() so it can be\r
+reused when the server listening task creates tasks to handle connections. */\r
+static uint16_t usUsedStackSize = 0;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void vStartSimpleTCPServerTasks( uint16_t usStackSize, UBaseType_t uxPriority )\r
+{\r
+ /* Create the TCP echo server. */\r
+ xTaskCreate( prvConnectionListeningTask, "ServerListener", usStackSize, NULL, uxPriority + 1, NULL );\r
+\r
+ /* Remember the requested stack size so it can be re-used by the server\r
+ listening task when it creates tasks to handle connections. */\r
+ usUsedStackSize = usStackSize;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvConnectionListeningTask( void *pvParameters )\r
+{\r
+struct freertos_sockaddr xClient, xBindAddress;\r
+Socket_t xListeningSocket, xConnectedSocket;\r
+socklen_t xSize = sizeof( xClient );\r
+static const TickType_t xReceiveTimeOut = portMAX_DELAY;\r
+const BaseType_t xBacklog = 20;\r
+\r
+#if( ipconfigUSE_TCP_WIN == 1 )\r
+ WinProperties_t xWinProps;\r
+\r
+ /* Fill in the buffer and window sizes that will be used by the socket. */\r
+ xWinProps.lTxBufSize = ipconfigTCP_TX_BUFFER_LENGTH;\r
+ xWinProps.lTxWinSize = configECHO_SERVER_TX_WINDOW_SIZE;\r
+ xWinProps.lRxBufSize = ipconfigTCP_RX_BUFFER_LENGTH;\r
+ xWinProps.lRxWinSize = configECHO_SERVER_RX_WINDOW_SIZE;\r
+#endif /* ipconfigUSE_TCP_WIN */\r
+\r
+ /* Just to prevent compiler warnings. */\r
+ ( void ) pvParameters;\r
+\r
+ /* Attempt to open the socket. */\r
+ xListeningSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );\r
+ configASSERT( xListeningSocket != FREERTOS_INVALID_SOCKET );\r
+\r
+ /* Set a time out so accept() will just wait for a connection. */\r
+ FreeRTOS_setsockopt( xListeningSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );\r
+\r
+ /* Set the window and buffer sizes. */\r
+ #if( ipconfigUSE_TCP_WIN == 1 )\r
+ {\r
+ FreeRTOS_setsockopt( xListeningSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );\r
+ }\r
+ #endif /* ipconfigUSE_TCP_WIN */\r
+\r
+ /* Bind the socket to the port that the client task will send to, then\r
+ listen for incoming connections. */\r
+ xBindAddress.sin_port = tcpechoPORT_NUMBER;\r
+ xBindAddress.sin_port = FreeRTOS_htons( xBindAddress.sin_port );\r
+ FreeRTOS_bind( xListeningSocket, &xBindAddress, sizeof( xBindAddress ) );\r
+ FreeRTOS_listen( xListeningSocket, xBacklog );\r
+\r
+ for( ;; )\r
+ {\r
+ /* Wait for a client to connect. */\r
+ xConnectedSocket = FreeRTOS_accept( xListeningSocket, &xClient, &xSize );\r
+ configASSERT( xConnectedSocket != FREERTOS_INVALID_SOCKET );\r
+\r
+ /* Spawn a task to handle the connection. */\r
+ xTaskCreate( prvServerConnectionInstance, "EchoServer", usUsedStackSize, ( void * ) xConnectedSocket, tskIDLE_PRIORITY, NULL );\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvServerConnectionInstance( void *pvParameters )\r
+{\r
+int32_t lBytes, lSent, lTotalSent;\r
+Socket_t xConnectedSocket;\r
+static const TickType_t xReceiveTimeOut = pdMS_TO_TICKS( 5000 );\r
+static const TickType_t xSendTimeOut = pdMS_TO_TICKS( 5000 );\r
+TickType_t xTimeOnShutdown;\r
+uint8_t *pucRxBuffer;\r
+\r
+ xConnectedSocket = ( Socket_t ) pvParameters;\r
+\r
+ /* Attempt to create the buffer used to receive the string to be echoed\r
+ back. This could be avoided using a zero copy interface that just returned\r
+ the same buffer. */\r
+ pucRxBuffer = ( uint8_t * ) pvPortMalloc( ipconfigTCP_MSS );\r
+\r
+ if( pucRxBuffer != NULL )\r
+ {\r
+ FreeRTOS_setsockopt( xConnectedSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );\r
+ FreeRTOS_setsockopt( xConnectedSocket, 0, FREERTOS_SO_SNDTIMEO, &xSendTimeOut, sizeof( xReceiveTimeOut ) );\r
+\r
+ for( ;; )\r
+ {\r
+ /* Zero out the receive array so there is NULL at the end of the string\r
+ when it is printed out. */\r
+ memset( pucRxBuffer, 0x00, ipconfigTCP_MSS );\r
+\r
+ /* Receive data on the socket. */\r
+ lBytes = FreeRTOS_recv( xConnectedSocket, pucRxBuffer, ipconfigTCP_MSS, 0 );\r
+\r
+ /* If data was received, echo it back. */\r
+ if( lBytes >= 0 )\r
+ {\r
+ lSent = 0;\r
+ lTotalSent = 0;\r
+\r
+ /* Call send() until all the data has been sent. */\r
+ while( ( lSent >= 0 ) && ( lTotalSent < lBytes ) )\r
+ {\r
+ lSent = FreeRTOS_send( xConnectedSocket, pucRxBuffer, lBytes - lTotalSent, 0 );\r
+ lTotalSent += lSent;\r
+ }\r
+\r
+ if( lSent < 0 )\r
+ {\r
+ /* Socket closed? */\r
+ break;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ /* Socket closed? */\r
+ break;\r
+ }\r
+ }\r
+ }\r
+\r
+ /* Initiate a shutdown in case it has not already been initiated. */\r
+ FreeRTOS_shutdown( xConnectedSocket, FREERTOS_SHUT_RDWR );\r
+\r
+ /* Wait for the shutdown to take effect, indicated by FreeRTOS_recv()\r
+ returning an error. */\r
+ xTimeOnShutdown = xTaskGetTickCount();\r
+ do\r
+ {\r
+ if( FreeRTOS_recv( xConnectedSocket, pucRxBuffer, ipconfigTCP_MSS, 0 ) < 0 )\r
+ {\r
+ break;\r
+ }\r
+ } while( ( xTaskGetTickCount() - xTimeOnShutdown ) < tcpechoSHUTDOWN_DELAY );\r
+\r
+ /* Finished with the socket, buffer, the task. */\r
+ vPortFree( pucRxBuffer );\r
+ FreeRTOS_closesocket( xConnectedSocket );\r
+\r
+ vTaskDelete( NULL );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* The whole file is excluded if TCP is not compiled in. */\r
+#endif /* ipconfigUSE_TCP */\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.\r
+ All rights reserved\r
+\r
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+ ***************************************************************************\r
+ >>! NOTE: The modification to the GPL is included to allow you to !<<\r
+ >>! distribute a combined work that includes FreeRTOS without being !<<\r
+ >>! obliged to provide the source code for proprietary components !<<\r
+ >>! outside of the FreeRTOS kernel. !<<\r
+ ***************************************************************************\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE. Full license text is available on the following\r
+ link: http://www.freertos.org/a00114.html\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that is more than just the market leader, it *\r
+ * is the industry's de facto standard. *\r
+ * *\r
+ * Help yourself get started quickly while simultaneously helping *\r
+ * to support the FreeRTOS project by purchasing a FreeRTOS *\r
+ * tutorial book, reference manual, or both: *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading\r
+ the FAQ page "My application does not run, what could be wrong?". Have you\r
+ defined configASSERT()?\r
+\r
+ http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+ embedded software for free we request you assist our global community by\r
+ participating in the support forum.\r
+\r
+ http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+ be as productive as possible as early as possible. Now you can receive\r
+ FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+ Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+ http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+ Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+ http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+ Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
+ mission critical applications that require provable dependability.\r
+\r
+ 1 tab == 4 spaces!\r
+*/\r
+\r
+#ifndef SIMPLE_TCP_ECHO_SERVER_H\r
+#define SIMPLE_TCP_ECHO_SERVER_H\r
+\r
+void vStartSimpleTCPServerTasks( uint16_t usStackSize, BaseType_t uxPriority );\r
+BaseType_t xAreTCPEchoServersStillRunning( void );\r
+\r
+#endif /* SIMPLE_TCP_ECHO_SERVER_H */\r
\r
/* Default IP address configuration. Used in ipconfigUSE_DNS is set to 0, or\r
ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */\r
-#define configIP_ADDR0 172\r
-#define configIP_ADDR1 25\r
-#define configIP_ADDR2 218\r
+#define configIP_ADDR0 10\r
+#define configIP_ADDR1 10\r
+#define configIP_ADDR2 10\r
#define configIP_ADDR3 200\r
\r
/* Default gateway IP address configuration. Used in ipconfigUSE_DNS is set to\r
0, or ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */\r
-#define configGATEWAY_ADDR0 172\r
-#define configGATEWAY_ADDR1 25\r
-#define configGATEWAY_ADDR2 218\r
+#define configGATEWAY_ADDR0 10\r
+#define configGATEWAY_ADDR1 10\r
+#define configGATEWAY_ADDR2 10\r
#define configGATEWAY_ADDR3 1\r
\r
/* Default DNS server configuration. OpenDNS addresses are 208.67.222.222 and\r
/* Default netmask configuration. Used in ipconfigUSE_DNS is set to 0, or\r
ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */\r
#define configNET_MASK0 255\r
-#define configNET_MASK1 255\r
+#define configNET_MASK1 0\r
#define configNET_MASK2 0\r
#define configNET_MASK3 0\r
\r
<ClCompile Include="..\..\Source\FreeRTOS-Plus-TCP\FreeRTOS_UDP_IP.c" />\r
<ClCompile Include="..\..\Source\FreeRTOS-Plus-TCP\portable\BufferManagement\BufferAllocation_2.c" />\r
<ClCompile Include="..\..\Source\FreeRTOS-Plus-TCP\portable\NetworkInterface\WinPCap\NetworkInterface.c" />\r
+ <ClCompile Include="DemoTasks\SimpleTCPEchoServer.c" />\r
<ClCompile Include="DemoTasks\TCPEchoClient_SingleTasks.c" />\r
<ClCompile Include="DemoTasks\SimpleUDPClientAndServer.c" />\r
<ClCompile Include="demo_logging.c" />\r
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>\r
</ClCompile>\r
<ClCompile Include="demo_logging.c" />\r
+ <ClCompile Include="DemoTasks\SimpleTCPEchoServer.c">\r
+ <Filter>DemoTasks</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\..\Source\FreeRTOS-Plus-TCP\include\NetworkInterface.h">\r
#include "FreeRTOS_IP.h"\r
#include "FreeRTOS_Sockets.h"\r
#include "SimpleUDPClientAndServer.h"\r
+#include "SimpleTCPEchoServer.h"\r
#include "TCPEchoClient_SingleTasks.h"\r
#include "demo_logging.h"\r
\r
#define mainECHO_CLIENT_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 ) /* Not used in the Windows port. */\r
#define mainECHO_CLIENT_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
\r
+/* Echo server task parameters. */\r
+#define mainECHO_SERVER_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 ) /* Not used in the Windows port. */\r
+#define mainECHO_SERVER_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+\r
/* Define a name that will be used for LLMNR and NBNS searches. */\r
#define mainHOST_NAME "RTOSDemo"\r
#define mainDEVICE_NICK_NAME "windows_demo"\r
same RTOS task). The IP address of the echo server must be configured using the\r
configECHO_SERVER_ADDR0 to configECHO_SERVER_ADDR3 constants in\r
FreeRTOSConfig.h.\r
+\r
+mainCREATE_TCP_ECHO_SERVER_TASK: When set to 1 a task is created that accepts\r
+connections on the standard echo port (port 7), then echos back any data\r
+received on that connection.\r
*/\r
#define mainCREATE_SIMPLE_UDP_CLIENT_SERVER_TASKS 1\r
#define mainCREATE_TCP_ECHO_TASKS_SINGLE 1\r
-\r
+#define mainCREATE_TCP_ECHO_SERVER_TASK 0\r
/*-----------------------------------------------------------*/\r
\r
/*\r
}\r
#endif /* mainCREATE_TCP_ECHO_TASKS_SINGLE */\r
\r
+ #if( mainCREATE_TCP_ECHO_SERVER_TASK == 1 )\r
+ {\r
+ vStartSimpleTCPServerTasks( mainECHO_SERVER_TASK_STACK_SIZE, mainECHO_SERVER_TASK_PRIORITY );\r
+ }\r
+ #endif\r
+\r
xTasksAlreadyCreated = pdTRUE;\r
}\r
\r
/*\r
- * FreeRTOS+TCP V2.0.1\r
+ * FreeRTOS+TCP V2.0.3\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
*\r
- * http://www.FreeRTOS.org\r
* http://aws.amazon.com/freertos\r
- *\r
- * 1 tab == 4 spaces!\r
+ * http://www.FreeRTOS.org\r
*/\r
\r
/* Standard includes. */\r
xDHCPData.ulTransactionId++;\r
}\r
\r
- xDHCPData.xUseBroadcast = 0;\r
- xDHCPData.ulOfferedIPAddress = 0UL;\r
- xDHCPData.ulDHCPServerAddress = 0UL;\r
- xDHCPData.xDHCPTxPeriod = dhcpINITIAL_DHCP_TX_PERIOD;\r
-\r
- /* Create the DHCP socket if it has not already been created. */\r
- prvCreateDHCPSocket();\r
- FreeRTOS_debug_printf( ( "prvInitialiseDHCP: start after %lu ticks\n", dhcpINITIAL_TIMER_PERIOD ) );\r
- vIPReloadDHCPTimer( dhcpINITIAL_TIMER_PERIOD );\r
+ /* Check for random number generator API failure. */\r
+ if( 0 != xDHCPData.ulTransactionId )\r
+ {\r
+ xDHCPData.xUseBroadcast = 0;\r
+ xDHCPData.ulOfferedIPAddress = 0UL;\r
+ xDHCPData.ulDHCPServerAddress = 0UL;\r
+ xDHCPData.xDHCPTxPeriod = dhcpINITIAL_DHCP_TX_PERIOD;\r
+\r
+ /* Create the DHCP socket if it has not already been created. */\r
+ prvCreateDHCPSocket();\r
+ FreeRTOS_debug_printf( ( "prvInitialiseDHCP: start after %lu ticks\n", dhcpINITIAL_TIMER_PERIOD ) );\r
+ vIPReloadDHCPTimer( dhcpINITIAL_TIMER_PERIOD );\r
+ }\r
}\r
/*-----------------------------------------------------------*/\r
\r
state machine is expecting. */\r
ulProcessed++;\r
}\r
- else\r
+ else if( *pucByte == ( uint8_t ) dhcpMESSAGE_TYPE_NACK )\r
{\r
- if( *pucByte == ( uint8_t ) dhcpMESSAGE_TYPE_NACK )\r
+ if( xExpectedMessageType == ( BaseType_t ) dhcpMESSAGE_TYPE_ACK )\r
{\r
- if( xExpectedMessageType == ( BaseType_t ) dhcpMESSAGE_TYPE_ACK )\r
- {\r
- /* Start again. */\r
- xDHCPData.eDHCPState = eWaitingSendFirstDiscover;\r
- }\r
+ /* Start again. */\r
+ xDHCPData.eDHCPState = eWaitingSendFirstDiscover;\r
}\r
- /* Stop processing further options. */\r
- ucLength = 0;\r
+ }\r
+ else\r
+ {\r
+ /* Don't process other message types. */\r
}\r
break;\r
\r
pxWhere->pxPrevious = pxNewListItem;\r
\r
/* Remember which list the item is in. */\r
- pxNewListItem->pvContainer = ( void * ) pxList;\r
+ pxNewListItem->pxContainer = pxList; \r
\r
( pxList->uxNumberOfItems )++;\r
}\r
{\r
ulSavedSequenceNumber = ulCurrentSequenceNumber;\r
\r
- /* Clean up all sequence received between ulSequenceNumber \r
+ /* Clean up all sequence received between ulSequenceNumber\r
and ulSequenceNumber + ulLength since they are duplicated.\r
- If the server is forced to retransmit packets several time \r
- in a row it might send a batch of concatenated packet for \r
- speed. So we cannot rely on the packets between \r
- ulSequenceNumber and ulSequenceNumber + ulLength to be \r
+ If the server is forced to retransmit packets several time\r
+ in a row it might send a batch of concatenated packet for\r
+ speed. So we cannot rely on the packets between\r
+ ulSequenceNumber and ulSequenceNumber + ulLength to be\r
sequential and it is better to just clean them out. */\r
do\r
{\r
#endif\r
\r
#ifndef ipconfigTCP_KEEP_ALIVE\r
- #define ipconfigTCP_KEEP_ALIVE 0\r
+ #define ipconfigTCP_KEEP_ALIVE 1\r
#endif\r
\r
#ifndef ipconfigDNS_USE_CALLBACKS\r
#endif\r
\r
#ifndef ipconfigTCP_HANG_PROTECTION\r
- #define ipconfigTCP_HANG_PROTECTION 0\r
+ #define ipconfigTCP_HANG_PROTECTION 1\r
#endif\r
\r
#ifndef ipconfigTCP_IP_SANITY\r
/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* trcHardwarePort.h\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2017.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
\r
#define TRC_HWTC_FREQ_HZ (TRACE_TICK_RATE_HZ * TRC_HWTC_PERIOD)\r
#define TRC_IRQ_PRIORITY_ORDER 0\r
\r
+#elif (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Altera_NiosII)\r
+\r
+ /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
+ \r
+ #include "system.h"\r
+ #include "sys/alt_timestamp.h"\r
+\r
+ #define TRC_HWTC_TYPE TRC_OS_TIMER_INCR\r
+ #define TRC_HWTC_COUNT (uint32_t)alt_timestamp()\r
+ #define TRC_HWTC_PERIOD 0xFFFFFFFF\r
+ #define TRC_HWTC_FREQ_HZ TIMESTAMP_TIMER_FREQ\r
+ #define TRC_HWTC_DIVISOR 1\r
+ #define TRC_IRQ_PRIORITY_ORDER 0\r
+\r
#elif (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_ARM_CORTEX_A9)\r
+ \r
/* INPUT YOUR PERIPHERAL BASE ADDRESS HERE */\r
#define TRC_CA9_MPCORE_PERIPHERAL_BASE_ADDRESS 0xSOMETHING\r
\r
/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* Terms of Use\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2017.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
\r
\r
/*** FreeRTOS version codes **************************************************/\r
#define FREERTOS_VERSION_NOT_SET 0\r
-#define TRC_FREERTOS_VERSION_7_3_OR_7_4 1\r
-#define TRC_FREERTOS_VERSION_7_5_OR_7_6 2\r
-#define TRC_FREERTOS_VERSION_8_X 3\r
-#define TRC_FREERTOS_VERSION_9_X 4\r
+#define TRC_FREERTOS_VERSION_7_3 1 /* v7.3 is earliest supported.*/\r
+#define TRC_FREERTOS_VERSION_7_4 2\r
+#define TRC_FREERTOS_VERSION_7_5_OR_7_6 3\r
+#define TRC_FREERTOS_VERSION_8_X 4 /* Any v8.x.x*/\r
+#define TRC_FREERTOS_VERSION_9_0_0 5 \r
+#define TRC_FREERTOS_VERSION_9_0_1 6 \r
+#define TRC_FREERTOS_VERSION_9_0_2 7\r
+#define TRC_FREERTOS_VERSION_10_0_0 8 /* If using FreeRTOS v10.0.0 or later version */\r
\r
-#if (TRC_USE_TRACEALYZER_RECORDER == 1)\r
+#define TRC_FREERTOS_VERSION_9_X 42 /* Not allowed anymore */\r
+\r
+#if (TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X)\r
+/* This setting for TRC_CFG_FREERTOS_VERSION is no longer allowed as v9.0.1 needs special handling. */ \r
+#error "Please specify your exact FreeRTOS version in trcConfig.h, from the options listed above."\r
+#endif\r
+\r
+#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+#define prvGetStreamBufferType(x) ((( StreamBuffer_t * )x )->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER)\r
+#else\r
+#define prvGetStreamBufferType(x) 0\r
+#endif\r
+\r
+/* Added mainly for our internal testing. This makes it easier to create test applications that \r
+ runs on multiple FreeRTOS versions. */\r
+#if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_8_X)\r
+ /* FreeRTOS v7.0 and later */ \r
+ #define STRING_CAST(x) ( (signed char*) x )\r
+ #define TickType portTickType\r
+#else\r
+ /* FreeRTOS v8.0 and later */\r
+ #define STRING_CAST(x) x\r
+ #define TickType TickType_t\r
+#endif\r
+\r
+#if (defined(TRC_USE_TRACEALYZER_RECORDER)) && (TRC_USE_TRACEALYZER_RECORDER == 1)\r
\r
/*******************************************************************************\r
* INCLUDE_xTaskGetCurrentTaskHandle must be set to 1 for tracing to work properly\r
#undef INCLUDE_xTaskGetCurrentTaskHandle\r
#define INCLUDE_xTaskGetCurrentTaskHandle 1\r
\r
+#if (TRC_CFG_SCHEDULING_ONLY == 0)\r
/*******************************************************************************\r
* vTraceSetQueueName(void* object, const char* name)\r
*\r
******************************************************************************/\r
void vTraceSetMutexName(void* object, const char* name);\r
\r
+#if (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1)\r
+/*******************************************************************************\r
+* vTraceSetEventGroupName(void* object, const char* name)\r
+*\r
+* Parameter object: pointer to the EventGroup that shall be named\r
+* Parameter name: the name to set (const string literal)\r
+*\r
+* Sets a name for EventGroup objects for display in Tracealyzer.\r
+******************************************************************************/\r
+void vTraceSetEventGroupName(void* object, const char* name);\r
+#else /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1) */\r
+#define vTraceSetEventGroupName(object, name) /* Do nothing */\r
+#endif /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1) */\r
+\r
+#if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1)\r
+/*******************************************************************************\r
+* vTraceSetStreamBufferName(void* object, const char* name)\r
+*\r
+* Parameter object: pointer to the StreamBuffer that shall be named\r
+* Parameter name: the name to set (const string literal)\r
+*\r
+* Sets a name for StreamBuffer objects for display in Tracealyzer.\r
+******************************************************************************/\r
+void vTraceSetStreamBufferName(void* object, const char* name);\r
+#else /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) */\r
+#define vTraceSetStreamBufferName(object, name) /* Do nothing */\r
+#endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) */\r
+\r
+#if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1)\r
+/*******************************************************************************\r
+ * vTraceSetMessageBufferName(void* object, const char* name)\r
+ *\r
+ * Parameter object: pointer to the MessageBuffer that shall be named\r
+ * Parameter name: the name to set (const string literal)\r
+ *\r
+ * Sets a name for MessageBuffer objects for display in Tracealyzer.\r
+ ******************************************************************************/\r
+void vTraceSetMessageBufferName(void* object, const char* name);\r
+#else /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) */\r
+#define vTraceSetMessageBufferName(object, name) /* Do nothing */\r
+#endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) */\r
+\r
+#else /* (TRC_CFG_SCHEDULING_ONLY == 0) */\r
+\r
+#define vTraceSetQueueName(object, name) /* Do nothing */\r
+#define vTraceSetSemaphoreName(object, name) /* Do nothing */\r
+#define vTraceSetMutexName(object, name) /* Do nothing */\r
+#define vTraceSetEventGroupName(object, name) /* Do nothing */\r
+#define vTraceSetStreamBufferName(object, name) /* Do nothing */\r
+#define vTraceSetMessageBufferName(object, name) /* Do nothing */\r
+\r
+#endif /* (TRC_CFG_SCHEDULING_ONLY == 0) */\r
+\r
/*******************************************************************************\r
* Note: Setting names for event groups is difficult to support, this has been \r
* excluded intentionally. This since we don't know if event_groups.c is \r
/* If using dynamic allocation of snapshot trace buffer... */\r
#define TRACE_MALLOC(size) pvPortMalloc(size) \r
\r
-#ifdef configUSE_TIMERS\r
+#if defined(configUSE_TIMERS)\r
#if (configUSE_TIMERS == 1)\r
#undef INCLUDE_xTimerGetTimerDaemonTaskHandle\r
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1\r
#define TRACE_EXIT_CRITICAL_SECTION() {__set_PRIMASK(__irq_status);}\r
#endif\r
\r
-#if ((TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_ARM_CORTEX_A9) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Renesas_RX600) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_MICROCHIP_PIC24_PIC32))\r
+#if ((TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_ARM_CORTEX_A9) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Renesas_RX600) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_MICROCHIP_PIC24_PIC32) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Altera_NiosII))\r
#define TRACE_ALLOC_CRITICAL_SECTION() int __irq_status;\r
#define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = portSET_INTERRUPT_MASK_FROM_ISR();}\r
#define TRACE_EXIT_CRITICAL_SECTION() {portCLEAR_INTERRUPT_MASK_FROM_ISR(__irq_status);}\r
#error "This hardware port has no definition for critical sections! See http://percepio.com/2014/10/27/how-to-define-critical-sections-for-the-recorder/"\r
#endif\r
\r
+\r
+#if (TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_0_1)\r
+ /******************************************************************************\r
+ * Fix for FreeRTOS v9.0.1 to correctly identify xQueuePeek events.\r
+ *\r
+ * In FreeRTOS v9.0.1, the below trace hooks are incorrectly used from three\r
+ * different functions. This as the earlier function xQueueGenericReceive\r
+ * has been replaced by xQueuePeek, xQueueSemaphoreTake and xQueueReceive.\r
+ *\r
+ * xQueueGenericReceive had a parameter "xJustPeeking", used by the trace hooks\r
+ * to tell between xQueuePeek events and others. This is no longer present, so\r
+ * we need another way to correctly identify peek events. Since all three\r
+ * functions call the same trace macros, the context of these macro is unknown.\r
+ *\r
+ * We therefore check the __LINE__ macro inside of the trace macros. This gives\r
+ * the line number of queue.c, where the macros are used. This can be used to\r
+ * tell if the context is xQueuePeek or another function.\r
+ * __LINE__ is a standard compiler feature since ancient times, so it should\r
+ * work on all common compilers.\r
+ *\r
+ * This might seem as a quite brittle and unusual solution, but works in this\r
+ * particular case and is only for FreeRTOS v9.0.1.\r
+ * Future versions of FreeRTOS should not need this fix, as we have submitted\r
+ * a correction of queue.c with individual trace macros for each function.\r
+ ******************************************************************************/\r
+#define isQueueReceiveHookActuallyPeek (__LINE__ > 1674) /* Half way between the closes trace points */\r
+\r
+#elif (TRC_CFG_FREERTOS_VERSION <= TRC_FREERTOS_VERSION_9_0_0)\r
+#define isQueueReceiveHookActuallyPeek xJustPeeking\r
+\r
+#elif (TRC_CFG_FREERTOS_VERSION > TRC_FREERTOS_VERSION_9_0_1)\r
+#define isQueueReceiveHookActuallyPeek (__LINE__ < 0) /* instead of pdFALSE to fix a warning of "constant condition" */\r
+\r
+#endif\r
+\r
+extern uint16_t CurrentFilterMask;\r
+\r
+extern uint16_t CurrentFilterGroup;\r
+\r
+uint8_t prvTraceGetQueueType(void* handle);\r
+\r
+uint16_t prvTraceGetTaskNumberLow16(void* handle);\r
+uint16_t prvTraceGetTaskNumberHigh16(void* handle);\r
+void prvTraceSetTaskNumberLow16(void* handle, uint16_t value);\r
+void prvTraceSetTaskNumberHigh16(void* handle, uint16_t value);\r
+\r
+uint16_t prvTraceGetQueueNumberLow16(void* handle);\r
+uint16_t prvTraceGetQueueNumberHigh16(void* handle);\r
+void prvTraceSetQueueNumberLow16(void* handle, uint16_t value);\r
+void prvTraceSetQueueNumberHigh16(void* handle, uint16_t value);\r
+\r
+#if (TRC_CFG_INCLUDE_TIMER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+uint16_t prvTraceGetTimerNumberLow16(void* handle);\r
+uint16_t prvTraceGetTimerNumberHigh16(void* handle);\r
+void prvTraceSetTimerNumberLow16(void* handle, uint16_t value);\r
+void prvTraceSetTimerNumberHigh16(void* handle, uint16_t value);\r
+#endif /* (TRC_CFG_INCLUDE_TIMER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+\r
+#if (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+uint16_t prvTraceGetEventGroupNumberLow16(void* handle);\r
+uint16_t prvTraceGetEventGroupNumberHigh16(void* handle);\r
+void prvTraceSetEventGroupNumberLow16(void* handle, uint16_t value);\r
+void prvTraceSetEventGroupNumberHigh16(void* handle, uint16_t value);\r
+#endif /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+\r
+#if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+uint16_t prvTraceGetStreamBufferNumberLow16(void* handle);\r
+uint16_t prvTraceGetStreamBufferNumberHigh16(void* handle);\r
+void prvTraceSetStreamBufferNumberLow16(void* handle, uint16_t value);\r
+void prvTraceSetStreamBufferNumberHigh16(void* handle, uint16_t value);\r
+#endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+\r
+#define TRACE_GET_TASK_FILTER(pxTask) prvTraceGetTaskNumberHigh16((void*)pxTask)\r
+#define TRACE_SET_TASK_FILTER(pxTask, group) prvTraceSetTaskNumberHigh16((void*)pxTask, group)\r
+\r
+#define TRACE_GET_QUEUE_FILTER(pxObject) prvTraceGetQueueNumberHigh16((void*)pxObject)\r
+#define TRACE_SET_QUEUE_FILTER(pxObject, group) prvTraceSetQueueNumberHigh16((void*)pxObject, group)\r
+\r
+#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+#define TRACE_GET_EVENTGROUP_FILTER(pxObject) prvTraceGetEventGroupNumberHigh16((void*)pxObject)\r
+#define TRACE_SET_EVENTGROUP_FILTER(pxObject, group) prvTraceSetEventGroupNumberHigh16((void*)pxObject, group)\r
+#else /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+/* FreeRTOS versions before v10.0 does not support filtering for event groups */\r
+#define TRACE_GET_EVENTGROUP_FILTER(pxObject) 1\r
+#define TRACE_SET_EVENTGROUP_FILTER(pxObject, group) \r
+#endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+\r
+#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+#define TRACE_GET_TIMER_FILTER(pxObject) prvTraceGetTimerNumberHigh16((void*)pxObject)\r
+#define TRACE_SET_TIMER_FILTER(pxObject, group) prvTraceSetTimerNumberHigh16((void*)pxObject, group)\r
+#else /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+/* FreeRTOS versions before v10.0 does not support filtering for timers */\r
+#define TRACE_GET_TIMER_FILTER(pxObject) 1\r
+#define TRACE_SET_TIMER_FILTER(pxObject, group) \r
+#endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+\r
+#define TRACE_GET_STREAMBUFFER_FILTER(pxObject) prvTraceGetStreamBufferNumberHigh16((void*)pxObject)\r
+#define TRACE_SET_STREAMBUFFER_FILTER(pxObject, group) prvTraceSetStreamBufferNumberHigh16((void*)pxObject, group)\r
+\r
+#define TRACE_GET_OBJECT_FILTER(CLASS, pxObject) TRACE_GET_##CLASS##_FILTER(pxObject)\r
+#define TRACE_SET_OBJECT_FILTER(CLASS, pxObject, group) TRACE_SET_##CLASS##_FILTER(pxObject, group)\r
+\r
/******************************************************************************/\r
/*** Definitions for Snapshot mode ********************************************/\r
/******************************************************************************/\r
\r
/*** The object classes *******************************************************/\r
\r
-#define TRACE_NCLASSES 7\r
+#define TRACE_NCLASSES 9\r
#define TRACE_CLASS_QUEUE ((traceObjectClass)0)\r
#define TRACE_CLASS_SEMAPHORE ((traceObjectClass)1)\r
#define TRACE_CLASS_MUTEX ((traceObjectClass)2)\r
#define TRACE_CLASS_ISR ((traceObjectClass)4)\r
#define TRACE_CLASS_TIMER ((traceObjectClass)5)\r
#define TRACE_CLASS_EVENTGROUP ((traceObjectClass)6)\r
+#define TRACE_CLASS_STREAMBUFFER ((traceObjectClass)7)\r
+#define TRACE_CLASS_MESSAGEBUFFER ((traceObjectClass)8)\r
\r
/*** Definitions for Object Table ********************************************/\r
-#define TRACE_KERNEL_OBJECT_COUNT (TRC_CFG_NQUEUE + TRC_CFG_NSEMAPHORE + TRC_CFG_NMUTEX + TRC_CFG_NTASK + TRC_CFG_NISR + TRC_CFG_NTIMER + TRC_CFG_NEVENTGROUP)\r
+#define TRACE_KERNEL_OBJECT_COUNT ((TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) + (TRC_CFG_NTASK) + (TRC_CFG_NISR) + (TRC_CFG_NTIMER) + (TRC_CFG_NEVENTGROUP) + (TRC_CFG_NSTREAMBUFFER) + (TRC_CFG_NMESSAGEBUFFER))\r
\r
/* Queue properties (except name): current number of message in queue */\r
-#define PropertyTableSizeQueue (TRC_CFG_NAME_LEN_QUEUE + 1)\r
+#define PropertyTableSizeQueue ((TRC_CFG_NAME_LEN_QUEUE) + 1)\r
\r
/* Semaphore properties (except name): state (signaled = 1, cleared = 0) */\r
-#define PropertyTableSizeSemaphore (TRC_CFG_NAME_LEN_SEMAPHORE + 1)\r
+#define PropertyTableSizeSemaphore ((TRC_CFG_NAME_LEN_SEMAPHORE) + 1)\r
\r
/* Mutex properties (except name): owner (task handle, 0 = free) */\r
-#define PropertyTableSizeMutex (TRC_CFG_NAME_LEN_MUTEX + 1)\r
+#define PropertyTableSizeMutex ((TRC_CFG_NAME_LEN_MUTEX) + 1)\r
\r
/* Task properties (except name): Byte 0: Current priority\r
Byte 1: state (if already active)\r
Byte 2: legacy, not used\r
Byte 3: legacy, not used */\r
-#define PropertyTableSizeTask (TRC_CFG_NAME_LEN_TASK + 4)\r
+#define PropertyTableSizeTask ((TRC_CFG_NAME_LEN_TASK) + 4)\r
\r
/* ISR properties: Byte 0: priority\r
Byte 1: state (if already active) */\r
-#define PropertyTableSizeISR (TRC_CFG_NAME_LEN_ISR + 2)\r
+#define PropertyTableSizeISR ((TRC_CFG_NAME_LEN_ISR) + 2)\r
\r
/* TRC_CFG_NTIMER properties: Byte 0: state (unused for now) */\r
-#define PropertyTableSizeTimer (TRC_CFG_NAME_LEN_TIMER + 1)\r
+#define PropertyTableSizeTimer ((TRC_CFG_NAME_LEN_TIMER) + 1)\r
\r
/* TRC_CFG_NEVENTGROUP properties: Byte 0-3: state (unused for now)*/\r
-#define PropertyTableSizeEventGroup (TRC_CFG_NAME_LEN_EVENTGROUP + 4)\r
+#define PropertyTableSizeEventGroup ((TRC_CFG_NAME_LEN_EVENTGROUP) + 4)\r
\r
+/* TRC_CFG_NSTREAMBUFFER properties: Byte 0-3: state (unused for now)*/\r
+#define PropertyTableSizeStreamBuffer ((TRC_CFG_NAME_LEN_STREAMBUFFER) + 4)\r
\r
-/* The layout of the byte array representing the Object Property Table */\r
-#define StartIndexQueue 0\r
-#define StartIndexSemaphore StartIndexQueue + TRC_CFG_NQUEUE * PropertyTableSizeQueue\r
-#define StartIndexMutex StartIndexSemaphore + TRC_CFG_NSEMAPHORE * PropertyTableSizeSemaphore\r
-#define StartIndexTask StartIndexMutex + TRC_CFG_NMUTEX * PropertyTableSizeMutex\r
-#define StartIndexISR StartIndexTask + TRC_CFG_NTASK * PropertyTableSizeTask\r
-#define StartIndexTimer StartIndexISR + TRC_CFG_NISR * PropertyTableSizeISR\r
-#define StartIndexEventGroup StartIndexTimer + TRC_CFG_NTIMER * PropertyTableSizeTimer\r
+/* TRC_CFG_NMESSAGEBUFFER properties: Byte 0-3: state (unused for now)*/\r
+#define PropertyTableSizeMessageBuffer ((TRC_CFG_NAME_LEN_MESSAGEBUFFER) + 4)\r
\r
-/* Number of bytes used by the object table */\r
-#define TRACE_OBJECT_TABLE_SIZE StartIndexEventGroup + TRC_CFG_NEVENTGROUP * PropertyTableSizeEventGroup\r
\r
-///*** FreeRTOS version codes **************************************************/\r
-//#define FREERTOS_VERSION_NOT_SET 0\r
-//#define TRC_FREERTOS_VERSION_7_3_OR_7_4 1\r
-//#define TRC_FREERTOS_VERSION_7_5_OR_7_6 2\r
-//#define TRC_FREERTOS_VERSION_8_X 3\r
-//#define TRC_FREERTOS_VERSION_9_X 4\r
+/* The layout of the byte array representing the Object Property Table */\r
+#define StartIndexQueue (0)\r
+#define StartIndexSemaphore (StartIndexQueue + (TRC_CFG_NQUEUE) * PropertyTableSizeQueue)\r
+#define StartIndexMutex (StartIndexSemaphore + (TRC_CFG_NSEMAPHORE) * PropertyTableSizeSemaphore)\r
+#define StartIndexTask (StartIndexMutex + (TRC_CFG_NMUTEX) * PropertyTableSizeMutex)\r
+#define StartIndexISR (StartIndexTask + (TRC_CFG_NTASK) * PropertyTableSizeTask)\r
+#define StartIndexTimer (StartIndexISR + (TRC_CFG_NISR) * PropertyTableSizeISR)\r
+#define StartIndexEventGroup (StartIndexTimer + (TRC_CFG_NTIMER) * PropertyTableSizeTimer)\r
+#define StartIndexStreamBuffer (StartIndexEventGroup + (TRC_CFG_NEVENTGROUP) * PropertyTableSizeEventGroup)\r
+#define StartIndexMessageBuffer (StartIndexStreamBuffer + (TRC_CFG_NSTREAMBUFFER) * PropertyTableSizeStreamBuffer)\r
\r
+/* Number of bytes used by the object table */\r
+#define TRACE_OBJECT_TABLE_SIZE (StartIndexMessageBuffer + (TRC_CFG_NMESSAGEBUFFER) * PropertyTableSizeMessageBuffer)\r
\r
/* Flag to tell the context of tracePEND_FUNC_CALL_FROM_ISR */\r
extern int uiInEventGroupSetBitsFromISR;\r
/* Returns the "Not enough handles" error message for the specified object class */\r
const char* pszTraceGetErrorNotEnoughHandles(traceObjectClass objectclass);\r
\r
-traceHandle prvTraceGetObjectNumber(void* handle);\r
-\r
-uint8_t prvTraceGetObjectType(void* handle);\r
-\r
-traceHandle prvTraceGetTaskNumber(void* handle);\r
-\r
void* prvTraceGetCurrentTaskHandle(void);\r
\r
-uint8_t uiTraceIsObjectExcluded(traceObjectClass objectclass, traceHandle handle);\r
-\r
-#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X)\r
-traceHandle prvTraceGetEventGroupNumber(void* handle);\r
-#endif\r
-\r
/******************************************************************************\r
- * TraceObjectClassTable\r
+ * TraceQueueClassTable\r
* Translates a FreeRTOS QueueType into trace objects classes (TRACE_CLASS_).\r
* Has one entry for each QueueType, gives TRACE_CLASS ID.\r
******************************************************************************/ \r
-extern traceObjectClass TraceObjectClassTable[5];\r
+extern traceObjectClass TraceQueueClassTable[5];\r
\r
\r
/*** Event codes for snapshot mode - must match Tracealyzer config files ******/\r
* EVENTGROUP_OBJCLOSE_PROP), containing the handle-name mapping and object\r
* properties valid up to this point.\r
******************************************************************************/\r
-#define EVENTGROUP_OBJCLOSE_NAME (EVENTGROUP_TS + 4UL) /*0x08*/\r
+#define EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS (EVENTGROUP_TS + 4UL) /*0x08*/\r
\r
/*******************************************************************************\r
* EVENTGROUP_OBJCLOSE_PROP\r
* handle. The lower three bits are not used (always zero) when queues are\r
* closed since the queue type is given in the previous OBJCLOSE_NAME event.\r
******************************************************************************/\r
-#define EVENTGROUP_OBJCLOSE_PROP (EVENTGROUP_OBJCLOSE_NAME + 8UL) /*0x10*/\r
+#define EVENTGROUP_OBJCLOSE_PROP_TRCSUCCESS (EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS + 8UL) /*0x10*/\r
\r
/*******************************************************************************\r
* EVENTGROUP_CREATE\r
* The lower three bits in the event code gives the object class, i.e., type of\r
* create operation (task, queue, semaphore, etc).\r
******************************************************************************/\r
-#define EVENTGROUP_CREATE_OBJ_SUCCESS (EVENTGROUP_OBJCLOSE_PROP + 8UL) /*0x18*/\r
+#define EVENTGROUP_CREATE_OBJ_TRCSUCCESS (EVENTGROUP_OBJCLOSE_PROP_TRCSUCCESS + 8UL) /*0x18*/\r
\r
/*******************************************************************************\r
* EVENTGROUP_SEND\r
* object class, i.e., what type of object that is operated on (queue, semaphore\r
* or mutex).\r
******************************************************************************/\r
-#define EVENTGROUP_SEND_SUCCESS (EVENTGROUP_CREATE_OBJ_SUCCESS + 8UL) /*0x20*/\r
+#define EVENTGROUP_SEND_TRCSUCCESS (EVENTGROUP_CREATE_OBJ_TRCSUCCESS + 8UL) /*0x20*/\r
\r
/*******************************************************************************\r
* EVENTGROUP_RECEIVE\r
* object class, i.e., what type of object that is operated on (queue, semaphore\r
* or mutex).\r
******************************************************************************/\r
-#define EVENTGROUP_RECEIVE_SUCCESS (EVENTGROUP_SEND_SUCCESS + 8UL) /*0x28*/\r
+#define EVENTGROUP_RECEIVE_TRCSUCCESS (EVENTGROUP_SEND_TRCSUCCESS + 8UL) /*0x28*/\r
\r
/* Send/Give operations, from ISR */\r
-#define EVENTGROUP_SEND_FROM_ISR_SUCCESS \\r
- (EVENTGROUP_RECEIVE_SUCCESS + 8UL) /*0x30*/\r
+#define EVENTGROUP_SEND_FROM_ISR_TRCSUCCESS \\r
+ (EVENTGROUP_RECEIVE_TRCSUCCESS + 8UL) /*0x30*/\r
\r
/* Receive/Take operations, from ISR */\r
-#define EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS \\r
- (EVENTGROUP_SEND_FROM_ISR_SUCCESS + 8UL) /*0x38*/\r
+#define EVENTGROUP_RECEIVE_FROM_ISR_TRCSUCCESS \\r
+ (EVENTGROUP_SEND_FROM_ISR_TRCSUCCESS + 8UL) /*0x38*/\r
\r
/* "Failed" event type versions of above (timeout, failed allocation, etc) */\r
-#define EVENTGROUP_KSE_FAILED \\r
- (EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS + 8UL) /*0x40*/\r
+#define EVENTGROUP_KSE_TRCFAILED \\r
+ (EVENTGROUP_RECEIVE_FROM_ISR_TRCSUCCESS + 8UL) /*0x40*/\r
\r
/* Failed create calls - memory allocation failed */\r
-#define EVENTGROUP_CREATE_OBJ_FAILED (EVENTGROUP_KSE_FAILED) /*0x40*/\r
+#define EVENTGROUP_CREATE_OBJ_TRCFAILED (EVENTGROUP_KSE_TRCFAILED) /*0x40*/\r
\r
/* Failed send/give - timeout! */\r
-#define EVENTGROUP_SEND_FAILED (EVENTGROUP_CREATE_OBJ_FAILED + 8UL) /*0x48*/\r
+#define EVENTGROUP_SEND_TRCFAILED (EVENTGROUP_CREATE_OBJ_TRCFAILED + 8UL) /*0x48*/\r
\r
/* Failed receive/take - timeout! */\r
-#define EVENTGROUP_RECEIVE_FAILED (EVENTGROUP_SEND_FAILED + 8UL) /*0x50*/\r
+#define EVENTGROUP_RECEIVE_TRCFAILED (EVENTGROUP_SEND_TRCFAILED + 8UL) /*0x50*/\r
\r
/* Failed non-blocking send/give - queue full */\r
-#define EVENTGROUP_SEND_FROM_ISR_FAILED (EVENTGROUP_RECEIVE_FAILED + 8UL) /*0x58*/\r
+#define EVENTGROUP_SEND_FROM_ISR_TRCFAILED (EVENTGROUP_RECEIVE_TRCFAILED + 8UL) /*0x58*/\r
\r
/* Failed non-blocking receive/take - queue empty */\r
-#define EVENTGROUP_RECEIVE_FROM_ISR_FAILED \\r
- (EVENTGROUP_SEND_FROM_ISR_FAILED + 8UL) /*0x60*/\r
+#define EVENTGROUP_RECEIVE_FROM_ISR_TRCFAILED \\r
+ (EVENTGROUP_SEND_FROM_ISR_TRCFAILED + 8UL) /*0x60*/\r
\r
/* Events when blocking on receive/take */\r
-#define EVENTGROUP_RECEIVE_BLOCK \\r
- (EVENTGROUP_RECEIVE_FROM_ISR_FAILED + 8UL) /*0x68*/\r
+#define EVENTGROUP_RECEIVE_TRCBLOCK \\r
+ (EVENTGROUP_RECEIVE_FROM_ISR_TRCFAILED + 8UL) /*0x68*/\r
\r
/* Events when blocking on send/give */\r
-#define EVENTGROUP_SEND_BLOCK (EVENTGROUP_RECEIVE_BLOCK + 8UL) /*0x70*/\r
+#define EVENTGROUP_SEND_TRCBLOCK (EVENTGROUP_RECEIVE_TRCBLOCK + 8UL) /*0x70*/\r
\r
/* Events on queue peek (receive) */\r
-#define EVENTGROUP_PEEK_SUCCESS (EVENTGROUP_SEND_BLOCK + 8UL) /*0x78*/\r
+#define EVENTGROUP_PEEK_TRCSUCCESS (EVENTGROUP_SEND_TRCBLOCK + 8UL) /*0x78*/\r
\r
/* Events on object delete (vTaskDelete or vQueueDelete) */\r
-#define EVENTGROUP_DELETE_OBJ_SUCCESS (EVENTGROUP_PEEK_SUCCESS + 8UL) /*0x80*/\r
+#define EVENTGROUP_DELETE_OBJ_TRCSUCCESS (EVENTGROUP_PEEK_TRCSUCCESS + 8UL) /*0x80*/\r
\r
/* Other events - object class is implied: TASK */\r
-#define EVENTGROUP_OTHERS (EVENTGROUP_DELETE_OBJ_SUCCESS + 8UL) /*0x88*/\r
+#define EVENTGROUP_OTHERS (EVENTGROUP_DELETE_OBJ_TRCSUCCESS + 8UL) /*0x88*/\r
#define TASK_DELAY_UNTIL (EVENTGROUP_OTHERS + 0UL) /*0x88*/\r
#define TASK_DELAY (EVENTGROUP_OTHERS + 1UL) /*0x89*/\r
#define TASK_SUSPEND (EVENTGROUP_OTHERS + 2UL) /*0x8A*/\r
#define EVENTGROUP_MISC_PLACEHOLDER (EVENTGROUP_OTHERS + 8UL) /*0x90*/\r
#define PEND_FUNC_CALL (EVENTGROUP_MISC_PLACEHOLDER+0UL) /*0x90*/\r
#define PEND_FUNC_CALL_FROM_ISR (EVENTGROUP_MISC_PLACEHOLDER+1UL) /*0x91*/\r
-#define PEND_FUNC_CALL_FAILED (EVENTGROUP_MISC_PLACEHOLDER+2UL) /*0x92*/\r
-#define PEND_FUNC_CALL_FROM_ISR_FAILED (EVENTGROUP_MISC_PLACEHOLDER+3UL) /*0x93*/\r
+#define PEND_FUNC_CALL_TRCFAILED (EVENTGROUP_MISC_PLACEHOLDER+2UL) /*0x92*/\r
+#define PEND_FUNC_CALL_FROM_ISR_TRCFAILED (EVENTGROUP_MISC_PLACEHOLDER+3UL) /*0x93*/\r
#define MEM_MALLOC_SIZE (EVENTGROUP_MISC_PLACEHOLDER+4UL) /*0x94*/\r
#define MEM_MALLOC_ADDR (EVENTGROUP_MISC_PLACEHOLDER+5UL) /*0x95*/\r
#define MEM_FREE_SIZE (EVENTGROUP_MISC_PLACEHOLDER+6UL) /*0x96*/\r
#define TIMER_RST (EVENTGROUP_TIMER + 2UL) /*0xB2*/\r
#define TIMER_STOP (EVENTGROUP_TIMER + 3UL) /*0xB3*/\r
#define TIMER_CHANGE_PERIOD (EVENTGROUP_TIMER + 4UL) /*0xB4*/\r
-#define TIMER_DELETE (EVENTGROUP_TIMER + 5UL) /*0xB5*/\r
+#define TIMER_DELETE_OBJ (EVENTGROUP_TIMER + 5UL) /*0xB5*/\r
#define TIMER_START_FROM_ISR (EVENTGROUP_TIMER + 6UL) /*0xB6*/\r
#define TIMER_RESET_FROM_ISR (EVENTGROUP_TIMER + 7UL) /*0xB7*/\r
#define TIMER_STOP_FROM_ISR (EVENTGROUP_TIMER + 8UL) /*0xB8*/\r
\r
-#define TIMER_CREATE_FAILED (EVENTGROUP_TIMER + 9UL) /*0xB9*/\r
-#define TIMER_START_FAILED (EVENTGROUP_TIMER + 10UL) /*0xBA*/\r
-#define TIMER_RESET_FAILED (EVENTGROUP_TIMER + 11UL) /*0xBB*/\r
-#define TIMER_STOP_FAILED (EVENTGROUP_TIMER + 12UL) /*0xBC*/\r
-#define TIMER_CHANGE_PERIOD_FAILED (EVENTGROUP_TIMER + 13UL) /*0xBD*/\r
-#define TIMER_DELETE_FAILED (EVENTGROUP_TIMER + 14UL) /*0xBE*/\r
-#define TIMER_START_FROM_ISR_FAILED (EVENTGROUP_TIMER + 15UL) /*0xBF*/\r
-#define TIMER_RESET_FROM_ISR_FAILED (EVENTGROUP_TIMER + 16UL) /*0xC0*/\r
-#define TIMER_STOP_FROM_ISR_FAILED (EVENTGROUP_TIMER + 17UL) /*0xC1*/\r
+#define TIMER_CREATE_TRCFAILED (EVENTGROUP_TIMER + 9UL) /*0xB9*/\r
+#define TIMER_START_TRCFAILED (EVENTGROUP_TIMER + 10UL) /*0xBA*/\r
+#define TIMER_RESET_TRCFAILED (EVENTGROUP_TIMER + 11UL) /*0xBB*/\r
+#define TIMER_STOP_TRCFAILED (EVENTGROUP_TIMER + 12UL) /*0xBC*/\r
+#define TIMER_CHANGE_PERIOD_TRCFAILED (EVENTGROUP_TIMER + 13UL) /*0xBD*/\r
+#define TIMER_DELETE_TRCFAILED (EVENTGROUP_TIMER + 14UL) /*0xBE*/\r
+#define TIMER_START_FROM_ISR_TRCFAILED (EVENTGROUP_TIMER + 15UL) /*0xBF*/\r
+#define TIMER_RESET_FROM_ISR_TRCFAILED (EVENTGROUP_TIMER + 16UL) /*0xC0*/\r
+#define TIMER_STOP_FROM_ISR_TRCFAILED (EVENTGROUP_TIMER + 17UL) /*0xC1*/\r
\r
#define EVENTGROUP_EG (EVENTGROUP_TIMER + 18UL) /*0xC2*/\r
#define EVENT_GROUP_CREATE (EVENTGROUP_EG + 0UL) /*0xC2*/\r
-#define EVENT_GROUP_CREATE_FAILED (EVENTGROUP_EG + 1UL) /*0xC3*/\r
-#define EVENT_GROUP_SYNC_BLOCK (EVENTGROUP_EG + 2UL) /*0xC4*/\r
+#define EVENT_GROUP_CREATE_TRCFAILED (EVENTGROUP_EG + 1UL) /*0xC3*/\r
+#define EVENT_GROUP_SYNC_TRCBLOCK (EVENTGROUP_EG + 2UL) /*0xC4*/\r
#define EVENT_GROUP_SYNC_END (EVENTGROUP_EG + 3UL) /*0xC5*/\r
-#define EVENT_GROUP_WAIT_BITS_BLOCK (EVENTGROUP_EG + 4UL) /*0xC6*/\r
+#define EVENT_GROUP_WAIT_BITS_TRCBLOCK (EVENTGROUP_EG + 4UL) /*0xC6*/\r
#define EVENT_GROUP_WAIT_BITS_END (EVENTGROUP_EG + 5UL) /*0xC7*/\r
#define EVENT_GROUP_CLEAR_BITS (EVENTGROUP_EG + 6UL) /*0xC8*/\r
#define EVENT_GROUP_CLEAR_BITS_FROM_ISR (EVENTGROUP_EG + 7UL) /*0xC9*/\r
#define EVENT_GROUP_SET_BITS (EVENTGROUP_EG + 8UL) /*0xCA*/\r
-#define EVENT_GROUP_DELETE (EVENTGROUP_EG + 9UL) /*0xCB*/\r
-#define EVENT_GROUP_SYNC_END_FAILED (EVENTGROUP_EG + 10UL) /*0xCC*/\r
-#define EVENT_GROUP_WAIT_BITS_END_FAILED (EVENTGROUP_EG + 11UL) /*0xCD*/\r
+#define EVENT_GROUP_DELETE_OBJ (EVENTGROUP_EG + 9UL) /*0xCB*/\r
+#define EVENT_GROUP_SYNC_END_TRCFAILED (EVENTGROUP_EG + 10UL) /*0xCC*/\r
+#define EVENT_GROUP_WAIT_BITS_END_TRCFAILED (EVENTGROUP_EG + 11UL) /*0xCD*/\r
#define EVENT_GROUP_SET_BITS_FROM_ISR (EVENTGROUP_EG + 12UL) /*0xCE*/\r
-#define EVENT_GROUP_SET_BITS_FROM_ISR_FAILED (EVENTGROUP_EG + 13UL) /*0xCF*/\r
+#define EVENT_GROUP_SET_BITS_FROM_ISR_TRCFAILED (EVENTGROUP_EG + 13UL) /*0xCF*/\r
\r
#define TASK_INSTANCE_FINISHED_NEXT_KSE (EVENTGROUP_EG + 14UL) /*0xD0*/\r
#define TASK_INSTANCE_FINISHED_DIRECT (EVENTGROUP_EG + 15UL) /*0xD1*/\r
#define TRACE_TASK_NOTIFY_GROUP (EVENTGROUP_EG + 16UL) /*0xD2*/\r
#define TRACE_TASK_NOTIFY (TRACE_TASK_NOTIFY_GROUP + 0UL) /*0xD2*/\r
#define TRACE_TASK_NOTIFY_TAKE (TRACE_TASK_NOTIFY_GROUP + 1UL) /*0xD3*/\r
-#define TRACE_TASK_NOTIFY_TAKE_BLOCK (TRACE_TASK_NOTIFY_GROUP + 2UL) /*0xD4*/\r
-#define TRACE_TASK_NOTIFY_TAKE_FAILED (TRACE_TASK_NOTIFY_GROUP + 3UL) /*0xD5*/\r
+#define TRACE_TASK_NOTIFY_TAKE_TRCBLOCK (TRACE_TASK_NOTIFY_GROUP + 2UL) /*0xD4*/\r
+#define TRACE_TASK_NOTIFY_TAKE_TRCFAILED (TRACE_TASK_NOTIFY_GROUP + 3UL) /*0xD5*/\r
#define TRACE_TASK_NOTIFY_WAIT (TRACE_TASK_NOTIFY_GROUP + 4UL) /*0xD6*/\r
-#define TRACE_TASK_NOTIFY_WAIT_BLOCK (TRACE_TASK_NOTIFY_GROUP + 5UL) /*0xD7*/\r
-#define TRACE_TASK_NOTIFY_WAIT_FAILED (TRACE_TASK_NOTIFY_GROUP + 6UL) /*0xD8*/\r
+#define TRACE_TASK_NOTIFY_WAIT_TRCBLOCK (TRACE_TASK_NOTIFY_GROUP + 5UL) /*0xD7*/\r
+#define TRACE_TASK_NOTIFY_WAIT_TRCFAILED (TRACE_TASK_NOTIFY_GROUP + 6UL) /*0xD8*/\r
#define TRACE_TASK_NOTIFY_FROM_ISR (TRACE_TASK_NOTIFY_GROUP + 7UL) /*0xD9*/\r
#define TRACE_TASK_NOTIFY_GIVE_FROM_ISR (TRACE_TASK_NOTIFY_GROUP + 8UL) /*0xDA*/\r
\r
+#define TIMER_EXPIRED (TRACE_TASK_NOTIFY_GROUP + 9UL) /* 0xDB */\r
\r
-#define TRACE_GET_TASK_PRIORITY(pxTCB) ((uint8_t)pxTCB->uxPriority)\r
-#define TRACE_GET_TASK_NAME(pxTCB) ((char*)pxTCB->pcTaskName)\r
-#define TRACE_GET_TASK_NUMBER(pxTCB) (prvTraceGetTaskNumber(pxTCB))\r
-#define TRACE_SET_TASK_NUMBER(pxTCB) pxTCB->uxTaskNumber = prvTraceGetObjectHandle(TRACE_CLASS_TASK);\r
-\r
-#define TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass) TraceObjectClassTable[kernelClass]\r
-#define TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject) TRACE_GET_CLASS_TRACE_CLASS(CLASS, prvTraceGetObjectType(pxObject))\r
-\r
-#define TRACE_GET_TIMER_NUMBER(tmr) (((uint32_t)tmr) != 0 ? ( ( traceHandle ) ((Timer_t*)tmr)->uxTimerNumber ) : 0)\r
-#define TRACE_SET_TIMER_NUMBER(tmr) ((Timer_t*)tmr)->uxTimerNumber = prvTraceGetObjectHandle(TRACE_CLASS_TIMER);\r
-#define TRACE_GET_TIMER_NAME(pxTimer) pxTimer->pcTimerName\r
-#define TRACE_GET_TIMER_PERIOD(pxTimer) pxTimer->xTimerPeriodInTicks\r
+ /* Events on queue peek (receive) */\r
+#define EVENTGROUP_PEEK_TRCBLOCK (TRACE_TASK_NOTIFY_GROUP + 10UL) /*0xDC*/\r
+/* peek block on queue: 0xDC */\r
+/* peek block on semaphore: 0xDD */\r
+/* peek block on mutex: 0xDE */\r
\r
+/* Events on queue peek (receive) */\r
+#define EVENTGROUP_PEEK_TRCFAILED (EVENTGROUP_PEEK_TRCBLOCK + 3UL) /*0xDF*/\r
+/* peek failed on queue: 0xDF */\r
+/* peek failed on semaphore: 0xE0 */\r
+/* peek failed on mutex: 0xE1 */\r
+\r
+#define EVENTGROUP_STREAMBUFFER_DIV (EVENTGROUP_PEEK_TRCFAILED + 3UL) /*0xE2*/\r
+#define TRACE_STREAMBUFFER_RESET (EVENTGROUP_STREAMBUFFER_DIV + 0) /*0xE2*/\r
+#define TRACE_MESSAGEBUFFER_RESET (EVENTGROUP_STREAMBUFFER_DIV + 1UL) /*0xE3*/\r
+#define TRACE_STREAMBUFFER_OBJCLOSE_NAME_TRCSUCCESS (EVENTGROUP_STREAMBUFFER_DIV + 2UL) /*0xE4*/\r
+#define TRACE_MESSAGEBUFFER_OBJCLOSE_NAME_TRCSUCCESS (EVENTGROUP_STREAMBUFFER_DIV + 3UL) /*0xE5*/\r
+#define TRACE_STREAMBUFFER_OBJCLOSE_PROP_TRCSUCCESS (EVENTGROUP_STREAMBUFFER_DIV + 4UL) /*0xE6*/\r
+#define TRACE_MESSAGEBUFFER_OBJCLOSE_PROP_TRCSUCCESS (EVENTGROUP_STREAMBUFFER_DIV + 5UL) /*0xE7*/\r
+\r
+/* The following are using previously "lost" event codes */\r
+#define TRACE_STREAMBUFFER_CREATE_OBJ_TRCSUCCESS (EVENTGROUP_CREATE_OBJ_TRCSUCCESS + 4UL) /*0x1C*/\r
+#define TRACE_STREAMBUFFER_CREATE_OBJ_TRCFAILED (EVENTGROUP_CREATE_OBJ_TRCFAILED + 4UL) /*0x44*/\r
+#define TRACE_STREAMBUFFER_DELETE_OBJ_TRCSUCCESS (EVENTGROUP_DELETE_OBJ_TRCSUCCESS + 4UL) /*0x84*/\r
+#define TRACE_STREAMBUFFER_SEND_TRCSUCCESS (EVENTGROUP_SEND_TRCSUCCESS + 3UL) /*0x23*/\r
+#define TRACE_STREAMBUFFER_SEND_TRCBLOCK (EVENTGROUP_SEND_TRCBLOCK + 3UL) /*0x73*/\r
+#define TRACE_STREAMBUFFER_SEND_TRCFAILED (EVENTGROUP_SEND_TRCFAILED + 3UL) /*0x4B*/\r
+#define TRACE_STREAMBUFFER_RECEIVE_TRCSUCCESS (EVENTGROUP_RECEIVE_TRCSUCCESS + 3UL) /*0x2B*/\r
+#define TRACE_STREAMBUFFER_RECEIVE_TRCBLOCK (EVENTGROUP_RECEIVE_TRCBLOCK + 3UL) /*0x6B*/\r
+#define TRACE_STREAMBUFFER_RECEIVE_TRCFAILED (EVENTGROUP_RECEIVE_TRCFAILED + 3UL) /*0x53*/\r
+#define TRACE_STREAMBUFFER_SEND_FROM_ISR_TRCSUCCESS (EVENTGROUP_SEND_FROM_ISR_TRCSUCCESS + 3UL) /*0x33*/\r
+#define TRACE_STREAMBUFFER_SEND_FROM_ISR_TRCFAILED (EVENTGROUP_SEND_FROM_ISR_TRCFAILED + 3UL) /*0x5B*/\r
+#define TRACE_STREAMBUFFER_RECEIVE_FROM_ISR_TRCSUCCESS (EVENTGROUP_RECEIVE_FROM_ISR_TRCSUCCESS + 3UL) /*0x3B*/\r
+#define TRACE_STREAMBUFFER_RECEIVE_FROM_ISR_TRCFAILED (EVENTGROUP_RECEIVE_FROM_ISR_TRCFAILED + 3UL) /*0x63*/\r
+\r
+/* The following are using previously "lost" event codes. These macros aren't even directly referenced, instead we do (equivalent STREAMBUFFER code) + 1. */\r
+#define TRACE_MESSAGEBUFFER_CREATE_OBJ_TRCSUCCESS (EVENTGROUP_CREATE_OBJ_TRCSUCCESS + 5UL) /*0x1D*/\r
+#define TRACE_MESSAGEBUFFER_CREATE_OBJ_TRCFAILED (EVENTGROUP_CREATE_OBJ_TRCFAILED + 5UL) /*0x45*/\r
+#define TRACE_MESSAGEBUFFER_DELETE_OBJ_TRCSUCCESS (EVENTGROUP_DELETE_OBJ_TRCSUCCESS + 5UL) /*0x85*/\r
+#define TRACE_MESSAGEBUFFER_SEND_TRCSUCCESS (EVENTGROUP_SEND_TRCSUCCESS + 4UL) /*0x24*/\r
+#define TRACE_MESSAGEBUFFER_SEND_TRCBLOCK (EVENTGROUP_SEND_TRCBLOCK + 4UL) /*0x74*/\r
+#define TRACE_MESSAGEBUFFER_SEND_TRCFAILED (EVENTGROUP_SEND_TRCFAILED + 4UL) /*0x4C*/\r
+#define TRACE_MESSAGEBUFFER_RECEIVE_TRCSUCCESS (EVENTGROUP_RECEIVE_TRCSUCCESS + 4UL) /*0x2C*/\r
+#define TRACE_MESSAGEBUFFER_RECEIVE_TRCBLOCK (EVENTGROUP_RECEIVE_TRCBLOCK + 4UL) /*0x6C*/\r
+#define TRACE_MESSAGEBUFFER_RECEIVE_TRCFAILED (EVENTGROUP_RECEIVE_TRCFAILED + 4UL) /*0x54*/\r
+#define TRACE_MESSAGEBUFFER_SEND_FROM_ISR_TRCSUCCESS (EVENTGROUP_SEND_FROM_ISR_TRCSUCCESS + 4UL) /*0x34*/\r
+#define TRACE_MESSAGEBUFFER_SEND_FROM_ISR_TRCFAILED (EVENTGROUP_SEND_FROM_ISR_TRCFAILED + 4UL) /*0x5C*/\r
+#define TRACE_MESSAGEBUFFER_RECEIVE_FROM_ISR_TRCSUCCESS (EVENTGROUP_RECEIVE_FROM_ISR_TRCSUCCESS + 4UL) /*0x3C*/\r
+#define TRACE_MESSAGEBUFFER_RECEIVE_FROM_ISR_TRCFAILED (EVENTGROUP_RECEIVE_FROM_ISR_TRCFAILED + 4UL) /*0x64*/\r
+\r
+/* LAST EVENT (0xE7) */\r
+\r
+/****************************\r
+* MACROS TO GET TRACE CLASS *\r
+****************************/\r
+#define TRACE_GET_TRACE_CLASS_FROM_TASK_CLASS(kernelClass) (TRACE_CLASS_TASK)\r
+#define TRACE_GET_TRACE_CLASS_FROM_TASK_OBJECT(pxObject) (TRACE_CLASS_TASK)\r
+\r
+#define TRACE_GET_TRACE_CLASS_FROM_QUEUE_CLASS(kernelClass) TraceQueueClassTable[kernelClass]\r
+#define TRACE_GET_TRACE_CLASS_FROM_QUEUE_OBJECT(pxObject) TRACE_GET_TRACE_CLASS_FROM_QUEUE_CLASS(prvTraceGetQueueType(pxObject))\r
+\r
+#define TRACE_GET_TRACE_CLASS_FROM_TIMER_CLASS(kernelClass) (TRACE_CLASS_TIMER)\r
+#define TRACE_GET_TRACE_CLASS_FROM_TIMER_OBJECT(pxObject) (TRACE_CLASS_TIMER)\r
+\r
+#define TRACE_GET_TRACE_CLASS_FROM_EVENTGROUP_CLASS(kernelClass) (TRACE_CLASS_EVENTGROUP)\r
+#define TRACE_GET_TRACE_CLASS_FROM_EVENTGROUP_OBJECT(pxObject) (TRACE_CLASS_EVENTGROUP)\r
+\r
+/* TRACE_GET_TRACE_CLASS_FROM_STREAMBUFFER_CLASS can only be accessed with a parameter indicating if it is a MessageBuffer */\r
+#define TRACE_GET_TRACE_CLASS_FROM_STREAMBUFFER_CLASS(xIsMessageBuffer) (xIsMessageBuffer == 1 ? TRACE_CLASS_MESSAGEBUFFER : TRACE_CLASS_STREAMBUFFER)\r
+#define TRACE_GET_TRACE_CLASS_FROM_STREAMBUFFER_OBJECT(pxObject) (prvGetStreamBufferType(pxObject) == 1 ? TRACE_CLASS_MESSAGEBUFFER : TRACE_CLASS_STREAMBUFFER)\r
+\r
+/* Generic versions */\r
+#define TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass) TRACE_GET_TRACE_CLASS_FROM_##CLASS##_CLASS(kernelClass)\r
+#define TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject) TRACE_GET_TRACE_CLASS_FROM_##CLASS##_OBJECT(pxObject)\r
+\r
+/******************************\r
+* MACROS TO GET OBJECT NUMBER *\r
+******************************/\r
+#define TRACE_GET_TASK_NUMBER(pxTCB) (traceHandle)(prvTraceGetTaskNumberLow16(pxTCB))\r
+#define TRACE_SET_TASK_NUMBER(pxTCB) prvTraceSetTaskNumberLow16(pxTCB, prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(TASK, pxTCB)));\r
+\r
+#define TRACE_GET_QUEUE_NUMBER(queue) ( ( traceHandle ) prvTraceGetQueueNumberLow16(queue) )\r
+#define TRACE_SET_QUEUE_NUMBER(queue) prvTraceSetQueueNumberLow16(queue, (uint16_t)prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, queue)));\r
+\r
+#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+#define TRACE_GET_TIMER_NUMBER(tmr) ( ( traceHandle ) prvTraceGetTimerNumberLow16(tmr) )\r
+#define TRACE_SET_TIMER_NUMBER(tmr) prvTraceSetTimerNumberLow16(tmr, (uint16_t)prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(TIMER, tmr)));\r
+#else /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+#define TRACE_GET_TIMER_NUMBER(tmr) ( ( traceHandle ) ((Timer_t*)tmr)->uxTimerNumber )\r
+#define TRACE_SET_TIMER_NUMBER(tmr) ((Timer_t*)tmr)->uxTimerNumber = prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(TIMER, tmr));\r
+#endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+\r
+#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+#define TRACE_GET_EVENTGROUP_NUMBER(eg) ( ( traceHandle ) prvTraceGetEventGroupNumberLow16(eg) )\r
+#define TRACE_SET_EVENTGROUP_NUMBER(eg) prvTraceSetEventGroupNumberLow16(eg, (uint16_t)prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(EVENTGROUP, eg)));\r
+#else /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
#define TRACE_GET_EVENTGROUP_NUMBER(eg) ( ( traceHandle ) uxEventGroupGetNumber(eg) )\r
+#define TRACE_SET_EVENTGROUP_NUMBER(eg) ((EventGroup_t*)eg)->uxEventGroupNumber = prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(EVENTGROUP, eg));\r
+#endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+\r
+\r
+#define TRACE_GET_STREAMBUFFER_NUMBER(sb) ( ( traceHandle ) prvTraceGetStreamBufferNumberLow16(sb) )\r
+#define TRACE_SET_STREAMBUFFER_NUMBER(sb) prvTraceSetStreamBufferNumberLow16(sb, (uint16_t)prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(STREAMBUFFER, sb)));\r
+\r
+/* Generic versions */\r
+#define TRACE_GET_OBJECT_NUMBER(CLASS, pxObject) TRACE_GET_##CLASS##_NUMBER(pxObject)\r
+#define TRACE_SET_OBJECT_NUMBER(CLASS, pxObject) TRACE_SET_##CLASS##_NUMBER(pxObject)\r
+\r
+/******************************\r
+* MACROS TO GET EVENT CODES *\r
+******************************/\r
+#define TRACE_GET_TASK_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_CLASS_TRACE_CLASS(TASK, kernelClass))\r
+#define TRACE_GET_QUEUE_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_CLASS_TRACE_CLASS(QUEUE, kernelClass))\r
+#define TRACE_GET_TIMER_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass) -- THIS IS NOT USED --\r
+#define TRACE_GET_EVENTGROUP_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass) -- THIS IS NOT USED --\r
+#define TRACE_GET_STREAMBUFFER_CLASS_EVENT_CODE(SERVICE, RESULT, isMessageBuffer) (uint8_t)(TRACE_STREAMBUFFER_##SERVICE##_##RESULT + (uint8_t)isMessageBuffer)\r
+\r
+#define TRACE_GET_TASK_OBJECT_EVENT_CODE(SERVICE, RESULT, pxTCB) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_CLASS_TASK)\r
+#define TRACE_GET_QUEUE_OBJECT_EVENT_CODE(SERVICE, RESULT, pxObject) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, pxObject))\r
+#define TRACE_GET_TIMER_OBJECT_EVENT_CODE(SERVICE, RESULT, UNUSED) -- THIS IS NOT USED --\r
+#define TRACE_GET_EVENTGROUP_OBJECT_EVENT_CODE(SERVICE, RESULT, UNUSED) -- THIS IS NOT USED --\r
+#define TRACE_GET_STREAMBUFFER_OBJECT_EVENT_CODE(SERVICE, RESULT, pxObject) (uint8_t)(TRACE_STREAMBUFFER_##SERVICE##_##RESULT + prvGetStreamBufferType(pxObject))\r
+\r
+/* Generic versions */\r
+#define TRACE_GET_CLASS_EVENT_CODE(SERVICE, RESULT, CLASS, kernelClass) TRACE_GET_##CLASS##_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass)\r
+#define TRACE_GET_OBJECT_EVENT_CODE(SERVICE, RESULT, CLASS, pxObject) TRACE_GET_##CLASS##_OBJECT_EVENT_CODE(SERVICE, RESULT, pxObject)\r
+\r
+/******************************\r
+* SPECIAL MACROS FOR TASKS *\r
+******************************/\r
+#define TRACE_GET_TASK_PRIORITY(pxTCB) ((uint8_t)pxTCB->uxPriority)\r
+#define TRACE_GET_TASK_NAME(pxTCB) ((char*)pxTCB->pcTaskName)\r
\r
-#define TRACE_SET_EVENTGROUP_NUMBER(eg) ((EventGroup_t*)eg)->uxEventGroupNumber = prvTraceGetObjectHandle(TRACE_CLASS_EVENTGROUP);\r
-\r
-#define TRACE_GET_OBJECT_NUMBER(CLASS, pxObject) (prvTraceGetObjectNumber(pxObject))\r
-\r
-#if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_8_X)\r
- #define TRACE_SET_OBJECT_NUMBER(CLASS, pxObject) pxObject->ucQueueNumber = prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject));\r
-#else\r
- #define TRACE_SET_OBJECT_NUMBER(CLASS, pxObject) pxObject->uxQueueNumber = prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject));\r
-#endif\r
-\r
-#define TRACE_GET_CLASS_EVENT_CODE(SERVICE, RESULT, CLASS, kernelClass) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass))\r
-#define TRACE_GET_OBJECT_EVENT_CODE(SERVICE, RESULT, CLASS, pxObject) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject))\r
-#define TRACE_GET_TASK_EVENT_CODE(SERVICE, RESULT, CLASS, pxTCB) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_CLASS_TASK)\r
-\r
-/*** The trace macros for snapshot mode **************************************/\r
-\r
-#ifdef configUSE_TICKLESS_IDLE\r
-#if (configUSE_TICKLESS_IDLE != 0)\r
-\r
-#undef traceLOW_POWER_IDLE_BEGIN\r
-#define traceLOW_POWER_IDLE_BEGIN() \\r
- { \\r
- extern uint32_t trace_disable_timestamp; \\r
- prvTraceStoreLowPower(0); \\r
- trace_disable_timestamp = 1; \\r
- }\r
-\r
-#undef traceLOW_POWER_IDLE_END\r
-#define traceLOW_POWER_IDLE_END() \\r
- { \\r
- extern uint32_t trace_disable_timestamp; \\r
- trace_disable_timestamp = 0; \\r
- prvTraceStoreLowPower(1); \\r
- }\r
-\r
-#endif /* configUSE_TICKLESS_IDLE != 0 */\r
-#endif /* configUSE_TICKLESS_IDLE */ \r
+/*** The trace macros for snapshot mode **************************************/ \r
\r
/* A macro that will update the tick count when returning from tickless idle */\r
#undef traceINCREASE_TICK_COUNT\r
/* Called on each OS tick. Will call uiPortGetTimestamp to make sure it is called at least once every OS tick. */\r
#undef traceTASK_INCREMENT_TICK\r
\r
-#if (TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_7_3_OR_7_4)\r
+#if (TRC_CFG_FREERTOS_VERSION <= TRC_FREERTOS_VERSION_7_4)\r
\r
#define traceTASK_INCREMENT_TICK( xTickCount ) \\r
if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxMissedTicks == 0) { trcKERNEL_HOOKS_INCREMENT_TICK(); } \\r
/* Called on each task-switch */\r
#undef traceTASK_SWITCHED_IN\r
#define traceTASK_SWITCHED_IN() \\r
- trcKERNEL_HOOKS_TASK_SWITCH(TRACE_GET_CURRENT_TASK());\r
+ trcKERNEL_HOOKS_TASK_SWITCH(TRACE_GET_CURRENT_TASK());\r
+\r
+/* Called on vTaskCreate */\r
+#undef traceTASK_CREATE\r
+#define traceTASK_CREATE(pxNewTCB) \\r
+ if (pxNewTCB != NULL) \\r
+ { \\r
+ trcKERNEL_HOOKS_TASK_CREATE(TRACE_GET_OBJECT_EVENT_CODE(CREATE_OBJ, TRCSUCCESS, TASK, pxNewTCB), TASK, pxNewTCB); \\r
+ }\r
+\r
+/* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */\r
+#undef traceTASK_CREATE_FAILED\r
+#define traceTASK_CREATE_FAILED() \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(TRACE_GET_CLASS_EVENT_CODE(CREATE_OBJ, TRCFAILED, TASK, NOT_USED), 0);\r
+\r
+/* Called on vTaskDelete */\r
+#undef traceTASK_DELETE\r
+#define traceTASK_DELETE( pxTaskToDelete ) \\r
+ { TRACE_ALLOC_CRITICAL_SECTION(); \\r
+ TRACE_ENTER_CRITICAL_SECTION(); \\r
+ trcKERNEL_HOOKS_TASK_DELETE(TRACE_GET_OBJECT_EVENT_CODE(DELETE_OBJ, TRCSUCCESS, TASK, pxTaskToDelete), TRACE_GET_OBJECT_EVENT_CODE(OBJCLOSE_NAME, TRCSUCCESS, TASK, pxTaskToDelete), TRACE_GET_OBJECT_EVENT_CODE(OBJCLOSE_PROP, TRCSUCCESS, TASK, pxTaskToDelete), pxTaskToDelete); \\r
+ TRACE_EXIT_CRITICAL_SECTION(); }\r
+\r
+#if (TRC_CFG_SCHEDULING_ONLY == 0)\r
+\r
+#if defined(configUSE_TICKLESS_IDLE)\r
+#if (configUSE_TICKLESS_IDLE != 0)\r
+\r
+#undef traceLOW_POWER_IDLE_BEGIN\r
+#define traceLOW_POWER_IDLE_BEGIN() \\r
+ { \\r
+ extern uint32_t trace_disable_timestamp; \\r
+ prvTraceStoreLowPower(0); \\r
+ trace_disable_timestamp = 1; \\r
+ }\r
+\r
+#undef traceLOW_POWER_IDLE_END\r
+#define traceLOW_POWER_IDLE_END() \\r
+ { \\r
+ extern uint32_t trace_disable_timestamp; \\r
+ trace_disable_timestamp = 0; \\r
+ prvTraceStoreLowPower(1); \\r
+ }\r
+\r
+#endif /* (configUSE_TICKLESS_IDLE != 0) */\r
+#endif /* defined(configUSE_TICKLESS_IDLE) */\r
\r
/* Called on vTaskSuspend */\r
#undef traceTASK_SUSPEND\r
\r
/* Called on vTaskDelayUntil - note the use of FreeRTOS variable xTimeToWake */\r
#undef traceTASK_DELAY_UNTIL\r
-#if TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X\r
+#if TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0\r
#define traceTASK_DELAY_UNTIL(xTimeToWake) \\r
trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY_UNTIL, pxCurrentTCB, xTimeToWake); \\r
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();\r
-#else /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
+#else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */\r
#define traceTASK_DELAY_UNTIL() \\r
trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY_UNTIL, pxCurrentTCB, xTimeToWake); \\r
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();\r
-#endif /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
+#endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */\r
\r
-#if (TRC_CFG_INCLUDE_OBJECT_DELETE == 1)\r
-/* Called on vTaskDelete */\r
-#undef traceTASK_DELETE\r
-#define traceTASK_DELETE( pxTaskToDelete ) \\r
- { TRACE_ALLOC_CRITICAL_SECTION(); \\r
- TRACE_ENTER_CRITICAL_SECTION(); \\r
- trcKERNEL_HOOKS_TASK_DELETE(DELETE_OBJ, pxTaskToDelete); \\r
- TRACE_EXIT_CRITICAL_SECTION(); }\r
+/* Called in xQueueCreate, and thereby for all other object based on queues, such as semaphores. */\r
+#undef traceQUEUE_CREATE\r
+#define traceQUEUE_CREATE( pxNewQueue ) \\r
+ trcKERNEL_HOOKS_OBJECT_CREATE(TRACE_GET_OBJECT_EVENT_CODE(CREATE_OBJ, TRCSUCCESS, QUEUE, pxNewQueue), QUEUE, pxNewQueue);\r
+\r
+/* Called in xQueueCreate, if the queue creation fails */\r
+#undef traceQUEUE_CREATE_FAILED\r
+#define traceQUEUE_CREATE_FAILED( queueType ) \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(TRACE_GET_CLASS_EVENT_CODE(CREATE_OBJ, TRCFAILED, QUEUE, queueType), 0);\r
\r
/* Called on vQueueDelete */\r
#undef traceQUEUE_DELETE\r
#define traceQUEUE_DELETE( pxQueue ) \\r
{ TRACE_ALLOC_CRITICAL_SECTION(); \\r
TRACE_ENTER_CRITICAL_SECTION(); \\r
- trcKERNEL_HOOKS_OBJECT_DELETE(DELETE_OBJ, TRC_UNUSED, pxQueue); \\r
+ trcKERNEL_HOOKS_OBJECT_DELETE(TRACE_GET_OBJECT_EVENT_CODE(DELETE_OBJ, TRCSUCCESS, QUEUE, pxQueue), TRACE_GET_OBJECT_EVENT_CODE(OBJCLOSE_NAME, TRCSUCCESS, QUEUE, pxQueue), TRACE_GET_OBJECT_EVENT_CODE(OBJCLOSE_PROP, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); \\r
TRACE_EXIT_CRITICAL_SECTION(); }\r
-#endif\r
-\r
-/* Called on vTaskCreate */\r
-#undef traceTASK_CREATE\r
-#define traceTASK_CREATE(pxNewTCB) \\r
- if (pxNewTCB != NULL) \\r
- { \\r
- trcKERNEL_HOOKS_TASK_CREATE(CREATE_OBJ, TRC_UNUSED, pxNewTCB); \\r
- }\r
-\r
-/* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */\r
-#undef traceTASK_CREATE_FAILED\r
-#define traceTASK_CREATE_FAILED() \\r
- trcKERNEL_HOOKS_TASK_CREATE_FAILED(CREATE_OBJ, TRC_UNUSED);\r
-\r
-/* Called in xQueueCreate, and thereby for all other object based on queues, such as semaphores. */\r
-#undef traceQUEUE_CREATE\r
-#define traceQUEUE_CREATE( pxNewQueue )\\r
- trcKERNEL_HOOKS_OBJECT_CREATE(CREATE_OBJ, TRC_UNUSED, pxNewQueue);\r
-\r
-/* Called in xQueueCreate, if the queue creation fails */\r
-#undef traceQUEUE_CREATE_FAILED\r
-#define traceQUEUE_CREATE_FAILED( queueType ) \\r
- trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(CREATE_OBJ, TRC_UNUSED, queueType);\r
\r
/* This macro is not necessary as of FreeRTOS v9.0.0 */\r
-#if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_X)\r
+#if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0)\r
/* Called in xQueueCreateMutex, and thereby also from xSemaphoreCreateMutex and xSemaphoreCreateRecursiveMutex */\r
#undef traceCREATE_MUTEX\r
#define traceCREATE_MUTEX( pxNewQueue ) \\r
- trcKERNEL_HOOKS_OBJECT_CREATE(CREATE_OBJ, TRC_UNUSED, pxNewQueue);\r
+ trcKERNEL_HOOKS_OBJECT_CREATE(TRACE_GET_OBJECT_EVENT_CODE(CREATE_OBJ, TRCSUCCESS, QUEUE, pxNewQueue), QUEUE, pxNewQueue);\r
\r
/* Called in xQueueCreateMutex when the operation fails (when memory allocation fails) */\r
#undef traceCREATE_MUTEX_FAILED\r
#define traceCREATE_MUTEX_FAILED() \\r
- trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(CREATE_OBJ, TRC_UNUSED, queueQUEUE_TYPE_MUTEX);\r
-#endif /* (TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X) */\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(TRACE_GET_CLASS_EVENT_CODE(CREATE_OBJ, TRCFAILED, QUEUE, queueQUEUE_TYPE_MUTEX), 0);\r
+#endif /* (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) */\r
\r
/* Called when the Mutex can not be given, since not holder */\r
#undef traceGIVE_MUTEX_RECURSIVE_FAILED\r
#define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex ) \\r
- trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, FAILED, TRC_UNUSED, pxMutex);\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCFAILED, QUEUE, pxMutex), QUEUE, pxMutex);\r
\r
/* Called when a message is sent to a queue */ /* CS IS NEW ! */\r
#undef traceQUEUE_SEND\r
#define traceQUEUE_SEND( pxQueue ) \\r
- trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, SUCCESS, TRC_UNUSED, pxQueue); \\r
- trcKERNEL_HOOKS_SET_OBJECT_STATE(TRC_UNUSED, pxQueue, TRACE_GET_OBJECT_TRACE_CLASS(TRC_UNUSED, pxQueue) == TRACE_CLASS_MUTEX ? (uint8_t)0 : (uint8_t)(pxQueue->uxMessagesWaiting + 1));\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); \\r
+ trcKERNEL_HOOKS_SET_OBJECT_STATE(QUEUE, pxQueue, TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, pxQueue) == TRACE_CLASS_MUTEX ? (uint8_t)0 : (uint8_t)(pxQueue->uxMessagesWaiting + 1));\r
\r
/* Called when a message failed to be sent to a queue (timeout) */\r
#undef traceQUEUE_SEND_FAILED\r
#define traceQUEUE_SEND_FAILED( pxQueue ) \\r
- trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, FAILED, TRC_UNUSED, pxQueue);\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCFAILED, QUEUE, pxQueue), QUEUE, pxQueue);\r
\r
/* Called when the task is blocked due to a send operation on a full queue */\r
#undef traceBLOCKING_ON_QUEUE_SEND\r
#define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) \\r
- trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, BLOCK, TRC_UNUSED, pxQueue);\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCBLOCK, QUEUE, pxQueue), QUEUE, pxQueue);\r
\r
/* Called when a message is received from a queue */\r
#undef traceQUEUE_RECEIVE\r
#define traceQUEUE_RECEIVE( pxQueue ) \\r
- trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, SUCCESS, TRC_UNUSED, pxQueue); \\r
- trcKERNEL_HOOKS_SET_OBJECT_STATE(TRC_UNUSED, pxQueue, TRACE_GET_OBJECT_TRACE_CLASS(TRC_UNUSED, pxQueue) == TRACE_CLASS_MUTEX ? (uint8_t)TRACE_GET_TASK_NUMBER(TRACE_GET_CURRENT_TASK()) : (uint8_t)(pxQueue->uxMessagesWaiting - 1));\r
+ if (isQueueReceiveHookActuallyPeek) \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(PEEK, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); \\r
+ } \\r
+ else \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); \\r
+ } \\r
+ trcKERNEL_HOOKS_SET_OBJECT_STATE(QUEUE, pxQueue, TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, pxQueue) == TRACE_CLASS_MUTEX ? (uint8_t)TRACE_GET_TASK_NUMBER(TRACE_GET_CURRENT_TASK()) : (uint8_t)(pxQueue->uxMessagesWaiting - 1));\r
\r
/* Called when a receive operation on a queue fails (timeout) */\r
#undef traceQUEUE_RECEIVE_FAILED\r
#define traceQUEUE_RECEIVE_FAILED( pxQueue ) \\r
- trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, FAILED, TRC_UNUSED, pxQueue);\r
+ if (isQueueReceiveHookActuallyPeek) \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(PEEK, TRCFAILED, QUEUE, pxQueue), QUEUE, pxQueue); \\r
+ } \\r
+ else \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCFAILED, QUEUE, pxQueue), QUEUE, pxQueue); \\r
+ }\r
\r
/* Called when the task is blocked due to a receive operation on an empty queue */\r
#undef traceBLOCKING_ON_QUEUE_RECEIVE\r
#define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) \\r
- trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, BLOCK, TRC_UNUSED, pxQueue); \\r
- if (TRACE_GET_OBJECT_TRACE_CLASS(TRC_UNUSED, pxQueue) != TRACE_CLASS_MUTEX) \\r
- {trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();}\r
+ if (isQueueReceiveHookActuallyPeek) \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(PEEK, TRCBLOCK, QUEUE, pxQueue), QUEUE, pxQueue); \\r
+ } \\r
+ else \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCBLOCK, QUEUE, pxQueue), QUEUE, pxQueue); \\r
+ } \\r
+ if (TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, pxQueue) != TRACE_CLASS_MUTEX) \\r
+ { \\r
+ trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); \\r
+ }\r
\r
/* Called on xQueuePeek */\r
#undef traceQUEUE_PEEK\r
#define traceQUEUE_PEEK( pxQueue ) \\r
- trcKERNEL_HOOKS_KERNEL_SERVICE(PEEK, SUCCESS, TRC_UNUSED, pxQueue);\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(PEEK, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue);\r
+\r
+/* Called on xQueuePeek fail/timeout (added in FreeRTOS v9.0.2) */\r
+#undef traceQUEUE_PEEK_FAILED\r
+#define traceQUEUE_PEEK_FAILED( pxQueue ) \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(PEEK, TRCFAILED, QUEUE, pxQueue), QUEUE, pxQueue);\r
+\r
+/* Called on xQueuePeek blocking (added in FreeRTOS v9.0.2) */\r
+#undef traceBLOCKING_ON_QUEUE_PEEK\r
+#define traceBLOCKING_ON_QUEUE_PEEK( pxQueue ) \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(PEEK, TRCBLOCK, QUEUE, pxQueue), QUEUE, pxQueue); \\r
+ if (TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, pxQueue) != TRACE_CLASS_MUTEX) \\r
+ { \\r
+ trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); \\r
+ }\r
\r
/* Called when a message is sent from interrupt context, e.g., using xQueueSendFromISR */\r
#undef traceQUEUE_SEND_FROM_ISR\r
#define traceQUEUE_SEND_FROM_ISR( pxQueue ) \\r
- trcKERNEL_HOOKS_KERNEL_SERVICE(SEND_FROM_ISR, SUCCESS, TRC_UNUSED, pxQueue); \\r
- trcKERNEL_HOOKS_SET_OBJECT_STATE(TRC_UNUSED, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting + 1));\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(SEND_FROM_ISR, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); \\r
+ trcKERNEL_HOOKS_SET_OBJECT_STATE(QUEUE, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting + 1));\r
\r
/* Called when a message send from interrupt context fails (since the queue was full) */\r
#undef traceQUEUE_SEND_FROM_ISR_FAILED\r
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) \\r
- trcKERNEL_HOOKS_KERNEL_SERVICE(SEND_FROM_ISR, FAILED, TRC_UNUSED, pxQueue);\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(SEND_FROM_ISR, TRCFAILED, QUEUE, pxQueue), QUEUE, pxQueue);\r
\r
/* Called when a message is received in interrupt context, e.g., using xQueueReceiveFromISR */\r
#undef traceQUEUE_RECEIVE_FROM_ISR\r
#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) \\r
- trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE_FROM_ISR, SUCCESS, TRC_UNUSED, pxQueue); \\r
- trcKERNEL_HOOKS_SET_OBJECT_STATE(TRC_UNUSED, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting - 1));\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE_FROM_ISR, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); \\r
+ trcKERNEL_HOOKS_SET_OBJECT_STATE(QUEUE, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting - 1));\r
\r
/* Called when a message receive from interrupt context fails (since the queue was empty) */\r
#undef traceQUEUE_RECEIVE_FROM_ISR_FAILED\r
#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) \\r
- trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE_FROM_ISR, FAILED, TRC_UNUSED, pxQueue);\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE_FROM_ISR, TRCFAILED, QUEUE, pxQueue), QUEUE, pxQueue);\r
+\r
+#undef traceQUEUE_REGISTRY_ADD\r
+#define traceQUEUE_REGISTRY_ADD(object, name) prvTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, object), TRACE_GET_OBJECT_NUMBER(QUEUE, object), name);\r
\r
/* Called in vTaskPrioritySet */\r
#undef traceTASK_PRIORITY_SET\r
/* Called in vTaskResumeFromISR */\r
#undef traceTASK_RESUME_FROM_ISR\r
#define traceTASK_RESUME_FROM_ISR( pxTaskToResume ) \\r
- trcKERNEL_HOOKS_TASK_RESUME(TASK_RESUME_FROM_ISR, pxTaskToResume);\r
+ trcKERNEL_HOOKS_TASK_RESUME_FROM_ISR(TASK_RESUME_FROM_ISR, pxTaskToResume);\r
\r
\r
#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X)\r
\r
-#if (TRC_CFG_SCHEDULING_ONLY == 0) && (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1)\r
+#if (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1)\r
\r
extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t size);\r
\r
+/* MALLOC and FREE are always stored, no matter if they happen inside filtered task */\r
#undef traceMALLOC\r
-#define traceMALLOC( pvAddress, uiSize ) {if (pvAddress != 0) vTraceStoreMemMangEvent(MEM_MALLOC_SIZE, ( uint32_t ) pvAddress, (int32_t)uiSize); }\r
+#define traceMALLOC( pvAddress, uiSize ) \\r
+ if (pvAddress != 0) \\r
+ vTraceStoreMemMangEvent(MEM_MALLOC_SIZE, ( uint32_t ) pvAddress, (int32_t)uiSize);\r
\r
#undef traceFREE\r
-#define traceFREE( pvAddress, uiSize ) {vTraceStoreMemMangEvent(MEM_FREE_SIZE, ( uint32_t ) pvAddress, -((int32_t)uiSize)); }\r
+#define traceFREE( pvAddress, uiSize ) \\r
+ vTraceStoreMemMangEvent(MEM_FREE_SIZE, ( uint32_t ) pvAddress, -((int32_t)uiSize));\r
+\r
+#endif /* (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1) */\r
\r
-#endif /* (TRC_CFG_SCHEDULING_ONLY == 0) && (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1) */\r
+#if (TRC_CFG_INCLUDE_TIMER_EVENTS == 1)\r
\r
/* Called in timer.c - xTimerCreate */\r
#undef traceTIMER_CREATE\r
#define traceTIMER_CREATE(tmr) \\r
- trcKERNEL_HOOKS_TIMER_CREATE(TIMER_CREATE, tmr);\r
+ trcKERNEL_HOOKS_OBJECT_CREATE(TIMER_CREATE, TIMER, tmr);\r
\r
#undef traceTIMER_CREATE_FAILED\r
#define traceTIMER_CREATE_FAILED() \\r
- trcKERNEL_HOOKS_TIMER_EVENT(TIMER_CREATE_FAILED, 0);\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(TIMER_CREATE_TRCFAILED, 0);\r
\r
/* Note that xCommandID can never be tmrCOMMAND_EXECUTE_CALLBACK (-1) since the trace macro is not called in that case */\r
#undef traceTIMER_COMMAND_SEND\r
#define traceTIMER_COMMAND_SEND(tmr, xCommandID, xOptionalValue, xReturn) \\r
-if (xCommandID > tmrCOMMAND_START_DONT_TRACE){\\r
- if (xCommandID == tmrCOMMAND_CHANGE_PERIOD){ prvTraceStoreKernelCallWithParam((xReturn == pdPASS) ? TIMER_CHANGE_PERIOD : TIMER_CHANGE_PERIOD_FAILED, TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(tmr), xOptionalValue);}\\r
- else if ((xCommandID == tmrCOMMAND_DELETE) && (xReturn == pdPASS)){ trcKERNEL_HOOKS_TIMER_DELETE(TIMER_DELETE, tmr); } \\r
- else {trcKERNEL_HOOKS_TIMER_EVENT(EVENTGROUP_TIMER + (uint32_t)xCommandID + ((xReturn == pdPASS)?0:(TIMER_CREATE_FAILED - TIMER_CREATE)), tmr); }\\r
-}\r
+ if (xCommandID > tmrCOMMAND_START_DONT_TRACE) \\r
+ { \\r
+ if (xCommandID == tmrCOMMAND_CHANGE_PERIOD) \\r
+ { \\r
+ if (xReturn == pdPASS) { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TIMER_CHANGE_PERIOD, TIMER, tmr, xOptionalValue); \\r
+ } \\r
+ else \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TIMER_CHANGE_PERIOD_TRCFAILED, TIMER, tmr, xOptionalValue); \\r
+ } \\r
+ } \\r
+ else if ((xCommandID == tmrCOMMAND_DELETE) && (xReturn == pdPASS)) \\r
+ { \\r
+ trcKERNEL_HOOKS_OBJECT_DELETE(TIMER_DELETE_OBJ, EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS + TRACE_GET_OBJECT_TRACE_CLASS(TIMER, tmr), EVENTGROUP_OBJCLOSE_PROP_TRCSUCCESS + TRACE_GET_OBJECT_TRACE_CLASS(TIMER, tmr), TIMER, tmr); \\r
+ } \\r
+ else \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENTGROUP_TIMER + (uint32_t)xCommandID + ((xReturn == pdPASS) ? 0 : (TIMER_CREATE_TRCFAILED - TIMER_CREATE)), TIMER, tmr, xOptionalValue); \\r
+ }\\r
+ }\r
+\r
+#undef traceTIMER_EXPIRED\r
+#define traceTIMER_EXPIRED(tmr) \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TIMER_EXPIRED, TIMER, tmr);\r
+\r
+#endif /* (TRC_CFG_INCLUDE_TIMER_EVENTS == 1) */\r
+\r
+#if (TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS == 1)\r
\r
#undef tracePEND_FUNC_CALL\r
#define tracePEND_FUNC_CALL(func, arg1, arg2, ret) \\r
-if (ret == pdPASS){ \\r
- prvTraceStoreKernelCall(PEND_FUNC_CALL, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) ); \\r
-}else{ \\r
- prvTraceStoreKernelCall(PEND_FUNC_CALL_FAILED, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) );}\r
+ if (ret == pdPASS){ \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(PEND_FUNC_CALL, TASK, xTimerGetTimerDaemonTaskHandle() ); \\r
+ } \\r
+ else \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(PEND_FUNC_CALL_TRCFAILED, TASK, xTimerGetTimerDaemonTaskHandle() ); \\r
+ }\r
\r
#undef tracePEND_FUNC_CALL_FROM_ISR\r
#define tracePEND_FUNC_CALL_FROM_ISR(func, arg1, arg2, ret) \\r
- if (! uiInEventGroupSetBitsFromISR){ prvTraceStoreKernelCall(PEND_FUNC_CALL_FROM_ISR, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) ); } \\r
+ if (! uiInEventGroupSetBitsFromISR) \\r
+ prvTraceStoreKernelCall(PEND_FUNC_CALL_FROM_ISR, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTimerGetTimerDaemonTaskHandle()) ); \\r
uiInEventGroupSetBitsFromISR = 0;\r
\r
+#endif /* (TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS == 1) */\r
+\r
#endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X) */\r
\r
+#if (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1)\r
+\r
#undef traceEVENT_GROUP_CREATE\r
#define traceEVENT_GROUP_CREATE(eg) \\r
- TRACE_SET_EVENTGROUP_NUMBER(eg); \\r
- prvTraceStoreKernelCall(EVENT_GROUP_CREATE, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg));\r
-\r
-#undef traceEVENT_GROUP_DELETE\r
-#define traceEVENT_GROUP_DELETE(eg) \\r
- prvTraceStoreKernelCall(EVENT_GROUP_DELETE, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg)); \\r
- prvTraceStoreObjectNameOnCloseEvent(TRACE_GET_EVENTGROUP_NUMBER(eg), TRACE_CLASS_EVENTGROUP); \\r
- prvTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_EVENTGROUP_NUMBER(eg), TRACE_CLASS_EVENTGROUP); \\r
- prvTraceFreeObjectHandle(TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg));\r
+ trcKERNEL_HOOKS_OBJECT_CREATE(EVENT_GROUP_CREATE, EVENTGROUP, eg);\r
\r
#undef traceEVENT_GROUP_CREATE_FAILED\r
#define traceEVENT_GROUP_CREATE_FAILED() \\r
- prvTraceStoreKernelCall(EVENT_GROUP_CREATE_FAILED, TRACE_CLASS_EVENTGROUP, 0);\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(EVENT_GROUP_CREATE_TRCFAILED, 0);\r
+\r
+#undef traceEVENT_GROUP_DELETE\r
+#define traceEVENT_GROUP_DELETE(eg) \\r
+ { TRACE_ALLOC_CRITICAL_SECTION(); \\r
+ TRACE_ENTER_CRITICAL_SECTION(); \\r
+ trcKERNEL_HOOKS_OBJECT_DELETE(EVENT_GROUP_DELETE_OBJ, EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS + TRACE_GET_OBJECT_TRACE_CLASS(EVENTGROUP, eg), EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS + TRACE_GET_OBJECT_TRACE_CLASS(EVENTGROUP, eg), EVENTGROUP, eg); \\r
+ TRACE_EXIT_CRITICAL_SECTION(); }\r
\r
#undef traceEVENT_GROUP_SYNC_BLOCK\r
#define traceEVENT_GROUP_SYNC_BLOCK(eg, bitsToSet, bitsToWaitFor) \\r
- prvTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_BLOCK, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor);\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_SYNC_TRCBLOCK, EVENTGROUP, eg, bitsToWaitFor);\r
\r
#undef traceEVENT_GROUP_SYNC_END\r
#define traceEVENT_GROUP_SYNC_END(eg, bitsToSet, bitsToWaitFor, wasTimeout) \\r
- if (wasTimeout){ prvTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_END_FAILED, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor);} \\r
- else{ prvTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_END, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); }\r
+ if (wasTimeout) \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_SYNC_END_TRCFAILED, EVENTGROUP, eg, bitsToWaitFor); \\r
+ } \\r
+ else \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_SYNC_END, EVENTGROUP, eg, bitsToWaitFor); \\r
+ }\r
\r
#undef traceEVENT_GROUP_WAIT_BITS_BLOCK\r
#define traceEVENT_GROUP_WAIT_BITS_BLOCK(eg, bitsToWaitFor) \\r
- prvTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_BLOCK, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_WAIT_BITS_TRCBLOCK, EVENTGROUP, eg, bitsToWaitFor); \\r
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();\r
\r
#undef traceEVENT_GROUP_WAIT_BITS_END\r
#define traceEVENT_GROUP_WAIT_BITS_END(eg, bitsToWaitFor, wasTimeout) \\r
- if (wasTimeout){ prvTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_END_FAILED, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); } \\r
- else{ prvTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_END, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); }\r
+ if (wasTimeout) \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_WAIT_BITS_END_TRCFAILED, EVENTGROUP, eg, bitsToWaitFor); \\r
+ } \\r
+ else \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_WAIT_BITS_END, EVENTGROUP, eg, bitsToWaitFor); \\r
+ }\r
\r
#undef traceEVENT_GROUP_CLEAR_BITS\r
#define traceEVENT_GROUP_CLEAR_BITS(eg, bitsToClear) \\r
- if (bitsToClear) prvTraceStoreKernelCallWithParam(EVENT_GROUP_CLEAR_BITS, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToClear);\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_CLEAR_BITS, EVENTGROUP, eg, bitsToClear);\r
\r
#undef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR\r
#define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR(eg, bitsToClear) \\r
- if (bitsToClear) prvTraceStoreKernelCallWithParam(EVENT_GROUP_CLEAR_BITS_FROM_ISR, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToClear);\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM_FROM_ISR(EVENT_GROUP_CLEAR_BITS_FROM_ISR, EVENTGROUP, eg, bitsToClear);\r
\r
#undef traceEVENT_GROUP_SET_BITS\r
#define traceEVENT_GROUP_SET_BITS(eg, bitsToSet) \\r
- prvTraceStoreKernelCallWithParam(EVENT_GROUP_SET_BITS, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToSet);\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_SET_BITS, EVENTGROUP, eg, bitsToSet);\r
\r
#undef traceEVENT_GROUP_SET_BITS_FROM_ISR\r
#define traceEVENT_GROUP_SET_BITS_FROM_ISR(eg, bitsToSet) \\r
- prvTraceStoreKernelCallWithParam(EVENT_GROUP_SET_BITS_FROM_ISR, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToSet); \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM_FROM_ISR(EVENT_GROUP_SET_BITS_FROM_ISR, EVENTGROUP, eg, bitsToSet); \\r
uiInEventGroupSetBitsFromISR = 1;\r
\r
+#endif /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1) */\r
+\r
#undef traceTASK_NOTIFY_TAKE\r
-#if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_X)\r
+#if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0)\r
#define traceTASK_NOTIFY_TAKE() \\r
if (pxCurrentTCB->eNotifyState == eNotified){ \\r
- prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_TAKE, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \\r
- }else{ \\r
- prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_TAKE_FAILED, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait);}\r
-#else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_X */\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_TAKE, TASK, pxCurrentTCB, xTicksToWait); \\r
+ } \\r
+ else{ \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_TAKE_TRCFAILED, TASK, pxCurrentTCB, xTicksToWait); \\r
+ }\r
+#else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0 */\r
#define traceTASK_NOTIFY_TAKE() \\r
if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED){ \\r
- prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_TAKE, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_TAKE, TASK, pxCurrentTCB, xTicksToWait); \\r
}else{ \\r
- prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_TAKE_FAILED, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait);}\r
-#endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_X */\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_TAKE_TRCFAILED, TASK, pxCurrentTCB, xTicksToWait);}\r
+#endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0 */\r
\r
#undef traceTASK_NOTIFY_TAKE_BLOCK\r
#define traceTASK_NOTIFY_TAKE_BLOCK() \\r
- prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_TAKE_BLOCK, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_TAKE_TRCBLOCK, TASK, pxCurrentTCB, xTicksToWait); \\r
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();\r
\r
#undef traceTASK_NOTIFY_WAIT\r
-#if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_X)\r
+#if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0)\r
#define traceTASK_NOTIFY_WAIT() \\r
- if (pxCurrentTCB->eNotifyState == eNotified){ \\r
- prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \\r
- }else{ \\r
- prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_FAILED, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait);}\r
-#else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_X */\r
+ if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \\r
+ { \\r
+ if (pxCurrentTCB->eNotifyState == eNotified) \\r
+ prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \\r
+ else \\r
+ prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_TRCFAILED, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \\r
+ }\r
+#else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0 */\r
#define traceTASK_NOTIFY_WAIT() \\r
- if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED){ \\r
- prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \\r
- }else{ \\r
- prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_FAILED, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); }\r
-#endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_X */\r
+ if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \\r
+ { \\r
+ if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED) \\r
+ prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \\r
+ else \\r
+ prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_TRCFAILED, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \\r
+ }\r
+#endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0 */\r
\r
#undef traceTASK_NOTIFY_WAIT_BLOCK\r
#define traceTASK_NOTIFY_WAIT_BLOCK() \\r
- prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_BLOCK, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \\r
+ if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_TRCBLOCK, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \\r
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();\r
\r
#undef traceTASK_NOTIFY\r
#define traceTASK_NOTIFY() \\r
- prvTraceStoreKernelCall(TRACE_TASK_NOTIFY, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTaskToNotify));\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCall(TRACE_TASK_NOTIFY, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTaskToNotify));\r
\r
#undef traceTASK_NOTIFY_FROM_ISR\r
#define traceTASK_NOTIFY_FROM_ISR() \\r
- prvTraceStoreKernelCall(TRACE_TASK_NOTIFY_FROM_ISR, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTaskToNotify));\r
+ if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCall(TRACE_TASK_NOTIFY_FROM_ISR, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTaskToNotify));\r
\r
#undef traceTASK_NOTIFY_GIVE_FROM_ISR\r
#define traceTASK_NOTIFY_GIVE_FROM_ISR() \\r
- prvTraceStoreKernelCall(TRACE_TASK_NOTIFY_GIVE_FROM_ISR, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTaskToNotify));\r
+ if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCall(TRACE_TASK_NOTIFY_GIVE_FROM_ISR, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTaskToNotify));\r
\r
-#undef traceQUEUE_REGISTRY_ADD\r
-#define traceQUEUE_REGISTRY_ADD(object, name) prvTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(TRC_UNUSED, object), TRACE_GET_OBJECT_NUMBER(TRC_UNUSED, object), name);\r
+#if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1)\r
\r
-/*******************************************************************************\r
- * (macro) vTraceExcludeQueue(object)\r
- *\r
- * Parameter object: pointer to the Queue object that shall be excluded.\r
- *\r
- * Excludes all operations on this object from the trace. Allows for capturing \r
- * longer traces the snapshot RAM buffer by filtering out irrelevant events.\r
- ******************************************************************************/\r
-#define vTraceExcludeQueue(object) \\r
-TRACE_SET_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(TRC_UNUSED, object));\r
+#undef traceSTREAM_BUFFER_CREATE\r
+#define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer ) \\r
+ trcKERNEL_HOOKS_OBJECT_CREATE(TRACE_GET_OBJECT_EVENT_CODE(CREATE_OBJ, TRCSUCCESS, STREAMBUFFER, pxStreamBuffer), STREAMBUFFER, pxStreamBuffer);\r
\r
-/*******************************************************************************\r
- * (macro) vTraceExcludeSemaphore(object)\r
- *\r
- * Parameter object: pointer to the Semaphore object that shall be excluded.\r
- *\r
- * Excludes all operations on this object from the trace. Allows for capturing \r
- * longer traces the snapshot RAM buffer by filtering out irrelevant events.\r
- * \r
- * Note: Only for snapshot mode. \r
- ******************************************************************************/\r
-#define vTraceExcludeSemaphore(object) \\r
-TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(TRC_UNUSED, object));\r
+#undef traceSTREAM_BUFFER_CREATE_FAILED\r
+#define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ) \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(TRACE_GET_CLASS_EVENT_CODE(CREATE_OBJ, TRCFAILED, STREAMBUFFER, xIsMessageBuffer), 0);\r
\r
-/*******************************************************************************\r
- * (macro) vTraceExcludeMutex(object)\r
- *\r
- * Parameter object: pointer to the Mutex object that shall be excluded.\r
- *\r
- * Excludes all operations on this object from the trace. Allows for capturing \r
- * longer traces the snapshot RAM buffer by filtering out irrelevant events.\r
- * \r
- * Note: Only for snapshot mode. \r
- ******************************************************************************/\r
-#define vTraceExcludeMutex(object) \\r
-TRACE_SET_MUTEX_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(TRC_UNUSED, object));\r
+#if 0 /*_RB_ Not defined anywhere*/\r
+#undef traceSTREAM_BUFFER_CREATE_STATIC_FAILED\r
+#define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer ) \\r
+ traceSTREAM_BUFFER_CREATE_TRCFAILED( xIsMessageBuffer )\r
+#endif\r
\r
-/*******************************************************************************\r
- * (macro) vTraceExcludeTimer(object)\r
- *\r
- * Parameter object: pointer to the Timer object that shall be excluded.\r
- *\r
- * Excludes all operations on this object from the trace. Allows for capturing \r
- * longer traces the snapshot RAM buffer by filtering out irrelevant events.\r
- * \r
- * Note: Only for snapshot mode. \r
- ******************************************************************************/\r
-#define vTraceExcludeTimer(object) \\r
-TRACE_SET_TIMER_FLAG_ISEXCLUDED(TRACE_GET_TIMER_NUMBER(object));\r
+#undef traceSTREAM_BUFFER_DELETE\r
+#define traceSTREAM_BUFFER_DELETE( xStreamBuffer ) \\r
+ trcKERNEL_HOOKS_OBJECT_DELETE(TRACE_GET_OBJECT_EVENT_CODE(DELETE_OBJ, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), TRACE_GET_OBJECT_EVENT_CODE(OBJCLOSE_NAME, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), TRACE_GET_OBJECT_EVENT_CODE(OBJCLOSE_PROP, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer);\r
\r
-/*******************************************************************************\r
- * (macro) vTraceExcludeEventGroup(object)\r
- *\r
- * Parameter object: pointer to the Event Group object that shall be excluded.\r
- *\r
- * Excludes all operations on this object from the trace. Allows for capturing \r
- * longer traces the snapshot RAM buffer by filtering out irrelevant events.\r
- * \r
- * Note: Only for snapshot mode. \r
- ******************************************************************************/\r
-#define vTraceExcludeEventGroup(object) \\r
-TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(TRACE_GET_EVENTGROUP_NUMBER(object));\r
+#undef traceSTREAM_BUFFER_RESET\r
+#define traceSTREAM_BUFFER_RESET( xStreamBuffer ) \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(prvGetStreamBufferType(xStreamBuffer) > 0 ? TRACE_MESSAGEBUFFER_RESET : TRACE_STREAMBUFFER_RESET, STREAMBUFFER, xStreamBuffer); \\r
+ trcKERNEL_HOOKS_SET_OBJECT_STATE(STREAMBUFFER, xStreamBuffer, 0);\r
\r
-/*******************************************************************************\r
- * (macro) vTraceExcludeTask(object)\r
- *\r
- * Parameter object: pointer to the Task object that shall be excluded.\r
- *\r
- * Excludes all events from the specified task. Allows for capturing \r
- * longer traces the snapshot RAM buffer by filtering out irrelevant events.\r
- * \r
- * Excluding tasks is problematic as the previous task will appear to continue\r
- * executing while the excluded task is in fact executing. This therefore affects\r
- * the timing statistics in an unpredictable way. \r
- * Moreover, any operations on queues, semaphores, etc. made by an excluded task\r
- * will also be excludes, so Tracealyzer will give an incorrect display regarding\r
- * the states of these objects (number of messages in a queue, etc.).\r
- *\r
- * This should only be used on short tasks that don't affect other kernel objects\r
- * of interest. \r
- * \r
- * Note: Only for snapshot mode. \r
- ******************************************************************************/\r
-#define vTraceExcludeTask(object) \\r
-TRACE_SET_TASK_FLAG_ISEXCLUDED(TRACE_GET_TASK_NUMBER(object));\r
+#undef traceSTREAM_BUFFER_SEND\r
+#define traceSTREAM_BUFFER_SEND( xStreamBuffer, xReturn ) \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); \\r
+ trcKERNEL_HOOKS_SET_OBJECT_STATE(STREAMBUFFER, xStreamBuffer, prvBytesInBuffer(xStreamBuffer));\r
+ \r
+#undef traceBLOCKING_ON_STREAM_BUFFER_SEND\r
+#define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer ) \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCBLOCK, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer);\r
\r
-/******************************************************************************\r
- * (macro) vTraceExcludeDelays()\r
- *\r
- * Excludes all Delay operations from the trace. Allows for capturing \r
- * longer traces the snapshot RAM buffer.\r
- * \r
- * Note: Only for snapshot mode. \r
- *****************************************************************************/\r
-#define vTraceExcludeDelays() \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY); \\r
-TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY_UNTIL);\r
-\r
-/*** Private helper macros for exclude functionality ************************/\r
-\r
-#define TRACE_SET_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_SET_FLAG_ISEXCLUDED(trcExcludedObjects, queueIndex)\r
-#define TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(trcExcludedObjects, queueIndex)\r
-#define TRACE_GET_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_GET_FLAG_ISEXCLUDED(trcExcludedObjects, queueIndex)\r
-\r
-#define TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_SET_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+semaphoreIndex)\r
-#define TRACE_CLEAR_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+semaphoreIndex)\r
-#define TRACE_GET_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_GET_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+semaphoreIndex)\r
-\r
-#define TRACE_SET_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_SET_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+TRC_CFG_NSEMAPHORE+1+mutexIndex)\r
-#define TRACE_CLEAR_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+TRC_CFG_NSEMAPHORE+1+mutexIndex)\r
-#define TRACE_GET_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_GET_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+TRC_CFG_NSEMAPHORE+1+mutexIndex)\r
-\r
-#define TRACE_SET_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_SET_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+TRC_CFG_NSEMAPHORE+1+TRC_CFG_NMUTEX+1+taskIndex)\r
-#define TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+TRC_CFG_NSEMAPHORE+1+TRC_CFG_NMUTEX+1+taskIndex)\r
-#define TRACE_GET_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_GET_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+TRC_CFG_NSEMAPHORE+1+TRC_CFG_NMUTEX+1+taskIndex)\r
-\r
-#define TRACE_SET_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_SET_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+TRC_CFG_NSEMAPHORE+1+TRC_CFG_NMUTEX+1+TRC_CFG_NTASK+1+timerIndex)\r
-#define TRACE_CLEAR_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+TRC_CFG_NSEMAPHORE+1+TRC_CFG_NMUTEX+1+TRC_CFG_NTASK+1+timerIndex)\r
-#define TRACE_GET_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_GET_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+TRC_CFG_NSEMAPHORE+1+TRC_CFG_NMUTEX+1+TRC_CFG_NTASK+1+timerIndex)\r
-\r
-#define TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_SET_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+TRC_CFG_NSEMAPHORE+1+TRC_CFG_NMUTEX+1+TRC_CFG_NTASK+1+TRC_CFG_NTIMER+1+egIndex)\r
-#define TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+TRC_CFG_NSEMAPHORE+1+TRC_CFG_NMUTEX+1+TRC_CFG_NTASK+1+TRC_CFG_NTIMER+1+egIndex)\r
-#define TRACE_GET_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_GET_FLAG_ISEXCLUDED(trcExcludedObjects, TRC_CFG_NQUEUE+1+TRC_CFG_NSEMAPHORE+1+TRC_CFG_NMUTEX+1+TRC_CFG_NTASK+1+TRC_CFG_NTIMER+1+egIndex)\r
-\r
-\r
-#define TRACE_CLEAR_OBJECT_FLAG_ISEXCLUDED(objectclass, handle) \\r
-switch (objectclass) \\r
-{ \\r
-case TRACE_CLASS_QUEUE: \\r
- TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(handle); \\r
- break; \\r
-case TRACE_CLASS_SEMAPHORE: \\r
- TRACE_CLEAR_SEMAPHORE_FLAG_ISEXCLUDED(handle); \\r
- break; \\r
-case TRACE_CLASS_MUTEX: \\r
- TRACE_CLEAR_MUTEX_FLAG_ISEXCLUDED(handle); \\r
- break; \\r
-case TRACE_CLASS_TASK: \\r
- TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(handle); \\r
- break; \\r
-case TRACE_CLASS_TIMER: \\r
- TRACE_CLEAR_TIMER_FLAG_ISEXCLUDED(handle); \\r
- break; \\r
-case TRACE_CLASS_EVENTGROUP: \\r
- TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(handle); \\r
- break; \\r
-}\r
+#undef traceSTREAM_BUFFER_SEND_FAILED\r
+#define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer ) \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCFAILED, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer);\r
\r
-#define TRACE_SET_OBJECT_FLAG_ISEXCLUDED(objectclass, handle) \\r
-switch (objectclass) \\r
-{ \\r
-case TRACE_CLASS_QUEUE: \\r
- TRACE_SET_QUEUE_FLAG_ISEXCLUDED(handle); \\r
- break; \\r
-case TRACE_CLASS_SEMAPHORE: \\r
- TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(handle); \\r
- break; \\r
-case TRACE_CLASS_MUTEX: \\r
- TRACE_SET_MUTEX_FLAG_ISEXCLUDED(handle); \\r
- break; \\r
-case TRACE_CLASS_TASK: \\r
- TRACE_SET_TASK_FLAG_ISEXCLUDED(handle); \\r
- break; \\r
-case TRACE_CLASS_TIMER: \\r
- TRACE_SET_TIMER_FLAG_ISEXCLUDED(handle); \\r
- break; \\r
-case TRACE_CLASS_EVENTGROUP: \\r
- TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(handle); \\r
- break; \\r
-}\r
+#undef traceSTREAM_BUFFER_RECEIVE\r
+#define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength ) \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); \\r
+ trcKERNEL_HOOKS_SET_OBJECT_STATE(STREAMBUFFER, xStreamBuffer, prvBytesInBuffer(xStreamBuffer));\r
+\r
+\r
+#undef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE\r
+#define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer ) \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCBLOCK, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer);\r
+\r
+#undef traceSTREAM_BUFFER_RECEIVE_FAILED\r
+#define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer ) \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCFAILED, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer);\r
+\r
+#undef traceSTREAM_BUFFER_SEND_FROM_ISR\r
+#define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xReturn ) \\r
+ if( xReturn > ( size_t ) 0 ) \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(SEND_FROM_ISR, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); \\r
+ trcKERNEL_HOOKS_SET_OBJECT_STATE(STREAMBUFFER, xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); \\r
+ } \\r
+ else \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(SEND_FROM_ISR, TRCFAILED, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); \\r
+ }\r
+\r
+#undef traceSTREAM_BUFFER_RECEIVE_FROM_ISR\r
+#define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength ) \\r
+ if( xReceivedLength > ( size_t ) 0 ) \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE_FROM_ISR, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); \\r
+ trcKERNEL_HOOKS_SET_OBJECT_STATE(STREAMBUFFER, xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); \\r
+ } \\r
+ else \\r
+ { \\r
+ trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE_FROM_ISR, TRCFAILED, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); \\r
+ }\r
+\r
+#endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) */\r
+\r
+#endif /* (TRC_CFG_SCHEDULING_ONLY == 0) */\r
\r
#endif /*#if TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT */\r
\r
******************************************************************************/ \r
void vTraceStoreKernelObjectName(void* object, const char* name); \r
\r
-/*******************************************************************************\r
- * prvTraceOnBegin\r
- *\r
- * Called on trace begin.\r
- ******************************************************************************/\r
-void prvTraceOnBegin(void);\r
-\r
-/*******************************************************************************\r
- * prvTraceOnEnd\r
- *\r
- * Called on trace end.\r
- ******************************************************************************/\r
-void prvTraceOnEnd(void);\r
-\r
/*******************************************************************************\r
* prvIsNewTCB\r
*\r
#define PSF_EVENT_EVENTGROUP_CREATE 0x15\r
#define PSF_EVENT_SEMAPHORE_COUNTING_CREATE 0x16\r
#define PSF_EVENT_MUTEX_RECURSIVE_CREATE 0x17\r
+#define PSF_EVENT_STREAMBUFFER_CREATE 0x18\r
+#define PSF_EVENT_MESSAGEBUFFER_CREATE 0x19\r
\r
#define PSF_EVENT_TASK_DELETE 0x20\r
#define PSF_EVENT_QUEUE_DELETE 0x21\r
#define PSF_EVENT_MUTEX_DELETE 0x23\r
#define PSF_EVENT_TIMER_DELETE 0x24\r
#define PSF_EVENT_EVENTGROUP_DELETE 0x25\r
+#define PSF_EVENT_STREAMBUFFER_DELETE 0x28\r
+#define PSF_EVENT_MESSAGEBUFFER_DELETE 0x29\r
\r
#define PSF_EVENT_TASK_READY 0x30\r
#define PSF_EVENT_NEW_TIME 0x31\r
#define PSF_EVENT_EVENTGROUP_CREATE_FAILED 0x45\r
#define PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED 0x46\r
#define PSF_EVENT_MUTEX_RECURSIVE_CREATE_FAILED 0x47\r
+#define PSF_EVENT_STREAMBUFFER_CREATE_FAILED 0x49\r
+#define PSF_EVENT_MESSAGEBUFFER_CREATE_FAILED 0x4A\r
\r
#define PSF_EVENT_TIMER_DELETE_FAILED 0x48\r
\r
#define PSF_EVENT_SEMAPHORE_TAKE_FROMISR_FAILED 0x6D\r
\r
#define PSF_EVENT_QUEUE_PEEK 0x70\r
-#define PSF_EVENT_SEMAPHORE_PEEK 0x71 /* Will never be used */\r
-#define PSF_EVENT_MUTEX_PEEK 0x72 /* Will never be used */\r
+#define PSF_EVENT_SEMAPHORE_PEEK 0x71\r
+#define PSF_EVENT_MUTEX_PEEK 0x72\r
\r
#define PSF_EVENT_QUEUE_PEEK_FAILED 0x73\r
-#define PSF_EVENT_SEMAPHORE_PEEK_FAILED 0x74 /* Will never be used */\r
-#define PSF_EVENT_MUTEX_PEEK_FAILED 0x75 /* Will never be used */\r
+#define PSF_EVENT_SEMAPHORE_PEEK_FAILED 0x74 \r
+#define PSF_EVENT_MUTEX_PEEK_FAILED 0x75\r
\r
#define PSF_EVENT_QUEUE_PEEK_BLOCK 0x76\r
-#define PSF_EVENT_SEMAPHORE_PEEK_BLOCK 0x77 /* Will never be used */\r
-#define PSF_EVENT_MUTEX_PEEK_BLOCK 0x78 /* Will never be used */\r
+#define PSF_EVENT_SEMAPHORE_PEEK_BLOCK 0x77\r
+#define PSF_EVENT_MUTEX_PEEK_BLOCK 0x78\r
\r
#define PSF_EVENT_TASK_DELAY_UNTIL 0x79\r
#define PSF_EVENT_TASK_DELAY 0x7A\r
#define PSF_EVENT_TASK_NOTIFY_FROM_ISR 0xD0\r
#define PSF_EVENT_TASK_NOTIFY_GIVE_FROM_ISR 0xD1\r
\r
-/*** The trace macros for streaming ******************************************/\r
-\r
-#if (defined(configUSE_TICKLESS_IDLE) && configUSE_TICKLESS_IDLE != 0)\r
-\r
-#undef traceLOW_POWER_IDLE_BEGIN\r
-#define traceLOW_POWER_IDLE_BEGIN() \\r
- { \\r
- prvTraceStoreEvent1(PSF_EVENT_LOWPOWER_BEGIN, xExpectedIdleTime); \\r
- }\r
-\r
-#undef traceLOW_POWER_IDLE_END\r
-#define traceLOW_POWER_IDLE_END() \\r
- { \\r
- prvTraceStoreEvent0(PSF_EVENT_LOWPOWER_END); \\r
- }\r
+#define PSF_EVENT_TIMER_EXPIRED 0xD2\r
+\r
+#define PSF_EVENT_STREAMBUFFER_SEND 0xD3\r
+#define PSF_EVENT_STREAMBUFFER_SEND_BLOCK 0xD4\r
+#define PSF_EVENT_STREAMBUFFER_SEND_FAILED 0xD5\r
+#define PSF_EVENT_STREAMBUFFER_RECEIVE 0xD6\r
+#define PSF_EVENT_STREAMBUFFER_RECEIVE_BLOCK 0xD7\r
+#define PSF_EVENT_STREAMBUFFER_RECEIVE_FAILED 0xD8\r
+#define PSF_EVENT_STREAMBUFFER_SEND_FROM_ISR 0xD9\r
+#define PSF_EVENT_STREAMBUFFER_SEND_FROM_ISR_FAILED 0xDA\r
+#define PSF_EVENT_STREAMBUFFER_RECEIVE_FROM_ISR 0xDB\r
+#define PSF_EVENT_STREAMBUFFER_RECEIVE_FROM_ISR_FAILED 0xDC\r
+#define PSF_EVENT_STREAMBUFFER_RESET 0xDD\r
+\r
+#define PSF_EVENT_MESSAGEBUFFER_SEND 0xDE\r
+#define PSF_EVENT_MESSAGEBUFFER_SEND_BLOCK 0xDF\r
+#define PSF_EVENT_MESSAGEBUFFER_SEND_FAILED 0xE0\r
+#define PSF_EVENT_MESSAGEBUFFER_RECEIVE 0xE1\r
+#define PSF_EVENT_MESSAGEBUFFER_RECEIVE_BLOCK 0xE2\r
+#define PSF_EVENT_MESSAGEBUFFER_RECEIVE_FAILED 0xE3\r
+#define PSF_EVENT_MESSAGEBUFFER_SEND_FROM_ISR 0xE4\r
+#define PSF_EVENT_MESSAGEBUFFER_SEND_FROM_ISR_FAILED 0xE5\r
+#define PSF_EVENT_MESSAGEBUFFER_RECEIVE_FROM_ISR 0xE6\r
+#define PSF_EVENT_MESSAGEBUFFER_RECEIVE_FROM_ISR_FAILED 0xE7\r
+#define PSF_EVENT_MESSAGEBUFFER_RESET 0xE8\r
\r
-#endif\r
+/*** The trace macros for streaming ******************************************/\r
\r
/* A macro that will update the tick count when returning from tickless idle */\r
#undef traceINCREASE_TICK_COUNT\r
/* Note: This can handle time adjustments of max 2^32 ticks, i.e., 35 seconds at 120 MHz. Thus, tick-less idle periods longer than 2^32 ticks will appear "compressed" on the time line.*/\r
#define traceINCREASE_TICK_COUNT( xCount ) { extern uint32_t uiTraceTickCount; uiTraceTickCount += xCount; }\r
\r
-/* Called for each task that becomes ready */\r
-#undef traceMOVED_TASK_TO_READY_STATE\r
-#define traceMOVED_TASK_TO_READY_STATE( pxTCB ) \\r
- prvTraceStoreEvent1(PSF_EVENT_TASK_READY, (uint32_t)pxTCB);\r
+#if (TRC_CFG_INCLUDE_OSTICK_EVENTS == 1)\r
+#define OS_TICK_EVENT(uxSchedulerSuspended, xTickCount) if (uxSchedulerSuspended == (unsigned portBASE_TYPE) pdFALSE) { prvTraceStoreEvent1(PSF_EVENT_NEW_TIME, (uint32_t)(xTickCount + 1)); }\r
+#else\r
+#define OS_TICK_EVENT(uxSchedulerSuspended, xTickCount) \r
+#endif\r
\r
/* Called on each OS tick. Will call uiPortGetTimestamp to make sure it is called at least once every OS tick. */\r
#undef traceTASK_INCREMENT_TICK\r
-#if TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_7_3_OR_7_4\r
+#if TRC_CFG_FREERTOS_VERSION <= TRC_FREERTOS_VERSION_7_4\r
#define traceTASK_INCREMENT_TICK( xTickCount ) \\r
if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxMissedTicks == 0) { extern uint32_t uiTraceTickCount; uiTraceTickCount++; } \\r
- if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE) { prvTraceStoreEvent1(PSF_EVENT_NEW_TIME, (uint32_t)(xTickCount + 1)); }\r
-#else /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_7_3_OR_7_4 */\r
+ OS_TICK_EVENT(uxSchedulerSuspended, xTickCount)\r
+#else\r
#define traceTASK_INCREMENT_TICK( xTickCount ) \\r
if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxPendedTicks == 0) { extern uint32_t uiTraceTickCount; uiTraceTickCount++; } \\r
- if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE) { prvTraceStoreEvent1(PSF_EVENT_NEW_TIME, (uint32_t)(xTickCount + 1)); }\r
-#endif /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_7_3_OR_7_4 */\r
+ OS_TICK_EVENT(uxSchedulerSuspended, xTickCount)\r
+#endif /* TRC_CFG_FREERTOS_VERSION <= TRC_FREERTOS_VERSION_7_4 */\r
\r
/* Called on each task-switch */\r
#undef traceTASK_SWITCHED_IN\r
#define traceTASK_SWITCHED_IN() \\r
- if (prvIsNewTCB(pxCurrentTCB)) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
{ \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_ACTIVATE, (uint32_t)pxCurrentTCB, pxCurrentTCB->uxPriority); \\r
+ if (prvIsNewTCB(pxCurrentTCB)) \\r
+ { \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_ACTIVATE, (uint32_t)pxCurrentTCB, pxCurrentTCB->uxPriority); \\r
+ } \\r
}\r
\r
-/* Called on vTaskSuspend */\r
-#undef traceTASK_SUSPEND\r
-#define traceTASK_SUSPEND( pxTaskToSuspend ) \\r
- prvTraceStoreEvent1(PSF_EVENT_TASK_SUSPEND, (uint32_t)pxTaskToSuspend);\r
-\r
-/* Called on vTaskDelay - note the use of FreeRTOS variable xTicksToDelay */\r
-#undef traceTASK_DELAY\r
-#define traceTASK_DELAY() \\r
- prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY, xTicksToDelay);\r
-\r
-/* Called on vTaskDelayUntil - note the use of FreeRTOS variable xTimeToWake */\r
-#undef traceTASK_DELAY_UNTIL\r
-#if TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X\r
-#define traceTASK_DELAY_UNTIL(xTimeToWake) \\r
- prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY_UNTIL, (uint32_t)xTimeToWake);\r
-#else /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
-#define traceTASK_DELAY_UNTIL() \\r
- prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY_UNTIL, (uint32_t)xTimeToWake);\r
-#endif /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
-\r
-/* Called on vTaskDelete */\r
-#undef traceTASK_DELETE\r
-#define traceTASK_DELETE( pxTaskToDelete ) \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_DELETE, (uint32_t)pxTaskToDelete, (pxTaskToDelete != NULL) ? (pxTaskToDelete->uxPriority) : 0); \\r
- prvTraceDeleteSymbol(pxTaskToDelete); \\r
- prvTraceDeleteObjectData(pxTaskToDelete);\r
-\r
-/* Called on vQueueDelete */\r
-#undef traceQUEUE_DELETE\r
-#define traceQUEUE_DELETE( pxQueue ) \\r
- switch (pxQueue->ucQueueType) \\r
- { \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent2(PSF_EVENT_QUEUE_DELETE, (uint32_t)pxQueue, (pxQueue != NULL) ? (pxQueue->uxMessagesWaiting) : 0); \\r
- break; \\r
- case queueQUEUE_TYPE_MUTEX: \\r
- case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
- prvTraceStoreEvent2(PSF_EVENT_MUTEX_DELETE, (uint32_t)pxQueue, (pxQueue != NULL) ? (pxQueue->uxMessagesWaiting) : 0); \\r
- break; \\r
- case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_DELETE, (uint32_t)pxQueue, (pxQueue != NULL) ? (pxQueue->uxMessagesWaiting) : 0); \\r
- break; \\r
- } \\r
- prvTraceDeleteSymbol(pxQueue);\r
+/* Called for each task that becomes ready */\r
+#if (TRC_CFG_INCLUDE_READY_EVENTS == 1)\r
+#undef traceMOVED_TASK_TO_READY_STATE\r
+#define traceMOVED_TASK_TO_READY_STATE( pxTCB ) \\r
+ if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(PSF_EVENT_TASK_READY, (uint32_t)pxTCB);\r
+#endif\r
\r
-/* Called on vTaskCreate */\r
#undef traceTASK_CREATE\r
-#if TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X\r
+#if TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0\r
#define traceTASK_CREATE(pxNewTCB) \\r
if (pxNewTCB != NULL) \\r
{ \\r
prvTraceSaveSymbol(pxNewTCB, pxNewTCB->pcTaskName); \\r
prvTraceSaveObjectData(pxNewTCB, pxNewTCB->uxPriority); \\r
prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, pxNewTCB->pcTaskName, pxNewTCB); \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_CREATE, (uint32_t)pxNewTCB, pxNewTCB->uxPriority); \\r
+ TRACE_SET_TASK_FILTER(pxNewTCB, CurrentFilterGroup); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(pxNewTCB) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_CREATE, (uint32_t)pxNewTCB, pxNewTCB->uxPriority); \\r
}\r
-#else /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
+#else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */\r
#define traceTASK_CREATE(pxNewTCB) \\r
if (pxNewTCB != NULL) \\r
{ \\r
prvTraceSaveSymbol(pxNewTCB, (const char*)pcName); \\r
prvTraceSaveObjectData(pxNewTCB, uxPriority); \\r
- prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, pcName, pxNewTCB); \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_CREATE, (uint32_t)pxNewTCB, uxPriority); \\r
+ prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, (const char*)pcName, pxNewTCB); \\r
+ TRACE_SET_TASK_FILTER(pxNewTCB, CurrentFilterGroup); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(pxNewTCB) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_CREATE, (uint32_t)pxNewTCB, uxPriority); \\r
}\r
-#endif /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
+#endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */\r
\r
/* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */\r
#undef traceTASK_CREATE_FAILED\r
#define traceTASK_CREATE_FAILED() \\r
- prvTraceStoreEvent0(PSF_EVENT_TASK_CREATE_FAILED);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent0(PSF_EVENT_TASK_CREATE_FAILED);\r
+\r
+/* Called on vTaskDelete */\r
+#undef traceTASK_DELETE // We don't allow for filtering out "delete" events. They are important and not very frequent. Moreover, we can't exclude create events, so this should be symmetrical.\r
+#define traceTASK_DELETE( pxTaskToDelete ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(pxTaskToDelete) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_DELETE, (uint32_t)pxTaskToDelete, (pxTaskToDelete != NULL) ? (pxTaskToDelete->uxPriority) : 0); \\r
+ prvTraceDeleteSymbol(pxTaskToDelete); \\r
+ prvTraceDeleteObjectData(pxTaskToDelete);\r
+\r
+#if (TRC_CFG_SCHEDULING_ONLY == 0)\r
+\r
+#if (defined(configUSE_TICKLESS_IDLE) && configUSE_TICKLESS_IDLE != 0)\r
+\r
+#undef traceLOW_POWER_IDLE_BEGIN\r
+#define traceLOW_POWER_IDLE_BEGIN() \\r
+ { \\r
+ prvTraceStoreEvent1(PSF_EVENT_LOWPOWER_BEGIN, xExpectedIdleTime); \\r
+ }\r
+\r
+#undef traceLOW_POWER_IDLE_END\r
+#define traceLOW_POWER_IDLE_END() \\r
+ { \\r
+ prvTraceStoreEvent0(PSF_EVENT_LOWPOWER_END); \\r
+ }\r
+\r
+#endif /* (defined(configUSE_TICKLESS_IDLE) && configUSE_TICKLESS_IDLE != 0) */\r
+\r
+/* Called on vTaskSuspend */\r
+#undef traceTASK_SUSPEND\r
+#define traceTASK_SUSPEND( pxTaskToSuspend ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(pxTaskToSuspend) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(PSF_EVENT_TASK_SUSPEND, (uint32_t)pxTaskToSuspend);\r
+\r
+/* Called on vTaskDelay - note the use of FreeRTOS variable xTicksToDelay */\r
+#undef traceTASK_DELAY\r
+#define traceTASK_DELAY() \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY, xTicksToDelay);\r
+\r
+/* Called on vTaskDelayUntil - note the use of FreeRTOS variable xTimeToWake */\r
+#undef traceTASK_DELAY_UNTIL\r
+#if TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0\r
+#define traceTASK_DELAY_UNTIL(xTimeToWake) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY_UNTIL, (uint32_t)xTimeToWake);\r
+#else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */\r
+#define traceTASK_DELAY_UNTIL() \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY_UNTIL, (uint32_t)xTimeToWake);\r
+#endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */\r
+\r
+#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0)\r
+#define traceQUEUE_CREATE_HELPER() \\r
+ case queueQUEUE_TYPE_MUTEX: \\r
+ prvTraceStoreEvent1(PSF_EVENT_MUTEX_CREATE, (uint32_t)pxNewQueue); \\r
+ break; \\r
+ case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
+ prvTraceStoreEvent1(PSF_EVENT_MUTEX_RECURSIVE_CREATE, (uint32_t)pxNewQueue); \\r
+ break;\r
+#else\r
+#define traceQUEUE_CREATE_HELPER()\r
+#endif /* (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) */\r
\r
/* Called in xQueueCreate, and thereby for all other object based on queues, such as semaphores. */\r
#undef traceQUEUE_CREATE\r
#define traceQUEUE_CREATE( pxNewQueue )\\r
- switch (pxNewQueue->ucQueueType) \\r
+ TRACE_SET_OBJECT_FILTER(QUEUE, pxNewQueue, CurrentFilterGroup); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
{ \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent2(PSF_EVENT_QUEUE_CREATE, (uint32_t)pxNewQueue, pxNewQueue->uxLength); \\r
- break; \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- prvTraceStoreEvent1(PSF_EVENT_SEMAPHORE_BINARY_CREATE, (uint32_t)pxNewQueue); \\r
- break; \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxNewQueue) & CurrentFilterMask) \\r
+ { \\r
+ switch (pxNewQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent2(PSF_EVENT_QUEUE_CREATE, (uint32_t)pxNewQueue, uxQueueLength); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ prvTraceStoreEvent1(PSF_EVENT_SEMAPHORE_BINARY_CREATE, (uint32_t)pxNewQueue); \\r
+ break; \\r
+ traceQUEUE_CREATE_HELPER() \\r
+ } \\r
+ } \\r
}\r
\r
+#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0)\r
+#define traceQUEUE_CREATE_FAILED_HELPER() \\r
+ case queueQUEUE_TYPE_MUTEX: \\r
+ prvTraceStoreEvent1(PSF_EVENT_MUTEX_CREATE_FAILED, 0); \\r
+ break; \\r
+ case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
+ prvTraceStoreEvent1(PSF_EVENT_MUTEX_RECURSIVE_CREATE_FAILED, 0); \\r
+ break;\r
+#else\r
+#define traceQUEUE_CREATE_FAILED_HELPER()\r
+#endif /* (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) */\r
+\r
/* Called in xQueueCreate, if the queue creation fails */\r
#undef traceQUEUE_CREATE_FAILED\r
#define traceQUEUE_CREATE_FAILED( queueType ) \\r
- switch (queueType) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
{ \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent0(PSF_EVENT_QUEUE_CREATE_FAILED); \\r
- break; \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- prvTraceStoreEvent0(PSF_EVENT_SEMAPHORE_BINARY_CREATE_FAILED); \\r
- break; \\r
+ switch (queueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent2(PSF_EVENT_QUEUE_CREATE_FAILED, 0, uxQueueLength); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ prvTraceStoreEvent1(PSF_EVENT_SEMAPHORE_BINARY_CREATE_FAILED, 0); \\r
+ break; \\r
+ traceQUEUE_CREATE_FAILED_HELPER() \\r
+ } \\r
}\r
\r
+#undef traceQUEUE_DELETE // We don't allow for filtering out "delete" events. They are important and not very frequent. Moreover, we can't exclude create events, so this should be symmetrical.\r
+#define traceQUEUE_DELETE( pxQueue ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ { \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ { \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent2(PSF_EVENT_QUEUE_DELETE, (uint32_t)pxQueue, (pxQueue != NULL) ? (pxQueue->uxMessagesWaiting) : 0); \\r
+ break; \\r
+ case queueQUEUE_TYPE_MUTEX: \\r
+ case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
+ prvTraceStoreEvent2(PSF_EVENT_MUTEX_DELETE, (uint32_t)pxQueue, (pxQueue != NULL) ? (pxQueue->uxMessagesWaiting) : 0); \\r
+ break; \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_DELETE, (uint32_t)pxQueue, (pxQueue != NULL) ? (pxQueue->uxMessagesWaiting) : 0); \\r
+ break; \\r
+ } \\r
+ } \\r
+ } \\r
+ prvTraceDeleteSymbol(pxQueue);\r
+\r
/* Called in xQueueCreateCountingSemaphore, if the queue creation fails */\r
#undef traceCREATE_COUNTING_SEMAPHORE\r
-#if TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_8_X || TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X\r
+#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X)\r
+#define traceCREATE_COUNTING_SEMAPHORE() \\r
+ TRACE_SET_OBJECT_FILTER(QUEUE, xHandle, CurrentFilterGroup); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, xHandle) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)xHandle, uxMaxCount)\r
+#elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_OR_7_6)\r
#define traceCREATE_COUNTING_SEMAPHORE() \\r
- prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)xHandle, ((Queue_t *) xHandle)->uxMessagesWaiting);\r
-#else /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_8_X || TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
+ TRACE_SET_OBJECT_FILTER(QUEUE, xHandle, CurrentFilterGroup); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, xHandle) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)xHandle, uxInitialCount);\r
+#elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4)\r
#define traceCREATE_COUNTING_SEMAPHORE() \\r
- prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)pxHandle, pxHandle->uxMessagesWaiting);\r
-#endif /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_8_X || TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
+ TRACE_SET_OBJECT_FILTER(QUEUE, xHandle, CurrentFilterGroup); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, xHandle) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)xHandle, uxCountValue);\r
+#else\r
+#define traceCREATE_COUNTING_SEMAPHORE() \\r
+ TRACE_SET_OBJECT_FILTER(QUEUE, pxHandle, CurrentFilterGroup); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxHandle) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)pxHandle, uxCountValue);\r
+#endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X */\r
\r
#undef traceCREATE_COUNTING_SEMAPHORE_FAILED\r
+#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X)\r
+#define traceCREATE_COUNTING_SEMAPHORE_FAILED() \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED, 0, uxMaxCount);\r
+#elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_OR_7_6)\r
#define traceCREATE_COUNTING_SEMAPHORE_FAILED() \\r
- prvTraceStoreEvent0(PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED, 0, uxInitialCount);\r
+#elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4)\r
+#define traceCREATE_COUNTING_SEMAPHORE_FAILED() \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED, 0, uxCountValue);\r
+#else\r
+#define traceCREATE_COUNTING_SEMAPHORE_FAILED() \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED, 0, uxCountValue);\r
+#endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X */\r
+\r
\r
+/* This macro is not necessary as of FreeRTOS v9.0.0 */\r
+#if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0)\r
/* Called in xQueueCreateMutex, and thereby also from xSemaphoreCreateMutex and xSemaphoreCreateRecursiveMutex */\r
#undef traceCREATE_MUTEX\r
#define traceCREATE_MUTEX( pxNewQueue ) \\r
- switch (pxNewQueue->ucQueueType) \\r
+ TRACE_SET_OBJECT_FILTER(QUEUE, pxNewQueue, CurrentFilterGroup); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
{ \\r
- case queueQUEUE_TYPE_MUTEX: \\r
- prvTraceStoreEvent1(PSF_EVENT_MUTEX_CREATE, (uint32_t)pxNewQueue); \\r
- break; \\r
- case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
- prvTraceStoreEvent1(PSF_EVENT_MUTEX_RECURSIVE_CREATE, (uint32_t)pxNewQueue); \\r
- break; \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxNewQueue) & CurrentFilterMask) \\r
+ { \\r
+ switch (pxNewQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_MUTEX: \\r
+ prvTraceStoreEvent1(PSF_EVENT_MUTEX_CREATE, (uint32_t)pxNewQueue); \\r
+ break; \\r
+ case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
+ prvTraceStoreEvent1(PSF_EVENT_MUTEX_RECURSIVE_CREATE, (uint32_t)pxNewQueue); \\r
+ break; \\r
+ } \\r
+ }\\r
}\r
\r
/* Called in xQueueCreateMutex when the operation fails (when memory allocation fails) */\r
#undef traceCREATE_MUTEX_FAILED\r
#define traceCREATE_MUTEX_FAILED() \\r
- prvTraceStoreEvent0(PSF_EVENT_MUTEX_CREATE_FAILED);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(PSF_EVENT_MUTEX_CREATE_FAILED, 0);\r
+#endif /* (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) */\r
\r
/* Called when a message is sent to a queue */ /* CS IS NEW ! */\r
#undef traceQUEUE_SEND\r
#define traceQUEUE_SEND( pxQueue ) \\r
- switch (pxQueue->ucQueueType) \\r
- { \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND : PSF_EVENT_QUEUE_SEND_FRONT, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting + 1); \\r
- break; \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
- prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting + 1); \\r
- break; \\r
- case queueQUEUE_TYPE_MUTEX: \\r
- case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
- prvTraceStoreEvent1(PSF_EVENT_MUTEX_GIVE, (uint32_t)pxQueue); \\r
- break; \\r
- }\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND : PSF_EVENT_QUEUE_SEND_FRONT, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting + 1); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting + 1); \\r
+ break; \\r
+ case queueQUEUE_TYPE_MUTEX: \\r
+ case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
+ prvTraceStoreEvent1(PSF_EVENT_MUTEX_GIVE, (uint32_t)pxQueue); \\r
+ break; \\r
+ }\r
\r
/* Called when a message failed to be sent to a queue (timeout) */\r
#undef traceQUEUE_SEND_FAILED\r
#define traceQUEUE_SEND_FAILED( pxQueue ) \\r
- switch (pxQueue->ucQueueType) \\r
- { \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_FAILED : PSF_EVENT_QUEUE_SEND_FRONT_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
- prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- case queueQUEUE_TYPE_MUTEX: \\r
- case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
- prvTraceStoreEvent1(PSF_EVENT_MUTEX_GIVE_FAILED, (uint32_t)pxQueue); \\r
- break; \\r
- }\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_FAILED : PSF_EVENT_QUEUE_SEND_FRONT_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_MUTEX: \\r
+ case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
+ prvTraceStoreEvent1(PSF_EVENT_MUTEX_GIVE_FAILED, (uint32_t)pxQueue); \\r
+ break; \\r
+ }\r
\r
/* Called when the task is blocked due to a send operation on a full queue */\r
#undef traceBLOCKING_ON_QUEUE_SEND\r
#define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) \\r
- switch (pxQueue->ucQueueType) \\r
- { \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_BLOCK : PSF_EVENT_QUEUE_SEND_FRONT_BLOCK, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
- prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE_BLOCK, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- case queueQUEUE_TYPE_MUTEX: \\r
- case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
- prvTraceStoreEvent1(PSF_EVENT_MUTEX_GIVE_BLOCK, (uint32_t)pxQueue); \\r
- break; \\r
- }\r
-\r
-/* Called for Recursive Mutex */\r
-#undef traceGIVE_MUTEX_RECURSIVE\r
-#define traceGIVE_MUTEX_RECURSIVE( pxMutex ) \\r
- prvTraceStoreEvent1(PSF_EVENT_MUTEX_GIVE_RECURSIVE, (uint32_t)pxMutex);\r
-\r
-/* Called for Recursive Mutex */\r
-#undef traceGIVE_MUTEX_RECURSIVE_FAILED\r
-#define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex ) \\r
- prvTraceStoreEvent1(PSF_EVENT_MUTEX_GIVE_RECURSIVE_FAILED, (uint32_t)pxMutex);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_BLOCK : PSF_EVENT_QUEUE_SEND_FRONT_BLOCK, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE_BLOCK, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_MUTEX: \\r
+ case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
+ prvTraceStoreEvent1(PSF_EVENT_MUTEX_GIVE_BLOCK, (uint32_t)pxQueue); \\r
+ break; \\r
+ }\r
\r
/**************************************************************************/\r
/* Makes sure xQueueGiveFromISR also has a xCopyPosition parameter */\r
/* Called when a message is sent from interrupt context, e.g., using xQueueSendFromISR */\r
#undef traceQUEUE_SEND_FROM_ISR\r
#define traceQUEUE_SEND_FROM_ISR( pxQueue ) \\r
- switch (pxQueue->ucQueueType) \\r
- { \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_FROMISR : PSF_EVENT_QUEUE_SEND_FRONT_FROMISR, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting + 1); \\r
- break; \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
- prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE_FROMISR, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting + 1); \\r
- break; \\r
- }\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_FROMISR : PSF_EVENT_QUEUE_SEND_FRONT_FROMISR, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting + 1); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE_FROMISR, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting + 1); \\r
+ break; \\r
+ }\r
\r
/* Called when a message send from interrupt context fails (since the queue was full) */\r
#undef traceQUEUE_SEND_FROM_ISR_FAILED\r
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) \\r
- switch (pxQueue->ucQueueType) \\r
- { \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_FROMISR_FAILED : PSF_EVENT_QUEUE_SEND_FRONT_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
- prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- }\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_FROMISR_FAILED : PSF_EVENT_QUEUE_SEND_FRONT_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ }\r
\r
/* Called when a message is received from a queue */\r
#undef traceQUEUE_RECEIVE\r
#define traceQUEUE_RECEIVE( pxQueue ) \\r
- switch (pxQueue->ucQueueType) \\r
- { \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent3(PSF_EVENT_QUEUE_RECEIVE, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting - 1); \\r
- break; \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
- prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_TAKE, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting - 1); \\r
- break; \\r
- case queueQUEUE_TYPE_MUTEX: \\r
- case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
- prvTraceStoreEvent2(PSF_EVENT_MUTEX_TAKE, (uint32_t)pxQueue, xTicksToWait); \\r
- break; \\r
- }\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ if (isQueueReceiveHookActuallyPeek) \\r
+ prvTraceStoreEvent3(PSF_EVENT_QUEUE_PEEK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting - 1); \\r
+ else\\r
+ prvTraceStoreEvent3(PSF_EVENT_QUEUE_RECEIVE, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting - 1); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ if (isQueueReceiveHookActuallyPeek) \\r
+ prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_PEEK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting - 1); \\r
+ else \\r
+ prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_TAKE, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting - 1); \\r
+ break; \\r
+ case queueQUEUE_TYPE_MUTEX: \\r
+ case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
+ if (isQueueReceiveHookActuallyPeek) \\r
+ prvTraceStoreEvent2(PSF_EVENT_MUTEX_PEEK, (uint32_t)pxQueue, xTicksToWait); \\r
+ else \\r
+ prvTraceStoreEvent2(PSF_EVENT_MUTEX_TAKE, (uint32_t)pxQueue, xTicksToWait); \\r
+ break; \\r
+ }\r
\r
/* Called when a receive operation on a queue fails (timeout) */\r
#undef traceQUEUE_RECEIVE_FAILED\r
#define traceQUEUE_RECEIVE_FAILED( pxQueue ) \\r
- switch (pxQueue->ucQueueType) \\r
- { \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent3(xJustPeeking == pdFALSE ? PSF_EVENT_QUEUE_RECEIVE_FAILED : PSF_EVENT_QUEUE_PEEK_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
- prvTraceStoreEvent3(xJustPeeking == pdFALSE ? PSF_EVENT_SEMAPHORE_TAKE_FAILED : PSF_EVENT_SEMAPHORE_PEEK_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- case queueQUEUE_TYPE_MUTEX: \\r
- case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
- prvTraceStoreEvent2(xJustPeeking == pdFALSE ? PSF_EVENT_MUTEX_TAKE_FAILED : PSF_EVENT_MUTEX_PEEK_FAILED, (uint32_t)pxQueue, xTicksToWait); \\r
- break; \\r
- }\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent3(isQueueReceiveHookActuallyPeek ? PSF_EVENT_QUEUE_PEEK_FAILED : PSF_EVENT_QUEUE_RECEIVE_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ prvTraceStoreEvent3(isQueueReceiveHookActuallyPeek ? PSF_EVENT_SEMAPHORE_PEEK_FAILED : PSF_EVENT_SEMAPHORE_TAKE_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_MUTEX: \\r
+ case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
+ prvTraceStoreEvent2(isQueueReceiveHookActuallyPeek ? PSF_EVENT_MUTEX_PEEK_FAILED : PSF_EVENT_MUTEX_TAKE_FAILED, (uint32_t)pxQueue, xTicksToWait); \\r
+ break; \\r
+ }\r
\r
/* Called when the task is blocked due to a receive operation on an empty queue */\r
#undef traceBLOCKING_ON_QUEUE_RECEIVE\r
#define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) \\r
- switch (pxQueue->ucQueueType) \\r
- { \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent3(xJustPeeking == pdFALSE ? PSF_EVENT_QUEUE_RECEIVE_BLOCK : PSF_EVENT_QUEUE_PEEK_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
- prvTraceStoreEvent3(xJustPeeking == pdFALSE ? PSF_EVENT_SEMAPHORE_TAKE_BLOCK : PSF_EVENT_SEMAPHORE_PEEK_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- case queueQUEUE_TYPE_MUTEX: \\r
- case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
- prvTraceStoreEvent2(xJustPeeking == pdFALSE ? PSF_EVENT_MUTEX_TAKE_BLOCK : PSF_EVENT_MUTEX_PEEK_BLOCK, (uint32_t)pxQueue, xTicksToWait); \\r
- break; \\r
- }\r
- \r
-#undef traceTAKE_MUTEX_RECURSIVE\r
-#if TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_8_X || TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X\r
-#define traceTAKE_MUTEX_RECURSIVE( pxQueue ) \\r
- prvTraceStoreEvent2(PSF_EVENT_MUTEX_TAKE_RECURSIVE, (uint32_t)pxQueue, xTicksToWait);\r
-#else /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_8_X || TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
-#define traceTAKE_MUTEX_RECURSIVE( pxQueue ) \\r
- prvTraceStoreEvent2(PSF_EVENT_MUTEX_TAKE_RECURSIVE, (uint32_t)pxQueue, xBlockTime);\r
-#endif /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_8_X || TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
-\r
-#undef traceTAKE_MUTEX_RECURSIVE_FAILED\r
-#if TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_8_X || TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X\r
-#define traceTAKE_MUTEX_RECURSIVE_FAILED( pxQueue ) \\r
- prvTraceStoreEvent2(PSF_EVENT_MUTEX_TAKE_RECURSIVE_FAILED, (uint32_t)pxQueue, xTicksToWait);\r
-#else /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_8_X || TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
-#define traceTAKE_MUTEX_RECURSIVE_FAILED( pxQueue ) \\r
- prvTraceStoreEvent2(PSF_EVENT_MUTEX_TAKE_RECURSIVE_FAILED, (uint32_t)pxQueue, xBlockTime);\r
-#endif /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_8_X || TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent3(isQueueReceiveHookActuallyPeek ? PSF_EVENT_QUEUE_PEEK_BLOCK : PSF_EVENT_QUEUE_RECEIVE_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ prvTraceStoreEvent3(isQueueReceiveHookActuallyPeek ? PSF_EVENT_SEMAPHORE_PEEK_BLOCK : PSF_EVENT_SEMAPHORE_TAKE_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_MUTEX: \\r
+ case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
+ prvTraceStoreEvent2(isQueueReceiveHookActuallyPeek ? PSF_EVENT_MUTEX_PEEK_BLOCK : PSF_EVENT_MUTEX_TAKE_BLOCK, (uint32_t)pxQueue, xTicksToWait); \\r
+ break; \\r
+ }\r
+\r
+#if (TRC_CFG_FREERTOS_VERSION > TRC_FREERTOS_VERSION_9_0_1)\r
+/* Called when a peek operation on a queue fails (timeout) */\r
+#undef traceQUEUE_PEEK_FAILED\r
+#define traceQUEUE_PEEK_FAILED( pxQueue ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent3(PSF_EVENT_QUEUE_PEEK_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_PEEK_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_MUTEX: \\r
+ case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
+ prvTraceStoreEvent2(PSF_EVENT_MUTEX_PEEK_FAILED, (uint32_t)pxQueue, xTicksToWait); \\r
+ break; \\r
+ }\r
+\r
+/* Called when the task is blocked due to a peek operation on an empty queue */\r
+#undef traceBLOCKING_ON_QUEUE_PEEK\r
+#define traceBLOCKING_ON_QUEUE_PEEK( pxQueue ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent3(PSF_EVENT_QUEUE_PEEK_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_PEEK_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_MUTEX: \\r
+ case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
+ prvTraceStoreEvent2(PSF_EVENT_MUTEX_PEEK_BLOCK, (uint32_t)pxQueue, xTicksToWait); \\r
+ break; \\r
+ }\r
+\r
+#endif /* (TRC_CFG_FREERTOS_VERSION > TRC_FREERTOS_VERSION_9_0_1) */\r
\r
/* Called when a message is received in interrupt context, e.g., using xQueueReceiveFromISR */\r
#undef traceQUEUE_RECEIVE_FROM_ISR\r
#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) \\r
-switch (pxQueue->ucQueueType) \\r
- { \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent2(PSF_EVENT_QUEUE_RECEIVE_FROMISR, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting - 1); \\r
- break; \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
- prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_TAKE_FROMISR, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting - 1); \\r
- break; \\r
- }\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent2(PSF_EVENT_QUEUE_RECEIVE_FROMISR, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting - 1); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_TAKE_FROMISR, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting - 1); \\r
+ break; \\r
+ }\r
\r
/* Called when a message receive from interrupt context fails (since the queue was empty) */\r
#undef traceQUEUE_RECEIVE_FROM_ISR_FAILED\r
#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) \\r
- switch (pxQueue->ucQueueType) \\r
- { \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent2(PSF_EVENT_QUEUE_RECEIVE_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
- prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_TAKE_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- }\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent2(PSF_EVENT_QUEUE_RECEIVE_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_TAKE_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ }\r
\r
/* Called on xQueuePeek */\r
#undef traceQUEUE_PEEK\r
#define traceQUEUE_PEEK( pxQueue ) \\r
- switch (pxQueue->ucQueueType) \\r
- { \\r
- case queueQUEUE_TYPE_BASE: \\r
- prvTraceStoreEvent3(PSF_EVENT_QUEUE_PEEK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
- case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
- prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_PEEK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
- break; \\r
- case queueQUEUE_TYPE_MUTEX: \\r
- case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
- prvTraceStoreEvent1(PSF_EVENT_MUTEX_PEEK, (uint32_t)pxQueue); \\r
- break; \\r
- }\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \\r
+ switch (pxQueue->ucQueueType) \\r
+ { \\r
+ case queueQUEUE_TYPE_BASE: \\r
+ prvTraceStoreEvent3(PSF_EVENT_QUEUE_PEEK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_BINARY_SEMAPHORE: \\r
+ case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \\r
+ prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_PEEK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \\r
+ break; \\r
+ case queueQUEUE_TYPE_MUTEX: \\r
+ case queueQUEUE_TYPE_RECURSIVE_MUTEX: \\r
+ prvTraceStoreEvent1(PSF_EVENT_MUTEX_PEEK, (uint32_t)pxQueue); \\r
+ break; \\r
+ }\r
\r
/* Called in vTaskPrioritySet */\r
#undef traceTASK_PRIORITY_SET\r
#define traceTASK_PRIORITY_SET( pxTask, uxNewPriority ) \\r
prvTraceSaveObjectData(pxTask, uxNewPriority); \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_PRIORITY, (uint32_t)pxTask, uxNewPriority);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(pxTask) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_PRIORITY, (uint32_t)pxTask, uxNewPriority);\r
\r
/* Called in vTaskPriorityInherit, which is called by Mutex operations */\r
#undef traceTASK_PRIORITY_INHERIT\r
#define traceTASK_PRIORITY_INHERIT( pxTask, uxNewPriority ) \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_PRIO_INHERIT, (uint32_t)pxTask, uxNewPriority);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(pxTask) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_PRIO_INHERIT, (uint32_t)pxTask, uxNewPriority);\r
\r
/* Called in vTaskPriorityDisinherit, which is called by Mutex operations */\r
#undef traceTASK_PRIORITY_DISINHERIT\r
#define traceTASK_PRIORITY_DISINHERIT( pxTask, uxNewPriority ) \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_PRIO_DISINHERIT, (uint32_t)pxTask, uxNewPriority);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(pxTask) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_PRIO_DISINHERIT, (uint32_t)pxTask, uxNewPriority);\r
\r
/* Called in vTaskResume */\r
#undef traceTASK_RESUME\r
#define traceTASK_RESUME( pxTaskToResume ) \\r
- prvTraceStoreEvent1(PSF_EVENT_TASK_RESUME, (uint32_t)pxTaskToResume);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(pxTaskToResume) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(PSF_EVENT_TASK_RESUME, (uint32_t)pxTaskToResume);\r
\r
/* Called in vTaskResumeFromISR */\r
#undef traceTASK_RESUME_FROM_ISR\r
#define traceTASK_RESUME_FROM_ISR( pxTaskToResume ) \\r
- prvTraceStoreEvent1(PSF_EVENT_TASK_RESUME_FROMISR, (uint32_t)pxTaskToResume);\r
+ if (TRACE_GET_TASK_FILTER(pxTaskToResume) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(PSF_EVENT_TASK_RESUME_FROMISR, (uint32_t)pxTaskToResume);\r
+\r
+#if (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1)\r
\r
#undef traceMALLOC\r
#define traceMALLOC( pvAddress, uiSize ) \\r
- prvTraceStoreEvent2(PSF_EVENT_MALLOC, (uint32_t)pvAddress, uiSize);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_MALLOC, (uint32_t)pvAddress, uiSize);\r
\r
#undef traceFREE\r
#define traceFREE( pvAddress, uiSize ) \\r
- prvTraceStoreEvent2(PSF_EVENT_FREE, (uint32_t)pvAddress, (uint32_t)(-uiSize));\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_FREE, (uint32_t)pvAddress, (uint32_t)(0 - uiSize)); /* "0 -" instead of just "-" to get rid of a warning... */\r
+\r
+#endif /* (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1) */\r
+\r
+#if (TRC_CFG_INCLUDE_TIMER_EVENTS == 1)\r
\r
/* Called in timer.c - xTimerCreate */\r
#undef traceTIMER_CREATE\r
#define traceTIMER_CREATE(tmr) \\r
+ TRACE_SET_OBJECT_FILTER(TIMER, tmr, CurrentFilterGroup); \\r
prvTraceSaveSymbol(tmr, tmr->pcTimerName); \\r
prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, tmr->pcTimerName, tmr); \\r
- prvTraceStoreEvent2(PSF_EVENT_TIMER_CREATE, (uint32_t)tmr, tmr->xTimerPeriodInTicks);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TIMER_CREATE, (uint32_t)tmr, tmr->xTimerPeriodInTicks);\r
\r
#undef traceTIMER_CREATE_FAILED\r
#define traceTIMER_CREATE_FAILED() \\r
- prvTraceStoreEvent0(PSF_EVENT_TIMER_CREATE_FAILED);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent0(PSF_EVENT_TIMER_CREATE_FAILED);\r
\r
-#if (TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_8_X || TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X)\r
+#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X)\r
#define traceTIMER_COMMAND_SEND_8_0_CASES(tmr) \\r
- case tmrCOMMAND_RESET: \\r
- prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_RESET : PSF_EVENT_TIMER_RESET_FAILED, (uint32_t)tmr, xOptionalValue); \\r
- break; \\r
- case tmrCOMMAND_START_FROM_ISR: \\r
- prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_START_FROMISR : PSF_EVENT_TIMER_START_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \\r
- break; \\r
- case tmrCOMMAND_RESET_FROM_ISR: \\r
- prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_RESET_FROMISR : PSF_EVENT_TIMER_RESET_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \\r
- break; \\r
- case tmrCOMMAND_STOP_FROM_ISR: \\r
- prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_STOP_FROMISR : PSF_EVENT_TIMER_STOP_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \\r
- break; \\r
- case tmrCOMMAND_CHANGE_PERIOD_FROM_ISR: \\r
- prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR : PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \\r
- break;\r
-#else /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_8_X || TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
+ case tmrCOMMAND_RESET: \\r
+ prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_RESET : PSF_EVENT_TIMER_RESET_FAILED, (uint32_t)tmr, xOptionalValue); \\r
+ break; \\r
+ case tmrCOMMAND_START_FROM_ISR: \\r
+ prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_START_FROMISR : PSF_EVENT_TIMER_START_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \\r
+ break; \\r
+ case tmrCOMMAND_RESET_FROM_ISR: \\r
+ prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_RESET_FROMISR : PSF_EVENT_TIMER_RESET_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \\r
+ break; \\r
+ case tmrCOMMAND_STOP_FROM_ISR: \\r
+ prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_STOP_FROMISR : PSF_EVENT_TIMER_STOP_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \\r
+ break; \\r
+ case tmrCOMMAND_CHANGE_PERIOD_FROM_ISR: \\r
+ prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR : PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \\r
+ break;\r
+#else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X */\r
#define traceTIMER_COMMAND_SEND_8_0_CASES(tmr) \r
-#endif /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_8_X || TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
+#endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X */\r
\r
/* Note that xCommandID can never be tmrCOMMAND_EXECUTE_CALLBACK (-1) since the trace macro is not called in that case */\r
#undef traceTIMER_COMMAND_SEND\r
#define traceTIMER_COMMAND_SEND(tmr, xCommandID, xOptionalValue, xReturn) \\r
- switch(xCommandID) \\r
- { \\r
- case tmrCOMMAND_START: \\r
- prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_START : PSF_EVENT_TIMER_START_FAILED, (uint32_t)tmr); \\r
- break; \\r
- case tmrCOMMAND_STOP: \\r
- prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_STOP : PSF_EVENT_TIMER_STOP_FAILED, (uint32_t)tmr); \\r
- break; \\r
- case tmrCOMMAND_CHANGE_PERIOD: \\r
- prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_CHANGEPERIOD : PSF_EVENT_TIMER_CHANGEPERIOD_FAILED, (uint32_t)tmr, xOptionalValue); \\r
- break; \\r
- case tmrCOMMAND_DELETE: \\r
- prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_DELETE : PSF_EVENT_TIMER_DELETE_FAILED, (uint32_t)tmr); \\r
- break; \\r
- traceTIMER_COMMAND_SEND_8_0_CASES(tmr) \\r
- }\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \\r
+ switch(xCommandID) \\r
+ { \\r
+ case tmrCOMMAND_START: \\r
+ prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_START : PSF_EVENT_TIMER_START_FAILED, (uint32_t)tmr); \\r
+ break; \\r
+ case tmrCOMMAND_STOP: \\r
+ prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_STOP : PSF_EVENT_TIMER_STOP_FAILED, (uint32_t)tmr); \\r
+ break; \\r
+ case tmrCOMMAND_CHANGE_PERIOD: \\r
+ prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_CHANGEPERIOD : PSF_EVENT_TIMER_CHANGEPERIOD_FAILED, (uint32_t)tmr, xOptionalValue); \\r
+ break; \\r
+ case tmrCOMMAND_DELETE: \\r
+ prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_DELETE : PSF_EVENT_TIMER_DELETE_FAILED, (uint32_t)tmr); \\r
+ break; \\r
+ traceTIMER_COMMAND_SEND_8_0_CASES(tmr) \\r
+ }\r
+\r
+#undef traceTIMER_EXPIRED\r
+#define traceTIMER_EXPIRED(tmr) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TIMER_EXPIRED, (uint32_t)tmr->pxCallbackFunction, (uint32_t)tmr->pvTimerID);\r
+\r
+#endif /* #if (TRC_CFG_INCLUDE_TIMER_EVENTS == 1) */\r
+\r
+\r
+#if (TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS == 1)\r
\r
#undef tracePEND_FUNC_CALL\r
#define tracePEND_FUNC_CALL(func, arg1, arg2, ret) \\r
#define tracePEND_FUNC_CALL_FROM_ISR(func, arg1, arg2, ret) \\r
prvTraceStoreEvent1((ret == pdPASS) ? PSF_EVENT_TIMER_PENDFUNCCALL_FROMISR : PSF_EVENT_TIMER_PENDFUNCCALL_FROMISR_FAILED, (uint32_t)func);\r
\r
+#endif /* (TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS == 1) */\r
+\r
+#if (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1)\r
+\r
#undef traceEVENT_GROUP_CREATE\r
#define traceEVENT_GROUP_CREATE(eg) \\r
- prvTraceStoreEvent1(PSF_EVENT_EVENTGROUP_CREATE, (uint32_t)eg);\r
+ TRACE_SET_OBJECT_FILTER(EVENTGROUP, eg, CurrentFilterGroup); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(PSF_EVENT_EVENTGROUP_CREATE, (uint32_t)eg);\r
\r
#undef traceEVENT_GROUP_DELETE\r
#define traceEVENT_GROUP_DELETE(eg) \\r
- prvTraceStoreEvent1(PSF_EVENT_EVENTGROUP_DELETE, (uint32_t)eg); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(PSF_EVENT_EVENTGROUP_DELETE, (uint32_t)eg); \\r
prvTraceDeleteSymbol(eg);\r
\r
#undef traceEVENT_GROUP_CREATE_FAILED\r
#define traceEVENT_GROUP_CREATE_FAILED() \\r
- prvTraceStoreEvent0(PSF_EVENT_EVENTGROUP_CREATE_FAILED);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent0(PSF_EVENT_EVENTGROUP_CREATE_FAILED);\r
\r
#undef traceEVENT_GROUP_SYNC_BLOCK\r
#define traceEVENT_GROUP_SYNC_BLOCK(eg, bitsToSet, bitsToWaitFor) \\r
- prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SYNC_BLOCK, (uint32_t)eg, bitsToWaitFor);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SYNC_BLOCK, (uint32_t)eg, bitsToWaitFor);\r
\r
#undef traceEVENT_GROUP_SYNC_END\r
#define traceEVENT_GROUP_SYNC_END(eg, bitsToSet, bitsToWaitFor, wasTimeout) \\r
- prvTraceStoreEvent2((wasTimeout != pdTRUE) ? PSF_EVENT_EVENTGROUP_SYNC : PSF_EVENT_EVENTGROUP_SYNC_FAILED, (uint32_t)eg, bitsToWaitFor);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2((wasTimeout != pdTRUE) ? PSF_EVENT_EVENTGROUP_SYNC : PSF_EVENT_EVENTGROUP_SYNC_FAILED, (uint32_t)eg, bitsToWaitFor);\r
\r
#undef traceEVENT_GROUP_WAIT_BITS_BLOCK\r
#define traceEVENT_GROUP_WAIT_BITS_BLOCK(eg, bitsToWaitFor) \\r
- prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_WAITBITS_BLOCK, (uint32_t)eg, bitsToWaitFor);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_WAITBITS_BLOCK, (uint32_t)eg, bitsToWaitFor);\r
\r
#undef traceEVENT_GROUP_WAIT_BITS_END\r
#define traceEVENT_GROUP_WAIT_BITS_END(eg, bitsToWaitFor, wasTimeout) \\r
- prvTraceStoreEvent2((wasTimeout != pdTRUE) ? PSF_EVENT_EVENTGROUP_WAITBITS : PSF_EVENT_EVENTGROUP_WAITBITS_FAILED, (uint32_t)eg, bitsToWaitFor);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2((wasTimeout != pdTRUE) ? PSF_EVENT_EVENTGROUP_WAITBITS : PSF_EVENT_EVENTGROUP_WAITBITS_FAILED, (uint32_t)eg, bitsToWaitFor);\r
\r
#undef traceEVENT_GROUP_CLEAR_BITS\r
#define traceEVENT_GROUP_CLEAR_BITS(eg, bitsToClear) \\r
- prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_CLEARBITS, (uint32_t)eg, bitsToClear);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_CLEARBITS, (uint32_t)eg, bitsToClear);\r
\r
#undef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR\r
#define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR(eg, bitsToClear) \\r
- prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_CLEARBITS_FROMISR, (uint32_t)eg, bitsToClear);\r
+ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_CLEARBITS_FROMISR, (uint32_t)eg, bitsToClear);\r
\r
#undef traceEVENT_GROUP_SET_BITS\r
#define traceEVENT_GROUP_SET_BITS(eg, bitsToSet) \\r
- prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SETBITS, (uint32_t)eg, bitsToSet);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SETBITS, (uint32_t)eg, bitsToSet);\r
\r
#undef traceEVENT_GROUP_SET_BITS_FROM_ISR\r
#define traceEVENT_GROUP_SET_BITS_FROM_ISR(eg, bitsToSet) \\r
- prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SETBITS_FROMISR, (uint32_t)eg, bitsToSet);\r
+ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SETBITS_FROMISR, (uint32_t)eg, bitsToSet);\r
+\r
+#endif /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1) */\r
\r
#undef traceTASK_NOTIFY_TAKE\r
-#if (TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X)\r
+#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0)\r
#define traceTASK_NOTIFY_TAKE() \\r
- if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED) \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE, (uint32_t)pxCurrentTCB, xTicksToWait); \\r
- else \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);\r
-#else /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \\r
+ if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE, (uint32_t)pxCurrentTCB, xTicksToWait); \\r
+ else \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);}\r
+#else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */\r
#define traceTASK_NOTIFY_TAKE() \\r
- if (pxCurrentTCB->eNotifyState == eNotified) \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE, (uint32_t)pxCurrentTCB, xTicksToWait); \\r
- else \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);\r
-#endif /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \\r
+ if (pxCurrentTCB->eNotifyState == eNotified) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE, (uint32_t)pxCurrentTCB, xTicksToWait); \\r
+ else \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);}\r
+#endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */\r
\r
#undef traceTASK_NOTIFY_TAKE_BLOCK\r
#define traceTASK_NOTIFY_TAKE_BLOCK() \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE_BLOCK, (uint32_t)pxCurrentTCB, xTicksToWait);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE_BLOCK, (uint32_t)pxCurrentTCB, xTicksToWait);\r
\r
#undef traceTASK_NOTIFY_WAIT\r
-#if (TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X)\r
+#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0)\r
#define traceTASK_NOTIFY_WAIT() \\r
- if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED) \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT, (uint32_t)pxCurrentTCB, xTicksToWait); \\r
- else \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);\r
-#else /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \\r
+ if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT, (uint32_t)pxCurrentTCB, xTicksToWait); \\r
+ else \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);}\r
+#else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */\r
#define traceTASK_NOTIFY_WAIT() \\r
- if (pxCurrentTCB->eNotifyState == eNotified) \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT, (uint32_t)pxCurrentTCB, xTicksToWait); \\r
- else \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);\r
-#endif /* TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X */\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \\r
+ if (pxCurrentTCB->eNotifyState == eNotified) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT, (uint32_t)pxCurrentTCB, xTicksToWait); \\r
+ else \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);}\r
+#endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */\r
\r
#undef traceTASK_NOTIFY_WAIT_BLOCK\r
#define traceTASK_NOTIFY_WAIT_BLOCK() \\r
- prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_BLOCK, (uint32_t)pxCurrentTCB, xTicksToWait);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_BLOCK, (uint32_t)pxCurrentTCB, xTicksToWait);\r
\r
#undef traceTASK_NOTIFY\r
#define traceTASK_NOTIFY() \\r
- prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY, (uint32_t)xTaskToNotify);\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY, (uint32_t)xTaskToNotify);\r
\r
#undef traceTASK_NOTIFY_FROM_ISR\r
#define traceTASK_NOTIFY_FROM_ISR() \\r
- prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY_FROM_ISR, (uint32_t)xTaskToNotify);\r
+ if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY_FROM_ISR, (uint32_t)xTaskToNotify);\r
\r
#undef traceTASK_NOTIFY_GIVE_FROM_ISR\r
#define traceTASK_NOTIFY_GIVE_FROM_ISR() \\r
- prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY_GIVE_FROM_ISR, (uint32_t)xTaskToNotify);\r
+ if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY_GIVE_FROM_ISR, (uint32_t)xTaskToNotify);\r
\r
#undef traceQUEUE_REGISTRY_ADD\r
#define traceQUEUE_REGISTRY_ADD(object, name) \\r
prvTraceSaveSymbol(object, (const char*)name); \\r
prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, name, object);\r
\r
-#endif /*#if TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING */\r
+#if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1)\r
+\r
+#undef traceSTREAM_BUFFER_CREATE\r
+#define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer ) \\r
+ TRACE_SET_OBJECT_FILTER(STREAMBUFFER, pxStreamBuffer, CurrentFilterGroup); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, pxStreamBuffer) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(xIsMessageBuffer == 1 ? PSF_EVENT_MESSAGEBUFFER_CREATE : PSF_EVENT_STREAMBUFFER_CREATE, (uint32_t)pxStreamBuffer, xBufferSizeBytes);\r
+\r
+#undef traceSTREAM_BUFFER_CREATE_FAILED\r
+#define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(xIsMessageBuffer == 1 ? PSF_EVENT_MESSAGEBUFFER_CREATE_FAILED : PSF_EVENT_STREAMBUFFER_CREATE_FAILED, 0 , xBufferSizeBytes);\r
+\r
+#undef traceSTREAM_BUFFER_CREATE_STATIC_FAILED\r
+#define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer ) \\r
+ traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )\r
+\r
+#undef traceSTREAM_BUFFER_DELETE\r
+#define traceSTREAM_BUFFER_DELETE( xStreamBuffer ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, pxStreamBuffer) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_DELETE : PSF_EVENT_STREAMBUFFER_DELETE, (uint32_t)xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); \\r
+ prvTraceDeleteSymbol(xStreamBuffer);\r
+\r
+#undef traceSTREAM_BUFFER_RESET\r
+#define traceSTREAM_BUFFER_RESET( xStreamBuffer ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RESET : PSF_EVENT_STREAMBUFFER_RESET, (uint32_t)xStreamBuffer, 0);\r
+\r
+#undef traceSTREAM_BUFFER_SEND\r
+#define traceSTREAM_BUFFER_SEND( xStreamBuffer, xReturn ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_SEND : PSF_EVENT_STREAMBUFFER_SEND, (uint32_t)xStreamBuffer, prvBytesInBuffer(xStreamBuffer));\r
+\r
+#undef traceBLOCKING_ON_STREAM_BUFFER_SEND\r
+#define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_SEND_BLOCK : PSF_EVENT_STREAMBUFFER_SEND_BLOCK, (uint32_t)xStreamBuffer);\r
+\r
+#undef traceSTREAM_BUFFER_SEND_FAILED\r
+#define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_SEND_FAILED : PSF_EVENT_STREAMBUFFER_SEND_FAILED, (uint32_t)xStreamBuffer);\r
+\r
+#undef traceSTREAM_BUFFER_RECEIVE\r
+#define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \\r
+ prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RECEIVE: PSF_EVENT_STREAMBUFFER_RECEIVE, (uint32_t)xStreamBuffer, prvBytesInBuffer(xStreamBuffer));\r
+\r
+#undef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE\r
+#define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RECEIVE_BLOCK: PSF_EVENT_STREAMBUFFER_RECEIVE_BLOCK, (uint32_t)xStreamBuffer);\r
+\r
+#undef traceSTREAM_BUFFER_RECEIVE_FAILED\r
+#define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer ) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \\r
+ prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RECEIVE_FAILED: PSF_EVENT_STREAMBUFFER_RECEIVE_FAILED, (uint32_t)xStreamBuffer);\r
+\r
+#undef traceSTREAM_BUFFER_SEND_FROM_ISR\r
+#define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xReturn ) \\r
+ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \\r
+ { \\r
+ if ( xReturn > ( size_t ) 0 ) \\r
+ { \\r
+ prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_SEND_FROM_ISR : PSF_EVENT_STREAMBUFFER_SEND_FROM_ISR, (uint32_t)xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); \\r
+ } \\r
+ else \\r
+ { \\r
+ prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_SEND_FROM_ISR_FAILED : PSF_EVENT_STREAMBUFFER_SEND_FROM_ISR_FAILED, (uint32_t)xStreamBuffer); \\r
+ } \\r
+ }\r
\r
-#else /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/\r
+#undef traceSTREAM_BUFFER_RECEIVE_FROM_ISR\r
+#define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength ) \\r
+if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \\r
+ { \\r
+ if ( xReceivedLength > ( size_t ) 0 ) \\r
+ { \\r
+ prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RECEIVE_FROM_ISR : PSF_EVENT_STREAMBUFFER_RECEIVE_FROM_ISR, (uint32_t)xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); \\r
+ } \\r
+ else \\r
+ { \\r
+ prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RECEIVE_FROM_ISR_FAILED : PSF_EVENT_STREAMBUFFER_RECEIVE_FROM_ISR_FAILED, (uint32_t)xStreamBuffer); \\r
+ } \\r
+ }\r
+\r
+#endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) */\r
+\r
+#endif /* (TRC_CFG_SCHEDULING_ONLY == 0) */\r
+\r
+#endif /* (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) */\r
+\r
+#else /* (TRC_USE_TRACEALYZER_RECORDER == 1) */\r
+ \r
+/* When recorder is disabled */\r
+#define vTraceSetQueueName(object, name)\r
+#define vTraceSetSemaphoreName(object, name)\r
+#define vTraceSetMutexName(object, name)\r
+#define vTraceSetEventGroupName(object, name)\r
+#define vTraceSetStreamBufferName(object, name)\r
+#define vTraceSetMessageBufferName(object, name)\r
\r
- /* when recorder disabled */\r
- #define vTraceSetQueueName(object, name)\r
- #define vTraceSetSemaphoreName(object, name)\r
- #define vTraceSetMutexName(object, name)\r
-\r
- #define vTraceExcludeQueue(handle)\r
- #define vTraceExcludeSemaphore(handle)\r
- #define vTraceExcludeMutex(handle)\r
- #define vTraceExcludeTimer(handle)\r
- #define vTraceExcludeEventGroup(handle)\r
- #define vTraceExcludeDelays()\r
-\r
-#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/\r
+#endif /* (TRC_USE_TRACEALYZER_RECORDER == 1) */\r
\r
#ifdef __cplusplus\r
}\r
/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* trcPortDefines.h\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2017.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
\r
#define TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC (0x01)\r
#define TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM (0x02)\r
\r
+/* Filter Groups */\r
+#define FilterGroup0 (uint16_t)0x0001\r
+#define FilterGroup1 (uint16_t)0x0002\r
+#define FilterGroup2 (uint16_t)0x0004\r
+#define FilterGroup3 (uint16_t)0x0008\r
+#define FilterGroup4 (uint16_t)0x0010\r
+#define FilterGroup5 (uint16_t)0x0020\r
+#define FilterGroup6 (uint16_t)0x0040\r
+#define FilterGroup7 (uint16_t)0x0080\r
+#define FilterGroup8 (uint16_t)0x0100\r
+#define FilterGroup9 (uint16_t)0x0200\r
+#define FilterGroup10 (uint16_t)0x0400\r
+#define FilterGroup11 (uint16_t)0x0800\r
+#define FilterGroup12 (uint16_t)0x1000\r
+#define FilterGroup13 (uint16_t)0x2000\r
+#define FilterGroup14 (uint16_t)0x4000\r
+#define FilterGroup15 (uint16_t)0x8000\r
\r
/******************************************************************************\r
* Supported ports\r
#define TRC_HARDWARE_PORT_NXP_LPC210X 14 /* No Any */\r
#define TRC_HARDWARE_PORT_ARM_CORTEX_A9 15 /* Yes Any */\r
#define TRC_HARDWARE_PORT_POWERPC_Z4 16 /* No FreeRTOS */\r
-\r
+#define TRC_HARDWARE_PORT_Altera_NiosII 17 /* No Any */\r
#endif /*TRC_PORTDEFINES_H*/\r
/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* trcRecorder.h\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2017.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
\r
\r
#include <stdarg.h>\r
#include <stdint.h>\r
+#include <stddef.h>\r
#include "trcConfig.h"\r
#include "trcPortDefines.h"\r
\r
\r
- \r
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)\r
typedef uint16_t traceString;\r
typedef uint8_t traceUBChannel;\r
#endif\r
\r
#if (TRC_USE_TRACEALYZER_RECORDER == 1)\r
- \r
+\r
+#define TRACE_GET_LOW16(value) ((uint16_t)((value) & 0x0000FFFF))\r
+#define TRACE_GET_HIGH16(value) ((uint16_t)(((value) >> 16) & 0x0000FFFF))\r
+#define TRACE_SET_LOW16(current, value) (((current) & 0xFFFF0000) | (value))\r
+#define TRACE_SET_HIGH16(current, value) (((current) & 0x0000FFFF) | (((uint32_t)(value)) << 16))\r
+\r
/******************************************************************************/\r
/*** Common API - both Snapshot and Streaming mode ****************************/\r
/******************************************************************************/\r
* In snapshot mode you are limited to maximum 15 arguments, that must not exceed\r
* 32 bytes in total (not counting the format string). If exceeded, the recorder\r
* logs an internal error (displayed when opening the trace) and stops recording. \r
- *\r
******************************************************************************/\r
+#if (TRC_CFG_SCHEDULING_ONLY == 0) && (TRC_CFG_INCLUDE_USER_EVENTS == 1)\r
void vTracePrintF(traceString chn, const char* fmt, ...);\r
+#else\r
+#define vTracePrintF(chn, ...) (void)chn\r
+#endif\r
\r
-/******************************************************************************\r
+ /******************************************************************************\r
* vTracePrint\r
*\r
* A faster version of vTracePrintF, that only allows for logging a string.\r
* traceString chn = xTraceRegisterString("MyChannel");\r
* ...\r
* vTracePrint(chn, "Hello World!");\r
-*\r
******************************************************************************/\r
+#if (TRC_CFG_SCHEDULING_ONLY == 0) && (TRC_CFG_INCLUDE_USER_EVENTS == 1)\r
void vTracePrint(traceString chn, const char* str);\r
+#else\r
+#define vTracePrint(chn, ...) (void)chn\r
+#endif\r
\r
/*******************************************************************************\r
* xTraceRegisterString\r
* myEventHandle = xTraceRegisterString("MyUserEvent");\r
* ...\r
* vTracePrintF(myEventHandle, "My value is: %d", myValue);\r
-*\r
******************************************************************************/\r
+#if (TRC_CFG_SCHEDULING_ONLY == 0) && (TRC_CFG_INCLUDE_USER_EVENTS == 1)\r
traceString xTraceRegisterString(const char* name);\r
+#else\r
+#define xTraceRegisterString(x) (x)\r
+#endif\r
\r
/*******************************************************************************\r
* vTraceSet...Name(void* object, const char* name)\r
*\r
* Kernel-specific functions for setting names of kernel objects, for display in\r
* Tracealyzer.\r
- *\r
- * See trcKernelPort.h for details (since kernel-specific)\r
******************************************************************************/\r
-\r
-/*******************************************************************************\r
- * vTraceExclude... \r
- *\r
- * Kernel-specific macros for excluding specified events from the trace. Allows \r
- * for capturing longer traces in snapshot mode by selective tracing.\r
- *\r
- * See trcKernelPort.h for details (kernel-specific)\r
- ******************************************************************************/ \r
+/* See trcKernelPort.h for details (kernel-specific) */\r
\r
/*******************************************************************************\r
* xTraceSetISRProperties\r
* ...\r
* vTraceStoreISREnd(0);\r
* }\r
- *\r
******************************************************************************/\r
traceHandle xTraceSetISRProperties(const char* name, uint8_t priority);\r
\r
* ...\r
* vTraceStoreISREnd(0);\r
* }\r
- *\r
******************************************************************************/\r
void vTraceStoreISRBegin(traceHandle handle);\r
\r
* ...\r
* vTraceStoreISREnd(0);\r
* }\r
- *\r
******************************************************************************/\r
void vTraceStoreISREnd(int isTaskSwitchRequired);\r
\r
/*******************************************************************************\r
* xTraceGetLastError\r
*\r
- * Returns the last error, if any.\r
+ * Returns the last error or warning as a string, or NULL if none.\r
*****************************************************************************/\r
const char* xTraceGetLastError(void);\r
\r
*\r
* This translates to a single static allocation, on which you can apply linker\r
* directives to place it in a particular memory region.\r
+*\r
* - Snapshot mode: "RecorderDataType <name>"\r
-* - Streaming mode: "char <name> [<size>]", with <size> from trcStreamingPort.h.\r
+*\r
+* - Streaming mode: "char <name> [<size>]", \r
+* where <size> is defined in trcStreamingConfig.h.\r
*\r
* Example:\r
*\r
* vTraceSetRecorderDataBuffer(&myTraceBuffer); // Note the "&"\r
* ...\r
* vTraceEnable(TRC_INIT); // Initialize the data structure\r
-*\r
******************************************************************************/\r
-#ifndef TRC_ALLOC_CUSTOM_BUFFER\r
-/* Definition for snapshot mode only. Also defined in trcStreamingPort.h */\r
#if (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM)\r
-#define TRC_ALLOC_CUSTOM_BUFFER(bufname) RecorderDataType bufname;\r
+ #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)\r
+ #define TRC_ALLOC_CUSTOM_BUFFER(bufname) RecorderDataType bufname;\r
+ #elif (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)\r
+ #ifdef TRC_CFG_RTT_BUFFER_SIZE_UP /* J-Link RTT */\r
+ #define TRC_ALLOC_CUSTOM_BUFFER(bufname) char bufname [TRC_CFG_RTT_BUFFER_SIZE_UP]; /* Not static in this case, since declared in user code */\r
+ #else\r
+ #define TRC_ALLOC_CUSTOM_BUFFER(bufname) char bufname [(TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT) * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE)];\r
+ #endif\r
+ #endif\r
#else\r
-#define TRC_ALLOC_CUSTOM_BUFFER(bufname)\r
-#endif\r
+ #define TRC_ALLOC_CUSTOM_BUFFER(bufname)\r
#endif\r
\r
+/******************************************************************************\r
+* xTraceIsRecordingEnabled\r
+*\r
+* Returns true (1) if the recorder is enabled (i.e. is recording), otherwise 0.\r
+******************************************************************************/\r
+int xTraceIsRecordingEnabled(void);\r
+\r
+/*******************************************************************************\r
+* vTraceSetFilterGroup\r
+*\r
+* Sets the "filter group" to assign when creating RTOS objects, such as tasks,\r
+* queues, semaphores and mutexes. This together with vTraceSetFilterMask \r
+* allows you to control what events that are recorded, based on the \r
+* objects they refer to.\r
+*\r
+* There are 16 filter groups named FilterGroup0 .. FilterGroup15.\r
+*\r
+* Note: We don't recommend filtering out the Idle task, so make sure to call \r
+* vTraceSetFilterGroup just before initializing the RTOS, in order to assign\r
+* such "default" objects to the right Filter Group (typically group 0).\r
+*\r
+* Example:\r
+* \r
+* // Assign tasks T1 to FilterGroup0 (default)\r
+* <Create Task T1> \r
+*\r
+* // Assign Q1 and Q2 to FilterGroup1\r
+* vTraceSetFilterGroup(FilterGroup1);\r
+* <Create Queue Q1> \r
+* <Create Queue Q2>\r
+*\r
+* // Assigns Q3 to FilterGroup2\r
+* vTraceSetFilterGroup(FilterGroup2);\r
+* <Create Queue Q3>\r
+*\r
+* // Only include FilterGroup0 and FilterGroup2, exclude FilterGroup1 (Q1 and Q2) from the trace\r
+* vTraceSetFilterMask( FilterGroup0 | FilterGroup2 );\r
+*\r
+* // Assign the default RTOS objects (e.g. Idle task) to FilterGroup0\r
+* vTraceSetFilterGroup(FilterGroup0);\r
+* <Start the RTOS scheduler>\r
+*\r
+* Note that you may define your own names for the filter groups using\r
+* preprocessor definitions, to make the code easier to understand.\r
+*\r
+* Example:\r
+*\r
+* #define BASE FilterGroup0\r
+* #define USB_EVENTS FilterGroup1\r
+* #define CAN_EVENTS FilterGroup2\r
+*\r
+* Note that filtering per event type (regardless of object) is also available\r
+* in trcConfig.h.\r
+******************************************************************************/\r
+void vTraceSetFilterGroup(uint16_t filterGroup);\r
+\r
+/******************************************************************************\r
+* vTraceSetFilterMask\r
+*\r
+* Sets the "filter mask" that is used to filter the events by object. This can\r
+* be used to reduce the trace data rate, i.e., if your streaming interface is\r
+* a bottleneck or if you want longer snapshot traces without increasing the\r
+* buffer size.\r
+*\r
+* Note: There are two kinds of filters in the recorder. The other filter type\r
+* excludes all events of certain kinds (e.g., OS ticks). See trcConfig.h.\r
+*\r
+* The filtering is based on bitwise AND with the Filter Group ID, assigned\r
+* to RTOS objects such as tasks, queues, semaphores and mutexes. \r
+* This together with vTraceSetFilterGroup allows you to control what\r
+* events that are recorded, based on the objects they refer to.\r
+*\r
+* See example for vTraceSetFilterGroup.\r
+******************************************************************************/\r
+void vTraceSetFilterMask(uint16_t filterMask);\r
\r
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)\r
\r
* error. In that case, check xTraceGetLastError to get the error message.\r
* Any error message is also presented when opening a trace file.\r
*\r
-*\r
* Snapshot mode only!\r
******************************************************************************/\r
uint32_t uiTraceStart(void);\r
/*** INTERNAL SNAPSHOT FUNCTIONS *********************************************/\r
/*****************************************************************************/\r
\r
-#undef INCLUDE_xTaskGetSchedulerState\r
-#define INCLUDE_xTaskGetSchedulerState 1\r
-\r
-#undef INCLUDE_xTaskGetCurrentTaskHandle\r
-#define INCLUDE_xTaskGetCurrentTaskHandle 1\r
+#define TRC_UNUSED\r
\r
#ifndef TRC_CFG_INCLUDE_OBJECT_DELETE\r
#define TRC_CFG_INCLUDE_OBJECT_DELETE 0\r
#define TRC_CFG_INCLUDE_OSTICK_EVENTS 0\r
#endif\r
\r
-#define TRC_UNUSED\r
+/* This macro will create a task in the object table */\r
+#undef trcKERNEL_HOOKS_TASK_CREATE\r
+#define trcKERNEL_HOOKS_TASK_CREATE(SERVICE, CLASS, pxTCB) \\r
+ TRACE_SET_TASK_NUMBER(pxTCB); \\r
+ TRACE_SET_TASK_FILTER(pxTCB, CurrentFilterGroup); \\r
+ prvTraceSetObjectName(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_NAME(pxTCB)); \\r
+ prvTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_PRIORITY(pxTCB)); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));\r
\r
-#if (TRC_CFG_INCLUDE_OBJECT_DELETE == 1)\r
/* This macro will remove the task and store it in the event buffer */\r
#undef trcKERNEL_HOOKS_TASK_DELETE\r
-#define trcKERNEL_HOOKS_TASK_DELETE(SERVICE, pxTCB) \\r
- prvTraceStoreKernelCall(TRACE_GET_TASK_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxTCB), TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \\r
- prvTraceStoreObjectNameOnCloseEvent(TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \\r
- prvTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \\r
+#define trcKERNEL_HOOKS_TASK_DELETE(SERVICE, SERVICE_NAME, SERVICE_PROP, pxTCB) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \\r
+ prvTraceStoreObjectNameOnCloseEvent(SERVICE_NAME, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \\r
+ prvTraceStoreObjectPropertiesOnCloseEvent(SERVICE_PROP, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \\r
prvTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_PRIORITY(pxTCB)); \\r
prvTraceSetObjectState(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TASK_STATE_INSTANCE_NOT_ACTIVE); \\r
prvTraceFreeObjectHandle(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));\r
-#else /*(TRC_CFG_INCLUDE_OBJECT_DELETE == 1)*/\r
-#undef trcKERNEL_HOOKS_TASK_DELETE\r
-#define trcKERNEL_HOOKS_TASK_DELETE(SERVICE, pxTCB)\r
-#endif /*(TRC_CFG_INCLUDE_OBJECT_DELETE == 1)*/\r
\r
-#if (TRC_CFG_INCLUDE_OBJECT_DELETE == 1)\r
-/* This macro will remove the object and store it in the event buffer */\r
-#undef trcKERNEL_HOOKS_OBJECT_DELETE\r
-#define trcKERNEL_HOOKS_OBJECT_DELETE(SERVICE, CLASS, pxObject) \\r
- prvTraceStoreKernelCall(TRACE_GET_OBJECT_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \\r
- prvTraceStoreObjectNameOnCloseEvent(TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); \\r
- prvTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); \\r
- prvTraceFreeObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));\r
-#else /*TRC_CFG_INCLUDE_OBJECT_DELETE*/\r
-#undef trcKERNEL_HOOKS_OBJECT_DELETE\r
-#define trcKERNEL_HOOKS_OBJECT_DELETE(SERVICE, CLASS, pxObject)\r
-#endif /*TRC_CFG_INCLUDE_OBJECT_DELETE*/\r
-\r
-/* This macro will create a task in the object table */\r
-#undef trcKERNEL_HOOKS_TASK_CREATE\r
-#define trcKERNEL_HOOKS_TASK_CREATE(SERVICE, CLASS, pxTCB) \\r
- TRACE_SET_TASK_NUMBER(pxTCB) \\r
- prvTraceSetObjectName(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_NAME(pxTCB)); \\r
- prvTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_PRIORITY(pxTCB)); \\r
- prvTraceStoreKernelCall(TRACE_GET_TASK_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxTCB), TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));\r
-\r
-/* This macro will create a failed create call to create a task */\r
-#undef trcKERNEL_HOOKS_TASK_CREATE_FAILED\r
-#define trcKERNEL_HOOKS_TASK_CREATE_FAILED(SERVICE, CLASS) \\r
- prvTraceStoreKernelCall(TRACE_GET_TASK_EVENT_CODE(SERVICE, FAILED, CLASS, 0), TRACE_CLASS_TASK, 0);\r
\r
/* This macro will setup a task in the object table */\r
#undef trcKERNEL_HOOKS_OBJECT_CREATE\r
#define trcKERNEL_HOOKS_OBJECT_CREATE(SERVICE, CLASS, pxObject)\\r
TRACE_SET_OBJECT_NUMBER(CLASS, pxObject);\\r
+ TRACE_SET_OBJECT_FILTER(CLASS, pxObject, CurrentFilterGroup); \\r
prvMarkObjectAsUsed(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));\\r
- prvTraceStoreKernelCall(TRACE_GET_OBJECT_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCall(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \\r
prvTraceSetObjectState(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), 0);\r
\r
-/* This macro will create a failed create call to create an object */\r
-#undef trcKERNEL_HOOKS_OBJECT_CREATE_FAILED\r
-#define trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(SERVICE, CLASS, kernelClass) \\r
- prvTraceStoreKernelCall(TRACE_GET_CLASS_EVENT_CODE(SERVICE, FAILED, CLASS, kernelClass), TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass), 0);\r
+/* This macro will remove the object and store it in the event buffer */\r
+#undef trcKERNEL_HOOKS_OBJECT_DELETE\r
+#define trcKERNEL_HOOKS_OBJECT_DELETE(SERVICE, SERVICE_NAME, SERVICE_PROP, CLASS, pxObject) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCall(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \\r
+ prvTraceStoreObjectNameOnCloseEvent(SERVICE_NAME, TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); \\r
+ prvTraceStoreObjectPropertiesOnCloseEvent(SERVICE_PROP, TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); \\r
+ prvTraceFreeObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));\r
\r
/* This macro will create a call to a kernel service with a certain result, with an object as parameter */\r
#undef trcKERNEL_HOOKS_KERNEL_SERVICE\r
-#define trcKERNEL_HOOKS_KERNEL_SERVICE(SERVICE, RESULT, CLASS, pxObject) \\r
- prvTraceStoreKernelCall(TRACE_GET_OBJECT_EVENT_CODE(SERVICE, RESULT, CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));\r
+#define trcKERNEL_HOOKS_KERNEL_SERVICE(SERVICE, CLASS, pxObject) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCall(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));\r
+\r
+/* This macro will create a call to a kernel service with a certain result, with an object as parameter */\r
+#undef trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM\r
+#define trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(SERVICE, CLASS, pxObject, param) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCallWithParam(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), (uint32_t)param);\r
+\r
+/* This macro will create a call to a kernel service with a certain result, with an object as parameter */\r
+#undef trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY\r
+#define trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(SERVICE, param) \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCallWithNumericParamOnly(SERVICE, (uint32_t)param);\r
+\r
+/* This macro will create a call to a kernel service with a certain result, with an object as parameter */\r
+#undef trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR\r
+#define trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(SERVICE, CLASS, pxObject) \\r
+ if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCall(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));\r
+\r
+/* This macro will create a call to a kernel service with a certain result, with an object as parameter */\r
+#undef trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM_FROM_ISR\r
+#define trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM_FROM_ISR(SERVICE, CLASS, pxObject, param) \\r
+ if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCallWithParam(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), (uint32_t)param);\r
+\r
+/* This macro will create a call to a kernel service with a certain result, with an object as parameter */\r
+#undef trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY_FROM_ISR\r
+#define trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY_FROM_ISR(SERVICE, param) \\r
+ prvTraceStoreKernelCallWithNumericParamOnly(SERVICE, (uint32_t)param);\r
\r
/* This macro will set the state for an object */\r
#undef trcKERNEL_HOOKS_SET_OBJECT_STATE\r
#define trcKERNEL_HOOKS_SET_OBJECT_STATE(CLASS, pxObject, STATE) \\r
- prvTraceSetObjectState(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), STATE);\r
+ prvTraceSetObjectState(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), (uint8_t)STATE);\r
\r
/* This macro will flag a certain task as a finished instance */\r
#undef trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED\r
#define trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED() \\r
- prvTraceSetTaskInstanceFinished(TRACE_GET_TASK_NUMBER(TRACE_GET_CURRENT_TASK()));\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ prvTraceSetTaskInstanceFinished(TRACE_GET_TASK_NUMBER(TRACE_GET_CURRENT_TASK()));\r
\r
#if (TRC_CFG_INCLUDE_READY_EVENTS == 1)\r
/* This macro will create an event to indicate that a task became Ready */\r
#undef trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE\r
#define trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB) \\r
- prvTraceStoreTaskReady(TRACE_GET_TASK_NUMBER(pxTCB));\r
+ if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \\r
+ prvTraceStoreTaskReady(TRACE_GET_TASK_NUMBER(pxTCB));\r
#else /*(TRC_CFG_INCLUDE_READY_EVENTS == 1)*/\r
#undef trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE\r
#define trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB)\r
/* This macro will update the internal tick counter and call prvTracePortGetTimeStamp(0) to update the internal counters */\r
#undef trcKERNEL_HOOKS_INCREMENT_TICK\r
#define trcKERNEL_HOOKS_INCREMENT_TICK() \\r
- { extern uint32_t uiTraceTickCount; uiTraceTickCount++; prvTracePortGetTimeStamp(0); }\r
+ { \\r
+ extern uint32_t uiTraceTickCount; \\r
+ uiTraceTickCount++; \\r
+ prvTracePortGetTimeStamp(0); \\r
+ }\r
\r
#if (TRC_CFG_INCLUDE_OSTICK_EVENTS == 1)\r
/* This macro will create an event indicating that the OS tick count has increased */\r
/* This macro will create a task switch event to the currently executing task */\r
#undef trcKERNEL_HOOKS_TASK_SWITCH\r
#define trcKERNEL_HOOKS_TASK_SWITCH( pxTCB ) \\r
- prvTraceStoreTaskswitch(TRACE_GET_TASK_NUMBER(pxTCB));\r
+ if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \\r
+ prvTraceStoreTaskswitch(TRACE_GET_TASK_NUMBER(pxTCB));\r
\r
/* This macro will create an event to indicate that the task has been suspended */\r
#undef trcKERNEL_HOOKS_TASK_SUSPEND\r
#define trcKERNEL_HOOKS_TASK_SUSPEND(SERVICE, pxTCB) \\r
- prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \\r
prvTraceSetTaskInstanceFinished((uint8_t)TRACE_GET_TASK_NUMBER(pxTCB));\r
\r
/* This macro will create an event to indicate that a task has called a wait/delay function */\r
#undef trcKERNEL_HOOKS_TASK_DELAY\r
#define trcKERNEL_HOOKS_TASK_DELAY(SERVICE, pxTCB, xValue) \\r
- prvTraceStoreKernelCallWithNumericParamOnly(SERVICE, xValue); \\r
- prvTraceSetTaskInstanceFinished((uint8_t)TRACE_GET_TASK_NUMBER(pxTCB));\r
+ if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \\r
+ { \\r
+ prvTraceStoreKernelCallWithNumericParamOnly(SERVICE, xValue); \\r
+ prvTraceSetTaskInstanceFinished((uint8_t)TRACE_GET_TASK_NUMBER(pxTCB)); \\r
+ }\r
\r
/* This macro will create an event to indicate that a task has gotten its priority changed */\r
#undef trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE\r
#define trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(SERVICE, pxTCB, uxNewPriority) \\r
- prvTraceStoreKernelCallWithParam(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), prvTraceGetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)));\\r
- prvTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), (uint8_t)uxNewPriority);\r
+ if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \\r
+ { \\r
+ prvTraceStoreKernelCallWithParam(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), prvTraceGetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)));\\r
+ prvTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), (uint8_t)uxNewPriority); \\r
+ }\r
\r
/* This macro will create an event to indicate that the task has been resumed */\r
#undef trcKERNEL_HOOKS_TASK_RESUME\r
#define trcKERNEL_HOOKS_TASK_RESUME(SERVICE, pxTCB) \\r
- prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));\r
- \r
-#undef trcKERNEL_HOOKS_TIMER_EVENT\r
-#define trcKERNEL_HOOKS_TIMER_EVENT(SERVICE, pxTimer) \\r
- prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(pxTimer));\r
-\r
-/* This macro will create a timer in the object table and assign the timer a trace handle (timer number).*/\r
-#undef trcKERNEL_HOOKS_TIMER_CREATE\r
-#define trcKERNEL_HOOKS_TIMER_CREATE(SERVICE, pxTimer) \\r
-TRACE_SET_TIMER_NUMBER(pxTimer); \\r
-prvTraceSetObjectName(TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(pxTimer), TRACE_GET_TIMER_NAME(pxTimer)); \\r
-prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(pxTimer));\r
-\r
-#undef trcKERNEL_HOOKS_TIMER_DELETE\r
-#define trcKERNEL_HOOKS_TIMER_DELETE(SERVICE, pxTimer) \\r
-prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(pxTimer)); \\r
-prvTraceStoreObjectNameOnCloseEvent(TRACE_GET_TIMER_NUMBER(pxTimer), TRACE_CLASS_TIMER); \\r
-prvTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_TIMER_NUMBER(pxTimer), TRACE_CLASS_TIMER); \\r
-prvTraceFreeObjectHandle(TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(pxTimer));\r
+ if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \\r
+ if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));\r
+\r
+#undef trcKERNEL_HOOKS_TASK_RESUME_FROM_ISR\r
+#define trcKERNEL_HOOKS_TASK_RESUME_FROM_ISR(SERVICE, pxTCB) \\r
+ if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \\r
+ prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));\r
\r
#if !defined TRC_CFG_INCLUDE_READY_EVENTS || TRC_CFG_INCLUDE_READY_EVENTS == 1\r
void prvTraceSetReadyEventsEnabled(int status);\r
\r
void prvMarkObjectAsUsed(traceObjectClass objectclass, traceHandle handle);\r
\r
-\r
-#if (TRC_CFG_INCLUDE_OBJECT_DELETE == 1)\r
-\r
-void prvTraceStoreObjectNameOnCloseEvent(traceHandle handle,\r
+void prvTraceStoreObjectNameOnCloseEvent(uint8_t evtcode, traceHandle handle,\r
traceObjectClass objectclass);\r
\r
-void prvTraceStoreObjectPropertiesOnCloseEvent(traceHandle handle,\r
+void prvTraceStoreObjectPropertiesOnCloseEvent(uint8_t evtcode, traceHandle handle,\r
traceObjectClass objectclass);\r
-#endif\r
\r
/* Internal constants for task state */\r
#define TASK_STATE_INSTANCE_NOT_ACTIVE 0\r
\r
#if (TRC_CFG_INCLUDE_ISR_TRACING == 0)\r
\r
-//void prvTraceIncreaseISRActive(void);\r
-\r
-//void prvTraceDecreaseISRActive(void);\r
#undef vTraceSetISRProperties\r
#define vTraceSetISRProperties(handle, name, priority)\r
\r
#define trcCRITICAL_SECTION_END_ON_CORTEX_M_ONLY() recorder_busy--;\r
#endif\r
\r
-/* Structure to handle the exclude flags for all objects and tasks. We add some extra objects since index 0 is not used for each object class. */\r
-extern uint8_t trcExcludedObjects[(TRACE_KERNEL_OBJECT_COUNT + TRACE_NCLASSES) / 8 + 1];\r
-\r
-/* Structure to handle the exclude flags for all event codes */\r
-extern uint8_t trcExcludedEventCodes[NEventCodes / 8 + 1];\r
-\r
/******************************************************************************\r
* ObjectHandleStack\r
* This data-structure is used to provide a mechanism for 1-byte trace object\r
* each object class active at any given moment. There can be more "historic"\r
* objects, that have been deleted - that number is only limited by the size of\r
* the symbol table.\r
+ *\r
* Note that handle zero (0) is not used, it is a code for an invalid handle.\r
*\r
* This data structure keeps track of the FREE handles, not the handles in use.\r
* is not a valid handle, that is a signal of additional handles needed.\r
* If a zero is received when popping a new handle, it is replaced by the\r
* index of the popped handle instead.\r
- *\r
*****************************************************************************/\r
typedef struct\r
{\r
* represent the current state. If a property is changed during runtime, the OLD\r
* value should be stored in the trace buffer, not the new value (since the new\r
* value is found in the Object Property Table).\r
+ *\r
* For close events this mechanism is the old names are stored in the symbol\r
* table), for "priority set" (the old priority is stored in the event data)\r
* and for "isActive", where the value decides if the task switch event type\r
uint32_t nextFreeSymbolIndex;\r
\r
/* Size rounded up to closest multiple of 4, to avoid alignment issues*/\r
- uint8_t symbytes[4*((TRC_CFG_SYMBOL_TABLE_SIZE+3)/4)];\r
+ uint8_t symbytes[4*(((TRC_CFG_SYMBOL_TABLE_SIZE)+3)/4)];\r
\r
/* Used for lookups - Up to 64 linked lists within the symbol table\r
connecting all entries with the same 6 bit checksum.\r
typedef struct\r
{\r
uint8_t type;\r
- uint8_t objHandle; /* the handle of the closed object */\r
- uint16_t symbolIndex; /* the name of the closed object */\r
+ uint8_t objHandle; /* the handle of the closed object */\r
+ uint16_t symbolIndex; /* the name of the closed object */\r
} ObjCloseNameEvent;\r
\r
typedef struct\r
uint8_t padding1;\r
uint8_t padding2;\r
uint8_t padding3;\r
- ChannelFormatPair channels[TRC_CFG_UB_CHANNELS+1];\r
- uint8_t channelBuffer[(TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE + 3) & 0xFFFFFFFC]; /* 1 byte per slot, with padding for 4 byte alignment */\r
- uint8_t dataBuffer[TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE * 4]; /* 4 bytes per slot */\r
+ ChannelFormatPair channels[(TRC_CFG_UB_CHANNELS)+1];\r
+ uint8_t channelBuffer[((TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE) + 3) & 0xFFFFFFFC]; /* 1 byte per slot, with padding for 4 byte alignment */\r
+ uint8_t dataBuffer[(TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE) * 4]; /* 4 bytes per slot */\r
\r
} UserEventBuffer;\r
#endif\r
int32_t debugMarker3;\r
\r
/* The event data, in 4-byte records */\r
- uint8_t eventData[ TRC_CFG_EVENT_BUFFER_SIZE * 4 ];\r
+ uint8_t eventData[ (TRC_CFG_EVENT_BUFFER_SIZE) * 4 ];\r
\r
#if (TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER == 1)\r
UserEventBuffer userEventBuffer;\r
RecorderDataPtr->ObjectPropertyTable.objbytes[uiIndexOfObject(handle, objectclass) \\r
+ RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[objectclass] + 1]\r
\r
-#define TRACE_SET_FLAG_ISEXCLUDED(flags, bitIndex) flags[(bitIndex) >> 3] |= (1 << ((bitIndex) & 7))\r
-#define TRACE_CLEAR_FLAG_ISEXCLUDED(flags, bitIndex) flags[(bitIndex) >> 3] &= (uint8_t)(~(1 << ((bitIndex) & 7)))\r
-#define TRACE_GET_FLAG_ISEXCLUDED(flags, bitIndex) (flags[(bitIndex) >> 3] & (1 << ((bitIndex) & 7)))\r
-\r
-#define TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(eventCode) TRACE_SET_FLAG_ISEXCLUDED(trcExcludedEventCodes, eventCode)\r
-#define TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(eventCode) TRACE_CLEAR_FLAG_ISEXCLUDED(trcExcludedEventCodes, eventCode)\r
-#define TRACE_GET_EVENT_CODE_FLAG_ISEXCLUDED(eventCode) TRACE_GET_FLAG_ISEXCLUDED(trcExcludedEventCodes, eventCode)\r
-\r
/* DEBUG ASSERTS */\r
#if defined TRC_CFG_USE_TRACE_ASSERT && TRC_CFG_USE_TRACE_ASSERT != 0\r
#define TRACE_ASSERT(eval, msg, defRetVal) \\r
\r
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)\r
\r
+/******************************************************************************\r
+ * Default values for STREAM PORT macros\r
+ *\r
+ * As a normal user, this is nothing you don't need to bother about. This is\r
+ * only important if you want to define your own custom streaming interface.\r
+ *\r
+ * You may override these in your own trcStreamingPort.h to create a custom\r
+ * stream port, and thereby stream the trace on any host-target interface.\r
+ * These default values are suitable for most cases, except the J-Link port. \r
+ ******************************************************************************/\r
+\r
+/******************************************************************************\r
+ * TRC_STREAM_PORT_USE_INTERNAL_BUFFER\r
+ *\r
+ * There are two kinds of stream ports, those that store the event to the \r
+ * internal buffer (with periodic flushing by the TzCtrl task) and those that\r
+ * write directly to the streaming interface. Most stream ports use the \r
+ * recorder's internal buffer, except for the SEGGER J-Link port (also uses a\r
+ * RAM buffer, but one defined in the SEGGER code).\r
+ *\r
+ * If the stream port (trcStreamingPort.h) defines this as zero (0), it is \r
+ * expected to transmit the data directly using TRC_STREAM_PORT_COMMIT_EVENT.\r
+ * Otherwise it is expected that the trace data is stored in the internal buffer\r
+ * and the TzCtrl task will then send the buffer pages when they become full.\r
+ ******************************************************************************/\r
+#ifndef TRC_STREAM_PORT_USE_INTERNAL_BUFFER\r
+#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 1\r
+#endif\r
+\r
+ /******************************************************************************\r
+ * TRC_STREAM_PORT_ON_TRACE_BEGIN\r
+ *\r
+ * Defining any actions needed in the stream port when the recording is activated.\r
+ *******************************************************************************/\r
+#ifndef TRC_STREAM_PORT_ON_TRACE_BEGIN\r
+ #define TRC_STREAM_PORT_ON_TRACE_BEGIN() /* Do nothing */\r
+#endif\r
+\r
+ /******************************************************************************\r
+ * TRC_STREAM_PORT_ON_TRACE_BEGIN\r
+ *\r
+ * Defining any actions needed in the stream port when the tracing stops.\r
+ * Empty by default.\r
+ *******************************************************************************/\r
+#ifndef TRC_STREAM_PORT_ON_TRACE_END\r
+#define TRC_STREAM_PORT_ON_TRACE_END() /* Do nothing */\r
+#endif\r
+\r
+ /******************************************************************************\r
+ * TRC_STREAM_PORT_ALLOCATE_EVENT\r
+ *\r
+ * This macro is used to allocate memory for each event record, just before\r
+ * assigning the record fields.\r
+ * Depending on "TRC_STREAM_PORT_USE_INTERNAL_BUFFER", this either allocates\r
+ * space in the paged event buffer, or on the local stack. In the latter case,\r
+ * the COMMIT event is used to write the data to the streaming interface.\r
+ ******************************************************************************/\r
+#ifndef TRC_STREAM_PORT_ALLOCATE_EVENT\r
+#if (TRC_STREAM_PORT_USE_INTERNAL_BUFFER == 1)\r
+ #define TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) _type* _ptrData; _ptrData = (_type*)prvPagedEventBufferGetWritePointer(_size);\r
+#else\r
+ #define TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) _type _tmpArray[_size / sizeof(_type)]; _type* _ptrData = _tmpArray;\r
+#endif\r
+#endif\r
+\r
+ /******************************************************************************\r
+ * TRC_STREAM_PORT_ALLOCATE_DYNAMIC_EVENT\r
+ *\r
+ * This macro is used to allocate memory for each event record, just before\r
+ * assigning the record fields. \r
+ * This has the same purpose as TRC_STREAM_PORT_ALLOCATE_EVENT and by default\r
+ * it has the same definition as TRC_STREAM_PORT_ALLOCATE_EVENT. This is used\r
+ * for events carrying variable-sized payload, such as strings.\r
+ * In the SEGGER RTT port, we need this in order to make a worst-case\r
+ * allocation on the stack. \r
+ ******************************************************************************/\r
+#ifndef TRC_STREAM_PORT_ALLOCATE_DYNAMIC_EVENT\r
+#if (TRC_STREAM_PORT_USE_INTERNAL_BUFFER == 1)\r
+ #define TRC_STREAM_PORT_ALLOCATE_DYNAMIC_EVENT(_type, _ptrData, _size) TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) /* We do the same thing as for non-dynamic event sizes */\r
+#else\r
+ #define TRC_STREAM_PORT_ALLOCATE_DYNAMIC_EVENT(_type, _ptrData, _size) _type _tmpArray[sizeof(largestEventType) / sizeof(_type)]; _type* _ptrData = _tmpArray;\r
+#endif\r
+#endif\r
+\r
+ /******************************************************************************\r
+ * TRC_STREAM_PORT_COMMIT_EVENT\r
+ *\r
+ * The COMMIT macro is used to write a single event record directly to the \r
+ * streaming inteface, without first storing the event in the internal buffer.\r
+ * This is currently only used in the SEGGER J-Link RTT port. \r
+ *\r
+ * This relies on the TRC_STREAM_PORT_WRITE_DATA macro, defined in by the \r
+ * stream port in trcStreamingPort.h. The COMMIT macro calls \r
+ * prvTraceWarning(TRC_STREAM_PORT_WRITE_DATA) if a non-zero value is returned\r
+ * from TRC_STREAM_PORT_WRITE_DATA. If zero (0) is returned, it is assumed \r
+ * that all data was successfully written.\r
+ *\r
+ * In ports using the internal buffer, this macro has no purpose as the events\r
+ * are written to the internal buffer instead. They are then flushed to the\r
+ * streaming interface in the TzCtrl task using TRC_STREAM_PORT_WRITE_DATA.\r
+ ******************************************************************************/\r
+#ifndef TRC_STREAM_PORT_COMMIT_EVENT\r
+#if (TRC_STREAM_PORT_USE_INTERNAL_BUFFER == 1)\r
+ #define TRC_STREAM_PORT_COMMIT_EVENT(_ptrData, _size) /* Not used */\r
+#else\r
+ #define TRC_STREAM_PORT_COMMIT_EVENT(_ptrData, _size) \\r
+ { \\r
+ if (TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, 0) != 0)\\r
+ prvTraceWarning(PSF_WARNING_STREAM_PORT_WRITE); \\r
+ }\r
+#endif\r
+#endif\r
+\r
+/******************************************************************************\r
+ * TRC_STREAM_PORT_READ_DATA (defined in trcStreamingPort.h)\r
+ *\r
+ * Defining how to read data from host (commands from Tracealyzer).\r
+ *\r
+ * If there is no direct interface to host (e.g., if streaming to a file\r
+ * system) this should be defined as 0. Instead use vTraceEnable(TRC_START) and\r
+ * vTraceStop() to control the recording from target.\r
+ *\r
+ * Parameters:\r
+ *\r
+ * - _ptrData: a pointer to a data buffer, where the received data shall be \r
+ * stored (TracealyzerCommandType*).\r
+ *\r
+ * - _size: the number of bytes to read (int).\r
+ *\r
+ * - _ptrBytesRead: a pointer to an integer (int), that should be assigned\r
+ * with the number of bytes that was received.\r
+ *\r
+ * Example:\r
+ * \r
+ * int32_t myRead(void* ptrData, uint32_t size, int32_t* ptrBytesRead);\r
+ * \r
+ * #define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) \\r
+ * myRead(_ptrData, _size, _ptrBytesRead)\r
+ *\r
+ * Your "myRead" function should return 0 if successful, i.e. if at least some \r
+ * bytes were received. A non-zero value should be returned if the streaming\r
+ * interface returned an error (e.g. a closed socket), which results in the\r
+ * recorder calling prvTraceWarning with the error code \r
+ * PSF_WARNING_STREAM_PORT_WRITE.\r
+ *\r
+ * If developing your own custom stream port and using the default internal\r
+ * buffer, it is important that the _ptrBytesRead parameter is assigned\r
+ * correctly by "myRead", i.e. with the number of bytes actually written. \r
+ * Otherwise the data stream may get out of sync in case the streaming interface\r
+ * can't swallow all data at once. \r
+ ******************************************************************************/\r
+#ifndef TRC_STREAM_PORT_READ_DATA\r
+#error "No definition for TRC_STREAM_PORT_READ_DATA (should be in trcStreamingPort.h)"\r
+#endif\r
+\r
+/******************************************************************************\r
+ * TRC_STREAM_PORT_WRITE_DATA (defined in trcStreamingPort.h)\r
+ *\r
+ * Defining how to write trace data to the streaming interface. \r
+ *\r
+ * Parameters:\r
+ *\r
+ * - _ptrData: a pointer (void*) to the data to write.\r
+ *\r
+ * - _size: the number of bytes to write (uint32_t).\r
+ *\r
+ * - _ptrBytesWritten: a pointer to an integer (int32_t), that should be\r
+ * assigned with the number of bytes actually written.\r
+ *\r
+ * Example:\r
+ *\r
+ * int32_t myWrite(void* ptrData, uint32_t size, int32_t* ptrBytesWritten);\r
+ *\r
+ * #define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesWritten) \\r
+ * myWrite(_ptrData, _size, _ptrBytesWritten) \r
+ * \r
+ * Your "myWrite" function should return 0 if successful, i.e. if at least some \r
+ * bytes were sent. A non-zero value should be returned if the streaming interface\r
+ * returned an error (e.g. a closed socket), which results in the recorder calling\r
+ * prvTraceWarning with the error code PSF_WARNING_STREAM_PORT_WRITE.\r
+ * \r
+ * If developing your own custom stream port and using the default internal\r
+ * buffer, it is important that the _ptrBytesWritten parameter is assigned\r
+ * correctly by "myWrite", i.e. with the number of bytes actually written. \r
+ * Otherwise the data stream may get out of sync in case the streaming interface\r
+ * can't swallow all data at once.\r
+ *\r
+ * Assuming TRC_STREAM_PORT_USE_INTERNAL_BUFFER is 1 (default), the TzCtrl task\r
+ * will use this macro to send one buffer page at a time. In case all data can't\r
+ * be written at once (if _ptrBytesWritten is less than _size), the TzCtrl task\r
+ * is smart enough to make repeated calls (with updated parameters) in order to \r
+ * send the remaining data.\r
+ * \r
+ * However, if TRC_STREAM_PORT_USE_INTERNAL_BUFFER is 0, this is used from the\r
+ * COMMIT macro, directly in the "event functions". In that case, the\r
+ * _ptrBytesWritten parameter will be NULL and should be ignored by the write\r
+ * function. In this case, it is assumed that all data can be sent in a single\r
+ * call, otherwise the write function should return a non-zero error code.\r
+ ******************************************************************************/\r
+#ifndef TRC_STREAM_PORT_WRITE_DATA\r
+#error "No definition for TRC_STREAM_PORT_WRITE_DATA (should be in trcStreamingPort.h)"\r
+#endif\r
+\r
+/******************************************************************************\r
+* Data structure declaration, depending on TRC_CFG_RECORDER_BUFFER_ALLOCATION\r
+*******************************************************************************/\r
+#if (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC)\r
+ \r
+ /* Static allocation. */\r
+ \r
+ /* If not defined in trcStreamingPort.h */\r
+ #ifndef TRC_STREAM_PORT_ALLOCATE_FIELDS\r
+ #define TRC_STREAM_PORT_ALLOCATE_FIELDS() \\r
+ char _TzTraceData[(TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT) * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE)]; \r
+ extern char _TzTraceData[(TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT) * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE)];\r
+ #endif\r
+ \r
+ /* If not defined in trcStreamingPort.h */\r
+ #ifndef TRC_STREAM_PORT_MALLOC\r
+ #define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */\r
+ #endif\r
+#else\r
+ /* For Dynamic or Custom Allocation mode */\r
+ \r
+ /* If not defined in trcStreamingPort.h */\r
+ #ifndef TRC_STREAM_PORT_ALLOCATE_FIELDS\r
+ #define TRC_STREAM_PORT_ALLOCATE_FIELDS() char* _TzTraceData = NULL;\r
+ extern char* _TzTraceData;\r
+ #endif\r
+ \r
+ /* If not defined in trcStreamingPort.h */\r
+ #ifndef TRC_STREAM_PORT_MALLOC\r
+ #if (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC)\r
+ #define TRC_STREAM_PORT_MALLOC() \\r
+ _TzTraceData = TRC_PORT_MALLOC((TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT) * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE));\r
+ extern char* _TzTraceData;\r
+ #else\r
+ #define TRC_STREAM_PORT_MALLOC() /* Custom allocation. Not used. */\r
+ #endif\r
+ #endif\r
+#endif\r
+\r
+#ifndef TRC_STREAM_PORT_INIT\r
+ #define TRC_STREAM_PORT_INIT() \\r
+ TRC_STREAM_PORT_MALLOC(); /* Empty if static allocation mode */ \\r
+ prvPagedEventBufferInit(_TzTraceData);\r
+#endif\r
+\r
+\r
+/* Signal an error. */\r
+void prvTraceError(int errCode);\r
+\r
+/* Signal an warning (does not stop the recorder). */\r
+void prvTraceWarning(int errCode);\r
+\r
+/******************************************************************************/\r
+/*** ERROR AND WARNING CODES (check using xTraceGetLastError) *****************/\r
+/******************************************************************************/\r
+\r
+#define PSF_ERROR_NONE 0\r
+#define PSF_ERROR_EVENT_CODE_TOO_LARGE 1\r
+#define PSF_ERROR_ISR_NESTING_OVERFLOW 2\r
+#define PSF_ERROR_DWT_NOT_SUPPORTED 3\r
+#define PSF_ERROR_DWT_CYCCNT_NOT_SUPPORTED 4\r
+#define PSF_ERROR_TZCTRLTASK_NOT_CREATED 5\r
+\r
+#define PSF_WARNING_SYMBOL_TABLE_SLOTS 101\r
+#define PSF_WARNING_SYMBOL_MAX_LENGTH 102\r
+#define PSF_WARNING_OBJECT_DATA_SLOTS 103\r
+#define PSF_WARNING_STRING_TOO_LONG 104\r
+#define PSF_WARNING_STREAM_PORT_READ 105\r
+#define PSF_WARNING_STREAM_PORT_WRITE 106\r
+\r
/******************************************************************************/\r
/*** INTERNAL STREAMING FUNCTIONS *********************************************/\r
/******************************************************************************/\r
void* prvPagedEventBufferGetWritePointer(int sizeOfEvent);\r
\r
/* Transfer a full buffer page */\r
-int32_t prvPagedEventBufferTransfer(int32_t(*writeFunc)(void* data, uint32_t size, int32_t* ptrBytesWritten), int32_t* nofBytes);\r
-\r
-/* Resets the paged event buffer */\r
-void prvPagedEventBufferReset(void);\r
+uint32_t prvPagedEventBufferTransfer(void);\r
\r
/* The data structure for commands (a bit overkill) */\r
typedef struct\r
/* Executed the received command (Start or Stop) */\r
void prvProcessCommand(TracealyzerCommandType* cmd);\r
\r
+#define vTraceSetStopHook(x)\r
\r
#endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/\r
\r
#define vTraceChannelPrint(label)\r
#define vTraceUBData(label, ...)\r
\r
+#define vTraceSetFilterGroup(x)\r
+#define vTraceSetFilterMask(x)\r
+\r
#define prvTraceSetReadyEventsEnabled(status)\r
\r
#define vTraceExcludeTask(handle)\r
#define TRC_ALLOC_CUSTOM_BUFFER(bufname)\r
#endif\r
\r
+#define xTraceIsRecordingEnabled() (0)\r
+\r
+#define vTraceSetStopHook(x)\r
+\r
#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/\r
\r
#ifdef __cplusplus\r
-/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+/*******************************************************************************\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* trcConfig.h\r
* Read more at http://percepio.com/2016/10/05/rtos-tracing/\r
*\r
* Terms of Use\r
- * This file is part of the trace recorder library (RECORDER), which is the \r
+ * This file is part of the trace recorder library (RECORDER), which is the\r
* intellectual property of Percepio AB (PERCEPIO) and provided under a\r
* license as follows.\r
* The RECORDER may be used free of charge for the purpose of recording data\r
* You may distribute the RECORDER in its original source code form, assuming\r
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are\r
* allowed to distribute the RECORDER with minor modifications intended for\r
- * configuration or porting of the RECORDER, e.g., to allow using it on a \r
+ * configuration or porting of the RECORDER, e.g., to allow using it on a\r
* specific processor, processor family or with a specific communication\r
* interface. Any such modifications should be documented directly below\r
- * this comment block. \r
+ * this comment block.\r
*\r
* Disclaimer\r
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty\r
- * as to its use or performance. PERCEPIO does not and cannot warrant the \r
+ * as to its use or performance. PERCEPIO does not and cannot warrant the\r
* performance or results you may obtain by using the RECORDER or documentation.\r
* PERCEPIO make no warranties, express or implied, as to noninfringement of\r
* third party rights, merchantability, or fitness for any particular purpose.\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2016.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
- \r
+\r
#ifndef TRC_CONFIG_H\r
#define TRC_CONFIG_H\r
\r
\r
/******************************************************************************\r
* Include of processor header file\r
- * \r
- * Here you may need to include the header file for your processor. This is \r
+ *\r
+ * Here you may need to include the header file for your processor. This is\r
* required at least for the ARM Cortex-M port, that uses the ARM CMSIS API.\r
* Try that in case of build problems. Otherwise, remove the #error line below.\r
*****************************************************************************/\r
* All ARM Cortex-M MCUs are supported by "TRC_HARDWARE_PORT_ARM_Cortex_M".\r
* This port uses the DWT cycle counter for Cortex-M3/M4/M7 devices, which is\r
* available on most such devices. In case your device don't have DWT support,\r
- * you will get an error message opening the trace. In that case, you may \r
+ * you will get an error message opening the trace. In that case, you may\r
* force the recorder to use SysTick timestamping instead, using this define:\r
*\r
* #define TRC_CFG_ARM_CM_USE_SYSTICK\r
*\r
* For ARM Cortex-M0/M0+ devices, SysTick mode is used automatically.\r
*\r
- * See trcHardwarePort.h for available ports and information on how to \r
+ * See trcHardwarePort.h for available ports and information on how to\r
* define your own port, if not already present.\r
******************************************************************************/\r
#define TRC_CFG_HARDWARE_PORT TRC_HARDWARE_PORT_NOT_SET\r
*\r
* Specify what recording mode to use. Snapshot means that the data is saved in\r
* an internal RAM buffer, for later upload. Streaming means that the data is\r
- * transferred continuously to the host PC. \r
+ * transferred continuously to the host PC.\r
*\r
* For more information, see http://percepio.com/2016/10/05/rtos-tracing/\r
* and the Tracealyzer User Manual.\r
******************************************************************************/\r
#define TRC_CFG_RECORDER_MODE TRC_RECORDER_MODE_SNAPSHOT\r
\r
+/******************************************************************************\r
+ * TRC_CFG_FREERTOS_VERSION\r
+ *\r
+ * Specify what version of FreeRTOS that is used (don't change unless using the\r
+ * trace recorder library with an older version of FreeRTOS).\r
+ *\r
+ * TRC_FREERTOS_VERSION_7_3 If using FreeRTOS v7.3.x\r
+ * TRC_FREERTOS_VERSION_7_4 If using FreeRTOS v7.4.x \r
+ * TRC_FREERTOS_VERSION_7_5_OR_7_6 If using FreeRTOS v7.5.0 - v7.6.0\r
+ * TRC_FREERTOS_VERSION_8_X If using FreeRTOS v8.X.X\r
+ * TRC_FREERTOS_VERSION_9_0_0 If using FreeRTOS v9.0.0\r
+ * TRC_FREERTOS_VERSION_9_0_1 If using FreeRTOS v9.0.1\r
+ * TRC_FREERTOS_VERSION_9_0_2 If using FreeRTOS v9.0.2\r
+ * TRC_FREERTOS_VERSION_10_0_0 If using FreeRTOS v10.0.0 or later\r
+ *****************************************************************************/\r
+#define TRC_CFG_FREERTOS_VERSION TRC_FREERTOS_VERSION_10_0_0\r
+\r
+/*******************************************************************************\r
+ * TRC_CFG_SCHEDULING_ONLY\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * If this setting is enabled (= 1), only scheduling events are recorded.\r
+ * If disabled (= 0), all events are recorded (unless filtered in other ways).\r
+ *\r
+ * Default value is 0 (= include additional events).\r
+ ******************************************************************************/\r
+#define TRC_CFG_SCHEDULING_ONLY 0\r
+\r
+ /******************************************************************************\r
+ * TRC_CFG_INCLUDE_MEMMANG_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * This controls if malloc and free calls should be traced. Set this to zero (0)\r
+ * to exclude malloc/free calls, or one (1) to include such events in the trace.\r
+ *\r
+ * Default value is 1.\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_MEMMANG_EVENTS 1\r
+\r
+ /******************************************************************************\r
+ * TRC_CFG_INCLUDE_USER_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * If this is zero (0), all code related to User Events is excluded in order \r
+ * to reduce code size. Any attempts of storing User Events are then silently\r
+ * ignored.\r
+ *\r
+ * User Events are application-generated events, like "printf" but for the \r
+ * trace log, generated using vTracePrint and vTracePrintF. \r
+ * The formatting is done on host-side, by Tracealyzer. User Events are \r
+ * therefore much faster than a console printf and can often be used\r
+ * in timing critical code without problems.\r
+ *\r
+ * Note: In streaming mode, User Events are used to provide error messages\r
+ * and warnings from the recorder (in case of incorrect configuration) for\r
+ * display in Tracealyzer. Disabling user events will also disable these\r
+ * warnings. You can however still catch them by calling xTraceGetLastError\r
+ * or by putting breakpoints in prvTraceError and prvTraceWarning.\r
+ *\r
+ * Default value is 1.\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_USER_EVENTS 1\r
+\r
+ /*****************************************************************************\r
+ * TRC_CFG_INCLUDE_ISR_TRACING\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * If this is zero (0), the code for recording Interrupt Service Routines is\r
+ * excluded, in order to reduce code size.\r
+ *\r
+ * Default value is 1.\r
+ *\r
+ * Note: tracing ISRs requires that you insert calls to vTraceStoreISRBegin\r
+ * and vTraceStoreISREnd in your interrupt handlers.\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_ISR_TRACING 1\r
+\r
+ /*****************************************************************************\r
+ * TRC_CFG_INCLUDE_READY_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * If one (1), events are recorded when tasks enter scheduling state "ready".\r
+ * This allows Tracealyzer to show the initial pending time before tasks enter\r
+ * the execution state, and present accurate response times.\r
+ * If zero (0), "ready events" are not created, which allows for recording\r
+ * longer traces in the same amount of RAM.\r
+ *\r
+ * Default value is 1.\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_READY_EVENTS 1\r
+\r
+ /*****************************************************************************\r
+ * TRC_CFG_INCLUDE_OSTICK_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * If this is one (1), events will be generated whenever the OS clock is\r
+ * increased. If zero (0), OS tick events are not generated, which allows for\r
+ * recording longer traces in the same amount of RAM.\r
+ *\r
+ * Default value is 1.\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_OSTICK_EVENTS 1\r
+\r
+ /*****************************************************************************\r
+ * TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * If this is zero (0), the trace will exclude any "event group" events.\r
+ *\r
+ * Default value is 0 (excluded) since dependent on event_groups.c\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS 0\r
+\r
+ /*****************************************************************************\r
+ * TRC_CFG_INCLUDE_TIMER_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * If this is zero (0), the trace will exclude any Timer events.\r
+ *\r
+ * Default value is 0 since dependent on timers.c\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_TIMER_EVENTS 0\r
+\r
+ /*****************************************************************************\r
+ * TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * If this is zero (0), the trace will exclude any "pending function call" \r
+ * events, such as xTimerPendFunctionCall().\r
+ *\r
+ * Default value is 0 since dependent on timers.c\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS 0\r
+\r
+/*******************************************************************************\r
+ * Configuration Macro: TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * If this is zero (0), the trace will exclude any stream buffer or message\r
+ * buffer events.\r
+ *\r
+ * Default value is 0 since dependent on stream_buffer.c (new in FreeRTOS v10)\r
+ ******************************************************************************/\r
+#define TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS 0\r
+\r
/*******************************************************************************\r
* Configuration Macro: TRC_CFG_RECORDER_BUFFER_ALLOCATION\r
*\r
* TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC - Malloc in vTraceEnable\r
* TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM - Use vTraceSetRecorderDataBuffer\r
*\r
- * Static and dynamic mode does the allocation for you, either in compile time \r
- * (static) or in runtime (malloc). \r
- * The custom mode allows you to control how and where the allocation is made, \r
+ * Static and dynamic mode does the allocation for you, either in compile time\r
+ * (static) or in runtime (malloc).\r
+ * The custom mode allows you to control how and where the allocation is made,\r
* for details see TRC_ALLOC_CUSTOM_BUFFER and vTraceSetRecorderDataBuffer().\r
******************************************************************************/\r
#define TRC_CFG_RECORDER_BUFFER_ALLOCATION TRC_RECORDER_BUFFER_ALLOCATION_STATIC\r
\r
-/******************************************************************************\r
- * TRC_CFG_FREERTOS_VERSION\r
- * \r
- * Specify what version of FreeRTOS that is used (don't change unless using the\r
- * trace recorder library with an older version of FreeRTOS).\r
- * \r
- * TRC_FREERTOS_VERSION_7_3_OR_7_4 If using FreeRTOS v7.3.0 - v7.4.2\r
- * TRC_FREERTOS_VERSION_7_5_OR_7_6 If using FreeRTOS v7.5.0 - v7.6.0\r
- * TRC_FREERTOS_VERSION_8_X If using FreeRTOS v8.X.X\r
- * TRC_FREERTOS_VERSION_9_X If using FreeRTOS v9.X.X\r
- *****************************************************************************/\r
-#define TRC_CFG_FREERTOS_VERSION TRC_FREERTOS_VERSION_9_X\r
-\r
/******************************************************************************\r
* TRC_CFG_MAX_ISR_NESTING\r
- * \r
+ *\r
* Defines how many levels of interrupt nesting the recorder can handle, in\r
* case multiple ISRs are traced and ISR nesting is possible. If this\r
- * is exceeded, the particular ISR will not be traced and the recorder then \r
+ * is exceeded, the particular ISR will not be traced and the recorder then\r
* logs an error message. This setting is used to allocate an internal stack\r
- * for keeping track of the previous execution context (4 byte per entry). \r
+ * for keeping track of the previous execution context (4 byte per entry).\r
*\r
* This value must be a non-zero positive constant, at least 1.\r
- * \r
+ *\r
* Default value: 8\r
*****************************************************************************/\r
#define TRC_CFG_MAX_ISR_NESTING 8\r
/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* trcSnapshotConfig.h\r
*\r
- * Configuration parameters for trace recorder library in snapshot mode. \r
+ * Configuration parameters for trace recorder library in snapshot mode.\r
* Read more at http://percepio.com/2016/10/05/rtos-tracing/\r
*\r
* Terms of Use\r
- * This file is part of the trace recorder library (RECORDER), which is the \r
+ * This file is part of the trace recorder library (RECORDER), which is the\r
* intellectual property of Percepio AB (PERCEPIO) and provided under a\r
* license as follows.\r
* The RECORDER may be used free of charge for the purpose of recording data\r
* You may distribute the RECORDER in its original source code form, assuming\r
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are\r
* allowed to distribute the RECORDER with minor modifications intended for\r
- * configuration or porting of the RECORDER, e.g., to allow using it on a \r
+ * configuration or porting of the RECORDER, e.g., to allow using it on a\r
* specific processor, processor family or with a specific communication\r
* interface. Any such modifications should be documented directly below\r
- * this comment block. \r
+ * this comment block.\r
*\r
* Disclaimer\r
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty\r
- * as to its use or performance. PERCEPIO does not and cannot warrant the \r
+ * as to its use or performance. PERCEPIO does not and cannot warrant the\r
* performance or results you may obtain by using the RECORDER or documentation.\r
* PERCEPIO make no warranties, express or implied, as to noninfringement of\r
* third party rights, merchantability, or fitness for any particular purpose.\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2017.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
\r
* - TRC_SNAPSHOT_MODE_STOP_WHEN_FULL\r
* Default is TRC_SNAPSHOT_MODE_RING_BUFFER.\r
*\r
- * With TRC_CFG_SNAPSHOT_MODE set to TRC_SNAPSHOT_MODE_RING_BUFFER, the \r
- * events are stored in a ring buffer, i.e., where the oldest events are \r
+ * With TRC_CFG_SNAPSHOT_MODE set to TRC_SNAPSHOT_MODE_RING_BUFFER, the\r
+ * events are stored in a ring buffer, i.e., where the oldest events are\r
* overwritten when the buffer becomes full. This allows you to get the last\r
- * events leading up to an interesting state, e.g., an error, without having \r
+ * events leading up to an interesting state, e.g., an error, without having\r
* to store the whole run since startup.\r
*\r
- * When TRC_CFG_SNAPSHOT_MODE is TRC_SNAPSHOT_MODE_STOP_WHEN_FULL, the \r
+ * When TRC_CFG_SNAPSHOT_MODE is TRC_SNAPSHOT_MODE_STOP_WHEN_FULL, the\r
* recording is stopped when the buffer becomes full. This is useful for\r
* recording events following a specific state, e.g., the startup sequence.\r
*****************************************************************************/\r
#define TRC_CFG_SNAPSHOT_MODE TRC_SNAPSHOT_MODE_RING_BUFFER\r
\r
-/*******************************************************************************\r
- * TRC_CFG_SCHEDULING_ONLY\r
- *\r
- * Macro which should be defined as an integer value.\r
- *\r
- * If this setting is enabled (= 1), only scheduling events are recorded.\r
- * If disabled (= 0), all events are recorded.\r
- *\r
- * For users of Tracealyzer Free Edition, that only displays scheduling events, this\r
- * option can be used to avoid storing other events.\r
- *\r
- * Default value is 0 (store all enabled events).\r
- *\r
- ******************************************************************************/\r
-#define TRC_CFG_SCHEDULING_ONLY 0\r
-\r
/*******************************************************************************\r
* TRC_CFG_EVENT_BUFFER_SIZE\r
*\r
* Macro which should be defined as an integer value.\r
*\r
* This defines the capacity of the event buffer, i.e., the number of records\r
- * it may store. Most events use one record (4 byte), although some events \r
+ * it may store. Most events use one record (4 byte), although some events\r
* require multiple 4-byte records. You should adjust this to the amount of RAM\r
* available in the target system.\r
- * \r
+ *\r
* Default value is 1000, which means that 4000 bytes is allocated for the\r
* event buffer.\r
******************************************************************************/\r
* A group of macros which should be defined as integer values, zero or larger.\r
*\r
* These define the capacity of the Object Property Table, i.e., the maximum\r
- * number of objects active at any given point, within each object class (e.g., \r
+ * number of objects active at any given point, within each object class (e.g.,\r
* task, queue, semaphore, ...).\r
- * \r
+ *\r
* If tasks or other objects are deleted in your system, this\r
* setting does not limit the total amount of objects created, only the number\r
* of objects that have been successfully created but not yet deleted.\r
*\r
- * Using too small values will cause vTraceError to be called, which stores an \r
+ * Using too small values will cause vTraceError to be called, which stores an\r
* error message in the trace that is shown when opening the trace file. The\r
* error message can also be retrieved using xTraceGetLastError.\r
*\r
- * It can be wise to start with large values for these constants, \r
+ * It can be wise to start with large values for these constants,\r
* unless you are very confident on these numbers. Then do a recording and\r
- * check the actual usage by selecting View menu -> Trace Details -> \r
- * Resource Usage -> Object Table. \r
+ * check the actual usage by selecting View menu -> Trace Details ->\r
+ * Resource Usage -> Object Table.\r
******************************************************************************/\r
-#define TRC_CFG_NTASK 10\r
+#define TRC_CFG_NTASK 15\r
#define TRC_CFG_NISR 5\r
#define TRC_CFG_NQUEUE 10\r
#define TRC_CFG_NSEMAPHORE 10\r
#define TRC_CFG_NMUTEX 10\r
#define TRC_CFG_NTIMER 5\r
#define TRC_CFG_NEVENTGROUP 5\r
-\r
-/******************************************************************************\r
- * TRC_CFG_INCLUDE_MEMMANG_EVENTS\r
- * \r
- * Macro which should be defined as either zero (0) or one (1). \r
- *\r
- * This controls if malloc and free calls should be traced. Set this to zero (0)\r
- * to exclude malloc/free calls, or one (1) to include such events in the trace.\r
- *\r
- * Default value is 1.\r
- *****************************************************************************/\r
-#define TRC_CFG_INCLUDE_MEMMANG_EVENTS 1\r
-\r
-/******************************************************************************\r
- * TRC_CFG_INCLUDE_USER_EVENTS\r
- *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- *\r
- * If this is zero (0) the code for creating User Events is excluded to\r
- * reduce code size. User Events are application-generated events, like \r
- * "printf" but for the trace log and the formatting is done offline, by the\r
- * Tracealyzer visualization tool. User Events are much faster than a printf\r
- * and can therefore be used in timing critical code.\r
- * \r
- * Default value is 1.\r
- *****************************************************************************/\r
-#define TRC_CFG_INCLUDE_USER_EVENTS 1\r
-\r
-/*****************************************************************************\r
- * TRC_CFG_INCLUDE_ISR_TRACING\r
- *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- *\r
- * If this is zero (0), the code for recording Interrupt Service Routines is \r
- * excluded, in order to reduce code size.\r
- *\r
- * Default value is 1.\r
- * \r
- * Note: tracing ISRs requires that you insert calls to vTraceStoreISRBegin\r
- * and vTraceStoreISREnd in your interrupt handlers.\r
- *****************************************************************************/\r
-#define TRC_CFG_INCLUDE_ISR_TRACING 1\r
-\r
-/*****************************************************************************\r
- * TRC_CFG_INCLUDE_READY_EVENTS\r
- *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- *\r
- * If one (1), events are recorded when tasks enter scheduling state "ready". \r
- * This allows Tracealyzer to show the initial pending time before tasks enter\r
- * the execution state, and present accurate response times.\r
- * If zero (0), "ready events" are not created, which allows for recording\r
- * longer traces in the same amount of RAM. \r
- *\r
- * Default value is 1.\r
- *****************************************************************************/\r
-#define TRC_CFG_INCLUDE_READY_EVENTS 1\r
-\r
-/*****************************************************************************\r
- * TRC_CFG_INCLUDE_OSTICK_EVENTS\r
- *\r
- * Macro which should be defined as either zero (0) or one (1). \r
- *\r
- * If this is one (1), events will be generated whenever the OS clock is\r
- * increased. If zero (0), OS tick events are not generated, which allows for\r
- * recording longer traces in the same amount of RAM. \r
- *\r
- * Default value is 0.\r
- *****************************************************************************/\r
-#define TRC_CFG_INCLUDE_OSTICK_EVENTS 0\r
+#define TRC_CFG_NSTREAMBUFFER 5\r
+#define TRC_CFG_NMESSAGEBUFFER 5\r
\r
/******************************************************************************\r
* TRC_CFG_INCLUDE_FLOAT_SUPPORT\r
*\r
- * Macro which should be defined as either zero (0) or one (1). \r
+ * Macro which should be defined as either zero (0) or one (1).\r
*\r
- * If this is zero (0), the support for logging floating point values in \r
+ * If this is zero (0), the support for logging floating point values in\r
* vTracePrintF is stripped out, in case floating point values are not used or\r
* supported by the platform used.\r
*\r
- * Floating point values are only used in vTracePrintF and its subroutines, to \r
- * allow for storing float (%f) or double (%lf) arguments. \r
+ * Floating point values are only used in vTracePrintF and its subroutines, to\r
+ * allow for storing float (%f) or double (%lf) arguments.\r
*\r
* vTracePrintF can be used with integer and string arguments in either case.\r
*\r
*****************************************************************************/\r
#define TRC_CFG_INCLUDE_FLOAT_SUPPORT 0\r
\r
-/******************************************************************************\r
- * TRC_CFG_INCLUDE_OBJECT_DELETE\r
- * \r
- * Macro which should be defined as either zero (0) or one (1). \r
- *\r
- * This must be enabled (1) if tasks, queues or other \r
- * traced kernel objects are deleted at runtime. If no deletes are made, this \r
- * can be set to 0 in order to exclude the delete-handling code.\r
- *\r
- * Default value is 1.\r
- *****************************************************************************/\r
-#define TRC_CFG_INCLUDE_OBJECT_DELETE 1\r
-\r
/*******************************************************************************\r
* TRC_CFG_SYMBOL_TABLE_SIZE\r
*\r
* Macro which should be defined as an integer value.\r
*\r
- * This defines the capacity of the symbol table, in bytes. This symbol table \r
+ * This defines the capacity of the symbol table, in bytes. This symbol table\r
* stores User Events labels and names of deleted tasks, queues, or other kernel\r
- * objects. If you don't use User Events or delete any kernel \r
+ * objects. If you don't use User Events or delete any kernel\r
* objects you set this to a very low value. The minimum recommended value is 4.\r
- * A size of zero (0) is not allowed since a zero-sized array may result in a \r
+ * A size of zero (0) is not allowed since a zero-sized array may result in a\r
* 32-bit pointer, i.e., using 4 bytes rather than 0.\r
*\r
* Default value is 800.\r
#define TRC_CFG_NAME_LEN_MUTEX 15\r
#define TRC_CFG_NAME_LEN_TIMER 15\r
#define TRC_CFG_NAME_LEN_EVENTGROUP 15\r
+#define TRC_CFG_NAME_LEN_STREAMBUFFER 15\r
+#define TRC_CFG_NAME_LEN_MESSAGEBUFFER 15\r
\r
/******************************************************************************\r
*** ADVANCED SETTINGS ********************************************************\r
* The remaining settings are not necessary to modify but allows for optimizing\r
* the recorder setup for your specific needs, e.g., to exclude events that you\r
* are not interested in, in order to get longer traces.\r
- *****************************************************************************/ \r
+ *****************************************************************************/\r
\r
/******************************************************************************\r
* TRC_CFG_HEAP_SIZE_BELOW_16M\r
*\r
* An integer constant that can be used to reduce the buffer usage of memory\r
-* allocation events (malloc/free). This value should be 1 if the heap size is \r
-* below 16 MB (2^24 byte), and you can live with reported addresses showing the \r
+* allocation events (malloc/free). This value should be 1 if the heap size is\r
+* below 16 MB (2^24 byte), and you can live with reported addresses showing the\r
* lower 24 bits only. If 0, you get the full 32-bit addresses.\r
*\r
* Default value is 0.\r
/******************************************************************************\r
* TRC_CFG_USE_IMPLICIT_IFE_RULES\r
*\r
- * Macro which should be defined as either zero (0) or one (1). \r
+ * Macro which should be defined as either zero (0) or one (1).\r
* Default is 1.\r
*\r
* Tracealyzer groups the events into "instances" based on Instance Finish\r
* Events (IFEs), produced either by default rules or calls to the recorder\r
- * functions vTraceInstanceFinishedNow and vTraceInstanceFinishedNext. \r
+ * functions vTraceInstanceFinishedNow and vTraceInstanceFinishedNext.\r
*\r
* If TRC_CFG_USE_IMPLICIT_IFE_RULES is one (1), the default IFE rules is\r
* used, resulting in a "typical" grouping of events into instances.\r
- * If these rules don't give appropriate instances in your case, you can \r
+ * If these rules don't give appropriate instances in your case, you can\r
* override the default rules using vTraceInstanceFinishedNow/Next for one\r
* or several tasks. The default IFE rules are then disabled for those tasks.\r
*\r
* disabled globally. You must then call vTraceInstanceFinishedNow or\r
* vTraceInstanceFinishedNext to manually group the events into instances,\r
* otherwise the tasks will appear a single long instance.\r
- * \r
+ *\r
* The default IFE rules count the following events as "instance finished":\r
* - Task delay, delay until\r
* - Task suspend\r
- * - Blocking on "input" operations, i.e., when the task is waiting for the \r
+ * - Blocking on "input" operations, i.e., when the task is waiting for the\r
* next a message/signal/event. But only if this event is blocking.\r
*\r
- * For details, see trcSnapshotKernelPort.h and look for references to the \r
- * macro trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED. \r
+ * For details, see trcSnapshotKernelPort.h and look for references to the\r
+ * macro trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED.\r
*****************************************************************************/\r
#define TRC_CFG_USE_IMPLICIT_IFE_RULES 1\r
\r
* TRC_CFG_USE_16BIT_OBJECT_HANDLES\r
*\r
* Macro which should be defined as either zero (0) or one (1).\r
- * \r
- * If set to 0 (zero), the recorder uses 8-bit handles to identify kernel \r
+ *\r
+ * If set to 0 (zero), the recorder uses 8-bit handles to identify kernel\r
* objects such as tasks and queues. This limits the supported number of\r
* concurrently active objects to 255 of each type (tasks, queues, mutexes,\r
* etc.) Note: 255, not 256, since handle 0 is reserved.\r
*\r
- * If set to 1 (one), the recorder uses 16-bit handles to identify kernel \r
+ * If set to 1 (one), the recorder uses 16-bit handles to identify kernel\r
* objects such as tasks and queues. This limits the supported number of\r
* concurrent objects to 65535 of each type (object class). However, since the\r
* object property table is limited to 64 KB, the practical limit is about\r
- * 3000 objects in total. \r
- * \r
+ * 3000 objects in total.\r
+ *\r
* Default is 0 (8-bit handles)\r
*\r
- * NOTE: An object with handle above 255 will use an extra 4-byte record in \r
+ * NOTE: An object with handle above 255 will use an extra 4-byte record in\r
* the event buffer whenever the object is referenced. Moreover, some internal\r
* tables in the recorder gets slightly larger when using 16-bit handles.\r
*****************************************************************************/\r
/******************************************************************************\r
* TRC_CFG_USE_TRACE_ASSERT\r
*\r
- * Macro which should be defined as either zero (0) or one (1). \r
+ * Macro which should be defined as either zero (0) or one (1).\r
* Default is 1.\r
*\r
- * If this is one (1), the TRACE_ASSERT macro (used at various locations in the \r
- * trace recorder) will verify that a relevant condition is true. \r
+ * If this is one (1), the TRACE_ASSERT macro (used at various locations in the\r
+ * trace recorder) will verify that a relevant condition is true.\r
* If the condition is false, prvTraceError() will be called, which stops the\r
* recording and stores an error message that is displayed when opening the\r
* trace in Tracealyzer.\r
*\r
* Macro which should be defined as an integer value.\r
*\r
- * Set TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER to 1 to enable the \r
+ * Set TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER to 1 to enable the\r
* separate user event buffer (UB).\r
- * In this mode, user events are stored separately from other events, \r
- * e.g., RTOS events. Thereby you can get a much longer history of \r
- * user events as they don't need to share the buffer space with more \r
- * frequent events. \r
+ * In this mode, user events are stored separately from other events,\r
+ * e.g., RTOS events. Thereby you can get a much longer history of\r
+ * user events as they don't need to share the buffer space with more\r
+ * frequent events.\r
*\r
* The UB is typically used with the snapshot ring-buffer mode, so the\r
- * recording can continue when the main buffer gets full. And since the \r
+ * recording can continue when the main buffer gets full. And since the\r
* main buffer then overwrites the earliest events, Tracealyzer displays\r
* "Unknown Actor" instead of task scheduling for periods with UB data only.\r
- * \r
+ *\r
* In UB mode, user events are structured as UB channels, which contains\r
* a channel name and a default format string. Register a UB channel using\r
* xTraceRegisterUBChannel.\r
* traceString chn1 = xTraceRegisterString("Channel 1");\r
* traceString fmt1 = xTraceRegisterString("Event!");\r
* traceUBChannel UBCh1 = xTraceRegisterUBChannel(chn1, fmt1);\r
- * \r
+ *\r
* traceString chn2 = xTraceRegisterString("Channel 2");\r
* traceString fmt2 = xTraceRegisterString("X: %d, Y: %d");\r
* traceUBChannel UBCh2 = xTraceRegisterUBChannel(chn2, fmt2);\r
- * \r
+ *\r
* // Result in "[Channel 1] Event!"\r
- * vTraceUBEvent(UBCh1); \r
+ * vTraceUBEvent(UBCh1);\r
*\r
* // Result in "[Channel 2] X: 23, Y: 19"\r
* vTraceUBData(UBCh2, 23, 19);\r
*\r
* You can also use the other user event functions, like vTracePrintF.\r
* as they are then rerouted to the UB instead of the main event buffer.\r
- * vTracePrintF then looks up the correct UB channel based on the \r
+ * vTracePrintF then looks up the correct UB channel based on the\r
* provided channel name and format string, or creates a new UB channel\r
- * if no match is found. The format string should therefore not contain \r
+ * if no match is found. The format string should therefore not contain\r
* "random" messages but mainly format specifiers. Random strings should\r
* be stored using %s and with the string as an argument.\r
*\r
* // Creates a new UB channel ("Channel 2", "%Z: %d")\r
* vTracePrintF(chn2, "%Z: %d", value1);\r
- * \r
+ *\r
* // Finds the existing UB channel\r
* vTracePrintF(chn2, "%Z: %d", value2);\r
- \r
+\r
******************************************************************************/\r
#define TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER 0\r
\r
*\r
* Macro which should be defined as an integer value.\r
*\r
- * If tracing multiple ISRs, this setting allows for accurate display of the \r
+ * If tracing multiple ISRs, this setting allows for accurate display of the\r
* context-switching also in cases when the ISRs execute in direct sequence.\r
- * \r
+ *\r
* vTraceStoreISREnd normally assumes that the ISR returns to the previous\r
- * context, i.e., a task or a preempted ISR. But if another traced ISR \r
+ * context, i.e., a task or a preempted ISR. But if another traced ISR\r
* executes in direct sequence, Tracealyzer may incorrectly display a minimal\r
* fragment of the previous context in between the ISRs.\r
*\r
- * By using TRC_CFG_ISR_TAILCHAINING_THRESHOLD you can avoid this. This is \r
+ * By using TRC_CFG_ISR_TAILCHAINING_THRESHOLD you can avoid this. This is\r
* however a threshold value that must be measured for your specific setup.\r
* See http://percepio.com/2014/03/21/isr_tailchaining_threshold/\r
*\r
- * The default setting is 0, meaning "disabled" and that you may get an \r
+ * The default setting is 0, meaning "disabled" and that you may get an\r
* extra fragments of the previous context in between tail-chained ISRs.\r
*\r
- * Note: This setting has separate definitions in trcSnapshotConfig.h and \r
+ * Note: This setting has separate definitions in trcSnapshotConfig.h and\r
* trcStreamingConfig.h, since it is affected by the recorder mode.\r
******************************************************************************/\r
#define TRC_CFG_ISR_TAILCHAINING_THRESHOLD 0\r
/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* trcStreamingConfig.h\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2017.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
\r
* - Task names\r
* - Named ISRs (vTraceSetISRProperties)\r
* - Named kernel objects (vTraceStoreKernelObjectName)\r
- * - User event channels (vTraceStoreUserEventChannelName)\r
+ * - User event channels (xTraceRegisterString)\r
*\r
* If this value is too small, not all symbol names will be stored and the\r
* trace display will be affected. In that case, there will be warnings\r
* - Task names\r
* - Named ISRs (vTraceSetISRProperties)\r
* - Named kernel objects (vTraceStoreKernelObjectName)\r
- * - User event channel names (vTraceStoreUserEventChannelName)\r
+ * - User event channel names (xTraceRegisterString)\r
*\r
* If longer symbol names are used, they will be truncated by the recorder,\r
* which will affect the trace display. In that case, there will be warnings\r
* Specifies the number of pages used by the paged event buffer.\r
* This may need to be increased if there are a lot of missed events.\r
*\r
- * Note: not used by the J-Link RTT stream port (see SEGGER_RTT_Conf.h instead)\r
+ * Note: not used by the J-Link RTT stream port (see trcStreamingPort.h instead)\r
******************************************************************************/\r
#define TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT 2\r
\r
* to match any internal low-level buffers used by the streaming interface, like\r
* the Ethernet MTU (Maximum Transmission Unit).\r
*\r
- * Note: not used by the J-Link RTT stream port (see SEGGER_RTT_Conf.h instead)\r
+ * Note: not used by the J-Link RTT stream port (see trcStreamingPort.h instead)\r
******************************************************************************/\r
#define TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE 2500\r
\r
--- /dev/null
+/************************************************************\r
+* Percepio Tracealyzer - ITM Trace Exporter for Keil uVision\r
+* Copyright (c) 2018, Percepio AB.\r
+* https://percepio.com\r
+************************************************************/\r
+\r
+FUNC void tzSetEnable(int enable)\r
+{ \r
+ if (enable == 1)\r
+ {\r
+ printf("Starting Tracealyzer recorder\n"); \r
+ \r
+ // Forward the ITM data to file\r
+ exec("ITMLOG 1 > .\\tracealyzer.psf");\r
+ \r
+ // Send start command to Tracealyzer (not required if using vTraceEnable(TRC_START))\r
+ exec("E CHAR tz_host_command_data = 1, 1, 0, 0, 0, 0, 0xFD, 0xFF");\r
+ exec("tz_host_command_bytes_to_read = 8");\r
+ }\r
+ else if (enable == 0)\r
+ { \r
+ printf("Stopping Tracealyzer recorder...\n"); \r
+ \r
+ // Send stop command to Tracealyzer, to stop writing ITM data. \r
+ exec("E CHAR tz_host_command_data = 1, 0, 0, 0, 0, 0, 0xFE, 0xFF");\r
+ exec("tz_host_command_bytes_to_read = 8");\r
+\r
+ _sleep_(2000); // Wait a while to let all data be written the host file.\r
+ \r
+ // Stop forwarding the ITM data to file and close the file.\r
+ exec("ITMLOG 1 OFF");\r
+ \r
+ printf("Tracealyzer recorder stopped.\n"); \r
+ \r
+ }\r
+ else printf("Usage: tzSetEnable(0 or 1), where 0 is disable (stops recorder) and 1 enable (starts recording)");\r
+ \r
+} \r
+\r
+\r
+// The Tracealyzer ITM stream port for Keil µVision can be used in two ways.\r
+//\r
+// 1. Start tracing directly from startup. \r
+// Make sure tzSetEnable(1) is called below and vTraceEnable(TRC_START) in your target startup.\r
+//\r
+// 2. Start the trace manually, using the "Start Recording" button in Keil µVision. \r
+// In this case, comment out the below call to tzSetEnable and make sure you call vTraceEnable(TRC_INIT) in your target startup (not TRC_START).\r
+\r
+tzSetEnable(1);\r
+\r
+DEFINE BUTTON "Start Recording", "tzSetEnable(1)";\r
+DEFINE BUTTON "Stop Recording", "tzSetEnable(0)";
\ No newline at end of file
--- /dev/null
+Tracealyzer Stream Port for ARM Cortex-M ITM\r
+--------------------------------------------\r
+2018-05-04\r
+\r
+This directory contains a "stream port" for the Tracealyzer recorder library,\r
+i.e., the specific code needed to use a particular interface for streaming a\r
+Tracealyzer RTOS trace. The stream port is defined by a set of macros in\r
+trcStreamingPort.h, found in the "include" directory.\r
+\r
+This particular stream port targets ARM's ITM interface, which together with\r
+a fast debug probe such as a Keil ULINKpro or ULINKplus provides excellent\r
+performance. This stream port does not use any RAM buffer for the trace, but\r
+writes the data directly to the ITM registers. This is very fast.\r
+\r
+To setup Keil uVision for ITM tracing with a Keil ULINKpro (or ULINKplus),\r
+see Percepio Application Note PA-021 https://percepio.com/2018/05/04/keil-itm-support/\r
+\r
+Learning more:\r
+ - Tracealyzer User Manual (Help -> User Manual)\r
+ - https://percepio.com/gettingstarted\r
+ - Percepio Application Note PA-021 https://percepio.com/2018/05/04/keil-itm-support/\r
+ - About ITM trace, https://percepio.com/2016/06/09/arm-itm/\r
+ - About the recorder and custom streaming, http://percepio.com/2016/10/05/rtos-tracing\r
+\r
+For questions, please contact support@percepio.com\r
+\r
+Percepio AB\r
+www.percepio.com
\ No newline at end of file
--- /dev/null
+/*******************************************************************************\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
+ * Percepio AB, www.percepio.com\r
+ *\r
+ * trcStreamingPort.h\r
+ *\r
+ * The interface definitions for trace streaming ("stream ports").\r
+ * This "stream port" sets up the recorder to use ARM ITM as streaming channel.\r
+ *\r
+ * Terms of Use\r
+ * This file is part of the trace recorder library (RECORDER), which is the \r
+ * intellectual property of Percepio AB (PERCEPIO) and provided under a\r
+ * license as follows.\r
+ * The RECORDER may be used free of charge for the purpose of recording data\r
+ * intended for analysis in PERCEPIO products. It may not be used or modified\r
+ * for other purposes without explicit permission from PERCEPIO.\r
+ * You may distribute the RECORDER in its original source code form, assuming\r
+ * this text (terms of use, disclaimer, copyright notice) is unchanged. You are\r
+ * allowed to distribute the RECORDER with minor modifications intended for\r
+ * configuration or porting of the RECORDER, e.g., to allow using it on a \r
+ * specific processor, processor family or with a specific communication\r
+ * interface. Any such modifications should be documented directly below\r
+ * this comment block. \r
+ *\r
+ * Disclaimer\r
+ * The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty\r
+ * as to its use or performance. PERCEPIO does not and cannot warrant the \r
+ * performance or results you may obtain by using the RECORDER or documentation.\r
+ * PERCEPIO make no warranties, express or implied, as to noninfringement of\r
+ * third party rights, merchantability, or fitness for any particular purpose.\r
+ * In no event will PERCEPIO, its technology partners, or distributors be liable\r
+ * to you for any consequential, incidental or special damages, including any\r
+ * lost profits or lost savings, even if a representative of PERCEPIO has been\r
+ * advised of the possibility of such damages, or for any claim by any third\r
+ * party. Some jurisdictions do not allow the exclusion or limitation of\r
+ * incidental, consequential or special damages, or the exclusion of implied\r
+ * warranties or limitations on how long an implied warranty may last, so the\r
+ * above limitations may not apply to you.\r
+ *\r
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2018.\r
+ * www.percepio.com\r
+ ******************************************************************************/\r
+\r
+#ifndef TRC_STREAMING_PORT_H\r
+#define TRC_STREAMING_PORT_H\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+\r
+int32_t itm_write(void* ptrData, uint32_t size, int32_t* ptrBytesWritten);\r
+int32_t read_from_host(void* ptrData, uint32_t size, int32_t* ptrBytesRead);\r
+\r
+/*******************************************************************************\r
+ * TRC_CFG_ITM_PORT\r
+ *\r
+ * Possible values: 0 - 31\r
+ *\r
+ * What ITM port to use for the ITM software events. Make sure the IDE is\r
+ * configured for the same channel.\r
+ *\r
+ * Default: 1 (0 is typically terminal output and 31 is used by Keil)\r
+ *\r
+ ******************************************************************************/\r
+#define TRC_CFG_ITM_PORT 1\r
+\r
+#if (TRC_CFG_ITM_PORT < 0) || (TRC_CFG_ITM_PORT > 31)\r
+#error "Bad ITM port selected."\r
+#endif\r
+\r
+// Not used for ITM - no RAM buffer...\r
+#define TRC_STREAM_PORT_ALLOCATE_FIELDS()\r
+\r
+// Not used for ITM - assume the IDE configures the ITM setup\r
+#define TRC_STREAM_PORT_INIT()\r
+\r
+/* Important for the ITM port - no RAM buffer, direct writes. In most other ports this can be skipped (default is 1) */\r
+#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 0\r
+ \r
+#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesWritten) itm_write(_ptrData, _size, _ptrBytesWritten)\r
+\r
+#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) read_from_host(_ptrData, _size, _ptrBytesRead)\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* TRC_STREAMING_PORT_H */\r
--- /dev/null
+\r
+#include "trcRecorder.h"\r
+\r
+#if (TRC_USE_TRACEALYZER_RECORDER == 1)\r
+#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)\r
+\r
+static void itm_write_32(uint32_t data);\r
+\r
+volatile int32_t tz_host_command_bytes_to_read = 0; // This is set by the Tracealyzer host application (to the number of bytes written), after having written to tz_host_commands. Set to zero by the read function after the message in tz_host_commands has been read.\r
+volatile char tz_host_command_data[32];\r
+\r
+/* This reads "command" data from a RAM buffer, written by a host macro in the debugger */\r
+int32_t read_from_host(void* ptrData, uint32_t size, int32_t* ptrBytesRead)\r
+{\r
+ if ( tz_host_command_bytes_to_read > 0)\r
+ { \r
+ int i;\r
+ uint8_t * bytesBuffer = (uint8_t*) ptrData;\r
+\r
+ if (ptrBytesRead != NULL)\r
+ *ptrBytesRead = (int32_t)tz_host_command_bytes_to_read;\r
+ \r
+ if (tz_host_command_bytes_to_read != size)\r
+ {\r
+ return -1;\r
+ }\r
+ \r
+ for (i=0; i < tz_host_command_bytes_to_read; i++)\r
+ {\r
+ bytesBuffer[i] = tz_host_command_data[i];\r
+ }\r
+ \r
+ tz_host_command_bytes_to_read = 0;\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+static void itm_write_32(uint32_t data)\r
+{ \r
+ if ((CoreDebug->DEMCR & CoreDebug_DEMCR_TRCENA_Msk) && // Trace enabled\r
+ (ITM->TCR & ITM_TCR_ITMENA_Msk) && // ITM enabled\r
+ (ITM->TER & (1UL << 0))) // ITM Port #0 enabled\r
+ {\r
+ while (ITM->PORT[TRC_CFG_ITM_PORT].u32 == 0); // Block until room in ITM FIFO - This stream port is always in "blocking mode", since intended for high-speed ITM!\r
+ ITM->PORT[TRC_CFG_ITM_PORT].u32 = data; // Write the data\r
+ } \r
+}\r
+\r
+/* This is assumed to execute from within the recorder, with interrupts disabled */\r
+int32_t itm_write(void* ptrData, uint32_t size, int32_t* ptrBytesWritten)\r
+{\r
+ uint32_t bytesWritten = 0;\r
+ uint32_t* ptr32 = (uint32_t*)ptrData;\r
+ \r
+ if (size % 4 != 0) return -2;\r
+ \r
+ while(bytesWritten < size)\r
+ {\r
+ itm_write_32(*ptr32);\r
+ ptr32++;\r
+ bytesWritten += 4;\r
+ }\r
+\r
+ *ptrBytesWritten = bytesWritten;\r
+ \r
+ return 0;\r
+}\r
+\r
+#endif\r
+#endif\r
--- /dev/null
+Tracealyzer Stream Port for Files\r
+-------------------------------------------------\r
+\r
+This directory contains a "stream port" for the Tracealyzer recorder library,\r
+i.e., the specific code needed to use a particular interface for streaming a\r
+Tracealyzer RTOS trace. The stream port is defined by a set of macros in\r
+trcStreamingPort.h, found in the "include" directory.\r
+\r
+This particular stream port is for streaming to a file via stdio.h (fwrite).\r
+\r
+To use this stream port, make sure that include/trcStreamingPort.h is found\r
+by the compiler (i.e., add this folder to your project's include paths) and\r
+add all included source files to your build. Make sure no other versions of\r
+trcStreamingPort.h are included by mistake!\r
+\r
+See also http://percepio.com/2016/10/05/rtos-tracing.\r
+\r
+Percepio AB\r
+www.percepio.com
\ No newline at end of file
--- /dev/null
+/*******************************************************************************\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
+ * Percepio AB, www.percepio.com\r
+ *\r
+ * trcStreamingPort.h\r
+ *\r
+ * The interface definitions for trace streaming ("stream ports").\r
+ * This "stream port" sets up the recorder to stream the trace to file.\r
+ *\r
+ * Terms of Use\r
+ * This file is part of the trace recorder library (RECORDER), which is the \r
+ * intellectual property of Percepio AB (PERCEPIO) and provided under a\r
+ * license as follows.\r
+ * The RECORDER may be used free of charge for the purpose of recording data\r
+ * intended for analysis in PERCEPIO products. It may not be used or modified\r
+ * for other purposes without explicit permission from PERCEPIO.\r
+ * You may distribute the RECORDER in its original source code form, assuming\r
+ * this text (terms of use, disclaimer, copyright notice) is unchanged. You are\r
+ * allowed to distribute the RECORDER with minor modifications intended for\r
+ * configuration or porting of the RECORDER, e.g., to allow using it on a \r
+ * specific processor, processor family or with a specific communication\r
+ * interface. Any such modifications should be documented directly below\r
+ * this comment block. \r
+ *\r
+ * Disclaimer\r
+ * The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty\r
+ * as to its use or performance. PERCEPIO does not and cannot warrant the \r
+ * performance or results you may obtain by using the RECORDER or documentation.\r
+ * PERCEPIO make no warranties, express or implied, as to noninfringement of\r
+ * third party rights, merchantability, or fitness for any particular purpose.\r
+ * In no event will PERCEPIO, its technology partners, or distributors be liable\r
+ * to you for any consequential, incidental or special damages, including any\r
+ * lost profits or lost savings, even if a representative of PERCEPIO has been\r
+ * advised of the possibility of such damages, or for any claim by any third\r
+ * party. Some jurisdictions do not allow the exclusion or limitation of\r
+ * incidental, consequential or special damages, or the exclusion of implied\r
+ * warranties or limitations on how long an implied warranty may last, so the\r
+ * above limitations may not apply to you.\r
+ *\r
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2018.\r
+ * www.percepio.com\r
+ ******************************************************************************/\r
+\r
+#ifndef TRC_STREAMING_PORT_H\r
+#define TRC_STREAMING_PORT_H\r
+\r
+#include <stdint.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+int32_t writeToFile(void* data, uint32_t size, int32_t *ptrBytesWritten);\r
+\r
+void closeFile(void);\r
+\r
+void openFile(char* fileName);\r
+\r
+/* This define will determine whether to use the internal PagedEventBuffer or not.\r
+If file writing creates additional trace events (i.e. it uses semaphores or mutexes), \r
+then the paged event buffer must be enabled to avoid infinite recursion. */\r
+#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 1\r
+\r
+#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) 0 /* Does not read commands from Tz (yet) */\r
+\r
+#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesSent) writeToFile(_ptrData, _size, _ptrBytesSent)\r
+\r
+#if (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC)\r
+#define TRC_STREAM_PORT_MALLOC() \\r
+ _TzTraceData = TRC_PORT_MALLOC((TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT) * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE));\r
+extern char* _TzTraceData;\r
+#else\r
+#define TRC_STREAM_PORT_MALLOC() /* Custom or static allocation. Not used. */\r
+#endif\r
+#define TRC_STREAM_PORT_INIT() \\r
+ TRC_STREAM_PORT_MALLOC(); \\r
+ openFile("trace.psf")\r
+\r
+#define TRC_STREAM_PORT_ON_TRACE_END() closeFile()\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* TRC_STREAMING_PORT_H */\r
--- /dev/null
+/*******************************************************************************\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
+ * Percepio AB, www.percepio.com\r
+ *\r
+ * trcStreamingPort.c\r
+ *\r
+ * Supporting functions for trace streaming, used by the "stream ports" \r
+ * for reading and writing data to the interface.\r
+ * Existing ports can easily be modified to fit another setup, e.g., a \r
+ * different TCP/IP stack, or to define your own stream port.\r
+ *\r
+ * Terms of Use\r
+ * This file is part of the trace recorder library (RECORDER), which is the \r
+ * intellectual property of Percepio AB (PERCEPIO) and provided under a\r
+ * license as follows.\r
+ * The RECORDER may be used free of charge for the purpose of recording data\r
+ * intended for analysis in PERCEPIO products. It may not be used or modified\r
+ * for other purposes without explicit permission from PERCEPIO.\r
+ * You may distribute the RECORDER in its original source code form, assuming\r
+ * this text (terms of use, disclaimer, copyright notice) is unchanged. You are\r
+ * allowed to distribute the RECORDER with minor modifications intended for\r
+ * configuration or porting of the RECORDER, e.g., to allow using it on a \r
+ * specific processor, processor family or with a specific communication\r
+ * interface. Any such modifications should be documented directly below\r
+ * this comment block. \r
+ *\r
+ * Disclaimer\r
+ * The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty\r
+ * as to its use or performance. PERCEPIO does not and cannot warrant the \r
+ * performance or results you may obtain by using the RECORDER or documentation.\r
+ * PERCEPIO make no warranties, express or implied, as to noninfringement of\r
+ * third party rights, merchantability, or fitness for any particular purpose.\r
+ * In no event will PERCEPIO, its technology partners, or distributors be liable\r
+ * to you for any consequential, incidental or special damages, including any\r
+ * lost profits or lost savings, even if a representative of PERCEPIO has been\r
+ * advised of the possibility of such damages, or for any claim by any third\r
+ * party. Some jurisdictions do not allow the exclusion or limitation of\r
+ * incidental, consequential or special damages, or the exclusion of implied\r
+ * warranties or limitations on how long an implied warranty may last, so the\r
+ * above limitations may not apply to you.\r
+ *\r
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2018.\r
+ * www.percepio.com\r
+ ******************************************************************************/\r
+\r
+#include "trcRecorder.h"\r
+\r
+#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) \r
+#if (TRC_USE_TRACEALYZER_RECORDER == 1)\r
+\r
+FILE* traceFile = NULL;\r
+\r
+void openFile(char* fileName)\r
+{\r
+ if (traceFile == NULL)\r
+ {\r
+ errno_t err = fopen_s(&traceFile, fileName, "wb");\r
+ if (err != 0)\r
+ {\r
+ printf("Could not open trace file, error code %d.\n", err);\r
+ exit(-1);\r
+ }\r
+ else {\r
+ printf("Trace file created.\n");\r
+ }\r
+ }\r
+}\r
+\r
+int32_t writeToFile(void* data, uint32_t size, int32_t *ptrBytesWritten)\r
+{\r
+ int32_t written = 0;\r
+ if (traceFile != NULL)\r
+ {\r
+ written = fwrite(data, 1, size, traceFile);\r
+ }\r
+ else\r
+ {\r
+ written = 0;\r
+ }\r
+\r
+ if (ptrBytesWritten != 0)\r
+ *ptrBytesWritten = written;\r
+\r
+ if ((int32_t)size == written)\r
+ return 0;\r
+ else\r
+ return -1;\r
+}\r
+\r
+void closeFile(void)\r
+{\r
+ if (traceFile != NULL)\r
+ {\r
+ fclose(traceFile);\r
+ traceFile = NULL;\r
+ printf("Trace file closed.\n");\r
+ }\r
+}\r
+\r
+#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/\r
+#endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/\r
+++ /dev/null
-/*********************************************************************\r
-* SEGGER MICROCONTROLLER GmbH & Co. KG *\r
-* Solutions for real time microcontroller applications *\r
-**********************************************************************\r
-* *\r
-* (c) 2014 - 2016 SEGGER Microcontroller GmbH & Co. KG *\r
-* *\r
-* www.segger.com Support: support@segger.com *\r
-* *\r
-**********************************************************************\r
-* *\r
-* SEGGER RTT * Real Time Transfer for embedded targets *\r
-* *\r
-**********************************************************************\r
-* *\r
-* All rights reserved. *\r
-* *\r
-* * This software may in its unmodified form be freely redistributed *\r
-* in source, linkable, or executable form. *\r
-* * The source code may be modified, provided the source code *\r
-* retains the above copyright notice, this list of conditions and *\r
-* the following disclaimer. *\r
-* * Modified versions of this software in source, executable, or *\r
-* linkable form may not be distributed without prior consent of *\r
-* SEGGER. *\r
-* * This software may only be used for communication with SEGGER *\r
-* J-Link debug probes. *\r
-* *\r
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *\r
-* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *\r
-* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *\r
-* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *\r
-* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *\r
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *\r
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *\r
-* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *\r
-* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *\r
-* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *\r
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *\r
-* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *\r
-* DAMAGE. *\r
-* *\r
-**********************************************************************\r
-* *\r
-* RTT version: 6.00e *\r
-* *\r
-**********************************************************************\r
----------------------------END-OF-HEADER------------------------------\r
-File : SEGGER_RTT_printf.c\r
-Purpose : Replacement for printf to write formatted data via RTT\r
-Revision: $Rev: 3667 $\r
-----------------------------------------------------------------------\r
-*/\r
-#include "SEGGER_RTT.h"\r
-#include "SEGGER_RTT_Conf.h"\r
-\r
-/*********************************************************************\r
-*\r
-* Defines, configurable\r
-*\r
-**********************************************************************\r
-*/\r
-\r
-#ifndef SEGGER_RTT_PRINTF_BUFFER_SIZE\r
- #define SEGGER_RTT_PRINTF_BUFFER_SIZE (64)\r
-#endif\r
-\r
-#include <stdlib.h>\r
-#include <stdarg.h>\r
-\r
-\r
-#define FORMAT_FLAG_LEFT_JUSTIFY (1u << 0)\r
-#define FORMAT_FLAG_PAD_ZERO (1u << 1)\r
-#define FORMAT_FLAG_PRINT_SIGN (1u << 2)\r
-#define FORMAT_FLAG_ALTERNATE (1u << 3)\r
-\r
-/*********************************************************************\r
-*\r
-* Types\r
-*\r
-**********************************************************************\r
-*/\r
-\r
-typedef struct {\r
- char* pBuffer;\r
- unsigned BufferSize;\r
- unsigned Cnt;\r
-\r
- int ReturnValue;\r
-\r
- unsigned RTTBufferIndex;\r
-} SEGGER_RTT_PRINTF_DESC;\r
-\r
-/*********************************************************************\r
-*\r
-* Function prototypes\r
-*\r
-**********************************************************************\r
-*/\r
-int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList);\r
-\r
-/*********************************************************************\r
-*\r
-* Static code\r
-*\r
-**********************************************************************\r
-*/\r
-/*********************************************************************\r
-*\r
-* _StoreChar\r
-*/\r
-static void _StoreChar(SEGGER_RTT_PRINTF_DESC * p, char c) {\r
- unsigned Cnt;\r
-\r
- Cnt = p->Cnt;\r
- if ((Cnt + 1u) <= p->BufferSize) {\r
- *(p->pBuffer + Cnt) = c;\r
- p->Cnt = Cnt + 1u;\r
- p->ReturnValue++;\r
- }\r
- //\r
- // Write part of string, when the buffer is full\r
- //\r
- if (p->Cnt == p->BufferSize) {\r
- if (SEGGER_RTT_Write(p->RTTBufferIndex, p->pBuffer, p->Cnt) != p->Cnt) {\r
- p->ReturnValue = -1;\r
- } else {\r
- p->Cnt = 0u;\r
- }\r
- }\r
-}\r
-\r
-/*********************************************************************\r
-*\r
-* _PrintUnsigned\r
-*/\r
-static void _PrintUnsigned(SEGGER_RTT_PRINTF_DESC * pBufferDesc, unsigned v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) {\r
- static const char _aV2C[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };\r
- unsigned Div;\r
- unsigned Digit;\r
- unsigned Number;\r
- unsigned Width;\r
- char c;\r
-\r
- Number = v;\r
- Digit = 1u;\r
- //\r
- // Get actual field width\r
- //\r
- Width = 1u;\r
- while (Number >= Base) {\r
- Number = (Number / Base);\r
- Width++;\r
- }\r
- if (NumDigits > Width) {\r
- Width = NumDigits;\r
- }\r
- //\r
- // Print leading chars if necessary\r
- //\r
- if ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u) {\r
- if (FieldWidth != 0u) {\r
- if (((FormatFlags & FORMAT_FLAG_PAD_ZERO) == FORMAT_FLAG_PAD_ZERO) && (NumDigits == 0u)) {\r
- c = '0';\r
- } else {\r
- c = ' ';\r
- }\r
- while ((FieldWidth != 0u) && (Width < FieldWidth)) {\r
- FieldWidth--;\r
- _StoreChar(pBufferDesc, c);\r
- if (pBufferDesc->ReturnValue < 0) {\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- if (pBufferDesc->ReturnValue >= 0) {\r
- //\r
- // Compute Digit.\r
- // Loop until Digit has the value of the highest digit required.\r
- // Example: If the output is 345 (Base 10), loop 2 times until Digit is 100.\r
- //\r
- while (1) {\r
- if (NumDigits > 1u) { // User specified a min number of digits to print? => Make sure we loop at least that often, before checking anything else (> 1 check avoids problems with NumDigits being signed / unsigned)\r
- NumDigits--;\r
- } else {\r
- Div = v / Digit;\r
- if (Div < Base) { // Is our divider big enough to extract the highest digit from value? => Done\r
- break;\r
- }\r
- }\r
- Digit *= Base;\r
- }\r
- //\r
- // Output digits\r
- //\r
- do {\r
- Div = v / Digit;\r
- v -= Div * Digit;\r
- _StoreChar(pBufferDesc, _aV2C[Div]);\r
- if (pBufferDesc->ReturnValue < 0) {\r
- break;\r
- }\r
- Digit /= Base;\r
- } while (Digit);\r
- //\r
- // Print trailing spaces if necessary\r
- //\r
- if ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == FORMAT_FLAG_LEFT_JUSTIFY) {\r
- if (FieldWidth != 0u) {\r
- while ((FieldWidth != 0u) && (Width < FieldWidth)) {\r
- FieldWidth--;\r
- _StoreChar(pBufferDesc, ' ');\r
- if (pBufferDesc->ReturnValue < 0) {\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- }\r
-}\r
-\r
-/*********************************************************************\r
-*\r
-* _PrintInt\r
-*/\r
-static void _PrintInt(SEGGER_RTT_PRINTF_DESC * pBufferDesc, int v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) {\r
- unsigned Width;\r
- int Number;\r
-\r
- Number = (v < 0) ? -v : v;\r
-\r
- //\r
- // Get actual field width\r
- //\r
- Width = 1u;\r
- while (Number >= (int)Base) {\r
- Number = (Number / (int)Base);\r
- Width++;\r
- }\r
- if (NumDigits > Width) {\r
- Width = NumDigits;\r
- }\r
- if ((FieldWidth > 0u) && ((v < 0) || ((FormatFlags & FORMAT_FLAG_PRINT_SIGN) == FORMAT_FLAG_PRINT_SIGN))) {\r
- FieldWidth--;\r
- }\r
-\r
- //\r
- // Print leading spaces if necessary\r
- //\r
- if ((((FormatFlags & FORMAT_FLAG_PAD_ZERO) == 0u) || (NumDigits != 0u)) && ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u)) {\r
- if (FieldWidth != 0u) {\r
- while ((FieldWidth != 0u) && (Width < FieldWidth)) {\r
- FieldWidth--;\r
- _StoreChar(pBufferDesc, ' ');\r
- if (pBufferDesc->ReturnValue < 0) {\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- //\r
- // Print sign if necessary\r
- //\r
- if (pBufferDesc->ReturnValue >= 0) {\r
- if (v < 0) {\r
- v = -v;\r
- _StoreChar(pBufferDesc, '-');\r
- } else if ((FormatFlags & FORMAT_FLAG_PRINT_SIGN) == FORMAT_FLAG_PRINT_SIGN) {\r
- _StoreChar(pBufferDesc, '+');\r
- } else {\r
-\r
- }\r
- if (pBufferDesc->ReturnValue >= 0) {\r
- //\r
- // Print leading zeros if necessary\r
- //\r
- if (((FormatFlags & FORMAT_FLAG_PAD_ZERO) == FORMAT_FLAG_PAD_ZERO) && ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u) && (NumDigits == 0u)) {\r
- if (FieldWidth != 0u) {\r
- while ((FieldWidth != 0u) && (Width < FieldWidth)) {\r
- FieldWidth--;\r
- _StoreChar(pBufferDesc, '0');\r
- if (pBufferDesc->ReturnValue < 0) {\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- if (pBufferDesc->ReturnValue >= 0) {\r
- //\r
- // Print number without sign\r
- //\r
- _PrintUnsigned(pBufferDesc, (unsigned)v, Base, NumDigits, FieldWidth, FormatFlags);\r
- }\r
- }\r
- }\r
-}\r
-\r
-/*********************************************************************\r
-*\r
-* Public code\r
-*\r
-**********************************************************************\r
-*/\r
-/*********************************************************************\r
-*\r
-* SEGGER_RTT_vprintf\r
-*\r
-* Function description\r
-* Stores a formatted string in SEGGER RTT control block.\r
-* This data is read by the host.\r
-*\r
-* Parameters\r
-* BufferIndex Index of "Up"-buffer to be used. (e.g. 0 for "Terminal")\r
-* sFormat Pointer to format string\r
-* pParamList Pointer to the list of arguments for the format string\r
-*\r
-* Return values\r
-* >= 0: Number of bytes which have been stored in the "Up"-buffer.\r
-* < 0: Error\r
-*/\r
-int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList) {\r
- char c;\r
- SEGGER_RTT_PRINTF_DESC BufferDesc;\r
- int v;\r
- unsigned NumDigits;\r
- unsigned FormatFlags;\r
- unsigned FieldWidth;\r
- char acBuffer[SEGGER_RTT_PRINTF_BUFFER_SIZE];\r
-\r
- BufferDesc.pBuffer = acBuffer;\r
- BufferDesc.BufferSize = SEGGER_RTT_PRINTF_BUFFER_SIZE;\r
- BufferDesc.Cnt = 0u;\r
- BufferDesc.RTTBufferIndex = BufferIndex;\r
- BufferDesc.ReturnValue = 0;\r
-\r
- do {\r
- c = *sFormat;\r
- sFormat++;\r
- if (c == 0u) {\r
- break;\r
- }\r
- if (c == '%') {\r
- //\r
- // Filter out flags\r
- //\r
- FormatFlags = 0u;\r
- v = 1;\r
- do {\r
- c = *sFormat;\r
- switch (c) {\r
- case '-': FormatFlags |= FORMAT_FLAG_LEFT_JUSTIFY; sFormat++; break;\r
- case '0': FormatFlags |= FORMAT_FLAG_PAD_ZERO; sFormat++; break;\r
- case '+': FormatFlags |= FORMAT_FLAG_PRINT_SIGN; sFormat++; break;\r
- case '#': FormatFlags |= FORMAT_FLAG_ALTERNATE; sFormat++; break;\r
- default: v = 0; break;\r
- }\r
- } while (v);\r
- //\r
- // filter out field with\r
- //\r
- FieldWidth = 0u;\r
- do {\r
- c = *sFormat;\r
- if ((c < '0') || (c > '9')) {\r
- break;\r
- }\r
- sFormat++;\r
- FieldWidth = (FieldWidth * 10u) + ((unsigned)c - '0');\r
- } while (1);\r
-\r
- //\r
- // Filter out precision (number of digits to display)\r
- //\r
- NumDigits = 0u;\r
- c = *sFormat;\r
- if (c == '.') {\r
- sFormat++;\r
- do {\r
- c = *sFormat;\r
- if ((c < '0') || (c > '9')) {\r
- break;\r
- }\r
- sFormat++;\r
- NumDigits = NumDigits * 10u + ((unsigned)c - '0');\r
- } while (1);\r
- }\r
- //\r
- // Filter out length modifier\r
- //\r
- c = *sFormat;\r
- do {\r
- if ((c == 'l') || (c == 'h')) {\r
- sFormat++;\r
- c = *sFormat;\r
- } else {\r
- break;\r
- }\r
- } while (1);\r
- //\r
- // Handle specifiers\r
- //\r
- switch (c) {\r
- case 'c': {\r
- char c0;\r
- v = va_arg(*pParamList, int);\r
- c0 = (char)v;\r
- _StoreChar(&BufferDesc, c0);\r
- break;\r
- }\r
- case 'd':\r
- v = va_arg(*pParamList, int);\r
- _PrintInt(&BufferDesc, v, 10u, NumDigits, FieldWidth, FormatFlags);\r
- break;\r
- case 'u':\r
- v = va_arg(*pParamList, int);\r
- _PrintUnsigned(&BufferDesc, (unsigned)v, 10u, NumDigits, FieldWidth, FormatFlags);\r
- break;\r
- case 'x':\r
- case 'X':\r
- v = va_arg(*pParamList, int);\r
- _PrintUnsigned(&BufferDesc, (unsigned)v, 16u, NumDigits, FieldWidth, FormatFlags);\r
- break;\r
- case 's':\r
- {\r
- const char * s = va_arg(*pParamList, const char *);\r
- do {\r
- c = *s;\r
- s++;\r
- if (c == '\0') {\r
- break;\r
- }\r
- _StoreChar(&BufferDesc, c);\r
- } while (BufferDesc.ReturnValue >= 0);\r
- }\r
- break;\r
- case 'p':\r
- v = va_arg(*pParamList, int);\r
- _PrintUnsigned(&BufferDesc, (unsigned)v, 16u, 8u, 8u, 0u);\r
- break;\r
- case '%':\r
- _StoreChar(&BufferDesc, '%');\r
- break;\r
- default:\r
- break;\r
- }\r
- sFormat++;\r
- } else {\r
- _StoreChar(&BufferDesc, c);\r
- }\r
- } while (BufferDesc.ReturnValue >= 0);\r
-\r
- if (BufferDesc.ReturnValue > 0) {\r
- //\r
- // Write remaining data, if any\r
- //\r
- if (BufferDesc.Cnt != 0u) {\r
- SEGGER_RTT_Write(BufferIndex, acBuffer, BufferDesc.Cnt);\r
- }\r
- BufferDesc.ReturnValue += (int)BufferDesc.Cnt;\r
- }\r
- return BufferDesc.ReturnValue;\r
-}\r
-\r
-/*********************************************************************\r
-*\r
-* SEGGER_RTT_printf\r
-*\r
-* Function description\r
-* Stores a formatted string in SEGGER RTT control block.\r
-* This data is read by the host.\r
-*\r
-* Parameters\r
-* BufferIndex Index of "Up"-buffer to be used. (e.g. 0 for "Terminal")\r
-* sFormat Pointer to format string, followed by the arguments for conversion\r
-*\r
-* Return values\r
-* >= 0: Number of bytes which have been stored in the "Up"-buffer.\r
-* < 0: Error\r
-*\r
-* Notes\r
-* (1) Conversion specifications have following syntax:\r
-* %[flags][FieldWidth][.Precision]ConversionSpecifier\r
-* (2) Supported flags:\r
-* -: Left justify within the field width\r
-* +: Always print sign extension for signed conversions\r
-* 0: Pad with 0 instead of spaces. Ignored when using '-'-flag or precision\r
-* Supported conversion specifiers:\r
-* c: Print the argument as one char\r
-* d: Print the argument as a signed integer\r
-* u: Print the argument as an unsigned integer\r
-* x: Print the argument as an hexadecimal integer\r
-* s: Print the string pointed to by the argument\r
-* p: Print the argument as an 8-digit hexadecimal integer. (Argument shall be a pointer to void.)\r
-*/\r
-int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...) {\r
- int r;\r
- va_list ParamList;\r
-\r
- va_start(ParamList, sFormat);\r
- r = SEGGER_RTT_vprintf(BufferIndex, sFormat, &ParamList);\r
- va_end(ParamList);\r
- return r;\r
-}\r
-/*************************** End of file ****************************/\r
/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* trcStreamingPort.h\r
* The interface definitions for trace streaming ("stream ports").\r
* This "stream port" sets up the recorder to use SEGGER RTT as streaming channel.\r
*\r
+ * Note that this stream port is more complex than the typical case, since\r
+ * the J-Link interface uses a separate RAM buffer in SEGGER_RTT.c, instead\r
+ * of the default buffer included in the recorder core. The other stream ports \r
+ * offer more typical examples of how to define a custom streaming interface.\r
+ *\r
* Terms of Use\r
* This file is part of the trace recorder library (RECORDER), which is the \r
* intellectual property of Percepio AB (PERCEPIO) and provided under a\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2017.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
\r
* internal RAM buffer read by the J-Link probes during execution.\r
*\r
* Possible values:\r
- * - SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL (default)\r
- * - SEGGER_RTT_MODE_NO_BLOCK_SKIP\r
+ * - SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL \r
+ * - SEGGER_RTT_MODE_NO_BLOCK_SKIP (default)\r
*\r
- * We recommend using SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL, to ensure you get a\r
+ * Using SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL ensure that you get a\r
* complete and valid trace. This may however cause blocking if your streaming\r
* interface isn't fast enough, which may disturb the real-time behavior.\r
- * We therefore recommend to try SEGGER_RTT_MODE_NO_BLOCK_SKIP as well. \r
- * In this mode, Tracealyzer will report lost events if the transfer is not\r
+ * \r
+ * We therefore recommend SEGGER_RTT_MODE_NO_BLOCK_SKIP. In this mode, \r
+ * Tracealyzer will report lost events if the transfer is not\r
* fast enough. In that case, try increasing the size of the "up buffer".\r
******************************************************************************/\r
-#define TRC_CFG_RTT_MODE SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL\r
+#define TRC_CFG_RTT_MODE SEGGER_RTT_MODE_NO_BLOCK_SKIP\r
\r
#include "SEGGER_RTT_Conf.h"\r
#include "SEGGER_RTT.h"\r
#if TRC_CFG_RTT_UP_BUFFER_INDEX == 0\r
#define TRC_RTT_ALLOC_UP() static char* _TzTraceData = NULL; /* Not actually used. Ignore allocation method. */\r
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */\r
-#define TRC_ALLOC_CUSTOM_BUFFER(bufname) /* Only for custom allocation */\r
#else\r
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC\r
#define TRC_RTT_ALLOC_UP() char _TzTraceData[TRC_CFG_RTT_BUFFER_SIZE_UP]; /* Static allocation */\r
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */\r
-#define TRC_ALLOC_CUSTOM_BUFFER(bufname) /* Only for custom allocation */\r
#endif\r
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC\r
#define TRC_RTT_ALLOC_UP() char* _TzTraceData = NULL; /* Dynamic allocation */\r
#define TRC_STREAM_PORT_MALLOC() _TzTraceData = TRC_PORT_MALLOC(TRC_CFG_RTT_BUFFER_SIZE_UP);\r
-#define TRC_ALLOC_CUSTOM_BUFFER(bufname) /* Only for custom allocation */\r
#endif\r
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM\r
#define TRC_RTT_ALLOC_UP() char* _TzTraceData = NULL; /* Custom allocation, user needs to call vTraceSetRecorderDataBuffer before vTraceEnable, to assign this */ \r
#define TRC_STREAM_PORT_MALLOC() /* Not used in custom mode */\r
-#define TRC_ALLOC_CUSTOM_BUFFER(bufname) char bufname [TRC_CFG_RTT_BUFFER_SIZE_UP]; /* Not static in this case, since declared in user code */\r
#endif\r
#endif\r
\r
TRC_RTT_ALLOC_UP() /* Macro that will result in proper UP buffer allocation */ \\r
TRC_RTT_ALLOC_DOWN() /* Macro that will result in proper DOWN buffer allocation */\r
\r
+int32_t readFromRTT(void* ptrData, uint32_t size, int32_t* ptrBytesRead);\r
+\r
+int32_t writeToRTT(void* ptrData, uint32_t size, int32_t* ptrBytesWritten);\r
+\r
+\r
#define TRC_STREAM_PORT_INIT() \\r
TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */ \\r
SEGGER_RTT_ConfigUpBuffer(TRC_CFG_RTT_UP_BUFFER_INDEX, "TzData", _TzTraceData, TRC_CFG_RTT_BUFFER_SIZE_UP, TRC_CFG_RTT_MODE ); \\r
SEGGER_RTT_ConfigDownBuffer(TRC_CFG_RTT_DOWN_BUFFER_INDEX, "TzCtrl", _TzCtrlData, TRC_CFG_RTT_BUFFER_SIZE_DOWN, TRC_CFG_RTT_MODE);\r
\r
-#define TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) _type _tmpArray[_size / sizeof(_type)]; _type* _ptrData = _tmpArray;\r
-#define TRC_STREAM_PORT_ALLOCATE_DYNAMIC_EVENT(_type, _ptrData, _size) _type _tmpArray[sizeof(largestEventType) / sizeof(_type)]; _type* _ptrData = _tmpArray;\r
-#define TRC_STREAM_PORT_COMMIT_EVENT(_ptrData, _size) SEGGER_RTT_Write(TRC_CFG_RTT_UP_BUFFER_INDEX, (const char*)_ptrData, _size);\r
-#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) if (SEGGER_RTT_HASDATA(TRC_CFG_RTT_DOWN_BUFFER_INDEX)) *_ptrBytesRead = (int)SEGGER_RTT_Read(TRC_CFG_RTT_DOWN_BUFFER_INDEX, (char*)_ptrData, _size);\r
-#define TRC_STREAM_PORT_PERIODIC_SEND_DATA(_ptrBytesSent)\r
+/* Important for the J-Link port, in most other ports this can be skipped (default is 1) */\r
+#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 0\r
+ \r
+#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesWritten) writeToRTT(_ptrData, _size, _ptrBytesWritten)\r
\r
-#define TRC_STREAM_PORT_ON_TRACE_BEGIN() /* Do nothing */\r
-#define TRC_STREAM_PORT_ON_TRACE_END() /* Do nothing */\r
- \r
+#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) readFromRTT(_ptrData, _size, _ptrBytesRead)\r
\r
#ifdef __cplusplus\r
}\r
--- /dev/null
+\r
+#include "trcRecorder.h"\r
+\r
+#if (TRC_USE_TRACEALYZER_RECORDER == 1)\r
+#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)\r
+\r
+int32_t readFromRTT(void* ptrData, uint32_t size, int32_t* ptrBytesRead)\r
+{\r
+ uint32_t bytesRead = 0; \r
+ \r
+ if (SEGGER_RTT_HASDATA(TRC_CFG_RTT_DOWN_BUFFER_INDEX))\r
+ {\r
+ bytesRead = SEGGER_RTT_Read((TRC_CFG_RTT_DOWN_BUFFER_INDEX), (char*)ptrData, size);\r
+ \r
+ if (ptrBytesRead != NULL)\r
+ *ptrBytesRead = (int32_t)bytesRead;\r
+ \r
+ if (bytesRead != size)\r
+ {\r
+ return -1;\r
+ }\r
+\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+int32_t writeToRTT(void* ptrData, uint32_t size, int32_t* ptrBytesWritten)\r
+{\r
+ uint32_t bytesWritten = SEGGER_RTT_Write((TRC_CFG_RTT_UP_BUFFER_INDEX), (const char*)ptrData, size);\r
+ \r
+ if (ptrBytesWritten != NULL)\r
+ *ptrBytesWritten = (int32_t)bytesWritten;\r
+\r
+ if (bytesWritten != size)\r
+ {\r
+ return -1;\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+#endif\r
+#endif\r
/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* trcStreamingPort.h\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2017.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
\r
extern "C" {\r
#endif\r
\r
-/*******************************************************************************\r
- * TRC_RECORDER_TRANSFER_METHOD_TCPIP\r
- * \r
- * This stream port for TCP/IP uses a temporary buffer consisting of multiple \r
- * pages, that are transmitted periodically by the TzCtrl task. You can modify \r
- * the supporting functions to match your system. See trcStreamingPort.c\r
- ******************************************************************************/\r
-\r
-int32_t trcTcpWrite(void* data, uint32_t size, int32_t *ptrBytesWritten);\r
int32_t trcTcpRead(void* data, uint32_t size, int32_t *ptrBytesRead);\r
\r
-#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC\r
-#define TRC_STREAM_PORT_ALLOCATE_FIELDS() static char _TzTraceData[TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE]; /* Static allocation. */\r
-#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */\r
-#else\r
-#define TRC_STREAM_PORT_ALLOCATE_FIELDS() static char* _TzTraceData = NULL; /* Dynamic allocation. */\r
-#define TRC_STREAM_PORT_MALLOC() _TzTraceData = TRC_PORT_MALLOC(TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE);\r
-#endif\r
-\r
-#define TRC_STREAM_PORT_INIT() \\r
- TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */ \\r
- prvPagedEventBufferInit(_TzTraceData);\r
+int32_t trcTcpWrite(void* data, uint32_t size, int32_t *ptrBytesWritten);\r
\r
-#define TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) _type* _ptrData; _ptrData = (_type*)prvPagedEventBufferGetWritePointer(_size);\r
-#define TRC_STREAM_PORT_ALLOCATE_DYNAMIC_EVENT(_type, _ptrData, _size) TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) /* We do the same thing as for non-dynamic event sizes */\r
-#define TRC_STREAM_PORT_COMMIT_EVENT(_ptrData, _size) /* Not needed since we write immediately into the buffer received above by TRC_STREAM_PORT_ALLOCATE_EVENT, and the TRC_STREAM_PORT_PERIODIC_SEND_DATA defined below will take care of the actual trace transfer. */\r
-#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) trcTcpRead(_ptrData, _size, _ptrBytesRead);\r
-#define TRC_STREAM_PORT_PERIODIC_SEND_DATA(_ptrBytesSent) prvPagedEventBufferTransfer(trcTcpWrite, _ptrBytesSent);\r
+#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) trcTcpRead(_ptrData, _size, _ptrBytesRead)\r
\r
-#define TRC_STREAM_PORT_ON_TRACE_BEGIN() prvPagedEventBufferInit(_TzTraceData);\r
-#define TRC_STREAM_PORT_ON_TRACE_END() /* Do nothing */\r
+#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesSent) trcTcpWrite(_ptrData, _size, _ptrBytesSent)\r
\r
#ifdef __cplusplus\r
}\r
/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* trcStreamingPort.c\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2017.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
\r
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) \r
#if (TRC_USE_TRACEALYZER_RECORDER == 1)\r
\r
-/* TCP/IP includes */\r
+/* TCP/IP includes - for lwIP in this case */\r
#include "lwip/tcpip.h"\r
#include "lwip/sockets.h"\r
\r
if (new_sd < 0)\r
return -1;\r
\r
+ if (bytesWritten == NULL)\r
+ return -1;\r
+ \r
*bytesWritten = send( new_sd, data, size, 0 );\r
if (*bytesWritten < 0)\r
{\r
/* EWOULDBLOCK may be expected when buffers are full */\r
- if (errno != EWOULDBLOCK)\r
+ if (errno != 0 && errno != EWOULDBLOCK)\r
{\r
closesocket(new_sd);\r
new_sd = -1;\r
if ( *bytesRead < 0 )\r
{\r
/* EWOULDBLOCK may be expected when there is no data to receive */\r
- if (errno != EWOULDBLOCK)\r
+ if (errno != 0 && errno != EWOULDBLOCK)\r
{\r
closesocket(new_sd);\r
new_sd = -1;\r
/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* trcStreamingPort.h\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2017.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
\r
extern "C" {\r
#endif\r
\r
-/*******************************************************************************\r
- * Implement the below macros to define your own stream port. If your transfer \r
- * method uses RTOS functions, you should not send the data directly but use \r
- * the recorder's internal buffer to store the trace data, for later transfer by\r
- * the TzCtrl task. Check the predefined stream ports for examples on how to use \r
- * the internal buffer (e.g., TCP/IP, UART or USB CDC).\r
- *\r
- * Read more at http://percepio.com/2016/10/05/rtos-tracing/ \r
- ******************************************************************************/\r
-\r
/* Include files as needed, in this case it is files from STM32Cube FW_F7 V1.4.1 */\r
#include "usb_device.h"\r
#include "usbd_cdc.h"\r
/* Tested on STM32 devices using Keil/CMSIS USB stack */\r
\r
extern USBD_CDC_ItfTypeDef USBD_Interface_fops_FS;\r
+\r
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len);\r
\r
int32_t trcCDCReceive(void *data, uint32_t size, int32_t* NumBytes);\r
-int32_t trcCDCTransmit(void* data, uint32_t size, int32_t * noOfBytesSent );\r
\r
-#if TRC_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC\r
-#define TRC_STREAM_PORT_ALLOCATE_FIELDS() static char _TzTraceData[TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE]; /* Static allocation. */\r
-#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */\r
-#else\r
-#define TRC_STREAM_PORT_ALLOCATE_FIELDS() static char* _TzTraceData = NULL; /* Dynamic allocation. */\r
-#define TRC_STREAM_PORT_MALLOC() _TzTraceData = TRC_PORT_MALLOC(TRC_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_PAGED_EVENT_BUFFER_PAGE_SIZE);\r
-#endif\r
+int32_t trcCDCTransmit(void* data, uint32_t size, int32_t * noOfBytesSent );\r
\r
#define TRC_STREAM_PORT_INIT() \\r
MX_USB_DEVICE_Init(); \\r
TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */\r
\r
-#define TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) _type* _ptrData; _ptrData = (_type*)prvPagedEventBufferGetWritePointer(_size);\r
+#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) trcCDCReceive(_ptrData, _size, _ptrBytesRead)\r
\r
-#define TRC_STREAM_PORT_ALLOCATE_DYNAMIC_EVENT(_type, _ptrData, _size) TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) /* We do the same thing as for non-dynamic event sizes */\r
-#define TRC_STREAM_PORT_COMMIT_EVENT(_ptrData, _size) /* Not needed since we write immediately into the buffer received above by TRC_STREAM_PORT_ALLOCATE_EVENT, and the TRC_STREAM_PORT_PERIODIC_SEND_DATA defined below will take care of the actual trace transfer. */\r
-#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) trcCDCReceive(_ptrData, _size, _ptrBytesRead);\r
-#define TRC_STREAM_PORT_PERIODIC_SEND_DATA(_ptrBytesSent) prvPagedEventBufferTransfer(trcCDCTransmit, _ptrBytesSent);\r
+#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesSent) trcCDCTransmit(_ptrData, _size, _ptrBytesSent)\r
\r
-#define TRC_STREAM_PORT_ON_TRACE_BEGIN() { prvPagedEventBufferInit(_TzTraceData); }\r
-#define TRC_STREAM_PORT_ON_TRACE_END() /* Do nothing */\r
\r
#ifdef __cplusplus\r
}\r
+\r
#include "trcRecorder.h"\r
\r
#if (TRC_USE_TRACEALYZER_RECORDER == 1)\r
-#if(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)\r
+#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)\r
\r
#include "stdint.h"\r
\r
uint8_t UserTxBufferFS[APP_TX_DATA_SIZE];\r
\r
extern USBD_HandleTypeDef hUsbDeviceFS;\r
-extern PCD_HandleTypeDef hpcd_USB_OTG_FS;\r
\r
+extern PCD_HandleTypeDef hpcd_USB_OTG_FS;\r
\r
recBuf commandBuffer;\r
\r
return result;\r
}\r
\r
+/* The READ function, used in trcStreamingPort.h */\r
int32_t trcCDCReceive(void *data, uint32_t size, int32_t* NumBytes)\r
{\r
uint32_t i,diff;\r
return 0;\r
}\r
\r
+/* The WRITE function, used in trcStreamingPort.h */\r
int32_t trcCDCTransmit(void* data, uint32_t size, int32_t * noOfBytesSent )\r
{\r
int32_t result;\r
- result=CDC_Transmit_FS(data,size);\r
- *noOfBytesSent=size;\r
-\r
- return result;\r
+ result=CDC_Transmit_FS(data, size);\r
+ *noOfBytesSent = size;\r
+ \r
+ /* Return value should be 0 on success (not sure what the value of USBD_OK is) */\r
+ if (result == USBD_OK)\r
+ return 0;\r
+ else\r
+ return -1;\r
}\r
\r
/**\r
--- /dev/null
+-------------------------------------------------------------------------------\r
+ Tracealyzer Recorder Library v4.1.0 for FreeRTOS\r
+-------------------------------------------------------------------------------\r
+\r
+Tracealyzer is a sophisticated tool for tracing and visualization\r
+of FreeRTOS-based software systems.\r
+\r
+Tracealyzer gives an unprecedented insight into the runtime behavior, which \r
+speeds up debugging, validation and optimization. \r
+\r
+This, the Trace Recorder Library, is the target-side part of Tracealyzer, that\r
+performs the actual tracing. The resulting data can then be viewed in the\r
+Tracealyzer PC application, found at https://percepio.com/tracealyzer\r
+\r
+To learn more, see these links.\r
+\r
+ - Getting Started (videos etc): https://percepio.com/gettingstarted\r
+\r
+ - FAQ: https://percepio.com/category/faq\r
+\r
+In case you have any questions, don't hesitate to contact support@percepio.com\r
+\r
+Tracealyzer supports FreeRTOS v7.3 and newer, including Amazon FreeRTOS.\r
+\r
+-------------------------------------------------------------------------------\r
+\r
+Changes, v4.0.3 -> v4.1.0\r
+\r
+- Improved performance of User Events\r
+- Fixed handling of format strings ending with '%'\r
+- Improved handling of creative user configuration macros\r
+\r
+-------------------------------------------------------------------------------\r
+\r
+Changes, v4.0.2 -> v4.0.3\r
+\r
+- Minor fix for TCP/IP stream port.\r
+- Corrected default RTT mode setting.\r
+\r
+-------------------------------------------------------------------------------\r
+\r
+Changes, v4.0.1 -> v4.0.2\r
+\r
+- Memory allocation trace events now ignore filters.\r
+\r
+-------------------------------------------------------------------------------\r
+\r
+Changes, v4.0.0 -> v4.0.1\r
+\r
+- Minor fixes to default values.\r
+\r
+-------------------------------------------------------------------------------\r
+\r
+Changes, v3.3.0 -> v4.0.0\r
+\r
+- Fixed some issues with filters.\r
+\r
+-------------------------------------------------------------------------------\r
+\r
+Changes, v3.2.0 -> v3.3.0\r
+\r
+- Added support for FreeRTOS v10, including the new object types Message Buffer\r
+ and Stream Buffer.\r
+\r
+- Improved the object-level filtering to also support Timer, Event Group, \r
+ Message Buffer and Stream Buffer objects.\r
+\r
+- Fixed a few remaining build problems with older FreeRTOS versions (v7.x).\r
+\r
+- vTraceStoreISRBegin now reports an error on invalid handles, i.e., if the \r
+ initialization of the handle (xTraceSetISRProperties) had not been made.\r
+\r
+-------------------------------------------------------------------------------\r
+\r
+Changes, v3.1.2 -> v3.2.0\r
+\r
+- Added new filtering system - that works in both snapshot and streaming mode.\r
+ Filtering was previously not supported in streaming mode, but can be very\r
+ useful for slower streaming interfaces. By exluding irrelevant events, the\r
+ amount of data produced can be reduced a lot.\r
+\r
+ * New functions vTraceSetFilterGroup and vTraceSetFilterMask allows for\r
+ excluding all events from specific objects (like a semaphore or queue).\r
+\r
+ * Added new "generic" filters (preprocessor level) to trcConfig.h, that\r
+ exclude all events of a particular types.\r
+ - TRC_CFG_INCLUDE_NOTIFY_EVENTS\r
+ - TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS\r
+ - TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS\r
+ - TRC_CFG_INCLUDE_TIMER_EVENTS\r
+\r
+ * Upgraded some previous filters from "Snapshot only" to the Common API \r
+ and thereby moved them from trcSnapshotConfig.h to trcConfig.h.\r
+ - TRC_CFG_SCHEDULING_ONLY\r
+ - TRC_CFG_INCLUDE_MEMMANG_EVENTS\r
+ - TRC_CFG_INCLUDE_USER_EVENTS\r
+ - TRC_CFG_INCLUDE_ISR_TRACING\r
+ - TRC_CFG_INCLUDE_READY_EVENTS\r
+ - TRC_CFG_INCLUDE_OSTICK_EVENTS\r
+\r
+ * Removed the old filter system from trcSnapshotRecorder.c.\r
+\r
+- Improved streaming interface - Now only two (2) macros are needed to be \r
+ defined in most cases, read and write. This makes it a lot easier to make\r
+ custom stream ports.\r
+\r
+ * Many definitions that were identical in most stream ports, have been\r
+ replaced by default definitions in the recorder core. If needed, they\r
+ can be overriden by custom definitions in trcStreamingPort.h.\r
+\r
+ * Stream ports are now assumed to use recorder's internal event buffer.\r
+ Other stream ports that writes directly to the streaming interface\r
+ (like J-Link) should define TRC_STREAM_PORT_USE_INTERNAL_BUFFER\r
+ as zero (0) to make it work correctly.\r
+\r
+ * Macro TRC_STREAM_PORT_PERIODIC_SEND_DATA has been replaced by\r
+ TRC_STREAM_PORT_WRITE_DATA. Together with TRC_STREAM_PORT_READ_DATA,\r
+ this is all that is necessary for a typical stream port.\r
+\r
+ * Return values from the stream port macros READ_DATA and WRITE_DATA are\r
+ now checked. Expects 0 on success, anything else produces a warning\r
+ that can be retrived using xTraceGetLastError() and also seen in\r
+ Tracealyzer if a trace was produced.\r
+\r
+ * Stream ports should no longer call prvPagedEventBufferInit explicitly\r
+ (e.g. in TRC_STREAM_PORT_ON_TRACE_BEGIN). This is now called \r
+ automatically if TRC_STREAM_PORT_USE_INTERNAL_BUFFER == 1.\r
+\r
+ * Macros TRC_STREAM_PORT_ON_TRACE_BEGIN and TRC_STREAM_PORT_ON_TRACE_END\r
+ are now unused by default and don't need to be defined.\r
+ You can however use them to hook in some own function at these events.\r
+\r
+- Added two new stream ports\r
+\r
+ * TCPIP-Win32: allows for testing the streaming on Windows ports of your\r
+ RTOS, using Winsock.\r
+\r
+ * File: example of streaming to a local file system (tested on Windows,\r
+ but easy to modify).\r
+\r
+- Added support for FreeRTOS v9.0.1\r
+\r
+ * Replaced FreeRTOS version code TRC_FREERTOS_VERSION_9_X with\r
+ - TRC_FREERTOS_VERSION_9_0_0\r
+ - TRC_FREERTOS_VERSION_9_0_1\r
+\r
+ * Using TRC_FREERTOS_VERSION_9_X is no longer allowed.\r
+\r
+- Added additional events for xQueuePeek, for blocking and timeouts events.\r
+\r
+- Added event for traceTIMER_EXPIRED, showing when the timer callback\r
+ function is called.\r
+\r
+- Improved diagnostics in streaming mode, in case of errors in the recorder.\r
+\r
+ * Added prvTraceWarning() - registers a "warning" error code, without\r
+ stopping the recorder. Called if READ_DATA or WRITE_DATA returns a\r
+ non-zero value, and in several other cases where the recorder \r
+ configuration is incorrect (e.g., too small symbol table). \r
+\r
+ * Added several new warning codes (PSF_WARNING_XYZ), corresponding to the\r
+ issues detected by prvCheckRecorderStatus.\r
+\r
+ * Fixed duplicate definitions of warning messages, so the warnings reported\r
+ to Tracealyzer are the same as those provided in xTraceGetLastError().\r
+\r
+ * Added better explainations of warning/error messages in the body of\r
+ xTraceGetLastError (in streaming mode).\r
+\r
+- Added xTraceIsRecordingEnabled() to Common API.\r
+\r
+- Added "unofficial" hardware port for Altera Nios-II. \r
+ This is a user contribition, not yet verified by Percerpio.\r
+\r
+- Fixed bug in vTraceEnable - option TRC_START_AWAIT_HOST was ignored if already initialized. \r
+\r
+- Fixed a few remaining compiler warnings.\r
+\r
+- Changed order of some settings in trcConfig.h - moved advanced stuff to the\r
+ bottom.\r
+\r
+- Removed SEGGER_RTT_Printf.c from the J-Link stream port since not required\r
+ for Tracealyzer.\r
+\r
+-------------------------------------------------------------------------------\r
+\r
+Changes, v3.1.1 -> v3.1.2\r
+- Fixed two bugs related to User Events, one in vTracePrintF and other in vTracePrint.\r
+\r
+- Fixed a build problem related to a single reference of the old FreeRTOS type "xTaskHandle", in trcKernelPort.c.\r
+ Changed to "TaskHandle_t", unless if using an older FreeRTOS kernel or the "compatibility mode".\r
+\r
+- Removed traceCREATE_MUTEX hook for FreeRTOS v9 or later (no longer required)\r
+\r
+- Updated the User Manual regarding snapshot trace via IAR Embedded Workbench.\r
+\r
+- Renamed vTraceGetTraceBuffer to xTraceGetTraceBuffer, since returning a pointer.\r
+\r
+-------------------------------------------------------------------------------\r
+\r
+Changes, v3.1.0 -> v3.1.1\r
+\r
+After the major changes in the v3.1.0 trace recorder library, this update \r
+corrects a number of minor issues. Only minor functional improvements.\r
+\r
+- You can now use TRC_ALLOC_CUSTOM_BUFFER to declare a trace buffer on a custom\r
+ location (using linker directives). \r
+ The related function vTraceSetRecorderDataBuffer has been promoted to the\r
+ Common API (previously only supported in snapshot mode, but custom allocation\r
+ is now generally supported also in streaming mode).\r
+ \r
+- Removed TRC_CFG_USE_LINKER_PRAGMA. No longer necessary thanks to the custom\r
+ allocation mode.\r
+ \r
+- Added support for timestamping from custom periodic timers, required for\r
+ accurate timestamping on Cortex-M0/M0+ devices when using tickless idle.\r
+ Only for streaming mode so far. See TRC_CUSTOM_TIMER_INCR / DECR.\r
+\r
+- ARM Cortex-M port: Made sure the DWT unit is initialized properly, in case\r
+ the debugger doesn't handle this.\r
+\r
+- ARM Cortex-M port: Added possibility to use Systick timestamping also on\r
+ Cortex-M3/M4/M7 devices (that otherwise use DWT timestamping by default).\r
+ To use this option, define the macro TRC_CFG_ARM_CM_USE_SYSTICK.\r
+\r
+- J-Link streaming: The default RTT buffer has been changed from 0 to 1.\r
+\r
+- J-Link streaming: The RTT buffer settings for buffer 1 and higher, are now\r
+ found in trcStreamingPort.h. Note: These settings don't apply to buffer 0.\r
+\r
+- vTracePrint has been optimized for better performance in string logging.\r
+\r
+- Minor performance improvement related to symbol table transfer in streaming mode.\r
+\r
+- Timer names now registered also in streaming mode.\r
+\r
+- Timer start and stop event are now traced.\r
+\r
+- Implemented support for queue registry (traceQUEUE_REGISTRY_ADD) also for streaming.\r
+\r
+- Fixed a bug related to repeated calls of vTraceEnable.\r
+\r
+- Fixed a bug where task-switches seemed to occur even though the scheduler was disabled.\r
+\r
+- Renamed HARDWARE_PORT_TEXAS_INSTRUMENTS_TMS570_RM48, added prefix TRC.\r
+\r
+- Fixed several language issues in the comments and documentation.\r
+\r
+- Fixed several minor issues and warnings from different compilers\r
+ (including PowerPC/gcc) and configurations.\r
+\r
+-------------------------------------------------------------------------------\r
+ \r
+Changes, v3.0.9 -> v3.1.0\r
+\r
+- Merge of previously separated snapshot and streaming recorders into a single\r
+ recorder supporting both streaming and snapshot as different modes.\r
+ \r
+- New common API for supporting both streaming and snapshot modes.\r
+ \r
+- New integration guide, see the User Manual.\r
+\r
+- Major improvement of API documentation in source files and User Manual.\r
+ \r
+- New concept of "stream ports", giving a better structure defining streaming\r
+ interfaces, and restructured the J-Link and TCP/IP streaming as stream ports.\r
+ \r
+- Added a stream port for USB CDC connections, with STM32 as example.\r
+ Since Tracealyzer now can receive serial data on Windows COM ports, this is\r
+ really easy to use.\r
+\r
+- Added a warning (#error) for cases where FreeRTOS tickless idle mode is used\r
+ together with timestamping using SysTick or other periodic interrupt timers,\r
+ Tracing with tickless idle requires an independent time source to correctly\r
+ capture the length of the idle periods.\r
+ \r
+- Major changes in the recorder API. Important examples are:\r
+\r
+ * Some configuration macros have changed names, e.g. for "hardware port".\r
+ Make sure to remove any old "trcConfig.h" files if upgrading from an\r
+ earlier version!\r
+\r
+ * Recorder configuration in trcConfig.h has been minimized and now only \r
+ includes the important settings that are independent of recorder mode.\r
+ Advanced settings for each mode are found in trcSnapshotConfig.h and\r
+ trcStreamingConfig.h.\r
+ \r
+ * vTraceEnable replaces Trace_Init and vTraceInitTraceData, as well as\r
+ vTraceStart and uiTraceStart.\r
+ \r
+ * vTraceStop now part of the common API and thereby available also in\r
+ streaming. And since vTraceEnable can start the streaming directly\r
+ you have the option control the tracing from target, e.g., for\r
+ streaming to a device file system.\r
+ \r
+ * vTraceStoreKernelObjectName from old streaming recorder has been replaced\r
+ by vTraceSetQueueName, vTraceSetSemaphoreName, etc.\r
+ \r
+ * vTraceSetISRProperties now returns a "traceHandle" that should be passed as\r
+ parameter to vTraceStoreISRBegin and vTraceStoreISREnd.\r
+ \r
+ * xTraceRegisterString has replaced the old functions xTraceOpenLabel and \r
+ vTraceStoreUserEventChannelName. This now returns a "traceString" for use\r
+ as "channel" parameter in vTracePrintF, and in other places where strings\r
+ are stored.\r
+ \r
+ * Removed vTraceStoreISREndManual and vTraceStoreISREndAuto, use\r
+ vTraceStoreISREnd instead.\r
+ \r
+ * Renamed the functions for saving User Events in a separate buffer:\r
+ - xTraceRegisterChannelFormat -> xTraceRegisterUBChannel\r
+ - vTraceChannelPrintF -> vTraceUBData\r
+ - vTraceChannelUserEvent -> vTraceUBEvent\r
+ \r
+ \r
+-------------------------------------------------------------------------------\r
+Copyright Percepio AB, 2018.
\ No newline at end of file
/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* trcKernelPort.c\r
* The FreeRTOS-specific parts of the trace recorder\r
*\r
* Terms of Use\r
- * This file is part of the trace recorder library (RECORDER), which is the\r
+ * This file is part of the trace recorder library (RECORDER), which is the \r
* intellectual property of Percepio AB (PERCEPIO) and provided under a\r
* license as follows.\r
* The RECORDER may be used free of charge for the purpose of recording data\r
* You may distribute the RECORDER in its original source code form, assuming\r
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are\r
* allowed to distribute the RECORDER with minor modifications intended for\r
- * configuration or porting of the RECORDER, e.g., to allow using it on a\r
+ * configuration or porting of the RECORDER, e.g., to allow using it on a \r
* specific processor, processor family or with a specific communication\r
* interface. Any such modifications should be documented directly below\r
- * this comment block.\r
+ * this comment block. \r
*\r
* Disclaimer\r
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty\r
- * as to its use or performance. PERCEPIO does not and cannot warrant the\r
+ * as to its use or performance. PERCEPIO does not and cannot warrant the \r
* performance or results you may obtain by using the RECORDER or documentation.\r
* PERCEPIO make no warranties, express or implied, as to noninfringement of\r
* third party rights, merchantability, or fitness for any particular purpose.\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2017.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
\r
\r
#if (defined(TRC_USE_TRACEALYZER_RECORDER) && TRC_USE_TRACEALYZER_RECORDER == 1)\r
\r
+#ifndef TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS\r
+ /* TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS is missing in trcConfig.h. */\r
+#error "TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS must be defined in trcConfig.h."\r
+#endif\r
+\r
+#ifndef TRC_CFG_INCLUDE_TIMER_EVENTS\r
+ /* TRC_CFG_INCLUDE_TIMER_EVENTS is missing in trcConfig.h. */\r
+#error "TRC_CFG_INCLUDE_TIMER_EVENTS must be defined in trcConfig.h."\r
+#endif\r
+\r
+#ifndef TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS\r
+ /* TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS is missing in trcConfig.h. */\r
+#error "TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS must be defined in trcConfig.h."\r
+#endif\r
+\r
+#ifndef TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS\r
+ /* TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS is missing in trcConfig.h. Define this as 1 if using FreeRTOS v10 or later and like to trace stream buffer or message buffer events, otherwise 0. */\r
+#error "TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS must be defined in trcConfig.h."\r
+#endif\r
+\r
#if (configUSE_TICKLESS_IDLE != 0 && (TRC_HWTC_TYPE == TRC_OS_TIMER_INCR || TRC_HWTC_TYPE == TRC_OS_TIMER_DECR))\r
- /*\r
+ /* \r
The below error message is to alert you on the following issue:\r
-\r
- The hardware port selected in trcConfig.h uses the operating system timer for the\r
+ \r
+ The hardware port selected in trcConfig.h uses the operating system timer for the \r
timestamping, i.e., the periodic interrupt timer that drives the OS tick interrupt.\r
-\r
- When using tickless idle, the recorder needs an independent time source in order to\r
- correctly record the durations of the idle times. Otherwise, the trace may appear\r
+ \r
+ When using "tickless idle" mode, the recorder needs an independent time source in\r
+ order to correctly record the durations of the idle times. Otherwise, the trace may appear\r
to have a different length than in reality, and the reported CPU load is also affected.\r
-\r
+ \r
You may override this warning by defining the TRC_CFG_ACKNOWLEDGE_TICKLESS_IDLE_WARNING\r
macro in your trcConfig.h file. But then the time scale may be incorrect during\r
tickless idle periods.\r
-\r
+ \r
To get this correct, override the default timestamping by setting TRC_CFG_HARDWARE_PORT\r
in trcConfig.h to TRC_HARDWARE_PORT_APPLICATION_DEFINED and define the HWTC macros\r
accordingly, using a free running counter or an independent periodic interrupt timer.\r
See trcHardwarePort.h for details.\r
-\r
- For ARM Cortex-M3, M4 and M7 MCUs this is not an issue, since the recorder uses the\r
- DWT cycle counter for timestamping in these cases.\r
+ \r
+ For ARM Cortex-M3, M4 and M7 MCUs this is not an issue, since the recorder uses the \r
+ DWT cycle counter for timestamping in these cases. \r
*/\r
-\r
+ \r
#ifndef TRC_CFG_ACKNOWLEDGE_TICKLESS_IDLE_WARNING\r
#error Trace Recorder: This timestamping mode is not recommended with Tickless Idle.\r
#endif\r
-#endif\r
-\r
+#endif /* (configUSE_TICKLESS_IDLE != 0 && (TRC_HWTC_TYPE == TRC_OS_TIMER_INCR || TRC_HWTC_TYPE == TRC_OS_TIMER_DECR)) */\r
+ \r
#include "task.h"\r
#include "queue.h"\r
\r
-#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)\r
+#if (TRC_CFG_INCLUDE_TIMER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X)\r
+/* If the project does not include the FreeRTOS timers, TRC_CFG_INCLUDE_TIMER_EVENTS must be set to 0 */\r
+#include "timers.h"\r
+#endif /* (TRC_CFG_INCLUDE_TIMER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X) */\r
+\r
+#if (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X)\r
+/* If the project does not include the FreeRTOS event groups, TRC_CFG_INCLUDE_TIMER_EVENTS must be set to 0 */\r
+#include "event_groups.h"\r
+#endif /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X) */\r
+\r
+#if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+/* If the project does not include the FreeRTOS stream buffers, TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS must be set to 0 */\r
+#include "stream_buffer.h"\r
+#endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+\r
+uint32_t prvTraceGetQueueNumber(void* handle);\r
+\r
+#if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_8_X)\r
+\r
+extern unsigned char ucQueueGetQueueNumber( xQueueHandle pxQueue );\r
+extern void vQueueSetQueueNumber( xQueueHandle pxQueue, unsigned char ucQueueNumber );\r
+extern unsigned char ucQueueGetQueueType( xQueueHandle pxQueue );\r
+\r
+uint32_t prvTraceGetQueueNumber(void* handle)\r
+{\r
+ return (uint32_t)ucQueueGetQueueNumber(handle);\r
+}\r
+#else \r
+uint32_t prvTraceGetQueueNumber(void* handle)\r
+{\r
+ return (uint32_t)uxQueueGetQueueNumber(handle);\r
+}\r
+#endif /* (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_8_X) */\r
+\r
+uint8_t prvTraceGetQueueType(void* handle)\r
+{\r
+ // This is either declared in header file in FreeRTOS 8 and later, or as extern above\r
+ return ucQueueGetQueueType(handle);\r
+}\r
+\r
+/* Tasks */\r
+uint16_t prvTraceGetTaskNumberLow16(void* handle)\r
+{\r
+ return TRACE_GET_LOW16(uxTaskGetTaskNumber(handle));\r
+}\r
+\r
+uint16_t prvTraceGetTaskNumberHigh16(void* handle)\r
+{\r
+ return TRACE_GET_HIGH16(uxTaskGetTaskNumber(handle));\r
+}\r
+\r
+void prvTraceSetTaskNumberLow16(void* handle, uint16_t value)\r
+{\r
+ vTaskSetTaskNumber(handle, TRACE_SET_LOW16(uxTaskGetTaskNumber(handle), value));\r
+}\r
+\r
+void prvTraceSetTaskNumberHigh16(void* handle, uint16_t value)\r
+{\r
+ vTaskSetTaskNumber(handle, TRACE_SET_HIGH16(uxTaskGetTaskNumber(handle), value));\r
+}\r
+\r
+uint16_t prvTraceGetQueueNumberLow16(void* handle)\r
+{\r
+ return TRACE_GET_LOW16(prvTraceGetQueueNumber(handle));\r
+}\r
+\r
+uint16_t prvTraceGetQueueNumberHigh16(void* handle)\r
+{\r
+ return TRACE_GET_HIGH16(prvTraceGetQueueNumber(handle));\r
+}\r
+\r
+void prvTraceSetQueueNumberLow16(void* handle, uint16_t value)\r
+{\r
+ vQueueSetQueueNumber(handle, TRACE_SET_LOW16(prvTraceGetQueueNumber(handle), value));\r
+}\r
+\r
+void prvTraceSetQueueNumberHigh16(void* handle, uint16_t value)\r
+{\r
+ vQueueSetQueueNumber(handle, TRACE_SET_HIGH16(prvTraceGetQueueNumber(handle), value));\r
+}\r
+\r
+#if (TRC_CFG_INCLUDE_TIMER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+\r
+uint16_t prvTraceGetTimerNumberLow16(void* handle)\r
+{\r
+ return TRACE_GET_LOW16(uxTimerGetTimerNumber(handle));\r
+}\r
+\r
+uint16_t prvTraceGetTimerNumberHigh16(void* handle)\r
+{\r
+ return TRACE_GET_HIGH16(uxTimerGetTimerNumber(handle));\r
+}\r
+\r
+void prvTraceSetTimerNumberLow16(void* handle, uint16_t value)\r
+{\r
+ vTimerSetTimerNumber(handle, TRACE_SET_LOW16(uxTimerGetTimerNumber(handle), value));\r
+}\r
+\r
+void prvTraceSetTimerNumberHigh16(void* handle, uint16_t value)\r
+{\r
+ vTimerSetTimerNumber(handle, TRACE_SET_HIGH16(uxTimerGetTimerNumber(handle), value));\r
+}\r
+#endif /* (TRC_CFG_INCLUDE_TIMER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+\r
+#if (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+\r
+uint16_t prvTraceGetEventGroupNumberLow16(void* handle)\r
+{\r
+ return TRACE_GET_LOW16(uxEventGroupGetNumber(handle));\r
+}\r
+\r
+uint16_t prvTraceGetEventGroupNumberHigh16(void* handle)\r
+{\r
+ return TRACE_GET_HIGH16(uxEventGroupGetNumber(handle));\r
+}\r
+\r
+void prvTraceSetEventGroupNumberLow16(void* handle, uint16_t value)\r
+{\r
+ vEventGroupSetNumber(handle, TRACE_SET_LOW16(uxEventGroupGetNumber(handle), value));\r
+}\r
+\r
+void prvTraceSetEventGroupNumberHigh16(void* handle, uint16_t value)\r
+{\r
+ vEventGroupSetNumber(handle, TRACE_SET_HIGH16(uxEventGroupGetNumber(handle), value));\r
+}\r
+#endif /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+\r
+#if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+\r
+uint16_t prvTraceGetStreamBufferNumberLow16(void* handle)\r
+{\r
+ return TRACE_GET_LOW16(uxStreamBufferGetStreamBufferNumber(handle));\r
+}\r
+\r
+uint16_t prvTraceGetStreamBufferNumberHigh16(void* handle)\r
+{\r
+ return TRACE_GET_HIGH16(uxStreamBufferGetStreamBufferNumber(handle));\r
+}\r
+\r
+void prvTraceSetStreamBufferNumberLow16(void* handle, uint16_t value)\r
+{\r
+ vStreamBufferSetStreamBufferNumber(handle, TRACE_SET_LOW16(uxStreamBufferGetStreamBufferNumber(handle), value));\r
+}\r
+\r
+void prvTraceSetStreamBufferNumberHigh16(void* handle, uint16_t value)\r
+{\r
+ vStreamBufferSetStreamBufferNumber(handle, TRACE_SET_HIGH16(uxStreamBufferGetStreamBufferNumber(handle), value));\r
+}\r
+#endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
\r
+#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)\r
+ \r
static void* pCurrentTCB = NULL;\r
#if (defined(configENABLE_BACKWARD_COMPATIBILITY) && configENABLE_BACKWARD_COMPATIBILITY == 0)\r
/* We're explicitly not using compatibility mode */\r
static xTaskHandle HandleTzCtrl = NULL; /* TzCtrl task TCB */\r
#endif\r
\r
+#if defined(configSUPPORT_STATIC_ALLOCATION)\r
#if (configSUPPORT_STATIC_ALLOCATION == 1)\r
static StackType_t stackTzCtrl[TRC_CFG_CTRL_TASK_STACK_SIZE];\r
static StaticTask_t tcbTzCtrl;\r
#endif\r
+#endif\r
\r
/* Monitored by TzCtrl task, that give warnings as User Events */\r
extern volatile uint32_t NoRoomForSymbol;\r
/* Called by TzCtrl task periodically (Normally every 100 ms) */\r
static void prvCheckRecorderStatus(void);\r
\r
+extern void prvTraceWarning(int errCode);\r
+\r
/* The TzCtrl task - receives commands from Tracealyzer (start/stop) */\r
static portTASK_FUNCTION( TzCtrl, pvParameters );\r
\r
******************************************************************************/\r
void vTraceEnable(int startOption)\r
{\r
- int bytes = 0;\r
+ int32_t bytes = 0;\r
+ int32_t status;\r
extern uint32_t RecorderEnabled;\r
TracealyzerCommandType msg;\r
\r
- if (HandleTzCtrl != NULL)\r
- return; /* Seems we already initiated */\r
-\r
- TRC_STREAM_PORT_INIT();\r
+ /* Only do this first time...*/\r
+ if (HandleTzCtrl == NULL)\r
+ {\r
+ TRC_STREAM_PORT_INIT();\r
+ \r
+ /* Note: Requires that TRC_CFG_INCLUDE_USER_EVENTS is 1. */\r
+ trcWarningChannel = xTraceRegisterString("Warnings from Recorder");\r
+\r
+ /* Creates the TzCtrl task - receives trace commands (start, stop, ...) */\r
+ #if defined(configSUPPORT_STATIC_ALLOCATION) && (configSUPPORT_STATIC_ALLOCATION == 1)\r
+ HandleTzCtrl = xTaskCreateStatic(TzCtrl, STRING_CAST("TzCtrl"), TRC_CFG_CTRL_TASK_STACK_SIZE, NULL, TRC_CFG_CTRL_TASK_PRIORITY, stackTzCtrl, &tcbTzCtrl);\r
+ #else\r
+ xTaskCreate( TzCtrl, STRING_CAST("TzCtrl"), TRC_CFG_CTRL_TASK_STACK_SIZE, NULL, TRC_CFG_CTRL_TASK_PRIORITY, &HandleTzCtrl );\r
+ #endif\r
+\r
+ if (HandleTzCtrl == NULL)\r
+ {\r
+ prvTraceError(PSF_ERROR_TZCTRLTASK_NOT_CREATED);\r
+ }\r
+ }\r
\r
if (startOption == TRC_START_AWAIT_HOST)\r
{\r
do\r
{\r
bytes = 0;\r
- TRC_STREAM_PORT_READ_DATA(&msg, sizeof(TracealyzerCommandType), &bytes);\r
+ \r
+ status = TRC_STREAM_PORT_READ_DATA(&msg, sizeof(TracealyzerCommandType), (int32_t*)&bytes);\r
+ \r
+ if (status != 0)\r
+ {\r
+ prvTraceWarning(PSF_WARNING_STREAM_PORT_READ);\r
+ }\r
\r
- if (bytes == sizeof(TracealyzerCommandType))\r
+ if ((status == 0) && (bytes == sizeof(TracealyzerCommandType)))\r
{\r
if (prvIsValidCommand(&msg))\r
{\r
/* On start, init and reset the timestamping */\r
TRC_PORT_SPECIFIC_INIT();\r
}\r
-\r
+ \r
prvProcessCommand(&msg);\r
}\r
}\r
{\r
/* We start streaming directly - this assumes that the interface is ready! */\r
TRC_PORT_SPECIFIC_INIT();\r
-\r
+ \r
msg.cmdCode = CMD_SET_ACTIVE;\r
msg.param1 = 1;\r
prvProcessCommand(&msg);\r
/* On TRC_INIT */\r
TRC_PORT_SPECIFIC_INIT();\r
}\r
-\r
- trcWarningChannel = xTraceRegisterString("Warnings from Recorder");\r
-\r
- /* Creates the TzCtrl task - receives trace commands (start, stop, ...) */\r
-#if (configSUPPORT_STATIC_ALLOCATION == 1)\r
- HandleTzCtrl = xTaskCreateStatic(TzCtrl, "TzCtrl", TRC_CFG_CTRL_TASK_STACK_SIZE, NULL, TRC_CFG_CTRL_TASK_PRIORITY, stackTzCtrl, &tcbTzCtrl);\r
- (void)HandleTzCtrl;\r
-#else\r
- xTaskCreate( TzCtrl, "TzCtrl", TRC_CFG_CTRL_TASK_STACK_SIZE, NULL, TRC_CFG_CTRL_TASK_PRIORITY, &HandleTzCtrl );\r
-#endif\r
-}\r
-\r
-/*******************************************************************************\r
- * prvTraceOnBegin\r
- *\r
- * Called on trace begin.\r
- ******************************************************************************/\r
-void prvTraceOnBegin()\r
-{\r
- TRC_STREAM_PORT_ON_TRACE_BEGIN();\r
-}\r
-\r
-/*******************************************************************************\r
- * prvTraceOnEnd\r
- *\r
- * Called on trace end.\r
- ******************************************************************************/\r
-void prvTraceOnEnd()\r
-{\r
- TRC_STREAM_PORT_ON_TRACE_END();\r
}\r
\r
+#if (TRC_CFG_SCHEDULING_ONLY == 0)\r
/*******************************************************************************\r
* vTraceSetQueueName(void* object, const char* name)\r
*\r
* Parameter object: pointer to the Mutex that shall be named\r
* Parameter name: the name to set (const string literal)\r
*\r
- * Sets a name for Semaphore objects for display in Tracealyzer.\r
+ * Sets a name for Mutex objects for display in Tracealyzer.\r
******************************************************************************/\r
void vTraceSetMutexName(void* object, const char* name)\r
{\r
vTraceStoreKernelObjectName(object, name);\r
}\r
\r
+#if (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X)\r
+/*******************************************************************************\r
+* vTraceSetEventGroupName(void* object, const char* name)\r
+*\r
+* Parameter object: pointer to the vTraceSetEventGroupName that shall be named\r
+* Parameter name: the name to set (const string literal)\r
+*\r
+* Sets a name for EventGroup objects for display in Tracealyzer.\r
+******************************************************************************/\r
+void vTraceSetEventGroupName(void* object, const char* name)\r
+{\r
+ vTraceStoreKernelObjectName(object, name);\r
+}\r
+#endif /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X) */\r
+\r
+#if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+/*******************************************************************************\r
+* vTraceSetStreamBufferName(void* object, const char* name)\r
+*\r
+* Parameter object: pointer to the StreamBuffer that shall be named\r
+* Parameter name: the name to set (const string literal)\r
+*\r
+* Sets a name for StreamBuffer objects for display in Tracealyzer.\r
+******************************************************************************/\r
+void vTraceSetStreamBufferName(void* object, const char* name)\r
+{\r
+ vTraceStoreKernelObjectName(object, name);\r
+}\r
+\r
+/*******************************************************************************\r
+* vTraceSetMessageBufferName(void* object, const char* name)\r
+*\r
+* Parameter object: pointer to the MessageBuffer that shall be named\r
+* Parameter name: the name to set (const string literal)\r
+*\r
+* Sets a name for MessageBuffer objects for display in Tracealyzer.\r
+******************************************************************************/\r
+void vTraceSetMessageBufferName(void* object, const char* name)\r
+{\r
+ vTraceStoreKernelObjectName(object, name);\r
+}\r
+#endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+\r
+#endif /* (TRC_CFG_SCHEDULING_ONLY == 0) */\r
+\r
/*******************************************************************************\r
* prvGetCurrentTaskHandle\r
*\r
* Returns true if the RTOS scheduler currently is disabled, thus preventing any\r
* task-switches from occurring. Only called from vTraceStoreISREnd.\r
******************************************************************************/\r
-unsigned char prvTraceIsSchedulerSuspended()\r
+unsigned char prvTraceIsSchedulerSuspended(void)\r
{\r
- /* Assumed to be available in FreeRTOS. According to the FreeRTOS docs,\r
+ /* Assumed to be available in FreeRTOS. According to the FreeRTOS docs, \r
INCLUDE_xTaskGetSchedulerState or configUSE_TIMERS must be set to 1 in\r
FreeRTOSConfig.h for this function to be available. */\r
\r
{\r
if (NoRoomForSymbol > NoRoomForSymbol_last)\r
{\r
- vTracePrintF(trcWarningChannel, "TRC_CFG_SYMBOL_TABLE_SLOTS too small. Add %d slots.",\r
- NoRoomForSymbol);\r
-\r
+ if (NoRoomForSymbol > 0)\r
+ {\r
+ prvTraceWarning(PSF_WARNING_SYMBOL_TABLE_SLOTS);\r
+ }\r
NoRoomForSymbol_last = NoRoomForSymbol;\r
}\r
\r
if (NoRoomForObjectData > NoRoomForObjectData_last)\r
{\r
- vTracePrintF(trcWarningChannel, "TRC_CFG_OBJECT_DATA_SLOTS too small. Add %d slots.",\r
- NoRoomForObjectData);\r
-\r
+ if (NoRoomForObjectData > 0)\r
+ {\r
+ prvTraceWarning(PSF_WARNING_OBJECT_DATA_SLOTS);\r
+ }\r
NoRoomForObjectData_last = NoRoomForObjectData;\r
}\r
\r
if (LongestSymbolName > LongestSymbolName_last)\r
{\r
- if (LongestSymbolName > TRC_CFG_SYMBOL_MAX_LENGTH)\r
+ if (LongestSymbolName > (TRC_CFG_SYMBOL_MAX_LENGTH))\r
{\r
- vTracePrintF(trcWarningChannel, "TRC_CFG_SYMBOL_MAX_LENGTH too small. Add %d chars.",\r
- LongestSymbolName);\r
+ prvTraceWarning(PSF_WARNING_SYMBOL_MAX_LENGTH);\r
}\r
LongestSymbolName_last = LongestSymbolName;\r
}\r
\r
if (MaxBytesTruncated > MaxBytesTruncated_last)\r
{\r
- /* Some string event generated a too long string that was truncated.\r
- This may happen for the following functions:\r
- - vTracePrintF\r
- - vTracePrintF\r
- - vTraceStoreKernelObjectName\r
- - vTraceStoreUserEventChannelName\r
- - vTraceSetISRProperties\r
-\r
- A PSF event may store maximum 60 bytes payload, including data arguments\r
- and string characters. For User Events, also the User Event Channel ptr\r
- must be squeezed in, if a channel is specified. */\r
-\r
- vTracePrintF(trcWarningChannel, "String event too long, up to %d bytes truncated.",\r
- MaxBytesTruncated);\r
-\r
+ if (MaxBytesTruncated > 0)\r
+ {\r
+ prvTraceWarning(PSF_WARNING_STRING_TOO_LONG);\r
+ }\r
MaxBytesTruncated_last = MaxBytesTruncated;\r
}\r
}\r
/*******************************************************************************\r
* TzCtrl\r
*\r
- * Task for receiving commands from Tracealyzer and for recorder diagnostics.\r
- *\r
+ * Task for sending the trace data from the internal buffer to the stream \r
+ * interface (assuming TRC_STREAM_PORT_USE_INTERNAL_BUFFER == 1) and for\r
+ * receiving commands from Tracealyzer. Also does some diagnostics.\r
******************************************************************************/\r
static portTASK_FUNCTION( TzCtrl, pvParameters )\r
{\r
TracealyzerCommandType msg;\r
- int bytes = 0;\r
-\r
+ int32_t bytes = 0;\r
+ int32_t status = 0;\r
(void)pvParameters;\r
\r
while (1)\r
{\r
/* Listen for new commands */\r
bytes = 0;\r
- TRC_STREAM_PORT_READ_DATA(&msg, sizeof(TracealyzerCommandType), &bytes);\r
- if (bytes == sizeof(TracealyzerCommandType))\r
+ status = TRC_STREAM_PORT_READ_DATA(&msg, sizeof(TracealyzerCommandType), (int32_t*)&bytes);\r
+\r
+ if (status != 0)\r
+ {\r
+ prvTraceWarning(PSF_WARNING_STREAM_PORT_READ);\r
+ }\r
+\r
+ if ((status == 0) && (bytes == sizeof(TracealyzerCommandType)))\r
{\r
if (prvIsValidCommand(&msg))\r
{\r
}\r
}\r
\r
- /* Send periodic data */\r
- bytes = 0;\r
- TRC_STREAM_PORT_PERIODIC_SEND_DATA(&bytes);\r
- /* If there was data sent (bytes != 0), immediately loop around and do all this again. Otherwise, step out of this loop and sleep for a while. */\r
- }\r
- while (bytes != 0);\r
+/* If the internal buffer is disabled, the COMMIT macro instead sends the data directly \r
+ from the "event functions" (using TRC_STREAM_PORT_WRITE_DATA). */ \r
+#if (TRC_STREAM_PORT_USE_INTERNAL_BUFFER == 1)\r
+ /* If there is a buffer page, this sends it to the streaming interface using TRC_STREAM_PORT_WRITE_DATA. */\r
+ bytes = prvPagedEventBufferTransfer();\r
+#endif \r
+ \r
+ /* If there was data sent or received (bytes != 0), loop around and repeat, if there is more data to send or receive.\r
+ Otherwise, step out of this loop and sleep for a while. */ \r
+ \r
+ } while (bytes != 0);\r
\r
prvCheckRecorderStatus();\r
- vTaskDelay(TRC_CFG_CTRL_TASK_DELAY); /* 10ms */\r
+\r
+ vTaskDelay(TRC_CFG_CTRL_TASK_DELAY);\r
}\r
}\r
\r
int uiInEventGroupSetBitsFromISR = 0;\r
\r
/******************************************************************************\r
- * TraceObjectClassTable\r
+ * TraceQueueClassTable\r
* Translates a FreeRTOS QueueType into trace objects classes (TRACE_CLASS_).\r
* Has one entry for each QueueType, gives TRACE_CLASS ID.\r
******************************************************************************/\r
-traceObjectClass TraceObjectClassTable[5] = {\r
+traceObjectClass TraceQueueClassTable[5] = {\r
TRACE_CLASS_QUEUE,\r
TRACE_CLASS_MUTEX,\r
TRACE_CLASS_SEMAPHORE,\r
TRACE_CLASS_MUTEX\r
};\r
\r
+#if (TRC_CFG_SCHEDULING_ONLY == 0)\r
/*******************************************************************************\r
* vTraceSetQueueName(void* object, const char* name)\r
*\r
******************************************************************************/\r
void vTraceSetQueueName(void* object, const char* name)\r
{\r
- prvTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(TRC_UNUSED, object), TRACE_GET_OBJECT_NUMBER(TRC_UNUSED, object), name);\r
+ prvTraceSetObjectName(TRACE_CLASS_QUEUE, TRACE_GET_OBJECT_NUMBER(QUEUE, object), name);\r
}\r
\r
/*******************************************************************************\r
******************************************************************************/\r
void vTraceSetSemaphoreName(void* object, const char* name)\r
{\r
- prvTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(TRC_UNUSED, object), TRACE_GET_OBJECT_NUMBER(TRC_UNUSED, object), name);\r
+ prvTraceSetObjectName(TRACE_CLASS_SEMAPHORE, TRACE_GET_OBJECT_NUMBER(QUEUE, object), name);\r
}\r
\r
/*******************************************************************************\r
******************************************************************************/\r
void vTraceSetMutexName(void* object, const char* name)\r
{\r
- prvTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(TRC_UNUSED, object), TRACE_GET_OBJECT_NUMBER(TRC_UNUSED, object), name);\r
+ prvTraceSetObjectName(TRACE_CLASS_MUTEX, TRACE_GET_OBJECT_NUMBER(QUEUE, object), name);\r
}\r
\r
-void* prvTraceGetCurrentTaskHandle()\r
+#if (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X)\r
+/*******************************************************************************\r
+* vTraceSetEventGroupName(void* object, const char* name)\r
+*\r
+* Parameter object: pointer to the EventGroup that shall be named\r
+* Parameter name: the name to set (const string literal)\r
+*\r
+* Sets a name for EventGroup objects for display in Tracealyzer.\r
+******************************************************************************/\r
+void vTraceSetEventGroupName(void* object, const char* name)\r
{\r
- return xTaskGetCurrentTaskHandle();\r
+ prvTraceSetObjectName(TRACE_CLASS_EVENTGROUP, TRACE_GET_OBJECT_NUMBER(EVENTGROUP, object), name);\r
}\r
+#endif /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X) */\r
\r
-#if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_8_X)\r
-traceHandle prvTraceGetObjectNumber(void* handle)\r
-{\r
- return (traceHandle) ucQueueGetQueueNumber(handle);\r
-}\r
-#else /* For FreeRTOS v8 and later */\r
-traceHandle prvTraceGetObjectNumber(void* handle)\r
+#if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)\r
+/*******************************************************************************\r
+* vTraceSetStreamBufferName(void* object, const char* name)\r
+*\r
+* Parameter object: pointer to the StreamBuffer that shall be named\r
+* Parameter name: the name to set (const string literal)\r
+*\r
+* Sets a name for StreamBuffer objects for display in Tracealyzer.\r
+******************************************************************************/\r
+void vTraceSetStreamBufferName(void* object, const char* name)\r
{\r
- return (traceHandle) uxQueueGetQueueNumber(handle);\r
+ prvTraceSetObjectName(TRACE_CLASS_STREAMBUFFER, TRACE_GET_OBJECT_NUMBER(STREAMBUFFER, object), name);\r
}\r
-#endif\r
\r
-uint8_t prvTraceGetObjectType(void* handle)\r
+/*******************************************************************************\r
+* vTraceSetMessageBufferName(void* object, const char* name)\r
+*\r
+* Parameter object: pointer to the MessageBuffer that shall be named\r
+* Parameter name: the name to set (const string literal)\r
+*\r
+* Sets a name for MessageBuffer objects for display in Tracealyzer.\r
+******************************************************************************/\r
+void vTraceSetMessageBufferName(void* object, const char* name)\r
{\r
- return ucQueueGetQueueType(handle);\r
+ prvTraceSetObjectName(TRACE_CLASS_MESSAGEBUFFER, TRACE_GET_OBJECT_NUMBER(STREAMBUFFER, object), name);\r
}\r
+#endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */\r
+\r
+#endif /* (TRC_CFG_SCHEDULING_ONLY == 0) */\r
\r
-traceHandle prvTraceGetTaskNumber(void* handle)\r
+void* prvTraceGetCurrentTaskHandle()\r
{\r
- return (traceHandle)uxTaskGetTaskNumber(handle);\r
+ return xTaskGetCurrentTaskHandle();\r
}\r
\r
/* Initialization of the object property table */\r
RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[4] = TRC_CFG_NISR;\r
RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[5] = TRC_CFG_NTIMER;\r
RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[6] = TRC_CFG_NEVENTGROUP;\r
+ RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[7] = TRC_CFG_NSTREAMBUFFER;\r
+ RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[8] = TRC_CFG_NMESSAGEBUFFER;\r
RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[0] = TRC_CFG_NAME_LEN_QUEUE;\r
RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[1] = TRC_CFG_NAME_LEN_SEMAPHORE;\r
RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[2] = TRC_CFG_NAME_LEN_MUTEX;\r
RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[4] = TRC_CFG_NAME_LEN_ISR;\r
RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[5] = TRC_CFG_NAME_LEN_TIMER;\r
RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[6] = TRC_CFG_NAME_LEN_EVENTGROUP;\r
+ RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[7] = TRC_CFG_NAME_LEN_STREAMBUFFER;\r
+ RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[8] = TRC_CFG_NAME_LEN_MESSAGEBUFFER;\r
RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[0] = PropertyTableSizeQueue;\r
RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[1] = PropertyTableSizeSemaphore;\r
RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[2] = PropertyTableSizeMutex;\r
RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[4] = PropertyTableSizeISR;\r
RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[5] = PropertyTableSizeTimer;\r
RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[6] = PropertyTableSizeEventGroup;\r
+ RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[7] = PropertyTableSizeStreamBuffer;\r
+ RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[8] = PropertyTableSizeMessageBuffer;\r
RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[0] = StartIndexQueue;\r
RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[1] = StartIndexSemaphore;\r
RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[2] = StartIndexMutex;\r
RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[4] = StartIndexISR;\r
RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[5] = StartIndexTimer;\r
RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[6] = StartIndexEventGroup;\r
+ RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[7] = StartIndexStreamBuffer;\r
+ RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[8] = StartIndexMessageBuffer;\r
RecorderDataPtr->ObjectPropertyTable.ObjectPropertyTableSizeInBytes = TRACE_OBJECT_TABLE_SIZE;\r
}\r
\r
void vTraceInitObjectHandleStack()\r
{\r
objectHandleStacks.indexOfNextAvailableHandle[0] = objectHandleStacks.lowestIndexOfClass[0] = 0;\r
- objectHandleStacks.indexOfNextAvailableHandle[1] = objectHandleStacks.lowestIndexOfClass[1] = TRC_CFG_NQUEUE;\r
- objectHandleStacks.indexOfNextAvailableHandle[2] = objectHandleStacks.lowestIndexOfClass[2] = TRC_CFG_NQUEUE + TRC_CFG_NSEMAPHORE;\r
- objectHandleStacks.indexOfNextAvailableHandle[3] = objectHandleStacks.lowestIndexOfClass[3] = TRC_CFG_NQUEUE + TRC_CFG_NSEMAPHORE + TRC_CFG_NMUTEX;\r
- objectHandleStacks.indexOfNextAvailableHandle[4] = objectHandleStacks.lowestIndexOfClass[4] = TRC_CFG_NQUEUE + TRC_CFG_NSEMAPHORE + TRC_CFG_NMUTEX + TRC_CFG_NTASK;\r
- objectHandleStacks.indexOfNextAvailableHandle[5] = objectHandleStacks.lowestIndexOfClass[5] = TRC_CFG_NQUEUE + TRC_CFG_NSEMAPHORE + TRC_CFG_NMUTEX + TRC_CFG_NTASK + TRC_CFG_NISR;\r
- objectHandleStacks.indexOfNextAvailableHandle[6] = objectHandleStacks.lowestIndexOfClass[6] = TRC_CFG_NQUEUE + TRC_CFG_NSEMAPHORE + TRC_CFG_NMUTEX + TRC_CFG_NTASK + TRC_CFG_NISR + TRC_CFG_NTIMER;\r
-\r
- objectHandleStacks.highestIndexOfClass[0] = TRC_CFG_NQUEUE - 1;\r
- objectHandleStacks.highestIndexOfClass[1] = TRC_CFG_NQUEUE + TRC_CFG_NSEMAPHORE - 1;\r
- objectHandleStacks.highestIndexOfClass[2] = TRC_CFG_NQUEUE + TRC_CFG_NSEMAPHORE + TRC_CFG_NMUTEX - 1;\r
- objectHandleStacks.highestIndexOfClass[3] = TRC_CFG_NQUEUE + TRC_CFG_NSEMAPHORE + TRC_CFG_NMUTEX + TRC_CFG_NTASK - 1;\r
- objectHandleStacks.highestIndexOfClass[4] = TRC_CFG_NQUEUE + TRC_CFG_NSEMAPHORE + TRC_CFG_NMUTEX + TRC_CFG_NTASK + TRC_CFG_NISR - 1;\r
- objectHandleStacks.highestIndexOfClass[5] = TRC_CFG_NQUEUE + TRC_CFG_NSEMAPHORE + TRC_CFG_NMUTEX + TRC_CFG_NTASK + TRC_CFG_NISR + TRC_CFG_NTIMER - 1;\r
- objectHandleStacks.highestIndexOfClass[6] = TRC_CFG_NQUEUE + TRC_CFG_NSEMAPHORE + TRC_CFG_NMUTEX + TRC_CFG_NTASK + TRC_CFG_NISR + TRC_CFG_NTIMER + TRC_CFG_NEVENTGROUP - 1;\r
+ objectHandleStacks.indexOfNextAvailableHandle[1] = objectHandleStacks.lowestIndexOfClass[1] = (TRC_CFG_NQUEUE);\r
+ objectHandleStacks.indexOfNextAvailableHandle[2] = objectHandleStacks.lowestIndexOfClass[2] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE);\r
+ objectHandleStacks.indexOfNextAvailableHandle[3] = objectHandleStacks.lowestIndexOfClass[3] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX);\r
+ objectHandleStacks.indexOfNextAvailableHandle[4] = objectHandleStacks.lowestIndexOfClass[4] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) + (TRC_CFG_NTASK);\r
+ objectHandleStacks.indexOfNextAvailableHandle[5] = objectHandleStacks.lowestIndexOfClass[5] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) + (TRC_CFG_NTASK) + (TRC_CFG_NISR);\r
+ objectHandleStacks.indexOfNextAvailableHandle[6] = objectHandleStacks.lowestIndexOfClass[6] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) + (TRC_CFG_NTASK) + (TRC_CFG_NISR) + (TRC_CFG_NTIMER);\r
+ objectHandleStacks.indexOfNextAvailableHandle[7] = objectHandleStacks.lowestIndexOfClass[7] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) + (TRC_CFG_NTASK) + (TRC_CFG_NISR) + (TRC_CFG_NTIMER) + (TRC_CFG_NEVENTGROUP);\r
+ objectHandleStacks.indexOfNextAvailableHandle[8] = objectHandleStacks.lowestIndexOfClass[8] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) + (TRC_CFG_NTASK) + (TRC_CFG_NISR) + (TRC_CFG_NTIMER) + (TRC_CFG_NEVENTGROUP) + (TRC_CFG_NSTREAMBUFFER);\r
+\r
+ objectHandleStacks.highestIndexOfClass[0] = (TRC_CFG_NQUEUE) - 1;\r
+ objectHandleStacks.highestIndexOfClass[1] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) - 1;\r
+ objectHandleStacks.highestIndexOfClass[2] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) - 1;\r
+ objectHandleStacks.highestIndexOfClass[3] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) + (TRC_CFG_NTASK) - 1;\r
+ objectHandleStacks.highestIndexOfClass[4] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) + (TRC_CFG_NTASK) + (TRC_CFG_NISR) - 1;\r
+ objectHandleStacks.highestIndexOfClass[5] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) + (TRC_CFG_NTASK) + (TRC_CFG_NISR) + (TRC_CFG_NTIMER) - 1;\r
+ objectHandleStacks.highestIndexOfClass[6] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) + (TRC_CFG_NTASK) + (TRC_CFG_NISR) + (TRC_CFG_NTIMER) + (TRC_CFG_NEVENTGROUP) - 1;\r
+ objectHandleStacks.highestIndexOfClass[7] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) + (TRC_CFG_NTASK) + (TRC_CFG_NISR) + (TRC_CFG_NTIMER) + (TRC_CFG_NEVENTGROUP) + (TRC_CFG_NSTREAMBUFFER) - 1;\r
+ objectHandleStacks.highestIndexOfClass[8] = (TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) + (TRC_CFG_NTASK) + (TRC_CFG_NISR) + (TRC_CFG_NTIMER) + (TRC_CFG_NEVENTGROUP) + (TRC_CFG_NSTREAMBUFFER) + (TRC_CFG_NMESSAGEBUFFER) - 1;\r
}\r
\r
/* Returns the "Not enough handles" error message for this object class */\r
return "Not enough TIMER handles - increase TRC_CFG_NTIMER in trcSnapshotConfig.h";\r
case TRACE_CLASS_EVENTGROUP:\r
return "Not enough EVENTGROUP handles - increase TRC_CFG_NEVENTGROUP in trcSnapshotConfig.h";\r
+ case TRACE_CLASS_STREAMBUFFER:\r
+ return "Not enough STREAMBUFFER handles - increase TRC_CFG_NSTREAMBUFFER in trcSnapshotConfig.h";\r
+ case TRACE_CLASS_MESSAGEBUFFER:\r
+ return "Not enough MESSAGEBUFFER handles - increase TRC_CFG_NMESSAGEBUFFER in trcSnapshotConfig.h";\r
default:\r
return "pszTraceGetErrorHandles: Invalid objectclass!";\r
}\r
}\r
\r
-/* Returns the exclude state of the object */\r
-uint8_t uiTraceIsObjectExcluded(traceObjectClass objectclass, traceHandle handle)\r
-{\r
- TRACE_ASSERT(objectclass < TRACE_NCLASSES, "prvIsObjectExcluded: objectclass >= TRACE_NCLASSES", 1);\r
- TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], "prvIsObjectExcluded: Invalid value for handle", 1);\r
-\r
- switch(objectclass)\r
- {\r
- case TRACE_CLASS_TASK:\r
- return (uint8_t) TRACE_GET_TASK_FLAG_ISEXCLUDED(handle);\r
- case TRACE_CLASS_SEMAPHORE:\r
- return (uint8_t) TRACE_GET_SEMAPHORE_FLAG_ISEXCLUDED(handle);\r
- case TRACE_CLASS_MUTEX:\r
- return (uint8_t) TRACE_GET_MUTEX_FLAG_ISEXCLUDED(handle);\r
- case TRACE_CLASS_QUEUE:\r
- return (uint8_t) TRACE_GET_QUEUE_FLAG_ISEXCLUDED(handle);\r
- case TRACE_CLASS_TIMER:\r
- return (uint8_t) TRACE_GET_TIMER_FLAG_ISEXCLUDED(handle);\r
- case TRACE_CLASS_EVENTGROUP:\r
- return (uint8_t) TRACE_GET_EVENTGROUP_FLAG_ISEXCLUDED(handle);\r
- }\r
-\r
- prvTraceError("Invalid object class ID in prvIsObjectExcluded!");\r
-\r
- /* Must never reach */\r
- return 1;\r
-}\r
-\r
/*******************************************************************************\r
* prvTraceIsSchedulerSuspended\r
*\r
* task-switches from occurring. Only called from vTraceStoreISREnd.\r
******************************************************************************/\r
#if (TRC_CFG_INCLUDE_ISR_TRACING == 1)\r
-unsigned char prvTraceIsSchedulerSuspended()\r
+unsigned char prvTraceIsSchedulerSuspended(void)\r
{\r
- /* Assumed to be available in FreeRTOS. According to the FreeRTOS docs,\r
+ /* Assumed to be available in FreeRTOS. According to the FreeRTOS docs, \r
INCLUDE_xTaskGetSchedulerState or configUSE_TIMERS must be set to 1 in\r
FreeRTOSConfig.h for this function to be available. */\r
\r
/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* trcSnapshotRecorder.c\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2017.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
\r
#if !defined TRC_CFG_INCLUDE_READY_EVENTS || TRC_CFG_INCLUDE_READY_EVENTS == 1\r
static int readyEventsEnabled = 1;\r
#endif /*!defined TRC_CFG_INCLUDE_READY_EVENTS || TRC_CFG_INCLUDE_READY_EVENTS == 1*/\r
+\r
/*******************************************************************************\r
* uiTraceTickCount\r
*\r
uint32_t uiTraceTickCount = 0;\r
\r
uint32_t trace_disable_timestamp = 0;\r
+\r
static uint32_t last_timestamp = 0;\r
+\r
/* Flag that shows if inside a critical section of the recorder */\r
volatile int recorder_busy = 0;\r
\r
/* The last error message of the recorder. NULL if no error message. */\r
const char* traceErrorMessage = NULL;\r
\r
-\r
int8_t nISRactive = 0;\r
-traceHandle handle_of_last_logged_task = 0;\r
-uint8_t inExcludedTask = 0;\r
\r
-extern uint8_t inExcludedTask;\r
-extern int8_t nISRactive;\r
-extern traceHandle handle_of_last_logged_task;\r
+traceHandle handle_of_last_logged_task = 0;\r
\r
/* Called when the recorder is stopped, set by vTraceSetStopHook. */\r
TRACE_STOP_HOOK vTraceStopHookPtr = (TRACE_STOP_HOOK)0;\r
\r
+uint16_t CurrentFilterMask = 0xFFFF;\r
+\r
+uint16_t CurrentFilterGroup = FilterGroup0;\r
+\r
+extern int8_t nISRactive;\r
+\r
+extern traceHandle handle_of_last_logged_task;\r
+\r
/*************** Private Functions *******************************************/\r
static void prvStrncpy(char* dst, const char* src, uint32_t maxLength);\r
static uint8_t prvTraceGetObjectState(uint8_t objectclass, traceHandle id); \r
static traceString prvTraceOpenSymbol(const char* name, traceString userEventChannel);\r
static void prvTraceUpdateCounters(void);\r
\r
+void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t signed_size);\r
+\r
#if (TRC_CFG_SNAPSHOT_MODE == TRC_SNAPSHOT_MODE_RING_BUFFER)\r
static void prvCheckDataToBeOverwrittenForMultiEntryEvents(uint8_t nEntries);\r
#endif\r
\r
\r
#if (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1) && (TRC_CFG_SCHEDULING_ONLY == 0)\r
- /* Current heap usage. Always updated. */\r
- static uint32_t heapMemUsage = 0;\r
+static uint32_t heapMemUsage = 0;\r
#endif\r
\r
#if (TRC_CFG_SCHEDULING_ONLY == 0)\r
* vTraceSetStopHook\r
*\r
* Sets a function to be called when the recorder is stopped. This can be used\r
- * to save the trace to a file system, if available. \r
+ * to save the trace to a file system, if available. This is only implemented\r
+ * for snapshot mode.\r
******************************************************************************/\r
void vTraceSetStopHook(TRACE_STOP_HOOK stopHookFunction)\r
{\r
\r
if (RecorderDataPtr == NULL)\r
{\r
- prvTraceError("RecorderDataPtr is NULL. Call vTraceInitTraceData() before starting trace.");\r
+ TRACE_ASSERT(RecorderDataPtr != NULL, "Recorder not initialized. Use vTraceEnable() instead!", 0);\r
return 0;\r
}\r
\r
******************************************************************************/\r
void vTraceStop(void)\r
{\r
- RecorderDataPtr->recorderActive = 0;\r
+ if (RecorderDataPtr != NULL)\r
+ {\r
+ RecorderDataPtr->recorderActive = 0;\r
+ }\r
\r
if (vTraceStopHookPtr != (TRACE_STOP_HOOK)0)\r
{\r
}\r
}\r
\r
+/*******************************************************************************\r
+* xTraceIsRecordingEnabled\r
+* Returns true (1) if the recorder is enabled (i.e. is recording), otherwise 0.\r
+******************************************************************************/\r
+int xTraceIsRecordingEnabled(void)\r
+{\r
+ if (RecorderDataPtr != NULL)\r
+ {\r
+ return (int)RecorderDataPtr->recorderActive;\r
+ }\r
+ else\r
+ {\r
+ return 0;\r
+ }\r
+}\r
+\r
/*******************************************************************************\r
* xTraceGetLastError\r
*\r
* prvTraceTaskInstanceFinish\r
*\r
* Private common function for the vTraceTaskInstanceFinishXXX functions.\r
- * \r
*****************************************************************************/\r
static void prvTraceTaskInstanceFinish(int8_t direct)\r
{\r
TRACE_ALLOC_CRITICAL_SECTION();\r
\r
trcCRITICAL_SECTION_BEGIN();\r
- if (RecorderDataPtr->recorderActive && (! inExcludedTask || nISRactive) && handle_of_last_logged_task)\r
+ if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
{\r
dts45 = (uint8_t)prvTraceGetDTS(0xFF);\r
tis = (TaskInstanceStatusEvent*) prvTraceNextFreeEventBufferSlot();\r
* processCommand(command);\r
* vTraceInstanceFinishedNext();\r
* }\r
- *\r
- * Note: This is only supported in Tracealyzer tools v2.7 or later\r
- *\r
*****************************************************************************/\r
void vTraceInstanceFinishedNext(void)\r
{\r
* DoSometingElse();\r
* vTraceInstanceFinishedNext();\r
* }\r
- *\r
- * Note: This is only supported in Tracealyzer tools v2.7 or later\r
- *\r
*****************************************************************************/\r
void vTraceInstanceFinishedNow(void)\r
{\r
* ...\r
* vTraceStoreISREnd(0);\r
* }\r
- *\r
******************************************************************************/\r
traceHandle xTraceSetISRProperties(const char* name, uint8_t priority)\r
{\r
- static traceHandle handle = 0;\r
- handle++;\r
+ static traceHandle handle = 0; \r
+ TRACE_ASSERT(RecorderDataPtr != NULL, "Recorder not initialized, call vTraceEnable() first!", (traceHandle)0);\r
TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[TRACE_CLASS_ISR], "xTraceSetISRProperties: Invalid value for handle", 0);\r
TRACE_ASSERT(name != NULL, "xTraceSetISRProperties: name == NULL", 0);\r
\r
+ handle++;\r
+\r
prvTraceSetObjectName(TRACE_CLASS_ISR, handle, name);\r
prvTraceSetPriorityProperty(TRACE_CLASS_ISR, handle, priority);\r
\r
* ...\r
* vTraceStoreISREnd(0);\r
* }\r
- *\r
******************************************************************************/\r
void vTraceStoreISRBegin(traceHandle handle)\r
{\r
{\r
uint16_t dts4;\r
\r
- TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[TRACE_CLASS_ISR], "vTraceStoreISRBegin: Invalid value for handle", TRC_UNUSED);\r
+ TRACE_ASSERT(handle != 0, "vTraceStoreISRBegin: Invalid ISR handle (NULL)", TRC_UNUSED); \r
+ TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[TRACE_CLASS_ISR], "vTraceStoreISRBegin: Invalid ISR handle (> NISR)", TRC_UNUSED);\r
\r
dts4 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
\r
* ...\r
* vTraceStoreISREnd(0);\r
* }\r
- *\r
******************************************************************************/\r
void vTraceStoreISREnd(int pendingISR)\r
{\r
}\r
#endif /* (TRC_CFG_INCLUDE_ISR_TRACING == 1)*/\r
\r
+\r
/********************************************************************************/\r
/* User Event functions */\r
/********************************************************************************/\r
{\r
uint32_t slots;\r
\r
- TRACE_ASSERT(TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE >= count,\r
+ TRACE_ASSERT((TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE) >= count,\r
"prvTraceClearChannelBuffer: TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE is too small to handle this event.", TRC_UNUSED);\r
\r
/* Check if we're close to the end of the buffer */\r
- if (RecorderDataPtr->userEventBuffer.nextSlotToWrite + count > TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE)\r
+ if (RecorderDataPtr->userEventBuffer.nextSlotToWrite + count > (TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE))\r
{\r
- slots = TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE - RecorderDataPtr->userEventBuffer.nextSlotToWrite; /* Number of slots before end of buffer */\r
+ slots = (TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE) - RecorderDataPtr->userEventBuffer.nextSlotToWrite; /* Number of slots before end of buffer */\r
(void)memset(&RecorderDataPtr->userEventBuffer.channelBuffer[RecorderDataPtr->userEventBuffer.nextSlotToWrite], 0, slots);\r
(void)memset(&RecorderDataPtr->userEventBuffer.channelBuffer[0], 0, (count - slots));\r
}\r
\r
TRACE_ASSERT(data != NULL,\r
"prvTraceCopyToDataBuffer: data == NULL.", TRC_UNUSED);\r
- TRACE_ASSERT(count <= TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE,\r
+ TRACE_ASSERT(count <= (TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE),\r
"prvTraceCopyToDataBuffer: TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE is too small to handle this event.", TRC_UNUSED);\r
/* Check if we're close to the end of the buffer */\r
- if (RecorderDataPtr->userEventBuffer.nextSlotToWrite + count > TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE)\r
+ if (RecorderDataPtr->userEventBuffer.nextSlotToWrite + count > (TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE))\r
{\r
- slots = TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE - RecorderDataPtr->userEventBuffer.nextSlotToWrite; /* Number of slots before end of buffer */\r
+ slots = (TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE) - RecorderDataPtr->userEventBuffer.nextSlotToWrite; /* Number of slots before end of buffer */\r
(void)memcpy(&RecorderDataPtr->userEventBuffer.dataBuffer[RecorderDataPtr->userEventBuffer.nextSlotToWrite * 4], data, slots * 4);\r
(void)memcpy(&RecorderDataPtr->userEventBuffer.dataBuffer[0], data + slots, (count - slots) * 4);\r
}\r
\r
TRACE_ALLOC_CRITICAL_SECTION();\r
\r
- TRACE_ASSERT(TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE >= noOfSlots, "prvTraceUBHelper2: TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE is too small to handle this event.", TRC_UNUSED);\r
+ TRACE_ASSERT((TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE) >= noOfSlots, "prvTraceUBHelper2: TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE is too small to handle this event.", TRC_UNUSED);\r
\r
trcCRITICAL_SECTION_BEGIN();\r
/* Store the timestamp */\r
prvTraceCopyToDataBuffer(data, noOfSlots); /* Will wrap around the data if necessary */\r
\r
old_nextSlotToWrite = RecorderDataPtr->userEventBuffer.nextSlotToWrite; /* Save the index that we want to write the channel data at when we're done */\r
- RecorderDataPtr->userEventBuffer.nextSlotToWrite = (RecorderDataPtr->userEventBuffer.nextSlotToWrite + noOfSlots) % TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE; /* Make sure we never end up outside the buffer */\r
+ RecorderDataPtr->userEventBuffer.nextSlotToWrite = (RecorderDataPtr->userEventBuffer.nextSlotToWrite + noOfSlots) % (TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE); /* Make sure we never end up outside the buffer */\r
\r
/* Write to the channel buffer to indicate that this user event is ready to be used */\r
if (channel != 0)\r
TRACE_ASSERT(formatStr != 0, "xTraceRegisterChannelFormat: formatStr == 0", (traceUBChannel)0);\r
\r
trcCRITICAL_SECTION_BEGIN();\r
- for (i = 1; i <= TRC_CFG_UB_CHANNELS; i++) /* Size of the channels buffer is TRC_CFG_UB_CHANNELS + 1. Index 0 is unused. */\r
+ for (i = 1; i <= (TRC_CFG_UB_CHANNELS); i++) /* Size of the channels buffer is TRC_CFG_UB_CHANNELS + 1. Index 0 is unused. */\r
{\r
if(RecorderDataPtr->userEventBuffer.channels[i].name == 0 && RecorderDataPtr->userEventBuffer.channels[i].defaultFormat == 0)\r
{\r
*\r
* Slightly faster version of vTracePrintF() due to no lookups.\r
*\r
- * Note: This is only available if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is enabled in\r
- * trcConfig.h\r
- *\r
+ * Note: This is only available if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is\r
+ * enabled in trcSnapshotConfig.h\r
******************************************************************************/\r
#if ((TRC_CFG_SCHEDULING_ONLY == 0) && (TRC_CFG_INCLUDE_USER_EVENTS == 1) && (TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER == 1))\r
void vTraceUBData(traceUBChannel channelPair, ...)\r
traceString formatStr;\r
\r
TRACE_ASSERT(channelPair != 0, "vTraceUBData_Helper: channelPair == 0", TRC_UNUSED);\r
- TRACE_ASSERT(channelPair <= TRC_CFG_UB_CHANNELS, "vTraceUBData_Helper: ", TRC_UNUSED);\r
+ TRACE_ASSERT(channelPair <= (TRC_CFG_UB_CHANNELS), "vTraceUBData_Helper: ", TRC_UNUSED);\r
\r
channel = RecorderDataPtr->userEventBuffer.channels[channelPair].name;\r
formatStr = RecorderDataPtr->userEventBuffer.channels[channelPair].defaultFormat;\r
uint32_t data[(3 + MAX_ARG_SIZE) / 4];\r
\r
TRACE_ASSERT(channelPair != 0, "vTraceUBEvent: channelPair == 0", TRC_UNUSED);\r
- TRACE_ASSERT(channelPair <= TRC_CFG_UB_CHANNELS, "vTraceUBEvent: ", TRC_UNUSED);\r
+ TRACE_ASSERT(channelPair <= (TRC_CFG_UB_CHANNELS), "vTraceUBEvent: ", TRC_UNUSED);\r
\r
prvTraceUBHelper2(channelPair, data, 1); /* Only need one slot for timestamp */\r
}\r
\r
trcCRITICAL_SECTION_BEGIN();\r
\r
- if (RecorderDataPtr->recorderActive && (! inExcludedTask || nISRactive) && handle_of_last_logged_task)\r
+ if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
{\r
/* First, write the "primary" user event entry in the local buffer, but\r
let the event type be "EVENT_BEING_WRITTEN" for now...*/\r
RecorderDataPtr->nextFreeIndex += noOfSlots;\r
RecorderDataPtr->numEvents += noOfSlots;\r
\r
- if (RecorderDataPtr->nextFreeIndex >= TRC_CFG_EVENT_BUFFER_SIZE)\r
+ if (RecorderDataPtr->nextFreeIndex >= (TRC_CFG_EVENT_BUFFER_SIZE))\r
{\r
#if (TRC_CFG_SNAPSHOT_MODE == TRC_SNAPSHOT_MODE_RING_BUFFER)\r
/* We have reached the end, but this is a ring buffer. Start from the beginning again. */\r
traceString formatLabel;\r
traceUBChannel channel;\r
\r
- if (RecorderDataPtr->recorderActive && (! inExcludedTask || nISRactive) && handle_of_last_logged_task)\r
+ if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
{\r
formatLabel = xTraceRegisterString(formatStr);\r
\r
TRACE_ALLOC_CRITICAL_SECTION();\r
\r
trcCRITICAL_SECTION_BEGIN();\r
- if (RecorderDataPtr->recorderActive && (! inExcludedTask || nISRactive) && handle_of_last_logged_task)\r
+ if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
{\r
dts1 = (uint8_t)prvTraceGetDTS(0xFF);\r
ue = (UserEvent*) prvTraceNextFreeEventBufferSlot();\r
traceUBChannel channel;\r
uint32_t noOfSlots = 1;\r
uint32_t tempDataBuffer[(3 + MAX_ARG_SIZE) / 4];\r
- if (RecorderDataPtr->recorderActive && (! inExcludedTask || nISRactive) && handle_of_last_logged_task)\r
+ if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
{\r
traceString trcStr = prvTraceOpenSymbol(str, chn);\r
channel = xTraceRegisterUBChannel(chn, trcStr);\r
* myEventHandle = xTraceRegisterString("MyUserEvent");\r
* ...\r
* vTracePrintF(myEventHandle, "My value is: %d", myValue);\r
- *\r
******************************************************************************/\r
#if ((TRC_CFG_SCHEDULING_ONLY == 0) && (TRC_CFG_INCLUDE_USER_EVENTS == 1))\r
traceString xTraceRegisterString(const char* label)\r
{\r
TRACE_ASSERT(label != NULL, "xTraceRegisterString: label == NULL", (traceString)0);\r
-\r
+ TRACE_ASSERT(RecorderDataPtr != NULL, "Recorder not initialized, call vTraceEnable() first!", (traceHandle)0);\r
return prvTraceOpenSymbol(label, 0);\r
}\r
#endif\r
return;\r
}\r
\r
- TRACE_ASSERT(handle <= TRC_CFG_NTASK, "prvTraceStoreTaskReady: Invalid value for handle", TRC_UNUSED);\r
+ TRACE_ASSERT(handle <= (TRC_CFG_NTASK), "prvTraceStoreTaskReady: Invalid value for handle", TRC_UNUSED);\r
\r
if (recorder_busy)\r
{\r
trcCRITICAL_SECTION_BEGIN();\r
if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */\r
{\r
- if (!TRACE_GET_TASK_FLAG_ISEXCLUDED(handle))\r
+ dts3 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
+ hnd8 = prvTraceGet8BitHandle(handle);\r
+ tr = (TREvent*)prvTraceNextFreeEventBufferSlot();\r
+ if (tr != NULL)\r
{\r
- dts3 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
- hnd8 = prvTraceGet8BitHandle(handle);\r
- tr = (TREvent*)prvTraceNextFreeEventBufferSlot();\r
- if (tr != NULL)\r
- {\r
- tr->type = DIV_TASK_READY;\r
- tr->dts = dts3;\r
- tr->objHandle = hnd8;\r
- prvTraceUpdateCounters();\r
- }\r
+ tr->type = DIV_TASK_READY;\r
+ tr->dts = dts3;\r
+ tr->objHandle = hnd8;\r
+ prvTraceUpdateCounters();\r
}\r
}\r
trcCRITICAL_SECTION_END();\r
\r
if (RecorderDataPtr->recorderActive)\r
{\r
- /* If it is an ISR or NOT an excluded task, this kernel call will be stored in the trace */\r
- if (nISRactive || !inExcludedTask)\r
+ dts1 = (uint8_t)prvTraceGetDTS(0xFF);\r
+ size_low = (uint16_t)prvTraceGetParam(0xFFFF, size);\r
+ ms = (MemEventSize *)prvTraceNextFreeEventBufferSlot();\r
+\r
+ if (ms != NULL)\r
{\r
- dts1 = (uint8_t)prvTraceGetDTS(0xFF);\r
- size_low = (uint16_t)prvTraceGetParam(0xFFFF, size);\r
- ms = (MemEventSize *)prvTraceNextFreeEventBufferSlot();\r
+ ms->dts = dts1;\r
+ ms->type = NULL_EVENT; /* Updated when all events are written */\r
+ ms->size = size_low;\r
+ prvTraceUpdateCounters();\r
\r
- if (ms != NULL)\r
- {\r
- ms->dts = dts1;\r
- ms->type = NULL_EVENT; /* Updated when all events are written */\r
- ms->size = size_low;\r
- prvTraceUpdateCounters();\r
-\r
- /* Storing a second record with address (signals "failed" if null) */\r
- #if (TRC_CFG_HEAP_SIZE_BELOW_16M)\r
- /* If the heap address range is within 16 MB, i.e., the upper 8 bits\r
- of addresses are constant, this optimization avoids storing an extra\r
- event record by ignoring the upper 8 bit of the address */\r
- addr_low = address & 0xFFFF; \r
- addr_high = (address >> 16) & 0xFF;\r
- #else\r
- /* The whole 32 bit address is stored using a second event record\r
- for the upper 16 bit */\r
- addr_low = (uint16_t)prvTraceGetParam(0xFFFF, address);\r
- addr_high = 0;\r
- #endif\r
+ /* Storing a second record with address (signals "failed" if null) */\r
+ #if (TRC_CFG_HEAP_SIZE_BELOW_16M)\r
+ /* If the heap address range is within 16 MB, i.e., the upper 8 bits\r
+ of addresses are constant, this optimization avoids storing an extra\r
+ event record by ignoring the upper 8 bit of the address */\r
+ addr_low = address & 0xFFFF; \r
+ addr_high = (address >> 16) & 0xFF;\r
+ #else\r
+ /* The whole 32 bit address is stored using a second event record\r
+ for the upper 16 bit */\r
+ addr_low = (uint16_t)prvTraceGetParam(0xFFFF, address);\r
+ addr_high = 0;\r
+ #endif\r
\r
- ma = (MemEventAddr *) prvTraceNextFreeEventBufferSlot();\r
- if (ma != NULL)\r
- {\r
- ma->addr_low = addr_low;\r
- ma->addr_high = addr_high;\r
- ma->type = (uint8_t) (ecode + 1); /* Note this! */\r
- ms->type = (uint8_t) ecode;\r
- prvTraceUpdateCounters(); \r
- RecorderDataPtr->heapMemUsage = heapMemUsage;\r
- }\r
+ ma = (MemEventAddr *) prvTraceNextFreeEventBufferSlot();\r
+ if (ma != NULL)\r
+ {\r
+ ma->addr_low = addr_low;\r
+ ma->addr_high = addr_high;\r
+ ma->type = (uint8_t) (ecode + 1); /* Note this! */\r
+ ms->type = (uint8_t) ecode;\r
+ prvTraceUpdateCounters(); \r
+ RecorderDataPtr->heapMemUsage = heapMemUsage;\r
}\r
}\r
}\r
trcCRITICAL_SECTION_BEGIN();\r
if (RecorderDataPtr->recorderActive)\r
{\r
- /* If it is an ISR or NOT an excluded task, this kernel call will be stored in the trace */\r
- if (nISRactive || !inExcludedTask)\r
+ dts1 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
+ hnd8 = prvTraceGet8BitHandle((traceHandle)objectNumber);\r
+ kse = (KernelCall*) prvTraceNextFreeEventBufferSlot();\r
+ if (kse != NULL)\r
{\r
- /* Check if the referenced object or the event code is excluded */\r
- if (!uiTraceIsObjectExcluded(objectClass, (traceHandle)objectNumber) && !TRACE_GET_EVENT_CODE_FLAG_ISEXCLUDED(ecode))\r
- {\r
- dts1 = (uint16_t)prvTraceGetDTS(0xFFFF);\r
- hnd8 = prvTraceGet8BitHandle((traceHandle)objectNumber);\r
- kse = (KernelCall*) prvTraceNextFreeEventBufferSlot();\r
- if (kse != NULL)\r
- {\r
- kse->dts = dts1;\r
- kse->type = (uint8_t)ecode;\r
- kse->objHandle = hnd8;\r
- prvTraceUpdateCounters();\r
- }\r
- }\r
+ kse->dts = dts1;\r
+ kse->type = (uint8_t)ecode;\r
+ kse->objHandle = hnd8;\r
+ prvTraceUpdateCounters();\r
}\r
}\r
trcCRITICAL_SECTION_END();\r
}\r
\r
trcCRITICAL_SECTION_BEGIN();\r
- if (RecorderDataPtr->recorderActive && handle_of_last_logged_task && (! inExcludedTask || nISRactive))\r
+ if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
{\r
- /* Check if the referenced object or the event code is excluded */\r
- if (!uiTraceIsObjectExcluded(objectClass, (traceHandle)objectNumber) &&\r
- !TRACE_GET_EVENT_CODE_FLAG_ISEXCLUDED(evtcode))\r
+ dts2 = (uint8_t)prvTraceGetDTS(0xFF);\r
+ p8 = (uint8_t) prvTraceGetParam(0xFF, param);\r
+ hnd8 = prvTraceGet8BitHandle((traceHandle)objectNumber);\r
+ kse = (KernelCallWithParamAndHandle*) prvTraceNextFreeEventBufferSlot();\r
+ if (kse != NULL)\r
{\r
- dts2 = (uint8_t)prvTraceGetDTS(0xFF);\r
- p8 = (uint8_t) prvTraceGetParam(0xFF, param);\r
- hnd8 = prvTraceGet8BitHandle((traceHandle)objectNumber);\r
- kse = (KernelCallWithParamAndHandle*) prvTraceNextFreeEventBufferSlot();\r
- if (kse != NULL)\r
- {\r
- kse->dts = dts2;\r
- kse->type = (uint8_t)evtcode;\r
- kse->objHandle = hnd8;\r
- kse->param = p8;\r
- prvTraceUpdateCounters();\r
- }\r
+ kse->dts = dts2;\r
+ kse->type = (uint8_t)evtcode;\r
+ kse->objHandle = hnd8;\r
+ kse->param = p8;\r
+ prvTraceUpdateCounters();\r
}\r
}\r
trcCRITICAL_SECTION_END();\r
}\r
\r
trcCRITICAL_SECTION_BEGIN();\r
- if (RecorderDataPtr->recorderActive && handle_of_last_logged_task\r
- && (! inExcludedTask || nISRactive))\r
+ if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)\r
{\r
- /* Check if the event code is excluded */\r
- if (!TRACE_GET_EVENT_CODE_FLAG_ISEXCLUDED(evtcode))\r
+ dts6 = (uint8_t)prvTraceGetDTS(0xFF);\r
+ restParam = (uint16_t)prvTraceGetParam(0xFFFF, param);\r
+ kse = (KernelCallWithParam16*) prvTraceNextFreeEventBufferSlot();\r
+ if (kse != NULL)\r
{\r
- dts6 = (uint8_t)prvTraceGetDTS(0xFF);\r
- restParam = (uint16_t)prvTraceGetParam(0xFFFF, param);\r
- kse = (KernelCallWithParam16*) prvTraceNextFreeEventBufferSlot();\r
- if (kse != NULL)\r
- {\r
- kse->dts = dts6;\r
- kse->type = (uint8_t)evtcode;\r
- kse->param = restParam;\r
- prvTraceUpdateCounters();\r
- }\r
+ kse->dts = dts6;\r
+ kse->type = (uint8_t)evtcode;\r
+ kse->param = restParam;\r
+ prvTraceUpdateCounters();\r
}\r
}\r
trcCRITICAL_SECTION_END();\r
{\r
uint16_t dts3;\r
TSEvent* ts;\r
- int8_t skipEvent;\r
uint8_t hnd8;\r
#if (TRC_CFG_INCLUDE_ISR_TRACING == 1)\r
extern int32_t isPendingContextSwitch;\r
#endif\r
trcSR_ALLOC_CRITICAL_SECTION_ON_CORTEX_M_ONLY();\r
\r
- skipEvent = 0;\r
-\r
- TRACE_ASSERT(task_handle <= TRC_CFG_NTASK,\r
+ TRACE_ASSERT(task_handle <= (TRC_CFG_NTASK),\r
"prvTraceStoreTaskswitch: Invalid value for task_handle", TRC_UNUSED);\r
\r
- /* Skip the event if the task has been excluded, using vTraceExcludeTask */\r
- if (TRACE_GET_TASK_FLAG_ISEXCLUDED(task_handle))\r
- {\r
- skipEvent = 1;\r
- inExcludedTask = 1;\r
- }\r
- else\r
- {\r
- inExcludedTask = 0;\r
- }\r
-\r
trcCRITICAL_SECTION_BEGIN_ON_CORTEX_M_ONLY();\r
\r
- /* Skip the event if the same task is scheduled */\r
- if (task_handle == handle_of_last_logged_task)\r
- {\r
- skipEvent = 1;\r
- }\r
-\r
- if (!RecorderDataPtr->recorderActive)\r
- {\r
- skipEvent = 1;\r
- }\r
-\r
- /* If this event should be logged, log it! */\r
- if (skipEvent == 0)\r
+ if ((task_handle != handle_of_last_logged_task) && (RecorderDataPtr->recorderActive))\r
{\r
#if (TRC_CFG_INCLUDE_ISR_TRACING == 1)\r
isPendingContextSwitch = 0;\r
* and name (a symbol table handle). The stored name-handle mapping is thus the\r
* "old" one, valid up until this point.\r
******************************************************************************/\r
-#if (TRC_CFG_INCLUDE_OBJECT_DELETE == 1)\r
-void prvTraceStoreObjectNameOnCloseEvent(traceHandle handle,\r
+void prvTraceStoreObjectNameOnCloseEvent(uint8_t evtcode, traceHandle handle,\r
traceObjectClass objectclass)\r
{\r
ObjCloseNameEvent * ce;\r
ce = (ObjCloseNameEvent*) prvTraceNextFreeEventBufferSlot();\r
if (ce != NULL)\r
{\r
- ce->type = (uint8_t) (EVENTGROUP_OBJCLOSE_NAME + objectclass);\r
+ ce->type = (uint8_t) evtcode;\r
ce->objHandle = hnd8;\r
ce->symbolIndex = idx;\r
prvTraceUpdateCounters();\r
}\r
}\r
\r
-void prvTraceStoreObjectPropertiesOnCloseEvent(traceHandle handle,\r
+void prvTraceStoreObjectPropertiesOnCloseEvent(uint8_t evtcode, traceHandle handle,\r
traceObjectClass objectclass)\r
{\r
ObjClosePropEvent * pe;\r
{\r
pe->arg1 = TRACE_PROPERTY_OBJECT_STATE(objectclass, handle);\r
}\r
- pe->type = (uint8_t) (EVENTGROUP_OBJCLOSE_PROP + objectclass);\r
+ pe->type = evtcode;\r
prvTraceUpdateCounters();\r
}\r
}\r
}\r
-#endif\r
\r
void prvTraceSetPriorityProperty(uint8_t objectclass, traceHandle id, uint8_t value)\r
{\r
* Static data initializations\r
******************************************************************************/\r
\r
-/* Tasks and kernel objects can be explicitly excluded from the trace to reduce\r
-buffer usage. This structure handles the exclude flags for all objects and tasks. \r
-Note that slot 0 is not used, since not a valid handle. */\r
-uint8_t trcExcludedObjects[(TRACE_KERNEL_OBJECT_COUNT + TRACE_NCLASSES) / 8 + 1] = { 0 };\r
-\r
-/* Specific events can also be excluded, i.e., by the event code. This can be\r
-used to exclude kernel calls that don't refer to a kernel object, like a delay.\r
-This structure handle the exclude flags for all event codes */\r
-uint8_t trcExcludedEventCodes[NEventCodes / 8 + 1] = { 0 };\r
-\r
/* A set of stacks that keeps track of available object handles for each class.\r
The stacks are empty initially, meaning that allocation of new handles will be \r
based on a counter (for each object class). Any delete operation will\r
RecorderDataPtr->minor_version = TRACE_MINOR_VERSION;\r
RecorderDataPtr->irq_priority_order = TRC_IRQ_PRIORITY_ORDER;\r
RecorderDataPtr->filesize = sizeof(RecorderDataType);\r
- RecorderDataPtr->maxEvents = TRC_CFG_EVENT_BUFFER_SIZE;\r
+ RecorderDataPtr->maxEvents = (TRC_CFG_EVENT_BUFFER_SIZE);\r
RecorderDataPtr->debugMarker0 = (int32_t) 0xF0F0F0F0;\r
RecorderDataPtr->isUsing16bitHandles = TRC_CFG_USE_16BIT_OBJECT_HANDLES;\r
RecorderDataPtr->isrTailchainingThreshold = TRC_CFG_ISR_TAILCHAINING_THRESHOLD;\r
vTraceInitObjectPropertyTable();\r
\r
RecorderDataPtr->debugMarker1 = (int32_t)0xF1F1F1F1;\r
- RecorderDataPtr->SymbolTable.symTableSize = TRC_CFG_SYMBOL_TABLE_SIZE;\r
+ RecorderDataPtr->SymbolTable.symTableSize = (TRC_CFG_SYMBOL_TABLE_SIZE);\r
RecorderDataPtr->SymbolTable.nextFreeSymbolIndex = 1;\r
#if (TRC_CFG_INCLUDE_FLOAT_SUPPORT == 1)\r
RecorderDataPtr->exampleFloatEncoding = 1.0f; /* otherwise already zero */\r
#if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER\r
RecorderDataPtr->userEventBuffer.bufferID = 1;\r
RecorderDataPtr->userEventBuffer.version = 0;\r
- RecorderDataPtr->userEventBuffer.numberOfSlots = TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE;\r
- RecorderDataPtr->userEventBuffer.numberOfChannels = TRC_CFG_UB_CHANNELS + 1;\r
+ RecorderDataPtr->userEventBuffer.numberOfSlots = (TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE);\r
+ RecorderDataPtr->userEventBuffer.numberOfChannels = (TRC_CFG_UB_CHANNELS) + 1;\r
#endif\r
\r
/* Kernel specific initialization of the objectHandleStacks variable */\r
RecorderDataPtr->startmarker1 = 0x02; \r
RecorderDataPtr->startmarker0 = 0x01; \r
\r
+ if (traceErrorMessage != NULL)\r
+ {\r
+ // An error was detected before vTraceEnable was called, make sure this is stored in the trace data.\r
+ prvStrncpy(RecorderDataPtr->systemInfo, traceErrorMessage, 80);\r
+ RecorderDataPtr->internalErrorOccured = 1;\r
+ vTraceStop();\r
+ }\r
+\r
+\r
\r
#ifdef TRC_PORT_SPECIFIC_INIT\r
TRC_PORT_SPECIFIC_INIT();\r
return NULL;\r
}\r
\r
- if (RecorderDataPtr->nextFreeIndex >= TRC_CFG_EVENT_BUFFER_SIZE)\r
+ if (RecorderDataPtr->nextFreeIndex >= (TRC_CFG_EVENT_BUFFER_SIZE))\r
{\r
prvTraceError("Attempt to index outside event buffer!");\r
return NULL;\r
traceHandle handle;\r
static int indexOfHandle;\r
\r
+ TRACE_ALLOC_CRITICAL_SECTION();\r
+\r
+ TRACE_ASSERT(RecorderDataPtr != NULL, "Recorder not initialized, call vTraceEnable() first!", (traceHandle)0);\r
+ \r
TRACE_ASSERT(objectclass < TRACE_NCLASSES, \r
"prvTraceGetObjectHandle: Invalid value for objectclass", (traceHandle)0);\r
\r
+ trcCRITICAL_SECTION_BEGIN();\r
indexOfHandle = objectHandleStacks.indexOfNextAvailableHandle[objectclass];\r
if (objectHandleStacks.objectHandles[indexOfHandle] == 0)\r
{\r
objectHandleStacks.handleCountWaterMarksOfClass[objectclass] =\r
(traceHandle)hndCount;\r
}\r
- TRACE_CLEAR_OBJECT_FLAG_ISEXCLUDED(objectclass, handle);\r
}\r
+ trcCRITICAL_SECTION_END();\r
+\r
return handle;\r
}\r
\r
void prvTraceError(const char* msg)\r
{\r
/* Stop the recorder */\r
- vTraceStop();\r
- \r
+ if (RecorderDataPtr != NULL)\r
+ {\r
+ vTraceStop();\r
+ }\r
+\r
/* If first error only... */\r
if (traceErrorMessage == NULL)\r
{\r
}\r
}\r
\r
+void vTraceSetFilterMask(uint16_t filterMask)\r
+{\r
+ CurrentFilterMask = filterMask;\r
+}\r
+\r
+void vTraceSetFilterGroup(uint16_t filterGroup)\r
+{\r
+ CurrentFilterGroup = filterGroup;\r
+}\r
+\r
/******************************************************************************\r
* prvCheckDataToBeOverwrittenForMultiEntryEvents\r
*\r
\r
RecorderDataPtr->nextFreeIndex++;\r
\r
- if (RecorderDataPtr->nextFreeIndex >= TRC_CFG_EVENT_BUFFER_SIZE)\r
+ if (RecorderDataPtr->nextFreeIndex >= (TRC_CFG_EVENT_BUFFER_SIZE))\r
{\r
#if (TRC_CFG_SNAPSHOT_MODE == TRC_SNAPSHOT_MODE_RING_BUFFER)\r
RecorderDataPtr->bufferIsFull = 1;\r
if (timestampFrequency != 0)\r
{\r
/* If to override default TRC_HWTC_FREQ_HZ value with value set by vTraceSetFrequency */\r
- RecorderDataPtr->frequency = timestampFrequency / TRC_HWTC_DIVISOR;\r
+ RecorderDataPtr->frequency = timestampFrequency / (TRC_HWTC_DIVISOR);\r
} \r
- else if (init_hwtc_count != TRC_HWTC_COUNT)\r
+ else if (init_hwtc_count != (TRC_HWTC_COUNT))\r
{\r
/* If using default value and timer has been started. \r
Note: If the default frequency value set here would be incorrect, e.g.,\r
if the timer has actually not been configured yet, override this \r
with vTraceSetFrequency.\r
*/\r
- RecorderDataPtr->frequency = TRC_HWTC_FREQ_HZ / TRC_HWTC_DIVISOR; \r
+ RecorderDataPtr->frequency = (TRC_HWTC_FREQ_HZ) / (TRC_HWTC_DIVISOR); \r
}\r
/* If no override (vTraceSetFrequency) and timer inactive -> no action */\r
}\r
TRACE_ASSERT(name != NULL, "prvTraceCreateSymbolTableEntry: name == NULL", 0);\r
TRACE_ASSERT(len != 0, "prvTraceCreateSymbolTableEntry: len == 0", 0);\r
\r
- if (RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + len + 4 >= TRC_CFG_SYMBOL_TABLE_SIZE)\r
+ if (RecorderDataPtr->SymbolTable.nextFreeSymbolIndex + len + 4 >= (TRC_CFG_SYMBOL_TABLE_SIZE))\r
{\r
prvTraceError("Symbol table full. Increase TRC_CFG_SYMBOL_TABLE_SIZE in trcConfig.h");\r
ret = 0;\r
/* Retrieve TRC_HWTC_COUNT only once since the same value should be used all throughout this function. */\r
#if (TRC_HWTC_TYPE == TRC_OS_TIMER_INCR || TRC_HWTC_TYPE == TRC_FREE_RUNNING_32BIT_INCR)\r
/* Get the increasing tick count */\r
- hwtc_count = TRC_HWTC_COUNT;\r
+ hwtc_count = (TRC_HWTC_COUNT);\r
#elif (TRC_HWTC_TYPE == TRC_OS_TIMER_DECR || TRC_HWTC_TYPE == TRC_FREE_RUNNING_32BIT_DECR)\r
/* Convert decreasing tick count into increasing tick count */\r
- hwtc_count = TRC_HWTC_PERIOD - TRC_HWTC_COUNT;\r
+ hwtc_count = (TRC_HWTC_PERIOD) - (TRC_HWTC_COUNT);\r
#else\r
#error "TRC_HWTC_TYPE has unexpected value"\r
#endif\r
if (pTimestamp)\r
{\r
/* Get timestamp from trace ticks. Scale down the period to avoid unwanted overflows. */\r
- last_timestamp = traceTickCount * (TRC_HWTC_PERIOD / TRC_HWTC_DIVISOR);\r
+ last_timestamp = traceTickCount * ((TRC_HWTC_PERIOD) / (TRC_HWTC_DIVISOR));\r
/* Increase timestamp by (hwtc_count + "lost hardware ticks from scaling down period") / TRC_HWTC_DIVISOR. */\r
- last_timestamp += (hwtc_count + traceTickCount * (TRC_HWTC_PERIOD % TRC_HWTC_DIVISOR)) / TRC_HWTC_DIVISOR;\r
+ last_timestamp += (hwtc_count + traceTickCount * ((TRC_HWTC_PERIOD) % (TRC_HWTC_DIVISOR))) / (TRC_HWTC_DIVISOR);\r
}\r
/* Store the previous value */\r
last_traceTickCount = traceTickCount;\r
diff = (hwtc_count - last_hwtc_count) + last_hwtc_rest;\r
\r
/* Scale down the diff */\r
- diff_scaled = diff / TRC_HWTC_DIVISOR;\r
+ diff_scaled = diff / (TRC_HWTC_DIVISOR);\r
\r
/* Find out how many ticks were lost when scaling down, so we can add them the next time */\r
- last_hwtc_rest = diff % TRC_HWTC_DIVISOR;\r
+ last_hwtc_rest = diff % (TRC_HWTC_DIVISOR);\r
\r
/* We increase the scaled timestamp by the scaled amount */\r
last_timestamp += diff_scaled;\r
/*******************************************************************************\r
- * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Trace Recorder Library for Tracealyzer v4.1.1\r
* Percepio AB, www.percepio.com\r
*\r
* trcStreamingRecorder.c\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2017.\r
+ * Copyright Percepio AB, 2018.\r
* www.percepio.com\r
******************************************************************************/\r
\r
} ObjectDataTable;\r
\r
typedef struct{\r
- uint8_t Status;\r
+ uint16_t Status; /* 16 bit to avoid implicit padding (warnings) */\r
uint16_t BytesRemaining;\r
char* WritePointer;\r
} PageType;\r
\r
#define PSF_ASSERT(_assert, _err) if (! (_assert)){ prvTraceError(_err); return; }\r
\r
-#define PSF_ERROR_NONE 0\r
-#define PSF_ERROR_EVENT_CODE_TOO_LARGE 1\r
-#define PSF_ERROR_ISR_NESTING_OVERFLOW 2\r
-#define PSF_ERROR_DWT_NOT_SUPPORTED 3\r
-#define PSF_ERROR_DWT_CYCCNT_NOT_SUPPORTED 4\r
-#define PSF_ERROR_AUTO_ISR_END 5\r
-\r
/* Part of the PSF format - encodes the number of 32-bit params in an event */\r
#define PARAM_COUNT(n) ((n & 0xF) << 12)\r
\r
\r
uint32_t uiTraceTickCount = 0;\r
uint32_t timestampFrequency = 0;\r
-uint32_t DroppedEventCounter = 0; // Total number of dropped events (failed allocations)\r
-uint32_t TotalBytesRemaining_LowWaterMark = TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE;\r
-uint32_t TotalBytesRemaining = TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE;\r
+uint32_t DroppedEventCounter = 0;\r
+uint32_t TotalBytesRemaining_LowWaterMark = (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT) * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE);\r
+uint32_t TotalBytesRemaining = (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT) * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE);\r
\r
PageType PageInfo[TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT];\r
\r
/*******************************************************************************\r
* LongestSymbolName\r
*\r
- * Updated in prvTraceSaveSymbol. Should not exceed SYMBOL_MAX_LENGTH, otherwise\r
- * symbol names will be truncated. In that case, set SYMBOL_MAX_LENGTH to (at\r
- * least) this value.\r
+ * Updated in prvTraceSaveSymbol. Should not exceed TRC_CFG_SYMBOL_MAX_LENGTH, \r
+ * otherwise symbol names will be truncated. In that case, set \r
+ * TRC_CFG_SYMBOL_MAX_LENGTH to (at least) this value.\r
******************************************************************************/\r
volatile uint32_t LongestSymbolName = 0;\r
\r
******************************************************************************/\r
volatile uint32_t MaxBytesTruncated = 0;\r
\r
+uint16_t CurrentFilterMask = 0xFFFF;\r
+\r
+uint16_t CurrentFilterGroup = FilterGroup0;\r
+\r
/* Internal common function for storing string events */\r
static void prvTraceStoreStringEventHelper( int nArgs,\r
uint16_t eventID,\r
traceString userEvtChannel,\r
+ int len,\r
const char* str,\r
va_list* vl);\r
-static void prvTraceStoreSimpleStringEventHelper( traceString userEvtChannel,\r
- const char* str);\r
\r
+/* Not static to avoid warnings from SysGCC/PPC */ \r
+void prvTraceStoreSimpleStringEventHelper(traceString userEvtChannel,\r
+ const char* str);\r
+\r
+ \r
/* Stores the header information on Start */\r
static void prvTraceStoreHeader(void);\r
\r
/* Retrieve a buffer page to write to. */\r
static int prvAllocateBufferPage(int prevPage);\r
\r
-/* Get the current buffer page index and remaining number of bytes. */\r
+/* Get the current buffer page index (return value) and the number \r
+of valid bytes in the buffer page (bytesUsed). */\r
static int prvGetBufferPage(int32_t* bytesUsed);\r
\r
/* Performs timestamping using definitions in trcHardwarePort.h */\r
/* Signal an error. */\r
void prvTraceError(int errCode);\r
\r
+/* Signal an warning (does not stop the recorder). */\r
+void prvTraceWarning(int errCode);\r
+\r
/******************************************************************************\r
* vTraceInstanceFinishedNow\r
*\r
prvTraceStoreEvent0(PSF_EVENT_IFE_NEXT);\r
}\r
\r
-/*******************************************************************************\r
- * xTraceRegisterString\r
- *\r
- * Stores a name for a user event channel, returns the handle.\r
- ******************************************************************************/\r
-traceString xTraceRegisterString(const char* name)\r
-{\r
- prvTraceSaveSymbol((const void*)name, name);\r
-\r
- /* Always save in symbol table, if the recording has not yet started */\r
- prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, (const char*)name, (uint32_t)name);\r
-\r
- return (traceString)name;\r
-}\r
-\r
/*******************************************************************************\r
* vTraceStoreKernelObjectName\r
*\r
timestampFrequency = frequency;\r
}\r
\r
+#if (TRC_CFG_SCHEDULING_ONLY == 0) && (TRC_CFG_INCLUDE_USER_EVENTS == 1)\r
+\r
+/*******************************************************************************\r
+* xTraceRegisterString\r
+*\r
+* Stores a name for a user event channel, returns the handle.\r
+******************************************************************************/\r
+traceString xTraceRegisterString(const char* name)\r
+{\r
+ prvTraceSaveSymbol((const void*)name, name);\r
+\r
+ /* Always save in symbol table, if the recording has not yet started */\r
+ prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, (const char*)name, (uint32_t)name);\r
+\r
+ return (traceString)name;\r
+}\r
+\r
/******************************************************************************\r
* vTracePrint\r
*\r
{\r
if (fmt[i] == '%')\r
{\r
- if (fmt[i + 1] != '%')\r
+ if (fmt[i + 1] != 0 && fmt[i + 1] != '%')\r
{\r
nArgs++; /* Found an argument */\r
}\r
\r
if (chn != NULL)\r
{\r
- prvTraceStoreStringEventHelper(nArgs, (uint16_t)(PSF_EVENT_USER_EVENT + nArgs + 1), chn, fmt, &vl);\r
+ prvTraceStoreStringEventHelper(nArgs, (uint16_t)(PSF_EVENT_USER_EVENT + nArgs + 1), chn, i, fmt, &vl);\r
}\r
else\r
{\r
- prvTraceStoreStringEventHelper(nArgs, (uint16_t)(PSF_EVENT_USER_EVENT + nArgs), chn, fmt, &vl);\r
+ prvTraceStoreStringEventHelper(nArgs, (uint16_t)(PSF_EVENT_USER_EVENT + nArgs), chn, i, fmt, &vl);\r
}\r
-\r
va_end(vl);\r
}\r
+#endif /* (TRC_CFG_SCHEDULING_ONLY == 0) && (TRC_CFG_INCLUDE_USER_EVENTS == 1) */\r
\r
/*******************************************************************************\r
* xTraceSetISRProperties\r
if (ISR_stack_index == -1)\r
isPendingContextSwitch = 0; \r
\r
- if (ISR_stack_index < TRC_CFG_MAX_ISR_NESTING - 1)\r
+ if (ISR_stack_index < (TRC_CFG_MAX_ISR_NESTING) - 1)\r
{\r
ISR_stack_index++;\r
ISR_stack[ISR_stack_index] = (uint32_t)handle;\r
+#if (TRC_CFG_INCLUDE_ISR_TRACING == 1)\r
prvTraceStoreEvent1(PSF_EVENT_ISR_BEGIN, (uint32_t)handle);\r
+#endif\r
TRACE_EXIT_CRITICAL_SECTION();\r
}\r
else\r
TRACE_ALLOC_CRITICAL_SECTION();\r
\r
TRACE_ENTER_CRITICAL_SECTION();\r
+ \r
+ (void)ISR_stack;\r
\r
/* Is there a pending task-switch? (perhaps from an earlier ISR) */\r
isPendingContextSwitch |= isTaskSwitchRequired;\r
{\r
ISR_stack_index--;\r
\r
+#if (TRC_CFG_INCLUDE_ISR_TRACING == 1)\r
/* Store return to interrupted ISR (if nested ISRs)*/\r
prvTraceStoreEvent1(PSF_EVENT_ISR_RESUME, (uint32_t)ISR_stack[ISR_stack_index]);\r
+#endif\r
}\r
else\r
{\r
/* Store return to interrupted task, if no context switch will occur in between. */\r
if ((isPendingContextSwitch == 0) || (prvTraceIsSchedulerSuspended()))\r
{\r
+#if (TRC_CFG_INCLUDE_ISR_TRACING == 1)\r
prvTraceStoreEvent1(PSF_EVENT_TS_RESUME, (uint32_t)TRACE_GET_CURRENT_TASK());\r
+#endif\r
}\r
}\r
\r
/*******************************************************************************\r
* xTraceGetLastError\r
*\r
- * Returns the last error, if any.\r
+ * Returns the last error or warning, as a string, or NULL if none.\r
*****************************************************************************/\r
const char* xTraceGetLastError(void)\r
{\r
- if (NoRoomForSymbol > 0)\r
+ /* Note: the error messages are short, in order to fit in a User Event.\r
+ Instead, the users can read more in the below comments.*/\r
+ \r
+ switch (errorCode)\r
{\r
- return "TRC_CFG_SYMBOL_TABLE_SLOTS too small.";\r
- }\r
+ \r
+ case PSF_WARNING_SYMBOL_TABLE_SLOTS:\r
+ /* There was not enough symbol table slots for storing symbol names.\r
+ The number of missing slots is counted by NoRoomForSymbol. Inspect this\r
+ variable and increase TRC_CFG_SYMBOL_TABLE_SLOTS by at least that value. */\r
+\r
+ return "Exceeded SYMBOL_TABLE_SLOTS (see xTraceGetLastError)";\r
+\r
+ case PSF_WARNING_SYMBOL_MAX_LENGTH:\r
+ /* A symbol name exceeded TRC_CFG_SYMBOL_MAX_LENGTH in length.\r
+ Make sure the symbol names are at most TRC_CFG_SYMBOL_MAX_LENGTH,\r
+ or inspect LongestSymbolName and increase TRC_CFG_SYMBOL_MAX_LENGTH\r
+ to at least this value. */\r
+\r
+ return "Exceeded SYMBOL_MAX_LENGTH (see xTraceGetLastError)";\r
+\r
+ case PSF_WARNING_OBJECT_DATA_SLOTS:\r
+ /* There was not enough symbol object table slots for storing object\r
+ properties, such as task priorites. The number of missing slots is \r
+ counted by NoRoomForObjectData. Inspect this variable and increase \r
+ TRC_CFG_OBJECT_DATA_SLOTS by at least that value. */\r
+ \r
+ return "Exceeded OBJECT_DATA_SLOTS (see xTraceGetLastError)";\r
\r
- if (LongestSymbolName > (TRC_CFG_SYMBOL_MAX_LENGTH))\r
- {\r
- return "TRC_CFG_SYMBOL_MAX_LENGTH too small.";\r
- }\r
+ case PSF_WARNING_STRING_TOO_LONG:\r
+ /* Some string argument was longer than the maximum payload size\r
+ and has been truncated by "MaxBytesTruncated" bytes.\r
\r
- if (NoRoomForObjectData > 0)\r
- {\r
- return "TRC_CFG_OBJECT_DATA_SLOTS too small.";\r
- }\r
+ This may happen for the following functions:\r
+ - vTracePrint\r
+ - vTracePrintF\r
+ - vTraceStoreKernelObjectName\r
+ - xTraceRegisterString\r
+ - vTraceSetISRProperties\r
\r
- if (MaxBytesTruncated > 0)\r
- {\r
- return "String or User Event too long.";\r
- }\r
+ A PSF event may store maximum 60 bytes payload, including data\r
+ arguments and string characters. For User Events, also the User\r
+ Event Channel (4 bytes) must be squeezed in, if a channel is\r
+ specified (can be NULL). */\r
+\r
+ return "String too long (see xTraceGetLastError)";\r
+\r
+ case PSF_WARNING_STREAM_PORT_READ:\r
+ /* TRC_STREAM_PORT_READ_DATA is expected to return 0 when completed successfully.\r
+ This means there is an error in the communication with host/Tracealyzer. */\r
+\r
+ return "TRC_STREAM_PORT_READ_DATA returned error (!= 0).";\r
+\r
+ case PSF_WARNING_STREAM_PORT_WRITE:\r
+ /* TRC_STREAM_PORT_WRITE_DATA is expected to return 0 when completed successfully.\r
+ This means there is an error in the communication with host/Tracealyzer. */\r
+\r
+ return "TRC_STREAM_PORT_WRITE_DATA returned error (!= 0).";\r
\r
- switch (errorCode)\r
- {\r
case PSF_ERROR_EVENT_CODE_TOO_LARGE:\r
- return "An invalid event code was used.";\r
+ /* The highest allowed event code is 4095, anything higher is an unexpected error. \r
+ Please contact support@percepio.com for assistance.*/\r
+ \r
+ return "Invalid event code (see xTraceGetLastError)";\r
+ \r
case PSF_ERROR_ISR_NESTING_OVERFLOW:\r
- return "Too much ISR nesting.";\r
+ /* Nesting of ISR trace calls exceeded the limit (TRC_CFG_MAX_ISR_NESTING).\r
+ If this is unlikely, make sure that you call vTraceStoreISRExit in the end \r
+ of all ISR handlers. Or increase TRC_CFG_MAX_ISR_NESTING. */\r
+\r
+ return "Exceeded ISR nesting (see xTraceGetLastError)";\r
+\r
case PSF_ERROR_DWT_NOT_SUPPORTED:\r
- return "DWT not supported by this chip.";\r
+ /* On ARM Cortex-M only - failed to initialize DWT Cycle Counter since not supported by this chip.\r
+ DWT timestamping is selected automatically for ART Cortex-M3, M4 and higher, based on the __CORTEX_M\r
+ macro normally set by ARM's CMSIS library, since typically available. You can however select\r
+ SysTick timestamping instead by defining adding "#define TRC_CFG_ARM_CM_USE_SYSTICK".*/\r
+\r
+ return "DWT not supported (see xTraceGetLastError)";\r
+\r
case PSF_ERROR_DWT_CYCCNT_NOT_SUPPORTED:\r
- return "DWT_CYCCNT not supported by this chip.";\r
+ /* On ARM Cortex-M only - failed to initialize DWT Cycle Counter since not supported by this chip.\r
+ DWT timestamping is selected automatically for ART Cortex-M3, M4 and higher, based on the __CORTEX_M\r
+ macro normally set by ARM's CMSIS library, since typically available. You can however select \r
+ SysTick timestamping instead by defining adding "#define TRC_CFG_ARM_CM_USE_SYSTICK".*/\r
+ \r
+ return "DWT_CYCCNT not supported (see xTraceGetLastError)";\r
+ \r
+ case PSF_ERROR_TZCTRLTASK_NOT_CREATED:\r
+ /* vTraceEnable failed creating the trace control task (TzCtrl) - incorrect parameters (priority?)\r
+ or insufficient heap size? */\r
+ return "Could not create TzCtrl (see xTraceGetLastError)";\r
+ \r
}\r
\r
- return "";\r
+ return NULL;\r
}\r
\r
/*******************************************************************************\r
}\r
#endif\r
\r
+\r
+/*******************************************************************************\r
+* xTraceIsRecordingEnabled\r
+* Returns true (1) if the recorder is enabled (i.e. is recording), otherwise 0.\r
+******************************************************************************/\r
+int xTraceIsRecordingEnabled(void)\r
+{\r
+ return (int)RecorderEnabled;\r
+}\r
+\r
+void vTraceSetFilterMask(uint16_t filterMask)\r
+{\r
+ CurrentFilterMask = filterMask;\r
+}\r
+\r
+void vTraceSetFilterGroup(uint16_t filterGroup)\r
+{\r
+ CurrentFilterGroup = filterGroup;\r
+}\r
+\r
+\r
/******************************************************************************/\r
/*** INTERNAL FUNCTIONS *******************************************************/\r
/******************************************************************************/\r
\r
TRACE_ALLOC_CRITICAL_SECTION();\r
\r
+ if (RecorderEnabled == isEnabled)\r
+ {\r
+ return;\r
+ }\r
+ \r
currentTask = TRACE_GET_CURRENT_TASK();\r
\r
TRACE_ENTER_CRITICAL_SECTION();\r
\r
if (RecorderEnabled)\r
{\r
- prvTraceOnBegin();\r
- \r
+ TRC_STREAM_PORT_ON_TRACE_BEGIN();\r
+\r
+ #if (TRC_STREAM_PORT_USE_INTERNAL_BUFFER == 1)\r
+ prvPagedEventBufferInit(_TzTraceData);\r
+ #endif\r
+ \r
eventCounter = 0;\r
ISR_stack_index = -1;\r
prvTraceStoreHeader();\r
}\r
else\r
{\r
- prvTraceOnEnd();\r
+ TRC_STREAM_PORT_ON_TRACE_END();\r
}\r
\r
TRACE_EXIT_CRITICAL_SECTION();\r
}\r
\r
/* Stores the symbol table on Start */\r
-static void prvTraceStoreSymbolTable()\r
+static void prvTraceStoreSymbolTable(void)\r
{\r
uint32_t i = 0;\r
uint32_t j = 0;\r
}\r
\r
/* Stores the object table on Start */\r
-static void prvTraceStoreObjectDataTable()\r
+static void prvTraceStoreObjectDataTable(void)\r
{\r
uint32_t i = 0;\r
uint32_t j = 0;\r
}\r
\r
/* Stores the header information on Start */\r
-static void prvTraceStoreHeader()\r
+static void prvTraceStoreHeader(void)\r
{\r
TRACE_ALLOC_CRITICAL_SECTION();\r
\r
header->symbolSize = SYMBOL_TABLE_SLOT_SIZE;\r
header->symbolCount = (TRC_CFG_SYMBOL_TABLE_SLOTS);\r
header->objectDataSize = 8;\r
- header->objectDataCount = TRC_CFG_OBJECT_DATA_SLOTS;\r
+ header->objectDataCount = (TRC_CFG_OBJECT_DATA_SLOTS);\r
TRC_STREAM_PORT_COMMIT_EVENT(header, sizeof(PSFHeaderInfo));\r
}\r
}\r
}\r
\r
/* Store the current warnings */\r
-static void prvTraceStoreWarnings()\r
+static void prvTraceStoreWarnings(void)\r
{\r
- TRACE_ALLOC_CRITICAL_SECTION();\r
-\r
- TRACE_ENTER_CRITICAL_SECTION();\r
-\r
if (RecorderEnabled)\r
{\r
- if (NoRoomForSymbol > 0)\r
- {\r
- vTracePrintF(trcWarningChannel, "TRC_CFG_SYMBOL_TABLE_SLOTS too small. Add %d slots.", NoRoomForSymbol);\r
- }\r
-\r
- if (LongestSymbolName > 0)\r
- {\r
- if (LongestSymbolName > (TRC_CFG_SYMBOL_MAX_LENGTH))\r
- {\r
- vTracePrintF(trcWarningChannel, "TRC_CFG_SYMBOL_MAX_LENGTH too small. Add %d chars.", LongestSymbolName - (TRC_CFG_SYMBOL_MAX_LENGTH));\r
- }\r
- }\r
-\r
- if (NoRoomForObjectData > 0)\r
- {\r
- /* We don't know how many objects we actually need to make room for since NoRoomForObjectData can be increased multiple times for the same object! */\r
- vTracePrintF(trcWarningChannel, "TRC_CFG_OBJECT_DATA_SLOTS too small. Add more slots.");\r
- }\r
+ const char* errStr = xTraceGetLastError();\r
\r
- if (MaxBytesTruncated > 0)\r
+ if (errStr != NULL)\r
{\r
- /* Some string event generated a too long string that was truncated.\r
- This may happen for the following functions:\r
- - vTracePrintF\r
- - vTraceStoreKernelObjectName\r
- - vTraceStoreUserEventChannelName\r
- - vTraceSetISRProperties\r
-\r
- A PSF event may store maximum 60 bytes payload, including data arguments\r
- and string characters. For User Events, also the User Event Channel ptr\r
- must be squeezed in, if a channel is specified. */\r
-\r
- vTracePrintF(trcWarningChannel, "String event too long, up to %d bytes truncated.", MaxBytesTruncated);\r
- }\r
-\r
- switch (errorCode)\r
- {\r
- case PSF_ERROR_EVENT_CODE_TOO_LARGE:\r
- break;\r
- case PSF_ERROR_ISR_NESTING_OVERFLOW: \r
- break;\r
- case PSF_ERROR_DWT_NOT_SUPPORTED:\r
- vTracePrintF(trcWarningChannel, "DWT not supported, see prvTraceInitCortexM.");\r
- break;\r
- case PSF_ERROR_DWT_CYCCNT_NOT_SUPPORTED:\r
- vTracePrintF(trcWarningChannel, "DWT_CYCCNT not supported, see prvTraceInitCortexM.");\r
- break;\r
+ vTracePrint(trcWarningChannel, errStr);\r
}\r
}\r
- TRACE_EXIT_CRITICAL_SECTION();\r
}\r
\r
/* Store an event with zero parameters (event ID only) */\r
/* Stories an event with a string and <nParam> 32-bit integer parameters */\r
void prvTraceStoreStringEvent(int nArgs, uint16_t eventID, const char* str, ...)\r
{\r
+ int len;\r
va_list vl;\r
\r
+ for (len = 0; (str[len] != 0) && (len < 52); len++); /* empty loop */\r
+\r
va_start(vl, str);\r
- prvTraceStoreStringEventHelper(nArgs, eventID, NULL, str, &vl);\r
+ prvTraceStoreStringEventHelper(nArgs, eventID, NULL, len, str, &vl);\r
va_end(vl);\r
}\r
\r
/* Internal common function for storing string events */\r
-static void prvTraceStoreStringEventHelper( int nArgs,\r
+static void prvTraceStoreStringEventHelper(int nArgs,\r
uint16_t eventID,\r
traceString userEvtChannel,\r
- const char* str, va_list* vl)\r
+ int len,\r
+ const char* str,\r
+ va_list* vl)\r
{\r
- int len;\r
int nWords;\r
int nStrWords;\r
int i;\r
TRACE_ALLOC_CRITICAL_SECTION();\r
\r
PSF_ASSERT(eventID < 4096, PSF_ERROR_EVENT_CODE_TOO_LARGE);\r
-\r
- for (len = 0; (str[len] != 0) && (len < 52); len++); /* empty loop */\r
\r
/* The string length in multiples of 32 bit words (+1 for null character) */\r
nStrWords = (len+1+3)/4;\r
}\r
\r
/* Internal common function for storing string events without additional arguments */\r
-static void prvTraceStoreSimpleStringEventHelper( traceString userEvtChannel,\r
- const char* str)\r
+void prvTraceStoreSimpleStringEventHelper(traceString userEvtChannel,\r
+ const char* str)\r
{\r
int len;\r
int nWords;\r
}\r
}\r
\r
+/* Called on warnings, when the recording can continue. */\r
+void prvTraceWarning(int errCode)\r
+{\r
+ if (!errorCode)\r
+ {\r
+ errorCode = errCode;\r
+ prvTraceStoreWarnings();\r
+ }\r
+}\r
+\r
/* Called on critical errors in the recorder. Stops the recorder! */\r
void prvTraceError(int errCode)\r
{\r
{\r
errorCode = errCode;\r
prvTraceStoreWarnings();\r
- vTracePrintF(trcWarningChannel, "Error detected. Stopped recorder.");\r
+ vTracePrintF(trcWarningChannel, "Recorder stopped in prvTraceError()");\r
\r
prvSetRecorderEnabled(0);\r
}\r
\r
#if ((TRC_HWTC_TYPE == TRC_OS_TIMER_INCR) || (TRC_HWTC_TYPE == TRC_OS_TIMER_DECR))\r
uint32_t ticks = TRACE_GET_OS_TICKS();\r
- return (TRC_HWTC_COUNT & 0x00FFFFFFU) + ((ticks & 0x000000FFU) << 24);\r
+ return ((TRC_HWTC_COUNT) & 0x00FFFFFFU) + ((ticks & 0x000000FFU) << 24);\r
#endif\r
}\r
\r
timestampFrequency = TRC_HWTC_FREQ_HZ;\r
}\r
\r
- if (TRC_HWTC_TYPE == TRC_CUSTOM_TIMER_INCR || TRC_HWTC_TYPE == TRC_CUSTOM_TIMER_DECR)\r
- {\r
+ #if (TRC_HWTC_TYPE == TRC_CUSTOM_TIMER_INCR || TRC_HWTC_TYPE == TRC_CUSTOM_TIMER_DECR)\r
+ \r
prvTraceStoreEvent(5, \r
PSF_EVENT_TS_CONFIG,\r
(uint32_t)timestampFrequency, \r
- (uint32_t)TRACE_TICK_RATE_HZ,\r
- (uint32_t)TRC_HWTC_TYPE,\r
- (uint32_t)TRC_CFG_ISR_TAILCHAINING_THRESHOLD,\r
- (uint32_t)TRC_HWTC_PERIOD);\r
- }\r
- else\r
- {\r
+ (uint32_t)(TRACE_TICK_RATE_HZ),\r
+ (uint32_t)(TRC_HWTC_TYPE),\r
+ (uint32_t)(TRC_CFG_ISR_TAILCHAINING_THRESHOLD),\r
+ (uint32_t)(TRC_HWTC_PERIOD));\r
+ \r
+ #else\r
+ \r
prvTraceStoreEvent(4, \r
PSF_EVENT_TS_CONFIG,\r
(uint32_t)timestampFrequency, \r
- (uint32_t)TRACE_TICK_RATE_HZ,\r
- (uint32_t)TRC_HWTC_TYPE,\r
- (uint32_t)TRC_CFG_ISR_TAILCHAINING_THRESHOLD);\r
- }\r
+ (uint32_t)(TRACE_TICK_RATE_HZ),\r
+ (uint32_t)(TRC_HWTC_TYPE),\r
+ (uint32_t)(TRC_CFG_ISR_TAILCHAINING_THRESHOLD)); \r
+ #endif\r
}\r
\r
/* Retrieve a buffer page to write to. */\r
int index;\r
int count = 0;\r
\r
- index = (prevPage + 1) % TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT;\r
+ index = (prevPage + 1) % (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT);\r
\r
- while((PageInfo[index].Status != PAGE_STATUS_FREE) && (count ++ < TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT))\r
+ while((PageInfo[index].Status != PAGE_STATUS_FREE) && (count ++ < (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT)))\r
{\r
- index = (index + 1) % TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT;\r
+ index = (index + 1) % (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT);\r
}\r
\r
if (PageInfo[index].Status == PAGE_STATUS_FREE)\r
TRACE_ALLOC_CRITICAL_SECTION();\r
\r
TRACE_ENTER_CRITICAL_SECTION();\r
- PageInfo[pageIndex].BytesRemaining = TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE;\r
- PageInfo[pageIndex].WritePointer = &EventBuffer[pageIndex * TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE];\r
+ PageInfo[pageIndex].BytesRemaining = (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE);\r
+ PageInfo[pageIndex].WritePointer = &EventBuffer[pageIndex * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE)];\r
PageInfo[pageIndex].Status = PAGE_STATUS_FREE;\r
\r
- TotalBytesRemaining += TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE;\r
+ TotalBytesRemaining += (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE);\r
\r
TRACE_EXIT_CRITICAL_SECTION();\r
}\r
{\r
static int8_t lastPage = -1;\r
int count = 0;\r
- int8_t index = (int8_t) ((lastPage + 1) % TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT);\r
+ int8_t index = (int8_t) ((lastPage + 1) % (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT));\r
\r
- while((PageInfo[index].Status != PAGE_STATUS_READ) && (count++ < TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT))\r
+ while((PageInfo[index].Status != PAGE_STATUS_READ) && (count++ < (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT)))\r
{\r
- index = (int8_t)((index + 1) % TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT);\r
+ index = (int8_t)((index + 1) % (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT));\r
}\r
\r
if (PageInfo[index].Status == PAGE_STATUS_READ)\r
{\r
- *bytesUsed = TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE - PageInfo[index].BytesRemaining;\r
+ *bytesUsed = (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE) - PageInfo[index].BytesRemaining;\r
lastPage = index;\r
return index;\r
}\r
}\r
\r
/*******************************************************************************\r
-\r
-int32_t prvPagedEventBufferTransfer(int32_t (*writeFunc)(void* data,\r
- uint32_t size),\r
- int32_t* nofBytes)\r
-\r
-Transfers one block of trace data, if available for reading. Returns the number\r
-of bytes transfered, or a negative error code. If data was transferred (return\r
-value > 0), it can be good to call this function again until all data available\r
-has been transfered.\r
-\r
-This function is intended to be called by a periodic task with a suitable\r
-delay (e.g. 10-100 ms).\r
-\r
-Return value: as returned from writeFunc (0 == OK)\r
-\r
-Parameters:\r
-\r
-- writeFunc\r
-Function pointer (example: int32_t write(void* data, uint32_t size))\r
-The function passed as writeFunc should write "size" bytes from "data" to the\r
-socket/file/channel, and return a status code where 0 means OK,\r
-and any other non-zero value means an error.\r
-\r
-- int32_t* nofBytes\r
-Pointer to an integer assigned the number of bytes that was transfered.\r
-\r
-*******************************************************************************/\r
-int32_t prvPagedEventBufferTransfer(int32_t (*writeFunc)(void* data, uint32_t size, int32_t* ptrBytesWritten), int32_t* nofBytes)\r
+ * uint32_t prvPagedEventBufferTransfer(void)\r
+ *\r
+ * Transfers one buffer page of trace data, if a full page is available, using\r
+ * the macro TRC_STREAM_PORT_WRITE_DATA as defined in trcStreamingPort.h.\r
+ *\r
+ * This function is intended to be called the periodic TzCtrl task with a suitable\r
+ * delay (e.g. 10-100 ms).\r
+ *\r
+ * Returns the number of bytes sent. If non-zero, it is good to call this \r
+ * again, in order to send any additional data waiting in the buffer.\r
+ * If zero, wait a while before calling again.\r
+ *\r
+ * In case of errors from the streaming interface, it registers a warning\r
+ * (PSF_WARNING_STREAM_PORT_WRITE) provided by xTraceGetLastError().\r
+ *\r
+ *******************************************************************************/\r
+uint32_t prvPagedEventBufferTransfer(void)\r
{\r
int8_t pageToTransfer = -1;\r
- int32_t transferred = 0;\r
- int32_t size = 0;\r
- \r
- pageToTransfer = (int8_t)prvGetBufferPage(nofBytes);\r
- size = *nofBytes; // The number of bytes we want to transfer\r
- transferred = 0; // The number of bytes we have transferred so far\r
+ int32_t bytesTransferredTotal = 0;\r
+ int32_t bytesTransferredNow = 0;\r
+ int32_t bytesToTransfer;\r
+\r
+ pageToTransfer = (int8_t)prvGetBufferPage(&bytesToTransfer);\r
\r
+ /* bytesToTransfer now contains the number of "valid" bytes in the buffer page, that should be transmitted.\r
+ There might be some unused junk bytes in the end, that must be ignored. */\r
+ \r
if (pageToTransfer > -1)\r
{\r
- while (1) // Keep going until we have transferred all that we intended to\r
+ while (1) /* Keep going until we have transferred all that we intended to */\r
{\r
- if (writeFunc(&EventBuffer[pageToTransfer * TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE + transferred], (uint32_t)(size - transferred), nofBytes) == 0)\r
+ if (TRC_STREAM_PORT_WRITE_DATA(\r
+ &EventBuffer[pageToTransfer * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE) + bytesTransferredTotal],\r
+ (uint32_t)(bytesToTransfer - bytesTransferredTotal),\r
+ &bytesTransferredNow) == 0)\r
{\r
- // Write was successful. Update the number of transferred bytes.\r
- transferred += *nofBytes;\r
- if (size == transferred)\r
+ /* Write was successful. Update the number of transferred bytes. */\r
+ bytesTransferredTotal += bytesTransferredNow;\r
+\r
+ if (bytesTransferredTotal == bytesToTransfer)\r
{\r
- // All bytes have been transferred. Mark as Complete and return.\r
- *nofBytes = transferred;\r
+ /* All bytes have been transferred. Mark the buffer page as "Read Complete" (so it can be written to) and return OK. */\r
prvPageReadComplete(pageToTransfer);\r
- return 0;\r
+ return (uint32_t)bytesTransferredTotal;\r
}\r
}\r
else\r
{\r
- *nofBytes = 0;\r
- return 1;\r
+ /* Some error from the streaming interface... */\r
+ prvTraceWarning(PSF_WARNING_STREAM_PORT_WRITE);\r
+ return 0;\r
}\r
}\r
}\r
}\r
\r
/*******************************************************************************\r
-\r
-void* prvPagedEventBufferGetWritePointer(int sizeOfEvent)\r
-\r
-Returns a pointer to an available location in the buffer able to store the\r
-requested size.\r
-\r
-Return value: The pointer.\r
-\r
-Parameters:\r
-\r
-- sizeOfEvent\r
-The size of the event that is to be placed in the buffer.\r
-\r
+ * void* prvPagedEventBufferGetWritePointer(int sizeOfEvent)\r
+ *\r
+ * Returns a pointer to an available location in the buffer able to store the\r
+ * requested size.\r
+ * \r
+ * Return value: The pointer.\r
+ * \r
+ * Parameters:\r
+ * - sizeOfEvent: The size of the event that is to be placed in the buffer.\r
+ *\r
*******************************************************************************/\r
void* prvPagedEventBufferGetWritePointer(int sizeOfEvent)\r
{\r
}\r
\r
/*******************************************************************************\r
-\r
-void prvPagedEventBufferInit(char* buffer)\r
-\r
-Assigns the buffer to use and initializes the PageInfo structure.\r
-\r
-Return value: void\r
-\r
-Parameters:\r
-\r
-- buffer\r
-Pointer to the buffer location that is dynamically or statically allocated by\r
-the caller.\r
-\r
+ * void prvPagedEventBufferInit(char* buffer)\r
+ *\r
+ * Assigns the buffer to use and initializes the PageInfo structure.\r
+ *\r
+ * Return value: void\r
+ * \r
+ * Parameters:\r
+ * - char* buffer: pointer to the trace data buffer, allocated by the caller.\r
+ *\r
*******************************************************************************/\r
void prvPagedEventBufferInit(char* buffer)\r
{\r
EventBuffer = buffer;\r
\r
TRACE_ENTER_CRITICAL_SECTION();\r
- for (i = 0; i < TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT; i++)\r
+ for (i = 0; i < (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT); i++)\r
{\r
- PageInfo[i].BytesRemaining = TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE;\r
- PageInfo[i].WritePointer = &EventBuffer[i * TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE];\r
+ PageInfo[i].BytesRemaining = (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE);\r
+ PageInfo[i].WritePointer = &EventBuffer[i * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE)];\r
PageInfo[i].Status = PAGE_STATUS_FREE;\r
}\r
TRACE_EXIT_CRITICAL_SECTION();\r
+\r
}\r
\r
#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/\r
+++ /dev/null
-Directories:\r
-\r
-+ The FreeRTOS-Plus/Source contains the source code of each FreeRTOS+ product.\r
-\r
-+ See http://www.FreeRTOS.org for FreeRTOS documentation. See\r
- http://www.freertos.org/plus for FreeRTOS+ documentation.\r
-\r