Some quick code to use UDP-only (no TCP) with mBed. Echos received packets and sends packets when a button is pressed
lwipopts.h
00001 #ifndef LWIPOPTS_H 00002 #define LWIPOPTS_H 00003 00004 #include <string.h> 00005 #include <stdlib.h> 00006 //#include <mbed.h> 00007 #include <stdio.h> 00008 00009 #ifdef __cplusplus 00010 using namespace std; 00011 #endif 00012 00013 // Application specific lwIP Options. 00014 #define IPv6 0 00015 #define NO_SYS 1 00016 #define LWIP_ARP 1 00017 #define LWIP_RAW 0 00018 #define LWIP_UDP 1 00019 #define LWIP_TCP 1 00020 #define LWIP_DNS 1 00021 #define LWIP_DHCP 1 00022 #define LWIP_IGMP 0 00023 #define LWIP_SNMP 0 00024 #define LWIP_SOCKET 0 00025 #define LWIP_NETCONN 0 00026 #define LWIP_AUTOIP 0 00027 #define LWIP_CALLBACK_API 1 00028 00029 #define MEM_LIBC_MALLOC 1 00030 #define MEMP_MEM_MALLOC 1 00031 #define MEM_ALIGNMENT 4 00032 //#define MEM_SIZE 5000 00033 #define MEM_SIZE 10000 00034 //#define MEM_SIZE (EMAC_MEM_SIZE - (2 * SIZEOF_STRUCT_MEM) - MEM_ALIGNMENT) 00035 #define MEM_POSITION __attribute((section("AHBSRAM1"),aligned)) 00036 // EMAC_MEM_ADDR 00037 00038 #define ARP_QUEUEING 0 00039 #define LWIP_NETIF_HOSTNAME 1 00040 00041 #define ARP_TABLE_SIZE 4 00042 00043 #define DNS_TABLE_SIZE 1 00044 #define DNS_USES_STATIC_BUF 0 00045 // 0 - Stack 00046 // 1 - RW-MEM 00047 // 2 - Heap 00048 00049 #define IP_FRAG_USES_STATIC_BUF 0 00050 #define LWIP_STATS 0 00051 00052 #define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 1 00053 00054 #define TCP_SND_BUF 2000 00055 #define TCP_MSS 0x276 00056 //0x300 00057 //#define TCP_SND_QUEUELEN (2 * TCP_SND_BUF/TCP_MSS) 00058 #define TCP_SND_QUEUELEN 16 00059 #define MEMP_NUM_TCP_PCB 5 00060 #define MEMP_NUM_TCP_PCB_LISTEN 8 00061 #define MEMP_NUM_TCP_SEG 20 00062 #define MEMP_NUM_PBUF 16 00063 #define PBUF_POOL_SIZE 6 00064 00065 #ifndef HOSTNAME 00066 #define HOSTNAME "mbed-c3p0" 00067 #endif 00068 00069 #define LWIP_DEBUG 1 00070 #define LWIP_DBG_TYPES_ON 0x03 //~0x0 00071 #define LWIP_DBG_MIN_LEVEL 0 00072 #define MEM_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING) 00073 //#define TCP_INPUT_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING) 00074 //#define TCP_OUTPUT_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING) 00075 //#define NETIF_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING) 00076 //#define DHCP_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING) 00077 //#define IP_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING) 00078 //#define TCP_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING) 00079 //#define TCP_CWND_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING) 00080 00081 #endif
Generated on Tue Jul 12 2022 19:17:23 by 1.7.2