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
>
19
#include <
xwos/osal/lock/spinlock.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
63
struct
xwmm_bma_orderlist
{
64
struct
xwlib_bclst_head
head
;
65
};
66
70
struct
xwmm_bma_bcb
{
71
xwu8_t
order
;
75
};
76
80
struct
xwmm_bma
{
81
struct
xwmm_zone
zone
;
82
const
char
*
name
;
83
xwsz_t
blksize
;
84
xwsq_t
blkodr
;
85
struct
xwos_splk
lock
;
86
struct
xwmm_bma_orderlist
*
orderlists
;
87
struct
xwmm_bma_bcb
*
bcbs
;
88
};
89
109
xwer_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
127
xwer_t
xwmm_bma_alloc
(
struct
xwmm_bma
* bma,
xwsq_t
order
,
void
** membuf);
128
142
xwer_t
xwmm_bma_free
(
struct
xwmm_bma
* bma,
void
* mem);
143
148
#endif
/* xwos/mm/bma.h */
bclst.h
XWOS通用库:双循环链表
xwmm_bma_init
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
xwmm_bma_free
xwer_t xwmm_bma_free(struct xwmm_bma *bma, void *mem)
XWMM API:释放内存块
Definition
bma.c:402
xwmm_bma_alloc
xwer_t xwmm_bma_alloc(struct xwmm_bma *bma, xwsq_t order, void **membuf)
XWMM API:申请一块连续的内存
Definition
bma.c:311
xwlib_bclst_head
#define xwlib_bclst_head
双循环链表头
Definition
bclst.h:35
xwer_t
signed long xwer_t
Definition
type.h:554
xwsz_t
unsigned long xwsz_t
Definition
type.h:339
xwu8_t
uint8_t xwu8_t
Definition
type.h:194
xwsq_t
unsigned long xwsq_t
Definition
type.h:445
xwptr_t
unsigned long xwptr_t
Definition
type.h:375
spinlock.h
操作系统抽象层:自旋锁
xwmm_bma_bcb
块控制块
Definition
bma.h:70
xwmm_bma_bcb::order
xwu8_t order
Definition
bma.h:71
xwmm_bma_orderlist
阶链表
Definition
bma.h:63
xwmm_bma_orderlist::head
struct xwlib_bclst_node head
Definition
bma.h:64
xwmm_bma
伙伴算法内存块分配器
Definition
bma.h:80
xwmm_bma::zone
struct xwmm_zone zone
Definition
bma.h:81
xwmm_bma::lock
struct xwos_splk lock
Definition
bma.h:85
xwmm_bma::orderlists
struct xwmm_bma_orderlist * orderlists
Definition
bma.h:86
xwmm_bma::name
const char * name
Definition
bma.h:82
xwmm_bma::bcbs
struct xwmm_bma_bcb * bcbs
Definition
bma.h:87
xwmm_bma::blkodr
xwsq_t blkodr
Definition
bma.h:84
xwmm_bma::blksize
xwsz_t blksize
Definition
bma.h:83
xwmm_zone
XWOS内存区域
Definition
common.h:40
xwos_splk
XWOS API:自旋锁
Definition
spinlock.h:73
xwbop.h
XWOS通用库:位操作
common.h
XWOS内存管理:通用定义
standard.h
XWOS的标准头文件
xwos
mm
bma.h
制作者
1.9.7