]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/portable/IAR/ARM_CM3/port.c
Added INCLUDE_xSemaphoreGetMutexHolder() default.
[freertos] / FreeRTOS / Source / portable / IAR / ARM_CM3 / port.c
index c501e72594bbe98c44b8a28ad99bbf4838164d46..c538e6dc7c2b0397a0b5d3970b77bd69f92abdb1 100644 (file)
@@ -265,6 +265,7 @@ void xPortSysTickHandler( void )
        __weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )\r
        {\r
        unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;\r
+       portTickType xModifiableIdleTime;\r
 \r
                /* Make sure the SysTick reload value does not overflow the counter. */\r
                if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )\r
@@ -310,9 +311,14 @@ void xPortSysTickHandler( void )
                        /* Restart SysTick. */\r
                        portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;\r
 \r
-                       /* Sleep until something happens. */\r
-                       configPRE_SLEEP_PROCESSING( xExpectedIdleTime );\r
-                       if( xExpectedIdleTime > 0 )\r
+                       /* Sleep until something happens.  configPRE_SLEEP_PROCESSING() can\r
+                       set its parameter to 0 to indicate that its implementation contains\r
+                       its own wait for interrupt or wait for event instruction, and so wfi\r
+                       should not be executed again.  However, the original expected idle\r
+                       time variable must remain unmodified, so a copy is taken. */\r
+                       xModifiableIdleTime = xExpectedIdleTime;\r
+                       configPRE_SLEEP_PROCESSING( xModifiableIdleTime );\r
+                       if( xModifiableIdleTime > 0 )\r
                        {\r
                                __WFI();\r
                        }\r
@@ -373,7 +379,7 @@ void xPortSysTickHandler( void )
  */\r
 __weak void vPortSetupTimerInterrupt( void )\r
 {\r
-       /* Calculate the constants required to configure the tick interrupt. */         \r
+       /* Calculate the constants required to configure the tick interrupt. */\r
        #if configUSE_TICKLESS_IDLE == 1\r
        {\r
                ulTimerReloadValueForOneTick = ( configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL;\r