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.h
00001 /*! 00002 * Copyright (c) 2015, Freescale Semiconductor, Inc. 00003 * All rights reserved. 00004 * 00005 * \file GenericList.h 00006 * This is the header file for the linked lists part of the Utils package. 00007 * 00008 * Redistribution and use in source and binary forms, with or without modification, 00009 * are permitted provided that the following conditions are met: 00010 * 00011 * o Redistributions of source code must retain the above copyright notice, this list 00012 * of conditions and the following disclaimer. 00013 * 00014 * o Redistributions in binary form must reproduce the above copyright notice, this 00015 * list of conditions and the following disclaimer in the documentation and/or 00016 * other materials provided with the distribution. 00017 * 00018 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its 00019 * contributors may be used to endorse or promote products derived from this 00020 * software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00023 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00024 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00025 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 00026 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00027 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00029 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00031 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 */ 00033 00034 #ifndef _GENERIC_LIST_H_ 00035 #define _GENERIC_LIST_H_ 00036 00037 00038 /*! ********************************************************************************* 00039 ************************************************************************************* 00040 * Include 00041 ************************************************************************************* 00042 ********************************************************************************** */ 00043 00044 #include "EmbeddedTypes.h " 00045 00046 /*! ********************************************************************************* 00047 ************************************************************************************* 00048 * Public macro definitions 00049 ************************************************************************************* 00050 ********************************************************************************** */ 00051 00052 /*! ********************************************************************************* 00053 ************************************************************************************* 00054 * Public type definitions 00055 ************************************************************************************* 00056 ********************************************************************************** */ 00057 typedef enum 00058 { 00059 gListOk_c = 0, 00060 gListFull_c, 00061 gListEmpty_c, 00062 gOrphanElement_c 00063 }listStatus_t ; 00064 00065 typedef struct list_tag 00066 { 00067 struct listElement_tag *head; 00068 struct listElement_tag *tail; 00069 uint16_t size; 00070 uint16_t max; 00071 }list_t, *listHandle_t; 00072 00073 typedef struct listElement_tag 00074 { 00075 struct listElement_tag *next; 00076 struct listElement_tag *prev; 00077 struct list_tag *list; 00078 }listElement_t, *listElementHandle_t; 00079 00080 /*! ********************************************************************************* 00081 ************************************************************************************* 00082 * Public prototypes 00083 ************************************************************************************* 00084 ********************************************************************************** */ 00085 void ListInit(listHandle_t list, uint32_t max); 00086 listHandle_t ListGetList(listElementHandle_t element); 00087 listStatus_t ListAddHead(listHandle_t list, listElementHandle_t element); 00088 listStatus_t ListAddTail(listHandle_t list, listElementHandle_t element); 00089 listElementHandle_t ListRemoveHead(listHandle_t list); 00090 listElementHandle_t ListGetHead(listHandle_t list); 00091 listElementHandle_t ListGetNext(listElementHandle_t element); 00092 listElementHandle_t ListGetPrev(listElementHandle_t element); 00093 listStatus_t ListRemoveElement(listElementHandle_t element); 00094 listStatus_t ListAddPrevElement(listElementHandle_t element, listElementHandle_t newElement); 00095 uint32_t ListGetSize(listHandle_t list); 00096 uint32_t ListGetAvailable(listHandle_t list); 00097 listStatus_t ListTest(void); 00098 00099 /*! ********************************************************************************* 00100 ************************************************************************************* 00101 * Private macros 00102 ************************************************************************************* 00103 ********************************************************************************** */ 00104 #ifdef DEBUG_ASSERT 00105 #define LIST_ASSERT(condition) if(!(condition))while(1); 00106 #else 00107 #define LIST_ASSERT(condition) (void)(condition); 00108 #endif 00109 00110 #endif /*_GENERIC_LIST_H_*/
Generated on Fri Jul 15 2022 21:41:17 by
