]> git.sur5r.net Git - freertos/commitdiff
Ensure a yield cannot be pended simultaneously with a critical section being entered.
authorRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 14 Aug 2008 11:04:54 +0000 (11:04 +0000)
committerRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 14 Aug 2008 11:04:54 +0000 (11:04 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@452 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/portable/GCC/ColdFire_V2/port.c

index d55e256301a6dcc8aa09891396c85e7de38bfeb1..986e85c4f5288c13706180db45156241bed34667 100644 (file)
@@ -143,7 +143,20 @@ void vPortEndScheduler( void )
 \r
 void vPortEnterCritical( void )\r
 {\r
-       portDISABLE_INTERRUPTS();\r
+       if( ulCriticalNesting == 0UL )\r
+       {\r
+               do\r
+               {\r
+                       portDISABLE_INTERRUPTS();\r
+                       if( MCF_INTC0_INTFRCH == 0UL )\r
+                       {\r
+                               break;\r
+                       }\r
+\r
+                       portENABLE_INTERRUPTS();\r
+\r
+               } while( 1 );\r
+       }\r
        ulCriticalNesting++;\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -162,10 +175,10 @@ void vPortYieldHandler( void )
 {\r
 unsigned portLONG ulSavedInterruptMask;\r
 \r
-       /* -32 as we are using the high word of the 64bit mask. */\r
-       MCF_INTC0_INTFRCH &= ~( 1UL << ( configYIELD_INTERRUPT_VECTOR - 32UL ) );\r
-\r
        ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR();\r
+               /* -32 as we are using the high word of the 64bit mask. */\r
+               /* Note this will clear all forced interrupts - this is done for speed. */\r
+               MCF_INTC0_INTFRCH = 0;\r
                vTaskSwitchContext();\r
        portCLEAR_INTERRUPT_MASK_FROM_ISR( ulSavedInterruptMask );\r
 }\r