Update in preparation for the V4.3.1 release.

pull/1/head
Richard Barry 18 years ago
parent 8235f7a15f
commit 42b2cbf237

@ -32,7 +32,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -44,15 +44,16 @@ static const char * const g_pcHex = "0123456789abcdef";
//***************************************************************************** //*****************************************************************************
// //
//! A simple sprintf function supporting \%c, \%d, \%s, \%u, \%x, and \%X. //! A simple vsnprintf function supporting \%c, \%d, \%s, \%u, \%x, and \%X.
//! //!
//! \param pcBuf is the buffer where the converted string is stored. //! \param pcBuf points to the buffer where the converted string is stored.
//! \param ulSize is the size of the buffer.
//! \param pcString is the format string. //! \param pcString is the format string.
//! \param ... are the optional arguments, which depend on the contents of the //! \param vaArgP is the list of optional arguments, which depend on the
//! format string. //! contents of the format string.
//! //!
//! This function is very similar to the C library <tt>sprintf()</tt> function. //! This function is very similar to the C library <tt>vsnprintf()</tt>
//! Only the following formatting characters are supported: //! function. Only the following formatting characters are supported:
//! //!
//! - \%c to print a character //! - \%c to print a character
//! - \%d to print a decimal value //! - \%d to print a decimal value
@ -75,18 +76,29 @@ static const char * const g_pcHex = "0123456789abcdef";
//! the format string. For example, if an integer was passed where a string //! the format string. For example, if an integer was passed where a string
//! was expected, an error of some kind will most likely occur. //! was expected, an error of some kind will most likely occur.
//! //!
//! The caller must ensure that the buffer pcBuf is large enough to hold the //! The \b ulSize parameter limits the number of characters that will be
//! entire converted string, including the null termination character. //! stored in the buffer pointed to by \b pcBuf to prevent the possibility
//! of a buffer overflow. The buffer size should be large enough to hold
//! the expected converted output string, including the null termination
//! character.
//! //!
//! \return None. //! The function will return the number of characters that would be
//! converted as if there were no limit on the buffer size. Therefore
//! it is possible for the function to return a count that is greater than
//! the specified buffer size. If this happens, it means that the output
//! was truncated.
//!
//! \return the number of characters that were to be stored, not including
//! the NULL termination character, regardless of space in the buffer.
// //
//***************************************************************************** //*****************************************************************************
int int
uvsnprintf(char *pcBuf, unsigned long ulSize, const char *pcString, uvsnprintf(char *pcBuf, unsigned long ulSize, const char *pcString,
va_list vaArgP) va_list vaArgP)
{ {
unsigned long ulIdx, ulValue, ulPos, ulCount, ulBase; unsigned long ulIdx, ulValue, ulCount, ulBase;
char *pcStr, cFill, *pcOriginalBuf = pcBuf; char *pcStr, cFill;
int iConvertCount = 0;
// //
// Check the arguments. // Check the arguments.
@ -104,10 +116,14 @@ uvsnprintf(char *pcBuf, unsigned long ulSize, const char *pcString,
} }
// //
// Loop while there are more characters in the string, and // Initialize the count of characters converted.
// there is more room in the destination buffer. //
iConvertCount = 0;
//
// Loop while there are more characters in the format string.
// //
while(*pcString && ulSize) while(*pcString)
{ {
// //
// Find the first non-% character, or the end of the string. // Find the first non-% character, or the end of the string.
@ -118,32 +134,32 @@ uvsnprintf(char *pcBuf, unsigned long ulSize, const char *pcString,
} }
// //
// Limit the number of characters that can be copied to the // Write this portion of the string to the output buffer. If
// space remaining in the buffer. // there are more characters to write than there is space in the
// buffer, then only write as much as will fit in the buffer.
// //
if(ulIdx > ulSize) if(ulIdx > ulSize)
{ {
ulIdx = ulSize; strncpy(pcBuf, pcString, ulSize);
pcBuf += ulSize;
ulSize = 0;
} }
else
// {
// Write this portion of the string and update the buffer pointer.
//
strncpy(pcBuf, pcString, ulIdx); strncpy(pcBuf, pcString, ulIdx);
pcBuf += ulIdx; pcBuf += ulIdx;
ulSize -= ulIdx;
}
// //
// Update the size limit, and check to see if the buffer // Update the conversion count. This will be the number of
// limit is reached. // characters that should have been written, even if there was
// not room in the buffer.
// //
ulSize -= ulIdx; iConvertCount += ulIdx;
if(ulSize == 0)
{
break;
}
// //
// Skip the portion of the string that was written. // Skip the portion of the format string that was written.
// //
pcString += ulIdx; pcString += ulIdx;
@ -222,14 +238,19 @@ again:
ulValue = va_arg(vaArgP, unsigned long); ulValue = va_arg(vaArgP, unsigned long);
// //
// Print out the character. // Copy the character to the output buffer, if
// there is room. Update the buffer size remaining.
// //
if(ulSize != 0)
{
*pcBuf++ = (char)ulValue; *pcBuf++ = (char)ulValue;
ulSize--;
}
// //
// Decrement the buffer limit. // Update the conversion count.
// //
ulSize--; iConvertCount++;
// //
// This command has been handled. // This command has been handled.
@ -247,30 +268,24 @@ again:
// //
ulValue = va_arg(vaArgP, unsigned long); ulValue = va_arg(vaArgP, unsigned long);
//
// Reset the buffer position.
//
ulPos = 0;
// //
// If the value is negative, make it positive and stick a // If the value is negative, make it positive and stick a
// minus sign in the beginning of the buffer. // minus sign in the beginning of the buffer.
// //
if((long)ulValue < 0) if((long)ulValue < 0)
{ {
*pcBuf++ = '-';
ulPos++;
ulValue = -(long)ulValue; ulValue = -(long)ulValue;
// if(ulSize != 0)
// Decrement the buffer size limit and check
// if the limit is reached.
//
ulSize--;
if(ulSize == 0)
{ {
break; *pcBuf++ = '-';
ulSize--;
} }
//
// Update the conversion count.
//
iConvertCount++;
} }
// //
@ -302,24 +317,29 @@ again:
} }
// //
// Limit the number of characters that can be copied to the // Copy the string to the output buffer. Only copy
// space remaining in the buffer. // as much as will fit in the buffer. Update the
// output buffer pointer and the space remaining.
// //
if(ulIdx > ulSize) if(ulIdx > ulSize)
{ {
ulIdx = ulSize; strncpy(pcBuf, pcStr, ulSize);
pcBuf += ulSize;
ulSize = 0;
} }
else
// {
// Write the string and update the buffer pointer.
//
strncpy(pcBuf, pcStr, ulIdx); strncpy(pcBuf, pcStr, ulIdx);
pcBuf += ulIdx; pcBuf += ulIdx;
ulSize -= ulIdx;
}
// //
// Decrement the buffer size limit. // Update the conversion count. This will be the number of
// characters that should have been written, even if there
// was not room in the buffer.
// //
ulSize -= ulIdx; iConvertCount += ulIdx;
// //
// //
@ -338,11 +358,6 @@ again:
// //
ulValue = va_arg(vaArgP, unsigned long); ulValue = va_arg(vaArgP, unsigned long);
//
// Reset the buffer position.
//
ulPos = 0;
// //
// Set the base to 10. // Set the base to 10.
// //
@ -367,11 +382,6 @@ again:
// //
ulValue = va_arg(vaArgP, unsigned long); ulValue = va_arg(vaArgP, unsigned long);
//
// Reset the buffer position.
//
ulPos = 0;
// //
// Set the base to 16. // Set the base to 16.
// //
@ -397,18 +407,20 @@ convert:
{ {
for(ulCount--; ulCount; ulCount--) for(ulCount--; ulCount; ulCount--)
{ {
*pcBuf++ = cFill;
ulPos++;
// //
// Decrement buffer size and check to see if // Copy the character to the output buffer if
// buffer limit is reached. // there is room.
// //
ulSize--; if(ulSize != 0)
if(ulSize == 0)
{ {
break; *pcBuf++ = cFill;
ulSize--;
} }
//
// Update the conversion count.
//
iConvertCount++;
} }
} }
@ -417,18 +429,20 @@ convert:
// //
for(; ulIdx; ulIdx /= ulBase) for(; ulIdx; ulIdx /= ulBase)
{ {
*pcBuf++ = g_pcHex[(ulValue / ulIdx) % ulBase];
ulPos++;
// //
// Decrement buffer size and check to see if // Copy the character to the output buffer if
// buffer limit is reached. // there is room.
// //
ulSize--; if(ulSize != 0)
if(ulSize == 0)
{ {
break; *pcBuf++ = g_pcHex[(ulValue / ulIdx) % ulBase];
ulSize--;
} }
//
// Update the conversion count.
//
iConvertCount++;
} }
// //
@ -445,8 +459,16 @@ convert:
// //
// Simply write a single %. // Simply write a single %.
// //
if(ulSize != 0)
{
*pcBuf++ = pcString[-1]; *pcBuf++ = pcString[-1];
ulSize--; ulSize--;
}
//
// Update the conversion count.
//
iConvertCount++;
// //
// This command has been handled. // This command has been handled.
@ -462,12 +484,23 @@ convert:
// //
// Indicate an error. // Indicate an error.
// //
if(ulSize > 5) if(ulSize >= 5)
{ {
strncpy(pcBuf, "ERROR", 5); strncpy(pcBuf, "ERROR", 5);
pcBuf += 5; pcBuf += 5;
ulSize -= 5; ulSize -= 5;
} }
else
{
strncpy(pcBuf, "ERROR", ulSize);
pcBuf += ulSize;
ulSize = 0;
}
//
// Update the conversion count.
//
iConvertCount += 5;
// //
// This command has been handled. // This command has been handled.
@ -482,7 +515,7 @@ convert:
// Null terminate the string in the buffer. // Null terminate the string in the buffer.
// //
*pcBuf = 0; *pcBuf = 0;
return ( int ) pcBuf - ( int ) pcOriginalBuf; return(iConvertCount);
} }
//***************************************************************************** //*****************************************************************************
@ -521,13 +554,15 @@ convert:
//! The caller must ensure that the buffer pcBuf is large enough to hold the //! The caller must ensure that the buffer pcBuf is large enough to hold the
//! entire converted string, including the null termination character. //! entire converted string, including the null termination character.
//! //!
//! \return None. //! \return The count of characters that were written to the output buffer,
//! not including the NULL termination character.
// //
//***************************************************************************** //*****************************************************************************
void int
usprintf(char *pcBuf, const char *pcString, ...) usprintf(char *pcBuf, const char *pcString, ...)
{ {
va_list vaArgP; va_list vaArgP;
int iRet;
// //
// Start the varargs processing. // Start the varargs processing.
@ -538,12 +573,17 @@ usprintf(char *pcBuf, const char *pcString, ...)
// Call vsnprintf to perform the conversion. Use a // Call vsnprintf to perform the conversion. Use a
// large number for the buffer size. // large number for the buffer size.
// //
uvsnprintf(pcBuf, 0xffff, pcString, vaArgP); iRet = uvsnprintf(pcBuf, 0xffff, pcString, vaArgP);
// //
// End the varargs processing. // End the varargs processing.
// //
va_end(vaArgP); va_end(vaArgP);
//
// Return the conversion count.
//
return(iRet);
} }
//***************************************************************************** //*****************************************************************************
@ -584,13 +624,20 @@ usprintf(char *pcBuf, const char *pcString, ...)
//! buffer \b pcBuf. One space is reserved in the buffer for the null //! buffer \b pcBuf. One space is reserved in the buffer for the null
//! termination character. //! termination character.
//! //!
//! \return None. //! The function will return the number of characters that would be
//! converted as if there were no limit on the buffer size. Therefore
//! it is possible for the function to return a count that is greater than
//! the specified buffer size. If this happens, it means that the output
//! was truncated.
//!
//! \return the number of characters that were to be stored, not including
//! the NULL termination character, regardless of space in the buffer.
// //
//***************************************************************************** //*****************************************************************************
int int
usnprintf(char *pcBuf, unsigned long ulSize, const char *pcString, ...) usnprintf(char *pcBuf, unsigned long ulSize, const char *pcString, ...)
{ {
int iReturn; int iRet;
va_list vaArgP; va_list vaArgP;
@ -602,14 +649,17 @@ int iReturn;
// //
// Call vsnprintf to perform the conversion. // Call vsnprintf to perform the conversion.
// //
iReturn = uvsnprintf(pcBuf, ulSize, pcString, vaArgP); iRet = uvsnprintf(pcBuf, ulSize, pcString, vaArgP);
// //
// End the varargs processing. // End the varargs processing.
// //
va_end(vaArgP); va_end(vaArgP);
return iReturn; //
// Return the conversion count.
//
return(iRet);
} }
//***************************************************************************** //*****************************************************************************

@ -37,7 +37,9 @@ extern "C"
// Prototypes for the APIs. // Prototypes for the APIs.
// //
//***************************************************************************** //*****************************************************************************
extern void usprintf(char *, const char *pcString, ...); extern int usprintf(char *, const char *pcString, ...);
extern int usnprintf(char *pcBuf, unsigned long ulSize,
const char *pcString, ...);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.
@ -44,6 +44,9 @@
#include "task.h" #include "task.h"
#include "queue.h" #include "queue.h"
/* Demo includes. */
#include "blocktim.h"
/* Task priorities. */ /* Task priorities. */
#define bktPRIMARY_PRIORITY ( 3 ) #define bktPRIMARY_PRIORITY ( 3 )
#define bktSECONDARY_PRIORITY ( 2 ) #define bktSECONDARY_PRIORITY ( 2 )

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry. FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save