Index: App/Services/CommBuffers.c =================================================================== diff -u -r8ba82119080b77f804fa2b3edadd11422f57371b -r1d856a336fbfdc72a1e1165b64f1725e497c5f65 --- App/Services/CommBuffers.c (.../CommBuffers.c) (revision 8ba82119080b77f804fa2b3edadd11422f57371b) +++ App/Services/CommBuffers.c (.../CommBuffers.c) (revision 1d856a336fbfdc72a1e1165b64f1725e497c5f65) @@ -20,6 +20,8 @@ * **************************************************************************/ +#include // for memcpy() + #include "Common.h" #include "CommBuffers.h" @@ -111,8 +113,6 @@ srcPtr = data; // copy source data to destination buffer memcpy( buffPtr, srcPtr, len ); - // adjust buffer count per this data add - commBufferByteCount[buffer][activeBuffer] += len; // data successfully added to buffer result = TRUE; } @@ -156,7 +156,7 @@ // verify given buffer if ( buffer < NUM_OF_COMM_BUFFERS ) { - // verify size of peek + // verify size of get if ( ( len <= ( COMM_BUFFER_LENGTH * DOUBLE_BUFFERS ) ) && ( len <= numberOfBytesInCommBuffer( buffer ) ) ) { U32 activeBuffer = activeDoubleBuffer[buffer]; @@ -281,7 +281,9 @@ /************************************************************************* * @brief switchDoubleBuffer * The switchDoubleBuffer function switches the active and inactive buffers \n - * for the given buffer. + * for the given buffer. \n + * This function should only be called when the current inactive buffer has \n + * been emptied. Any unconsumed data in inactive buffer will be lost. * @details * Inputs : activeDoubleBuffer[] * Outputs : activeDoubleBuffer[], commBufferByteCount[] @@ -306,7 +308,7 @@ * @brief getDataFromInactiveBuffer * The getDataFromInactiveBuffer function retrieves a given number of bytes \n * from the inactive buffer of a given buffer. This function should only be \n - * called by getFromCommBuffer(). Params will be pre-validated. + * called by getFromCommBuffer(). Params will be pre-validated there. * @details * Inputs : commBuffers[], activeDoubleBuffer[], commBufferByteCount[] * Outputs : commBuffers[], activeDoubleBuffer[], commBufferByteCount[]