From a89df3b27961b89a86de9364e06532f0e7b99b41 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 12 Oct 2017 12:22:39 +0200 Subject: [PATCH] TSCH-RPL: configure callbacks automatically --- .../6tisch/etsi-plugtest-2017/project-conf.h | 15 --------------- examples/ipv6/rpl-simple/project-conf.h | 16 ---------------- examples/ipv6/rpl-tsch-sixtop/project-conf.h | 6 ------ examples/ipv6/rpl-tsch/project-conf.h | 7 ------- .../platform-specific/jn516x/rpl/common-conf.h | 7 ------- .../platform-specific/jn516x/tsch/common-conf.h | 3 --- os/net/mac/tsch/tsch.h | 17 +++++++++++++++++ os/net/rpl-classic/rpl-private.h | 12 ++++++++++++ os/net/rpl-lite/rpl-conf.h | 13 +++++++++++++ 9 files changed, 42 insertions(+), 54 deletions(-) diff --git a/examples/6tisch/etsi-plugtest-2017/project-conf.h b/examples/6tisch/etsi-plugtest-2017/project-conf.h index 894a49aba..97fd591f8 100644 --- a/examples/6tisch/etsi-plugtest-2017/project-conf.h +++ b/examples/6tisch/etsi-plugtest-2017/project-conf.h @@ -43,21 +43,6 @@ #define WITH_SECURITY 0 #endif /* WITH_SECURITY */ -/*******************************************************/ -/********************* Enable TSCH *********************/ -/*******************************************************/ - -/* TSCH and RPL callbacks */ -#define RPL_CALLBACK_PARENT_SWITCH tsch_rpl_callback_parent_switch -#define RPL_CALLBACK_NEW_DIO_INTERVAL tsch_rpl_callback_new_dio_interval -#define TSCH_CALLBACK_KA_SENT tsch_rpl_callback_ka_sent -#define TSCH_CALLBACK_JOINING_NETWORK tsch_rpl_callback_joining_network -#define TSCH_CALLBACK_LEAVING_NETWORK tsch_rpl_callback_leaving_network - -/*******************************************************/ -/******************* Configure TSCH ********************/ -/*******************************************************/ - /* IEEE802.15.4 PANID */ #define IEEE802154_CONF_PANID 0x81a5 diff --git a/examples/ipv6/rpl-simple/project-conf.h b/examples/ipv6/rpl-simple/project-conf.h index 3d60588bc..2a8b376f4 100644 --- a/examples/ipv6/rpl-simple/project-conf.h +++ b/examples/ipv6/rpl-simple/project-conf.h @@ -40,22 +40,6 @@ /* Save some space */ #define SICSLOWPAN_CONF_FRAG 0 -#if MAC_CONF_WITH_TSCH -/*******************************************************/ -/********************* Configure TSCH *********************/ -/*******************************************************/ - -/* TSCH and RPL callbacks */ -#define RPL_CALLBACK_PARENT_SWITCH tsch_rpl_callback_parent_switch -#define RPL_CALLBACK_NEW_DIO_INTERVAL tsch_rpl_callback_new_dio_interval -#define TSCH_CALLBACK_JOINING_NETWORK tsch_rpl_callback_joining_network -#define TSCH_CALLBACK_LEAVING_NETWORK tsch_rpl_callback_leaving_network - -/*******************************************************/ -/******************* Configure TSCH ********************/ -/*******************************************************/ -#endif /* MAC_CONF_WITH_TSCH */ - /* Do not start TSCH at init, wait for NETSTACK_MAC.on() */ #define TSCH_CONF_AUTOSTART 0 diff --git a/examples/ipv6/rpl-tsch-sixtop/project-conf.h b/examples/ipv6/rpl-tsch-sixtop/project-conf.h index 11c9b16e7..52370676b 100755 --- a/examples/ipv6/rpl-tsch-sixtop/project-conf.h +++ b/examples/ipv6/rpl-tsch-sixtop/project-conf.h @@ -47,12 +47,6 @@ /********************* Enable TSCH *********************/ /*******************************************************/ -/* TSCH and RPL callbacks */ -#define RPL_CALLBACK_PARENT_SWITCH tsch_rpl_callback_parent_switch -#define RPL_CALLBACK_NEW_DIO_INTERVAL tsch_rpl_callback_new_dio_interval -#define TSCH_CALLBACK_JOINING_NETWORK tsch_rpl_callback_joining_network -#define TSCH_CALLBACK_LEAVING_NETWORK tsch_rpl_callback_leaving_network - /* Needed for CC2538 platforms only */ /* For TSCH we have to use the more accurate crystal oscillator * by default the RC oscillator is activated */ diff --git a/examples/ipv6/rpl-tsch/project-conf.h b/examples/ipv6/rpl-tsch/project-conf.h index f3becfc5c..e0803481d 100644 --- a/examples/ipv6/rpl-tsch/project-conf.h +++ b/examples/ipv6/rpl-tsch/project-conf.h @@ -59,13 +59,6 @@ /********************* Configure TSCH *********************/ /*******************************************************/ -/* TSCH and RPL callbacks */ -#define RPL_CALLBACK_PARENT_SWITCH tsch_rpl_callback_parent_switch -#define RPL_CALLBACK_NEW_DIO_INTERVAL tsch_rpl_callback_new_dio_interval -#define TSCH_CALLBACK_KA_SENT tsch_rpl_callback_ka_sent -#define TSCH_CALLBACK_JOINING_NETWORK tsch_rpl_callback_joining_network -#define TSCH_CALLBACK_LEAVING_NETWORK tsch_rpl_callback_leaving_network - #if WITH_SHELL /* Needed for CC2538 platforms, for serial */ #define USB_SERIAL_CONF_ENABLE 1 diff --git a/examples/platform-specific/jn516x/rpl/common-conf.h b/examples/platform-specific/jn516x/rpl/common-conf.h index 97bc5fd37..d82be3963 100644 --- a/examples/platform-specific/jn516x/rpl/common-conf.h +++ b/examples/platform-specific/jn516x/rpl/common-conf.h @@ -53,13 +53,6 @@ #define WITH_SECURITY 0 #endif /* WITH_SECURITY */ -/* TSCH and RPL callbacks */ -#define RPL_CALLBACK_PARENT_SWITCH tsch_rpl_callback_parent_switch -#define RPL_CALLBACK_NEW_DIO_INTERVAL tsch_rpl_callback_new_dio_interval -#define TSCH_CALLBACK_KA_SENT tsch_rpl_callback_ka_sent -#define TSCH_CALLBACK_JOINING_NETWORK tsch_rpl_callback_joining_network -#define TSCH_CALLBACK_LEAVING_NETWORK tsch_rpl_callback_leaving_network - /* Do not start TSCH at init, wait for NETSTACK_MAC.on() */ #define TSCH_CONF_AUTOSTART 0 diff --git a/examples/platform-specific/jn516x/tsch/common-conf.h b/examples/platform-specific/jn516x/tsch/common-conf.h index 325bc2536..232c9f404 100644 --- a/examples/platform-specific/jn516x/tsch/common-conf.h +++ b/examples/platform-specific/jn516x/tsch/common-conf.h @@ -50,9 +50,6 @@ #define TSCH_CONF_AUTOSTART 0 -#define RPL_CALLBACK_PARENT_SWITCH tsch_rpl_callback_parent_switch -#define RPL_CALLBACK_NEW_DIO_INTERVAL tsch_rpl_callback_new_dio_interval - /* RPL Trickle timer tuning */ #define RPL_CONF_DIO_INTERVAL_MIN 12 /* 4.096 s */ diff --git a/os/net/mac/tsch/tsch.h b/os/net/mac/tsch/tsch.h index c93d2d460..dfb38b537 100644 --- a/os/net/mac/tsch/tsch.h +++ b/os/net/mac/tsch/tsch.h @@ -163,6 +163,23 @@ frequency hopping for enhanced reliability. /*********** Callbacks *********/ +/* Link callbacks to RPL in case RPL is enabled */ +#if UIP_CONF_IPV6_RPL + +#ifndef TSCH_CALLBACK_JOINING_NETWORK +#define TSCH_CALLBACK_JOINING_NETWORK tsch_rpl_callback_joining_network +#endif /* TSCH_CALLBACK_JOINING_NETWORK */ + +#ifndef TSCH_CALLBACK_LEAVING_NETWORK +#define TSCH_CALLBACK_LEAVING_NETWORK tsch_rpl_callback_leaving_network +#endif /* TSCH_CALLBACK_LEAVING_NETWORK */ + +#ifndef TSCH_CALLBACK_KA_SENT +#define TSCH_CALLBACK_KA_SENT tsch_rpl_callback_ka_sent +#endif /* TSCH_CALLBACK_KA_SENT */ + +#endif /* UIP_CONF_IPV6_RPL */ + /* Called by TSCH when joining a network */ #ifdef TSCH_CALLBACK_JOINING_NETWORK void TSCH_CALLBACK_JOINING_NETWORK(); diff --git a/os/net/rpl-classic/rpl-private.h b/os/net/rpl-classic/rpl-private.h index 73de3104c..f00734821 100644 --- a/os/net/rpl-classic/rpl-private.h +++ b/os/net/rpl-classic/rpl-private.h @@ -271,6 +271,18 @@ typedef struct rpl_stats rpl_stats_t; extern rpl_stats_t rpl_stats; #endif +/* RPL callbacks when TSCH is enabled */ +#if MAC_CONF_WITH_TSCH + +#ifndef RPL_CALLBACK_PARENT_SWITCH +#define RPL_CALLBACK_PARENT_SWITCH tsch_rpl_callback_parent_switch +#endif /* RPL_CALLBACK_PARENT_SWITCH */ + +#ifndef RPL_CALLBACK_NEW_DIO_INTERVAL +#define RPL_CALLBACK_NEW_DIO_INTERVAL tsch_rpl_callback_new_dio_interval +#endif /* RPL_CALLBACK_NEW_DIO_INTERVAL */ + +#endif /* MAC_CONF_WITH_TSCH */ /*---------------------------------------------------------------------------*/ /* RPL macros. */ diff --git a/os/net/rpl-lite/rpl-conf.h b/os/net/rpl-lite/rpl-conf.h index ed69b86d6..6ada97f0b 100644 --- a/os/net/rpl-lite/rpl-conf.h +++ b/os/net/rpl-lite/rpl-conf.h @@ -382,6 +382,19 @@ #define RPL_PREFERENCE 0 #endif +/* RPL callbacks when TSCH is enabled */ +#if MAC_CONF_WITH_TSCH + +#ifndef RPL_CALLBACK_PARENT_SWITCH +#define RPL_CALLBACK_PARENT_SWITCH tsch_rpl_callback_parent_switch +#endif /* RPL_CALLBACK_PARENT_SWITCH */ + +#ifndef RPL_CALLBACK_NEW_DIO_INTERVAL +#define RPL_CALLBACK_NEW_DIO_INTERVAL tsch_rpl_callback_new_dio_interval +#endif /* RPL_CALLBACK_NEW_DIO_INTERVAL */ + +#endif /* MAC_CONF_WITH_TSCH */ + /** @} */ #endif /* RPL_CONF_H */