changeset 3051:654ce0d409ee

* cdl/lwip_net.cdl: New CDL option CYGIMP_LWIP_ENDIAN_BY_HAL. * include/lwipopts.h: Add HAL override of htonl() and htons(). [ Bugzilla 1001275 ]
author sergeig
date Wed, 24 Aug 2011 17:35:27 +0000
parents b8cb8bedf5e1
children 49131cbb0014
files packages/net/lwip_tcpip/current/ChangeLog packages/net/lwip_tcpip/current/cdl/lwip_net.cdl packages/net/lwip_tcpip/current/include/lwipopts.h
diffstat 3 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/net/lwip_tcpip/current/ChangeLog
+++ b/packages/net/lwip_tcpip/current/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-23  Ilija Kocho  <ilijak@siva.com.mk>
+
+	* cdl/lwip_net.cdl: New CDL option CYGIMP_LWIP_ENDIAN_BY_HAL.
+	* include/lwipopts.h: Add HAL override of htonl() and htons().
+	[ Bugzilla 1001275 ]
+
 2011-03-08  John Dallaway  <john@dallaway.org.uk>
 
 	* cdl/lwip_net.cdl: Require CYGPKG_ISOINFRA.
--- a/packages/net/lwip_tcpip/current/cdl/lwip_net.cdl
+++ b/packages/net/lwip_tcpip/current/cdl/lwip_net.cdl
@@ -127,6 +127,17 @@ cdl_package CYGPKG_NET_LWIP {
         compile         ecos/sio.c
     }
     
+    cdl_option CYGIMP_LWIP_ENDIAN_BY_HAL {
+        display       "HAL optimized endian functions"
+        flavor        bool
+        active_if     CYGIMP_HAL_ARCH_ENDIAN
+        default_value CYGIMP_HAL_ARCH_ENDIAN
+        description   "
+            Some architectures provide optimized functions for endian
+            manipulation (byte swapping). If utilized, they can give
+            shorter and faster code for that."
+    }
+
     cdl_component CYGPKG_LWIP_APIS {
         display         "APIs"
         flavor          none
--- a/packages/net/lwip_tcpip/current/include/lwipopts.h
+++ b/packages/net/lwip_tcpip/current/include/lwipopts.h
@@ -36,6 +36,10 @@
 
 #include <cyg/hal/hal_arch.h>
 
+#if defined(CYGIMP_LWIP_ENDIAN_BY_HAL) && CYGIMP_LWIP_ENDIAN_BY_HAL
+# include <cyg/hal/hal_endian.h>
+#endif
+
 //------------------------------------------------------------------------------
 // Platform specific locking
 //------------------------------------------------------------------------------
@@ -44,6 +48,16 @@
 #define NO_SYS                      defined(CYGFUN_LWIP_MODE_SIMPLE)
 
 //------------------------------------------------------------------------------
+// Architecture specific options
+//------------------------------------------------------------------------------
+
+#if defined(CYGIMP_LWIP_ENDIAN_BY_HAL) && CYGIMP_LWIP_ENDIAN_BY_HAL
+# define LWIP_PLATFORM_BYTESWAP     1
+# define LWIP_PLATFORM_HTONS(__val) CYG_CPU_TO_BE16(__val)
+# define LWIP_PLATFORM_HTONL(__val) CYG_CPU_TO_BE32(__val)
+#endif
+
+//------------------------------------------------------------------------------
 // Memory options
 //------------------------------------------------------------------------------