diff --git a/cpu/cc2538/Makefile.dep b/cpu/cc2538/Makefile.dep index d8489f01b06e..41e6d4edfc3b 100644 --- a/cpu/cc2538/Makefile.dep +++ b/cpu/cc2538/Makefile.dep @@ -1,6 +1,7 @@ ifneq (,$(filter cc2538_rf,$(USEMODULE))) - USEMODULE += netdev_ieee802154 - ifeq (,$(filter netdev_ieee802154_legacy,$(USEMODULE))) + ifneq (,$(filter cc2538_rf_netdev_legacy,$(USEMODULE))) + USEMODULE += netdev_ieee802154 + else ifneq (,$(filter netdev,$(USEMODULE))) USEMODULE += netdev_ieee802154_submac endif endif diff --git a/cpu/cc2538/include/cc2538_rf.h b/cpu/cc2538/include/cc2538_rf.h index fc27bf96f8e2..a30c44f1c4b2 100644 --- a/cpu/cc2538/include/cc2538_rf.h +++ b/cpu/cc2538/include/cc2538_rf.h @@ -29,7 +29,7 @@ #include "net/ieee802154.h" #include "kernel_defines.h" -#if IS_USED(MODULE_IEEE802154_RADIO_HAL) +#if !IS_USED(MODULE_CC2538_RF_NETDEV_LEGACY) #include "net/ieee802154/radio.h" #if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC) #include "net/netdev/ieee802154_submac.h" @@ -292,7 +292,7 @@ enum { typedef struct { #if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC) netdev_ieee802154_submac_t netdev; /**< netdev parent struct */ -#elif !IS_USED(MODULE_IEEE802154_RADIO_HAL) +#elif IS_USED(MODULE_CC2538_RF_NETDEV_LEGACY) netdev_ieee802154_t netdev; /**< netdev parent struct */ #endif uint8_t state; /**< current state of the radio */ diff --git a/cpu/cc2538/radio/Makefile b/cpu/cc2538/radio/Makefile index cafd539d3402..9bfe55433d21 100644 --- a/cpu/cc2538/radio/Makefile +++ b/cpu/cc2538/radio/Makefile @@ -6,10 +6,11 @@ SRC = \ cc2538_rf_internal.c \ # -ifneq (,$(filter ieee802154_radio_hal,$(USEMODULE))) - SRC += cc2538_rf_radio_ops.c -else +# use netdev implementation when legacy is explicitly enabled +ifneq (,$(filter cc2538_rf_netdev_legacy,$(USEMODULE))) SRC += cc2538_rf_netdev.c +else + SRC += cc2538_rf_radio_ops.c endif include $(RIOTBASE)/Makefile.base diff --git a/cpu/cc2538/radio/cc2538_rf.c b/cpu/cc2538/radio/cc2538_rf.c index 899f092f7cf1..076d238dcd22 100644 --- a/cpu/cc2538/radio/cc2538_rf.c +++ b/cpu/cc2538/radio/cc2538_rf.c @@ -136,7 +136,7 @@ void cc2538_init(void) RFCORE_XREG_FIFOPCTRL = CC2538_RF_MAX_DATA_LEN; /* Set default IRQ */ - if (IS_USED(MODULE_IEEE802154_RADIO_HAL)) { + if (!IS_USED(MODULE_CC2538_RF_NETDEV_LEGACY)) { RFCORE_XREG_RFIRQM1 = TXDONE | CSP_STOP | TXACKDONE; RFCORE_XREG_RFIRQM0 = RXPKTDONE | FIFOP | SFD; } else { @@ -212,7 +212,7 @@ bool cc2538_on(void) void cc2538_setup(cc2538_rf_t *dev) { -#if IS_USED(MODULE_IEEE802154_RADIO_HAL) +#if !IS_USED(MODULE_CC2538_RF_NETDEV_LEGACY) (void) dev; #if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC) extern ieee802154_dev_t cc2538_rf_dev; diff --git a/cpu/nrf52/Makefile.dep b/cpu/nrf52/Makefile.dep index 9dc5836063b1..b42cbfc6bc1f 100644 --- a/cpu/nrf52/Makefile.dep +++ b/cpu/nrf52/Makefile.dep @@ -4,8 +4,9 @@ ifneq (,$(filter nrf802154,$(USEMODULE))) FEATURES_REQUIRED += periph_timer FEATURES_REQUIRED += radio_nrf802154 USEMODULE += luid - USEMODULE += netdev_ieee802154 - ifeq (,$(filter netdev_ieee802154_legacy,$(USEMODULE))) + ifneq (,$(filter nrf802154_netdev_legacy,$(USEMODULE))) + USEMODULE += netdev_ieee802154 + else ifneq (,$(filter netdev,$(USEMODULE))) USEMODULE += netdev_ieee802154_submac endif endif diff --git a/cpu/nrf52/include/nrf802154.h b/cpu/nrf52/include/nrf802154.h index 33a9428bfb7c..aab8fab59e9e 100644 --- a/cpu/nrf52/include/nrf802154.h +++ b/cpu/nrf52/include/nrf802154.h @@ -36,7 +36,7 @@ #ifndef NRF802154_H #define NRF802154_H -#if IS_USED(MODULE_IEEE802154_RADIO_HAL) +#if !IS_USED(MODULE_NRF802154_NETDEV_LEGACY) #include "net/ieee802154/radio.h" #if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC) #include "net/netdev/ieee802154_submac.h" @@ -58,7 +58,7 @@ extern "C" { typedef struct { #if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC) netdev_ieee802154_submac_t netdev; /**< netdev SubMAC descriptor */ -#elif !IS_USED(MODULE_IEEE802154_RADIO_HAL) +#elif IS_USED(MODULE_NRF802154_NETDEV_LEGACY) netdev_ieee802154_t netdev; /**< ieee802154 device descriptor */ #endif } nrf802154_t; diff --git a/cpu/nrf52/radio/nrf802154/Makefile b/cpu/nrf52/radio/nrf802154/Makefile index b83537831a6a..5e95315e6425 100644 --- a/cpu/nrf52/radio/nrf802154/Makefile +++ b/cpu/nrf52/radio/nrf802154/Makefile @@ -1,9 +1,10 @@ MODULE = nrf802154 -ifneq (,$(filter ieee802154_radio_hal,$(USEMODULE))) - SRC += nrf802154_radio.c -else +# use netdev implementation when legacy is explicitly enabled +ifneq (,$(filter nrf802154_netdev_legacy,$(USEMODULE))) SRC += nrf802154.c +else + SRC += nrf802154_radio.c endif include $(RIOTBASE)/Makefile.base diff --git a/doc/doxygen/src/getting-started.md b/doc/doxygen/src/getting-started.md index 7fb91c7adff4..1077412eae86 100644 --- a/doc/doxygen/src/getting-started.md +++ b/doc/doxygen/src/getting-started.md @@ -153,6 +153,18 @@ For instructions on how to configure via `CFLAGS` check the @ref config "identified compile-time configurations". To learn how to use Kconfig in RIOT, please refer to the @ref kconfig-users-guide. +Default configurations {#default-configurations} +---------------------- +When devices have a common access interface, having a default configuration to +enable them across platforms, without having to explicitly specify which modules +to include, comes in handy. For this, two pseudomodules are defined: + +- `saul_default`: will enable all the drivers of sensors and actuators that are +present in the target platform. + +- `netdev_default`: will enable all the drivers of network devices +present in the target platform. + Use Docker to build RIOT {#docker} ======================== [Docker](https://www.docker.com/) is a platform that allows packaging software into containers that can easily be run on any Linux that has Docker installed. diff --git a/doc/doxygen/src/porting-boards.md b/doc/doxygen/src/porting-boards.md index f5d025348f89..69a9f90f9075 100644 --- a/doc/doxygen/src/porting-boards.md +++ b/doc/doxygen/src/porting-boards.md @@ -105,6 +105,29 @@ endif the dependency block for your board *before* its dependencies pull in their own dependencies. +#### Default configurations +As explained in @ref default-configurations "Default Configurations", there are +two pseudomodules that are used to indicate that certain drivers of devices +present in the platform should be enabled. Each board (or CPU) has knowledge as +to which drivers should be enabled in each case. + +The previous code snippet shows how a board which has a @ref drivers_sx127x +device, pulls in its driver when the default network interfaces are required. + +When the pseudomodule `saul_default` is enabled, the board should pull in all +the drivers of the devices it has which provide a @ref drivers_saul interface. This is +usually done as following: + +```mk +ifneq (,$(filter saul_default,$(USEMODULE))) + USEMODULE += saul_gpio + USEMODULE += apds9960 + USEMODULE += bmp280_i2c + USEMODULE += lis3mdl + USEMODULE += sht3x +endif +``` + ### Makefile.features {#makefile-features} This file defines all the features provided by the BOARD. These features diff --git a/drivers/Makefile.dep b/drivers/Makefile.dep index 65537ebd81d3..92e57c4494a2 100644 --- a/drivers/Makefile.dep +++ b/drivers/Makefile.dep @@ -197,7 +197,7 @@ ifneq (,$(filter periph_timer_periodic,$(USEMODULE))) FEATURES_REQUIRED += periph_timer endif -ifneq (,$(filter netdev_%,$(USEMODULE))) +ifneq (,$(filter-out netdev_default, $(filter netdev_%,$(USEMODULE)))) USEMODULE += netdev # Don't register netdevs if there is only a single one of them ifeq (,$(filter gnrc_netif_single,$(USEMODULE))) diff --git a/examples/gnrc_networking/Makefile b/examples/gnrc_networking/Makefile index bf7693130549..aa06541d76b4 100644 --- a/examples/gnrc_networking/Makefile +++ b/examples/gnrc_networking/Makefile @@ -37,9 +37,6 @@ USEMODULE += netstats_rpl # USEMODULE += sock_dns # include DNS client # USEMODULE += gnrc_ipv6_nib_dns # include RDNSS option handling -# Uncomment this to enable legacy support of netdev for IEEE 802.15.4 radios. -# USEMODULE += netdev_ieee802154_legacy - # Comment this out to disable code in RIOT that does safety checking # which is not needed in a production environment but helps in the # development process: diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index a4acda742a5c..7359f6086257 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -13,6 +13,7 @@ PSEUDOMODULES += can_pm PSEUDOMODULES += can_raw PSEUDOMODULES += ccn-lite-utils PSEUDOMODULES += cc2538_rf_obs_sig +PSEUDOMODULES += cc2538_rf_netdev_legacy PSEUDOMODULES += conn_can_isotp_multi PSEUDOMODULES += cord_ep_standalone PSEUDOMODULES += core_% @@ -67,7 +68,6 @@ PSEUDOMODULES += gnrc_sock_check_reuse PSEUDOMODULES += gnrc_txtsnd PSEUDOMODULES += heap_cmd PSEUDOMODULES += i2c_scan -PSEUDOMODULES += ieee802154_radio_hal PSEUDOMODULES += ieee802154_security PSEUDOMODULES += ieee802154_submac PSEUDOMODULES += ina3221_alerts @@ -105,6 +105,7 @@ PSEUDOMODULES += newlib PSEUDOMODULES += newlib_gnu_source PSEUDOMODULES += newlib_nano PSEUDOMODULES += nrf24l01p_ng_diagnostics +PSEUDOMODULES += nrf802154_netdev_legacy PSEUDOMODULES += openthread PSEUDOMODULES += picolibc PSEUDOMODULES += picolibc_stdout_buffered diff --git a/pkg/lwip/Makefile.dep b/pkg/lwip/Makefile.dep index 62d932f3b69e..2179cfbbc630 100644 --- a/pkg/lwip/Makefile.dep +++ b/pkg/lwip/Makefile.dep @@ -63,6 +63,7 @@ ifneq (,$(filter lwip_%,$(USEMODULE))) USEMODULE += lwip_contrib USEMODULE += lwip_core USEMODULE += lwip_netif + USEMODULE += netdev ifeq (,$(filter lwip_ipv4 lwip_ipv6,$(USEMODULE))) USEMODULE += lwip_ipv4 endif diff --git a/pkg/openthread/Makefile.dep b/pkg/openthread/Makefile.dep index bff5bf798cef..1ddb74aef203 100644 --- a/pkg/openthread/Makefile.dep +++ b/pkg/openthread/Makefile.dep @@ -1,12 +1,9 @@ USEMODULE += openthread_contrib +USEMODULE += netdev USEMODULE += openthread_contrib_netdev USEMODULE += l2util USEMODULE += xtimer USEMODULE += event -ifneq (,$(filter cc2538_rf nrf802154,$(USEMODULE))) - USEMODULE += netdev_ieee802154_submac -endif - FEATURES_REQUIRED += cpp diff --git a/pkg/openwsn/Makefile.dep b/pkg/openwsn/Makefile.dep index 2ed2db6eaeb7..12f55e540e01 100644 --- a/pkg/openwsn/Makefile.dep +++ b/pkg/openwsn/Makefile.dep @@ -49,7 +49,9 @@ ifneq (,$(filter openwsn_crypto,$(USEMODULE))) endif ifneq (,$(filter openwsn_radio,$(USEMODULE))) + # enable default network devices on the platform USEMODULE += netdev_default + USEMODULE += netdev USEMODULE += luid ifneq (,$(filter cc2538_rf nrf802154,$(USEMODULE))) USEMODULE += openwsn_radio_hal @@ -60,7 +62,6 @@ ifneq (,$(filter openwsn_radio,$(USEMODULE))) endif ifneq (,$(filter openwsn_radio_hal,$(USEMODULE))) - USEMODULE += ieee802154_radio_hal # Used here only for dependency resolution DISABLE_MODULE += auto_init_gnrc_netif endif diff --git a/sys/Makefile.dep b/sys/Makefile.dep index 22c395fba7a3..a937ede72334 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -142,12 +142,10 @@ ifneq (,$(filter sntp,$(USEMODULE))) USEMODULE += xtimer endif -ifneq (,$(filter ieee802154_radio_hal,$(USEMODULE))) - USEMODULE += ieee802154 -endif - ifneq (,$(filter gnrc_netdev_default,$(USEMODULE))) + # enable default network devices on the platform USEMODULE += netdev_default + USEMODULE += netdev USEMODULE += gnrc_netif endif @@ -157,7 +155,8 @@ ifneq (,$(filter netdev_ieee802154,$(USEMODULE))) endif ifneq (,$(filter netdev_ieee802154_submac,$(USEMODULE))) - USEMODULE += ieee802154_radio_hal + USEMODULE += netdev_ieee802154 + USEMODULE += ieee802154 USEMODULE += ieee802154_submac endif diff --git a/tests/ieee802154_hal/Makefile b/tests/ieee802154_hal/Makefile index a227353d6789..434bb3fe8b14 100644 --- a/tests/ieee802154_hal/Makefile +++ b/tests/ieee802154_hal/Makefile @@ -27,7 +27,6 @@ USEMODULE += ps USEMODULE += event_thread_highest USEMODULE += event_callback USEMODULE += xtimer -USEMODULE += ieee802154_radio_hal USEMODULE += netdev_default CFLAGS += -DEVENT_THREAD_HIGHEST_STACKSIZE=1024 diff --git a/tests/netstats_neighbor/Makefile b/tests/netstats_neighbor/Makefile index 9d9283b779ab..8b194abefc4b 100644 --- a/tests/netstats_neighbor/Makefile +++ b/tests/netstats_neighbor/Makefile @@ -1,4 +1,4 @@ -USEMODULE = netdev_default +USEMODULE = gnrc_netdev_default USEMODULE += netstats_neighbor_etx USEMODULE += netstats_neighbor_count