⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mem.h

📁 日本著名的的嵌入式实时操作系统T-Kernel的源码及用户手册。
💻 H
字号:
/* *---------------------------------------------------------------------- *    T-Kernel * *    Copyright (C) 2004 by Ken Sakamura. All rights reserved. *    T-Kernel is distributed under the T-License. *---------------------------------------------------------------------- * *    Version:   1.01.00 *    Released by T-Engine Forum(http://www.t-engine.org) at 2004/6/28. * *---------------------------------------------------------------------- *//* *	@(#)mem.h (libtk) * *	Memory local allocation library  */#include <basic.h>#include <sys/memalloc.h>#include <libstr.h>/* * Minimum fragmentation unit  *	Since memory is allocated in ROUNDSZ units, *	the lower three bits of the address must be 0. *	These low three bits are used in the flag in the area queue. */#define	ROUNDSZ		( sizeof(QUEUE) )	/* 8 byte */#define	ROUND(sz)	( ((sz) + (ROUNDSZ-1)) & ~(ROUNDSZ-1) )/* Minimum fragment size */#define	MIN_FRAGMENT	( _mem_minfragment )/* * Flag that uses the lower bits of the area queue prev   */#define	AREA_USE	0x00000001	/* In use */#define	AREA_TOP	0x00000002	/* Top of page */#define	AREA_END	0x00000004	/* End of page */#define	AREA_MASK	0x00000007#define	setAreaFlag(q, f)     ( (q)->prev = (QUEUE*)((UW)(q)->prev |  (f)) )#define	clrAreaFlag(q, f)     ( (q)->prev = (QUEUE*)((UW)(q)->prev & ~(f)) )#define	chkAreaFlag(q, f)     ( ((UW)(q)->prev & (f)) != 0 )#define	Mask(x)		( (QUEUE*)((UW)(x) & ~AREA_MASK) )#define	Assign(x, y)	( (x) = (QUEUE*)(((UW)(x) & AREA_MASK) | (UW)(y)) )/* * Area size  */#define	AreaSize(aq)	( (VB*)(aq)->next - (VB*)((aq) + 1) )#define	FreeSize(fq)	( (VB*)((fq) - 1)->next - (VB*)(fq) )/* * Memory allocation check function */IMPORT BOOL (*_mem_chkalloc)( void *ptr, int mode, MACB *macb );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -