?? memp.h
字號:
/*
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Adam Dunkels <adam@sics.se>
*
*/
#ifndef __LWIP_MEMP_H__
#define __LWIP_MEMP_H__
#include "lwip/opt.h"
typedef enum {
MEMP_PBUF,
#if LWIP_UDP
MEMP_UDP_PCB,
#endif
#if LWIP_TCP
MEMP_TCP_PCB,
MEMP_TCP_PCB_LISTEN,
MEMP_TCP_SEG,
#endif
#if (NO_SYS!=1)
MEMP_NETBUF,
MEMP_NETCONN,
MEMP_API_MSG,
MEMP_TCPIP_MSG,
MEMP_SYS_TIMEOUT,
#endif
MEMP_MAX
} memp_t;
struct memp {
struct memp *next;
};
void memp_init(void);
void *memp_malloc(memp_t type);
void *memp_realloc(memp_t fromtype, memp_t totype, void *mem);
void memp_free(memp_t type, void *mem);
void *memp_mallocp(memp_t type);
void memp_freep(memp_t type, void *mem);
#ifdef CONFIGURABLE
#ifdef MAIN // for user, not lib maker
const u16_t memp_num[MEMP_MAX]= {
PBUF_NUM,
#if LWIP_UDP
UDP_NUM,
#endif
#if LWIP_TCP
TCP_NUM,
LTCP_NUM,
TCP_SEG_NUM,
#endif
#if (NO_SYS !=1)
MEMP_NUM_NETBUF,
MEMP_NUM_NETCONN,
MEMP_NUM_API_MSG,
MEMP_NUM_TCPIP_MSG,
MEMP_NUM_SYS_TIMEOUT
#endif
};
#else
extern u16_t memp_num[];
#endif
#if (LWIP_UDP!=1)
#undef UDP_NUM
#define UDP_NUM 0
#endif
#if (LWIP_TCP!=1)
#undef TCP_NUM
#undef LTCP_NUM
#undef TCP_SEG_NUM
#define TCP_NUM 0
#define LTCP_NUM 0
#define TCP_SEG_NUM 0
#endif
EXTVAR_ARRAY(u8_t memp_memory,(PBUF_NUM *
MEM_ALIGN_SIZE(sizeof(struct pbuf) +
sizeof(struct memp)) +
UDP_NUM *
MEM_ALIGN_SIZE(sizeof(struct udp_pcb) +
sizeof(struct memp)) +
TCP_NUM *
MEM_ALIGN_SIZE(sizeof(struct tcp_pcb) +
sizeof(struct memp)) +
LTCP_NUM *
MEM_ALIGN_SIZE(sizeof(struct tcp_pcb_listen) +
sizeof(struct memp)) +
TCP_SEG_NUM *
MEM_ALIGN_SIZE(sizeof(struct tcp_seg) +
sizeof(struct memp))
/*#if (NO_SYS!=1)
+
MEMP_NUM_NETBUF *
MEM_ALIGN_SIZE(sizeof(struct netbuf) +
sizeof(struct memp)) +
MEMP_NUM_NETCONN *
MEM_ALIGN_SIZE(sizeof(struct netconn) +
sizeof(struct memp)) +
MEMP_NUM_API_MSG *
MEM_ALIGN_SIZE(sizeof(struct api_msg) +
sizeof(struct memp)) +
MEMP_NUM_TCPIP_MSG *
MEM_ALIGN_SIZE(sizeof(struct tcpip_msg) +
sizeof(struct memp)) +
MEMP_NUM_SYS_TIMEOUT *
MEM_ALIGN_SIZE(sizeof(struct sys_timeout) +
sizeof(struct memp))
#endif*/
));
EXTVAR(pbuf_num,PBUF_NUM);
EXTVAR(udp_num,UDP_NUM);
EXTVAR(tcp_num,TCP_NUM);
EXTVAR(ltcp_num,LTCP_NUM);
EXTVAR(tcp_seg_num,TCP_SEG_NUM);
#endif
#endif /* __LWIP_MEMP_H__ */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -