mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 16:29:34 +00:00
The recent change turning uip_buf from an array to a pointer seems a quite heavyweight way to have the uip_buf alligned to a 32-bit boundary. Contiki is - still - supposed to be portable across a wide range of toolchains - therefore it i.e. intentionally doesn't use C99 features. From that perspective it seems questionable if all toolchains are able to optimize away the overhead imposed by an "unnecessary" indirection to access uip_buf - and uIP consists mostly of accesses to uip_buf. Even if the future is supposed to bring support for multiple uip_bufs which would turn the uip_buf pointer from a mere workaround to an neceesary element on can still presume that there will be targets with resources limited in a way prohibiting the use of several uip_bufs. So at least for those targets will still be a usecase for a "plain", not indirected uip_buf.
Therefore it seems reasonable to allow to stay with the "plain" uip_buf at compile-time.
This commit is contained in:
parent
62ca797fad
commit
e5665fb968
@ -41,7 +41,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: uip.c,v 1.26 2010/05/07 20:45:16 oliverschmidt Exp $
|
* $Id: uip.c,v 1.27 2010/05/08 07:23:55 oliverschmidt Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -126,12 +126,14 @@ const struct uip_eth_addr uip_ethaddr = {{UIP_ETHADDR0,
|
|||||||
struct uip_eth_addr uip_ethaddr = {{0,0,0,0,0,0}};
|
struct uip_eth_addr uip_ethaddr = {{0,0,0,0,0,0}};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef UIP_CONF_EXTERNAL_BUFFER
|
#ifdef UIP_CONF_PLAIN_BUFFER
|
||||||
|
uint8_t uip_buf[UIP_BUFSIZE + 2];
|
||||||
|
#else /* UIP_CONF_PLAIN_BUFFER */
|
||||||
static uint32_t uip_buf32[(UIP_BUFSIZE + 3) / 4];
|
static uint32_t uip_buf32[(UIP_BUFSIZE + 3) / 4];
|
||||||
#endif /* UIP_CONF_EXTERNAL_BUFFER */
|
|
||||||
uint8_t * const uip_buf = (uint8_t * const)uip_buf32;
|
uint8_t * const uip_buf = (uint8_t * const)uip_buf32;
|
||||||
/* The packet buffer that contains
|
/* The packet buffer that contains
|
||||||
incoming packets. */
|
incoming packets. */
|
||||||
|
#endif /* UIP_CONF_PLAIN_BUFFER */
|
||||||
|
|
||||||
void *uip_appdata; /* The uip_appdata pointer points to
|
void *uip_appdata; /* The uip_appdata pointer points to
|
||||||
application data. */
|
application data. */
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: uip.h,v 1.31 2010/05/05 13:07:45 joxe Exp $
|
* $Id: uip.h,v 1.32 2010/05/08 07:23:55 oliverschmidt Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -476,7 +476,11 @@ void uip_reass_over(void);
|
|||||||
}
|
}
|
||||||
\endcode
|
\endcode
|
||||||
*/
|
*/
|
||||||
|
#ifdef UIP_CONF_PLAIN_BUFFER
|
||||||
|
CCIF extern uint8_t uip_buf[UIP_BUFSIZE+2];
|
||||||
|
#else /* UIP_CONF_PLAIN_BUFFER */
|
||||||
CCIF extern uint8_t * const uip_buf;
|
CCIF extern uint8_t * const uip_buf;
|
||||||
|
#endif /* UIP_CONF_PLAIN_BUFFER */
|
||||||
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
Loading…
Reference in New Issue
Block a user