From fba104c2ce44c836236aaad5eecc82f70eb2119e Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Fri, 26 Feb 2021 11:03:45 +0100 Subject: [PATCH] drivers/kw2xrf: make TX/RX IRQs read only This brings the implementation in sync with the API. --- drivers/include/kw2xrf.h | 8 ------- drivers/kw2xrf/kw2xrf.c | 4 ++++ drivers/kw2xrf/kw2xrf_getset.c | 33 ---------------------------- drivers/kw2xrf/kw2xrf_netdev.c | 39 +--------------------------------- 4 files changed, 5 insertions(+), 79 deletions(-) diff --git a/drivers/include/kw2xrf.h b/drivers/include/kw2xrf.h index 69901def61..5b63b4200c 100644 --- a/drivers/include/kw2xrf.h +++ b/drivers/include/kw2xrf.h @@ -95,14 +95,6 @@ extern "C" { #define KW2XRF_OPT_PROMISCUOUS (0x0200) /**< promiscuous mode * active */ #define KW2XRF_OPT_PRELOADING (0x0400) /**< preloading enabled */ -#define KW2XRF_OPT_TELL_TX_START (0x0800) /**< notify MAC layer on TX - * start */ -#define KW2XRF_OPT_TELL_TX_END (0x1000) /**< notify MAC layer on TX - * finished */ -#define KW2XRF_OPT_TELL_RX_START (0x2000) /**< notify MAC layer on RX - * start */ -#define KW2XRF_OPT_TELL_RX_END (0x4000) /**< notify MAC layer on RX - * finished */ #define KW2XRF_OPT_AUTOACK (0x8000) /**< enable automatically ACK * for incommint packet */ /** @} */ diff --git a/drivers/kw2xrf/kw2xrf.c b/drivers/kw2xrf/kw2xrf.c index 006254662e..7dc272cef2 100644 --- a/drivers/kw2xrf/kw2xrf.c +++ b/drivers/kw2xrf/kw2xrf.c @@ -66,6 +66,10 @@ void kw2xrf_setup(kw2xrf_t *dev, const kw2xrf_params_t *params) dev->pending_tx = 0; kw2xrf_spi_init(dev); kw2xrf_set_power_mode(dev, KW2XRF_IDLE); + DEBUG("[kw2xrf] enabling RX/TX completion and start events"); + kw2xrf_clear_dreg_bit(dev, MKW2XDM_PHY_CTRL2, MKW2XDM_PHY_CTRL2_RX_WMRK_MSK); + kw2xrf_clear_dreg_bit(dev, MKW2XDM_PHY_CTRL2, MKW2XDM_PHY_CTRL2_RXMSK); + kw2xrf_clear_dreg_bit(dev, MKW2XDM_PHY_CTRL2, MKW2XDM_PHY_CTRL2_TXMSK); DEBUG("[kw2xrf] setup finished\n"); } diff --git a/drivers/kw2xrf/kw2xrf_getset.c b/drivers/kw2xrf/kw2xrf_getset.c index e69e006a4c..3e2d628475 100644 --- a/drivers/kw2xrf/kw2xrf_getset.c +++ b/drivers/kw2xrf/kw2xrf_getset.c @@ -398,22 +398,6 @@ void kw2xrf_set_option(kw2xrf_t *dev, uint16_t option, bool state) MKW2XDM_PHY_CTRL1_RXACKRQD); break; - case KW2XRF_OPT_TELL_RX_START: - kw2xrf_clear_dreg_bit(dev, MKW2XDM_PHY_CTRL2, - MKW2XDM_PHY_CTRL2_RX_WMRK_MSK); - break; - - case KW2XRF_OPT_TELL_RX_END: - kw2xrf_clear_dreg_bit(dev, MKW2XDM_PHY_CTRL2, - MKW2XDM_PHY_CTRL2_RXMSK); - break; - - case KW2XRF_OPT_TELL_TX_END: - kw2xrf_clear_dreg_bit(dev, MKW2XDM_PHY_CTRL2, - MKW2XDM_PHY_CTRL2_TXMSK); - break; - - case KW2XRF_OPT_TELL_TX_START: default: /* do nothing */ break; @@ -453,23 +437,6 @@ void kw2xrf_set_option(kw2xrf_t *dev, uint16_t option, bool state) MKW2XDM_PHY_CTRL1_RXACKRQD); break; - case KW2XRF_OPT_TELL_RX_START: - kw2xrf_set_dreg_bit(dev, MKW2XDM_PHY_CTRL2, - MKW2XDM_PHY_CTRL2_RX_WMRK_MSK); - break; - - case KW2XRF_OPT_TELL_RX_END: - kw2xrf_set_dreg_bit(dev, MKW2XDM_PHY_CTRL2, - MKW2XDM_PHY_CTRL2_RXMSK); - break; - - case KW2XRF_OPT_TELL_TX_END: - kw2xrf_set_dreg_bit(dev, MKW2XDM_PHY_CTRL2, - MKW2XDM_PHY_CTRL2_TXMSK); - break; - - - case KW2XRF_OPT_TELL_TX_START: default: /* do nothing */ break; diff --git a/drivers/kw2xrf/kw2xrf_netdev.c b/drivers/kw2xrf/kw2xrf_netdev.c index 4ee4b17ec0..3f18bd2a9a 100644 --- a/drivers/kw2xrf/kw2xrf_netdev.c +++ b/drivers/kw2xrf/kw2xrf_netdev.c @@ -298,23 +298,10 @@ int _get(netdev_t *netdev, netopt_t opt, void *value, size_t len) return sizeof(netopt_enable_t); case NETOPT_RX_START_IRQ: - *((netopt_enable_t *)value) = - !!(dev->netdev.flags & KW2XRF_OPT_TELL_RX_START); - return sizeof(netopt_enable_t); - case NETOPT_RX_END_IRQ: - *((netopt_enable_t *)value) = - !!(dev->netdev.flags & KW2XRF_OPT_TELL_RX_END); - return sizeof(netopt_enable_t); - case NETOPT_TX_START_IRQ: - *((netopt_enable_t *)value) = - !!(dev->netdev.flags & KW2XRF_OPT_TELL_TX_START); - return sizeof(netopt_enable_t); - case NETOPT_TX_END_IRQ: - *((netopt_enable_t *)value) = - !!(dev->netdev.flags & KW2XRF_OPT_TELL_TX_END); + *((netopt_enable_t *)value) = NETOPT_ENABLE; return sizeof(netopt_enable_t); case NETOPT_AUTOCCA: @@ -482,30 +469,6 @@ static int _set(netdev_t *netdev, netopt_t opt, const void *value, size_t len) res = sizeof(netopt_enable_t); break; - case NETOPT_RX_START_IRQ: - kw2xrf_set_option(dev, KW2XRF_OPT_TELL_RX_START, - ((bool *)value)[0]); - res = sizeof(netopt_enable_t); - break; - - case NETOPT_RX_END_IRQ: - kw2xrf_set_option(dev, KW2XRF_OPT_TELL_RX_END, - ((bool *)value)[0]); - res = sizeof(netopt_enable_t); - break; - - case NETOPT_TX_START_IRQ: - kw2xrf_set_option(dev, KW2XRF_OPT_TELL_TX_START, - ((bool *)value)[0]); - res = sizeof(netopt_enable_t); - break; - - case NETOPT_TX_END_IRQ: - kw2xrf_set_option(dev, KW2XRF_OPT_TELL_TX_END, - ((bool *)value)[0]); - res = sizeof(netopt_enable_t); - break; - case NETOPT_AUTOCCA: kw2xrf_set_option(dev, KW2XRF_OPT_AUTOCCA, ((bool *)value)[0]);