SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Classes | Macros | Functions
smalloc.h File Reference
#include <stdint.h>
#include <types.h>
Include dependency graph for smalloc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  alloc_struct_t
 

Macros

#define BYTE_ALIGN(x)   (((x + 15) / 16) * 16)
 

Functions

int32_t smalloc_init (uint32_t p_heap_head, uint32_t n_heap_size)
 Initialize the simple malloc library with the specified heap parameters.
 
void * smalloc (uint32_t num_bytes)
 Allocate a block of memory from the heap with the specified size.
 
void * srealloc (void *p, uint32_t num_bytes)
 Reallocate a block of memory with the specified new size.
 
void sfree (void *p)
 Free the memory block pointed to by the specified pointer.
 

Macro Definition Documentation

◆ BYTE_ALIGN

#define BYTE_ALIGN (   x)    (((x + 15) / 16) * 16)

Function Documentation

◆ sfree()

void sfree ( void *  p)

Free the memory block pointed to by the specified pointer.

Parameters
pThe pointer to the memory block to free.

◆ smalloc()

void * smalloc ( uint32_t  num_bytes)

Allocate a block of memory from the heap with the specified size.

Parameters
num_bytesThe number of bytes to allocate.
Returns
A pointer to the allocated memory block, or NULL if allocation fails.

◆ smalloc_init()

int32_t smalloc_init ( uint32_t  p_heap_head,
uint32_t  n_heap_size 
)

Initialize the simple malloc library with the specified heap parameters.

Parameters
p_heap_headThe starting address of the heap.
n_heap_sizeThe size of the heap in bytes.
Returns
Zero if successful, non-zero otherwise.

◆ srealloc()

void * srealloc ( void *  p,
uint32_t  num_bytes 
)

Reallocate a block of memory with the specified new size.

Parameters
pThe pointer to the memory block to reallocate.
num_bytesThe new size in bytes.
Returns
A pointer to the reallocated memory block, or NULL if reallocation fails.