Modbus Vault v1.0
Loading...
Searching...
No Matches
slab_pool.h File Reference

Memory slab provide abstraction layer for memory chunks. More...

#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for slab_pool.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  slab_pool_t
 Slab pool type structure. More...
 

Macros

#define SLAB_POOL_SIZE   (32U)
 
#define SLAB_POOL_MAX_DATA_SIZE   (512U)
 

Functions

esp_err_t slab_pool_init (void)
 Initialize slab pool.
 
slab_pool_tslab_pool_alloc (void)
 Allocate a slab from pool.
 
void slab_pool_free (slab_pool_t *slab_ptr)
 Return slab to pool.
 
void slab_pool_deinit (void)
 Deinitialize slab pool.
 

Detailed Description

Memory slab provide abstraction layer for memory chunks.

Author
Abanoub Salah
  • Thread-safe interface
  • Designed to provide ready memory-pool to any layer.

Macro Definition Documentation

◆ SLAB_POOL_MAX_DATA_SIZE

#define SLAB_POOL_MAX_DATA_SIZE   (512U)

Slab pool data maximum size

◆ SLAB_POOL_SIZE

#define SLAB_POOL_SIZE   (32U)

Slab pool size

Function Documentation

◆ slab_pool_alloc()

slab_pool_t * slab_pool_alloc ( void  )

Allocate a slab from pool.

Returns
slab_pool_t* pointer to slab on success otherwise NULL
Here is the call graph for this function:
Here is the caller graph for this function:

◆ slab_pool_free()

void slab_pool_free ( slab_pool_t slab_ptr)

Return slab to pool.

Parameters
slab_ptrPointer to slab structure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ slab_pool_init()

esp_err_t slab_pool_init ( void  )

Initialize slab pool.

Returns
esp_err_t Initialize result
Return values
ESP_OKInitialize success
ESP_ERR_NO_MEMNo available memory for resource allocation
ESP_ERR_INVALID_STATEAlready initialized
Here is the caller graph for this function: