Return to previous page Return to menu Go to next page

Memory management library

1.Guide

1.1 Purpose

A library for easy memory management.

1.2 Overview

Provides various functions for securing and releasing memory.
∙ In releasing memory, see both sides of the released area and if it is an empty area, it will be integrated.
These functions reduce the burden of user memory management.
The function has a function interface close to the standard function.

1.3 Calling sequence

Below is the calling sequence for securing and releasing memory blocks.

void sysInit()
{
     ...     
     MEM_Init (0x6050000, 0x10000); / * 10000H bytes from address 6050000H
                                                            Set to memory management area * /
     ...
}
...
void userFunc()
{
     Uint32 *mem_area1;
     Uint8 *mem_area2;

     ...      mem_area1 = (Uint32 *) MEM_Malloc (4); / * Allocate a 4-byte area * /      if(mem_area1 == NULL){           return(ERR);      }      mem_area2 = (Uint8 *) MEM_Malloc (1); / * Allocate 1 byte area * /      if(mem_area2 == NULL){           return(ERR);      }      ...      ...      MEM_Free (mem_area1); / * Free mem_area1 memory * /      ... }


Return to previous page Return to menu Go to next page