#define bktQUEUE_LENGTH ( 5 )\r
#define bktSHORT_WAIT ( ( ( portTickType ) 20 ) / portTICK_RATE_MS )\r
#define bktPRIMARY_BLOCK_TIME ( 10 )\r
-#define bktALLOWABLE_MARGIN ( 12 )\r
+#define bktALLOWABLE_MARGIN ( 15 )\r
#define bktTIME_TO_BLOCK ( 175 )\r
#define bktDONT_BLOCK ( ( portTickType ) 0 )\r
#define bktRUN_INDICATOR ( ( unsigned portBASE_TYPE ) 0x55 )\r
time. When we wake, ensure the delta in time is as expected. */\r
xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;\r
\r
- /* A critical section is used to minimise the jitter in the time\r
- measurements. */\r
- portENTER_CRITICAL();\r
+ xTimeWhenBlocking = xTaskGetTickCount();\r
+ \r
+ /* We should unblock after xTimeToBlock having not received\r
+ anything on the queue. */\r
+ if( xQueueReceive( xTestQueue, &xData, xTimeToBlock ) != errQUEUE_EMPTY )\r
{\r
- xTimeWhenBlocking = xTaskGetTickCount();\r
- \r
- /* We should unblock after xTimeToBlock having not received\r
- anything on the queue. */\r
- if( xQueueReceive( xTestQueue, &xData, xTimeToBlock ) != errQUEUE_EMPTY )\r
- {\r
- xErrorOccurred = pdTRUE;\r
- }\r
-\r
- /* How long were we blocked for? */\r
- xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;\r
+ xErrorOccurred = pdTRUE;\r
}\r
- portEXIT_CRITICAL();\r
+\r
+ /* How long were we blocked for? */\r
+ xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;\r
\r
if( xBlockedTime < xTimeToBlock )\r
{\r
time. When we wake, ensure the delta in time is as expected. */\r
xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;\r
\r
- portENTER_CRITICAL();\r
+ xTimeWhenBlocking = xTaskGetTickCount();\r
+ \r
+ /* We should unblock after xTimeToBlock having not received\r
+ anything on the queue. */\r
+ if( xQueueSend( xTestQueue, &xItem, xTimeToBlock ) != errQUEUE_FULL )\r
{\r
- xTimeWhenBlocking = xTaskGetTickCount();\r
- \r
- /* We should unblock after xTimeToBlock having not received\r
- anything on the queue. */\r
- if( xQueueSend( xTestQueue, &xItem, xTimeToBlock ) != errQUEUE_FULL )\r
- {\r
- xErrorOccurred = pdTRUE;\r
- }\r
-\r
- /* How long were we blocked for? */\r
- xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;\r
+ xErrorOccurred = pdTRUE;\r
}\r
- portEXIT_CRITICAL();\r
+\r
+ /* How long were we blocked for? */\r
+ xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;\r
\r
if( xBlockedTime < xTimeToBlock )\r
{\r
The first thing we do is attempt to read from the queue. It should be\r
full so we block. Note the time before we block so we can check the\r
wake time is as per that expected. */\r
- portENTER_CRITICAL();\r
+ xTimeWhenBlocking = xTaskGetTickCount();\r
+ \r
+ /* We should unblock after bktTIME_TO_BLOCK having not received\r
+ anything on the queue. */\r
+ xData = 0;\r
+ xRunIndicator = bktRUN_INDICATOR;\r
+ if( xQueueSend( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_FULL )\r
{\r
- xTimeWhenBlocking = xTaskGetTickCount();\r
- \r
- /* We should unblock after bktTIME_TO_BLOCK having not received\r
- anything on the queue. */\r
- xData = 0;\r
- xRunIndicator = bktRUN_INDICATOR;\r
- if( xQueueSend( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_FULL )\r
- {\r
- xErrorOccurred = pdTRUE;\r
- }\r
-\r
- /* How long were we inside the send function? */\r
- xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;\r
+ xErrorOccurred = pdTRUE;\r
}\r
- portEXIT_CRITICAL();\r
+\r
+ /* How long were we inside the send function? */\r
+ xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;\r
\r
/* We should not have blocked for less time than bktTIME_TO_BLOCK. */\r
if( xBlockedTime < bktTIME_TO_BLOCK )\r
Test 4\r
\r
As per test three, but with the send and receive reversed. */\r
- portENTER_CRITICAL();\r
+ xTimeWhenBlocking = xTaskGetTickCount();\r
+ \r
+ /* We should unblock after bktTIME_TO_BLOCK having not received\r
+ anything on the queue. */\r
+ xRunIndicator = bktRUN_INDICATOR;\r
+ if( xQueueReceive( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_EMPTY )\r
{\r
- xTimeWhenBlocking = xTaskGetTickCount();\r
- \r
- /* We should unblock after bktTIME_TO_BLOCK having not received\r
- anything on the queue. */\r
- xRunIndicator = bktRUN_INDICATOR;\r
- if( xQueueReceive( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_EMPTY )\r
- {\r
- xErrorOccurred = pdTRUE;\r
- }\r
-\r
- xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;\r
+ xErrorOccurred = pdTRUE;\r
}\r
- portEXIT_CRITICAL();\r
+\r
+ xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;\r
\r
/* We should not have blocked for less time than bktTIME_TO_BLOCK. */\r
if( xBlockedTime < bktTIME_TO_BLOCK )\r