EVE 1.0
Movable and discardable heap
Collaboration diagram for Movable and discardable heap:

Data Structures

struct  md_list_t
 
struct  md_descriptor_t
 
struct  md_stat_t
 
struct  md_state_t
 
struct  md_heap_t
 
struct  md_auto_lock_t
 

Macros

#define MEM_AUTO_LOCK(TheName, TheHeap, ThePtr)
 

Typedefs

typedef uint8_t md_idx_t
 
typedef void(* md_reloc_handler_t) (void **Ptr, void *Addr)
 
typedef bool(* md_swap_out_cb_t) (const struct md_heap_t *Heap, uint32_t Pos, const uint8_t **DataPtr, uint32_t Size)
 
typedef bool(* md_swap_in_cb_t) (const struct md_heap_t *Heap, uint8_t **DataPtr, uint32_t Pos, uint32_t Size)
 

Functions

void MemDefragment (const struct md_heap_t *Heap)
 

Detailed Description

Macro Definition Documentation

#define MEM_AUTO_LOCK (   TheName,
  TheHeap,
  ThePtr 
)
Value:
struct md_auto_lock_t TheName \
__attribute__((cleanup(MemAutoLockDestructor))) \
= { .Heap = TheHeap, .Ptr = (void **) ThePtr, }; \
{ \
bool Ret = MemLock(TheHeap, ThePtr, &TheName.Handler); \
assert(Ret); \
} \
do { } while (0)
__attribute__((always_inline)) static inline void swint_enable_indirect_adapter(swint_state_t *state)
Definition: work.h:245

Auto lock

Definition at line 212 of file md-heap.h.

Typedef Documentation

typedef uint8_t md_idx_t

Heap index type

Definition at line 50 of file md-heap.h.

typedef void(* md_reloc_handler_t) (void **Ptr, void *Addr)

Entry relocation handler

Parameters
PtrAddress of a variable which contains a pointer to the allocated memory block
AddrNew value for the pointer

Definition at line 63 of file md-heap.h.

typedef bool(* md_swap_out_cb_t) (const struct md_heap_t *Heap, uint32_t Pos, const uint8_t **DataPtr, uint32_t Size)

Swap-out user callback

Parameters
HeapHeap instance pointer
PosPosition in the external memory where data to be swapped out
DataAddress of the data in the internal memory
SizeSize of the data
Returns
true if data was swapped out, false otherwise

Definition at line 74 of file md-heap.h.

typedef bool(* md_swap_in_cb_t) (const struct md_heap_t *Heap, uint8_t **DataPtr, uint32_t Pos, uint32_t Size)

Swap-in user callback

Parameters
HeapHeap instance pointer
DataAddress of the data buffer in the internal memory to be filled by data
PosPosition in the external memory where data is located
SizeSize of the data
Returns
true if data was swapped in, false otherwise

Definition at line 85 of file md-heap.h.

Function Documentation

void MemDefragment ( const struct md_heap_t Heap)

Compact the memory pool, collect small free blocks into a big one(s)

Parameters
HeapHeap instance pointer