Use global MAC_CONF_WITH_TSCH instead of ad-hoc WITH_TSCH flags

This commit is contained in:
Simon Duquennoy 2017-09-08 18:00:15 +02:00
parent 13f014f882
commit 5f2b3c2fcb
7 changed files with 12 additions and 20 deletions

View File

@ -3,12 +3,8 @@ CONTIKI=../../..
CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\"
WITH_TSCH ?= 0
ifeq ($(WITH_TSCH),1)
MAKE_MAC = MAKE_MAC_TSCH
endif
CFLAGS += -DWITH_TSCH=$(WITH_TSCH)
# Set MAKE_MAC = MAKE_MAC_TSCH to run TSCH instead
MAKE_MAC = MAKE_MAC_CSMA
CONTIKI_WITH_IPV6 = 1
CONTIKI_WITH_RPL_LITE = 1

View File

@ -148,9 +148,9 @@ PROCESS_THREAD(node_process, ev, data)
etimer_set(&periodic, START_INTERVAL);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic));
#if WITH_TSCH
#if MAC_CONF_WITH_TSCH
NETSTACK_MAC.on();
#endif /* WITH_TSCH */
#endif /* MAC_CONF_WITH_TSCH */
if(!uip_ip6addr_cmp(&destination_ipaddr, &node_ipaddr)) {
/* Send data periodically */

View File

@ -46,7 +46,7 @@
#undef SICSLOWPAN_CONF_FRAG
#define SICSLOWPAN_CONF_FRAG 0
#if WITH_TSCH
#if MAC_CONF_WITH_TSCH
/*******************************************************/
/********************* Configure TSCH *********************/
@ -87,6 +87,6 @@
#undef TSCH_SCHEDULE_CONF_MAX_LINKS
#define TSCH_SCHEDULE_CONF_MAX_LINKS 4
#endif /* WITH_TSCH */
#endif /* MAC_CONF_WITH_TSCH */
#endif

View File

@ -36,7 +36,6 @@
/* Global config flags */
#define WITH_TSCH 1
#define WITH_TSCH_SECURITY 0
#define TSCH_LOG_CONF_PER_SLOT 1
#define WITH_COAP_RESOURCES 0
@ -129,7 +128,7 @@
#define TSCH_CONF_JOIN_SECURED_ONLY 0
#endif /* WITH_TSCH_SECURITY */
#if !WITH_TSCH /* No TSCH, use Csma with ACK (default MAC) */
#if MAC_CONF_WITH_CSMA /* Configure Csma with ACK (default MAC) */
#undef MICROMAC_CONF_CHANNEL
#define MICROMAC_CONF_CHANNEL 26
@ -141,7 +140,7 @@
#undef MIRCOMAC_CONF_BUF_NUM
#define MIRCOMAC_CONF_BUF_NUM 4
#endif
#endif /* MAC_CONF_WITH_CSMA */
#undef CONTIKI_VERSION_STRING
#define CONTIKI_VERSION_STRING "Contiki 3.x"

View File

@ -167,9 +167,9 @@ PROCESS_THREAD(node_process, ev, data)
printf("Init: node starting with role %s\n",
node_role == role_6ln ? "6ln" : (node_role == role_6dr) ? "6dr" : "6dr-sec");
#if WITH_TSCH
#if MAC_CONF_WITH_TSCH
tsch_set_pan_secured(LLSEC802154_ENABLED && (node_role == role_6dr_sec));
#endif /* WITH_TSCH */
#endif /* MAC_CONF_WITH_TSCH */
is_coordinator = node_role > role_6ln;
if(is_coordinator) {

View File

@ -4,11 +4,8 @@ MAKE_MAC = MAKE_MAC_TSCH
MODULES += os/services/unit-test
CFLAGS += -D PROJECT_CONF_H=\"project-conf.h\"
WITH_TSCH ?= 0
TEST_CONFIG_TYPE ?= DEFAULT
CFLAGS += -D WITH_TSCH=1
ifeq ($(TEST_CONFIG_TYPE), SECURITY_ON)
CFLAGS += -D WITH_SECURITY_ON=1
endif

View File

@ -34,8 +34,8 @@
#define UNIT_TEST_PRINT_FUNCTION test_print_report
#if WITH_TSCH
#if MAC_CONF_WITH_TSCH
#include "project-tsch-conf.h"
#endif
#endif /* MAC_CONF_WITH_TSCH */
#endif /* !_PROJECT_CONF_H_ */