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

📄 cxbfcre.c

📁 上传一个带源代码的嵌入式实时多任务操作系统CMX
💻 C
字号:
/*********************************************************

Copyright (c) CMX Company. 1999. All rights reserved

*********************************************************/
/* version 5.30 */

#define CMXMODULE 1

#include <cxfuncs.h>	/* get cmx include header file */
#include <cxextern.h>	/* get cmx include header file */

#if (defined(CMXTRACKER) || defined(WINTRACKER))
#include <cmxtrack.h>	/* get cmx include header file */
#endif

/* here's what a memory partition will look like
	ptr head = ptr to head of free list_ptr
	byte body = body of memory partition starts here

	does not test to ensure size of array is large enough for
	block size times the number of blocks */

/****************************************************************
 This function creates a fixed memory block according to the
 parameters passed. Make note, that the memory address supplied
 as the beginning of this fixed memory block is not tested as
 to legal CPU boundries and that the size of this memory block
 is free to be used.
****************************************************************/
void K_Mem_FB_Create(void *part,word16 bsize,word16 nblocks)
{
	byte *link;		/* scratch pointer */

#if (defined(CMXTRACKER) || defined(WINTRACKER))
		if (CMXTRACKER_ON)
			{
#if (defined(WINTRACKER))
			cmxtracker_in1(CXBFCRE_K_OK);
#else
			cmxtracker_in5(CXBFCRE_K_OK,0,part);
#endif
			}
#endif
	link = (byte *)part + sizeof(byte *); /* address of 1st block */
	*(byte **) part = link;	/* point head at 1st block */

	while (nblocks--)
	{
		part = link;		/* skip to next block */
		/* compute addr of next block */
		link += bsize;		/* compute addr of next block */
		*(byte **) part = link;	/* create link to it */
	}
	*(word16 **) part = 0;	/* last link in chain is null */
}

⌨️ 快捷键说明

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