MeterLogger
|
#include "lwip/opt.h"
#include "lwip/memp.h"
#include "lwip/pbuf.h"
#include "lwip/udp.h"
#include "lwip/raw.h"
#include "lwip/tcp_impl.h"
#include "lwip/igmp.h"
#include "lwip/api.h"
#include "lwip/api_msg.h"
#include "lwip/tcpip.h"
#include "lwip/sys.h"
#include "lwip/timers.h"
#include "lwip/stats.h"
#include "netif/etharp.h"
#include "lwip/ip_frag.h"
#include "lwip/snmp_structs.h"
#include "lwip/snmp_msg.h"
#include "lwip/dns.h"
#include "netif/ppp_oe.h"
#include <string.h>
#include "lwip/memp_std.h"
Go to the source code of this file.
Data Structures | |
struct | memp |
Macros | |
#define | MEMP_SIZE 0 |
#define | MEMP_ALIGN_SIZE(x) (LWIP_MEM_ALIGN_SIZE(x)) |
#define | LWIP_MEMPOOL(name, num, size, desc, attr) LWIP_MEM_ALIGN_SIZE(size), |
#define | LWIP_MEMPOOL(name, num, size, desc, attr) (num), |
#define | LWIP_MEMPOOL(name, num, size, desc, attr) (desc), |
#define | LWIP_MEMPOOL(name, num, size, desc, attr) + ( (num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size) ) ) |
Functions | |
void | memp_init (void) |
void * | memp_malloc (memp_t type) |
void | memp_free (memp_t type, void *mem) |
Variables | |
static struct memp * | memp_tab [MEMP_MAX] |
static const u32_t memp_sizes [MEMP_MAX] | ICACHE_RODATA_ATTR |
u16_t | memp_sizes_test [1] = {PBUF_POOL_BUFSIZE,} |
static const u16_t | memp_num [MEMP_MAX] |
const char * | memp_desc [MEMP_MAX] |
static u8_t | memp_memory [MEM_ALIGNMENT - 1 #define LWIP_MEMPOOL(name, num, size, desc, attr)] |
Dynamic pool memory manager
lwIP has dedicated pools for many structures (netconn, protocol control blocks, packet buffers, ...). All these pools are managed here.
Definition in file memp.c.
#define LWIP_MEMPOOL | ( | name, | |
num, | |||
size, | |||
desc, | |||
attr | |||
) | LWIP_MEM_ALIGN_SIZE(size), |
#define LWIP_MEMPOOL | ( | name, | |
num, | |||
size, | |||
desc, | |||
attr | |||
) | (num), |
#define LWIP_MEMPOOL | ( | name, | |
num, | |||
size, | |||
desc, | |||
attr | |||
) | (desc), |
#define LWIP_MEMPOOL | ( | name, | |
num, | |||
size, | |||
desc, | |||
attr | |||
) | + ( (num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size) ) ) |
#define MEMP_ALIGN_SIZE | ( | x | ) | (LWIP_MEM_ALIGN_SIZE(x)) |
#define MEMP_SIZE 0 |
Definition at line 110 of file memp.c.
Referenced by memp_free(), memp_init(), and memp_malloc().
void memp_free | ( | memp_t | type, |
void * | mem | ||
) |
Put an element back into its pool.
type | the pool where to put mem |
mem | the memp element to free |
Definition at line 438 of file memp.c.
References ETH_PAD_SIZE, LWIP_ASSERT, MEM_ALIGNMENT, memp_desc, memp_memory_PBUF_POOL_base, MEMP_SIZE, memp_sizes_test, MEMP_STATS_DEC, memp::next, NULL, PBUF_LINK_HLEN, PBUF_POOL_BUFSIZE, printf, SYS_ARCH_DECL_PROTECT, SYS_ARCH_PROTECT, SYS_ARCH_UNPROTECT, and TCP_MSS.
Referenced by espconn_kill_oldest(), espconn_kill_pcb(), espconn_tcp_client(), espconn_tcp_disconnect_successful(), espconn_tcp_server(), pbuf_free(), tcpip_callback_with_block(), tcpip_input(), and tcpip_thread().
void memp_init | ( | void | ) |
Initialize this module.
Carves out memp_memory into linked lists for each pool-type.
Definition at line 341 of file memp.c.
References LWIP_MEM_ALIGN, MEMP_MAX, memp_memory, memp_num, MEMP_OVERFLOW_CHECK, MEMP_SIZE, MEMP_STATS_AVAIL, memp::next, and NULL.
Referenced by lwip_init().
void* memp_malloc | ( | memp_t | type | ) |
Get an element from a specific pool.
type | the pool to get an element from |
the debug version has two more parameters:
file | file name calling this function |
line | number of line where this function is called |
Definition at line 393 of file memp.c.
References LWIP_ASSERT, LWIP_DBG_LEVEL_SERIOUS, LWIP_DEBUGF, LWIP_ERROR, MEM_ALIGNMENT, MEMP_DEBUG, memp_desc, MEMP_MAX, MEMP_SIZE, MEMP_STATS_INC, MEMP_STATS_INC_USED, memp::next, NULL, SYS_ARCH_DECL_PROTECT, SYS_ARCH_PROTECT, and SYS_ARCH_UNPROTECT.
Referenced by pbuf_alloc(), tcpip_callback_with_block(), and tcpip_input().
const char* memp_desc[MEMP_MAX] |
This array holds a textual description of each pool.
Definition at line 147 of file memp.c.
Referenced by memp_free(), and memp_malloc().
|
static |
This is the actual memory used by the pools (all pools in one big block).
Definition at line 176 of file memp.c.
Referenced by memp_init().
This array holds the number of elements in each pool.
Definition at line 139 of file memp.c.
Referenced by memp_init().
u16_t memp_sizes_test[1] = {PBUF_POOL_BUFSIZE,} |
Definition at line 134 of file memp.c.
Referenced by memp_free().