FreeRTOS: update to v10.2.0
This commit is contained in:
parent
d0373af5c0
commit
bceb096e69
27 changed files with 1155 additions and 711 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS Kernel V10.0.1
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* FreeRTOS Kernel V10.2.0
|
||||
* Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
|
@ -43,11 +43,11 @@ task.h is included from an application file. */
|
|||
#error configUSE_TASK_NOTIFICATIONS must be set to 1 to build stream_buffer.c
|
||||
#endif
|
||||
|
||||
/* Lint e961 and e750 are suppressed as a MISRA exception justified because the
|
||||
MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined for the
|
||||
header files above, but not in this file, in order to generate the correct
|
||||
privileged Vs unprivileged linkage and placement. */
|
||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750. */
|
||||
/* Lint e961, e9021 and e750 are suppressed as a MISRA exception justified
|
||||
because the MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined
|
||||
for the header files above, but not in this file, in order to generate the
|
||||
correct privileged Vs unprivileged linkage and placement. */
|
||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750 !e9021. */
|
||||
|
||||
/* If the user has not provided application specific Rx notification macros,
|
||||
or #defined the notification macros away, them provide default implementations
|
||||
|
|
@ -138,7 +138,7 @@ that uses task notifications. */
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Structure that hold state information on the buffer. */
|
||||
typedef struct xSTREAM_BUFFER /*lint !e9058 Style convention uses tag. */
|
||||
typedef struct StreamBufferDef_t /*lint !e9058 Style convention uses tag. */
|
||||
{
|
||||
volatile size_t xTail; /* Index to the next item to read within the buffer. */
|
||||
volatile size_t xHead; /* Index to the next item to write within the buffer. */
|
||||
|
|
@ -210,7 +210,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
uint8_t * const pucBuffer,
|
||||
size_t xBufferSizeBytes,
|
||||
size_t xTriggerLevelBytes,
|
||||
BaseType_t xIsMessageBuffer ) PRIVILEGED_FUNCTION;
|
||||
uint8_t ucFlags ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
@ -219,19 +219,31 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
StreamBufferHandle_t xStreamBufferGenericCreate( size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer )
|
||||
{
|
||||
uint8_t *pucAllocatedMemory;
|
||||
uint8_t ucFlags;
|
||||
|
||||
/* In case the stream buffer is going to be used as a message buffer
|
||||
(that is, it will hold discrete messages with a little meta data that
|
||||
says how big the next message is) check the buffer will be large enough
|
||||
to hold at least one message. */
|
||||
configASSERT( xBufferSizeBytes > sbBYTES_TO_STORE_MESSAGE_LENGTH );
|
||||
if( xIsMessageBuffer == pdTRUE )
|
||||
{
|
||||
/* Is a message buffer but not statically allocated. */
|
||||
ucFlags = sbFLAGS_IS_MESSAGE_BUFFER;
|
||||
configASSERT( xBufferSizeBytes > sbBYTES_TO_STORE_MESSAGE_LENGTH );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Not a message buffer and not statically allocated. */
|
||||
ucFlags = 0;
|
||||
configASSERT( xBufferSizeBytes > 0 );
|
||||
}
|
||||
configASSERT( xTriggerLevelBytes <= xBufferSizeBytes );
|
||||
|
||||
/* A trigger level of 0 would cause a waiting task to unblock even when
|
||||
the buffer was empty. */
|
||||
if( xTriggerLevelBytes == ( size_t ) 0 )
|
||||
{
|
||||
xTriggerLevelBytes = ( size_t ) 1; /*lint !e9044 Parameter modified to ensure it doesn't have a dangerous value. */
|
||||
xTriggerLevelBytes = ( size_t ) 1;
|
||||
}
|
||||
|
||||
/* A stream buffer requires a StreamBuffer_t structure and a buffer.
|
||||
|
|
@ -251,7 +263,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
pucAllocatedMemory + sizeof( StreamBuffer_t ), /* Storage area follows. */ /*lint !e9016 Indexing past structure valid for uint8_t pointer, also storage area has no alignment requirement. */
|
||||
xBufferSizeBytes,
|
||||
xTriggerLevelBytes,
|
||||
xIsMessageBuffer );
|
||||
ucFlags );
|
||||
|
||||
traceSTREAM_BUFFER_CREATE( ( ( StreamBuffer_t * ) pucAllocatedMemory ), xIsMessageBuffer );
|
||||
}
|
||||
|
|
@ -260,7 +272,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer );
|
||||
}
|
||||
|
||||
return ( StreamBufferHandle_t * ) pucAllocatedMemory; /*lint !e9087 !e826 Safe cast as allocated memory is aligned. */
|
||||
return ( StreamBufferHandle_t ) pucAllocatedMemory; /*lint !e9087 !e826 Safe cast as allocated memory is aligned. */
|
||||
}
|
||||
|
||||
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
||||
|
|
@ -276,6 +288,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
{
|
||||
StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) pxStaticStreamBuffer; /*lint !e740 !e9087 Safe cast as StaticStreamBuffer_t is opaque Streambuffer_t. */
|
||||
StreamBufferHandle_t xReturn;
|
||||
uint8_t ucFlags;
|
||||
|
||||
configASSERT( pucStreamBufferStorageArea );
|
||||
configASSERT( pxStaticStreamBuffer );
|
||||
|
|
@ -285,7 +298,18 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
the buffer was empty. */
|
||||
if( xTriggerLevelBytes == ( size_t ) 0 )
|
||||
{
|
||||
xTriggerLevelBytes = ( size_t ) 1; /*lint !e9044 Function parameter deliberately modified to ensure it is in range. */
|
||||
xTriggerLevelBytes = ( size_t ) 1;
|
||||
}
|
||||
|
||||
if( xIsMessageBuffer != pdFALSE )
|
||||
{
|
||||
/* Statically allocated message buffer. */
|
||||
ucFlags = sbFLAGS_IS_MESSAGE_BUFFER | sbFLAGS_IS_STATICALLY_ALLOCATED;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Statically allocated stream buffer. */
|
||||
ucFlags = sbFLAGS_IS_STATICALLY_ALLOCATED;
|
||||
}
|
||||
|
||||
/* In case the stream buffer is going to be used as a message buffer
|
||||
|
|
@ -301,7 +325,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
message buffer structure. */
|
||||
volatile size_t xSize = sizeof( StaticStreamBuffer_t );
|
||||
configASSERT( xSize == sizeof( StreamBuffer_t ) );
|
||||
}
|
||||
} /*lint !e529 xSize is referenced is configASSERT() is defined. */
|
||||
#endif /* configASSERT_DEFINED */
|
||||
|
||||
if( ( pucStreamBufferStorageArea != NULL ) && ( pxStaticStreamBuffer != NULL ) )
|
||||
|
|
@ -310,7 +334,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
pucStreamBufferStorageArea,
|
||||
xBufferSizeBytes,
|
||||
xTriggerLevelBytes,
|
||||
xIsMessageBuffer );
|
||||
ucFlags );
|
||||
|
||||
/* Remember this was statically allocated in case it is ever deleted
|
||||
again. */
|
||||
|
|
@ -334,7 +358,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
|
||||
void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer )
|
||||
{
|
||||
StreamBuffer_t * pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
StreamBuffer_t * pxStreamBuffer = xStreamBuffer;
|
||||
|
||||
configASSERT( pxStreamBuffer );
|
||||
|
||||
|
|
@ -360,15 +384,15 @@ StreamBuffer_t * pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9
|
|||
{
|
||||
/* The structure and buffer were not allocated dynamically and cannot be
|
||||
freed - just scrub the structure so future use will assert. */
|
||||
memset( pxStreamBuffer, 0x00, sizeof( StreamBuffer_t ) );
|
||||
( void ) memset( pxStreamBuffer, 0x00, sizeof( StreamBuffer_t ) );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer )
|
||||
{
|
||||
StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
BaseType_t xReturn = pdFAIL, xIsMessageBuffer;
|
||||
StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
BaseType_t xReturn = pdFAIL;
|
||||
|
||||
#if( configUSE_TRACE_FACILITY == 1 )
|
||||
UBaseType_t uxStreamBufferNumber;
|
||||
|
|
@ -385,35 +409,30 @@ BaseType_t xReturn = pdFAIL, xIsMessageBuffer;
|
|||
#endif
|
||||
|
||||
/* Can only reset a message buffer if there are no tasks blocked on it. */
|
||||
if( pxStreamBuffer->xTaskWaitingToReceive == NULL )
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
if( pxStreamBuffer->xTaskWaitingToSend == NULL )
|
||||
if( pxStreamBuffer->xTaskWaitingToReceive == NULL )
|
||||
{
|
||||
if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) != ( uint8_t ) 0 )
|
||||
if( pxStreamBuffer->xTaskWaitingToSend == NULL )
|
||||
{
|
||||
xIsMessageBuffer = pdTRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
xIsMessageBuffer = pdFALSE;
|
||||
}
|
||||
prvInitialiseNewStreamBuffer( pxStreamBuffer,
|
||||
pxStreamBuffer->pucBuffer,
|
||||
pxStreamBuffer->xLength,
|
||||
pxStreamBuffer->xTriggerLevelBytes,
|
||||
pxStreamBuffer->ucFlags );
|
||||
xReturn = pdPASS;
|
||||
|
||||
prvInitialiseNewStreamBuffer( pxStreamBuffer,
|
||||
pxStreamBuffer->pucBuffer,
|
||||
pxStreamBuffer->xLength,
|
||||
pxStreamBuffer->xTriggerLevelBytes,
|
||||
xIsMessageBuffer );
|
||||
xReturn = pdPASS;
|
||||
#if( configUSE_TRACE_FACILITY == 1 )
|
||||
{
|
||||
pxStreamBuffer->uxStreamBufferNumber = uxStreamBufferNumber;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if( configUSE_TRACE_FACILITY == 1 )
|
||||
{
|
||||
pxStreamBuffer->uxStreamBufferNumber = uxStreamBufferNumber;
|
||||
traceSTREAM_BUFFER_RESET( xStreamBuffer );
|
||||
}
|
||||
#endif
|
||||
|
||||
traceSTREAM_BUFFER_RESET( xStreamBuffer );
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
|
@ -421,7 +440,7 @@ BaseType_t xReturn = pdFAIL, xIsMessageBuffer;
|
|||
|
||||
BaseType_t xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, size_t xTriggerLevel )
|
||||
{
|
||||
StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
BaseType_t xReturn;
|
||||
|
||||
configASSERT( pxStreamBuffer );
|
||||
|
|
@ -429,7 +448,7 @@ BaseType_t xReturn;
|
|||
/* It is not valid for the trigger level to be 0. */
|
||||
if( xTriggerLevel == ( size_t ) 0 )
|
||||
{
|
||||
xTriggerLevel = ( size_t ) 1; /*lint !e9044 Parameter modified to ensure it doesn't have a dangerous value. */
|
||||
xTriggerLevel = ( size_t ) 1;
|
||||
}
|
||||
|
||||
/* The trigger level is the number of bytes that must be in the stream
|
||||
|
|
@ -450,7 +469,7 @@ BaseType_t xReturn;
|
|||
|
||||
size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer )
|
||||
{
|
||||
const StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
size_t xSpace;
|
||||
|
||||
configASSERT( pxStreamBuffer );
|
||||
|
|
@ -474,7 +493,7 @@ size_t xSpace;
|
|||
|
||||
size_t xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer )
|
||||
{
|
||||
const StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
size_t xReturn;
|
||||
|
||||
configASSERT( pxStreamBuffer );
|
||||
|
|
@ -489,7 +508,7 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
|
|||
size_t xDataLengthBytes,
|
||||
TickType_t xTicksToWait )
|
||||
{
|
||||
StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
size_t xReturn, xSpace = 0;
|
||||
size_t xRequiredSpace = xDataLengthBytes;
|
||||
TimeOut_t xTimeOut;
|
||||
|
|
@ -593,7 +612,7 @@ size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer,
|
|||
size_t xDataLengthBytes,
|
||||
BaseType_t * const pxHigherPriorityTaskWoken )
|
||||
{
|
||||
StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
size_t xReturn, xSpace;
|
||||
size_t xRequiredSpace = xDataLengthBytes;
|
||||
|
||||
|
|
@ -660,7 +679,7 @@ static size_t prvWriteMessageToBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
stream of bytes rather than discrete messages. Write as many bytes as
|
||||
possible. */
|
||||
xShouldWrite = pdTRUE;
|
||||
xDataLengthBytes = configMIN( xDataLengthBytes, xSpace ); /*lint !e9044 Function parameter modified to ensure it is capped to available space. */
|
||||
xDataLengthBytes = configMIN( xDataLengthBytes, xSpace );
|
||||
}
|
||||
else if( xSpace >= xRequiredSpace )
|
||||
{
|
||||
|
|
@ -696,7 +715,7 @@ size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer,
|
|||
size_t xBufferLengthBytes,
|
||||
TickType_t xTicksToWait )
|
||||
{
|
||||
StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
size_t xReceivedLength = 0, xBytesAvailable, xBytesToStoreMessageLength;
|
||||
|
||||
configASSERT( pvRxData );
|
||||
|
|
@ -797,7 +816,7 @@ size_t xReceivedLength = 0, xBytesAvailable, xBytesToStoreMessageLength;
|
|||
|
||||
size_t xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer )
|
||||
{
|
||||
StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
size_t xReturn, xBytesAvailable, xOriginalTail;
|
||||
configMESSAGE_BUFFER_LENGTH_TYPE xTempReturn;
|
||||
|
||||
|
|
@ -844,7 +863,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer,
|
|||
size_t xBufferLengthBytes,
|
||||
BaseType_t * const pxHigherPriorityTaskWoken )
|
||||
{
|
||||
StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
size_t xReceivedLength = 0, xBytesAvailable, xBytesToStoreMessageLength;
|
||||
|
||||
configASSERT( pvRxData );
|
||||
|
|
@ -950,7 +969,7 @@ configMESSAGE_BUFFER_LENGTH_TYPE xTempNextMessageLength;
|
|||
|
||||
BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer )
|
||||
{
|
||||
const StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
BaseType_t xReturn;
|
||||
size_t xTail;
|
||||
|
||||
|
|
@ -975,7 +994,7 @@ BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer )
|
|||
{
|
||||
BaseType_t xReturn;
|
||||
size_t xBytesToStoreMessageLength;
|
||||
const StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
|
||||
configASSERT( pxStreamBuffer );
|
||||
|
||||
|
|
@ -1008,7 +1027,7 @@ const StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer
|
|||
|
||||
BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t *pxHigherPriorityTaskWoken )
|
||||
{
|
||||
StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
BaseType_t xReturn;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
|
||||
|
|
@ -1038,7 +1057,7 @@ UBaseType_t uxSavedInterruptStatus;
|
|||
|
||||
BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t *pxHigherPriorityTaskWoken )
|
||||
{
|
||||
StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */
|
||||
StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
BaseType_t xReturn;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
|
||||
|
|
@ -1081,7 +1100,7 @@ size_t xNextHead, xFirstLength;
|
|||
|
||||
/* Write as many bytes as can be written in the first write. */
|
||||
configASSERT( ( xNextHead + xFirstLength ) <= pxStreamBuffer->xLength );
|
||||
memcpy( ( void* ) ( &( pxStreamBuffer->pucBuffer[ xNextHead ] ) ), ( const void * ) pucData, xFirstLength ); /*lint !e9087 memcpy() requires void *. */
|
||||
( void ) memcpy( ( void* ) ( &( pxStreamBuffer->pucBuffer[ xNextHead ] ) ), ( const void * ) pucData, xFirstLength ); /*lint !e9087 memcpy() requires void *. */
|
||||
|
||||
/* If the number of bytes written was less than the number that could be
|
||||
written in the first write... */
|
||||
|
|
@ -1089,7 +1108,7 @@ size_t xNextHead, xFirstLength;
|
|||
{
|
||||
/* ...then write the remaining bytes to the start of the buffer. */
|
||||
configASSERT( ( xCount - xFirstLength ) <= pxStreamBuffer->xLength );
|
||||
memcpy( ( void * ) pxStreamBuffer->pucBuffer, ( const void * ) &( pucData[ xFirstLength ] ), xCount - xFirstLength ); /*lint !e9087 memcpy() requires void *. */
|
||||
( void ) memcpy( ( void * ) pxStreamBuffer->pucBuffer, ( const void * ) &( pucData[ xFirstLength ] ), xCount - xFirstLength ); /*lint !e9087 memcpy() requires void *. */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1132,7 +1151,7 @@ size_t xCount, xFirstLength, xNextTail;
|
|||
read. Asserts check bounds of read and write. */
|
||||
configASSERT( xFirstLength <= xMaxCount );
|
||||
configASSERT( ( xNextTail + xFirstLength ) <= pxStreamBuffer->xLength );
|
||||
memcpy( ( void * ) pucData, ( const void * ) &( pxStreamBuffer->pucBuffer[ xNextTail ] ), xFirstLength ); /*lint !e9087 memcpy() requires void *. */
|
||||
( void ) memcpy( ( void * ) pucData, ( const void * ) &( pxStreamBuffer->pucBuffer[ xNextTail ] ), xFirstLength ); /*lint !e9087 memcpy() requires void *. */
|
||||
|
||||
/* If the total number of wanted bytes is greater than the number
|
||||
that could be read in the first read... */
|
||||
|
|
@ -1140,7 +1159,7 @@ size_t xCount, xFirstLength, xNextTail;
|
|||
{
|
||||
/*...then read the remaining bytes from the start of the buffer. */
|
||||
configASSERT( xCount <= xMaxCount );
|
||||
memcpy( ( void * ) &( pucData[ xFirstLength ] ), ( void * ) ( pxStreamBuffer->pucBuffer ), xCount - xFirstLength ); /*lint !e9087 memcpy() requires void *. */
|
||||
( void ) memcpy( ( void * ) &( pucData[ xFirstLength ] ), ( void * ) ( pxStreamBuffer->pucBuffer ), xCount - xFirstLength ); /*lint !e9087 memcpy() requires void *. */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1191,7 +1210,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
uint8_t * const pucBuffer,
|
||||
size_t xBufferSizeBytes,
|
||||
size_t xTriggerLevelBytes,
|
||||
BaseType_t xIsMessageBuffer )
|
||||
uint8_t ucFlags )
|
||||
{
|
||||
/* Assert here is deliberately writing to the entire buffer to ensure it can
|
||||
be written to without generating exceptions, and is setting the buffer to a
|
||||
|
|
@ -1203,25 +1222,21 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
result in confusion as to what is actually being observed. */
|
||||
const BaseType_t xWriteValue = 0x55;
|
||||
configASSERT( memset( pucBuffer, ( int ) xWriteValue, xBufferSizeBytes ) == pucBuffer );
|
||||
}
|
||||
} /*lint !e529 !e438 xWriteValue is only used if configASSERT() is defined. */
|
||||
#endif
|
||||
|
||||
memset( ( void * ) pxStreamBuffer, 0x00, sizeof( StreamBuffer_t ) ); /*lint !e9087 memset() requires void *. */
|
||||
( void ) memset( ( void * ) pxStreamBuffer, 0x00, sizeof( StreamBuffer_t ) ); /*lint !e9087 memset() requires void *. */
|
||||
pxStreamBuffer->pucBuffer = pucBuffer;
|
||||
pxStreamBuffer->xLength = xBufferSizeBytes;
|
||||
pxStreamBuffer->xTriggerLevelBytes = xTriggerLevelBytes;
|
||||
|
||||
if( xIsMessageBuffer != pdFALSE )
|
||||
{
|
||||
pxStreamBuffer->ucFlags |= sbFLAGS_IS_MESSAGE_BUFFER;
|
||||
}
|
||||
pxStreamBuffer->ucFlags = ucFlags;
|
||||
}
|
||||
|
||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
|
||||
UBaseType_t uxStreamBufferGetStreamBufferNumber( StreamBufferHandle_t xStreamBuffer )
|
||||
{
|
||||
return ( ( StreamBuffer_t * ) xStreamBuffer )->uxStreamBufferNumber;
|
||||
return xStreamBuffer->uxStreamBufferNumber;
|
||||
}
|
||||
|
||||
#endif /* configUSE_TRACE_FACILITY */
|
||||
|
|
@ -1231,7 +1246,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
|
||||
void vStreamBufferSetStreamBufferNumber( StreamBufferHandle_t xStreamBuffer, UBaseType_t uxStreamBufferNumber )
|
||||
{
|
||||
( ( StreamBuffer_t * ) xStreamBuffer )->uxStreamBufferNumber = uxStreamBufferNumber;
|
||||
xStreamBuffer->uxStreamBufferNumber = uxStreamBufferNumber;
|
||||
}
|
||||
|
||||
#endif /* configUSE_TRACE_FACILITY */
|
||||
|
|
@ -1241,7 +1256,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
|
||||
uint8_t ucStreamBufferGetStreamBufferType( StreamBufferHandle_t xStreamBuffer )
|
||||
{
|
||||
return ( ( StreamBuffer_t * )xStreamBuffer )->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER;
|
||||
return ( xStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER );
|
||||
}
|
||||
|
||||
#endif /* configUSE_TRACE_FACILITY */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue