📄 heap.c
字号:
/***************************************************************************
* Copyright ? Intel Corporation, March 18th 1998. All rights reserved.
* Copyright ? ARM Limited 1998. All rights reserved.
***************************************************************************/
/*****************************************************************************
$Id: heap.c,v 1.3 1999/05/19 16:25:50 dbrooke Exp $
******************************************************************************/
#include "uhal.h"
extern void print_header( void);
char * test_name = "Heap Storage Tests\n";
char * test_ver = "Program Version 1.0\n";
extern void print_end (void);
int main (int argc, int *argv[])
{
int Ch ;
int i ;
void *memP ;
infoType platformInfo ;
print_header();
uHALr_printf("*** HEAP Storage Allocation/Deallocation ***\n\n") ;
uHALr_GetPlatformInfo(&platformInfo);
uHALr_printf("platform Id : 0x%08X\n",platformInfo.platformId);
uHALr_printf("memory Size : 0x%08X\n",platformInfo.memSize);
uHALr_printf("cpu ID : 0x%08X\n\n",platformInfo.cpuId);
#if uHAL_HEAP == 0
uHALr_printf("Sorry, no heap storage available\n") ;
#else
// init
uHALr_InitHeap() ;
// allocate and free some memory
for (i = 0 ; i < 16 ; i++) {
uHALr_printf("malloc'ing 0x%02X bytes...", i * 16) ;
memP = uHALr_malloc(i * 16) ;
uHALr_printf("@ 0x%04X\n", memP) ;
uHALr_free(memP) ;
}
#endif
print_end ();
return (OK);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -