From 18ee5ce294eebd1a1bfbafdd539fcb3e00a69bde Mon Sep 17 00:00:00 2001 From: kkrentz Date: Thu, 9 Oct 2014 23:33:08 -0700 Subject: [PATCH 1/3] ContikiMAC: Added missing length function to contikimac-framer.c --- core/net/mac/contikimac/contikimac-framer.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/net/mac/contikimac/contikimac-framer.c b/core/net/mac/contikimac/contikimac-framer.c index 86121df5e..cbe4c8f5f 100644 --- a/core/net/mac/contikimac/contikimac-framer.c +++ b/core/net/mac/contikimac/contikimac-framer.c @@ -78,6 +78,12 @@ struct hdr { uint8_t len; }; +/*---------------------------------------------------------------------------*/ +static int +hdr_length(void) +{ + return DECORATED_FRAMER.length() + sizeof(struct hdr); +} /*---------------------------------------------------------------------------*/ static int create(void) @@ -172,6 +178,7 @@ parse(void) } /*---------------------------------------------------------------------------*/ const struct framer contikimac_framer = { + hdr_length, create, create_and_secure, parse From 6ecbf8af347fc6956dd863b6514b240e137884c0 Mon Sep 17 00:00:00 2001 From: kkrentz Date: Tue, 18 Nov 2014 00:49:25 -0800 Subject: [PATCH 2/3] ContikiMAC: Retain original copyright --- core/net/mac/contikimac/contikimac-framer.c | 4 +++- core/net/mac/contikimac/contikimac-framer.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/net/mac/contikimac/contikimac-framer.c b/core/net/mac/contikimac/contikimac-framer.c index cbe4c8f5f..0a47866f9 100644 --- a/core/net/mac/contikimac/contikimac-framer.c +++ b/core/net/mac/contikimac/contikimac-framer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Fraunhofer Heinrich-Hertz-Institut. + * Copyright (c) 2010, Swedish Institute of Computer Science. * All rights reserved. * * 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 * SUCH DAMAGE. * + * This file is part of the Contiki operating system. + * */ /** diff --git a/core/net/mac/contikimac/contikimac-framer.h b/core/net/mac/contikimac/contikimac-framer.h index 5bc84f67f..ea9429997 100644 --- a/core/net/mac/contikimac/contikimac-framer.h +++ b/core/net/mac/contikimac/contikimac-framer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Fraunhofer Heinrich-Hertz-Institut. + * Copyright (c) 2010, Swedish Institute of Computer Science. * All rights reserved. * * 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 * SUCH DAMAGE. * + * This file is part of the Contiki operating system. + * */ /** From 7b63217a326d7a606ca552309b39c2c0dbea3079 Mon Sep 17 00:00:00 2001 From: kkrentz Date: Tue, 18 Nov 2014 00:42:39 -0800 Subject: [PATCH 3/3] ContikiMAC: Default to contikimac_framer when using Rime over ContikiMAC --- platform/avr-atmega128rfa1/contiki-conf.h | 8 +++++++- platform/avr-raven/contiki-conf.h | 8 +++++++- platform/avr-ravenusb/contiki-conf.h | 8 +++++++- platform/cc2538dk/contiki-conf.h | 6 +++++- platform/exp5438/contiki-conf.h | 4 ++++ platform/sky/contiki-conf.h | 4 ++++ platform/z1/contiki-conf.h | 2 +- 7 files changed, 35 insertions(+), 5 deletions(-) diff --git a/platform/avr-atmega128rfa1/contiki-conf.h b/platform/avr-atmega128rfa1/contiki-conf.h index bb08df5a3..6240232d9 100644 --- a/platform/avr-atmega128rfa1/contiki-conf.h +++ b/platform/avr-atmega128rfa1/contiki-conf.h @@ -243,7 +243,13 @@ typedef unsigned short uip_stats_t; #define WITH_PHASE_OPTIMIZATION 0 #define CONTIKIMAC_CONF_COMPOWER 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 CHANNEL_802_15_4 26 /* The radio needs to interrupt during an rtimer interrupt */ diff --git a/platform/avr-raven/contiki-conf.h b/platform/avr-raven/contiki-conf.h index c6ef38eba..e921b9046 100644 --- a/platform/avr-raven/contiki-conf.h +++ b/platform/avr-raven/contiki-conf.h @@ -259,7 +259,13 @@ typedef unsigned short uip_stats_t; #define WITH_PHASE_OPTIMIZATION 0 #define CONTIKIMAC_CONF_COMPOWER 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 CHANNEL_802_15_4 26 /* The radio needs to interrupt during an rtimer interrupt */ diff --git a/platform/avr-ravenusb/contiki-conf.h b/platform/avr-ravenusb/contiki-conf.h index 9669becc9..9aae672d4 100644 --- a/platform/avr-ravenusb/contiki-conf.h +++ b/platform/avr-ravenusb/contiki-conf.h @@ -312,7 +312,13 @@ typedef unsigned short uip_stats_t; #define NETSTACK_CONF_MAC nullmac_driver //#define NETSTACK_CONF_MAC csma_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 CHANNEL_802_15_4 26 /* Enable extended mode with autoack, but no csma/autoretry */ diff --git a/platform/cc2538dk/contiki-conf.h b/platform/cc2538dk/contiki-conf.h index 141a62ce2..b4ace7aa3 100644 --- a/platform/cc2538dk/contiki-conf.h +++ b/platform/cc2538dk/contiki-conf.h @@ -316,8 +316,12 @@ typedef uint32_t rtimer_clock_t; #endif #ifndef NETSTACK_CONF_FRAMER +#if UIP_CONF_IPV6 #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 /** @} */ diff --git a/platform/exp5438/contiki-conf.h b/platform/exp5438/contiki-conf.h index 29901103a..b59a65c4d 100644 --- a/platform/exp5438/contiki-conf.h +++ b/platform/exp5438/contiki-conf.h @@ -26,7 +26,11 @@ #endif /* NETSTACK_CONF_RADIO */ #ifndef NETSTACK_CONF_FRAMER +#if WITH_UIP6 #define NETSTACK_CONF_FRAMER framer_802154 +#else /* WITH_UIP6 */ +#define NETSTACK_CONF_FRAMER contikimac_framer +#endif /* WITH_UIP6 */ #endif /* NETSTACK_CONF_FRAMER */ #ifndef CC2420_CONF_AUTOACK diff --git a/platform/sky/contiki-conf.h b/platform/sky/contiki-conf.h index c99645898..00aace08a 100644 --- a/platform/sky/contiki-conf.h +++ b/platform/sky/contiki-conf.h @@ -26,7 +26,11 @@ #endif /* NETSTACK_CONF_RADIO */ #ifndef NETSTACK_CONF_FRAMER +#if WITH_UIP6 #define NETSTACK_CONF_FRAMER framer_802154 +#else /* WITH_UIP6 */ +#define NETSTACK_CONF_FRAMER contikimac_framer +#endif /* WITH_UIP6 */ #endif /* NETSTACK_CONF_FRAMER */ #ifndef CC2420_CONF_AUTOACK diff --git a/platform/z1/contiki-conf.h b/platform/z1/contiki-conf.h index 4445b53f5..129c124b0 100644 --- a/platform/z1/contiki-conf.h +++ b/platform/z1/contiki-conf.h @@ -69,7 +69,7 @@ #define NETSTACK_CONF_MAC csma_driver #define NETSTACK_CONF_RDC contikimac_driver #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