Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
mpool.h
Go to the documentation of this file.
1 
4 #ifndef __MPOOL_H__
5 #define __MPOOL_H__
6 
7 #include <stddef.h>
8 #include <stdint.h>
9 
10 struct mpool {
11  int offset;
12  size_t size;
13  uint8_t *mem;
14 };
15 
22 void mpool_init(struct mpool *mpool, uint8_t *mem, size_t size);
23 
29 void *mpool_alloc(struct mpool *mpool, size_t size);
30 
31 #endif
void mpool_init(struct mpool *mpool, uint8_t *mem, size_t size)
Initialize a memory poll object with a contiguous memory space.
Definition: mpool.c:5
void * mpool_alloc(struct mpool *mpool, size_t size)
Allocate a memory space from the memory pool.
Definition: mpool.h:10