1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #15886 from leandrolanzieri/pr/netdev_remove_radio_hal_pseudomodule

drivers/netdev: cleanup dependencies and remove ieee802154_radio_hal pseudomodule
This commit is contained in:
Martine Lenders 2021-03-10 16:42:55 +01:00 committed by GitHub
commit 5521492a75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 67 additions and 33 deletions

View File

@ -1,6 +1,7 @@
ifneq (,$(filter cc2538_rf,$(USEMODULE))) ifneq (,$(filter cc2538_rf,$(USEMODULE)))
USEMODULE += netdev_ieee802154 ifneq (,$(filter cc2538_rf_netdev_legacy,$(USEMODULE)))
ifeq (,$(filter netdev_ieee802154_legacy,$(USEMODULE))) USEMODULE += netdev_ieee802154
else ifneq (,$(filter netdev,$(USEMODULE)))
USEMODULE += netdev_ieee802154_submac USEMODULE += netdev_ieee802154_submac
endif endif
endif endif

View File

@ -29,7 +29,7 @@
#include "net/ieee802154.h" #include "net/ieee802154.h"
#include "kernel_defines.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" #include "net/ieee802154/radio.h"
#if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC) #if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC)
#include "net/netdev/ieee802154_submac.h" #include "net/netdev/ieee802154_submac.h"
@ -292,7 +292,7 @@ enum {
typedef struct { typedef struct {
#if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC) #if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC)
netdev_ieee802154_submac_t netdev; /**< netdev parent struct */ 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 */ netdev_ieee802154_t netdev; /**< netdev parent struct */
#endif #endif
uint8_t state; /**< current state of the radio */ uint8_t state; /**< current state of the radio */

View File

@ -6,10 +6,11 @@ SRC = \
cc2538_rf_internal.c \ cc2538_rf_internal.c \
# #
ifneq (,$(filter ieee802154_radio_hal,$(USEMODULE))) # use netdev implementation when legacy is explicitly enabled
SRC += cc2538_rf_radio_ops.c ifneq (,$(filter cc2538_rf_netdev_legacy,$(USEMODULE)))
else
SRC += cc2538_rf_netdev.c SRC += cc2538_rf_netdev.c
else
SRC += cc2538_rf_radio_ops.c
endif endif
include $(RIOTBASE)/Makefile.base include $(RIOTBASE)/Makefile.base

View File

@ -136,7 +136,7 @@ void cc2538_init(void)
RFCORE_XREG_FIFOPCTRL = CC2538_RF_MAX_DATA_LEN; RFCORE_XREG_FIFOPCTRL = CC2538_RF_MAX_DATA_LEN;
/* Set default IRQ */ /* 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_RFIRQM1 = TXDONE | CSP_STOP | TXACKDONE;
RFCORE_XREG_RFIRQM0 = RXPKTDONE | FIFOP | SFD; RFCORE_XREG_RFIRQM0 = RXPKTDONE | FIFOP | SFD;
} else { } else {
@ -212,7 +212,7 @@ bool cc2538_on(void)
void cc2538_setup(cc2538_rf_t *dev) void cc2538_setup(cc2538_rf_t *dev)
{ {
#if IS_USED(MODULE_IEEE802154_RADIO_HAL) #if !IS_USED(MODULE_CC2538_RF_NETDEV_LEGACY)
(void) dev; (void) dev;
#if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC) #if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC)
extern ieee802154_dev_t cc2538_rf_dev; extern ieee802154_dev_t cc2538_rf_dev;

View File

@ -4,8 +4,9 @@ ifneq (,$(filter nrf802154,$(USEMODULE)))
FEATURES_REQUIRED += periph_timer FEATURES_REQUIRED += periph_timer
FEATURES_REQUIRED += radio_nrf802154 FEATURES_REQUIRED += radio_nrf802154
USEMODULE += luid USEMODULE += luid
USEMODULE += netdev_ieee802154 ifneq (,$(filter nrf802154_netdev_legacy,$(USEMODULE)))
ifeq (,$(filter netdev_ieee802154_legacy,$(USEMODULE))) USEMODULE += netdev_ieee802154
else ifneq (,$(filter netdev,$(USEMODULE)))
USEMODULE += netdev_ieee802154_submac USEMODULE += netdev_ieee802154_submac
endif endif
endif endif

View File

@ -36,7 +36,7 @@
#ifndef NRF802154_H #ifndef NRF802154_H
#define NRF802154_H #define NRF802154_H
#if IS_USED(MODULE_IEEE802154_RADIO_HAL) #if !IS_USED(MODULE_NRF802154_NETDEV_LEGACY)
#include "net/ieee802154/radio.h" #include "net/ieee802154/radio.h"
#if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC) #if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC)
#include "net/netdev/ieee802154_submac.h" #include "net/netdev/ieee802154_submac.h"
@ -58,7 +58,7 @@ extern "C" {
typedef struct { typedef struct {
#if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC) #if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC)
netdev_ieee802154_submac_t netdev; /**< netdev SubMAC descriptor */ 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 */ netdev_ieee802154_t netdev; /**< ieee802154 device descriptor */
#endif #endif
} nrf802154_t; } nrf802154_t;

View File

@ -1,9 +1,10 @@
MODULE = nrf802154 MODULE = nrf802154
ifneq (,$(filter ieee802154_radio_hal,$(USEMODULE))) # use netdev implementation when legacy is explicitly enabled
SRC += nrf802154_radio.c ifneq (,$(filter nrf802154_netdev_legacy,$(USEMODULE)))
else
SRC += nrf802154.c SRC += nrf802154.c
else
SRC += nrf802154_radio.c
endif endif
include $(RIOTBASE)/Makefile.base include $(RIOTBASE)/Makefile.base

View File

@ -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 @ref config "identified compile-time configurations". To learn how to use
Kconfig in RIOT, please refer to the @ref kconfig-users-guide. 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} 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. [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.

View File

@ -105,6 +105,29 @@ endif
the dependency block for your board *before* its dependencies pull in their own the dependency block for your board *before* its dependencies pull in their own
dependencies. 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} ### Makefile.features {#makefile-features}
This file defines all the features provided by the BOARD. These features This file defines all the features provided by the BOARD. These features

View File

@ -197,7 +197,7 @@ ifneq (,$(filter periph_timer_periodic,$(USEMODULE)))
FEATURES_REQUIRED += periph_timer FEATURES_REQUIRED += periph_timer
endif endif
ifneq (,$(filter netdev_%,$(USEMODULE))) ifneq (,$(filter-out netdev_default, $(filter netdev_%,$(USEMODULE))))
USEMODULE += netdev USEMODULE += netdev
# Don't register netdevs if there is only a single one of them # Don't register netdevs if there is only a single one of them
ifeq (,$(filter gnrc_netif_single,$(USEMODULE))) ifeq (,$(filter gnrc_netif_single,$(USEMODULE)))

View File

@ -37,9 +37,6 @@ USEMODULE += netstats_rpl
# USEMODULE += sock_dns # include DNS client # USEMODULE += sock_dns # include DNS client
# USEMODULE += gnrc_ipv6_nib_dns # include RDNSS option handling # 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 # Comment this out to disable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the # which is not needed in a production environment but helps in the
# development process: # development process:

View File

@ -13,6 +13,7 @@ PSEUDOMODULES += can_pm
PSEUDOMODULES += can_raw PSEUDOMODULES += can_raw
PSEUDOMODULES += ccn-lite-utils PSEUDOMODULES += ccn-lite-utils
PSEUDOMODULES += cc2538_rf_obs_sig PSEUDOMODULES += cc2538_rf_obs_sig
PSEUDOMODULES += cc2538_rf_netdev_legacy
PSEUDOMODULES += conn_can_isotp_multi PSEUDOMODULES += conn_can_isotp_multi
PSEUDOMODULES += cord_ep_standalone PSEUDOMODULES += cord_ep_standalone
PSEUDOMODULES += core_% PSEUDOMODULES += core_%
@ -67,7 +68,6 @@ PSEUDOMODULES += gnrc_sock_check_reuse
PSEUDOMODULES += gnrc_txtsnd PSEUDOMODULES += gnrc_txtsnd
PSEUDOMODULES += heap_cmd PSEUDOMODULES += heap_cmd
PSEUDOMODULES += i2c_scan PSEUDOMODULES += i2c_scan
PSEUDOMODULES += ieee802154_radio_hal
PSEUDOMODULES += ieee802154_security PSEUDOMODULES += ieee802154_security
PSEUDOMODULES += ieee802154_submac PSEUDOMODULES += ieee802154_submac
PSEUDOMODULES += ina3221_alerts PSEUDOMODULES += ina3221_alerts
@ -105,6 +105,7 @@ PSEUDOMODULES += newlib
PSEUDOMODULES += newlib_gnu_source PSEUDOMODULES += newlib_gnu_source
PSEUDOMODULES += newlib_nano PSEUDOMODULES += newlib_nano
PSEUDOMODULES += nrf24l01p_ng_diagnostics PSEUDOMODULES += nrf24l01p_ng_diagnostics
PSEUDOMODULES += nrf802154_netdev_legacy
PSEUDOMODULES += openthread PSEUDOMODULES += openthread
PSEUDOMODULES += picolibc PSEUDOMODULES += picolibc
PSEUDOMODULES += picolibc_stdout_buffered PSEUDOMODULES += picolibc_stdout_buffered

View File

@ -63,6 +63,7 @@ ifneq (,$(filter lwip_%,$(USEMODULE)))
USEMODULE += lwip_contrib USEMODULE += lwip_contrib
USEMODULE += lwip_core USEMODULE += lwip_core
USEMODULE += lwip_netif USEMODULE += lwip_netif
USEMODULE += netdev
ifeq (,$(filter lwip_ipv4 lwip_ipv6,$(USEMODULE))) ifeq (,$(filter lwip_ipv4 lwip_ipv6,$(USEMODULE)))
USEMODULE += lwip_ipv4 USEMODULE += lwip_ipv4
endif endif

View File

@ -1,12 +1,9 @@
USEMODULE += openthread_contrib USEMODULE += openthread_contrib
USEMODULE += netdev
USEMODULE += openthread_contrib_netdev USEMODULE += openthread_contrib_netdev
USEMODULE += l2util USEMODULE += l2util
USEMODULE += xtimer USEMODULE += xtimer
USEMODULE += event USEMODULE += event
ifneq (,$(filter cc2538_rf nrf802154,$(USEMODULE)))
USEMODULE += netdev_ieee802154_submac
endif
FEATURES_REQUIRED += cpp FEATURES_REQUIRED += cpp

View File

@ -49,7 +49,9 @@ ifneq (,$(filter openwsn_crypto,$(USEMODULE)))
endif endif
ifneq (,$(filter openwsn_radio,$(USEMODULE))) ifneq (,$(filter openwsn_radio,$(USEMODULE)))
# enable default network devices on the platform
USEMODULE += netdev_default USEMODULE += netdev_default
USEMODULE += netdev
USEMODULE += luid USEMODULE += luid
ifneq (,$(filter cc2538_rf nrf802154,$(USEMODULE))) ifneq (,$(filter cc2538_rf nrf802154,$(USEMODULE)))
USEMODULE += openwsn_radio_hal USEMODULE += openwsn_radio_hal
@ -60,7 +62,6 @@ ifneq (,$(filter openwsn_radio,$(USEMODULE)))
endif endif
ifneq (,$(filter openwsn_radio_hal,$(USEMODULE))) ifneq (,$(filter openwsn_radio_hal,$(USEMODULE)))
USEMODULE += ieee802154_radio_hal
# Used here only for dependency resolution # Used here only for dependency resolution
DISABLE_MODULE += auto_init_gnrc_netif DISABLE_MODULE += auto_init_gnrc_netif
endif endif

View File

@ -142,12 +142,10 @@ ifneq (,$(filter sntp,$(USEMODULE)))
USEMODULE += xtimer USEMODULE += xtimer
endif endif
ifneq (,$(filter ieee802154_radio_hal,$(USEMODULE)))
USEMODULE += ieee802154
endif
ifneq (,$(filter gnrc_netdev_default,$(USEMODULE))) ifneq (,$(filter gnrc_netdev_default,$(USEMODULE)))
# enable default network devices on the platform
USEMODULE += netdev_default USEMODULE += netdev_default
USEMODULE += netdev
USEMODULE += gnrc_netif USEMODULE += gnrc_netif
endif endif
@ -157,7 +155,8 @@ ifneq (,$(filter netdev_ieee802154,$(USEMODULE)))
endif endif
ifneq (,$(filter netdev_ieee802154_submac,$(USEMODULE))) ifneq (,$(filter netdev_ieee802154_submac,$(USEMODULE)))
USEMODULE += ieee802154_radio_hal USEMODULE += netdev_ieee802154
USEMODULE += ieee802154
USEMODULE += ieee802154_submac USEMODULE += ieee802154_submac
endif endif

View File

@ -27,7 +27,6 @@ USEMODULE += ps
USEMODULE += event_thread_highest USEMODULE += event_thread_highest
USEMODULE += event_callback USEMODULE += event_callback
USEMODULE += xtimer USEMODULE += xtimer
USEMODULE += ieee802154_radio_hal
USEMODULE += netdev_default USEMODULE += netdev_default
CFLAGS += -DEVENT_THREAD_HIGHEST_STACKSIZE=1024 CFLAGS += -DEVENT_THREAD_HIGHEST_STACKSIZE=1024

View File

@ -1,4 +1,4 @@
USEMODULE = netdev_default USEMODULE = gnrc_netdev_default
USEMODULE += netstats_neighbor_etx USEMODULE += netstats_neighbor_etx
USEMODULE += netstats_neighbor_count USEMODULE += netstats_neighbor_count