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.
//!
//! 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 None. //! \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.
// //
while(*pcString && ulSize) iConvertCount = 0;
//
// Loop while there are more characters in the format string.
//
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
{
strncpy(pcBuf, pcString, ulIdx);
pcBuf += ulIdx;
ulSize -= ulIdx;
} }
// //
// Write this portion of the string and update the buffer pointer. // 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.
// //
strncpy(pcBuf, pcString, ulIdx); iConvertCount += ulIdx;
pcBuf += ulIdx;
// //
// Update the size limit, and check to see if the buffer // Skip the portion of the format string that was written.
// limit is reached.
//
ulSize -= ulIdx;
if(ulSize == 0)
{
break;
}
//
// Skip the portion of the 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.
// //
*pcBuf++ = (char)ulValue; if(ulSize != 0)
{
*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
{
strncpy(pcBuf, pcStr, ulIdx);
pcBuf += ulIdx;
ulSize -= ulIdx;
} }
// //
// Write the string and update the buffer pointer. // Update the conversion count. This will be the number of
// // characters that should have been written, even if there
strncpy(pcBuf, pcStr, ulIdx); // was not room in the buffer.
pcBuf += ulIdx;
//
// Decrement the buffer size limit.
// //
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 %.
// //
*pcBuf++ = pcString[-1]; if(ulSize != 0)
ulSize--; {
*pcBuf++ = pcString[-1];
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);
} }
//***************************************************************************** //*****************************************************************************

@ -3,24 +3,24 @@
// uartstdlib.h - Prototypes for simple standard library functions. // uartstdlib.h - Prototypes for simple standard library functions.
// //
// Copyright (c) 2007 Luminary Micro, Inc. All rights reserved. // Copyright (c) 2007 Luminary Micro, Inc. All rights reserved.
// //
// Software License Agreement // Software License Agreement
// //
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and // Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's microcontroller products. // exclusively on LMI's microcontroller products.
// //
// The software is owned by LMI and/or its suppliers, and is protected under // The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws. All rights are reserved. Any use in violation // applicable copyright laws. All rights are reserved. Any use in violation
// of the foregoing restrictions may subject the user to criminal sanctions // of the foregoing restrictions may subject the user to criminal sanctions
// under applicable laws, as well as to civil liability for the breach of the // under applicable laws, as well as to civil liability for the breach of the
// terms and conditions of this license. // terms and conditions of this license.
// //
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
// //
// //
//***************************************************************************** //*****************************************************************************
@ -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.
@ -19,13 +19,13 @@
A special exception to the GPL can be applied should you wish to distribute A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS.org, without being obliged to provide a combined work that includes FreeRTOS.org, without being obliged to provide
the source code for any proprietary components. See the licensing section the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception of http://www.FreeRTOS.org for full details of how and when the exception
can be applied. can be applied.
*************************************************************************** ***************************************************************************
See http://www.FreeRTOS.org for documentation, latest information, license See http://www.FreeRTOS.org for documentation, latest information, license
and contact details. Please ensure to read the configuration and relevant and contact details. Please ensure to read the configuration and relevant
port sections of the online documentation. port sections of the online documentation.
Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along
@ -35,7 +35,7 @@
/* /*
* This file contains some test scenarios that ensure tasks do not exit queue * This file contains some test scenarios that ensure tasks do not exit queue
* send or receive functions prematurely. A description of the tests is * send or receive functions prematurely. A description of the tests is
* included within the code. * included within the code.
*/ */
@ -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 )
@ -68,7 +71,7 @@ static xTaskHandle xSecondary;
static portBASE_TYPE xPrimaryCycles = 0, xSecondaryCycles = 0; static portBASE_TYPE xPrimaryCycles = 0, xSecondaryCycles = 0;
static portBASE_TYPE xErrorOccurred = pdFALSE; static portBASE_TYPE xErrorOccurred = pdFALSE;
/* Provides a simple mechanism for the primary task to know when the /* Provides a simple mechanism for the primary task to know when the
secondary task has executed. */ secondary task has executed. */
static volatile unsigned portBASE_TYPE xRunIndicator; static volatile unsigned portBASE_TYPE xRunIndicator;
@ -125,7 +128,7 @@ portTickType xTimeToBlock, xBlockedTime;
} }
portEXIT_CRITICAL(); portEXIT_CRITICAL();
if( xBlockedTime < xTimeToBlock ) if( xBlockedTime < xTimeToBlock )
{ {
/* Should not have blocked for less than we requested. */ /* Should not have blocked for less than we requested. */
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
@ -134,7 +137,7 @@ portTickType xTimeToBlock, xBlockedTime;
if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) ) if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) )
{ {
/* Should not have blocked for longer than we requested, /* Should not have blocked for longer than we requested,
although we would not necessarily run as soon as we were although we would not necessarily run as soon as we were
unblocked so a margin is allowed. */ unblocked so a margin is allowed. */
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
@ -176,7 +179,7 @@ portTickType xTimeToBlock, xBlockedTime;
} }
portEXIT_CRITICAL(); portEXIT_CRITICAL();
if( xBlockedTime < xTimeToBlock ) if( xBlockedTime < xTimeToBlock )
{ {
/* Should not have blocked for less than we requested. */ /* Should not have blocked for less than we requested. */
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
@ -185,7 +188,7 @@ portTickType xTimeToBlock, xBlockedTime;
if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) ) if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) )
{ {
/* Should not have blocked for longer than we requested, /* Should not have blocked for longer than we requested,
although we would not necessarily run as soon as we were although we would not necessarily run as soon as we were
unblocked so a margin is allowed. */ unblocked so a margin is allowed. */
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
@ -227,7 +230,7 @@ portTickType xTimeToBlock, xBlockedTime;
} }
/* Now fill the queue again before the other task gets a chance to /* Now fill the queue again before the other task gets a chance to
execute. If the other task had executed we would find the queue execute. If the other task had executed we would find the queue
full ourselves, and the other task have set xRunIndicator. */ full ourselves, and the other task have set xRunIndicator. */
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS ) if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
{ {
@ -270,7 +273,7 @@ portTickType xTimeToBlock, xBlockedTime;
/********************************************************************* /*********************************************************************
Test 4 Test 4
As per test 3 - but with the send and receive the other way around. As per test 3 - but with the send and receive the other way around.
The other task blocks attempting to read from the queue. The other task blocks attempting to read from the queue.
Empty the queue. We should find that it is full. */ Empty the queue. We should find that it is full. */
@ -282,7 +285,7 @@ portTickType xTimeToBlock, xBlockedTime;
} }
} }
/* Wake the other task so it blocks attempting to read from the /* Wake the other task so it blocks attempting to read from the
already empty queue. */ already empty queue. */
vTaskResume( xSecondary ); vTaskResume( xSecondary );
@ -296,7 +299,7 @@ portTickType xTimeToBlock, xBlockedTime;
for( xItem = 0; xItem < bktQUEUE_LENGTH; xItem++ ) for( xItem = 0; xItem < bktQUEUE_LENGTH; xItem++ )
{ {
/* Now when we place an item on the queue the other task should /* Now when we place an item on the queue the other task should
wake but not execute as this task has higher priority. */ wake but not execute as this task has higher priority. */
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS ) if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
{ {
@ -304,7 +307,7 @@ portTickType xTimeToBlock, xBlockedTime;
} }
/* Now empty the queue again before the other task gets a chance to /* Now empty the queue again before the other task gets a chance to
execute. If the other task had executed we would find the queue execute. If the other task had executed we would find the queue
empty ourselves, and the other task would be suspended. */ empty ourselves, and the other task would be suspended. */
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS ) if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )
{ {
@ -321,7 +324,7 @@ portTickType xTimeToBlock, xBlockedTime;
on the queue again. */ on the queue again. */
vTaskPrioritySet( xSecondary, bktPRIMARY_PRIORITY + 2 ); vTaskPrioritySet( xSecondary, bktPRIMARY_PRIORITY + 2 );
/* The other task should now have re-blocked without exiting the /* The other task should now have re-blocked without exiting the
queue function. */ queue function. */
if( xRunIndicator == bktRUN_INDICATOR ) if( xRunIndicator == bktRUN_INDICATOR )
{ {
@ -388,7 +391,7 @@ portBASE_TYPE xData;
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
/* We should of not blocked for much longer than bktALLOWABLE_MARGIN /* We should of not blocked for much longer than bktALLOWABLE_MARGIN
either. A margin is permitted as we would not necessarily run as either. A margin is permitted as we would not necessarily run as
soon as we unblocked. */ soon as we unblocked. */
if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) ) if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) )
@ -426,7 +429,7 @@ portBASE_TYPE xData;
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
/* We should of not blocked for much longer than bktALLOWABLE_MARGIN /* We should of not blocked for much longer than bktALLOWABLE_MARGIN
either. A margin is permitted as we would not necessarily run as soon either. A margin is permitted as we would not necessarily run as soon
as we unblocked. */ as we unblocked. */
if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) ) if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) )

@ -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