RTEMS
Files | Classes | Macros | Functions | Variables
Memory Handler

Low level handler to provide memory areas for higher level memory handlers such as the Workspace Handler. More...

Files

file  memory.h
 Memory Handler API.
 

Classes

struct  Memory_Area
 The memory area description. More...
 
struct  Memory_Information
 The memory information. More...
 

Macros

#define MEMORY_INFORMATION_INITIALIZER(areas)   { RTEMS_ARRAY_SIZE( areas ), ( areas ) }
 Statically initialize a memory information. More...
 
#define MEMORY_INITIALIZER(begin, end)   { ( begin ), ( begin ), ( end ) }
 Statically initialize a memory area. More...
 

Functions

static __inline__ size_t _Memory_Get_count (const Memory_Information *information)
 Get the memory area count. More...
 
static __inline__ Memory_Area_Memory_Get_area (const Memory_Information *information, size_t index)
 Get a memory area by index. More...
 
static __inline__ void _Memory_Initialize (Memory_Area *area, void *begin, void *end)
 Initialize the memory area. More...
 
static __inline__ void _Memory_Initialize_by_size (Memory_Area *area, void *begin, uintptr_t size)
 Initialize the memory area by size. More...
 
static __inline__ const void * _Memory_Get_begin (const Memory_Area *area)
 Get the memory area begin. More...
 
static __inline__ void _Memory_Set_begin (Memory_Area *area, const void *begin)
 Set the memory area begin. More...
 
static __inline__ const void * _Memory_Get_end (const Memory_Area *area)
 Get the memory area end. More...
 
static __inline__ void _Memory_Set_end (Memory_Area *area, const void *end)
 Set the memory area end. More...
 
static __inline__ uintptr_t _Memory_Get_size (const Memory_Area *area)
 Get the memory area size. More...
 
static __inline__ void * _Memory_Get_free_begin (const Memory_Area *area)
 Get the begin of the free area of the memory area. More...
 
static __inline__ void _Memory_Set_free_begin (Memory_Area *area, void *begin)
 Set the begin of the free area of the memory area. More...
 
static __inline__ uintptr_t _Memory_Get_free_size (const Memory_Area *area)
 Get the size of the free memory area of the memory area. More...
 
static __inline__ void _Memory_Consume (Memory_Area *area, uintptr_t consume)
 Consume the specified size from the free memory area of the memory area. More...
 
const Memory_Information_Memory_Get (void)
 Return the memory information of this platform. More...
 
void * _Memory_Allocate (const Memory_Information *information, uintptr_t size, uintptr_t alignment)
 Allocate a memory area from the memory information. More...
 
void _Memory_Fill (const Memory_Information *information, int c)
 Fill all free memory areas of the memory information with a constant byte. More...
 
void _Memory_Zero_free_areas (void)
 Zeros all free memory areas of the system.
 
void _Memory_Dirty_free_areas (void)
 Dirty all free memory areas of the system.
 

Variables

const bool _Memory_Zero_before_use
 Indicates if the memory is zeroed during system initialization. More...
 

Detailed Description

Low level handler to provide memory areas for higher level memory handlers such as the Workspace Handler.

Macro Definition Documentation

◆ MEMORY_INFORMATION_INITIALIZER

#define MEMORY_INFORMATION_INITIALIZER (   areas)    { RTEMS_ARRAY_SIZE( areas ), ( areas ) }

Statically initialize a memory information.

Parameters
areasThe designator of an array of the memory areas.

Definition at line 97 of file memory.h.

◆ MEMORY_INITIALIZER

#define MEMORY_INITIALIZER (   begin,
  end 
)    { ( begin ), ( begin ), ( end ) }

Statically initialize a memory area.

Parameters
beginThe begin of the memory area.
endThe end of the memory area.

Definition at line 106 of file memory.h.

Function Documentation

◆ _Memory_Allocate()

void* _Memory_Allocate ( const Memory_Information information,
uintptr_t  size,
uintptr_t  alignment 
)

Allocate a memory area from the memory information.

It is not possible to free the memory area allocated by this function.

Parameters
informationThe memory information.
sizeThe size in bytes of the memory area to allocate.
alignmentThe alignment in bytes of the memory area to allocate. It must be a power of two.
Return values
NULLNo such memory area available.
beginThe begin of the allocated memory area.

Definition at line 34 of file memoryallocate.c.

◆ _Memory_Consume()

static __inline__ void _Memory_Consume ( Memory_Area area,
uintptr_t  consume 
)
static

Consume the specified size from the free memory area of the memory area.

Parameters
areaThe memory area.
consumeThe bytes to consume from the free memory area of the memory area.

Definition at line 285 of file memory.h.

◆ _Memory_Fill()

void _Memory_Fill ( const Memory_Information information,
int  c 
)

Fill all free memory areas of the memory information with a constant byte.

Parameters
informationThe memory information.
cThe constant byte to fill the free memory areas.

◆ _Memory_Get()

const Memory_Information* _Memory_Get ( void  )

Return the memory information of this platform.

This function is provided by the Board Support Package (BSP). Using a function gives the BSPs a bit more freedom with respect to the implementation. Calling this function shall not have side-effects. Initialization steps to set up the memory information shall be done in a system initialization handler (RTEMS_SYSINIT_MEMORY).

Returns
The memory information.

Definition at line 42 of file bspgetworkarea.c.

◆ _Memory_Get_area()

static __inline__ Memory_Area* _Memory_Get_area ( const Memory_Information information,
size_t  index 
)
static

Get a memory area by index.

Parameters
informationThe memory information.
indexThe index of the memory area to return.
Returns
The memory area of the specified index.

Definition at line 130 of file memory.h.

◆ _Memory_Get_begin()

static __inline__ const void* _Memory_Get_begin ( const Memory_Area area)
static

Get the memory area begin.

Parameters
areaThe memory area.
Returns
The memory area begin.

Definition at line 182 of file memory.h.

◆ _Memory_Get_count()

static __inline__ size_t _Memory_Get_count ( const Memory_Information information)
static

Get the memory area count.

Parameters
informationThe memory information.
Returns
The memory area count.

Definition at line 115 of file memory.h.

◆ _Memory_Get_end()

static __inline__ const void* _Memory_Get_end ( const Memory_Area area)
static

Get the memory area end.

Parameters
areaThe memory area.
Returns
The memory area end.

Definition at line 208 of file memory.h.

◆ _Memory_Get_free_begin()

static __inline__ void* _Memory_Get_free_begin ( const Memory_Area area)
static

Get the begin of the free area of the memory area.

Parameters
areaThe memory area.
Returns
The free memory area begin the memory area.

Definition at line 246 of file memory.h.

◆ _Memory_Get_free_size()

static __inline__ uintptr_t _Memory_Get_free_size ( const Memory_Area area)
static

Get the size of the free memory area of the memory area.

Parameters
areaThe memory area.
Returns
The free memory area size in bytes of the memory area.

Definition at line 272 of file memory.h.

◆ _Memory_Get_size()

static __inline__ uintptr_t _Memory_Get_size ( const Memory_Area area)
static

Get the memory area size.

Parameters
areaThe memory area.
Returns
The memory area size in bytes.

Definition at line 234 of file memory.h.

◆ _Memory_Initialize()

static __inline__ void _Memory_Initialize ( Memory_Area area,
void *  begin,
void *  end 
)
static

Initialize the memory area.

Parameters
areaThe memory area.
beginThe begin of the memory area.
endThe end of the memory area.

Definition at line 146 of file memory.h.

◆ _Memory_Initialize_by_size()

static __inline__ void _Memory_Initialize_by_size ( Memory_Area area,
void *  begin,
uintptr_t  size 
)
static

Initialize the memory area by size.

Parameters
areaThe memory area.
beginThe begin of the memory area.
sizeThe size of the memory area in bytes.

Definition at line 164 of file memory.h.

◆ _Memory_Set_begin()

static __inline__ void _Memory_Set_begin ( Memory_Area area,
const void *  begin 
)
static

Set the memory area begin.

Parameters
areaThe memory area.
beginThe memory area begin.

Definition at line 193 of file memory.h.

◆ _Memory_Set_end()

static __inline__ void _Memory_Set_end ( Memory_Area area,
const void *  end 
)
static

Set the memory area end.

Parameters
areaThe memory area.
endThe memory area end.

Definition at line 219 of file memory.h.

◆ _Memory_Set_free_begin()

static __inline__ void _Memory_Set_free_begin ( Memory_Area area,
void *  begin 
)
static

Set the begin of the free area of the memory area.

Parameters
areaThe memory area.
beginThe free memory area begin the memory area.

Definition at line 257 of file memory.h.

Variable Documentation

◆ _Memory_Zero_before_use

const bool _Memory_Zero_before_use

Indicates if the memory is zeroed during system initialization.

This value is provided via <rtems/confdefs.h> in case CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY is defined.