/*\r
- FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
\r
/* Lists for ready and blocked co-routines. --------------------*/\r
-static xList pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /*< Prioritised ready co-routines. */\r
-static xList xDelayedCoRoutineList1; /*< Delayed co-routines. */\r
-static xList xDelayedCoRoutineList2; /*< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */\r
-static xList * pxDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used. */\r
-static xList * pxOverflowDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */\r
-static xList xPendingReadyCoRoutineList; /*< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */\r
+static List_t pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /*< Prioritised ready co-routines. */\r
+static List_t xDelayedCoRoutineList1; /*< Delayed co-routines. */\r
+static List_t xDelayedCoRoutineList2; /*< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */\r
+static List_t * pxDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used. */\r
+static List_t * pxOverflowDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */\r
+static List_t xPendingReadyCoRoutineList; /*< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */\r
\r
/* Other file private variables. --------------------------------*/\r
-corCRCB * pxCurrentCoRoutine = NULL;\r
-static unsigned portBASE_TYPE uxTopCoRoutineReadyPriority = 0;\r
-static portTickType xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks = 0;\r
+CRCB_t * pxCurrentCoRoutine = NULL;\r
+static UBaseType_t uxTopCoRoutineReadyPriority = 0;\r
+static TickType_t xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks = 0;\r
\r
/* The initial state of the co-routine when it is created. */\r
#define corINITIAL_STATE ( 0 )\r
{ \\r
uxTopCoRoutineReadyPriority = pxCRCB->uxPriority; \\r
} \\r
- vListInsertEnd( ( xList * ) &( pxReadyCoRoutineLists[ pxCRCB->uxPriority ] ), &( pxCRCB->xGenericListItem ) ); \\r
+ vListInsertEnd( ( List_t * ) &( pxReadyCoRoutineLists[ pxCRCB->uxPriority ] ), &( pxCRCB->xGenericListItem ) ); \\r
}\r
\r
/*\r
\r
/*-----------------------------------------------------------*/\r
\r
-signed portBASE_TYPE xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, unsigned portBASE_TYPE uxPriority, unsigned portBASE_TYPE uxIndex )\r
+BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPriority, UBaseType_t uxIndex )\r
{\r
-signed portBASE_TYPE xReturn;\r
-corCRCB *pxCoRoutine;\r
+BaseType_t xReturn;\r
+CRCB_t *pxCoRoutine;\r
\r
/* Allocate the memory that will store the co-routine control block. */\r
- pxCoRoutine = ( corCRCB * ) pvPortMalloc( sizeof( corCRCB ) );\r
+ pxCoRoutine = ( CRCB_t * ) pvPortMalloc( sizeof( CRCB_t ) );\r
if( pxCoRoutine )\r
{\r
/* If pxCurrentCoRoutine is NULL then this is the first co-routine to\r
vListInitialiseItem( &( pxCoRoutine->xGenericListItem ) );\r
vListInitialiseItem( &( pxCoRoutine->xEventListItem ) );\r
\r
- /* Set the co-routine control block as a link back from the xListItem.\r
+ /* Set the co-routine control block as a link back from the ListItem_t.\r
This is so we can get back to the containing CRCB from a generic item\r
in a list. */\r
listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xGenericListItem ), pxCoRoutine );\r
listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xEventListItem ), pxCoRoutine );\r
\r
/* Event lists are always in priority order. */\r
- listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) uxPriority );\r
+ listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), ( ( TickType_t ) configMAX_CO_ROUTINE_PRIORITIES - ( TickType_t ) uxPriority ) );\r
\r
/* Now the co-routine has been initialised it can be added to the ready\r
list at the correct priority. */\r
}\r
/*-----------------------------------------------------------*/\r
\r
-void vCoRoutineAddToDelayedList( portTickType xTicksToDelay, xList *pxEventList )\r
+void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay, List_t *pxEventList )\r
{\r
-portTickType xTimeToWake;\r
+TickType_t xTimeToWake;\r
\r
/* Calculate the time to wake - this may overflow but this is\r
not a problem. */\r
/* We must remove ourselves from the ready list before adding\r
ourselves to the blocked list as the same list item is used for\r
both lists. */\r
- ( void ) uxListRemove( ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );\r
+ ( void ) uxListRemove( ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) );\r
\r
/* The list item will be inserted in wake time order. */\r
listSET_LIST_ITEM_VALUE( &( pxCurrentCoRoutine->xGenericListItem ), xTimeToWake );\r
{\r
/* Wake time has overflowed. Place this item in the\r
overflow list. */\r
- vListInsert( ( xList * ) pxOverflowDelayedCoRoutineList, ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );\r
+ vListInsert( ( List_t * ) pxOverflowDelayedCoRoutineList, ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) );\r
}\r
else\r
{\r
/* The wake time has not overflowed, so we can use the\r
current block list. */\r
- vListInsert( ( xList * ) pxDelayedCoRoutineList, ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );\r
+ vListInsert( ( List_t * ) pxDelayedCoRoutineList, ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) );\r
}\r
\r
if( pxEventList )\r
the ready lists itself. */\r
while( listLIST_IS_EMPTY( &xPendingReadyCoRoutineList ) == pdFALSE )\r
{\r
- corCRCB *pxUnblockedCRCB;\r
+ CRCB_t *pxUnblockedCRCB;\r
\r
/* The pending ready list can be accessed by an ISR. */\r
portDISABLE_INTERRUPTS();\r
{\r
- pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) );\r
+ pxUnblockedCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) );\r
( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );\r
}\r
portENABLE_INTERRUPTS();\r
\r
static void prvCheckDelayedList( void )\r
{\r
-corCRCB *pxCRCB;\r
+CRCB_t *pxCRCB;\r
\r
xPassedTicks = xTaskGetTickCount() - xLastTickCount;\r
while( xPassedTicks )\r
/* If the tick count has overflowed we need to swap the ready lists. */\r
if( xCoRoutineTickCount == 0 )\r
{\r
- xList * pxTemp;\r
+ List_t * pxTemp;\r
\r
/* Tick count has overflowed so we need to swap the delay lists. If there are\r
any items in pxDelayedCoRoutineList here then there is an error! */\r
/* See if this tick has made a timeout expire. */\r
while( listLIST_IS_EMPTY( pxDelayedCoRoutineList ) == pdFALSE )\r
{\r
- pxCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList );\r
+ pxCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList );\r
\r
if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) )\r
{\r
have been moved to the pending ready list and the following\r
line is still valid. Also the pvContainer parameter will have\r
been set to NULL so the following lines are also valid. */\r
- uxListRemove( &( pxCRCB->xGenericListItem ) );\r
+ ( void ) uxListRemove( &( pxCRCB->xGenericListItem ) );\r
\r
/* Is the co-routine waiting on an event also? */\r
if( pxCRCB->xEventListItem.pvContainer )\r
\r
static void prvInitialiseCoRoutineLists( void )\r
{\r
-unsigned portBASE_TYPE uxPriority;\r
+UBaseType_t uxPriority;\r
\r
for( uxPriority = 0; uxPriority < configMAX_CO_ROUTINE_PRIORITIES; uxPriority++ )\r
{\r
- vListInitialise( ( xList * ) &( pxReadyCoRoutineLists[ uxPriority ] ) );\r
+ vListInitialise( ( List_t * ) &( pxReadyCoRoutineLists[ uxPriority ] ) );\r
}\r
\r
- vListInitialise( ( xList * ) &xDelayedCoRoutineList1 );\r
- vListInitialise( ( xList * ) &xDelayedCoRoutineList2 );\r
- vListInitialise( ( xList * ) &xPendingReadyCoRoutineList );\r
+ vListInitialise( ( List_t * ) &xDelayedCoRoutineList1 );\r
+ vListInitialise( ( List_t * ) &xDelayedCoRoutineList2 );\r
+ vListInitialise( ( List_t * ) &xPendingReadyCoRoutineList );\r
\r
/* Start with pxDelayedCoRoutineList using list1 and the\r
pxOverflowDelayedCoRoutineList using list2. */\r
}\r
/*-----------------------------------------------------------*/\r
\r
-signed portBASE_TYPE xCoRoutineRemoveFromEventList( const xList *pxEventList )\r
+BaseType_t xCoRoutineRemoveFromEventList( const List_t *pxEventList )\r
{\r
-corCRCB *pxUnblockedCRCB;\r
-signed portBASE_TYPE xReturn;\r
+CRCB_t *pxUnblockedCRCB;\r
+BaseType_t xReturn;\r
\r
/* This function is called from within an interrupt. It can only access\r
event lists and the pending ready list. This function assumes that a\r
check has already been made to ensure pxEventList is not empty. */\r
- pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );\r
+ pxUnblockedCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );\r
( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );\r
- vListInsertEnd( ( xList * ) &( xPendingReadyCoRoutineList ), &( pxUnblockedCRCB->xEventListItem ) );\r
+ vListInsertEnd( ( List_t * ) &( xPendingReadyCoRoutineList ), &( pxUnblockedCRCB->xEventListItem ) );\r
\r
if( pxUnblockedCRCB->uxPriority >= pxCurrentCoRoutine->uxPriority )\r
{\r