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

drivers/cc2420: 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:39:18 +01:00
parent 1d0ee42046
commit 3a378c24a2
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F
4 changed files with 7 additions and 49 deletions

View File

@ -145,7 +145,7 @@ size_t cc2420_tx_prepare(cc2420_t *dev, const iolist_t *iolist)
void cc2420_tx_exec(cc2420_t *dev)
{
/* trigger the transmission */
if (dev->options & CC2420_OPT_TELL_TX_START) {
if (dev->netdev.netdev.event_callback) {
dev->netdev.netdev.event_callback(&dev->netdev.netdev,
NETDEV_EVENT_TX_STARTED);
}

View File

@ -199,14 +199,6 @@ int cc2420_set_option(cc2420_t *dev, uint16_t option, bool state)
DEBUG("cc2420: set_opt: CC2420_OPT_PRELOADING\n");
break;
case CC2420_OPT_TELL_TX_START:
case CC2420_OPT_TELL_TX_END:
case CC2420_OPT_TELL_RX_START:
case CC2420_OPT_TELL_RX_END:
DEBUG("cc2420: set_opt: TX/RX START/END\n");
/* TODO */
break;
default:
return -ENOTSUP;
}
@ -242,14 +234,6 @@ int cc2420_set_option(cc2420_t *dev, uint16_t option, bool state)
DEBUG("cc2420: clr_opt: CC2420_OPT_PRELOADING\n");
break;
case CC2420_OPT_TELL_TX_START:
case CC2420_OPT_TELL_TX_END:
case CC2420_OPT_TELL_RX_START:
case CC2420_OPT_TELL_RX_END:
DEBUG("cc2420: clr_opt: TX/RX START/END\n");
/* TODO */
break;
default:
return -ENOTSUP;
}

View File

@ -213,16 +213,11 @@ static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len)
return opt_state(val, (dev->options & CC2420_OPT_PROMISCUOUS));
case NETOPT_RX_START_IRQ:
return opt_state(val, (dev->options & CC2420_OPT_TELL_RX_START));
case NETOPT_RX_END_IRQ:
return opt_state(val, (dev->options & CC2420_OPT_TELL_TX_END));
case NETOPT_TX_START_IRQ:
return opt_state(val, (dev->options & CC2420_OPT_TELL_RX_START));
case NETOPT_TX_END_IRQ:
return opt_state(val, (dev->options & CC2420_OPT_TELL_RX_END));
*((netopt_enable_t *)val) = NETOPT_ENABLE;
return sizeof(netopt_enable_t);
default:
return -ENOTSUP;
@ -280,18 +275,6 @@ static int _set(netdev_t *netdev, netopt_t opt, const void *val, size_t val_len)
case NETOPT_PROMISCUOUSMODE:
return cc2420_set_option(dev, CC2420_OPT_PROMISCUOUS, to_bool(val));
case NETOPT_RX_START_IRQ:
return cc2420_set_option(dev, CC2420_OPT_TELL_RX_START, to_bool(val));
case NETOPT_RX_END_IRQ:
return cc2420_set_option(dev, CC2420_OPT_TELL_RX_END, to_bool(val));
case NETOPT_TX_START_IRQ:
return cc2420_set_option(dev, CC2420_OPT_TELL_TX_START, to_bool(val));
case NETOPT_TX_END_IRQ:
return cc2420_set_option(dev, CC2420_OPT_TELL_TX_END, to_bool(val));
default:
return ext;
}

View File

@ -31,17 +31,8 @@ extern "C" {
*/
#define CC2420_OPT_AUTOACK (0x0001) /**< auto ACKs active */
#define CC2420_OPT_CSMA (0x0002) /**< CSMA active */
#define CC2420_OPT_PROMISCUOUS (0x0004) /**< promiscuous mode
* active */
#define CC2420_OPT_PROMISCUOUS (0x0004) /**< promiscuous mode active */
#define CC2420_OPT_PRELOADING (0x0008) /**< preloading enabled */
#define CC2420_OPT_TELL_TX_START (0x0010) /**< notify MAC layer on TX
* start */
#define CC2420_OPT_TELL_TX_END (0x0020) /**< notify MAC layer on TX
* finished */
#define CC2420_OPT_TELL_RX_START (0x0040) /**< notify MAC layer on RX
* start */
#define CC2420_OPT_TELL_RX_END (0x0080) /**< notify MAC layer on RX
* finished */
/** @} */
/**
@ -49,11 +40,11 @@ extern "C" {
* @{
*/
enum {
CC2420_GOTO_PD, /**< power down */
CC2420_GOTO_PD, /**< power down */
CC2420_GOTO_IDLE, /**< idle */
CC2420_GOTO_RX, /**< receive state */
CC2420_GOTO_RX, /**< receive state */
CC2420_GOTO_TXON, /**< transmit packet without CCA */
CC2420_GOTO_TXONCCA /**< transmit packet using CCA */
CC2420_GOTO_TXONCCA /**< transmit packet using CCA */
};
/**