#include "juno/memory/memory_api.h"
#include "juno/memory/memory_types.h"
#include "juno/status.h"
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
|
JUNO_STATUS_T | Juno_MemoryBlkInit (JUNO_MEMORY_BLOCK_T *ptMemBlk, void *pvMemory, JUNO_MEMORY_BLOCK_METADATA_T *pvMetadata, size_t zTypeSize, size_t zLength, JUNO_FAILURE_HANDLER_T pfcnFailureHandler, JUNO_USER_DATA_T *pvUserData) |
| Initializes a memory block for allocation. Sets up a memory block with an associated free stack for managing fixed-size allocations.
|
|
JUNO_STATUS_T | Juno_MemoryGet (JUNO_MEMORY_ALLOC_T *ptMem, JUNO_MEMORY_T *ptMemory, size_t zSize) |
| Generic memory allocation function. Allocates memory by using the appropriate allocation method based on the allocation type.
|
|
JUNO_STATUS_T | Juno_MemoryUpdate (JUNO_MEMORY_ALLOC_T *ptMem, JUNO_MEMORY_T *ptMemory, size_t zNewSize) |
| Updates the current memory allocation to a new size (realloc).
|
|
JUNO_STATUS_T | Juno_MemoryPut (JUNO_MEMORY_ALLOC_T *ptMem, JUNO_MEMORY_T *ptMemory) |
| Generic memory free function. Releases memory back to the allocator and clears the memory descriptor.
|
|
const JUNO_MEMORY_API_T * | Juno_MemoryApi (void) |
| Retrieves the generic memory API structure.
|
|
◆ Juno_MemoryApi()
Retrieves the generic memory API structure.
- Returns
- Pointer to the generic memory API structre.
◆ Juno_MemoryBlkInit()
Initializes a memory block for allocation. Sets up a memory block with an associated free stack for managing fixed-size allocations.
- Parameters
-
ptMemBlk | Pointer to the memory block structure to initialize. |
pvMemory | Pointer to the contiguous memory used for allocations. |
pvMetadata | Pointer to an array for block metadata tracking. |
zTypeSize | Size in bytes of each element in the block. |
zLength | Total number of possible allocations. |
pfcnFailureHandler | Callback function to handle failures. |
pvUserData | User data passed to the failure handler. |
- Returns
- JUNO_STATUS_T Status of the initialization.
◆ Juno_MemoryGet()
Generic memory allocation function. Allocates memory by using the appropriate allocation method based on the allocation type.
- Parameters
-
ptMem | Pointer to the memory allocation structure. |
ptMemory | Pointer to a memory descriptor where allocation details will be stored. |
- Returns
- JUNO_STATUS_T Status of the allocation.
◆ Juno_MemoryPut()
Generic memory free function. Releases memory back to the allocator and clears the memory descriptor.
- Parameters
-
ptMem | Pointer to the memory allocation structure. |
ptMemory | Pointer to the memory descriptor to free. |
- Returns
- JUNO_STATUS_T Status of the free operation.
◆ Juno_MemoryUpdate()
Updates the current memory allocation to a new size (realloc).
- Parameters
-
ptMem | Pointer to the memory allocator. |
ptMemory | The memory to update with a new size. |
zNewSize | The new size of the memory. |
- Returns
- JUNO_STATUS_T Status of the allocation.