From 9754c3a6ce119209ebdd9e3a2ad29947e6296fff Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 9 Jan 2013 09:34:48 +0000 Subject: [PATCH] Option for lwip link status poll interval. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5047 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/mac.h | 2 +- os/various/lwip_bindings/lwipthread.c | 2 +- os/various/lwip_bindings/lwipthread.h | 59 +++++++++++++++------------ readme.txt | 1 + 4 files changed, 35 insertions(+), 29 deletions(-) diff --git a/os/hal/include/mac.h b/os/hal/include/mac.h index d7893bc0c..79813e672 100644 --- a/os/hal/include/mac.h +++ b/os/hal/include/mac.h @@ -177,7 +177,7 @@ typedef struct MACDriver MACDriver; * * @api */ -#define magGetNextReceiveBuffer(rdp, sizep) \ +#define macGetNextReceiveBuffer(rdp, sizep) \ mac_lld_get_next_receive_buffer(rdp, sizep) #endif /* MAC_USE_ZERO_COPY */ /** @} */ diff --git a/os/various/lwip_bindings/lwipthread.c b/os/various/lwip_bindings/lwipthread.c index 145eebf0d..d8a558b35 100644 --- a/os/various/lwip_bindings/lwipthread.c +++ b/os/various/lwip_bindings/lwipthread.c @@ -262,7 +262,7 @@ msg_t lwip_thread(void *p) { netif_set_up(&thisif); /* Setup event sources.*/ - evtInit(&evt, S2ST(5)); + evtInit(&evt, LWIP_LINK_POLL_INTERVAL); evtStart(&evt); chEvtRegisterMask(&evt.et_es, &el0, PERIODIC_TIMER_ID); chEvtRegisterMask(macGetReceiveEventSource(ÐD1), &el1, FRAME_RECEIVED_ID); diff --git a/os/various/lwip_bindings/lwipthread.h b/os/various/lwip_bindings/lwipthread.h index fc608642e..ed7682755 100644 --- a/os/various/lwip_bindings/lwipthread.h +++ b/os/various/lwip_bindings/lwipthread.h @@ -30,77 +30,82 @@ /** @brief MAC thread priority.*/ #ifndef LWIP_THREAD_PRIORITY -#define LWIP_THREAD_PRIORITY LOWPRIO -#endif - -/** @brief IP Address. */ -#if !defined(LWIP_IPADDR) || defined(__DOXYGEN__) -#define LWIP_IPADDR(p) IP4_ADDR(p, 192, 168, 1, 20) -#endif - -/** @brief IP Gateway. */ -#if !defined(LWIP_GATEWAY) || defined(__DOXYGEN__) -#define LWIP_GATEWAY(p) IP4_ADDR(p, 192, 168, 1, 1) -#endif - -/** @brief IP netmask. */ -#if !defined(LWIP_NETMASK) || defined(__DOXYGEN__) -#define LWIP_NETMASK(p) IP4_ADDR(p, 255, 255, 255, 0) +#define LWIP_THREAD_PRIORITY LOWPRIO #endif /** @brief MAC thread stack size. */ #if !defined(LWIP_THREAD_STACK_SIZE) || defined(__DOXYGEN__) -#define LWIP_THREAD_STACK_SIZE 512 +#define LWIP_THREAD_STACK_SIZE 512 +#endif + +/** @brief Link poll interval. */ +#if !defined(LWIP_LINK_POLL_INTERVAL) || defined(__DOXYGEN__) +#define LWIP_LINK_POLL_INTERVAL S2ST(5) +#endif + +/** @brief IP Address. */ +#if !defined(LWIP_IPADDR) || defined(__DOXYGEN__) +#define LWIP_IPADDR(p) IP4_ADDR(p, 192, 168, 1, 20) +#endif + +/** @brief IP Gateway. */ +#if !defined(LWIP_GATEWAY) || defined(__DOXYGEN__) +#define LWIP_GATEWAY(p) IP4_ADDR(p, 192, 168, 1, 1) +#endif + +/** @brief IP netmask. */ +#if !defined(LWIP_NETMASK) || defined(__DOXYGEN__) +#define LWIP_NETMASK(p) IP4_ADDR(p, 255, 255, 255, 0) #endif /** @brief Transmission timeout. */ #if !defined(LWIP_SEND_TIMEOUT) || defined(__DOXYGEN__) -#define LWIP_SEND_TIMEOUT 50 +#define LWIP_SEND_TIMEOUT 50 #endif /** @brief Link speed. */ #if !defined(LWIP_LINK_SPEED) || defined(__DOXYGEN__) -#define LWIP_LINK_SPEED 100000000 +#define LWIP_LINK_SPEED 100000000 #endif /** @brief MAC Address byte 0. */ #if !defined(LWIP_ETHADDR_0) || defined(__DOXYGEN__) -#define LWIP_ETHADDR_0 0xC2 +#define LWIP_ETHADDR_0 0xC2 #endif /** @brief MAC Address byte 1. */ #if !defined(LWIP_ETHADDR_1) || defined(__DOXYGEN__) -#define LWIP_ETHADDR_1 0xAF +#define LWIP_ETHADDR_1 0xAF #endif /** @brief MAC Address byte 2. */ #if !defined(LWIP_ETHADDR_2) || defined(__DOXYGEN__) -#define LWIP_ETHADDR_2 0x51 +#define LWIP_ETHADDR_2 0x51 #endif /** @brief MAC Address byte 3. */ #if !defined(LWIP_ETHADDR_3) || defined(__DOXYGEN__) -#define LWIP_ETHADDR_3 0x03 +#define LWIP_ETHADDR_3 0x03 #endif /** @brief MAC Address byte 4. */ #if !defined(LWIP_ETHADDR_4) || defined(__DOXYGEN__) -#define LWIP_ETHADDR_4 0xCF +#define LWIP_ETHADDR_4 0xCF #endif /** @brief MAC Address byte 5. */ #if !defined(LWIP_ETHADDR_5) || defined(__DOXYGEN__) -#define LWIP_ETHADDR_5 0x46 +#define LWIP_ETHADDR_5 0x46 #endif /** @brief Interface name byte 0. */ #if !defined(LWIP_IFNAME0) || defined(__DOXYGEN__) -#define LWIP_IFNAME0 'm' +#define LWIP_IFNAME0 'm' #endif /** @brief Interface name byte 1. */ #if !defined(LWIP_IFNAME1) || defined(__DOXYGEN__) -#define LWIP_IFNAME1 's' +#define LWIP_IFNAME1 's' #endif /** diff --git a/readme.txt b/readme.txt index 532752cee..0e54caa6c 100644 --- a/readme.txt +++ b/readme.txt @@ -98,6 +98,7 @@ TODO: Create a FatFS wrapper implementing the interface and using a server thread for synchronization. TODO: Create an implementation over a read-only file system in code space. +- NEW: Added an option to lwipthread to change the link status poll interval. - NEW: Added new C++ demo for the STM32F4-Discovery. - NEW: Updated C++ wrapper with a much more logical classes structure. TODO: Opdate older C++ demos.