]> git.sur5r.net Git - freertos/commitdiff
Introduce the portSOFTWARE_BARRIER macro which thus far is only used by the Win32...
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 23 Jan 2020 23:49:24 +0000 (23:49 +0000)
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 23 Jan 2020 23:49:24 +0000 (23:49 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2808 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Source/include/FreeRTOS.h
FreeRTOS/Source/portable/MSVC-MingW/port.c
FreeRTOS/Source/portable/MSVC-MingW/portmacro.h
FreeRTOS/Source/tasks.c

index 28668de14c57de6391e38cfdef45cdee4bd1b4d8..c2ebf24c33d88b4a3d80419508e3beab51b51843 100644 (file)
@@ -257,6 +257,10 @@ hold explicit before calling the code. */
        #define portMEMORY_BARRIER()\r
 #endif\r
 \r
        #define portMEMORY_BARRIER()\r
 #endif\r
 \r
+#ifndef portSOFTWARE_BARRIER\r
+       #define portSOFTWARE_BARRIER()\r
+#endif\r
+\r
 /* The timers module relies on xTaskGetSchedulerState(). */\r
 #if configUSE_TIMERS == 1\r
 \r
 /* The timers module relies on xTaskGetSchedulerState(). */\r
 #if configUSE_TIMERS == 1\r
 \r
index 396633123a66716ddb9e4d86512b650f2ceafb2b..3c685b925ba6849ace36b70a015bc5456dae4ac7 100644 (file)
@@ -75,7 +75,7 @@ static uint32_t prvProcessTickInterrupt( void );
  * attempt to obtain pvInterruptEventMutex if a critical section is used inside\r
  * an interrupt handler itself.\r
  */\r
  * attempt to obtain pvInterruptEventMutex if a critical section is used inside\r
  * an interrupt handler itself.\r
  */\r
-static volatile BaseType_t xInsideInterrupt = pdFALSE;\r
+volatile BaseType_t xInsideInterrupt = pdFALSE;\r
 \r
 /*\r
  * Called when the process exits to let Windows know the high timer resolution\r
 \r
 /*\r
  * Called when the process exits to let Windows know the high timer resolution\r
@@ -394,7 +394,7 @@ CONTEXT xContext;
                xInsideInterrupt = pdFALSE;\r
                WaitForMultipleObjects( sizeof( pvObjectList ) / sizeof( void * ), pvObjectList, TRUE, INFINITE );\r
 \r
                xInsideInterrupt = pdFALSE;\r
                WaitForMultipleObjects( sizeof( pvObjectList ) / sizeof( void * ), pvObjectList, TRUE, INFINITE );\r
 \r
-               /* /* Cannot be in a critical section to get here.  Tasks that exist a\r
+               /* Cannot be in a critical section to get here.  Tasks that exist a\r
                critical section will block on a yield mutex to wait for an interrupt to\r
                process if an interrupt was set pending while the task was inside the\r
                critical section.  xInsideInterrupt prevents interrupts that contain\r
                critical section will block on a yield mutex to wait for an interrupt to\r
                process if an interrupt was set pending while the task was inside the\r
                critical section.  xInsideInterrupt prevents interrupts that contain\r
index 5f54128106e27a67759b1e6a02a12bfcd576cd9d..51b96f2fcc250f2d45adb330ab13049cf74987e4 100644 (file)
@@ -74,6 +74,11 @@ typedef unsigned long UBaseType_t;
 \r
 #define portYIELD()                                    vPortGenerateSimulatedInterrupt( portINTERRUPT_YIELD )\r
 \r
 \r
 #define portYIELD()                                    vPortGenerateSimulatedInterrupt( portINTERRUPT_YIELD )\r
 \r
+\r
+extern volatile BaseType_t xInsideInterrupt;\r
+#define portSOFTWARE_BARRIER() while( xInsideInterrupt != pdFALSE )\r
+\r
+\r
 /* Simulated interrupts return pdFALSE if no context switch should be performed,\r
 or a non-zero number if a context switch should be performed. */\r
 #define portYIELD_FROM_ISR( x ) ( void ) x\r
 /* Simulated interrupts return pdFALSE if no context switch should be performed,\r
 or a non-zero number if a context switch should be performed. */\r
 #define portYIELD_FROM_ISR( x ) ( void ) x\r
index 5129bf981a6a4f9c4cc8d13a81e180118ef8d8c3..20044337e4675c68afa5835d6e555678b69593f1 100644 (file)
@@ -2113,7 +2113,17 @@ void vTaskSuspendAll( void )
        BaseType_t.  Please read Richard Barry's reply in the following link to a\r
        post in the FreeRTOS support forum before reporting this as a bug! -\r
        http://goo.gl/wu4acr */\r
        BaseType_t.  Please read Richard Barry's reply in the following link to a\r
        post in the FreeRTOS support forum before reporting this as a bug! -\r
        http://goo.gl/wu4acr */\r
+\r
+       /* portSOFRWARE_BARRIER() is only implemented for emulated/simulated ports that\r
+       do not otherwise exhibit real time behaviour. */\r
+       portSOFTWARE_BARRIER();\r
+\r
+       /* The scheduler is suspended if uxSchedulerSuspended is non-zero.  An increment\r
+       is used to allow calls to vTaskSuspendAll() to nest. */\r
        ++uxSchedulerSuspended;\r
        ++uxSchedulerSuspended;\r
+\r
+       /* Enforces ordering for ports and optimised compilers that may otherwise place\r
+       the above increment elsewhere. */\r
        portMEMORY_BARRIER();\r
 }\r
 /*----------------------------------------------------------*/\r
        portMEMORY_BARRIER();\r
 }\r
 /*----------------------------------------------------------*/\r