#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
* 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
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
\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
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
+\r
+ /* Enforces ordering for ports and optimised compilers that may otherwise place\r
+ the above increment elsewhere. */\r
portMEMORY_BARRIER();\r
}\r
/*----------------------------------------------------------*/\r