]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/portable/IAR/ARM_CM3/port.c
Update FreeRTOS version number to V7.5.3
[freertos] / FreeRTOS / Source / portable / IAR / ARM_CM3 / port.c
index 3ed02de16f265a2b43470254af73674353786b9b..23070ae2b44130ae7352e8347ddd048866e55489 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
-    FreeRTOS V7.5.2 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+    FreeRTOS V7.5.3 - Copyright (C) 2013 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
@@ -440,12 +441,24 @@ void xPortSysTickHandler( void )
 \r
                        if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 )\r
                        {\r
+                               unsigned long ulCalculatedLoadValue;\r
+                               \r
                                /* The tick interrupt has already executed, and the SysTick\r
                                count reloaded with ulReloadValue.  Reset the\r
                                portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick\r
                                period. */\r
-                               portNVIC_SYSTICK_LOAD_REG = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG );\r
-\r
+                               ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG );\r
+\r
+                               /* Don't allow a tiny value, or values that have somehow \r
+                               underflowed because the post sleep hook did something \r
+                               that took too long. */\r
+                               if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) )\r
+                               {\r
+                                       ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL );\r
+                               }\r
+                               \r
+                               portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue;\r
+                               \r
                                /* The tick interrupt handler will already have pended the tick\r
                                processing in the kernel.  As the pending tick will be\r
                                processed as soon as this function exits, the tick value\r