1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/kw2xrf: make TX/RX IRQs read only

This brings the implementation in sync with the API.
This commit is contained in:
Marian Buschsieweke 2021-02-26 11:03:45 +01:00
parent a18ec987bf
commit fba104c2ce
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F
4 changed files with 5 additions and 79 deletions

View File

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

View File

@ -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");
}

View File

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

View File

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