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_netdev_legacy,$(USEMODULE)))
USEMODULE += netdev_ieee802154
ifeq (,$(filter netdev_ieee802154_legacy,$(USEMODULE)))
else ifneq (,$(filter netdev,$(USEMODULE)))
USEMODULE += netdev_ieee802154_submac
endif
endif

View File

@ -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 */

View File

@ -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

View File

@ -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;

View File

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

View File

@ -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;

View File

@ -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

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
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.

View File

@ -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

View File

@ -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)))

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

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