]> git.sur5r.net Git - freertos/commitdiff
Add some assertion points to timers.c.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 22 Feb 2011 20:43:17 +0000 (20:43 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 22 Feb 2011 20:43:17 +0000 (20:43 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1305 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/timers.c

index 88959ed1bfd5741f6ef68bd621c547ed04c95d22..5b29f55848ca7bc1e51b314257c6a23c02df19bd 100644 (file)
@@ -149,7 +149,7 @@ static portTickType prvSampleTimeNow( portBASE_TYPE *pxTimerListsWereSwitched )
  * timer list does not contain any timers then return 0 and set *pxListWasEmpty\r
  * to pdTRUE.\r
  */\r
-static portTickType prvLookForExpiredTimer( portBASE_TYPE *pxListWasEmpty ) PRIVILEGED_FUNCTION;\r
+static portTickType prvGetNextExpireTime( portBASE_TYPE *pxListWasEmpty ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * If a timer has expired, process it.  Otherwise, block the timer service task\r
@@ -251,6 +251,7 @@ xTIMER_MESSAGE xMessage;
 static void prvProcessExpiredTimer( portTickType xNextExpireTime, portTickType xTimeNow )\r
 {\r
 xTIMER *pxTimer;\r
+portBASE_TYPE xResult;\r
 \r
        /* Remove the timer from the list of active timers.  A check has already\r
        been performed to ensure the list is not empty. */\r
@@ -271,7 +272,9 @@ xTIMER *pxTimer;
                {\r
                        /* The timer expired before it was added to the active timer\r
                        list.  Reload it now.  */\r
-                       xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY );\r
+                       xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY );\r
+                       configASSERT( xResult );\r
+                       ( void ) xResult;\r
                }\r
        }\r
 \r
@@ -292,7 +295,7 @@ portBASE_TYPE xListWasEmpty;
        {\r
                /* Query the timers list to see if it contains any timers, and if so,\r
                obtain the time at which the next timer will expire. */\r
-               xNextExpireTime = prvLookForExpiredTimer( &xListWasEmpty );\r
+               xNextExpireTime = prvGetNextExpireTime( &xListWasEmpty );\r
 \r
                /* If a timer has expired, process it.  Otherwise, block this task\r
                until either a timer does expire, or a command is received. */\r
@@ -322,6 +325,7 @@ portBASE_TYPE xTimerListsWereSwitched;
                        /* The tick count has not overflowed, has the timer expired? */\r
                        if( ( xListWasEmpty == pdFALSE ) && ( xNextExpireTime <= xTimeNow ) )\r
                        {\r
+                               xTaskResumeAll();\r
                                prvProcessExpiredTimer( xNextExpireTime, xTimeNow );\r
                        }\r
                        else\r
@@ -333,21 +337,26 @@ portBASE_TYPE xTimerListsWereSwitched;
                                be reached unless xNextExpireTime > xTimeNow, except in the\r
                                case when the current timer list is empty. */\r
                                vQueueWaitForMessageRestricted( xTimerQueue, ( xNextExpireTime - xTimeNow ) );\r
+\r
+                               if( xTaskResumeAll() == pdFALSE )\r
+                               {\r
+                                       /* Yield to wait for either a command to arrive, or the block time\r
+                                       to expire.  If a command arrived between the critical section being\r
+                                       exited and this yield then the yield will not cause the task\r
+                                       to block. */\r
+                                       portYIELD_WITHIN_API();\r
+                               }\r
                        }\r
                }\r
-       }\r
-       if( xTaskResumeAll() == pdFALSE )\r
-       {\r
-               /* Yield to wait for either a command to arrive, or the block time\r
-               to expire.  If a command arrived between the critical section being\r
-               exited and this yield then the yield will not cause the task\r
-               to block. */\r
-               portYIELD_WITHIN_API();\r
+               else\r
+               {\r
+                       xTaskResumeAll();\r
+               }\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static portTickType prvLookForExpiredTimer( portBASE_TYPE *pxListWasEmpty )\r
+static portTickType prvGetNextExpireTime( portBASE_TYPE *pxListWasEmpty )\r
 {\r
 portTickType xNextExpireTime;\r
 \r
@@ -441,7 +450,7 @@ static void prvProcessReceivedCommands( void )
 {\r
 xTIMER_MESSAGE xMessage;\r
 xTIMER *pxTimer;\r
-portBASE_TYPE xTimerListsWereSwitched;\r
+portBASE_TYPE xTimerListsWereSwitched, xResult;\r
 portTickType xTimeNow;\r
 \r
        /* In this case the xTimerListsWereSwitched parameter is not used, but it\r
@@ -476,7 +485,9 @@ portTickType xTimeNow;
 \r
                                        if( pxTimer->uxAutoReload == pdTRUE )\r
                                        {\r
-                                               xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xMessage.xMessageValue + pxTimer->xTimerPeriodInTicks, NULL, tmrNO_DELAY );\r
+                                               xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xMessage.xMessageValue + pxTimer->xTimerPeriodInTicks, NULL, tmrNO_DELAY );\r
+                                               configASSERT( xResult );\r
+                                               ( void ) xResult;\r
                                        }\r
                                }\r
                                break;\r
@@ -511,6 +522,7 @@ static void prvSwitchTimerLists( portTickType xLastTime )
 portTickType xNextExpireTime;\r
 xList *pxTemp;\r
 xTIMER *pxTimer;\r
+portBASE_TYPE xResult;\r
 \r
        /* Remove compiler warnings if configASSERT() is not defined. */\r
        ( void ) xLastTime;\r
@@ -534,7 +546,9 @@ xTIMER *pxTimer;
                pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer );\r
                if( pxTimer->uxAutoReload == pdTRUE )\r
                {\r
-                       xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY );\r
+                       xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY );\r
+                       configASSERT( xResult );\r
+                       ( void ) xResult;\r
                }\r
        }\r
 \r