RTEMS: Memory Handler

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Files | Data Structures | Macros | Functions | Variables
Memory Handler
Internal » SuperCore

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.

## Data Structures
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.
#define | MEMORY_INITIALIZER(begin, end) { ( begin ), ( begin ), ( end ) }
| Statically initialize a memory area.

## Functions
RTEMS_INLINE_ROUTINE size_t | _Memory_Get_count (const Memory_Information *information)
| Get the memory area count.
RTEMS_INLINE_ROUTINE Memory_Area * | _Memory_Get_area (const Memory_Information *information, size_t index)
| Get a memory area by index.
RTEMS_INLINE_ROUTINE void | _Memory_Initialize (Memory_Area *area, void *begin, void *end)
| Initialize the memory area.
RTEMS_INLINE_ROUTINE void | _Memory_Initialize_by_size (Memory_Area *area, void *begin, uintptr_t size)
| Initialize the memory area by size.
RTEMS_INLINE_ROUTINE const void * | _Memory_Get_begin (const Memory_Area *area)
| Get the memory area begin.
RTEMS_INLINE_ROUTINE void | _Memory_Set_begin (Memory_Area *area, const void *begin)
| Set the memory area begin.
RTEMS_INLINE_ROUTINE const void * | _Memory_Get_end (const Memory_Area *area)
| Get the memory area end.
RTEMS_INLINE_ROUTINE void | _Memory_Set_end (Memory_Area *area, const void *end)
| Set the memory area end.
RTEMS_INLINE_ROUTINE uintptr_t | _Memory_Get_size (const Memory_Area *area)
| Get the memory area size.
RTEMS_INLINE_ROUTINE void * | _Memory_Get_free_begin (const Memory_Area *area)
| Get the begin of the free area of the memory area.
RTEMS_INLINE_ROUTINE void | _Memory_Set_free_begin (Memory_Area *area, void *begin)
| Set the begin of the free area of the memory area.
RTEMS_INLINE_ROUTINE uintptr_t | _Memory_Get_free_size (const Memory_Area *area)
| Get the size of the free memory area of the memory area.
RTEMS_INLINE_ROUTINE void | _Memory_Consume (Memory_Area *area, uintptr_t consume)
| Consume the specified size from the free memory area of the memory area.
const Memory_Information * | _Memory_Get (void)
| Return the memory information of this platform.
void * | _Memory_Allocate (const Memory_Information *information, uintptr_t size, uintptr_t alignment)
| Allocate a memory area from the memory information.
void | _Memory_Fill (const Memory_Information *information, int c)
| Fill all free memory areas of the memory information with a constant byte.
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.

## 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

  areas | The designator of an array of the memory areas.

## ◆ MEMORY_INITIALIZER

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

Statically initialize a memory area.

Parameters

  begin | The begin of the memory area.
  end | The end of the memory area.

## 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

  information | The memory information.
  size | The size in bytes of the memory area to allocate.
  alignment | The alignment in bytes of the memory area to allocate. It must be a power of two.

Return values

  NULL | No such memory area available.
  begin | The begin of the allocated memory area.

## ◆ _Memory_Consume()

RTEMS_INLINE_ROUTINE void _Memory_Consume | ( | Memory_Area * | area,
|  | uintptr_t | consume
| ) |  |

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

Parameters

  area | The memory area.
  consume | The bytes to consume from the free memory area of the memory area.

## ◆ _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

  information | The memory information.
  c | The 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.

## ◆ _Memory_Get_area()

RTEMS_INLINE_ROUTINE Memory_Area * _Memory_Get_area | ( | const Memory_Information * | information,
|  | size_t | index
| ) |  |

Get a memory area by index.

Parameters

  information | The memory information.
  index | The index of the memory area to return.

Returns
  The memory area of the specified index.

## ◆ _Memory_Get_begin()

RTEMS_INLINE_ROUTINE const void * _Memory_Get_begin | ( | const Memory_Area * | area | ) |

Get the memory area begin.

Parameters

  area | The memory area.

Returns
  The memory area begin.

## ◆ _Memory_Get_count()

RTEMS_INLINE_ROUTINE size_t _Memory_Get_count | ( | const Memory_Information * | information | ) |

Get the memory area count.

Parameters

  information | The memory information.

Returns
  The memory area count.

## ◆ _Memory_Get_end()

RTEMS_INLINE_ROUTINE const void * _Memory_Get_end | ( | const Memory_Area * | area | ) |

Get the memory area end.

Parameters

  area | The memory area.

Returns
  The memory area end.

## ◆ _Memory_Get_free_begin()

RTEMS_INLINE_ROUTINE void * _Memory_Get_free_begin | ( | const Memory_Area * | area | ) |

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

Parameters

  area | The memory area.

Returns
  The free memory area begin the memory area.

## ◆ _Memory_Get_free_size()

RTEMS_INLINE_ROUTINE uintptr_t _Memory_Get_free_size | ( | const Memory_Area * | area | ) |

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

Parameters

  area | The memory area.

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

## ◆ _Memory_Get_size()

RTEMS_INLINE_ROUTINE uintptr_t _Memory_Get_size | ( | const Memory_Area * | area | ) |

Get the memory area size.

Parameters

  area | The memory area.

Returns
  The memory area size in bytes.

## ◆ _Memory_Initialize()

RTEMS_INLINE_ROUTINE void _Memory_Initialize | ( | Memory_Area * | area,
|  | void * | begin,
|  | void * | end
| ) |  |

Initialize the memory area.

Parameters

  area | The memory area.
  begin | The begin of the memory area.
  end | The end of the memory area.

## ◆ _Memory_Initialize_by_size()

RTEMS_INLINE_ROUTINE void _Memory_Initialize_by_size | ( | Memory_Area * | area,
|  | void * | begin,
|  | uintptr_t | size
| ) |  |

Initialize the memory area by size.

Parameters

  area | The memory area.
  begin | The begin of the memory area.
  size | The size of the memory area in bytes.

## ◆ _Memory_Set_begin()

RTEMS_INLINE_ROUTINE void _Memory_Set_begin | ( | Memory_Area * | area,
|  | const void * | begin
| ) |  |

Set the memory area begin.

Parameters

  area | The memory area.
  begin | The memory area begin.

## ◆ _Memory_Set_end()

RTEMS_INLINE_ROUTINE void _Memory_Set_end | ( | Memory_Area * | area,
|  | const void * | end
| ) |  |

Set the memory area end.

Parameters

  area | The memory area.
  end | The memory area end.

## ◆ _Memory_Set_free_begin()

RTEMS_INLINE_ROUTINE void _Memory_Set_free_begin | ( | Memory_Area * | area,
|  | void * | begin
| ) |  |

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

Parameters

  area | The memory area.
  begin | The free memory area begin the memory area.

## Variable Documentation

## ◆ _Memory_Zero_before_use

const bool _Memory_Zero_before_use
| extern

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.