From 8ac4f3332dc5834422401a6dbd3da615bd5ef601 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Mon, 3 Feb 2014 15:58:18 +0100 Subject: [PATCH] core cpu: add defaulttransceiver pseudomodule update examples/default --- Makefile.modules | 7 ++++++- boards/avsextrem/Makefile.include | 13 +++++++++++++ boards/chronos/Makefile.dep | 8 ++++++++ boards/chronos/Makefile.include | 2 ++ boards/msb-430h/Makefile.dep | 9 +++++++++ boards/msba2/Makefile.include | 9 +++++++++ boards/native/Makefile.dep | 8 ++++++++ boards/native/Makefile.include | 2 ++ boards/pttu/Makefile.include | 10 ++++++++++ boards/redbee-econotag/Makefile.include | 10 ++++++++++ boards/telosb/Makefile.include | 9 +++++++++ boards/wsn430-v1_3b/Makefile.dep | 9 +++++++++ boards/wsn430-v1_4/Makefile.dep | 9 +++++++++ examples/default/Makefile | 15 ++------------- examples/default/main.c | 20 +------------------- sys/include/transceiver.h | 25 +++++++++++++++++++++++++ 16 files changed, 132 insertions(+), 33 deletions(-) create mode 100644 boards/chronos/Makefile.dep create mode 100644 boards/native/Makefile.dep diff --git a/Makefile.modules b/Makefile.modules index 89418ecb3a..a61df5f6bc 100644 --- a/Makefile.modules +++ b/Makefile.modules @@ -6,7 +6,12 @@ INCLUDES += -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBAS ED = $(USEMODULE:%=-DMODULE_%) ED += $(USEPKG:%=-DMODULE_%) EXTDEFINES = $(shell echo $(ED)|tr 'a-z' 'A-Z') -export BASELIBS = $(USEMODULE:%= $(BINDIR)%.a) +BL=$(USEMODULE:%= $(BINDIR)%.a) + +# Exclude defaulttransceiver, it is only a pseudomodule that adds other +# modules depending on the current board. +export BASELIBS = $(shell echo $(BL)|sed \ + -e 's/[^ ]*defaulttransceiver.a//') CFLAGS += $(EXTDEFINES) diff --git a/boards/avsextrem/Makefile.include b/boards/avsextrem/Makefile.include index ae4227e388..28df46718f 100644 --- a/boards/avsextrem/Makefile.include +++ b/boards/avsextrem/Makefile.include @@ -1,3 +1,16 @@ export INCLUDES += -I$(RIOTBOARD)/avsextrem/include +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc110x,$(USEMODULE))) + USEMODULE += cc110x + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif + +ifneq (,$(filter cc110x,$(USEMODULE))) + INCLUDES += -I$(RIOTBASE)/sys/net/include +endif + include $(RIOTBOARD)/msba2-common/Makefile.include diff --git a/boards/chronos/Makefile.dep b/boards/chronos/Makefile.dep new file mode 100644 index 0000000000..5fdf00ff8b --- /dev/null +++ b/boards/chronos/Makefile.dep @@ -0,0 +1,8 @@ +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc110x_ng,$(USEMODULE))) + USEMODULE += cc110x_ng + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif diff --git a/boards/chronos/Makefile.include b/boards/chronos/Makefile.include index 5dfe7e4607..3125887563 100644 --- a/boards/chronos/Makefile.include +++ b/boards/chronos/Makefile.include @@ -20,3 +20,5 @@ export HEXFILE = $(BINDIR)$(PROJECT).hex export USEMODULE += msp430_common export FFLAGS = rf2500 "prog $(HEXFILE)" export OFLAGS = -O ihex + +include $(RIOTBOARD)/$(BOARD)/Makefile.dep diff --git a/boards/msb-430h/Makefile.dep b/boards/msb-430h/Makefile.dep index a4578de2ab..c20de5e788 100644 --- a/boards/msb-430h/Makefile.dep +++ b/boards/msb-430h/Makefile.dep @@ -1,3 +1,12 @@ +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc110x_ng,$(USEMODULE))) + USEMODULE += cc110x_ng + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif + ifneq (,$(filter cc110x_ng,$(USEMODULE))) ifeq (,$(filter cc110x_spi,$(USEMODULE))) USEMODULE += cc110x_spi diff --git a/boards/msba2/Makefile.include b/boards/msba2/Makefile.include index 214f4602c3..750e92254f 100644 --- a/boards/msba2/Makefile.include +++ b/boards/msba2/Makefile.include @@ -1,3 +1,12 @@ export INCLUDES += -I$(RIOTBOARD)/msba2/include +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc110x_ng,$(USEMODULE))) + USEMODULE += cc110x_ng + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif + include $(RIOTBOARD)/msba2-common/Makefile.include diff --git a/boards/native/Makefile.dep b/boards/native/Makefile.dep new file mode 100644 index 0000000000..444440b754 --- /dev/null +++ b/boards/native/Makefile.dep @@ -0,0 +1,8 @@ +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter nativenet,$(USEMODULE))) + USEMODULE += nativenet + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif diff --git a/boards/native/Makefile.include b/boards/native/Makefile.include index 753b118b24..18e234acca 100644 --- a/boards/native/Makefile.include +++ b/boards/native/Makefile.include @@ -1,3 +1,5 @@ +include $(RIOTBOARD)/$(BOARD)/Makefile.dep + export NATIVEINCLUDES = -I$(RIOTBOARD)/$(BOARD)/include/ export NATIVEINCLUDES += -I$(RIOTBASE)/core/include/ export NATIVEINCLUDES += -I$(RIOTBASE)/drivers/include/ diff --git a/boards/pttu/Makefile.include b/boards/pttu/Makefile.include index cb34c2c317..289e0e92a1 100644 --- a/boards/pttu/Makefile.include +++ b/boards/pttu/Makefile.include @@ -1,3 +1,13 @@ export INCLUDES += -I$(RIOTBOARD)/pttu/include +# Enable this after fixing https://github.com/RIOT-OS/RIOT/issues/659 +#ifneq (,$(filter defaulttransceiver,$(USEMODULE))) +# ifeq (,$(filter cc110x,$(USEMODULE))) +# USEMODULE += cc110x +# endif +# ifeq (,$(filter transceiver,$(USEMODULE))) +# USEMODULE += transceiver +# endif +#endif + include $(RIOTBOARD)/msba2-common/Makefile.include diff --git a/boards/redbee-econotag/Makefile.include b/boards/redbee-econotag/Makefile.include index a94a9e1b36..687457634b 100644 --- a/boards/redbee-econotag/Makefile.include +++ b/boards/redbee-econotag/Makefile.include @@ -29,3 +29,13 @@ export FFLAGS = -t $(PORT) -f $(HEXFILE) -c 'bbmc -l redbee-econotag reset' export OFLAGS = -O binary --gap-fill=0xff export INCLUDES += -I$(RIOTCPU)/$(CPU)/include/ -I$(RIOTBOARD)/$(BOARD)/include + +# un-comment once https://github.com/RIOT-OS/RIOT/issues/676 is fixed +#ifneq (,$(filter defaulttransceiver,$(USEMODULE))) +# ifeq (,$(filter mc1322x,$(USEMODULE))) +# USEMODULE += mc1322x +# endif +# ifeq (,$(filter transceiver,$(USEMODULE))) +# USEMODULE += transceiver +# endif +#endif diff --git a/boards/telosb/Makefile.include b/boards/telosb/Makefile.include index 219cced126..8a86c618f5 100644 --- a/boards/telosb/Makefile.include +++ b/boards/telosb/Makefile.include @@ -24,3 +24,12 @@ export FFLAGS = --telosb -c $(PORT) -r -e -I -p $(HEXFILE) export INCLUDES += -I$(RIOTCPU)/msp430-common/include -I$(RIOTBOARD)/$(BOARD)/include -I$(RIOTBASE)/drivers/cc2420/include -I$(RIOTBASE)/sys/net/include export OFLAGS = -O ihex + +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc2240,$(USEMODULE))) + USEMODULE += cc2420 + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif diff --git a/boards/wsn430-v1_3b/Makefile.dep b/boards/wsn430-v1_3b/Makefile.dep index ef9279fd5e..ec40a19435 100644 --- a/boards/wsn430-v1_3b/Makefile.dep +++ b/boards/wsn430-v1_3b/Makefile.dep @@ -1,3 +1,12 @@ +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc110x_ng,$(USEMODULE))) + USEMODULE += cc110x_ng + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif + ifneq (,$(filter cc110x_ng,$(USEMODULE))) ifeq (,$(filter cc110x_spi,$(USEMODULE))) USEMODULE += cc110x_spi diff --git a/boards/wsn430-v1_4/Makefile.dep b/boards/wsn430-v1_4/Makefile.dep index 4e36d0ff56..b2a12a0e67 100644 --- a/boards/wsn430-v1_4/Makefile.dep +++ b/boards/wsn430-v1_4/Makefile.dep @@ -1 +1,10 @@ USEMODULE += msp430_common + +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc2420,$(USEMODULE))) + USEMODULE += cc2420 + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif diff --git a/examples/default/Makefile b/examples/default/Makefile index 2070303e64..55f92b0c61 100644 --- a/examples/default/Makefile +++ b/examples/default/Makefile @@ -35,33 +35,22 @@ USEMODULE += shell_commands USEMODULE += ps USEMODULE += vtimer USEMODULE += auto_init +USEMODULE += defaulttransceiver + ifneq (,$(filter msb-430,$(BOARD))) USEMODULE += sht11 endif -ifneq (,$(filter msb-430h,$(BOARD))) - USEMODULE += sht11 - USEMODULE += cc110x_ng -endif -ifneq (,$(filter chronos,$(BOARD))) - USEMODULE += cc110x_ng -endif -ifneq (,$(filter wsn430-v1_3b,$(BOARD))) - USEMODULE += cc110x_ng -endif ifneq (,$(filter msba2,$(BOARD))) USEMODULE += sht11 USEMODULE += ltc4150 USEMODULE += rtc USEMODULE += mci - USEMODULE += cc110x_ng USEMODULE += config USEMODULE += random endif ifneq (,$(filter native,$(BOARD))) USEMODULE += ltc4150 USEMODULE += rtc - USEMODULE += nativenet - USEMODULE += transceiver USEMODULE += config USEMODULE += random endif diff --git a/examples/default/main.c b/examples/default/main.c index 0d8e5a23fe..a291896c77 100644 --- a/examples/default/main.c +++ b/examples/default/main.c @@ -94,25 +94,7 @@ void init_transceiver(void) radio, "radio"); - uint16_t transceivers = 0; -#ifdef MODULE_CC110X - transceivers |= TRANSCEIVER_CC1100; -#endif -#ifdef MODULE_CC110X_NG - transceivers |= TRANSCEIVER_CC1100; -#endif -#ifdef MODULE_CC2420 - transceivers |= TRANSCEIVER_CC2420; -#endif -#ifdef MODULE_NATIVENET - transceivers |= TRANSCEIVER_NATIVE; -#endif -#ifdef MODULE_AT86RF231 - transceivers |= TRANSCEIVER_AT86RF231; -#endif -#ifdef MODULE_MC1322X - transceivers |= TRANSCEIVER_MC1322X; -#endif + uint16_t transceivers = TRANSCEIVER_DEFAULT; transceiver_init(transceivers); (void) transceiver_start(); diff --git a/sys/include/transceiver.h b/sys/include/transceiver.h index 79553216fd..437e72c962 100644 --- a/sys/include/transceiver.h +++ b/sys/include/transceiver.h @@ -15,29 +15,54 @@ * https://github.com/RIOT-OS/RIOT/issues/117 */ #ifdef MODULE_CC110X #include "cc110x.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_CC1100 +#endif #endif #ifdef MODULE_CC110X_NG #include "cc110x_ng.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_CC1100 +#endif +#endif + +#ifdef MODULE_CC11020 +#include "cc1020.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_CC1020 +#endif #endif #ifdef MODULE_CC2420 #include "cc2420.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_CC2420 +#endif #endif #ifdef MODULE_MC1322X #include "mc1322x.h" #include "maca.h" #include "maca_packet.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_MC1322X +#endif #endif #ifdef MODULE_NATIVENET #include "nativenet.h" #include "nativenet_internal.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_NATIVE +#endif #endif #ifdef MODULE_AT86RF231 #include "at86rf231.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_AT86RF231 +#endif #endif /* Stack size for transceiver thread */