Nios II Classic Software Developer’s Handbook

ID 683282
Date 5/14/2015
Public
Document Table of Contents

14.1.6. alt_uncached_malloc()

Prototype

volatile void* alt_uncached_malloc (size_t size)

Commonly Called By

C/C++ programs

Device drivers

Thread-safe

Yes.

Available from ISR

No.

Include

<sys/alt_cache.h>

Description

The alt_uncached_malloc() routine guarantees that the allocated memory region is not in the data cache and that all subsequent accesses to the allocated memory regions bypass the data cache. In the case there is no data cache implemented the alt_uncached_malloc() routine simply calls malloc(). If data cache is implemented, but bit 31 is not set to be used as a cache bypass then the following link error will result when building the code:ALT_LINK_ERROR("alt_uncached_malloc() is not available because CPU is not configured to use bit 31 of address to bypass data cache");.

Return

If sufficient memory cannot be allocated, this function returns null, otherwise a pointer to the allocated space is returned.