Go to the source code of this file.
Data Structures | |
struct | xLIST |
struct | xLIST_ITEM |
struct | xMINI_LIST_ITEM |
Defines | |
#define | listCURRENT_LIST_LENGTH(pxList) ( ( pxList )->uxNumberOfItems ) |
#define | listGET_LIST_ITEM_VALUE(pxListItem) ( ( pxListItem )->xItemValue ) |
#define | listGET_OWNER_OF_HEAD_ENTRY(pxList) ( ( pxList->uxNumberOfItems != ( unsigned portBASE_TYPE ) 0 ) ? ( (&( pxList->xListEnd ))->pxNext->pvOwner ) : ( NULL ) ) |
#define | listGET_OWNER_OF_NEXT_ENTRY(pxTCB, pxList) |
#define | listIS_CONTAINED_WITHIN(pxList, pxListItem) ( ( pxListItem )->pvContainer == ( void * ) pxList ) |
#define | listLIST_IS_EMPTY(pxList) ( ( pxList )->uxNumberOfItems == ( unsigned portBASE_TYPE ) 0 ) |
#define | listSET_LIST_ITEM_OWNER(pxListItem, pxOwner) ( pxListItem )->pvOwner = ( void * ) pxOwner |
#define | listSET_LIST_ITEM_VALUE(pxListItem, xValue) ( pxListItem )->xItemValue = xValue |
Typedefs | |
typedef struct xLIST | xList |
typedef struct xLIST_ITEM | xListItem |
typedef struct xMINI_LIST_ITEM | xMiniListItem |
Functions | |
void | vListInitialise (xList *pxList) |
void | vListInitialiseItem (xListItem *pxItem) |
void | vListInsert (xList *pxList, xListItem *pxNewListItem) |
void | vListInsertEnd (xList *pxList, xListItem *pxNewListItem) |
void | vListRemove (xListItem *pxItemToRemove) |
#define listCURRENT_LIST_LENGTH | ( | pxList | ) | ( ( pxList )->uxNumberOfItems ) |
#define listGET_LIST_ITEM_VALUE | ( | pxListItem | ) | ( ( pxListItem )->xItemValue ) |
#define listGET_OWNER_OF_HEAD_ENTRY | ( | pxList | ) | ( ( pxList->uxNumberOfItems != ( unsigned portBASE_TYPE ) 0 ) ? ( (&( pxList->xListEnd ))->pxNext->pvOwner ) : ( NULL ) ) |
Definition at line 217 of file list.h.
Referenced by prvCheckDelayedList(), prvCheckPendingReadyList(), prvCheckTasksWaitingTermination(), xCoRoutineRemoveFromEventList(), xTaskRemoveFromEventList(), and xTaskResumeAll().
#define listGET_OWNER_OF_NEXT_ENTRY | ( | pxTCB, | |||
pxList | ) |
Value:
{ \ xList * const pxConstList = pxList; \ /* Increment the index to the next item and return the item, ensuring */ \ /* we don't return the marker used at the end of the list. */ \ ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \ if( ( pxConstList )->pxIndex == ( xListItem * ) &( ( pxConstList )->xListEnd ) ) \ { \ ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \ } \ pxTCB = ( pxConstList )->pxIndex->pvOwner; \ }
Definition at line 187 of file list.h.
Referenced by vCoRoutineSchedule(), and vTaskSwitchContext().
#define listIS_CONTAINED_WITHIN | ( | pxList, | |||
pxListItem | ) | ( ( pxListItem )->pvContainer == ( void * ) pxList ) |
#define listLIST_IS_EMPTY | ( | pxList | ) | ( ( pxList )->uxNumberOfItems == ( unsigned portBASE_TYPE ) 0 ) |
Definition at line 161 of file list.h.
Referenced by prvCheckPendingReadyList(), prvCheckTasksWaitingTermination(), prvUnlockQueue(), vCoRoutineSchedule(), vTaskSwitchContext(), xQueueGenericReceive(), xQueueGenericSend(), xQueueGenericSendFromISR(), and xQueueReceiveFromISR().
#define listSET_LIST_ITEM_OWNER | ( | pxListItem, | |||
pxOwner | ) | ( pxListItem )->pvOwner = ( void * ) pxOwner |
Definition at line 133 of file list.h.
Referenced by prvInitialiseTCBVariables(), and xCoRoutineCreate().
#define listSET_LIST_ITEM_VALUE | ( | pxListItem, | |||
xValue | ) | ( pxListItem )->xItemValue = xValue |
Definition at line 142 of file list.h.
Referenced by prvInitialiseTCBVariables(), vCoRoutineAddToDelayedList(), vTaskPlaceOnEventList(), and xCoRoutineCreate().
typedef struct xLIST_ITEM xListItem |
typedef struct xMINI_LIST_ITEM xMiniListItem |
void vListInitialise | ( | xList * | pxList | ) |
Definition at line 63 of file list.c.
References portMAX_DELAY, xLIST::pxIndex, xMINI_LIST_ITEM::pxNext, xMINI_LIST_ITEM::pxPrevious, xLIST::uxNumberOfItems, xMINI_LIST_ITEM::xItemValue, and xLIST::xListEnd.
Referenced by prvInitialiseCoRoutineLists(), and prvInitialiseTaskLists().
00064 { 00065 /* The list structure contains a list item which is used to mark the 00066 end of the list. To initialise the list the list end is inserted 00067 as the only list entry. */ 00068 pxList->pxIndex = ( xListItem * ) &( pxList->xListEnd ); 00069 00070 /* The list end value is the highest possible value in the list to 00071 ensure it remains at the end of the list. */ 00072 pxList->xListEnd.xItemValue = portMAX_DELAY; 00073 00074 /* The list end next and previous pointers point to itself so we know 00075 when the list is empty. */ 00076 pxList->xListEnd.pxNext = ( xListItem * ) &( pxList->xListEnd ); 00077 pxList->xListEnd.pxPrevious = ( xListItem * ) &( pxList->xListEnd ); 00078 00079 pxList->uxNumberOfItems = 0; 00080 }
void vListInitialiseItem | ( | xListItem * | pxItem | ) |
Definition at line 83 of file list.c.
References xLIST_ITEM::pvContainer.
Referenced by prvInitialiseTCBVariables(), and xCoRoutineCreate().
00084 { 00085 /* Make sure the list item is not recorded as being on a list. */ 00086 pxItem->pvContainer = NULL; 00087 }
Definition at line 113 of file list.c.
References portMAX_DELAY, xLIST_ITEM::pvContainer, xLIST_ITEM::pxNext, xLIST_ITEM::pxPrevious, xMINI_LIST_ITEM::pxPrevious, xLIST::uxNumberOfItems, xLIST_ITEM::xItemValue, and xLIST::xListEnd.
Referenced by vCoRoutineAddToDelayedList(), and vTaskPlaceOnEventList().
00114 { 00115 volatile xListItem *pxIterator; 00116 portTickType xValueOfInsertion; 00117 00118 /* Insert the new list item into the list, sorted in ulListItem order. */ 00119 xValueOfInsertion = pxNewListItem->xItemValue; 00120 00121 /* If the list already contains a list item with the same item value then 00122 the new list item should be placed after it. This ensures that TCB's which 00123 are stored in ready lists (all of which have the same ulListItem value) 00124 get an equal share of the CPU. However, if the xItemValue is the same as 00125 the back marker the iteration loop below will not end. This means we need 00126 to guard against this by checking the value first and modifying the 00127 algorithm slightly if necessary. */ 00128 if( xValueOfInsertion == portMAX_DELAY ) 00129 { 00130 pxIterator = pxList->xListEnd.pxPrevious; 00131 } 00132 else 00133 { 00134 /* *** NOTE *********************************************************** 00135 If you find your application is crashing here then likely causes are: 00136 1) Stack overflow - 00137 see http://www.freertos.org/Stacks-and-stack-overflow-checking.html 00138 2) Incorrect interrupt priority assignment, especially on Cortex M3 00139 parts where numerically high priority values denote low actual 00140 interrupt priories, which can seem counter intuitive. See 00141 configMAX_SYSCALL_INTERRUPT_PRIORITY on http://www.freertos.org/a00110.html 00142 3) Calling an API function from within a critical section or when 00143 the scheduler is suspended. 00144 4) Using a queue or semaphore before it has been initialised or 00145 before the scheduler has been started (are interrupts firing 00146 before vTaskStartScheduler() has been called?). 00147 See http://www.freertos.org/FAQHelp.html for more tips. 00148 **********************************************************************/ 00149 00150 for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) 00151 { 00152 /* There is nothing to do here, we are just iterating to the 00153 wanted insertion position. */ 00154 } 00155 } 00156 00157 pxNewListItem->pxNext = pxIterator->pxNext; 00158 pxNewListItem->pxNext->pxPrevious = ( volatile xListItem * ) pxNewListItem; 00159 pxNewListItem->pxPrevious = pxIterator; 00160 pxIterator->pxNext = ( volatile xListItem * ) pxNewListItem; 00161 00162 /* Remember which list the item is in. This allows fast removal of the 00163 item later. */ 00164 pxNewListItem->pvContainer = ( void * ) pxList; 00165 00166 ( pxList->uxNumberOfItems )++; 00167 }
Definition at line 90 of file list.c.
References xLIST_ITEM::pvContainer, xLIST::pxIndex, xLIST_ITEM::pxNext, xLIST_ITEM::pxPrevious, and xLIST::uxNumberOfItems.
Referenced by vTaskPlaceOnEventList(), xCoRoutineRemoveFromEventList(), and xTaskRemoveFromEventList().
00091 { 00092 volatile xListItem * pxIndex; 00093 00094 /* Insert a new list item into pxList, but rather than sort the list, 00095 makes the new list item the last item to be removed by a call to 00096 pvListGetOwnerOfNextEntry. This means it has to be the item pointed to by 00097 the pxIndex member. */ 00098 pxIndex = pxList->pxIndex; 00099 00100 pxNewListItem->pxNext = pxIndex->pxNext; 00101 pxNewListItem->pxPrevious = pxList->pxIndex; 00102 pxIndex->pxNext->pxPrevious = ( volatile xListItem * ) pxNewListItem; 00103 pxIndex->pxNext = ( volatile xListItem * ) pxNewListItem; 00104 pxList->pxIndex = ( volatile xListItem * ) pxNewListItem; 00105 00106 /* Remember which list the item is in. */ 00107 pxNewListItem->pvContainer = ( void * ) pxList; 00108 00109 ( pxList->uxNumberOfItems )++; 00110 }
void vListRemove | ( | xListItem * | pxItemToRemove | ) |
Definition at line 170 of file list.c.
References xLIST_ITEM::pvContainer, xLIST::pxIndex, xLIST_ITEM::pxNext, xLIST_ITEM::pxPrevious, and xLIST::uxNumberOfItems.
Referenced by prvCheckDelayedList(), prvCheckPendingReadyList(), prvCheckTasksWaitingTermination(), vCoRoutineAddToDelayedList(), vTaskPlaceOnEventList(), xCoRoutineRemoveFromEventList(), xTaskRemoveFromEventList(), and xTaskResumeAll().
00171 { 00172 xList * pxList; 00173 00174 pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious; 00175 pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext; 00176 00177 /* The list item knows which list it is in. Obtain the list from the list 00178 item. */ 00179 pxList = ( xList * ) pxItemToRemove->pvContainer; 00180 00181 /* Make sure the index is left pointing to a valid item. */ 00182 if( pxList->pxIndex == pxItemToRemove ) 00183 { 00184 pxList->pxIndex = pxItemToRemove->pxPrevious; 00185 } 00186 00187 pxItemToRemove->pvContainer = NULL; 00188 ( pxList->uxNumberOfItems )--; 00189 }