]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/timers.c
Minor updates to ensure all kernel aware debuggers are happy with V8.
[freertos] / FreeRTOS / Source / timers.c
index 26f537d723e43c0f92a12e4ffecd4244c8f37cb8..a7625887480d618793628a5848f5e9bf9ce6b0f0 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.0.0:rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+    FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
@@ -76,8 +76,8 @@ task.h is included from an application file. */
 #include "queue.h"\r
 #include "timers.h"\r
 \r
-#if ( INCLUDE_xTimerPendFunctionCallFromISR == 1 ) && ( configUSE_TIMERS == 0 )\r
-       #error configUSE_TIMERS must be set to 1 to make the INCLUDE_xTimerPendFunctionCallFromISR() function available.\r
+#if ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 0 )\r
+       #error configUSE_TIMERS must be set to 1 to make the xTimerPendFunctionCall() function available.\r
 #endif\r
 \r
 /* Lint e961 and e750 are suppressed as a MISRA exception justified because the\r
@@ -108,7 +108,11 @@ typedef struct tmrTimerControl
        #if( configUSE_TRACE_FACILITY == 1 )\r
                UBaseType_t                     uxTimerNumber;          /*<< An ID assigned by trace tools such as FreeRTOS+Trace */\r
        #endif\r
-} Timer_t;\r
+} xTIMER;\r
+\r
+/* The old xTIMER name is maintained above then typedefed to the new Timer_t\r
+name below to enable the use of older kernel aware debuggers. */\r
+typedef xTIMER Timer_t;\r
 \r
 /* The definition of messages that can be sent and received on the timer queue.\r
 Two types of message can be queued - messages that manipulate a software timer,\r
@@ -140,9 +144,9 @@ typedef struct tmrTimerQueueMessage
 \r
                /* Don't include xCallbackParameters if it is not going to be used as\r
                it makes the structure (and therefore the timer queue) larger. */\r
-               #if ( INCLUDE_xTimerPendFunctionCallFromISR == 1 )\r
+               #if ( INCLUDE_xTimerPendFunctionCall == 1 )\r
                        CallbackParameters_t xCallbackParameters;\r
-               #endif /* INCLUDE_xTimerPendFunctionCallFromISR */\r
+               #endif /* INCLUDE_xTimerPendFunctionCall */\r
        } u;\r
 } DaemonTaskMessage_t;\r
 \r
@@ -305,7 +309,7 @@ Timer_t *pxNewTimer;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xBlockTime )\r
+BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait )\r
 {\r
 BaseType_t xReturn = pdFAIL;\r
 DaemonTaskMessage_t xMessage;\r
@@ -323,7 +327,7 @@ DaemonTaskMessage_t xMessage;
                {\r
                        if( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING )\r
                        {\r
-                               xReturn = xQueueSendToBack( xTimerQueue, &xMessage, xBlockTime );\r
+                               xReturn = xQueueSendToBack( xTimerQueue, &xMessage, xTicksToWait );\r
                        }\r
                        else\r
                        {\r
@@ -575,9 +579,11 @@ TickType_t xTimeNow;
 \r
        while( xQueueReceive( xTimerQueue, &xMessage, tmrNO_DELAY ) != pdFAIL ) /*lint !e603 xMessage does not have to be initialised as it is passed out, not in, and it is not used unless xQueueReceive() returns pdTRUE. */\r
        {\r
-               #if ( INCLUDE_xTimerPendFunctionCallFromISR == 1 )\r
+               #if ( INCLUDE_xTimerPendFunctionCall == 1 )\r
                {\r
-                       if( xMessage.xMessageID == tmrCOMMAND_EXECUTE_CALLBACK )\r
+                       /* Negative commands are pended function calls rather than timer\r
+                       commands. */\r
+                       if( xMessage.xMessageID < 0 )\r
                        {\r
                                const CallbackParameters_t * const pxCallback = &( xMessage.u.xCallbackParameters );\r
 \r
@@ -593,9 +599,11 @@ TickType_t xTimeNow;
                                mtCOVERAGE_TEST_MARKER();\r
                        }\r
                }\r
-               #endif /* INCLUDE_xTimerPendFunctionCallFromISR */\r
+               #endif /* INCLUDE_xTimerPendFunctionCall */\r
 \r
-               if( xMessage.xMessageID != tmrCOMMAND_EXECUTE_CALLBACK )\r
+               /* Commands that are positive are timer commands rather than pended\r
+               function calls. */\r
+               if( xMessage.xMessageID >= ( BaseType_t ) 0 )\r
                {\r
                        /* The messages uses the xTimerParameters member to work on a\r
                        software timer. */\r
@@ -660,6 +668,7 @@ TickType_t xTimeNow;
                                        break;\r
 \r
                                case tmrCOMMAND_CHANGE_PERIOD :\r
+                               case tmrCOMMAND_CHANGE_PERIOD_FROM_ISR :\r
                                        pxTimer->xTimerPeriodInTicks = xMessage.u.xTimerParameters.xMessageValue;\r
                                        configASSERT( ( pxTimer->xTimerPeriodInTicks > 0 ) );\r
 \r
@@ -800,7 +809,7 @@ Timer_t *pxTimer = ( Timer_t * ) xTimer;
        taskEXIT_CRITICAL();\r
 \r
        return xTimerIsInActiveList;\r
-}\r
+} /*lint !e818 Can't be pointer to const due to the typedef. */\r
 /*-----------------------------------------------------------*/\r
 \r
 void *pvTimerGetTimerID( const TimerHandle_t xTimer )\r
@@ -811,7 +820,7 @@ Timer_t * const pxTimer = ( Timer_t * ) xTimer;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-#if( INCLUDE_xTimerPendFunctionCallFromISR == 1 )\r
+#if( INCLUDE_xTimerPendFunctionCall == 1 )\r
 \r
        BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, BaseType_t *pxHigherPriorityTaskWoken )\r
        {\r
@@ -820,17 +829,43 @@ Timer_t * const pxTimer = ( Timer_t * ) xTimer;
 \r
                /* Complete the message with the function parameters and post it to the\r
                daemon task. */\r
-               xMessage.xMessageID = tmrCOMMAND_EXECUTE_CALLBACK;\r
+               xMessage.xMessageID = tmrCOMMAND_EXECUTE_CALLBACK_FROM_ISR;\r
                xMessage.u.xCallbackParameters.pxCallbackFunction = xFunctionToPend;\r
                xMessage.u.xCallbackParameters.pvParameter1 = pvParameter1;\r
                xMessage.u.xCallbackParameters.ulParameter2 = ulParameter2;\r
 \r
                xReturn = xQueueSendFromISR( xTimerQueue, &xMessage, pxHigherPriorityTaskWoken );\r
+               \r
+               tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, xReturn );\r
+\r
+               return xReturn;\r
+       }\r
+\r
+#endif /* INCLUDE_xTimerPendFunctionCall */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( INCLUDE_xTimerPendFunctionCall == 1 )\r
+\r
+       BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait )\r
+       {\r
+       DaemonTaskMessage_t xMessage;\r
+       BaseType_t xReturn;\r
+\r
+               /* Complete the message with the function parameters and post it to the\r
+               daemon task. */\r
+               xMessage.xMessageID = tmrCOMMAND_EXECUTE_CALLBACK;\r
+               xMessage.u.xCallbackParameters.pxCallbackFunction = xFunctionToPend;\r
+               xMessage.u.xCallbackParameters.pvParameter1 = pvParameter1;\r
+               xMessage.u.xCallbackParameters.ulParameter2 = ulParameter2;\r
+\r
+               xReturn = xQueueSendToBack( xTimerQueue, &xMessage, xTicksToWait );\r
 \r
+               tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, xReturn );\r
+               \r
                return xReturn;\r
        }\r
 \r
-#endif /* INCLUDE_xTimerPendFunctionCallFromISR */\r
+#endif /* INCLUDE_xTimerPendFunctionCall */\r
 /*-----------------------------------------------------------*/\r
 \r
 /* This entire source file will be skipped if the application is not configured\r