ill_defs.h
来自「澳洲人写的Cortex,包括uC_IP协议栈」· C头文件 代码 · 共 254 行 · 第 1/2 页
H
254 行
# define</font></b> <font color="maroon"><a name="ILST_SET_POOL_ID">ILST_SET_POOL_ID</a></font>(_pool) ((_pool)->CheckID=ILST_POOL_ID)<b><font color='DarkGreen'># define</font></b> <font color="maroon"><a name="ILST_CHECK_LIST_ID">ILST_CHECK_LIST_ID</a></font>(_list) ((_list)->CheckID==ILST_LIST_ID)<b><font color='DarkGreen'># define</font></b> <font color="maroon"><a name="ILST_CHECK_NODE_ID">ILST_CHECK_NODE_ID</a></font>(_node) ((_node)->CheckID==ILST_NODE_ID)<b><font color='DarkGreen'># define</font></b> <font color="maroon"><a name="ILST_CHECK_POOL_ID">ILST_CHECK_POOL_ID</a></font>(_pool) ((_pool)->CheckID==ILST_POOL_ID)<b><font color='DarkGreen'>#endif</font></b><font color="maroon"> <font color="#6920ac">/* ENVI_CRTX_ERR_CHECK_LEVEL == 0 */</font></font><font color="#6920ac">/*********************** * GLOBAL DATA TYPES * ***********************/</font><i><a name="ilst_Index_t">typedef</a></i> <i>crtx_Int_t</i> <i><font color='DarkBlue'>ilst_Index_t</font></i>;<i><a name="ilst_Key_t">typedef</a></i> <i>crtx_Uint32_t</i> <i><font color='DarkBlue'>ilst_Key_t</font></i>;<font color="#6920ac">/* * ILL Attributes Structure. The following structure allowes to * specify ILL attributes when list is created. */</font><i><a name="ilst_Attr_t">typedef</a></i> <i>struct</i> ilst_Attr_s { <i>crtx_SegNum_t</i> Segment; <font color="#6920ac">/* memory segment */</font>} <i><font color='DarkBlue'>ilst_Attr_t</font></i>;<font color="#6920ac">/* * Index linked list's node */</font><i><a name="ilst_Node_t">typedef</a></i> <i>struct</i> ilst_Node_s { <i>ilst_Index_t</i> Next; <font color="#6920ac">/* next node */</font> <i>ilst_Index_t</i> Prev; <font color="#6920ac">/* previous node */</font> <i>ilst_Key_t</i> Key; <font color="#6920ac">/* node's key */</font><b><font color='DarkGreen'>#if</font></b><font color="maroon"> ENVI_CRTX_ERR_CHECK_LEVEL > 0</font> <i>crtx_Uint32_t</i> CheckID; <font color="#6920ac">/* node id (for error checking) */</font> <i>struct</i> ilst_Pool_s *pPool; <font color="#6920ac">/* pool id */</font><b><font color='DarkGreen'>#endif</font></b><font color="maroon"> <font color="#6920ac">/* ENVI_CRTX_ERR_CHECK_LEVEL > 0 */</font></font>} <i><font color='DarkBlue'>ilst_Node_t</font></i>;<font color="#6920ac">/* * Index linked lists pool (pool contains logically related lists) */</font><i><a name="ilst_Pool_t">typedef</a></i> <i>struct</i> ilst_Pool_s { <i>crtx_Int_t</i> NrLists; <font color="#6920ac">/* Nr of lists in the pool */</font> <i>crtx_Int_t</i> NrNodes; <font color="#6920ac">/* Nr of nodes in table */</font> <i>ilst_Index_t</i> NextList; <font color="#6920ac">/* next list to allocate */</font> <i>ilst_Node_t</i> *pTable; <font color="#6920ac">/* table of the list nodes */</font> <i>crtx_Int_t</i> Flags; <font color="#6920ac">/* ILL pool's flags */</font> <i>ilst_Attr_t</i> Attr; <font color="#6920ac">/* pool's attributes */</font><b><font color='DarkGreen'>#if</font></b><font color="maroon"> ENVI_CRTX_ERR_CHECK_LEVEL > 0</font> <i>crtx_Uint32_t</i> CheckID; <font color="#6920ac">/* pool id (for error checking) */</font><b><font color='DarkGreen'>#endif</font></b><font color="maroon"> <font color="#6920ac">/* ENVI_CRTX_ERR_CHECK_LEVEL > 0 */</font></font>} <i><font color='DarkBlue'>ilst_Pool_t</font></i>;<font color="#6920ac">/* * Index linked list's control block */</font><i><a name="ilst_List_t">typedef</a></i> <i>struct</i> ilst_List_s { <i>ilst_Index_t</i> Index; <font color="#6920ac">/* index of this list's head node */</font> <font color="#6920ac">/* tail node follows */</font> <i>ilst_Pool_t</i> *pPool; <font color="#6920ac">/* ILL pool */</font> <i>ilst_Node_t</i> *pTable; <font color="#6920ac">/* node table */</font> <i>crtx_Int_t</i> Flags; <font color="#6920ac">/* list flags */</font><b><font color='DarkGreen'>#if</font></b><font color="maroon"> ENVI_CRTX_ERR_CHECK_LEVEL > 0</font> <i>crtx_Int_t</i> NrNodes; <font color="#6920ac">/* Nr of nodes in table */</font> <i>crtx_Uint32_t</i> CheckID; <font color="#6920ac">/* list id (for error checking) */</font><b><font color='DarkGreen'>#endif</font></b><font color="maroon"> <font color="#6920ac">/* ENVI_CRTX_ERR_CHECK_LEVEL > 0 */</font></font>} <i><font color='DarkBlue'>ilst_List_t</font></i>;<font color="#6920ac">/***************** * GLOBAL DATA * *****************/</font><i>extern</i> <i>ilst_Attr_t</i> ilst_AttrDefault_g; <font color="#6920ac">/* default attribute */</font><font color="#6920ac">/*************************** * PROCEDURES PROTOTYPES * ***************************/</font><font color="#6920ac">/* * Index Linked List Component Core Functions */</font><font color="#6920ac">/* Services to manipulate Index Linked List */</font> <font color="#6920ac">/* Create pool of the index linked lists */</font><font size="+1"><i>ilst_Pool_t</i> *<a href="ilst_CreatePool.FIND-FUNC">ilst_CreatePool</a>(<i>ilst_Pool_t</i> *pPool_a, <i>ilst_Node_t</i> *pTable_a, <i>crtx_Int_t</i> Nodes_a, <i>crtx_Int_t</i> Lists_a, <i>ilst_Attr_t</i> *pAttr_a);</font><font color="#6920ac">/* Destroy ILL pool */</font><font size="+1"><i>crtx_Void_t</i> <a href="ilst_DestroyPool.FIND-FUNC">ilst_DestroyPool</a>(<i>ilst_Pool_t</i> *pPool_a);</font><font color="#6920ac">/* Allocate Index Linked List from the specified pool */</font><font size="+1"><i>ilst_List_t</i> *<a href="ilst_AllocateList.FIND-FUNC">ilst_AllocateList</a>(<i>ilst_Pool_t</i> *pPool_a, <i>ilst_List_t</i> *pList_a, <i>ilst_Key_t</i> MinKey_a, <i>ilst_Key_t</i> MaxKey_a);</font><font color="#6920ac">/* Free Index Linked List's control block */</font><font size="+1"><i>crtx_Void_t</i> <a href="ilst_FreeList.FIND-FUNC">ilst_FreeList</a>(<i>ilst_List_t</i> *pList_a);</font><font color="#6920ac">/* Test whether a index linked list is empty or not */</font><font size="+1"><i>crtx_Boolean_t</i> <a href="ilst_IsEmpty.FIND-FUNC">ilst_IsEmpty</a>(<i>ilst_List_t</i> *pList_a);</font><font color="#6920ac">/* Insert a node at head of a index linked list */</font><font size="+1"><i>ilst_Index_t</i> <a href="ilst_AddHead.FIND-FUNC">ilst_AddHead</a>(<i>ilst_List_t</i> *pList_a, <i>ilst_Index_t</i> Node_a);</font><font color="#6920ac">/* Insert a node at tail of a index linked list */</font><font size="+1"><i>ilst_Index_t</i> <a href="ilst_AddTail.FIND-FUNC">ilst_AddTail</a>(<i>ilst_List_t</i> *pList_a, <i>ilst_Index_t</i> Node_a);</font><font color="#6920ac">/* Remove a node from tail of a index linked list */</font><font size="+1"><i>ilst_Index_t</i> <a href="ilst_RemoveTail.FIND-FUNC">ilst_RemoveTail</a>(<i>ilst_List_t</i> *pList_a);</font><font color="#6920ac">/* Remove a node from head of a index linked list */</font><font size="+1"><i>ilst_Index_t</i> <a href="ilst_RemoveHead.FIND-FUNC">ilst_RemoveHead</a>(<i>ilst_List_t</i> *pList_a);</font><font color="#6920ac">/* Insert a node at index linked list in key order */</font><font size="+1"><i>ilst_Index_t</i> <a href="ilst_Enqueue.FIND-FUNC">ilst_Enqueue</a>(<i>ilst_List_t</i> *pList_a, <i>ilst_Index_t</i> Node_a, <i>ilst_Key_t</i> Key_a);</font><font color="#6920ac">/* Remove a node from a index linked list it's currently on */</font><font size="+1"><i>ilst_Index_t</i> <a href="ilst_Dequeue.FIND-FUNC">ilst_Dequeue</a>(<i>ilst_Pool_t</i> *pPool_a, <i>ilst_Index_t</i> Node_a);</font><font color="#6920ac">/* ===== END OF THE DEFINITION FILE ===== */</font><b><font color='DarkGreen'>#ifdef</font></b><font color="maroon"> __cplusplus</font>}<b><font color='DarkGreen'>#endif</font></b><font color="maroon"> <font color="#6920ac">/* __cplusplus */</font></font><b><font color='DarkGreen'>#endif</font></b><font color="maroon"> <font color="#6920ac">/* __ILL_DEFS__H */</font></font></pre></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?