mirror of
				https://github.com/FreeRTOS/FreeRTOS-Kernel.git
				synced 2025-11-04 10:42:33 -05:00 
			
		
		
		
	Remove the critical sections as not all ports can yield from within critical sections.
This commit is contained in:
		
							parent
							
								
									2888b15b7e
								
							
						
					
					
						commit
						dd1ef6a777
					
				
					 1 changed files with 39 additions and 57 deletions
				
			
		| 
						 | 
					@ -69,7 +69,7 @@
 | 
				
			||||||
#define bktQUEUE_LENGTH				( 5 )
 | 
					#define bktQUEUE_LENGTH				( 5 )
 | 
				
			||||||
#define bktSHORT_WAIT				( ( ( portTickType ) 20 ) / portTICK_RATE_MS )
 | 
					#define bktSHORT_WAIT				( ( ( portTickType ) 20 ) / portTICK_RATE_MS )
 | 
				
			||||||
#define bktPRIMARY_BLOCK_TIME		( 10 )
 | 
					#define bktPRIMARY_BLOCK_TIME		( 10 )
 | 
				
			||||||
#define bktALLOWABLE_MARGIN			( 12 )
 | 
					#define bktALLOWABLE_MARGIN			( 15 )
 | 
				
			||||||
#define bktTIME_TO_BLOCK			( 175 )
 | 
					#define bktTIME_TO_BLOCK			( 175 )
 | 
				
			||||||
#define bktDONT_BLOCK				( ( portTickType ) 0 )
 | 
					#define bktDONT_BLOCK				( ( portTickType ) 0 )
 | 
				
			||||||
#define bktRUN_INDICATOR			( ( unsigned portBASE_TYPE ) 0x55 )
 | 
					#define bktRUN_INDICATOR			( ( unsigned portBASE_TYPE ) 0x55 )
 | 
				
			||||||
| 
						 | 
					@ -126,10 +126,6 @@ portTickType xTimeToBlock, xBlockedTime;
 | 
				
			||||||
			time.  When we wake, ensure the delta in time is as expected. */
 | 
								time.  When we wake, ensure the delta in time is as expected. */
 | 
				
			||||||
			xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;
 | 
								xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* A critical section is used to minimise the jitter in the time
 | 
					 | 
				
			||||||
			measurements. */
 | 
					 | 
				
			||||||
			portENTER_CRITICAL();
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			xTimeWhenBlocking = xTaskGetTickCount();
 | 
								xTimeWhenBlocking = xTaskGetTickCount();
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			/* We should unblock after xTimeToBlock having not received
 | 
								/* We should unblock after xTimeToBlock having not received
 | 
				
			||||||
| 
						 | 
					@ -141,8 +137,6 @@ portTickType xTimeToBlock, xBlockedTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* How long were we blocked for? */
 | 
								/* How long were we blocked for? */
 | 
				
			||||||
			xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
 | 
								xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			portEXIT_CRITICAL();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if( xBlockedTime < xTimeToBlock )
 | 
								if( xBlockedTime < xTimeToBlock )
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
| 
						 | 
					@ -183,8 +177,6 @@ portTickType xTimeToBlock, xBlockedTime;
 | 
				
			||||||
			time.  When we wake, ensure the delta in time is as expected. */
 | 
								time.  When we wake, ensure the delta in time is as expected. */
 | 
				
			||||||
			xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;
 | 
								xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			portENTER_CRITICAL();
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			xTimeWhenBlocking = xTaskGetTickCount();
 | 
								xTimeWhenBlocking = xTaskGetTickCount();
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			/* We should unblock after xTimeToBlock having not received
 | 
								/* We should unblock after xTimeToBlock having not received
 | 
				
			||||||
| 
						 | 
					@ -196,8 +188,6 @@ portTickType xTimeToBlock, xBlockedTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* How long were we blocked for? */
 | 
								/* How long were we blocked for? */
 | 
				
			||||||
			xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
 | 
								xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			portEXIT_CRITICAL();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if( xBlockedTime < xTimeToBlock )
 | 
								if( xBlockedTime < xTimeToBlock )
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
| 
						 | 
					@ -388,8 +378,6 @@ portBASE_TYPE xData;
 | 
				
			||||||
		The first thing we do is attempt to read from the queue.  It should be
 | 
							The first thing we do is attempt to read from the queue.  It should be
 | 
				
			||||||
		full so we block.  Note the time before we block so we can check the
 | 
							full so we block.  Note the time before we block so we can check the
 | 
				
			||||||
		wake time is as per that expected. */
 | 
							wake time is as per that expected. */
 | 
				
			||||||
		portENTER_CRITICAL();
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		xTimeWhenBlocking = xTaskGetTickCount();
 | 
							xTimeWhenBlocking = xTaskGetTickCount();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		/* We should unblock after bktTIME_TO_BLOCK having not received
 | 
							/* We should unblock after bktTIME_TO_BLOCK having not received
 | 
				
			||||||
| 
						 | 
					@ -403,8 +391,6 @@ portBASE_TYPE xData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* How long were we inside the send function? */
 | 
							/* How long were we inside the send function? */
 | 
				
			||||||
		xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
 | 
							xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		portEXIT_CRITICAL();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* We should not have blocked for less time than bktTIME_TO_BLOCK. */
 | 
							/* We should not have blocked for less time than bktTIME_TO_BLOCK. */
 | 
				
			||||||
		if( xBlockedTime < bktTIME_TO_BLOCK )
 | 
							if( xBlockedTime < bktTIME_TO_BLOCK )
 | 
				
			||||||
| 
						 | 
					@ -428,8 +414,6 @@ portBASE_TYPE xData;
 | 
				
			||||||
        Test 4
 | 
					        Test 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		As per test three, but with the send and receive reversed. */
 | 
							As per test three, but with the send and receive reversed. */
 | 
				
			||||||
		portENTER_CRITICAL();
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		xTimeWhenBlocking = xTaskGetTickCount();
 | 
							xTimeWhenBlocking = xTaskGetTickCount();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		/* We should unblock after bktTIME_TO_BLOCK having not received
 | 
							/* We should unblock after bktTIME_TO_BLOCK having not received
 | 
				
			||||||
| 
						 | 
					@ -441,8 +425,6 @@ portBASE_TYPE xData;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
 | 
							xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		portEXIT_CRITICAL();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* We should not have blocked for less time than bktTIME_TO_BLOCK. */
 | 
							/* We should not have blocked for less time than bktTIME_TO_BLOCK. */
 | 
				
			||||||
		if( xBlockedTime < bktTIME_TO_BLOCK )
 | 
							if( xBlockedTime < bktTIME_TO_BLOCK )
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue