Index: firmware/App/Services/CommBuffers.c =================================================================== diff -u -r4459be59bdc2896b44bcf6cd42d2762190e23c16 -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision 4459be59bdc2896b44bcf6cd42d2762190e23c16) +++ firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -23,25 +23,30 @@ #include "SystemCommMessages.h" #include "Timers.h" +/** + * @addtogroup CommBuffers + * @{ + */ + // ********** private definitions ********** -#define COMM_BUFFER_LENGTH 512 // max bytes in each comm buffer (double if you count double buffers) -#define DOUBLE_BUFFERS 2 // need 2 buffers for double buffering -#define BUFFER_OVERFLOW_PERSISTENCE_MS 5000 // how many ms buffer overflows must persist before fault +#define COMM_BUFFER_LENGTH 512 ///< max bytes in each comm buffer (each side of double buffer is this size) +#define DOUBLE_BUFFERS 2 ///< need 2 buffers for double buffering +#define BUFFER_OVERFLOW_PERSISTENCE_MS 5000 ///< how many ms buffer overflows must persist before fault // ********** private data ********** -static volatile U32 commBufferByteCount[ NUM_OF_COMM_BUFFERS ][ DOUBLE_BUFFERS ]; // for each buffer, how many bytes does it contain? (also index to next available) -static volatile 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 -static U32 firstBufferOverflowTimeStamp = 0; // time stamp of a prior overflow event - allows for an overflow persistence check +static volatile U32 commBufferByteCount[ NUM_OF_COMM_BUFFERS ][ DOUBLE_BUFFERS ]; ///< for each buffer, how many bytes does it contain? (also index to next available) +static volatile 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 +static U32 firstBufferOverflowTimeStamp = 0; ///< time stamp of a prior overflow event - allows for an overflow persistence check // ********** private function prototypes ********** static U32 switchDoubleBuffer( COMM_BUFFER_T buffer ); static void getDataFromInactiveBuffer( COMM_BUFFER_T buffer, U08 *data, U32 len ); -/************************************************************************* +/*********************************************************************//** * @brief * The initCommBuffers function initializes the CommBuffers module. * @details @@ -60,7 +65,7 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief * The clearBuffer function clears (empties) a given buffer. * Caller should ensure buffer won't be used while this function is clearing @@ -92,7 +97,7 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief * The addToCommBuffer function adds data of specified length to a specified * communication buffer. S/W fault if buffer too full to add data. @@ -189,7 +194,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The getFromCommBuffer function fills a given byte array with a given * number of bytes from a given buffer and returns the number of bytes @@ -250,7 +255,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The peekFromCommBuffer function fills a given byte array with a given * number of bytes from a given buffer. This function does NOT consume @@ -308,7 +313,7 @@ return numOfBytesPeeked; } -/************************************************************************* +/*********************************************************************//** * @brief * The numberOfBytesInCommBuffer function determines how many bytes * are currently contained in a given comm buffer. Both double buffers @@ -339,7 +344,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The switchDoubleBuffer function switches the active and inactive buffers * for the given buffer. @@ -365,7 +370,7 @@ return inactiveBuffer; } -/************************************************************************* +/*********************************************************************//** * @brief * The getDataFromInactiveBuffer function retrieves a given number of bytes * from the inactive buffer of a given buffer. This function should only be @@ -402,3 +407,5 @@ switchDoubleBuffer( buffer ); // switch will zero count off inactive buffer } } + +/**@}*/