From b9e1e52093d33494bf4a8ca27c14a56a25b6e0bc Mon Sep 17 00:00:00 2001 From: Daniele Basile Date: Mon, 16 Jan 2012 15:01:59 +0100 Subject: [PATCH] Move unpack lwip ip address macro to macros module. --- bertos/cfg/macros.h | 17 +++++++++++++++++ .../examples/sam3x-ek_http_server/main.c | 7 ------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/bertos/cfg/macros.h b/bertos/cfg/macros.h index ff682fe2..de9fa0e9 100644 --- a/bertos/cfg/macros.h +++ b/bertos/cfg/macros.h @@ -446,5 +446,22 @@ INLINE bool is_aligned(const void *addr, size_t size) /** \} */ //defgroup macros + +/** + * Macro to unpack the ip addres from lwip format in 4 int + * \param struct ip_addr ip_addr; + * \return for int variable separated from comma + * + * \usage: + * \code + * LOG_INFO("dhcp ok: ip = %d.%d.%d.%d\n", IP_ADDR_TO_INT_TUPLE(netif.ip_addr.addr)); + * \endcode + */ +#define IP_ADDR_TO_INT_TUPLE(addr) \ + (int)((addr) >> 0 & 0xff), \ + (int)((addr) >> 8 & 0xff), \ + (int)((addr) >> 16 & 0xff), \ + (int)((addr) >> 24 & 0xff) + #endif /* MACROS_H */ diff --git a/boards/sam3x-ek/examples/sam3x-ek_http_server/main.c b/boards/sam3x-ek/examples/sam3x-ek_http_server/main.c index 4e6b492f..30054db8 100644 --- a/boards/sam3x-ek/examples/sam3x-ek_http_server/main.c +++ b/boards/sam3x-ek/examples/sam3x-ek_http_server/main.c @@ -92,13 +92,6 @@ #include #include -/* Macro to unpack the ip addres from lwip format in 4 int*/ -#define IP_ADDR_TO_INT_TUPLE(addr) \ - (int)((addr) >> 0 & 0xff), \ - (int)((addr) >> 8 & 0xff), \ - (int)((addr) >> 16 & 0xff), \ - (int)((addr) >> 24 & 0xff) - /* Network interface global variables */ static struct ip_addr ipaddr, netmask, gw; static struct netif netif; -- 2.25.1