+ Moved the History.txt file from the website git repo into the source code SVN repo.

+ Added xTaskCatchUpTicks() which corrects the tick count value after the application code has held interrupts disabled for an extended period.
+ Updated the xTaskResumeAll() implementation so it uses the new xTaskCatchUpTicks() function mentioned above to unwind ticks that were pended while the scheduler was suspended.
+ Various maintenance on the message buffer, stream buffer and abort delay demos.
+ Change type of uxPendedTicks from UBaseType_t to TickType_t to ensure it has same type as variables it is compared to, and therefore also rename the variable xPendingTicks.
+ Correct spelling mistake within a comment that was common to all the ARMv7-M ports.
This commit is contained in:
Richard Barry 2019-08-25 19:35:59 +00:00
parent 72af51cd86
commit 7d285f3dcb
20 changed files with 2835 additions and 59 deletions

View file

@ -430,7 +430,7 @@ static void prvTestAbortingStreamBufferReceive( void )
{
TickType_t xTimeAtStart;
StreamBufferHandle_t xStreamBuffer;
EventBits_t xReturn;
size_t xReturn;
const size_t xTriggerLevelBytes = ( size_t ) 1;
uint8_t uxRxData;

View file

@ -57,7 +57,7 @@ priority tasks, and from high to low priority tasks. */
#define mbHIGHER_PRIORITY ( tskIDLE_PRIORITY + 1 )
/* Block times used when sending and receiving from the message buffers. */
#define mbRX_TX_BLOCK_TIME pdMS_TO_TICKS( 125UL )
#define mbRX_TX_BLOCK_TIME pdMS_TO_TICKS( 175UL )
/* A block time of 0 means "don't block". */
#define mbDONT_BLOCK ( 0 )
@ -245,8 +245,8 @@ UBaseType_t uxOriginalPriority;
xReturned = xMessageBufferSend( xMessageBuffer, ( void * ) pucData, sizeof( pucData[ 0 ] ), xBlockTime );
xTimeAfterCall = xTaskGetTickCount();
vTaskPrioritySet( NULL, uxOriginalPriority );
configASSERT( ( xTimeAfterCall - xTimeBeforeCall ) >= xBlockTime );
configASSERT( ( xTimeAfterCall - xTimeBeforeCall ) < ( xBlockTime + xAllowableMargin ) );
configASSERT( ( ( TickType_t ) ( xTimeAfterCall - xTimeBeforeCall ) ) >= xBlockTime );
configASSERT( ( ( TickType_t ) ( xTimeAfterCall - xTimeBeforeCall ) ) < ( xBlockTime + xAllowableMargin ) );
configASSERT( xReturned == 0 );
( void ) xReturned; /* In case configASSERT() is not defined. */
( void ) xTimeBeforeCall;
@ -758,7 +758,7 @@ const TickType_t xTicksToBlock = pdMS_TO_TICKS( 250UL );
/* Don't expect to receive anything yet! */
xTimeOnEntering = xTaskGetTickCount();
xReceivedLength = xMessageBufferReceive( xMessageBuffers.xEchoClientBuffer, ( void * ) pcReceivedString, mbMESSAGE_BUFFER_LENGTH_BYTES, xTicksToBlock );
configASSERT( ( xTaskGetTickCount() - xTimeOnEntering ) >= xTicksToBlock );
configASSERT( ( ( TickType_t ) ( xTaskGetTickCount() - xTimeOnEntering ) ) >= xTicksToBlock );
configASSERT( xReceivedLength == 0 );
( void ) xTimeOnEntering; /* In case configASSERT() is not defined. */

View file

@ -283,8 +283,8 @@ UBaseType_t uxOriginalPriority;
xReturned = xStreamBufferSend( xStreamBuffer, ( void * ) pucData, sizeof( pucData[ 0 ] ), xBlockTime );
xTimeAfterCall = xTaskGetTickCount();
vTaskPrioritySet( NULL, uxOriginalPriority );
prvCheckExpectedState( ( xTimeAfterCall - xTimeBeforeCall ) >= xBlockTime );
prvCheckExpectedState( ( xTimeAfterCall - xTimeBeforeCall ) < ( xBlockTime + xAllowableMargin ) );
prvCheckExpectedState( ( ( TickType_t ) ( xTimeAfterCall - xTimeBeforeCall ) ) >= xBlockTime );
prvCheckExpectedState( ( ( TickType_t ) ( xTimeAfterCall - xTimeBeforeCall ) ) < ( xBlockTime + xAllowableMargin ) );
prvCheckExpectedState( xReturned == 0 );
/* The buffer is now full of data in the form "000000", "111111", etc. Make
@ -331,8 +331,8 @@ UBaseType_t uxOriginalPriority;
xReturned = xStreamBufferReceive( xStreamBuffer, ( void * ) pucReadData, x6ByteLength, xBlockTime );
xTimeAfterCall = xTaskGetTickCount();
vTaskPrioritySet( NULL, uxOriginalPriority );
prvCheckExpectedState( ( xTimeAfterCall - xTimeBeforeCall ) >= xBlockTime );
prvCheckExpectedState( ( xTimeAfterCall - xTimeBeforeCall ) < ( xBlockTime + xAllowableMargin ) );
prvCheckExpectedState( ( ( TickType_t ) ( xTimeAfterCall - xTimeBeforeCall ) ) >= xBlockTime );
prvCheckExpectedState( ( ( TickType_t ) ( xTimeAfterCall - xTimeBeforeCall ) ) < ( xBlockTime + xAllowableMargin ) );
prvCheckExpectedState( xReturned == 0 );
@ -847,7 +847,7 @@ const TickType_t xTicksToBlock = pdMS_TO_TICKS( 350UL );
/* Don't expect to receive anything yet! */
xTimeOnEntering = xTaskGetTickCount();
xReceivedLength = xStreamBufferReceive( xStreamBuffers.xEchoClientBuffer, ( void * ) pcReceivedString, sbSTREAM_BUFFER_LENGTH_BYTES, xTicksToBlock );
prvCheckExpectedState( ( xTaskGetTickCount() - xTimeOnEntering ) >= xTicksToBlock );
prvCheckExpectedState( ( ( TickType_t ) ( xTaskGetTickCount() - xTimeOnEntering ) ) >= xTicksToBlock );
prvCheckExpectedState( xReceivedLength == 0 );
/* Now the stream buffers have been created the echo client task can be
@ -933,6 +933,7 @@ BaseType_t xErrorDetected = pdFALSE;
{
/* Create the stream buffer that will be used from inside the tick
interrupt. */
memset( ucRxData, 0x00, sizeof( ucRxData ) );
xStreamBuffer = xStreamBufferCreate( xStreamBufferSizeBytes, xTriggerLevel );
configASSERT( xStreamBuffer );
@ -958,21 +959,34 @@ BaseType_t xErrorDetected = pdFALSE;
/* Now check the number of bytes received equals the trigger level,
except in the case that the read timed out before the trigger level
was reached. */
if( xBytesReceived < xTriggerLevel )
if( xTriggerLevel > xReadBlockTime )
{
/* This should only happen if the trigger level was greater than
the block time. */
if( xTriggerLevel < xReadBlockTime )
/* Trigger level was greater than the block time so expect to
time out having received xReadBlockTime bytes. */
if( ( xReadBlockTime - xBytesReceived ) > xAllowableMargin )
{
xErrorDetected = pdTRUE;
}
}
else if( ( xBytesReceived - xTriggerLevel ) > xAllowableMargin )
else if( xTriggerLevel < xReadBlockTime )
{
/* A margin may be required here if there are other high priority
tasks prevent the task that reads from the message buffer running
immediately. */
xErrorDetected = pdTRUE;
/* Trigger level was less than the block time so we expect to
have received the trigger level number of bytes. */
if( ( xTriggerLevel - xBytesReceived ) > xAllowableMargin )
{
xErrorDetected = pdTRUE;
}
}
else
{
/* The trigger level equaled the block time, so expect to
receive no greater than the block time, but one or two less is
ok due to variations in how far through the time slice the
functions get executed. */
if( xBytesReceived > xReadBlockTime )
{
xErrorDetected = pdTRUE;
}
}
if( xBytesReceived > sizeof( ucRxData ) )