1 /* 2 * Copyright (c) 2006-2022, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2022-11-14 WangXiaoyao the first version 9 */ 10 11 #ifndef __MM_AVL_ADPT_H__ 12 #define __MM_AVL_ADPT_H__ 13 14 #include <avl.h> 15 #include <rtdef.h> 16 #include <rtthread.h> 17 #include <stdint.h> 18 19 #define VAREA_ENTRY(pnode) \ 20 (pnode) \ 21 ? rt_container_of(rt_container_of(pnode, struct _aspace_node, node), \ 22 struct rt_varea, node) \ 23 : 0 24 25 #define ASPACE_VAREA_NEXT(pva) (VAREA_ENTRY(util_avl_next(&pva->node.node))) 26 #define ASPACE_VAREA_FIRST(aspace) (VAREA_ENTRY(util_avl_first(&aspace->tree.tree))) 27 #define ASPACE_VAREA_LAST(aspace) (VAREA_ENTRY(util_avl_last(&aspace->tree.tree))) 28 #define ASPACE_VAREA_PREV(pva) (VAREA_ENTRY(util_avl_prev(&pva->node.node))) 29 30 typedef struct _aspace_node 31 { 32 struct util_avl_struct node; 33 } *_aspace_node_t; 34 35 typedef struct _aspace_tree 36 { 37 struct util_avl_root tree; 38 } *_aspace_tree_t; 39 40 #endif /* __MM_AVL_ADPT_H__ */ 41