Nios® II Software Developer Handbook

ID 683525
Date 8/28/2023
Public
Document Table of Contents

15.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 results 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.