added const for the uip_buf pointer for more efficient and smaller uip code and fixed same construct for the sicslowpan code

This commit is contained in:
joxe 2010-05-05 13:07:45 +00:00
parent e4187b2fc8
commit cd5dfa9692
4 changed files with 12 additions and 12 deletions

View file

@ -32,7 +32,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: sicslowpan.c,v 1.37 2010/04/01 10:56:00 adamdunkels Exp $ * $Id: sicslowpan.c,v 1.38 2010/05/05 13:07:45 joxe Exp $
*/ */
/** /**
* \file * \file
@ -209,9 +209,6 @@ static u8_t uncomp_hdr_len;
* @{ * @{
*/ */
/* NOTE: lenght is before the buffer to ensure alignment of the
buffer */
static u16_t sicslowpan_len; static u16_t sicslowpan_len;
/** /**
* The buffer used for the 6lowpan reassembly. * The buffer used for the 6lowpan reassembly.
@ -219,7 +216,9 @@ static u16_t sicslowpan_len;
* It has a fix size as we do not use dynamic memory allocation. * It has a fix size as we do not use dynamic memory allocation.
*/ */
static u8_t sicslowpan_buf[UIP_BUFSIZE]; /* Allocate buffer as 32 bit to ensure that it is 32-bit aligned */
static uint32_t uip_buf32[(UIP_BUFSIZE + 3) / 4];
static uint8_t * const sicslowpan_buf = (uint8_t * const) uip_buf32;
/** The total length of the IPv6 packet in the sicslowpan_buf. */ /** The total length of the IPv6 packet in the sicslowpan_buf. */

View file

@ -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.24 2010/05/04 09:19:41 joxe Exp $ * $Id: uip.c,v 1.25 2010/05/05 13:07:45 joxe Exp $
* *
*/ */
@ -128,7 +128,7 @@ struct uip_eth_addr uip_ethaddr = {{0,0,0,0,0,0}};
#ifndef UIP_CONF_EXTERNAL_BUFFER #ifndef UIP_CONF_EXTERNAL_BUFFER
static uint32_t uip_buf32[(UIP_BUFSIZE + 3) / 4]; static uint32_t uip_buf32[(UIP_BUFSIZE + 3) / 4];
uint8_t *uip_buf = (uint8_t *)uip_buf32; /* The packet buffer that contains uint8_t * const uip_buf = (uint8_t * const)uip_buf32; /* The packet buffer that contains
incoming packets. */ incoming packets. */
#endif /* UIP_CONF_EXTERNAL_BUFFER */ #endif /* UIP_CONF_EXTERNAL_BUFFER */

View file

@ -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.30 2010/05/04 09:19:41 joxe Exp $ * $Id: uip.h,v 1.31 2010/05/05 13:07:45 joxe Exp $
* *
*/ */
@ -476,8 +476,7 @@ void uip_reass_over(void);
} }
\endcode \endcode
*/ */
CCIF extern uint8_t *uip_buf; CCIF extern uint8_t * const uip_buf;
/** @} */ /** @} */

View file

@ -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: uip6.c,v 1.20 2010/05/04 09:19:41 joxe Exp $ * $Id: uip6.c,v 1.21 2010/05/05 13:07:45 joxe Exp $
* *
*/ */
@ -170,8 +170,10 @@ u8_t uip_ext_opt_offset = 0;
*/ */
/** Packet buffer for incoming and outgoing packets */ /** Packet buffer for incoming and outgoing packets */
#ifndef UIP_CONF_EXTERNAL_BUFFER #ifndef UIP_CONF_EXTERNAL_BUFFER
static uint32_t uip_buf32[(UIP_BUFSIZE + 3) / 4]; static uint32_t uip_buf32[(UIP_BUFSIZE + 3) / 4];
uint8_t *uip_buf = (uint8_t *) uip_buf32; uint8_t * const uip_buf = (uint8_t * const) uip_buf32;
#endif /* UIP_CONF_EXTERNAL_BUFFER */ #endif /* UIP_CONF_EXTERNAL_BUFFER */
/* The uip_appdata pointer points to application data. */ /* The uip_appdata pointer points to application data. */