📄 rdmalloc.c
字号:
/*************************************************************
File Name: RdMalloc.c (RAMDisk 4.1) *
**************************************************************
Programmer: chilong
Last Modified Date: 2001/8/31
Compiler : GNU Cross-compiler/SDS
Platform : ARM
Usage :
*************************************************************/
/*************************************************************
History
**************************************************************/
/*
* Version: 4.1
* Date 2001/8/31
*
*/
/*************************************************************
Global Definitions
**************************************************************/
/*************************************************************
Header Files
**************************************************************/
#include <sys/syscall.h>
//#include <ansi_c/stdio.h>
/**** modified by chilong 8/23/2001 ****/
#include <stdio.h>
/**** modified by chilong 8/23/2001 ****/
//#include "myansi.h"
#include <ramdisk.h>
#include <dskblk.h>
#ifdef RAMDISK_ID
/*************************************************************
Function: RD_ramdisk_malloc
Description:
allocate the needed size
Input:
wantSize - the size of the memory
blockType - what this block will be used for
Output:
void* pointer which indicates the start position of the
allocated memory
**************************************************************/
void* RD_ramdisk_malloc(unsigned long wantSize, int blockType)
{
struct diskBlock* blk;
blk = RD_getBlock(wantSize);
if (blk == NULL)
return NULL;
if (blockType < BLOCK_FREE || blockType > BLOCK_FOR_DLL)
return NULL;
// this block is for dll
blk->status = blockType;
return blk;
}
/*************************************************************
Function: RD_ramdisk_free
Description:
free the memory that the pointer points to
Input:
Output:
**************************************************************/
void RD_ramdisk_free(void *pointer)
{
RD_freeBlock(pointer);
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -