XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
bma.h
浏览该文件的文档.
1
13#ifndef __xwos_mm_bma_h__
14#define __xwos_mm_bma_h__
15
16#include <xwos/standard.h>
17#include <xwos/lib/bclst.h>
18#include <xwos/lib/xwbop.h>
20#include <xwos/mm/common.h>
21
44#define XWMM_BMA_MAX_ORDER ((xwu8_t)126)
45#define XWMM_BMA_COMBINED ((xwu8_t)127)
46#define XWMM_BMA_ORDER_MASK ((xwu8_t)0x7F)
47#define XWMM_BMA_INUSED ((xwu8_t)0x80)
55#define XWMM_BMA_RAWOBJ_DEF(name, blkodr) \
56 xwu8_t name[sizeof(struct xwmm_bma) + \
57 sizeof(struct xwmm_bma_orderlist[(blkodr) + 1U]) + \
58 sizeof(struct xwmm_bma_bcb[1U << (blkodr)])]
59
65};
66
75};
76
80struct xwmm_bma {
81 struct xwmm_zone zone;
82 const char * name;
85 struct xwos_splk lock;
87 struct xwmm_bma_bcb * bcbs;
88};
89
109xwer_t xwmm_bma_init(struct xwmm_bma * bma, const char * name,
110 xwptr_t origin, xwsz_t size,
111 xwsz_t blksize, xwsz_t blkodr);
112
127xwer_t xwmm_bma_alloc(struct xwmm_bma * bma, xwsq_t order, void ** membuf);
128
142xwer_t xwmm_bma_free(struct xwmm_bma * bma, void * mem);
143
148#endif /* xwos/mm/bma.h */
XWOS通用库:双循环链表
xwer_t xwmm_bma_init(struct xwmm_bma *bma, const char *name, xwptr_t origin, xwsz_t size, xwsz_t blksize, xwsz_t blkodr)
XWMM API:初始化伙伴算法内存块分配器
Definition bma.c:62
xwer_t xwmm_bma_free(struct xwmm_bma *bma, void *mem)
XWMM API:释放内存块
Definition bma.c:402
xwer_t xwmm_bma_alloc(struct xwmm_bma *bma, xwsq_t order, void **membuf)
XWMM API:申请一块连续的内存
Definition bma.c:311
#define xwlib_bclst_head
双循环链表头
Definition bclst.h:35
signed long xwer_t
Definition type.h:554
unsigned long xwsz_t
Definition type.h:339
uint8_t xwu8_t
Definition type.h:194
unsigned long xwsq_t
Definition type.h:445
unsigned long xwptr_t
Definition type.h:375
操作系统抽象层:自旋锁
块控制块
Definition bma.h:70
xwu8_t order
Definition bma.h:71
阶链表
Definition bma.h:63
struct xwlib_bclst_node head
Definition bma.h:64
伙伴算法内存块分配器
Definition bma.h:80
struct xwmm_zone zone
Definition bma.h:81
struct xwos_splk lock
Definition bma.h:85
struct xwmm_bma_orderlist * orderlists
Definition bma.h:86
const char * name
Definition bma.h:82
struct xwmm_bma_bcb * bcbs
Definition bma.h:87
xwsq_t blkodr
Definition bma.h:84
xwsz_t blksize
Definition bma.h:83
XWOS内存区域
Definition common.h:40
XWOS API:自旋锁
Definition spinlock.h:73
XWOS通用库:位操作
XWOS内存管理:通用定义
XWOS的标准头文件