/*\r
- FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
-\r
- This file is part of the FreeRTOS.org distribution.\r
-\r
- FreeRTOS.org is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- FreeRTOS.org is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with FreeRTOS.org; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
-\r
- A special exception to the GPL can be applied should you wish to distribute\r
- a combined work that includes FreeRTOS.org, without being obliged to provide\r
- the source code for any proprietary components. See the licensing section\r
- of http://www.FreeRTOS.org for full details of how and when the exception\r
- can be applied.\r
-\r
- ***************************************************************************\r
- See http://www.FreeRTOS.org for documentation, latest information, license\r
- and contact details. Please ensure to read the configuration and relevant\r
- port sections of the online documentation.\r
- ***************************************************************************\r
+ FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * If you are: *\r
+ * *\r
+ * + New to FreeRTOS, *\r
+ * + Wanting to learn FreeRTOS or multitasking in general quickly *\r
+ * + Looking for basic training, *\r
+ * + Wanting to improve your FreeRTOS skills and productivity *\r
+ * *\r
+ * then take a look at the FreeRTOS books - available as PDF or paperback *\r
+ * *\r
+ * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ * A pdf reference manual is also available. Both are usually delivered *\r
+ * to your inbox within 20 minutes to two hours when purchased between 8am *\r
+ * and 8pm GMT (although please allow up to 24 hours in case of *\r
+ * exceptional circumstances). Thank you for your support! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+ ***NOTE*** The exception to the GPL is included to allow you to distribute\r
+ a combined work that includes FreeRTOS without being obliged to provide the\r
+ source code for proprietary components outside of the FreeRTOS kernel.\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ more details. You should have received a copy of the GNU General Public\r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+ by writing to Richard Barry, contact details for whom are available on the\r
+ FreeRTOS WEB site.\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
+ licensing and training services.\r
*/\r
+\r
#ifndef CO_ROUTINE_H\r
#define CO_ROUTINE_H\r
\r
+#ifndef INC_FREERTOS_H\r
+ #error "include FreeRTOS.h must appear in source files before include croutine.h"\r
+#endif\r
+\r
#include "list.h"\r
\r
-/* Used to hide the implementation of the co-routine control block. The \r
-control block structure however has to be included in the header due to \r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/* Used to hide the implementation of the co-routine control block. The\r
+control block structure however has to be included in the header due to\r
the macro implementation of the co-routine functionality. */\r
typedef void * xCoRoutineHandle;\r
\r
xListItem xEventListItem; /*< List item used to place the CRCB in event lists. */\r
unsigned portBASE_TYPE uxPriority; /*< The priority of the co-routine in relation to other co-routines. */\r
unsigned portBASE_TYPE uxIndex; /*< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */\r
- unsigned portSHORT uxState; /*< Used internally by the co-routine implementation. */\r
+ unsigned short uxState; /*< Used internally by the co-routine implementation. */\r
} corCRCB; /* Co-routine control block. Note must be identical in size down to uxPriority with tskTCB. */\r
\r
/**\r
unsigned portBASE_TYPE uxIndex\r
);</pre>\r
*\r
- * Create a new co-routine and add it to the list of co-routines that are \r
+ * Create a new co-routine and add it to the list of co-routines that are\r
* ready to run.\r
*\r
- * @param pxCoRoutineCode Pointer to the co-routine function. Co-routine \r
- * functions require special syntax - see the co-routine section of the WEB \r
+ * @param pxCoRoutineCode Pointer to the co-routine function. Co-routine\r
+ * functions require special syntax - see the co-routine section of the WEB\r
* documentation for more information.\r
*\r
- * @param uxPriority The priority with respect to other co-routines at which \r
+ * @param uxPriority The priority with respect to other co-routines at which\r
* the co-routine will run.\r
*\r
* @param uxIndex Used to distinguish between different co-routines that\r
// Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
// This may not be necessary for const variables.\r
static const char cLedToFlash[ 2 ] = { 5, 6 };\r
- static const portTickType xTimeToDelay[ 2 ] = { 200, 400 };\r
+ static const portTickType uxFlashRates[ 2 ] = { 200, 400 };\r
\r
// Must start every co-routine with a call to crSTART();\r
crSTART( xHandle );\r
for( uxIndex = 0; uxIndex < 2; uxIndex++ )\r
{\r
xCoRoutineCreate( vFlashCoRoutine, 0, uxIndex );\r
- } \r
+ }\r
}\r
</pre>\r
* \defgroup xCoRoutineCreate xCoRoutineCreate\r
* \ingroup Tasks\r
*/\r
-portBASE_TYPE xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, unsigned portBASE_TYPE uxPriority, unsigned portBASE_TYPE uxIndex );\r
+signed portBASE_TYPE xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, unsigned portBASE_TYPE uxPriority, unsigned portBASE_TYPE uxIndex );\r
\r
\r
/**\r
void vCoRoutineSchedule( void );</pre>\r
*\r
* Run a co-routine.\r
- * \r
+ *\r
* vCoRoutineSchedule() executes the highest priority co-routine that is able\r
* to run. The co-routine will execute until it either blocks, yields or is\r
- * preempted by a task. Co-routines execute cooperatively so one \r
+ * preempted by a task. Co-routines execute cooperatively so one\r
* co-routine cannot be preempted by another, but can be preempted by a task.\r
*\r
- * If an application comprises of both tasks and co-routines then \r
- * vCoRoutineSchedule should be called from the idle task (in an idle task \r
+ * If an application comprises of both tasks and co-routines then\r
+ * vCoRoutineSchedule should be called from the idle task (in an idle task\r
* hook).\r
*\r
* Example usage:\r
vCoRoutineSchedule();\r
}\r
\r
- // Alternatively, if you do not require any other part of the idle task to \r
+ // Alternatively, if you do not require any other part of the idle task to\r
// execute, the idle task hook can call vCoRoutineScheduler() within an\r
// infinite loop.\r
void vApplicationIdleHook( void )\r
void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )\r
{\r
// Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
- static portLONG ulAVariable;\r
+ static long ulAVariable;\r
\r
// Must start every co-routine with a call to crSTART();\r
crSTART( xHandle );\r
* \defgroup crSTART crSTART\r
* \ingroup Tasks\r
*/\r
-#define crSTART( pxCRCB ) switch( ( ( corCRCB * )pxCRCB )->uxState ) { case 0:\r
+#define crSTART( pxCRCB ) switch( ( ( corCRCB * )( pxCRCB ) )->uxState ) { case 0:\r
\r
/**\r
* croutine. h\r
void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )\r
{\r
// Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
- static portLONG ulAVariable;\r
+ static long ulAVariable;\r
\r
// Must start every co-routine with a call to crSTART();\r
crSTART( xHandle );\r
#define crEND() }\r
\r
/*\r
- * These macros are intended for internal use by the co-routine implementation \r
+ * These macros are intended for internal use by the co-routine implementation\r
* only. The macros should not be used directly by application writers.\r
*/\r
-#define crSET_STATE0( xHandle ) ( ( corCRCB * )xHandle)->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):\r
-#define crSET_STATE1( xHandle ) ( ( corCRCB * )xHandle)->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):\r
+#define crSET_STATE0( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):\r
+#define crSET_STATE1( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):\r
\r
/**\r
* croutine. h\r
* @param xHandle The handle of the co-routine to delay. This is the xHandle\r
* parameter of the co-routine function.\r
*\r
- * @param xTickToDelay The number of ticks that the co-routine should delay \r
- * for. The actual amount of time this equates to is defined by \r
+ * @param xTickToDelay The number of ticks that the co-routine should delay\r
+ * for. The actual amount of time this equates to is defined by\r
* configTICK_RATE_HZ (set in FreeRTOSConfig.h). The constant portTICK_RATE_MS\r
* can be used to convert ticks to milliseconds.\r
*\r
* \ingroup Tasks\r
*/\r
#define crDELAY( xHandle, xTicksToDelay ) \\r
- if( xTicksToDelay > 0 ) \\r
+ if( ( xTicksToDelay ) > 0 ) \\r
{ \\r
- vCoRoutineAddToDelayedList( xTicksToDelay, NULL ); \\r
+ vCoRoutineAddToDelayedList( ( xTicksToDelay ), NULL ); \\r
} \\r
- crSET_STATE0( xHandle );\r
+ crSET_STATE0( ( xHandle ) );\r
\r
/**\r
* <pre>\r
- crQUEUE_SEND( \r
- xCoRoutineHandle xHandle, \r
- xQueueHandle pxQueue, \r
- void *pvItemToQueue, \r
- portTickType xTicksToWait, \r
- portBASE_TYPE *pxResult \r
+ crQUEUE_SEND(\r
+ xCoRoutineHandle xHandle,\r
+ xQueueHandle pxQueue,\r
+ void *pvItemToQueue,\r
+ portTickType xTicksToWait,\r
+ portBASE_TYPE *pxResult\r
)</pre>\r
*\r
- * The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine \r
- * equivalent to the xQueueSend() and xQueueReceive() functions used by tasks. \r
+ * The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine\r
+ * equivalent to the xQueueSend() and xQueueReceive() functions used by tasks.\r
*\r
- * crQUEUE_SEND and crQUEUE_RECEIVE can only be used from a co-routine whereas \r
+ * crQUEUE_SEND and crQUEUE_RECEIVE can only be used from a co-routine whereas\r
* xQueueSend() and xQueueReceive() can only be used from tasks.\r
*\r
* crQUEUE_SEND can only be called from the co-routine function itself - not\r
* from within a function called by the co-routine function. This is because\r
* co-routines do not maintain their own stack.\r
*\r
- * See the co-routine section of the WEB documentation for information on \r
- * passing data between tasks and co-routines and between ISR's and \r
+ * See the co-routine section of the WEB documentation for information on\r
+ * passing data between tasks and co-routines and between ISR's and\r
* co-routines.\r
*\r
* @param xHandle The handle of the calling co-routine. This is the xHandle\r
* parameter of the co-routine function.\r
*\r
- * @param pxQueue The handle of the queue on which the data will be posted. \r
- * The handle is obtained as the return value when the queue is created using \r
+ * @param pxQueue The handle of the queue on which the data will be posted.\r
+ * The handle is obtained as the return value when the queue is created using\r
* the xQueueCreate() API function.\r
*\r
* @param pvItemToQueue A pointer to the data being posted onto the queue.\r
* created. This number of bytes is copied from pvItemToQueue into the queue\r
* itself.\r
*\r
- * @param xTickToDelay The number of ticks that the co-routine should block \r
+ * @param xTickToDelay The number of ticks that the co-routine should block\r
* to wait for space to become available on the queue, should space not be\r
- * available immediately. The actual amount of time this equates to is defined \r
- * by configTICK_RATE_HZ (set in FreeRTOSConfig.h). The constant \r
+ * available immediately. The actual amount of time this equates to is defined\r
+ * by configTICK_RATE_HZ (set in FreeRTOSConfig.h). The constant\r
* portTICK_RATE_MS can be used to convert ticks to milliseconds (see example\r
* below).\r
*\r
* @param pxResult The variable pointed to by pxResult will be set to pdPASS if\r
- * data was successfully posted onto the queue, otherwise it will be set to an \r
+ * data was successfully posted onto the queue, otherwise it will be set to an\r
* error defined within ProjDefs.h.\r
*\r
* Example usage:\r
\r
// Increment the number to be posted onto the queue.\r
xNumberToPost++;\r
- \r
+\r
// Delay for 100 ticks.\r
crDELAY( xHandle, 100 );\r
}\r
*/\r
#define crQUEUE_SEND( xHandle, pxQueue, pvItemToQueue, xTicksToWait, pxResult ) \\r
{ \\r
- *pxResult = xQueueCRSend( pxQueue, pvItemToQueue, xTicksToWait ); \\r
+ *( pxResult ) = xQueueCRSend( ( pxQueue) , ( pvItemToQueue) , ( xTicksToWait ) ); \\r
if( *pxResult == errQUEUE_BLOCKED ) \\r
{ \\r
- crSET_STATE0( xHandle ); \\r
- *pxResult = xQueueCRSend( pxQueue, pvItemToQueue, 0 ); \\r
+ crSET_STATE0( ( xHandle ) ); \\r
+ *pxResult = xQueueCRSend( ( pxQueue ), ( pvItemToQueue ), 0 ); \\r
} \\r
if( *pxResult == errQUEUE_YIELD ) \\r
{ \\r
- crSET_STATE1( xHandle ); \\r
+ crSET_STATE1( ( xHandle ) ); \\r
*pxResult = pdPASS; \\r
} \\r
}\r
/**\r
* croutine. h\r
* <pre>\r
- crQUEUE_RECEIVE( \r
- xCoRoutineHandle xHandle, \r
- xQueueHandle pxQueue, \r
- void *pvBuffer, \r
- portTickType xTicksToWait, \r
- portBASE_TYPE *pxResult \r
+ crQUEUE_RECEIVE(\r
+ xCoRoutineHandle xHandle,\r
+ xQueueHandle pxQueue,\r
+ void *pvBuffer,\r
+ portTickType xTicksToWait,\r
+ portBASE_TYPE *pxResult\r
)</pre>\r
*\r
- * The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine \r
- * equivalent to the xQueueSend() and xQueueReceive() functions used by tasks. \r
+ * The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine\r
+ * equivalent to the xQueueSend() and xQueueReceive() functions used by tasks.\r
*\r
- * crQUEUE_SEND and crQUEUE_RECEIVE can only be used from a co-routine whereas \r
+ * crQUEUE_SEND and crQUEUE_RECEIVE can only be used from a co-routine whereas\r
* xQueueSend() and xQueueReceive() can only be used from tasks.\r
*\r
* crQUEUE_RECEIVE can only be called from the co-routine function itself - not\r
* from within a function called by the co-routine function. This is because\r
* co-routines do not maintain their own stack.\r
*\r
- * See the co-routine section of the WEB documentation for information on \r
- * passing data between tasks and co-routines and between ISR's and \r
+ * See the co-routine section of the WEB documentation for information on\r
+ * passing data between tasks and co-routines and between ISR's and\r
* co-routines.\r
*\r
* @param xHandle The handle of the calling co-routine. This is the xHandle\r
* parameter of the co-routine function.\r
*\r
- * @param pxQueue The handle of the queue from which the data will be received. \r
- * The handle is obtained as the return value when the queue is created using \r
+ * @param pxQueue The handle of the queue from which the data will be received.\r
+ * The handle is obtained as the return value when the queue is created using\r
* the xQueueCreate() API function.\r
*\r
* @param pvBuffer The buffer into which the received item is to be copied.\r
* The number of bytes of each queued item is specified when the queue is\r
* created. This number of bytes is copied into pvBuffer.\r
*\r
- * @param xTickToDelay The number of ticks that the co-routine should block \r
+ * @param xTickToDelay The number of ticks that the co-routine should block\r
* to wait for data to become available from the queue, should data not be\r
- * available immediately. The actual amount of time this equates to is defined \r
- * by configTICK_RATE_HZ (set in FreeRTOSConfig.h). The constant \r
+ * available immediately. The actual amount of time this equates to is defined\r
+ * by configTICK_RATE_HZ (set in FreeRTOSConfig.h). The constant\r
* portTICK_RATE_MS can be used to convert ticks to milliseconds (see the\r
* crQUEUE_SEND example).\r
*\r
*\r
* Example usage:\r
<pre>\r
- // A co-routine receives the number of an LED to flash from a queue. It \r
+ // A co-routine receives the number of an LED to flash from a queue. It\r
// blocks on the queue until the number is received.\r
static void prvCoRoutineFlashWorkTask( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )\r
{\r
*/\r
#define crQUEUE_RECEIVE( xHandle, pxQueue, pvBuffer, xTicksToWait, pxResult ) \\r
{ \\r
- *pxResult = xQueueCRReceive( pxQueue, pvBuffer, xTicksToWait ); \\r
- if( *pxResult == errQUEUE_BLOCKED ) \\r
+ *( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), ( xTicksToWait ) ); \\r
+ if( *( pxResult ) == errQUEUE_BLOCKED ) \\r
{ \\r
- crSET_STATE0( xHandle ); \\r
- *pxResult = xQueueCRReceive( pxQueue, pvBuffer, 0 ); \\r
+ crSET_STATE0( ( xHandle ) ); \\r
+ *( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), 0 ); \\r
} \\r
- if( *pxResult == errQUEUE_YIELD ) \\r
+ if( *( pxResult ) == errQUEUE_YIELD ) \\r
{ \\r
- crSET_STATE1( xHandle ); \\r
- *pxResult = pdPASS; \\r
+ crSET_STATE1( ( xHandle ) ); \\r
+ *( pxResult ) = pdPASS; \\r
} \\r
}\r
\r
/**\r
* croutine. h\r
* <pre>\r
- crQUEUE_SEND_FROM_ISR( \r
- xQueueHandle pxQueue, \r
- void *pvItemToQueue, \r
+ crQUEUE_SEND_FROM_ISR(\r
+ xQueueHandle pxQueue,\r
+ void *pvItemToQueue,\r
portBASE_TYPE xCoRoutinePreviouslyWoken\r
)</pre>\r
*\r
- * The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the \r
- * co-routine equivalent to the xQueueSendFromISR() and xQueueReceiveFromISR() \r
- * functions used by tasks. \r
+ * The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the\r
+ * co-routine equivalent to the xQueueSendFromISR() and xQueueReceiveFromISR()\r
+ * functions used by tasks.\r
*\r
* crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() can only be used to\r
- * pass data between a co-routine and and ISR, whereas xQueueSendFromISR() and \r
+ * pass data between a co-routine and and ISR, whereas xQueueSendFromISR() and\r
* xQueueReceiveFromISR() can only be used to pass data between a task and and\r
* ISR.\r
*\r
* crQUEUE_SEND_FROM_ISR can only be called from an ISR to send data to a queue\r
* that is being used from within a co-routine.\r
*\r
- * See the co-routine section of the WEB documentation for information on \r
- * passing data between tasks and co-routines and between ISR's and \r
+ * See the co-routine section of the WEB documentation for information on\r
+ * passing data between tasks and co-routines and between ISR's and\r
* co-routines.\r
*\r
* @param xQueue The handle to the queue on which the item is to be posted.\r
- * \r
- * @param pvItemToQueue A pointer to the item that is to be placed on the \r
+ *\r
+ * @param pvItemToQueue A pointer to the item that is to be placed on the\r
* queue. The size of the items the queue will hold was defined when the\r
* queue was created, so this many bytes will be copied from pvItemToQueue\r
* into the queue storage area.\r
* @param xCoRoutinePreviouslyWoken This is included so an ISR can post onto\r
* the same queue multiple times from a single interrupt. The first call\r
* should always pass in pdFALSE. Subsequent calls should pass in\r
- * the value returned from the previous call. \r
+ * the value returned from the previous call.\r
*\r
- * @return pdTRUE if a co-routine was woken by posting onto the queue. This is \r
+ * @return pdTRUE if a co-routine was woken by posting onto the queue. This is\r
* used by the ISR to determine if a context switch may be required following\r
* the ISR.\r
*\r
// A co-routine that blocks on a queue waiting for characters to be received.\r
static void vReceivingCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )\r
{\r
- portCHAR cRxedChar;\r
+ char cRxedChar;\r
portBASE_TYPE xResult;\r
\r
// All co-routines must start with a call to crSTART().\r
// Wait for data to become available on the queue. This assumes the\r
// queue xCommsRxQueue has already been created!\r
crQUEUE_RECEIVE( xHandle, xCommsRxQueue, &uxLEDToFlash, portMAX_DELAY, &xResult );\r
- \r
+\r
// Was a character received?\r
if( xResult == pdPASS )\r
{\r
// a co-routine.\r
void vUART_ISR( void )\r
{\r
- portCHAR cRxedChar;\r
+ char cRxedChar;\r
portBASE_TYPE xCRWokenByPost = pdFALSE;\r
\r
// We loop around reading characters until there are none left in the UART.\r
{\r
// Obtain the character from the UART.\r
cRxedChar = UART_RX_REG;\r
- \r
- // Post the character onto a queue. xCRWokenByPost will be pdFALSE \r
+\r
+ // Post the character onto a queue. xCRWokenByPost will be pdFALSE\r
// the first time around the loop. If the post causes a co-routine\r
// to be woken (unblocked) then xCRWokenByPost will be set to pdTRUE.\r
// In this manner we can ensure that if more than one co-routine is\r
* \defgroup crQUEUE_SEND_FROM_ISR crQUEUE_SEND_FROM_ISR\r
* \ingroup Tasks\r
*/\r
-#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) xQueueCRSendFromISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken )\r
+#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) xQueueCRSendFromISR( ( pxQueue ), ( pvItemToQueue ), ( xCoRoutinePreviouslyWoken ) )\r
\r
\r
/**\r
* croutine. h\r
* <pre>\r
- crQUEUE_SEND_FROM_ISR( \r
- xQueueHandle pxQueue, \r
- void *pvBuffer, \r
+ crQUEUE_SEND_FROM_ISR(\r
+ xQueueHandle pxQueue,\r
+ void *pvBuffer,\r
portBASE_TYPE * pxCoRoutineWoken\r
)</pre>\r
*\r
- * The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the \r
- * co-routine equivalent to the xQueueSendFromISR() and xQueueReceiveFromISR() \r
- * functions used by tasks. \r
+ * The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the\r
+ * co-routine equivalent to the xQueueSendFromISR() and xQueueReceiveFromISR()\r
+ * functions used by tasks.\r
*\r
* crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() can only be used to\r
- * pass data between a co-routine and and ISR, whereas xQueueSendFromISR() and \r
+ * pass data between a co-routine and and ISR, whereas xQueueSendFromISR() and\r
* xQueueReceiveFromISR() can only be used to pass data between a task and and\r
* ISR.\r
*\r
- * crQUEUE_RECEIVE_FROM_ISR can only be called from an ISR to receive data \r
+ * crQUEUE_RECEIVE_FROM_ISR can only be called from an ISR to receive data\r
* from a queue that is being used from within a co-routine (a co-routine\r
* posted to the queue).\r
*\r
- * See the co-routine section of the WEB documentation for information on \r
- * passing data between tasks and co-routines and between ISR's and \r
+ * See the co-routine section of the WEB documentation for information on\r
+ * passing data between tasks and co-routines and between ISR's and\r
* co-routines.\r
*\r
* @param xQueue The handle to the queue on which the item is to be posted.\r
- * \r
+ *\r
* @param pvBuffer A pointer to a buffer into which the received item will be\r
* placed. The size of the items the queue will hold was defined when the\r
* queue was created, so this many bytes will be copied from the queue into\r
* pvBuffer.\r
*\r
* @param pxCoRoutineWoken A co-routine may be blocked waiting for space to become\r
- * available on the queue. If crQUEUE_RECEIVE_FROM_ISR causes such a \r
- * co-routine to unblock *pxCoRoutineWoken will get set to pdTRUE, otherwise \r
+ * available on the queue. If crQUEUE_RECEIVE_FROM_ISR causes such a\r
+ * co-routine to unblock *pxCoRoutineWoken will get set to pdTRUE, otherwise\r
* *pxCoRoutineWoken will remain unchanged.\r
*\r
* @return pdTRUE an item was successfully received from the queue, otherwise\r
*\r
* Example usage:\r
<pre>\r
- // A co-routine that posts a character to a queue then blocks for a fixed \r
+ // A co-routine that posts a character to a queue then blocks for a fixed\r
// period. The character is incremented each time.\r
static void vSendingCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )\r
{\r
// cChar holds its value while this co-routine is blocked and must therefore\r
// be declared static.\r
- static portCHAR cCharToTx = 'a';\r
+ static char cCharToTx = 'a';\r
portBASE_TYPE xResult;\r
\r
// All co-routines must start with a call to crSTART().\r
{\r
// Send the next character to the queue.\r
crQUEUE_SEND( xHandle, xCoRoutineQueue, &cCharToTx, NO_DELAY, &xResult );\r
- \r
+\r
if( xResult == pdPASS )\r
{\r
// The character was successfully posted to the queue.\r
// from the queue and send it.\r
ENABLE_RX_INTERRUPT();\r
\r
- // Increment to the next character then block for a fixed period. \r
+ // Increment to the next character then block for a fixed period.\r
// cCharToTx will maintain its value across the delay as it is\r
// declared static.\r
cCharToTx++;\r
// An ISR that uses a queue to receive characters to send on a UART.\r
void vUART_ISR( void )\r
{\r
- portCHAR cCharToTx;\r
+ char cCharToTx;\r
portBASE_TYPE xCRWokenByPost = pdFALSE;\r
\r
while( UART_TX_REG_EMPTY() )\r
* \defgroup crQUEUE_RECEIVE_FROM_ISR crQUEUE_RECEIVE_FROM_ISR\r
* \ingroup Tasks\r
*/\r
-#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) xQueueCRReceiveFromISR( pxQueue, pvBuffer, pxCoRoutineWoken )\r
+#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) xQueueCRReceiveFromISR( ( pxQueue ), ( pvBuffer ), ( pxCoRoutineWoken ) )\r
\r
/*\r
* This function is intended for internal use by the co-routine macros only.\r
- * The macro nature of the co-routine implementation requires that the \r
- * prototype appears here. The function should not be used by application \r
+ * The macro nature of the co-routine implementation requires that the\r
+ * prototype appears here. The function should not be used by application\r
* writers.\r
*\r
- * Removes the current co-routine from its ready list and places it in the \r
+ * Removes the current co-routine from its ready list and places it in the\r
* appropriate delayed list.\r
*/\r
void vCoRoutineAddToDelayedList( portTickType xTicksToDelay, xList *pxEventList );\r
* Removes the highest priority co-routine from the event list and places it in\r
* the pending ready list.\r
*/\r
-portBASE_TYPE xCoRoutineRemoveFromEventList( const xList *pxEventList );\r
+signed portBASE_TYPE xCoRoutineRemoveFromEventList( const xList *pxEventList );\r
\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
\r
#endif /* CO_ROUTINE_H */\r