Index: App/Services/CommBuffers.c =================================================================== diff -u -r833095dbbe2b21a989b05f48bd7ddc390ad964cb -r6dde2145782d8f68eb66e053f1db8f8847b15980 --- App/Services/CommBuffers.c (.../CommBuffers.c) (revision 833095dbbe2b21a989b05f48bd7ddc390ad964cb) +++ App/Services/CommBuffers.c (.../CommBuffers.c) (revision 6dde2145782d8f68eb66e053f1db8f8847b15980) @@ -31,7 +31,7 @@ // ********** private data ********** static U32 commBufferByteCount[NUM_OF_COMM_BUFFERS][DOUBLE_BUFFERS]; // for each buffer, how many bytes does it contain? (also index to next available) -static U32 activeDoubleBuffers[NUM_OF_COMM_BUFFERS]; // for each buffer, which double buffer is being fed right now? +static U32 activeDoubleBuffer[NUM_OF_COMM_BUFFERS]; // for each buffer, which double buffer is being fed right now? static U08 commBuffers[NUM_OF_COMM_BUFFERS][DOUBLE_BUFFERS][COMM_BUFFER_LENGTH]; // each is double buffered to avoid thread contention // ********** private function prototypes ********** @@ -56,7 +56,7 @@ // reset and zero out all buffers for ( b = 0; b < NUM_OF_COMM_BUFFERS; b++ ) { - activeDoubleBuffers[b] = 0; + activeDoubleBuffer[b] = 0; for ( d = 0; d < 2; d++ ) { commBufferByteCount[b][d] = 0; @@ -75,7 +75,7 @@ * Only one function in one thread should be calling this function for a \n * given buffer. This function will always add to the active double buffer. * @details - * Inputs : commBufferByteCount[], activeDoubleBuffers[] + * Inputs : commBufferByteCount[], activeDoubleBuffer[] * Outputs : commBuffers[], commBufferByteCount[] * @param buffer : which comm buffer to add data to * @param data : pointer to byte array containing data to add @@ -85,7 +85,7 @@ BOOL addToCommBuffer( COMM_BUFFER_T buffer, U08* data, U32 len ) { BOOL result = FALSE; - U32 activeBuffer = activeDoubleBuffers[buffer]; + U32 activeBuffer = activeDoubleBuffer[buffer]; // verify given buffer if ( buffer < NUM_OF_COMM_BUFFERS ) @@ -136,8 +136,8 @@ * Only one function in one thread should be calling this function for a given \n * buffer. * @details - * Inputs : commBuffers[], commBufferByteCount[], activeDoubleBuffers[] - * Outputs : commBuffers[], commBufferByteCount[], activeDoubleBuffers[], \n + * Inputs : commBuffers[], commBufferByteCount[], activeDoubleBuffer[] + * Outputs : commBuffers[], commBufferByteCount[], activeDoubleBuffer[], \n * and the given data array is populated with data from the buffer. * @param buffer : which comm buffer to retrieve data from * @param data : pointer to byte array to stuff data into @@ -154,7 +154,7 @@ // verify size of peek if ( ( len <= ( COMM_BUFFER_LENGTH * DOUBLE_BUFFERS ) ) && ( len <= numberOfBytesInCommBuffer( buffer ) ) ) { - U32 activeBuffer = activeDoubleBuffers[buffer]; + U32 activeBuffer = activeDoubleBuffer[buffer]; U32 inactiveBuffer = ( activeBuffer == 0 ? 1 : 0 ); U32 bytesInInactiveBuffer = commBufferByteCount[buffer][inactiveBuffer]; U32 sizeOfFirstConsumption = ( len <= bytesInInactiveBuffer ? len : bytesInInactiveBuffer ); @@ -196,7 +196,7 @@ * are currently in the buffer. Do not call this function with a "len" \n * longer than what is currently in the buffer. * @details - * Inputs : commBuffers[], commBufferByteCount[], activeDoubleBuffers[] + * Inputs : commBuffers[], commBufferByteCount[], activeDoubleBuffer[] * Outputs : given array populated with requested # of bytes from the buffer. * @param buffer : which comm buffer to retrieve data from * @param data : pointer to byte array to stuff data into @@ -213,7 +213,7 @@ // verify size of peek if ( ( len <= ( COMM_BUFFER_LENGTH * DOUBLE_BUFFERS ) ) && ( len <= numberOfBytesInCommBuffer( buffer ) ) ) { - U32 activeBuffer = activeDoubleBuffers[buffer]; + U32 activeBuffer = activeDoubleBuffer[buffer]; U32 inactiveBuffer = ( activeBuffer == 0 ? 1 : 0 ); U32 bytesInInactiveBuffer = commBufferByteCount[buffer][inactiveBuffer]; @@ -252,7 +252,7 @@ * are currently contained in a given comm buffer. Both double buffers \n * are considered for this. * @details - * Inputs : activeDoubleBuffers[], commBufferByteCount[] + * Inputs : activeDoubleBuffer[], commBufferByteCount[] * Outputs : none * @param buffer : which comm buffer to get byte count for * @return the number of bytes in the given comm buffer. @@ -279,20 +279,20 @@ * The switchDoubleBuffer function switches the active and inactive buffers \n * for the given buffer. * @details - * Inputs : activeDoubleBuffers[] - * Outputs : activeDoubleBuffers[], commBufferByteCount[] + * Inputs : activeDoubleBuffer[] + * Outputs : activeDoubleBuffer[], commBufferByteCount[] * @param buffer : which comm buffer to switch double buffers on * @return the new active buffer for the given buffer. *************************************************************************/ static U32 switchDoubleBuffer( COMM_BUFFER_T buffer ) { - U32 activeBuffer = activeDoubleBuffers[buffer]; + U32 activeBuffer = activeDoubleBuffer[buffer]; U32 inactiveBuffer = ( activeBuffer == 0 ? 1 : 0 ); // ensure inactive buffer is reset before making active commBufferByteCount[buffer][inactiveBuffer] = 0; // switch buffers - activeDoubleBuffers[buffer] = inactiveBuffer; + activeDoubleBuffer[buffer] = inactiveBuffer; // return the new active buffer (was just inactive) return inactiveBuffer; @@ -304,16 +304,16 @@ * from the inactive buffer of a given buffer. This function should only be \n * called by getFromCommBuffer(). Params will be pre-validated. * @details - * Inputs : commBuffers[], activeDoubleBuffers[], commBufferByteCount[] - * Outputs : commBuffers[], activeDoubleBuffers[], commBufferByteCount[] + * Inputs : commBuffers[], activeDoubleBuffer[], commBufferByteCount[] + * Outputs : commBuffers[], activeDoubleBuffer[], commBufferByteCount[] * @param buffer : which comm buffer get data from * @param data : pointer to byte array to populate with data * @param len : # of bytes to get from comm buffer * @return none *************************************************************************/ static void getDataFromInactiveBuffer( COMM_BUFFER_T buffer, U08 *data, U32 len ) { - U32 activeBuffer = activeDoubleBuffers[buffer]; + U32 activeBuffer = activeDoubleBuffer[buffer]; U32 inactiveBuffer = ( activeBuffer == 0 ? 1 : 0 ); U32 bytesInInactiveBuffer = commBufferByteCount[buffer][inactiveBuffer]; @@ -341,15 +341,15 @@ * The getRemainingByteCapacity function determines the remaining capacity \n * of the given buffer. * @details - * Inputs : commBufferByteCount[], activeDoubleBuffers[] + * Inputs : commBufferByteCount[], activeDoubleBuffer[] * Outputs : none * @param buffer : which comm buffer to check the capacity of * @return the number of bytes of capacity remaining in the buffer. *************************************************************************/ static U32 getRemainingByteCapacity( COMM_BUFFER_T buffer ) { U32 result; - U32 activeBuffer = activeDoubleBuffers[buffer]; + U32 activeBuffer = activeDoubleBuffer[buffer]; result = COMM_BUFFER_LENGTH - commBufferByteCount[buffer][activeBuffer];