Memory manager functions – Maxim Integrated High-Speed Microcontroller Users Guide: Network Microcontroller Supplement User Manual

Page 193

Advertising
background image

High-Speed Microcontroller User’s

Guide: Network Microcontroller

Supplement

193

getpseudorandom

Description:

unsigned char getpseudorandom(void);

The

getpseudorandom function gets a pseudorandom byte from a CRC function.

MEMORY MANAGER FUNCTIONS

rom_kernelmalloc

Description:

void rom_kernelmalloc(
int
blocksize);

/* requested memory blocksize */

The

rom_kernelmalloc function allocates fast kernel memory. It allocates a block from the kernel memory pool without incur-

ring the overhead of the regular memory manager. This function returns 0 in the accumulator if successful, nonzero otherwise.

It is exported by the DS80C400 silicon software and also serves as the default

kernelmalloc in the function redirect table.

rom_kernelfree

Description:

void rom_kernelfree(
int blockhandle);

/* blockhandle of memory to free. */

The

rom_kernelfree function frees fast kernel memory. With blockhandle, this function frees a block of memory that had pre-

viously been allocated by kernelmalloc. It returns 0 in the accumulator if successful, nonzero otherwise. This function is export-

ed by the DS80C400 silicon software and also serves as the default kernelfree in the function redirect table.

rom_malloc

Description:

void rom_malloc(
int
blocksize);

/* requested memory blocksize */

The

rom_malloc function allocates memory from the heap and clears the allocated memory. It returns 0 in the accumulator if

successful, nonzero otherwise. This function is exported by the DS80C400 silicon software and also serves as the default

mal-

loc in the function redirect table.

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

R3:R2

blocksize

ACC

R3:R2

DPTR0

Return value (= 0 for success)

Memory block handle

Pointer to memory block

Example:

MOV R3, #high(MEMLENGTH)

MOV R2, #low(MEMLENGTH)

ROMCALL rom_malloc

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

R3:R2

blockhandle

ACC

Return value (= 0 for success)

Example:

MOV R3, #high(MEMHANDLE)

MOV R2, #low(MEMHANDLE)

ROMCALL rom_kernelfree

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

R3:R2

blocksize

ACC

R3:R2

DPTR0

Return value (= 0 for success)

Memory block handle

Pointer to memory block

Example:

MOV R3, #high(MEMLENGTH)

MOV R2, #low(MEMLENGTH)

ROMCALL rom_kernelmalloc

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

ACC

Return value

Example:

ROMCALL getpseudorandom

Maxim Integrated

Advertising