Please see my note book http://mbed.org/users/kenjiArai/notebook/freertos-on-mbed-board-with-mbed-cloud-ide--never-/
This is too old.
Below is another FreeRTOS on mbed.
http://developer.mbed.org/users/rgrover1/code/FreeRTOS/
I don't know it works well or not.
I have not evaluated it.
FreeRTOS/Source/include/list.h@0:d4960fcea8ff, 2011-01-01 (annotated)
- Committer:
- kenjiArai
- Date:
- Sat Jan 01 11:17:45 2011 +0000
- Revision:
- 0:d4960fcea8ff
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kenjiArai | 0:d4960fcea8ff | 1 | /* |
kenjiArai | 0:d4960fcea8ff | 2 | FreeRTOS V6.0.3 - Copyright (C) 2010 Real Time Engineers Ltd. |
kenjiArai | 0:d4960fcea8ff | 3 | |
kenjiArai | 0:d4960fcea8ff | 4 | *************************************************************************** |
kenjiArai | 0:d4960fcea8ff | 5 | * * |
kenjiArai | 0:d4960fcea8ff | 6 | * If you are: * |
kenjiArai | 0:d4960fcea8ff | 7 | * * |
kenjiArai | 0:d4960fcea8ff | 8 | * + New to FreeRTOS, * |
kenjiArai | 0:d4960fcea8ff | 9 | * + Wanting to learn FreeRTOS or multitasking in general quickly * |
kenjiArai | 0:d4960fcea8ff | 10 | * + Looking for basic training, * |
kenjiArai | 0:d4960fcea8ff | 11 | * + Wanting to improve your FreeRTOS skills and productivity * |
kenjiArai | 0:d4960fcea8ff | 12 | * * |
kenjiArai | 0:d4960fcea8ff | 13 | * then take a look at the FreeRTOS eBook * |
kenjiArai | 0:d4960fcea8ff | 14 | * * |
kenjiArai | 0:d4960fcea8ff | 15 | * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * |
kenjiArai | 0:d4960fcea8ff | 16 | * http://www.FreeRTOS.org/Documentation * |
kenjiArai | 0:d4960fcea8ff | 17 | * * |
kenjiArai | 0:d4960fcea8ff | 18 | * A pdf reference manual is also available. Both are usually delivered * |
kenjiArai | 0:d4960fcea8ff | 19 | * to your inbox within 20 minutes to two hours when purchased between 8am * |
kenjiArai | 0:d4960fcea8ff | 20 | * and 8pm GMT (although please allow up to 24 hours in case of * |
kenjiArai | 0:d4960fcea8ff | 21 | * exceptional circumstances). Thank you for your support! * |
kenjiArai | 0:d4960fcea8ff | 22 | * * |
kenjiArai | 0:d4960fcea8ff | 23 | *************************************************************************** |
kenjiArai | 0:d4960fcea8ff | 24 | |
kenjiArai | 0:d4960fcea8ff | 25 | This file is part of the FreeRTOS distribution. |
kenjiArai | 0:d4960fcea8ff | 26 | |
kenjiArai | 0:d4960fcea8ff | 27 | FreeRTOS is free software; you can redistribute it and/or modify it under |
kenjiArai | 0:d4960fcea8ff | 28 | the terms of the GNU General Public License (version 2) as published by the |
kenjiArai | 0:d4960fcea8ff | 29 | Free Software Foundation AND MODIFIED BY the FreeRTOS exception. |
kenjiArai | 0:d4960fcea8ff | 30 | ***NOTE*** The exception to the GPL is included to allow you to distribute |
kenjiArai | 0:d4960fcea8ff | 31 | a combined work that includes FreeRTOS without being obliged to provide the |
kenjiArai | 0:d4960fcea8ff | 32 | source code for proprietary components outside of the FreeRTOS kernel. |
kenjiArai | 0:d4960fcea8ff | 33 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT |
kenjiArai | 0:d4960fcea8ff | 34 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
kenjiArai | 0:d4960fcea8ff | 35 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
kenjiArai | 0:d4960fcea8ff | 36 | more details. You should have received a copy of the GNU General Public |
kenjiArai | 0:d4960fcea8ff | 37 | License and the FreeRTOS license exception along with FreeRTOS; if not it |
kenjiArai | 0:d4960fcea8ff | 38 | can be viewed here: http://www.freertos.org/a00114.html and also obtained |
kenjiArai | 0:d4960fcea8ff | 39 | by writing to Richard Barry, contact details for whom are available on the |
kenjiArai | 0:d4960fcea8ff | 40 | FreeRTOS WEB site. |
kenjiArai | 0:d4960fcea8ff | 41 | |
kenjiArai | 0:d4960fcea8ff | 42 | 1 tab == 4 spaces! |
kenjiArai | 0:d4960fcea8ff | 43 | |
kenjiArai | 0:d4960fcea8ff | 44 | http://www.FreeRTOS.org - Documentation, latest information, license and |
kenjiArai | 0:d4960fcea8ff | 45 | contact details. |
kenjiArai | 0:d4960fcea8ff | 46 | |
kenjiArai | 0:d4960fcea8ff | 47 | http://www.SafeRTOS.com - A version that is certified for use in safety |
kenjiArai | 0:d4960fcea8ff | 48 | critical systems. |
kenjiArai | 0:d4960fcea8ff | 49 | |
kenjiArai | 0:d4960fcea8ff | 50 | http://www.OpenRTOS.com - Commercial support, development, porting, |
kenjiArai | 0:d4960fcea8ff | 51 | licensing and training services. |
kenjiArai | 0:d4960fcea8ff | 52 | */ |
kenjiArai | 0:d4960fcea8ff | 53 | |
kenjiArai | 0:d4960fcea8ff | 54 | /* |
kenjiArai | 0:d4960fcea8ff | 55 | * This is the list implementation used by the scheduler. While it is tailored |
kenjiArai | 0:d4960fcea8ff | 56 | * heavily for the schedulers needs, it is also available for use by |
kenjiArai | 0:d4960fcea8ff | 57 | * application code. |
kenjiArai | 0:d4960fcea8ff | 58 | * |
kenjiArai | 0:d4960fcea8ff | 59 | * xLists can only store pointers to xListItems. Each xListItem contains a |
kenjiArai | 0:d4960fcea8ff | 60 | * numeric value (xItemValue). Most of the time the lists are sorted in |
kenjiArai | 0:d4960fcea8ff | 61 | * descending item value order. |
kenjiArai | 0:d4960fcea8ff | 62 | * |
kenjiArai | 0:d4960fcea8ff | 63 | * Lists are created already containing one list item. The value of this |
kenjiArai | 0:d4960fcea8ff | 64 | * item is the maximum possible that can be stored, it is therefore always at |
kenjiArai | 0:d4960fcea8ff | 65 | * the end of the list and acts as a marker. The list member pxHead always |
kenjiArai | 0:d4960fcea8ff | 66 | * points to this marker - even though it is at the tail of the list. This |
kenjiArai | 0:d4960fcea8ff | 67 | * is because the tail contains a wrap back pointer to the true head of |
kenjiArai | 0:d4960fcea8ff | 68 | * the list. |
kenjiArai | 0:d4960fcea8ff | 69 | * |
kenjiArai | 0:d4960fcea8ff | 70 | * In addition to it's value, each list item contains a pointer to the next |
kenjiArai | 0:d4960fcea8ff | 71 | * item in the list (pxNext), a pointer to the list it is in (pxContainer) |
kenjiArai | 0:d4960fcea8ff | 72 | * and a pointer to back to the object that contains it. These later two |
kenjiArai | 0:d4960fcea8ff | 73 | * pointers are included for efficiency of list manipulation. There is |
kenjiArai | 0:d4960fcea8ff | 74 | * effectively a two way link between the object containing the list item and |
kenjiArai | 0:d4960fcea8ff | 75 | * the list item itself. |
kenjiArai | 0:d4960fcea8ff | 76 | * |
kenjiArai | 0:d4960fcea8ff | 77 | * |
kenjiArai | 0:d4960fcea8ff | 78 | * \page ListIntroduction List Implementation |
kenjiArai | 0:d4960fcea8ff | 79 | * \ingroup FreeRTOSIntro |
kenjiArai | 0:d4960fcea8ff | 80 | */ |
kenjiArai | 0:d4960fcea8ff | 81 | |
kenjiArai | 0:d4960fcea8ff | 82 | /* |
kenjiArai | 0:d4960fcea8ff | 83 | Changes from V4.3.1 |
kenjiArai | 0:d4960fcea8ff | 84 | |
kenjiArai | 0:d4960fcea8ff | 85 | + Included local const within listGET_OWNER_OF_NEXT_ENTRY() to assist |
kenjiArai | 0:d4960fcea8ff | 86 | compiler with optimisation. Thanks B.R. |
kenjiArai | 0:d4960fcea8ff | 87 | */ |
kenjiArai | 0:d4960fcea8ff | 88 | |
kenjiArai | 0:d4960fcea8ff | 89 | #ifndef LIST_H |
kenjiArai | 0:d4960fcea8ff | 90 | #define LIST_H |
kenjiArai | 0:d4960fcea8ff | 91 | |
kenjiArai | 0:d4960fcea8ff | 92 | #ifdef __cplusplus |
kenjiArai | 0:d4960fcea8ff | 93 | extern "C" { |
kenjiArai | 0:d4960fcea8ff | 94 | #endif |
kenjiArai | 0:d4960fcea8ff | 95 | /* |
kenjiArai | 0:d4960fcea8ff | 96 | * Definition of the only type of object that a list can contain. |
kenjiArai | 0:d4960fcea8ff | 97 | */ |
kenjiArai | 0:d4960fcea8ff | 98 | struct xLIST_ITEM |
kenjiArai | 0:d4960fcea8ff | 99 | { |
kenjiArai | 0:d4960fcea8ff | 100 | portTickType xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */ |
kenjiArai | 0:d4960fcea8ff | 101 | volatile struct xLIST_ITEM * pxNext; /*< Pointer to the next xListItem in the list. */ |
kenjiArai | 0:d4960fcea8ff | 102 | volatile struct xLIST_ITEM * pxPrevious;/*< Pointer to the previous xListItem in the list. */ |
kenjiArai | 0:d4960fcea8ff | 103 | void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */ |
kenjiArai | 0:d4960fcea8ff | 104 | void * pvContainer; /*< Pointer to the list in which this list item is placed (if any). */ |
kenjiArai | 0:d4960fcea8ff | 105 | }; |
kenjiArai | 0:d4960fcea8ff | 106 | typedef struct xLIST_ITEM xListItem; /* For some reason lint wants this as two separate definitions. */ |
kenjiArai | 0:d4960fcea8ff | 107 | |
kenjiArai | 0:d4960fcea8ff | 108 | struct xMINI_LIST_ITEM |
kenjiArai | 0:d4960fcea8ff | 109 | { |
kenjiArai | 0:d4960fcea8ff | 110 | portTickType xItemValue; |
kenjiArai | 0:d4960fcea8ff | 111 | volatile struct xLIST_ITEM *pxNext; |
kenjiArai | 0:d4960fcea8ff | 112 | volatile struct xLIST_ITEM *pxPrevious; |
kenjiArai | 0:d4960fcea8ff | 113 | }; |
kenjiArai | 0:d4960fcea8ff | 114 | typedef struct xMINI_LIST_ITEM xMiniListItem; |
kenjiArai | 0:d4960fcea8ff | 115 | |
kenjiArai | 0:d4960fcea8ff | 116 | /* |
kenjiArai | 0:d4960fcea8ff | 117 | * Definition of the type of queue used by the scheduler. |
kenjiArai | 0:d4960fcea8ff | 118 | */ |
kenjiArai | 0:d4960fcea8ff | 119 | typedef struct xLIST |
kenjiArai | 0:d4960fcea8ff | 120 | { |
kenjiArai | 0:d4960fcea8ff | 121 | volatile unsigned portBASE_TYPE uxNumberOfItems; |
kenjiArai | 0:d4960fcea8ff | 122 | volatile xListItem * pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to pvListGetOwnerOfNextEntry (). */ |
kenjiArai | 0:d4960fcea8ff | 123 | volatile xMiniListItem xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */ |
kenjiArai | 0:d4960fcea8ff | 124 | } xList; |
kenjiArai | 0:d4960fcea8ff | 125 | |
kenjiArai | 0:d4960fcea8ff | 126 | /* |
kenjiArai | 0:d4960fcea8ff | 127 | * Access macro to set the owner of a list item. The owner of a list item |
kenjiArai | 0:d4960fcea8ff | 128 | * is the object (usually a TCB) that contains the list item. |
kenjiArai | 0:d4960fcea8ff | 129 | * |
kenjiArai | 0:d4960fcea8ff | 130 | * \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER |
kenjiArai | 0:d4960fcea8ff | 131 | * \ingroup LinkedList |
kenjiArai | 0:d4960fcea8ff | 132 | */ |
kenjiArai | 0:d4960fcea8ff | 133 | #define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner ) ( pxListItem )->pvOwner = ( void * ) pxOwner |
kenjiArai | 0:d4960fcea8ff | 134 | |
kenjiArai | 0:d4960fcea8ff | 135 | /* |
kenjiArai | 0:d4960fcea8ff | 136 | * Access macro to set the value of the list item. In most cases the value is |
kenjiArai | 0:d4960fcea8ff | 137 | * used to sort the list in descending order. |
kenjiArai | 0:d4960fcea8ff | 138 | * |
kenjiArai | 0:d4960fcea8ff | 139 | * \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE |
kenjiArai | 0:d4960fcea8ff | 140 | * \ingroup LinkedList |
kenjiArai | 0:d4960fcea8ff | 141 | */ |
kenjiArai | 0:d4960fcea8ff | 142 | #define listSET_LIST_ITEM_VALUE( pxListItem, xValue ) ( pxListItem )->xItemValue = xValue |
kenjiArai | 0:d4960fcea8ff | 143 | |
kenjiArai | 0:d4960fcea8ff | 144 | /* |
kenjiArai | 0:d4960fcea8ff | 145 | * Access macro the retrieve the value of the list item. The value can |
kenjiArai | 0:d4960fcea8ff | 146 | * represent anything - for example a the priority of a task, or the time at |
kenjiArai | 0:d4960fcea8ff | 147 | * which a task should be unblocked. |
kenjiArai | 0:d4960fcea8ff | 148 | * |
kenjiArai | 0:d4960fcea8ff | 149 | * \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE |
kenjiArai | 0:d4960fcea8ff | 150 | * \ingroup LinkedList |
kenjiArai | 0:d4960fcea8ff | 151 | */ |
kenjiArai | 0:d4960fcea8ff | 152 | #define listGET_LIST_ITEM_VALUE( pxListItem ) ( ( pxListItem )->xItemValue ) |
kenjiArai | 0:d4960fcea8ff | 153 | |
kenjiArai | 0:d4960fcea8ff | 154 | /* |
kenjiArai | 0:d4960fcea8ff | 155 | * Access macro to determine if a list contains any items. The macro will |
kenjiArai | 0:d4960fcea8ff | 156 | * only have the value true if the list is empty. |
kenjiArai | 0:d4960fcea8ff | 157 | * |
kenjiArai | 0:d4960fcea8ff | 158 | * \page listLIST_IS_EMPTY listLIST_IS_EMPTY |
kenjiArai | 0:d4960fcea8ff | 159 | * \ingroup LinkedList |
kenjiArai | 0:d4960fcea8ff | 160 | */ |
kenjiArai | 0:d4960fcea8ff | 161 | #define listLIST_IS_EMPTY( pxList ) ( ( pxList )->uxNumberOfItems == ( unsigned portBASE_TYPE ) 0 ) |
kenjiArai | 0:d4960fcea8ff | 162 | |
kenjiArai | 0:d4960fcea8ff | 163 | /* |
kenjiArai | 0:d4960fcea8ff | 164 | * Access macro to return the number of items in the list. |
kenjiArai | 0:d4960fcea8ff | 165 | */ |
kenjiArai | 0:d4960fcea8ff | 166 | #define listCURRENT_LIST_LENGTH( pxList ) ( ( pxList )->uxNumberOfItems ) |
kenjiArai | 0:d4960fcea8ff | 167 | |
kenjiArai | 0:d4960fcea8ff | 168 | /* |
kenjiArai | 0:d4960fcea8ff | 169 | * Access function to obtain the owner of the next entry in a list. |
kenjiArai | 0:d4960fcea8ff | 170 | * |
kenjiArai | 0:d4960fcea8ff | 171 | * The list member pxIndex is used to walk through a list. Calling |
kenjiArai | 0:d4960fcea8ff | 172 | * listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list |
kenjiArai | 0:d4960fcea8ff | 173 | * and returns that entries pxOwner parameter. Using multiple calls to this |
kenjiArai | 0:d4960fcea8ff | 174 | * function it is therefore possible to move through every item contained in |
kenjiArai | 0:d4960fcea8ff | 175 | * a list. |
kenjiArai | 0:d4960fcea8ff | 176 | * |
kenjiArai | 0:d4960fcea8ff | 177 | * The pxOwner parameter of a list item is a pointer to the object that owns |
kenjiArai | 0:d4960fcea8ff | 178 | * the list item. In the scheduler this is normally a task control block. |
kenjiArai | 0:d4960fcea8ff | 179 | * The pxOwner parameter effectively creates a two way link between the list |
kenjiArai | 0:d4960fcea8ff | 180 | * item and its owner. |
kenjiArai | 0:d4960fcea8ff | 181 | * |
kenjiArai | 0:d4960fcea8ff | 182 | * @param pxList The list from which the next item owner is to be returned. |
kenjiArai | 0:d4960fcea8ff | 183 | * |
kenjiArai | 0:d4960fcea8ff | 184 | * \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY |
kenjiArai | 0:d4960fcea8ff | 185 | * \ingroup LinkedList |
kenjiArai | 0:d4960fcea8ff | 186 | */ |
kenjiArai | 0:d4960fcea8ff | 187 | // Modified by Kenji Arai / JH1PJL, October 31st,2010 |
kenjiArai | 0:d4960fcea8ff | 188 | #define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \ |
kenjiArai | 0:d4960fcea8ff | 189 | { \ |
kenjiArai | 0:d4960fcea8ff | 190 | xList * const pxConstList = pxList; \ |
kenjiArai | 0:d4960fcea8ff | 191 | /* Increment the index to the next item and return the item, ensuring */ \ |
kenjiArai | 0:d4960fcea8ff | 192 | /* we don't return the marker used at the end of the list. */ \ |
kenjiArai | 0:d4960fcea8ff | 193 | ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \ |
kenjiArai | 0:d4960fcea8ff | 194 | if( ( pxConstList )->pxIndex == ( xListItem * ) &( ( pxConstList )->xListEnd ) ) \ |
kenjiArai | 0:d4960fcea8ff | 195 | { \ |
kenjiArai | 0:d4960fcea8ff | 196 | ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \ |
kenjiArai | 0:d4960fcea8ff | 197 | } \ |
kenjiArai | 0:d4960fcea8ff | 198 | pxTCB = (tskTCB *)(( pxConstList )->pxIndex->pvOwner); \ |
kenjiArai | 0:d4960fcea8ff | 199 | } |
kenjiArai | 0:d4960fcea8ff | 200 | |
kenjiArai | 0:d4960fcea8ff | 201 | /* |
kenjiArai | 0:d4960fcea8ff | 202 | * Access function to obtain the owner of the first entry in a list. Lists |
kenjiArai | 0:d4960fcea8ff | 203 | * are normally sorted in ascending item value order. |
kenjiArai | 0:d4960fcea8ff | 204 | * |
kenjiArai | 0:d4960fcea8ff | 205 | * This function returns the pxOwner member of the first item in the list. |
kenjiArai | 0:d4960fcea8ff | 206 | * The pxOwner parameter of a list item is a pointer to the object that owns |
kenjiArai | 0:d4960fcea8ff | 207 | * the list item. In the scheduler this is normally a task control block. |
kenjiArai | 0:d4960fcea8ff | 208 | * The pxOwner parameter effectively creates a two way link between the list |
kenjiArai | 0:d4960fcea8ff | 209 | * item and its owner. |
kenjiArai | 0:d4960fcea8ff | 210 | * |
kenjiArai | 0:d4960fcea8ff | 211 | * @param pxList The list from which the owner of the head item is to be |
kenjiArai | 0:d4960fcea8ff | 212 | * returned. |
kenjiArai | 0:d4960fcea8ff | 213 | * |
kenjiArai | 0:d4960fcea8ff | 214 | * \page listGET_OWNER_OF_HEAD_ENTRY listGET_OWNER_OF_HEAD_ENTRY |
kenjiArai | 0:d4960fcea8ff | 215 | * \ingroup LinkedList |
kenjiArai | 0:d4960fcea8ff | 216 | */ |
kenjiArai | 0:d4960fcea8ff | 217 | #define listGET_OWNER_OF_HEAD_ENTRY( pxList ) ( ( pxList->uxNumberOfItems != ( unsigned portBASE_TYPE ) 0 ) ? ( (&( pxList->xListEnd ))->pxNext->pvOwner ) : ( NULL ) ) |
kenjiArai | 0:d4960fcea8ff | 218 | |
kenjiArai | 0:d4960fcea8ff | 219 | /* |
kenjiArai | 0:d4960fcea8ff | 220 | * Check to see if a list item is within a list. The list item maintains a |
kenjiArai | 0:d4960fcea8ff | 221 | * "container" pointer that points to the list it is in. All this macro does |
kenjiArai | 0:d4960fcea8ff | 222 | * is check to see if the container and the list match. |
kenjiArai | 0:d4960fcea8ff | 223 | * |
kenjiArai | 0:d4960fcea8ff | 224 | * @param pxList The list we want to know if the list item is within. |
kenjiArai | 0:d4960fcea8ff | 225 | * @param pxListItem The list item we want to know if is in the list. |
kenjiArai | 0:d4960fcea8ff | 226 | * @return pdTRUE is the list item is in the list, otherwise pdFALSE. |
kenjiArai | 0:d4960fcea8ff | 227 | * pointer against |
kenjiArai | 0:d4960fcea8ff | 228 | */ |
kenjiArai | 0:d4960fcea8ff | 229 | #define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( pxListItem )->pvContainer == ( void * ) pxList ) |
kenjiArai | 0:d4960fcea8ff | 230 | |
kenjiArai | 0:d4960fcea8ff | 231 | /* |
kenjiArai | 0:d4960fcea8ff | 232 | * Must be called before a list is used! This initialises all the members |
kenjiArai | 0:d4960fcea8ff | 233 | * of the list structure and inserts the xListEnd item into the list as a |
kenjiArai | 0:d4960fcea8ff | 234 | * marker to the back of the list. |
kenjiArai | 0:d4960fcea8ff | 235 | * |
kenjiArai | 0:d4960fcea8ff | 236 | * @param pxList Pointer to the list being initialised. |
kenjiArai | 0:d4960fcea8ff | 237 | * |
kenjiArai | 0:d4960fcea8ff | 238 | * \page vListInitialise vListInitialise |
kenjiArai | 0:d4960fcea8ff | 239 | * \ingroup LinkedList |
kenjiArai | 0:d4960fcea8ff | 240 | */ |
kenjiArai | 0:d4960fcea8ff | 241 | void vListInitialise( xList *pxList ); |
kenjiArai | 0:d4960fcea8ff | 242 | |
kenjiArai | 0:d4960fcea8ff | 243 | /* |
kenjiArai | 0:d4960fcea8ff | 244 | * Must be called before a list item is used. This sets the list container to |
kenjiArai | 0:d4960fcea8ff | 245 | * null so the item does not think that it is already contained in a list. |
kenjiArai | 0:d4960fcea8ff | 246 | * |
kenjiArai | 0:d4960fcea8ff | 247 | * @param pxItem Pointer to the list item being initialised. |
kenjiArai | 0:d4960fcea8ff | 248 | * |
kenjiArai | 0:d4960fcea8ff | 249 | * \page vListInitialiseItem vListInitialiseItem |
kenjiArai | 0:d4960fcea8ff | 250 | * \ingroup LinkedList |
kenjiArai | 0:d4960fcea8ff | 251 | */ |
kenjiArai | 0:d4960fcea8ff | 252 | void vListInitialiseItem( xListItem *pxItem ); |
kenjiArai | 0:d4960fcea8ff | 253 | |
kenjiArai | 0:d4960fcea8ff | 254 | /* |
kenjiArai | 0:d4960fcea8ff | 255 | * Insert a list item into a list. The item will be inserted into the list in |
kenjiArai | 0:d4960fcea8ff | 256 | * a position determined by its item value (descending item value order). |
kenjiArai | 0:d4960fcea8ff | 257 | * |
kenjiArai | 0:d4960fcea8ff | 258 | * @param pxList The list into which the item is to be inserted. |
kenjiArai | 0:d4960fcea8ff | 259 | * |
kenjiArai | 0:d4960fcea8ff | 260 | * @param pxNewListItem The item to that is to be placed in the list. |
kenjiArai | 0:d4960fcea8ff | 261 | * |
kenjiArai | 0:d4960fcea8ff | 262 | * \page vListInsert vListInsert |
kenjiArai | 0:d4960fcea8ff | 263 | * \ingroup LinkedList |
kenjiArai | 0:d4960fcea8ff | 264 | */ |
kenjiArai | 0:d4960fcea8ff | 265 | void vListInsert( xList *pxList, xListItem *pxNewListItem ); |
kenjiArai | 0:d4960fcea8ff | 266 | |
kenjiArai | 0:d4960fcea8ff | 267 | /* |
kenjiArai | 0:d4960fcea8ff | 268 | * Insert a list item into a list. The item will be inserted in a position |
kenjiArai | 0:d4960fcea8ff | 269 | * such that it will be the last item within the list returned by multiple |
kenjiArai | 0:d4960fcea8ff | 270 | * calls to listGET_OWNER_OF_NEXT_ENTRY. |
kenjiArai | 0:d4960fcea8ff | 271 | * |
kenjiArai | 0:d4960fcea8ff | 272 | * The list member pvIndex is used to walk through a list. Calling |
kenjiArai | 0:d4960fcea8ff | 273 | * listGET_OWNER_OF_NEXT_ENTRY increments pvIndex to the next item in the list. |
kenjiArai | 0:d4960fcea8ff | 274 | * Placing an item in a list using vListInsertEnd effectively places the item |
kenjiArai | 0:d4960fcea8ff | 275 | * in the list position pointed to by pvIndex. This means that every other |
kenjiArai | 0:d4960fcea8ff | 276 | * item within the list will be returned by listGET_OWNER_OF_NEXT_ENTRY before |
kenjiArai | 0:d4960fcea8ff | 277 | * the pvIndex parameter again points to the item being inserted. |
kenjiArai | 0:d4960fcea8ff | 278 | * |
kenjiArai | 0:d4960fcea8ff | 279 | * @param pxList The list into which the item is to be inserted. |
kenjiArai | 0:d4960fcea8ff | 280 | * |
kenjiArai | 0:d4960fcea8ff | 281 | * @param pxNewListItem The list item to be inserted into the list. |
kenjiArai | 0:d4960fcea8ff | 282 | * |
kenjiArai | 0:d4960fcea8ff | 283 | * \page vListInsertEnd vListInsertEnd |
kenjiArai | 0:d4960fcea8ff | 284 | * \ingroup LinkedList |
kenjiArai | 0:d4960fcea8ff | 285 | */ |
kenjiArai | 0:d4960fcea8ff | 286 | void vListInsertEnd( xList *pxList, xListItem *pxNewListItem ); |
kenjiArai | 0:d4960fcea8ff | 287 | |
kenjiArai | 0:d4960fcea8ff | 288 | /* |
kenjiArai | 0:d4960fcea8ff | 289 | * Remove an item from a list. The list item has a pointer to the list that |
kenjiArai | 0:d4960fcea8ff | 290 | * it is in, so only the list item need be passed into the function. |
kenjiArai | 0:d4960fcea8ff | 291 | * |
kenjiArai | 0:d4960fcea8ff | 292 | * @param vListRemove The item to be removed. The item will remove itself from |
kenjiArai | 0:d4960fcea8ff | 293 | * the list pointed to by it's pxContainer parameter. |
kenjiArai | 0:d4960fcea8ff | 294 | * |
kenjiArai | 0:d4960fcea8ff | 295 | * \page vListRemove vListRemove |
kenjiArai | 0:d4960fcea8ff | 296 | * \ingroup LinkedList |
kenjiArai | 0:d4960fcea8ff | 297 | */ |
kenjiArai | 0:d4960fcea8ff | 298 | void vListRemove( xListItem *pxItemToRemove ); |
kenjiArai | 0:d4960fcea8ff | 299 | |
kenjiArai | 0:d4960fcea8ff | 300 | #ifdef __cplusplus |
kenjiArai | 0:d4960fcea8ff | 301 | } |
kenjiArai | 0:d4960fcea8ff | 302 | #endif |
kenjiArai | 0:d4960fcea8ff | 303 | |
kenjiArai | 0:d4960fcea8ff | 304 | #endif |
kenjiArai | 0:d4960fcea8ff | 305 |