RTEMS 6.1-rc5
Loading...
Searching...
No Matches
Functions
cachecoherentalloc.c File Reference
#include <rtems.h>
#include <rtems/malloc.h>
#include <rtems/score/apimutex.h>
#include <rtems/score/heapimpl.h>
#include <rtems/score/sysstate.h>

Functions

void * rtems_cache_coherent_allocate (size_t size, uintptr_t alignment, uintptr_t boundary)
 Allocates a memory area from cache coherent memory.
 
void rtems_cache_coherent_free (void *ptr)
 Frees memory allocated by rtems_cache_coherent_allocate().
 
rtems_status_code rtems_cache_coherent_add_area (void *area_begin, uintptr_t area_size)
 Adds a cache coherent memory area to the cache coherent allocator.
 

Function Documentation

◆ rtems_cache_coherent_add_area()

rtems_status_code rtems_cache_coherent_add_area ( void *  begin,
uintptr_t  size 
)

Adds a cache coherent memory area to the cache coherent allocator.

Parameters
beginis the begin address of the cache coherent memory area to add.
sizeis the size in bytes of the cache coherent memory area to add.
Return values
RTEMS_SUCCESSFULThe requested operation was successful.
RTEMS_UNSATISFIEDThe requested operation was not successful.
Constraints

The following constraints apply to this directive:

  • The directive may be called from within device driver initialization context.
  • The directive may be called from within task context.
  • The directive may obtain and release the object allocator mutex. This may cause the calling task to be preempted.

◆ rtems_cache_coherent_allocate()

void * rtems_cache_coherent_allocate ( size_t  size,
uintptr_t  alignment,
uintptr_t  boundary 
)

Allocates a memory area from cache coherent memory.

Parameters
sizeis the requested size in bytes of the memory area to allocate.
alignmentis the requested alignment in bytes of the memory area to allocate. If the alignment parameter is not equal to zero, the allocated memory area will begin at an address aligned by this value.
boundaryis the requested boundary in bytes of the memory area to allocate. If the boundary parameter is not equal to zero, the allocated memory area will comply with a boundary constraint. The boundary value specifies the set of addresses which are aligned by the boundary value. The interior of the allocated memory area will not contain an element of this set. The begin or end address of the area may be a member of the set.
Return values
NULLThere is not enough memory available to satisfy the allocation request.
Returns
Returns the begin address of the allocated memory.
Notes

A size value of zero will return a unique address which may be freed with rtems_cache_coherent_free().

The memory allocated by the directive may be released with a call to rtems_cache_coherent_free().

By default the C Program Heap allocator is used. In case special memory areas must be used, then the BSP or the application should add cache coherent memory areas for the allocator via rtems_cache_coherent_add_area().

Constraints

The following constraints apply to this directive:

  • The directive may be called from within device driver initialization context.
  • The directive may be called from within task context.
  • The directive may obtain and release the object allocator mutex. This may cause the calling task to be preempted.

◆ rtems_cache_coherent_free()

void rtems_cache_coherent_free ( void *  ptr)

Frees memory allocated by rtems_cache_coherent_allocate().

Parameters
ptris a pointer returned by rtems_cache_coherent_allocate().
Constraints

The following constraints apply to this directive:

  • The directive may be called from within device driver initialization context.
  • The directive may be called from within task context.
  • The directive may obtain and release the object allocator mutex. This may cause the calling task to be preempted.