Merge pull request #816 from kkrentz/contikimac-framer-fix

ContikiMAC framer fix
This commit is contained in:
Nicolas Tsiftes 2014-11-28 19:12:55 +01:00
commit 47096a1bae
9 changed files with 48 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, Fraunhofer Heinrich-Hertz-Institut. * Copyright (c) 2010, Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -26,6 +26,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* This file is part of the Contiki operating system.
*
*/ */
/** /**
@ -78,6 +80,12 @@ struct hdr {
uint8_t len; uint8_t len;
}; };
/*---------------------------------------------------------------------------*/
static int
hdr_length(void)
{
return DECORATED_FRAMER.length() + sizeof(struct hdr);
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static int static int
create(void) create(void)
@ -172,6 +180,7 @@ parse(void)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
const struct framer contikimac_framer = { const struct framer contikimac_framer = {
hdr_length,
create, create,
create_and_secure, create_and_secure,
parse parse

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, Fraunhofer Heinrich-Hertz-Institut. * Copyright (c) 2010, Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -26,6 +26,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* This file is part of the Contiki operating system.
*
*/ */
/** /**

View File

@ -243,7 +243,13 @@ typedef unsigned short uip_stats_t;
#define WITH_PHASE_OPTIMIZATION 0 #define WITH_PHASE_OPTIMIZATION 0
#define CONTIKIMAC_CONF_COMPOWER 1 #define CONTIKIMAC_CONF_COMPOWER 1
#define RIMESTATS_CONF_ENABLED 1 #define RIMESTATS_CONF_ENABLED 1
#define NETSTACK_CONF_FRAMER framer_802154
#if UIP_CONF_IPV6
#define NETSTACK_CONF_FRAMER framer802154
#else /* UIP_CONF_IPV6 */
#define NETSTACK_CONF_FRAMER contikimac_framer
#endif /* UIP_CONF_IPV6 */
#define NETSTACK_CONF_RADIO rf230_driver #define NETSTACK_CONF_RADIO rf230_driver
#define CHANNEL_802_15_4 26 #define CHANNEL_802_15_4 26
/* The radio needs to interrupt during an rtimer interrupt */ /* The radio needs to interrupt during an rtimer interrupt */

View File

@ -259,7 +259,13 @@ typedef unsigned short uip_stats_t;
#define WITH_PHASE_OPTIMIZATION 0 #define WITH_PHASE_OPTIMIZATION 0
#define CONTIKIMAC_CONF_COMPOWER 1 #define CONTIKIMAC_CONF_COMPOWER 1
#define RIMESTATS_CONF_ENABLED 1 #define RIMESTATS_CONF_ENABLED 1
#define NETSTACK_CONF_FRAMER framer_802154
#if UIP_CONF_IPV6
#define NETSTACK_CONF_FRAMER framer802154
#else /* UIP_CONF_IPV6 */
#define NETSTACK_CONF_FRAMER contikimac_framer
#endif /* UIP_CONF_IPV6 */
#define NETSTACK_CONF_RADIO rf230_driver #define NETSTACK_CONF_RADIO rf230_driver
#define CHANNEL_802_15_4 26 #define CHANNEL_802_15_4 26
/* The radio needs to interrupt during an rtimer interrupt */ /* The radio needs to interrupt during an rtimer interrupt */

View File

@ -312,7 +312,13 @@ typedef unsigned short uip_stats_t;
#define NETSTACK_CONF_MAC nullmac_driver #define NETSTACK_CONF_MAC nullmac_driver
//#define NETSTACK_CONF_MAC csma_driver //#define NETSTACK_CONF_MAC csma_driver
#define NETSTACK_CONF_RDC contikimac_driver #define NETSTACK_CONF_RDC contikimac_driver
#define NETSTACK_CONF_FRAMER framer_802154
#if UIP_CONF_IPV6
#define NETSTACK_CONF_FRAMER framer802154
#else /* UIP_CONF_IPV6 */
#define NETSTACK_CONF_FRAMER contikimac_framer
#endif /* UIP_CONF_IPV6 */
#define NETSTACK_CONF_RADIO rf230_driver #define NETSTACK_CONF_RADIO rf230_driver
#define CHANNEL_802_15_4 26 #define CHANNEL_802_15_4 26
/* Enable extended mode with autoack, but no csma/autoretry */ /* Enable extended mode with autoack, but no csma/autoretry */

View File

@ -316,8 +316,12 @@ typedef uint32_t rtimer_clock_t;
#endif #endif
#ifndef NETSTACK_CONF_FRAMER #ifndef NETSTACK_CONF_FRAMER
#if UIP_CONF_IPV6
#define NETSTACK_CONF_FRAMER framer_802154 #define NETSTACK_CONF_FRAMER framer_802154
#endif #else /* UIP_CONF_IPV6 */
#define NETSTACK_CONF_FRAMER contikimac_framer
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_FRAMER */
#define NETSTACK_CONF_RADIO cc2538_rf_driver #define NETSTACK_CONF_RADIO cc2538_rf_driver
/** @} */ /** @} */

View File

@ -26,7 +26,11 @@
#endif /* NETSTACK_CONF_RADIO */ #endif /* NETSTACK_CONF_RADIO */
#ifndef NETSTACK_CONF_FRAMER #ifndef NETSTACK_CONF_FRAMER
#if WITH_UIP6
#define NETSTACK_CONF_FRAMER framer_802154 #define NETSTACK_CONF_FRAMER framer_802154
#else /* WITH_UIP6 */
#define NETSTACK_CONF_FRAMER contikimac_framer
#endif /* WITH_UIP6 */
#endif /* NETSTACK_CONF_FRAMER */ #endif /* NETSTACK_CONF_FRAMER */
#ifndef CC2420_CONF_AUTOACK #ifndef CC2420_CONF_AUTOACK

View File

@ -26,7 +26,11 @@
#endif /* NETSTACK_CONF_RADIO */ #endif /* NETSTACK_CONF_RADIO */
#ifndef NETSTACK_CONF_FRAMER #ifndef NETSTACK_CONF_FRAMER
#if WITH_UIP6
#define NETSTACK_CONF_FRAMER framer_802154 #define NETSTACK_CONF_FRAMER framer_802154
#else /* WITH_UIP6 */
#define NETSTACK_CONF_FRAMER contikimac_framer
#endif /* WITH_UIP6 */
#endif /* NETSTACK_CONF_FRAMER */ #endif /* NETSTACK_CONF_FRAMER */
#ifndef CC2420_CONF_AUTOACK #ifndef CC2420_CONF_AUTOACK

View File

@ -69,7 +69,7 @@
#define NETSTACK_CONF_MAC csma_driver #define NETSTACK_CONF_MAC csma_driver
#define NETSTACK_CONF_RDC contikimac_driver #define NETSTACK_CONF_RDC contikimac_driver
#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
#define NETSTACK_CONF_FRAMER framer_802154 #define NETSTACK_CONF_FRAMER contikimac_framer
#define CC2420_CONF_AUTOACK 1 #define CC2420_CONF_AUTOACK 1