From: richardbarry Date: Tue, 29 Sep 2009 19:49:54 +0000 (+0000) Subject: Update for V6. X-Git-Tag: V6.0.0~51 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=15d4f3a0645fd6ea547a01f3237afdb889c800ca;p=freertos Update for V6. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@877 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Source/include/FreeRTOS.h b/Source/include/FreeRTOS.h index 938261caf..92bfe31d2 100644 --- a/Source/include/FreeRTOS.h +++ b/Source/include/FreeRTOS.h @@ -394,5 +394,21 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * ); #define configUSE_MALLOC_FAILED_HOOK 0 #endif +#ifndef portPRIVILEGE_BIT + #define portPRIVILEGE_BIT ( ( unsigned portBASE_TYPE ) 0x00 ) +#endif + +#ifndef portYIELD_WITHIN_API + #define portYIELD_WITHIN_API portYIELD +#endif + +#ifndef pvPortMallocAligned + #define pvPortMallocAligned( xSize, pvBuffer ) pvPortMalloc( xSize ); ( void ) pvBuffer +#endif + +#ifndef vPortFreeAligned + #define vPortFreeAligned( pvBlockToFree ) vPortFree( pvBlockToFree ) +#endif + #endif /* INC_FREERTOS_H */ diff --git a/Source/include/portable.h b/Source/include/portable.h index 8fc0723d0..3a279d879 100644 --- a/Source/include/portable.h +++ b/Source/include/portable.h @@ -301,24 +301,54 @@ to find the path to the correct portmacro.h file. */ #include "portmacro.h" #endif +#if portBYTE_ALIGNMENT == 8 + #define portBYTE_ALIGNMENT_MASK ( 0x0007 ) +#endif + +#if portBYTE_ALIGNMENT == 4 + #define portBYTE_ALIGNMENT_MASK ( 0x0003 ) +#endif + +#if portBYTE_ALIGNMENT == 2 + #define portBYTE_ALIGNMENT_MASK ( 0x0001 ) +#endif + +#if portBYTE_ALIGNMENT == 1 + #define portBYTE_ALIGNMENT_MASK ( 0x0000 ) +#endif + +#ifndef portBYTE_ALIGNMENT_MASK + #error "Invalid portBYTE_ALIGNMENT definition" +#endif + +#ifndef portNUM_CONFIGURABLE_REGIONS + #define portNUM_CONFIGURABLE_REGIONS 1 +#endif + #ifdef __cplusplus extern "C" { #endif +#include "mpu_wrappers.h" + /* * Setup the stack of a new task so it is ready to be placed under the * scheduler control. The registers have to be placed on the stack in * the order that the port expects to find them. * */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ); +#if( portUSING_MPU_WRAPPERS == 1 ) + portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ); +#else + portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ); +#endif /* * Map to the memory management routines required for the port. */ -void *pvPortMalloc( size_t xSize ); -void vPortFree( void *pv ); -void vPortInitialiseBlocks( void ); +void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION; +void vPortFree( void *pv ) PRIVILEGED_FUNCTION; +void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION; /* * Setup the hardware ready for the scheduler to take control. This generally @@ -333,6 +363,18 @@ portBASE_TYPE xPortStartScheduler( void ); */ void vPortEndScheduler( void ); +/* + * The structures and methods of manipulating the MPU are contained within the + * port layer. + * + * Fills the xMPUSettings structure with the memory region information + * contained in xRegions. + */ +#if( portUSING_MPU_WRAPPERS == 1 ) + struct xMEMORY_REGION; + void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned portSHORT usStackDepth ); +#endif + #ifdef __cplusplus } #endif diff --git a/Source/include/queue.h b/Source/include/queue.h index 6865240b2..8c176547b 100644 --- a/Source/include/queue.h +++ b/Source/include/queue.h @@ -3,14 +3,14 @@ This file is part of the FreeRTOS distribution. - FreeRTOS is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License (version 2) as published by the + FreeRTOS is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License (version 2) as published by the Free Software Foundation and modified by the FreeRTOS exception. **NOTE** The exception to the GPL is included to allow you to distribute a - combined work that includes FreeRTOS without being obliged to provide the - source code for proprietary components outside of the FreeRTOS kernel. - Alternative commercial license and support terms are also available upon - request. See the licensing section of http://www.FreeRTOS.org for full + combined work that includes FreeRTOS without being obliged to provide the + source code for proprietary components outside of the FreeRTOS kernel. + Alternative commercial license and support terms are also available upon + request. See the licensing section of http://www.FreeRTOS.org for full license details. FreeRTOS is distributed in the hope that it will be useful, but WITHOUT @@ -24,10 +24,10 @@ *************************************************************************** - * * - * Looking for a quick start? Then check out the FreeRTOS eBook! * - * See http://www.FreeRTOS.org/Documentation for details * - * * + * * + * Looking for a quick start? Then check out the FreeRTOS eBook! * + * See http://www.FreeRTOS.org/Documentation for details * + * * *************************************************************************** 1 tab == 4 spaces! @@ -58,8 +58,14 @@ #ifdef __cplusplus extern "C" { #endif + + +#include "mpu_wrappers.h" + + typedef void * xQueueHandle; + /* For internal use only. */ #define queueSEND_TO_BACK ( 0 ) #define queueSEND_TO_FRONT ( 1 ) @@ -69,9 +75,9 @@ typedef void * xQueueHandle; * queue. h *
  xQueueHandle xQueueCreate(
-                              unsigned portBASE_TYPE uxQueueLength,
-                              unsigned portBASE_TYPE uxItemSize
-                          );
+							  unsigned portBASE_TYPE uxQueueLength,
+							  unsigned portBASE_TYPE uxItemSize
+						  );
  * 
* * Creates a new queue instance. This allocates the storage required by the @@ -92,30 +98,30 @@ typedef void * xQueueHandle;
  struct AMessage
  {
-    portCHAR ucMessageID;
-    portCHAR ucData[ 20 ];
+	portCHAR ucMessageID;
+	portCHAR ucData[ 20 ];
  };
 
  void vATask( void *pvParameters )
  {
  xQueueHandle xQueue1, xQueue2;
 
-    // Create a queue capable of containing 10 unsigned long values.
-    xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );
-    if( xQueue1 == 0 )
-    {
-        // Queue was not created and must not be used.
-    }
-
-    // Create a queue capable of containing 10 pointers to AMessage structures.
-    // These should be passed by pointer as they contain a lot of data.
-    xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
-    if( xQueue2 == 0 )
-    {
-        // Queue was not created and must not be used.
-    }
-
-    // ... Rest of task code.
+	// Create a queue capable of containing 10 unsigned long values.
+	xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );
+	if( xQueue1 == 0 )
+	{
+		// Queue was not created and must not be used.
+	}
+
+	// Create a queue capable of containing 10 pointers to AMessage structures.
+	// These should be passed by pointer as they contain a lot of data.
+	xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
+	if( xQueue2 == 0 )
+	{
+		// Queue was not created and must not be used.
+	}
+
+	// ... Rest of task code.
  }
  
* \defgroup xQueueCreate xQueueCreate @@ -127,10 +133,10 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA * queue. h *
  portBASE_TYPE xQueueSendToToFront(
-                                   xQueueHandle xQueue,
-                                   const void * pvItemToQueue,
-                                   portTickType xTicksToWait
-                               );
+								   xQueueHandle	xQueue,
+								   const	void	*	pvItemToQueue,
+								   portTickType	xTicksToWait
+							   );
  * 
* * This is a macro that calls xQueueGenericSend(). @@ -150,7 +156,7 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA * @param xTicksToWait The maximum amount of time the task should block * waiting for space to become available on the queue, should it already * be full. The call will return immediately if this is set to 0 and the - * queue is full. The time is defined in tick periods so the constant + * queue is full. The time is defined in tick periods so the constant * portTICK_RATE_MS should be used to convert to real time if this is required. * * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL. @@ -159,8 +165,8 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
  struct AMessage
  {
-    portCHAR ucMessageID;
-    portCHAR ucData[ 20 ];
+	portCHAR ucMessageID;
+	portCHAR ucData[ 20 ];
  } xMessage;
 
  unsigned portLONG ulVar = 10UL;
@@ -170,32 +176,32 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
  xQueueHandle xQueue1, xQueue2;
  struct AMessage *pxMessage;
 
-    // Create a queue capable of containing 10 unsigned long values.
-    xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );
-
-    // Create a queue capable of containing 10 pointers to AMessage structures.
-    // These should be passed by pointer as they contain a lot of data.
-    xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
-
-    // ...
-
-    if( xQueue1 != 0 )
-    {
-        // Send an unsigned long.  Wait for 10 ticks for space to become
-        // available if necessary.
-        if( xQueueSendToFront( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS )
-        {
-            // Failed to post the message, even after 10 ticks.
-        }
-    }
-
-    if( xQueue2 != 0 )
-    {
-        // Send a pointer to a struct AMessage object.  Don't block if the
-        // queue is already full.
-        pxMessage = & xMessage;
-        xQueueSendToFront( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 );
-    }
+	// Create a queue capable of containing 10 unsigned long values.
+	xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );
+
+	// Create a queue capable of containing 10 pointers to AMessage structures.
+	// These should be passed by pointer as they contain a lot of data.
+	xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
+
+	// ...
+
+	if( xQueue1 != 0 )
+	{
+		// Send an unsigned long.  Wait for 10 ticks for space to become
+		// available if necessary.
+		if( xQueueSendToFront( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS )
+		{
+			// Failed to post the message, even after 10 ticks.
+		}
+	}
+
+	if( xQueue2 != 0 )
+	{
+		// Send a pointer to a struct AMessage object.  Don't block if the
+		// queue is already full.
+		pxMessage = & xMessage;
+		xQueueSendToFront( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 );
+	}
 
 	// ... Rest of task code.
  }
@@ -209,10 +215,10 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
  * queue. h
  * 
  portBASE_TYPE xQueueSendToBack(
-                                   xQueueHandle xQueue,
-                                   const void * pvItemToQueue,
-                                   portTickType xTicksToWait
-                               );
+								   xQueueHandle	xQueue,
+								   const	void	*	pvItemToQueue,
+								   portTickType	xTicksToWait
+							   );
  * 
* * This is a macro that calls xQueueGenericSend(). @@ -232,7 +238,7 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA * @param xTicksToWait The maximum amount of time the task should block * waiting for space to become available on the queue, should it already * be full. The call will return immediately if this is set to 0 and the queue - * is full. The time is defined in tick periods so the constant + * is full. The time is defined in tick periods so the constant * portTICK_RATE_MS should be used to convert to real time if this is required. * * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL. @@ -241,8 +247,8 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
  struct AMessage
  {
-    portCHAR ucMessageID;
-    portCHAR ucData[ 20 ];
+	portCHAR ucMessageID;
+	portCHAR ucData[ 20 ];
  } xMessage;
 
  unsigned portLONG ulVar = 10UL;
@@ -252,32 +258,32 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
  xQueueHandle xQueue1, xQueue2;
  struct AMessage *pxMessage;
 
-    // Create a queue capable of containing 10 unsigned long values.
-    xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );
-
-    // Create a queue capable of containing 10 pointers to AMessage structures.
-    // These should be passed by pointer as they contain a lot of data.
-    xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
-
-    // ...
-
-    if( xQueue1 != 0 )
-    {
-        // Send an unsigned long.  Wait for 10 ticks for space to become
-        // available if necessary.
-        if( xQueueSendToBack( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS )
-        {
-            // Failed to post the message, even after 10 ticks.
-        }
-    }
-
-    if( xQueue2 != 0 )
-    {
-        // Send a pointer to a struct AMessage object.  Don't block if the
-        // queue is already full.
-        pxMessage = & xMessage;
-        xQueueSendToBack( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 );
-    }
+	// Create a queue capable of containing 10 unsigned long values.
+	xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );
+
+	// Create a queue capable of containing 10 pointers to AMessage structures.
+	// These should be passed by pointer as they contain a lot of data.
+	xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
+
+	// ...
+
+	if( xQueue1 != 0 )
+	{
+		// Send an unsigned long.  Wait for 10 ticks for space to become
+		// available if necessary.
+		if( xQueueSendToBack( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS )
+		{
+			// Failed to post the message, even after 10 ticks.
+		}
+	}
+
+	if( xQueue2 != 0 )
+	{
+		// Send a pointer to a struct AMessage object.  Don't block if the
+		// queue is already full.
+		pxMessage = & xMessage;
+		xQueueSendToBack( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 );
+	}
 
 	// ... Rest of task code.
  }
@@ -291,10 +297,10 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
  * queue. h
  * 
  portBASE_TYPE xQueueSend(
-                              xQueueHandle xQueue,
-                              const void * pvItemToQueue,
-                              portTickType xTicksToWait
-                         );
+							  xQueueHandle xQueue,
+							  const void * pvItemToQueue,
+							  portTickType xTicksToWait
+						 );
  * 
* * This is a macro that calls xQueueGenericSend(). It is included for @@ -316,7 +322,7 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA * @param xTicksToWait The maximum amount of time the task should block * waiting for space to become available on the queue, should it already * be full. The call will return immediately if this is set to 0 and the - * queue is full. The time is defined in tick periods so the constant + * queue is full. The time is defined in tick periods so the constant * portTICK_RATE_MS should be used to convert to real time if this is required. * * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL. @@ -325,8 +331,8 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
  struct AMessage
  {
-    portCHAR ucMessageID;
-    portCHAR ucData[ 20 ];
+	portCHAR ucMessageID;
+	portCHAR ucData[ 20 ];
  } xMessage;
 
  unsigned portLONG ulVar = 10UL;
@@ -336,32 +342,32 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
  xQueueHandle xQueue1, xQueue2;
  struct AMessage *pxMessage;
 
-    // Create a queue capable of containing 10 unsigned long values.
-    xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );
-
-    // Create a queue capable of containing 10 pointers to AMessage structures.
-    // These should be passed by pointer as they contain a lot of data.
-    xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
-
-    // ...
-
-    if( xQueue1 != 0 )
-    {
-        // Send an unsigned long.  Wait for 10 ticks for space to become
-        // available if necessary.
-        if( xQueueSend( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS )
-        {
-            // Failed to post the message, even after 10 ticks.
-        }
-    }
-
-    if( xQueue2 != 0 )
-    {
-        // Send a pointer to a struct AMessage object.  Don't block if the
-        // queue is already full.
-        pxMessage = & xMessage;
-        xQueueSend( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 );
-    }
+	// Create a queue capable of containing 10 unsigned long values.
+	xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );
+
+	// Create a queue capable of containing 10 pointers to AMessage structures.
+	// These should be passed by pointer as they contain a lot of data.
+	xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
+
+	// ...
+
+	if( xQueue1 != 0 )
+	{
+		// Send an unsigned long.  Wait for 10 ticks for space to become
+		// available if necessary.
+		if( xQueueSend( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS )
+		{
+			// Failed to post the message, even after 10 ticks.
+		}
+	}
+
+	if( xQueue2 != 0 )
+	{
+		// Send a pointer to a struct AMessage object.  Don't block if the
+		// queue is already full.
+		pxMessage = & xMessage;
+		xQueueSend( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 );
+	}
 
 	// ... Rest of task code.
  }
@@ -400,7 +406,7 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
  * @param xTicksToWait The maximum amount of time the task should block
  * waiting for space to become available on the queue, should it already
  * be full.  The call will return immediately if this is set to 0 and the
- * queue is full.  The time is defined in tick periods so the constant 
+ * queue is full.  The time is defined in tick periods so the constant
  * portTICK_RATE_MS should be used to convert to real time if this is required.
  *
  * @param xCopyPosition Can take the value queueSEND_TO_BACK to place the
@@ -413,8 +419,8 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
    
  struct AMessage
  {
-    portCHAR ucMessageID;
-    portCHAR ucData[ 20 ];
+	portCHAR ucMessageID;
+	portCHAR ucData[ 20 ];
  } xMessage;
 
  unsigned portLONG ulVar = 10UL;
@@ -424,32 +430,32 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
  xQueueHandle xQueue1, xQueue2;
  struct AMessage *pxMessage;
 
-    // Create a queue capable of containing 10 unsigned long values.
-    xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );
-
-    // Create a queue capable of containing 10 pointers to AMessage structures.
-    // These should be passed by pointer as they contain a lot of data.
-    xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
-
-    // ...
-
-    if( xQueue1 != 0 )
-    {
-        // Send an unsigned long.  Wait for 10 ticks for space to become
-        // available if necessary.
-        if( xQueueGenericSend( xQueue1, ( void * ) &ulVar, ( portTickType ) 10, queueSEND_TO_BACK ) != pdPASS )
-        {
-            // Failed to post the message, even after 10 ticks.
-        }
-    }
-
-    if( xQueue2 != 0 )
-    {
-        // Send a pointer to a struct AMessage object.  Don't block if the
-        // queue is already full.
-        pxMessage = & xMessage;
-        xQueueGenericSend( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0, queueSEND_TO_BACK );
-    }
+	// Create a queue capable of containing 10 unsigned long values.
+	xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );
+
+	// Create a queue capable of containing 10 pointers to AMessage structures.
+	// These should be passed by pointer as they contain a lot of data.
+	xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
+
+	// ...
+
+	if( xQueue1 != 0 )
+	{
+		// Send an unsigned long.  Wait for 10 ticks for space to become
+		// available if necessary.
+		if( xQueueGenericSend( xQueue1, ( void * ) &ulVar, ( portTickType ) 10, queueSEND_TO_BACK ) != pdPASS )
+		{
+			// Failed to post the message, even after 10 ticks.
+		}
+	}
+
+	if( xQueue2 != 0 )
+	{
+		// Send a pointer to a struct AMessage object.  Don't block if the
+		// queue is already full.
+		pxMessage = & xMessage;
+		xQueueGenericSend( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0, queueSEND_TO_BACK );
+	}
 
 	// ... Rest of task code.
  }
@@ -463,10 +469,10 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
  * queue. h
  * 
  portBASE_TYPE xQueuePeek(
-                             xQueueHandle xQueue,
-                             void *pvBuffer,
-                             portTickType xTicksToWait
-                         );
+ xQueueHandle xQueue, + void *pvBuffer, + portTickType xTicksToWait + );
* * This is a macro that calls the xQueueGenericReceive() function. * @@ -488,7 +494,7 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const * * @param xTicksToWait The maximum amount of time the task should block * waiting for an item to receive should the queue be empty at the time - * of the call. The time is defined in tick periods so the constant + * of the call. The time is defined in tick periods so the constant * portTICK_RATE_MS should be used to convert to real time if this is required. * xQueuePeek() will return immediately if xTicksToWait is 0 and the queue * is empty. @@ -500,8 +506,8 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
  struct AMessage
  {
-    portCHAR ucMessageID;
-    portCHAR ucData[ 20 ];
+	portCHAR ucMessageID;
+	portCHAR ucData[ 20 ];
  } xMessage;
 
  xQueueHandle xQueue;
@@ -511,20 +517,20 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
  {
  struct AMessage *pxMessage;
 
-    // Create a queue capable of containing 10 pointers to AMessage structures.
-    // These should be passed by pointer as they contain a lot of data.
-    xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );
-    if( xQueue == 0 )
-    {
-        // Failed to create the queue.
-    }
+	// Create a queue capable of containing 10 pointers to AMessage structures.
+	// These should be passed by pointer as they contain a lot of data.
+	xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );
+	if( xQueue == 0 )
+	{
+		// Failed to create the queue.
+	}
 
-    // ...
+	// ...
 
-    // Send a pointer to a struct AMessage object.  Don't block if the
-    // queue is already full.
-    pxMessage = & xMessage;
-    xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 );
+	// Send a pointer to a struct AMessage object.  Don't block if the
+	// queue is already full.
+	pxMessage = & xMessage;
+	xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 );
 
 	// ... Rest of task code.
  }
@@ -534,16 +540,16 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
  {
  struct AMessage *pxRxedMessage;
 
-    if( xQueue != 0 )
-    {
-        // Peek a message on the created queue.  Block for 10 ticks if a
-        // message is not immediately available.
-        if( xQueuePeek( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) )
-        {
-            // pcRxedMessage now points to the struct AMessage variable posted
-            // by vATask, but the item still remains on the queue.
-        }
-    }
+	if( xQueue != 0 )
+	{
+		// Peek a message on the created queue.  Block for 10 ticks if a
+		// message is not immediately available.
+		if( xQueuePeek( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) )
+		{
+			// pcRxedMessage now points to the struct AMessage variable posted
+			// by vATask, but the item still remains on the queue.
+		}
+	}
 
 	// ... Rest of task code.
  }
@@ -557,10 +563,10 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
  * queue. h
  * 
  portBASE_TYPE xQueueReceive(
-                                 xQueueHandle xQueue,
-                                 void *pvBuffer,
-                                 portTickType xTicksToWait
-                            );
+ xQueueHandle xQueue, + void *pvBuffer, + portTickType xTicksToWait + );
* * This is a macro that calls the xQueueGenericReceive() function. * @@ -581,9 +587,9 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const * * @param xTicksToWait The maximum amount of time the task should block * waiting for an item to receive should the queue be empty at the time - * of the call. xQueueReceive() will return immediately if xTicksToWait - * is zero and the queue is empty. The time is defined in tick periods so the - * constant portTICK_RATE_MS should be used to convert to real time if this is + * of the call. xQueueReceive() will return immediately if xTicksToWait + * is zero and the queue is empty. The time is defined in tick periods so the + * constant portTICK_RATE_MS should be used to convert to real time if this is * required. * * @return pdTRUE if an item was successfully received from the queue, @@ -593,8 +599,8 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
  struct AMessage
  {
-    portCHAR ucMessageID;
-    portCHAR ucData[ 20 ];
+	portCHAR ucMessageID;
+	portCHAR ucData[ 20 ];
  } xMessage;
 
  xQueueHandle xQueue;
@@ -604,20 +610,20 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
  {
  struct AMessage *pxMessage;
 
-    // Create a queue capable of containing 10 pointers to AMessage structures.
-    // These should be passed by pointer as they contain a lot of data.
-    xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );
-    if( xQueue == 0 )
-    {
-        // Failed to create the queue.
-    }
+	// Create a queue capable of containing 10 pointers to AMessage structures.
+	// These should be passed by pointer as they contain a lot of data.
+	xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );
+	if( xQueue == 0 )
+	{
+		// Failed to create the queue.
+	}
 
-    // ...
+	// ...
 
-    // Send a pointer to a struct AMessage object.  Don't block if the
-    // queue is already full.
-    pxMessage = & xMessage;
-    xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 );
+	// Send a pointer to a struct AMessage object.  Don't block if the
+	// queue is already full.
+	pxMessage = & xMessage;
+	xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 );
 
 	// ... Rest of task code.
  }
@@ -627,16 +633,16 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
  {
  struct AMessage *pxRxedMessage;
 
-    if( xQueue != 0 )
-    {
-        // Receive a message on the created queue.  Block for 10 ticks if a
-        // message is not immediately available.
-        if( xQueueReceive( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) )
-        {
-            // pcRxedMessage now points to the struct AMessage variable posted
-            // by vATask.
-        }
-    }
+	if( xQueue != 0 )
+	{
+		// Receive a message on the created queue.  Block for 10 ticks if a
+		// message is not immediately available.
+		if( xQueueReceive( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) )
+		{
+			// pcRxedMessage now points to the struct AMessage variable posted
+			// by vATask.
+		}
+	}
 
 	// ... Rest of task code.
  }
@@ -651,11 +657,11 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
  * queue. h
  * 
  portBASE_TYPE xQueueGenericReceive(
-                                       xQueueHandle xQueue,
-                                       void *pvBuffer,
-                                       portTickType xTicksToWait
-                                       portBASE_TYPE xJustPeek
-                                    );
+ xQueueHandle xQueue, + void *pvBuffer, + portTickType xTicksToWait + portBASE_TYPE xJustPeek + );
* * It is preferred that the macro xQueueReceive() be used rather than calling * this function directly. @@ -675,7 +681,7 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const * * @param xTicksToWait The maximum amount of time the task should block * waiting for an item to receive should the queue be empty at the time - * of the call. The time is defined in tick periods so the constant + * of the call. The time is defined in tick periods so the constant * portTICK_RATE_MS should be used to convert to real time if this is required. * xQueueGenericReceive() will return immediately if the queue is empty and * xTicksToWait is 0. @@ -692,8 +698,8 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
  struct AMessage
  {
-    portCHAR ucMessageID;
-    portCHAR ucData[ 20 ];
+	portCHAR ucMessageID;
+	portCHAR ucData[ 20 ];
  } xMessage;
 
  xQueueHandle xQueue;
@@ -703,20 +709,20 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
  {
  struct AMessage *pxMessage;
 
-    // Create a queue capable of containing 10 pointers to AMessage structures.
-    // These should be passed by pointer as they contain a lot of data.
-    xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );
-    if( xQueue == 0 )
-    {
-        // Failed to create the queue.
-    }
+	// Create a queue capable of containing 10 pointers to AMessage structures.
+	// These should be passed by pointer as they contain a lot of data.
+	xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );
+	if( xQueue == 0 )
+	{
+		// Failed to create the queue.
+	}
 
-    // ...
+	// ...
 
-    // Send a pointer to a struct AMessage object.  Don't block if the
-    // queue is already full.
-    pxMessage = & xMessage;
-    xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 );
+	// Send a pointer to a struct AMessage object.  Don't block if the
+	// queue is already full.
+	pxMessage = & xMessage;
+	xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 );
 
 	// ... Rest of task code.
  }
@@ -726,16 +732,16 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
  {
  struct AMessage *pxRxedMessage;
 
-    if( xQueue != 0 )
-    {
-        // Receive a message on the created queue.  Block for 10 ticks if a
-        // message is not immediately available.
-        if( xQueueGenericReceive( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) )
-        {
-            // pcRxedMessage now points to the struct AMessage variable posted
-            // by vATask.
-        }
-    }
+	if( xQueue != 0 )
+	{
+		// Receive a message on the created queue.  Block for 10 ticks if a
+		// message is not immediately available.
+		if( xQueueGenericReceive( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) )
+		{
+			// pcRxedMessage now points to the struct AMessage variable posted
+			// by vATask.
+		}
+	}
 
 	// ... Rest of task code.
  }
@@ -778,10 +784,10 @@ void vQueueDelete( xQueueHandle xQueue );
  * queue. h
  * 
  portBASE_TYPE xQueueSendToFrontFromISR(
-                                         xQueueHandle pxQueue,
-                                         const void *pvItemToQueue,
-                                         portBASE_TYPE *pxHigherPriorityTaskWoken
-                                      );
+										 xQueueHandle pxQueue,
+										 const void *pvItemToQueue,
+										 portBASE_TYPE *pxHigherPriorityTaskWoken
+									  );
  
* * This is a macro that calls xQueueGenericSendFromISR(). @@ -817,25 +823,25 @@ void vQueueDelete( xQueueHandle xQueue ); portCHAR cIn; portBASE_TYPE xHigherPrioritTaskWoken; - // We have not woken a task at the start of the ISR. - xHigherPriorityTaskWoken = pdFALSE; + // We have not woken a task at the start of the ISR. + xHigherPriorityTaskWoken = pdFALSE; - // Loop until the buffer is empty. - do - { - // Obtain a byte from the buffer. - cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); + // Loop until the buffer is empty. + do + { + // Obtain a byte from the buffer. + cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); - // Post the byte. - xQueueSendToFrontFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken ); + // Post the byte. + xQueueSendToFrontFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken ); - } while( portINPUT_BYTE( BUFFER_COUNT ) ); + } while( portINPUT_BYTE( BUFFER_COUNT ) ); - // Now the buffer is empty we can switch context if necessary. - if( xHigherPriorityTaskWoken ) - { - taskYIELD (); - } + // Now the buffer is empty we can switch context if necessary. + if( xHigherPriorityTaskWoken ) + { + taskYIELD (); + } }
* @@ -849,10 +855,10 @@ void vQueueDelete( xQueueHandle xQueue ); * queue. h *
  portBASE_TYPE xQueueSendToBackFromISR(
-                                         xQueueHandle pxQueue,
-                                         const void *pvItemToQueue,
-                                         portBASE_TYPE *pxHigherPriorityTaskWoken
-                                      );
+										 xQueueHandle pxQueue,
+										 const void *pvItemToQueue,
+										 portBASE_TYPE *pxHigherPriorityTaskWoken
+									  );
  
* * This is a macro that calls xQueueGenericSendFromISR(). @@ -888,25 +894,25 @@ void vQueueDelete( xQueueHandle xQueue ); portCHAR cIn; portBASE_TYPE xHigherPriorityTaskWoken; - // We have not woken a task at the start of the ISR. - xHigherPriorityTaskWoken = pdFALSE; + // We have not woken a task at the start of the ISR. + xHigherPriorityTaskWoken = pdFALSE; - // Loop until the buffer is empty. - do - { - // Obtain a byte from the buffer. - cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); + // Loop until the buffer is empty. + do + { + // Obtain a byte from the buffer. + cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); - // Post the byte. - xQueueSendToBackFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken ); + // Post the byte. + xQueueSendToBackFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken ); - } while( portINPUT_BYTE( BUFFER_COUNT ) ); + } while( portINPUT_BYTE( BUFFER_COUNT ) ); - // Now the buffer is empty we can switch context if necessary. - if( xHigherPriorityTaskWoken ) - { - taskYIELD (); - } + // Now the buffer is empty we can switch context if necessary. + if( xHigherPriorityTaskWoken ) + { + taskYIELD (); + } }
* @@ -919,10 +925,10 @@ void vQueueDelete( xQueueHandle xQueue ); * queue. h *
  portBASE_TYPE xQueueSendFromISR(
-                                     xQueueHandle pxQueue,
-                                     const void *pvItemToQueue,
-                                     portBASE_TYPE *pxHigherPriorityTaskWoken
-                                );
+									 xQueueHandle pxQueue,
+									 const void *pvItemToQueue,
+									 portBASE_TYPE *pxHigherPriorityTaskWoken
+								);
  
* * This is a macro that calls xQueueGenericSendFromISR(). It is included @@ -961,26 +967,26 @@ void vQueueDelete( xQueueHandle xQueue ); portCHAR cIn; portBASE_TYPE xHigherPriorityTaskWoken; - // We have not woken a task at the start of the ISR. - xHigherPriorityTaskWoken = pdFALSE; + // We have not woken a task at the start of the ISR. + xHigherPriorityTaskWoken = pdFALSE; - // Loop until the buffer is empty. - do - { - // Obtain a byte from the buffer. - cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); + // Loop until the buffer is empty. + do + { + // Obtain a byte from the buffer. + cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); - // Post the byte. - xQueueSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken ); + // Post the byte. + xQueueSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken ); - } while( portINPUT_BYTE( BUFFER_COUNT ) ); + } while( portINPUT_BYTE( BUFFER_COUNT ) ); - // Now the buffer is empty we can switch context if necessary. - if( xHigherPriorityTaskWoken ) - { - // Actual macro used here is port specific. - taskYIELD_FROM_ISR (); - } + // Now the buffer is empty we can switch context if necessary. + if( xHigherPriorityTaskWoken ) + { + // Actual macro used here is port specific. + taskYIELD_FROM_ISR (); + } }
* @@ -993,11 +999,11 @@ void vQueueDelete( xQueueHandle xQueue ); * queue. h *
  portBASE_TYPE xQueueGenericSendFromISR(
-                                           xQueueHandle pxQueue,
-                                           const void *pvItemToQueue,
-                                           portBASE_TYPE *pxHigherPriorityTaskWoken,
-										   portBASE_TYPE xCopyPosition
-                                       );
+										   xQueueHandle	pxQueue,
+										   const	void	*pvItemToQueue,
+										   portBASE_TYPE	*pxHigherPriorityTaskWoken,
+										   portBASE_TYPE	xCopyPosition
+									   );
  
* * It is preferred that the macros xQueueSendFromISR(), @@ -1039,26 +1045,26 @@ void vQueueDelete( xQueueHandle xQueue ); portCHAR cIn; portBASE_TYPE xHigherPriorityTaskWokenByPost; - // We have not woken a task at the start of the ISR. - xHigherPriorityTaskWokenByPost = pdFALSE; + // We have not woken a task at the start of the ISR. + xHigherPriorityTaskWokenByPost = pdFALSE; - // Loop until the buffer is empty. - do - { - // Obtain a byte from the buffer. - cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); + // Loop until the buffer is empty. + do + { + // Obtain a byte from the buffer. + cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); - // Post each byte. - xQueueGenericSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWokenByPost, queueSEND_TO_BACK ); + // Post each byte. + xQueueGenericSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWokenByPost, queueSEND_TO_BACK ); - } while( portINPUT_BYTE( BUFFER_COUNT ) ); + } while( portINPUT_BYTE( BUFFER_COUNT ) ); - // Now the buffer is empty we can switch context if necessary. Note that the - // name of the yield function required is port specific. - if( xHigherPriorityTaskWokenByPost ) - { - taskYIELD_YIELD_FROM_ISR(); - } + // Now the buffer is empty we can switch context if necessary. Note that the + // name of the yield function required is port specific. + if( xHigherPriorityTaskWokenByPost ) + { + taskYIELD_YIELD_FROM_ISR(); + } }
* @@ -1071,10 +1077,10 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * queue. h *
  portBASE_TYPE xQueueReceiveFromISR(
-                                       xQueueHandle pxQueue,
-                                       void *pvBuffer,
-                                       portBASE_TYPE *pxTaskWoken
-                                   );
+									   xQueueHandle	pxQueue,
+									   void	*pvBuffer,
+									   portBASE_TYPE	*pxTaskWoken
+								   );
  * 
* * Receive an item from a queue. It is safe to use this function from within an @@ -1105,27 +1111,27 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void portCHAR cValueToPost; const portTickType xBlockTime = ( portTickType )0xff; - // Create a queue capable of containing 10 characters. - xQueue = xQueueCreate( 10, sizeof( portCHAR ) ); - if( xQueue == 0 ) - { - // Failed to create the queue. - } + // Create a queue capable of containing 10 characters. + xQueue = xQueueCreate( 10, sizeof( portCHAR ) ); + if( xQueue == 0 ) + { + // Failed to create the queue. + } - // ... + // ... - // Post some characters that will be used within an ISR. If the queue - // is full then this task will block for xBlockTime ticks. - cValueToPost = 'a'; - xQueueSend( xQueue, ( void * ) &cValueToPost, xBlockTime ); - cValueToPost = 'b'; - xQueueSend( xQueue, ( void * ) &cValueToPost, xBlockTime ); + // Post some characters that will be used within an ISR. If the queue + // is full then this task will block for xBlockTime ticks. + cValueToPost = 'a'; + xQueueSend( xQueue, ( void * ) &cValueToPost, xBlockTime ); + cValueToPost = 'b'; + xQueueSend( xQueue, ( void * ) &cValueToPost, xBlockTime ); - // ... keep posting characters ... this task may block when the queue - // becomes full. + // ... keep posting characters ... this task may block when the queue + // becomes full. - cValueToPost = 'c'; - xQueueSend( xQueue, ( void * ) &cValueToPost, xBlockTime ); + cValueToPost = 'c'; + xQueueSend( xQueue, ( void * ) &cValueToPost, xBlockTime ); } // ISR that outputs all the characters received on the queue. @@ -1134,21 +1140,21 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void portBASE_TYPE xTaskWokenByReceive = pdFALSE; portCHAR cRxedChar; - while( xQueueReceiveFromISR( xQueue, ( void * ) &cRxedChar, &xTaskWokenByReceive) ) - { - // A character was received. Output the character now. - vOutputCharacter( cRxedChar ); - - // If removing the character from the queue woke the task that was - // posting onto the queue cTaskWokenByReceive will have been set to - // pdTRUE. No matter how many times this loop iterates only one - // task will be woken. - } - - if( cTaskWokenByPost != ( portCHAR ) pdFALSE; - { - taskYIELD (); - } + while( xQueueReceiveFromISR( xQueue, ( void * ) &cRxedChar, &xTaskWokenByReceive) ) + { + // A character was received. Output the character now. + vOutputCharacter( cRxedChar ); + + // If removing the character from the queue woke the task that was + // posting onto the queue cTaskWokenByReceive will have been set to + // pdTRUE. No matter how many times this loop iterates only one + // task will be woken. + } + + if( cTaskWokenByPost != ( portCHAR ) pdFALSE; + { + taskYIELD (); + } } * \defgroup xQueueReceiveFromISR xQueueReceiveFromISR @@ -1165,17 +1171,17 @@ signed portBASE_TYPE xQueueIsQueueFullFromISR( const xQueueHandle pxQueue ); unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle pxQueue ); -/* +/* * xQueueAltGenericSend() is an alternative version of xQueueGenericSend(). * Likewise xQueueAltGenericReceive() is an alternative version of * xQueueGenericReceive(). * - * The source code that implements the alternative (Alt) API is much - * simpler because it executes everything from within a critical section. - * This is the approach taken by many other RTOSes, but FreeRTOS.org has the - * preferred fully featured API too. The fully featured API has more - * complex code that takes longer to execute, but makes much less use of - * critical sections. Therefore the alternative API sacrifices interrupt + * The source code that implements the alternative (Alt) API is much + * simpler because it executes everything from within a critical section. + * This is the approach taken by many other RTOSes, but FreeRTOS.org has the + * preferred fully featured API too. The fully featured API has more + * complex code that takes longer to execute, but makes much less use of + * critical sections. Therefore the alternative API sacrifices interrupt * responsiveness to gain execution speed, whereas the fully featured API * sacrifices execution speed to ensure better interrupt responsiveness. */ @@ -1217,14 +1223,14 @@ portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle xMutex ); /* * The registry is provided as a means for kernel aware debuggers to * locate queues, semaphores and mutexes. Call vQueueAddToRegistry() add - * a queue, semaphore or mutex handle to the registry if you want the handle - * to be available to a kernel aware debugger. If you are not using a kernel + * a queue, semaphore or mutex handle to the registry if you want the handle + * to be available to a kernel aware debugger. If you are not using a kernel * aware debugger then this function can be ignored. * * configQUEUE_REGISTRY_SIZE defines the maximum number of handles the - * registry can hold. configQUEUE_REGISTRY_SIZE must be greater than 0 + * registry can hold. configQUEUE_REGISTRY_SIZE must be greater than 0 * within FreeRTOSConfig.h for the registry to be available. Its value - * does not effect the number of queues, semaphores and mutexes that can be + * does not effect the number of queues, semaphores and mutexes that can be * created - just the number that the registry can hold. * * @param xQueue The handle of the queue being added to the registry. This