From 0004e016776379b57468a3f01cb61c932a5d2819 Mon Sep 17 00:00:00 2001 From: rtel Date: Mon, 9 Jun 2014 12:43:18 +0000 Subject: [PATCH] Update lwIP byte alignment to make Zynq pings more reliable. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2252 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../RTOSDemo/src/FreeRTOSConfig.h | 8 ++--- .../src/Full_Demo/lwIP_port/netif/xadapter.c | 2 +- .../src/Full_Demo/lwIP_port/sys_arch.c | 7 +--- .../RTOSDemo/src/lwipopts.h | 33 +++++++++++++++---- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h index 4df6af36f..7fdca27e5 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h @@ -218,10 +218,10 @@ Zynq MPU. */ #define configMAC_ADDR5 0x16 /* IP address configuration. */ -#define configIP_ADDR0 10 -#define configIP_ADDR1 134 -#define configIP_ADDR2 134 -#define configIP_ADDR3 210 +#define configIP_ADDR0 172 +#define configIP_ADDR1 25 +#define configIP_ADDR2 218 +#define configIP_ADDR3 200 /* Netmask configuration. */ #define configNET_MASK0 255 diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/lwIP_port/netif/xadapter.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/lwIP_port/netif/xadapter.c index 1517189b4..065746b18 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/lwIP_port/netif/xadapter.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/lwIP_port/netif/xadapter.c @@ -201,7 +201,7 @@ xemacif_input_thread(struct netif *netif) * This semaphore is set by the packet receive interrupt * routine. */ - sys_sem_wait(&emac->sem_rx_data_available); + sys_arch_sem_wait( &emac->sem_rx_data_available, 250 / portTICK_PERIOD_MS ); /* move all received packets to lwIP */ xemacif_input(netif); diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/lwIP_port/sys_arch.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/lwIP_port/sys_arch.c index 70ed0d369..0f850524e 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/lwIP_port/sys_arch.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/lwIP_port/sys_arch.c @@ -276,15 +276,10 @@ err_t sys_sem_new( sys_sem_t *pxSemaphore, u8_t ucCount ) { err_t xReturn = ERR_MEM; - vSemaphoreCreateBinary( ( *pxSemaphore ) ); + *pxSemaphore = xSemaphoreCreateCounting( 0xffff, ( unsigned long ) ucCount ); if( *pxSemaphore != NULL ) { - if( ucCount == 0U ) - { - xSemaphoreTake( *pxSemaphore, 1UL ); - } - xReturn = ERR_OK; SYS_STATS_INC_USED( sem ); } diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwipopts.h b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwipopts.h index 1a9cfb124..46f8597f8 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwipopts.h +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwipopts.h @@ -109,7 +109,7 @@ void vLwipAppsReleaseTxBuffer( void ); byte alignment -> define MEM_ALIGNMENT to 2. */ /* MSVC port: intel processors don't need 4-byte alignment, but are faster that way! */ -#define MEM_ALIGNMENT 4 +#define MEM_ALIGNMENT 64 /* MEM_SIZE: the size of the heap memory. If the application will send a lot of data that needs to be copied, this should be set high. */ @@ -148,10 +148,10 @@ a lot of data that needs to be copied, this should be set high. */ /* The following four are used only with the sequential API and can be set to 0 if the application only will use the raw API. */ /* MEMP_NUM_NETBUF: the number of struct netbufs. */ -#define MEMP_NUM_NETBUF 0 +#define MEMP_NUM_NETBUF 8 /* MEMP_NUM_NETCONN: the number of struct netconns. */ -#define MEMP_NUM_NETCONN 10 +#define MEMP_NUM_NETCONN 16 /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used for sequential API communication and incoming packets. Used in @@ -198,6 +198,13 @@ a lot of data that needs to be copied, this should be set high. */ TCP_SND_BUF/TCP_MSS for things to work. */ #define TCP_SND_QUEUELEN (16 * TCP_SND_BUF/TCP_MSS) +#define CHECKSUM_GEN_TCP 0 +#define CHECKSUM_GEN_UDP 0 +#define CHECKSUM_GEN_IP 0 +#define CHECKSUM_CHECK_TCP 0 +#define CHECKSUM_CHECK_UDP 0 +#define CHECKSUM_CHECK_IP 0 + /* TCP writable space (bytes). This must be less than or equal to TCP_SND_BUF. It is the amount of space which must be available in the tcp snd_buf for select to return writable */ @@ -227,10 +234,15 @@ a lot of data that needs to be copied, this should be set high. */ /* IP reassembly and segmentation.These are orthogonal even * if they both deal with IP fragments */ -#define IP_REASSEMBLY 0 -#define IP_REASS_MAX_PBUFS 10 +#define IP_REASSEMBLY 1 +#define IP_REASS_MAX_PBUFS 128 #define MEMP_NUM_REASSDATA 10 -#define IP_FRAG 0 +#define IP_FRAG 1 + +#define IP_OPTIONS 0 +#define IP_FRAG_MAX_MTU 1500 +#define IP_DEFAULT_TTL 255 +#define LWIP_CHKSUM_ALGORITHM 3 /* ---------- ICMP options ---------- */ @@ -278,6 +290,15 @@ a lot of data that needs to be copied, this should be set high. */ #endif /* LWIP_STATS */ +#define NO_SYS_NO_TIMERS 1 +#define MEMP_SEPARATE_POOLS 1 +#define MEMP_NUM_FRAG_PBUF 256 +#define IP_OPTIONS_ALLOWED 0 +#define TCP_OVERSIZE TCP_MSS +#define LWIP_COMPAT_MUTEX 0 +#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1 + + /* ---------- PPP options ---------- */ #define PPP_SUPPORT 0 /* Set > 0 for PPP */ -- 2.39.5