cxbfcre.c
来自「CMEX source code RTOS for atmel atmega12」· C语言 代码 · 共 54 行
C
54 行
/*********************************************************
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 */
#ifdef CMXTRACKER
#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 */
#ifdef CMXTRACKER
if (CMXTRACKER_ON)
{
cmxtracker_in5(CXBFCRE_K_OK,0,part);
}
#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 + =
减小字号Ctrl + -
显示快捷键?