RTEMS 6.1-rc7
Loading...
Searching...
No Matches
Functions
cache.h File Reference

This header file defines the Cache Manager API. More...

#include <stddef.h>
#include <stdint.h>
#include <rtems/rtems/status.h>

Go to the source code of this file.

Functions

rtems_status_code rtems_cache_coherent_add_area (void *begin, uintptr_t size)
 Adds a cache coherent memory area to the cache coherent allocator.
 
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().
 
void rtems_cache_freeze_data (void)
 Freezes the data caches.
 
void rtems_cache_freeze_instruction (void)
 Freezes the instruction caches.
 
void rtems_cache_unfreeze_data (void)
 Unfreezes the data cache.
 
void rtems_cache_unfreeze_instruction (void)
 Unfreezes the instruction cache.
 
void rtems_cache_flush_multiple_data_lines (const void *begin, size_t size)
 Flushes the data cache lines covering the memory area.
 
void rtems_cache_invalidate_multiple_data_lines (const void *begin, size_t size)
 Invalidates the data cache lines covering the memory area.
 
void rtems_cache_invalidate_multiple_instruction_lines (const void *begin, size_t size)
 Invalidates the instruction cache lines covering the memory area.
 
void rtems_cache_instruction_sync_after_code_change (const void *begin, size_t size)
 Ensures necessary synchronization required after code changes.
 
size_t rtems_cache_get_maximal_line_size (void)
 Gets the maximal cache line size in bytes of all caches (data, instruction, or unified).
 
size_t rtems_cache_get_data_line_size (void)
 Gets the data cache line size in bytes.
 
size_t rtems_cache_get_instruction_line_size (void)
 Gets the instruction cache line size in bytes.
 
size_t rtems_cache_get_data_cache_size (uint32_t level)
 Gets the data cache size in bytes for the cache level.
 
size_t rtems_cache_get_instruction_cache_size (uint32_t level)
 Gets the instruction cache size in bytes for the cache level.
 
void rtems_cache_flush_entire_data (void)
 Flushes the entire data cache.
 
void rtems_cache_invalidate_entire_data (void)
 Invalidates the entire data cache.
 
void rtems_cache_invalidate_entire_instruction (void)
 Invalidates the entire instruction cache.
 
void rtems_cache_enable_data (void)
 Enables the data cache.
 
void rtems_cache_disable_data (void)
 Disables the data cache.
 
void rtems_cache_enable_instruction (void)
 Enables the instruction cache.
 
void rtems_cache_disable_instruction (void)
 Disables the instruction cache.
 
void * rtems_cache_aligned_malloc (size_t size)
 Allocates memory from the C Program Heap which begins at a cache line boundary.
 

Detailed Description

This header file defines the Cache Manager API.

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.

◆ rtems_cache_freeze_data()

void rtems_cache_freeze_data ( void  )

Freezes the data caches.

Constraints

The following constraints apply to this directive:

  • The directive may be called from within any runtime context.
  • The directive will not cause the calling task to be preempted.

◆ rtems_cache_freeze_instruction()

void rtems_cache_freeze_instruction ( void  )

Freezes the instruction caches.

Constraints

The following constraints apply to this directive:

  • The directive may be called from within any runtime context.
  • The directive will not cause the calling task to be preempted.

◆ rtems_cache_unfreeze_data()

void rtems_cache_unfreeze_data ( void  )

Unfreezes the data cache.

Constraints

The following constraints apply to this directive:

  • The directive may be called from within any runtime context.
  • The directive will not cause the calling task to be preempted.

◆ rtems_cache_unfreeze_instruction()

void rtems_cache_unfreeze_instruction ( void  )

Unfreezes the instruction cache.

Constraints

The following constraints apply to this directive:

  • The directive may be called from within any runtime context.
  • The directive will not cause the calling task to be preempted.