From f0e7dfdf7603a358e65ecea3db34823df6d20270 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Tue, 2 Feb 2021 10:49:38 +0100 Subject: [PATCH] cpu/cc2538/radio: use driver specific legacy pseudomodule This introduces the cc2538_rf_netdev_legacy pseudomodule that switches to the netdev-based implementation of the cc2538 radio driver. --- cpu/cc2538/Makefile.dep | 5 +++-- cpu/cc2538/include/cc2538_rf.h | 4 ++-- cpu/cc2538/radio/Makefile | 7 ++++--- cpu/cc2538/radio/cc2538_rf.c | 4 ++-- makefiles/pseudomodules.inc.mk | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cpu/cc2538/Makefile.dep b/cpu/cc2538/Makefile.dep index d8489f01b0..41e6d4edfc 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 fc27bf96f8..a30c44f1c4 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 cafd539d34..9bfe55433d 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 899f092f7c..076d238dcd 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/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index a4acda742a..231445c2e3 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