From a18ec987bf0a72aef1cbd28ac15c18d99596ef0a Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Fri, 26 Feb 2021 10:53:22 +0100 Subject: [PATCH] drivers/mrf24j40: make TX/RX IRQs read only This brings the implementation in sync with the API. --- drivers/include/mrf24j40.h | 8 ----- drivers/mrf24j40/mrf24j40.c | 2 +- drivers/mrf24j40/mrf24j40_netdev.c | 48 ++---------------------------- 3 files changed, 4 insertions(+), 54 deletions(-) diff --git a/drivers/include/mrf24j40.h b/drivers/include/mrf24j40.h index e9af526835..6a65044ab0 100644 --- a/drivers/include/mrf24j40.h +++ b/drivers/include/mrf24j40.h @@ -96,14 +96,6 @@ extern "C" { #define MRF24J40_OPT_PROMISCUOUS (0x0200) /**< promiscuous mode * active */ #define MRF24J40_OPT_PRELOADING (0x0400) /**< preloading enabled */ -#define MRF24J40_OPT_TELL_TX_START (0x0800) /**< notify MAC layer on TX - * start */ -#define MRF24J40_OPT_TELL_TX_END (0x1000) /**< notify MAC layer on TX - * finished */ -#define MRF24J40_OPT_TELL_RX_START (0x2000) /**< notify MAC layer on RX - * start */ -#define MRF24J40_OPT_TELL_RX_END (0x4000) /**< notify MAC layer on RX - * finished */ /** @} */ diff --git a/drivers/mrf24j40/mrf24j40.c b/drivers/mrf24j40/mrf24j40.c index d3c9b1bb6e..360895733e 100644 --- a/drivers/mrf24j40/mrf24j40.c +++ b/drivers/mrf24j40/mrf24j40.c @@ -156,7 +156,7 @@ void mrf24j40_tx_exec(mrf24j40_t *dev) else { mrf24j40_reg_write_short(dev, MRF24J40_REG_TXNCON, MRF24J40_TXNCON_TXNTRIG); } - if (netdev->event_callback && (dev->netdev.flags & MRF24J40_OPT_TELL_TX_START)) { + if (netdev->event_callback) { netdev->event_callback(netdev, NETDEV_EVENT_TX_STARTED); } } diff --git a/drivers/mrf24j40/mrf24j40_netdev.c b/drivers/mrf24j40/mrf24j40_netdev.c index ddddef13e1..d93df48856 100644 --- a/drivers/mrf24j40/mrf24j40_netdev.c +++ b/drivers/mrf24j40/mrf24j40_netdev.c @@ -231,26 +231,10 @@ static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len) break; case NETOPT_RX_START_IRQ: - *((netopt_enable_t *)val) = - !!(dev->netdev.flags & MRF24J40_OPT_TELL_RX_START); - res = sizeof(netopt_enable_t); - break; - case NETOPT_RX_END_IRQ: - *((netopt_enable_t *)val) = - !!(dev->netdev.flags & MRF24J40_OPT_TELL_RX_END); - res = sizeof(netopt_enable_t); - break; - case NETOPT_TX_START_IRQ: - *((netopt_enable_t *)val) = - !!(dev->netdev.flags & MRF24J40_OPT_TELL_TX_START); - res = sizeof(netopt_enable_t); - break; - case NETOPT_TX_END_IRQ: - *((netopt_enable_t *)val) = - !!(dev->netdev.flags & MRF24J40_OPT_TELL_TX_END); + *((netopt_enable_t *)val) = NETOPT_ENABLE; res = sizeof(netopt_enable_t); break; @@ -486,30 +470,6 @@ static int _set(netdev_t *netdev, netopt_t opt, const void *val, size_t len) res = sizeof(netopt_enable_t); break; - case NETOPT_RX_START_IRQ: - mrf24j40_set_option(dev, MRF24J40_OPT_TELL_RX_START, - ((const bool *)val)[0]); - res = sizeof(netopt_enable_t); - break; - - case NETOPT_RX_END_IRQ: - mrf24j40_set_option(dev, MRF24J40_OPT_TELL_RX_END, - ((const bool *)val)[0]); - res = sizeof(netopt_enable_t); - break; - - case NETOPT_TX_START_IRQ: - mrf24j40_set_option(dev, MRF24J40_OPT_TELL_TX_START, - ((const bool *)val)[0]); - res = sizeof(netopt_enable_t); - break; - - case NETOPT_TX_END_IRQ: - mrf24j40_set_option(dev, MRF24J40_OPT_TELL_TX_END, - ((const bool *)val)[0]); - res = sizeof(netopt_enable_t); - break; - case NETOPT_CSMA: mrf24j40_set_option(dev, MRF24J40_OPT_CSMA, ((const bool *)val)[0]); @@ -570,7 +530,7 @@ static void _isr(netdev_t *netdev) dev->pending &= ~(MRF24J40_TASK_TX_READY); DEBUG("[mrf24j40] EVT - TX_END\n"); #ifdef MODULE_NETSTATS_L2 - if (netdev->event_callback && (dev->netdev.flags & MRF24J40_OPT_TELL_TX_END)) { + if (netdev->event_callback) { uint8_t txstat = mrf24j40_reg_read_short(dev, MRF24J40_REG_TXSTAT); dev->tx_retries = (txstat >> MRF24J40_TXSTAT_MAX_FRAME_RETRIES_SHIFT); /* transmission failed */ @@ -595,9 +555,7 @@ static void _isr(netdev_t *netdev) /* Receive interrupt occurred */ if (dev->pending & MRF24J40_TASK_RX_READY) { DEBUG("[mrf24j40] EVT - RX_END\n"); - if ((dev->netdev.flags & MRF24J40_OPT_TELL_RX_END)) { - netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE); - } + netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE); dev->pending &= ~(MRF24J40_TASK_RX_READY); } DEBUG("[mrf24j40] END IRQ\n");