]> git.sur5r.net Git - freertos/commitdiff
Continue testing timers module. Still a work in progress.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 21 Feb 2011 09:38:33 +0000 (09:38 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 21 Feb 2011 09:38:33 +0000 (09:38 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1303 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/timers.c

index 8593c723b27f31d50311b7eb5a58ca71a303fccb..ed710bd2665d119e4e50eee7c7bc1ed696d5e117 100644 (file)
@@ -243,8 +243,7 @@ xTIMER_MESSAGE xMessage;
                        xReturn = xQueueSendToBackFromISR( xTimerQueue, &xMessage, pxHigherPriorityTaskWoken );\r
                }\r
        }\r
-\r
-       configASSERT( xReturn );\r
+       \r
        return xReturn;\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -268,7 +267,16 @@ xTIMER *pxTimer;
                the time this task thinks it is now, even if a command to\r
                switch lists due to a tick count overflow is already waiting in\r
                the timer queue. */\r
-               prvInsertTimerInActiveList( pxTimer, ( xNextExpireTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xNextExpireTime );\r
+               if( prvInsertTimerInActiveList( pxTimer, ( xNextExpireTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xNextExpireTime ) == pdTRUE )\r
+               {\r
+                       /* The timer expired before it was added to the active timer\r
+                       list.  Reload it now.  The callback will get executed before\r
+                       this function exits. */\r
+                       if( pxTimer->uxAutoReload == pdTRUE )\r
+                       {\r
+                               xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY ); /* Should it be xNextExpireTime or ( xNextExpireTime + pxTimer->xTimerPeriodInTicks )?  I think the former. */\r
+                       }\r
+               }\r
        }\r
 \r
        /* Call the timer callback. */\r
@@ -403,7 +411,7 @@ portBASE_TYPE xProcessTimerNow = pdFALSE;
        {\r
                /* Has the expiry time elapsed between the command to start/reset a\r
                timer was issued, and the time the command was processed? */\r
-               if( ( xTimeNow - xCommandTime ) >= pxTimer->xTimerPeriodInTicks )\r
+               if( ( ( portTickType ) ( xTimeNow - xCommandTime ) ) >= pxTimer->xTimerPeriodInTicks )\r
                {\r
                        /* The time between a command being issued and the command being\r
                        processed actually exceeds the timers period.  */\r
@@ -468,7 +476,6 @@ portTickType xTimeNow;
                                {\r
                                        /* The timer expired before it was added to the active timer\r
                                        list.  Process it now. */\r
-                                       /* Call the timer callback. */\r
                                        pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer );\r
 \r
                                        if( pxTimer->uxAutoReload == pdTRUE )\r