Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
Data Structures | Functions
mpool.h File Reference
#include <stddef.h>
#include <stdint.h>
Include dependency graph for mpool.h:

Go to the source code of this file.

Data Structures

struct  mpool
 

Functions

void mpool_init (struct mpool *mpool, uint8_t *mem, size_t size)
 Initialize a memory poll object with a contiguous memory space. More...
 
void * mpool_alloc (struct mpool *mpool, size_t size)
 Allocate a memory space from the memory pool. More...
 

Function Documentation

◆ mpool_alloc()

void* mpool_alloc ( struct mpool mpool,
size_t  size 
)

Allocate a memory space from the memory pool.

Parameters
mem_poolPointer to the memory poll object.
sizeThe size of the memory to allocate in bytes.

◆ mpool_init()

void mpool_init ( struct mpool mpool,
uint8_t *  mem,
size_t  size 
)

Initialize a memory poll object with a contiguous memory space.

Parameters
mem_poolPointer to the memory poll object.
memA contiguous memory space to provide.
sizeThe size of the memory poll.