LibJuno 1.0.1
LibJuno is a lightweight C11 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
memory_block.h File Reference

Fixed-size block allocator interface and helpers. More...

#include "juno/module.h"
#include "juno/status.h"
#include "juno/memory/memory_api.h"
Include dependency graph for memory_block.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  JUNO_MEMORY_BLOCK_METADATA_TAG
 Metadata for a memory block entry (allocator-specific). More...
 

Macros

#define JUNO_MEMORY_BLOCK(name, type, length)   static type name[length] = {0}
 Declare a static contiguous memory array for block storage.
 
#define JUNO_MEMORY_BLOCK_METADATA(name, length)   static JUNO_MEMORY_BLOCK_METADATA_T name[length] = {0}
 Declare a static array for per-block metadata.
 
#define JunoMemory_BlockGetT(ptBlkRoot, type)   (ptBlkRoot)->tRoot.ptApi->Get(&(ptBlkRoot)->tRoot, sizeof(type))
 Allocate a block sized for the specified C type.
 
#define JunoMemory_BlockPutT(ptBlkRoot, pPtr)   (ptBlkRoot)->tRoot.ptApi->Put(&(ptBlkRoot)->tRoot, (pPtr))
 Free a previously allocated block given its pointer descriptor.
 

Typedefs

typedef struct JUNO_MEMORY_BLOCK_METADATA_TAG JUNO_MEMORY_BLOCK_METADATA_T
 
typedef struct JUNO_MEMORY_ALLOC_BLOCK_TAG JUNO_MEMORY_ALLOC_BLOCK_T
 

Functions

struct JUNO_MEMORY_ALLOC_BLOCK_TAG JUNO_MODULE_DERIVE (JUNO_MEMORY_ALLOC_ROOT_T, uint8_t *pvMemory;JUNO_MEMORY_BLOCK_METADATA_T *ptMetadata;size_t zTypeSize;size_t zAlignment;size_t zLength;size_t zUsed;size_t zFreed;)
 Concrete block allocator derivation over the generic alloc root.
 
JUNO_STATUS_T JunoMemory_BlockInit (JUNO_MEMORY_ALLOC_BLOCK_T *ptJunoMemory, const JUNO_POINTER_API_T *ptPointerApi, void *pvMemory, JUNO_MEMORY_BLOCK_METADATA_T *ptMetadata, size_t zTypeSize, size_t zAlignment, size_t zLength, JUNO_FAILURE_HANDLER_T pfcnFailureHandler, JUNO_USER_DATA_T *pvFailureUserData)
 Initialize a fixed-size block allocator over a caller-supplied region.
 

Detailed Description

Fixed-size block allocator interface and helpers.

This API has been generated by LibJuno: https://www.robinonsay.com/libjuno/

Typedef Documentation

◆ JUNO_MEMORY_ALLOC_BLOCK_T

typedef struct JUNO_MEMORY_ALLOC_BLOCK_TAG JUNO_MEMORY_ALLOC_BLOCK_T

◆ JUNO_MEMORY_BLOCK_METADATA_T