Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of fsl_phy_mcr20a by
GenericList.c File Reference
Go to the source code of this file.
Functions | |
void | ListInit (listHandle_t list, uint32_t max) |
Initialises the list descriptor. | |
listHandle_t | ListGetList (listElementHandle_t elementHandle) |
Gets the list that contains the given element. | |
listStatus_t | ListAddTail (listHandle_t list, listElementHandle_t element) |
Links element to the tail of the list. | |
listStatus_t | ListAddHead (listHandle_t list, listElementHandle_t element) |
Links element to the head of the list. | |
listElementHandle_t | ListRemoveHead (listHandle_t list) |
Unlinks element from the head of the list. | |
listElementHandle_t | ListGetHead (listHandle_t list) |
Gets head element ID. | |
listElementHandle_t | ListGetNext (listElementHandle_t element) |
Gets next element ID. | |
listElementHandle_t | ListGetPrev (listElementHandle_t element) |
Gets previous element ID. | |
listStatus_t | ListRemoveElement (listElementHandle_t element) |
Unlinks an element from its list. | |
listStatus_t | ListAddPrevElement (listElementHandle_t element, listElementHandle_t newElement) |
Links an element in the previous position relative to a given member of a list. | |
uint32_t | ListGetSize (listHandle_t list) |
Gets the current size of a list. | |
uint32_t | ListGetAvailable (listHandle_t list) |
Gets the number of free places in the list. | |
listStatus_t | ListTest () |
Creates, tests and deletes a list. Any error that occurs will trap the CPU in a while(1) loop. |
Detailed Description
Copyright (c) 2015, Freescale Semiconductor, Inc. All rights reserved.
This is the source file for the linked lists part of the Utils package.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
o Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
o Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
o Neither the name of Freescale Semiconductor, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file GenericList.c.
Function Documentation
listStatus_t ListAddHead | ( | listHandle_t | list, |
listElementHandle_t | element | ||
) |
Links element to the head of the list.
*********************************************************************************
- Parameters:
-
[in] list - ID of list to insert into. element - element to add
- Returns:
- gListFull_c if list is full. gListOk_c if insertion was successful.
- Precondition:
- Postcondition:
- Remarks:
Definition at line 153 of file GenericList.c.
listStatus_t ListAddPrevElement | ( | listElementHandle_t | element, |
listElementHandle_t | newElement | ||
) |
Links an element in the previous position relative to a given member of a list.
*********************************************************************************
- Parameters:
-
[in] element - ID of a member of a list. newElement - new element to insert before the given member.
- Returns:
- gOrphanElement_c if element is not part of any list. gListFull_c if list is full. gListOk_c if insertion was successful.
- Precondition:
- Postcondition:
- Remarks:
Definition at line 350 of file GenericList.c.
listStatus_t ListAddTail | ( | listHandle_t | list, |
listElementHandle_t | element | ||
) |
Links element to the tail of the list.
*********************************************************************************
- Parameters:
-
[in] list - ID of list to insert into. element - element to add
- Returns:
- gListFull_c if list is full. gListOk_c if insertion was successful.
- Precondition:
- Postcondition:
- Remarks:
Definition at line 109 of file GenericList.c.
uint32_t ListGetAvailable | ( | listHandle_t | list ) |
Gets the number of free places in the list.
*********************************************************************************
- Parameters:
-
[in] list - ID of the list.
- Returns:
- Available size of the list.
- Precondition:
- Postcondition:
- Remarks:
Definition at line 415 of file GenericList.c.
listElementHandle_t ListGetHead | ( | listHandle_t | list ) |
Gets head element ID.
*********************************************************************************
- Parameters:
-
[in] list - ID of list.
- Returns:
- NULL if list is empty. ID of head element if list is not empty.
- Precondition:
- Postcondition:
- Remarks:
Definition at line 240 of file GenericList.c.
listHandle_t ListGetList | ( | listElementHandle_t | elementHandle ) |
Gets the list that contains the given element.
*********************************************************************************
- Parameters:
-
[in] element - Handle of the element.
- Returns:
- NULL if element is orphan. Handle of the list the element is inserted into.
- Precondition:
- Postcondition:
- Remarks:
Definition at line 88 of file GenericList.c.
listElementHandle_t ListGetNext | ( | listElementHandle_t | element ) |
Gets next element ID.
*********************************************************************************
- Parameters:
-
[in] element - ID of the element.
- Returns:
- NULL if element is tail. ID of next element if exists.
- Precondition:
- Postcondition:
- Remarks:
Definition at line 260 of file GenericList.c.
listElementHandle_t ListGetPrev | ( | listElementHandle_t | element ) |
Gets previous element ID.
*********************************************************************************
- Parameters:
-
[in] element - ID of the element.
- Returns:
- NULL if element is head. ID of previous element if exists.
- Precondition:
- Postcondition:
- Remarks:
Definition at line 280 of file GenericList.c.
uint32_t ListGetSize | ( | listHandle_t | list ) |
Gets the current size of a list.
*********************************************************************************
- Parameters:
-
[in] list - ID of the list.
- Returns:
- Current size of the list.
- Precondition:
- Postcondition:
- Remarks:
Definition at line 396 of file GenericList.c.
void ListInit | ( | listHandle_t | list, |
uint32_t | max | ||
) |
Initialises the list descriptor.
*********************************************************************************
Include
*********************************************************************************
Public functions
*********************************************************************************
- Parameters:
-
[in] list - List handle to init. max - Maximum number of elements in list. 0 for unlimited.
- Returns:
- void.
- Precondition:
- Postcondition:
- Remarks:
Definition at line 65 of file GenericList.c.
listStatus_t ListRemoveElement | ( | listElementHandle_t | element ) |
Unlinks an element from its list.
*********************************************************************************
- Parameters:
-
[in] element - ID of the element to remove.
- Returns:
- gOrphanElement_c if element is not part of any list. gListOk_c if removal was successful.
- Precondition:
- Postcondition:
- Remarks:
Definition at line 300 of file GenericList.c.
listElementHandle_t ListRemoveHead | ( | listHandle_t | list ) |
Unlinks element from the head of the list.
*********************************************************************************
- Parameters:
-
[in] list - ID of list to remove from.
- Returns:
- NULL if list is empty. ID of removed element(pointer) if removal was successful.
- Precondition:
- Postcondition:
- Remarks:
Definition at line 196 of file GenericList.c.
listStatus_t ListTest | ( | void | ) |
Creates, tests and deletes a list. Any error that occurs will trap the CPU in a while(1) loop.
*********************************************************************************
- Parameters:
-
[in] void.
- Returns:
- gListOk_c.
- Precondition:
- Postcondition:
- Remarks:
Definition at line 437 of file GenericList.c.
Generated on Fri Jul 15 2022 21:41:18 by
