sys/net/iee802154/radio: add IEEE802154_RADIO_INDICATION_CRC_ERROR

This commit is contained in:
Francisco Molina 2020-11-06 17:39:55 +01:00
parent daf5a7d6b4
commit fe1e16cdc7
No known key found for this signature in database
GPG Key ID: 3E94EAC3DBDEEDA8
3 changed files with 23 additions and 3 deletions

View File

@ -348,8 +348,10 @@ void cc2538_irq_handler(void)
cc2538_rf_dev.cb(&cc2538_rf_dev, IEEE802154_RADIO_INDICATION_RX_DONE); cc2538_rf_dev.cb(&cc2538_rf_dev, IEEE802154_RADIO_INDICATION_RX_DONE);
} }
else { else {
/* Disable RX while the frame has not been processed */
RFCORE_XREG_RXMASKCLR = 0xFF;
/* CRC failed; discard packet */ /* CRC failed; discard packet */
RFCORE_SFR_RFST = ISFLUSHRX; cc2538_rf_dev.cb(&cc2538_rf_dev, IEEE802154_RADIO_INDICATION_CRC_ERROR);
} }
} }
@ -391,11 +393,12 @@ static bool _get_cap(ieee802154_dev_t *dev, ieee802154_rf_caps_t cap)
(void) dev; (void) dev;
switch (cap) { switch (cap) {
case IEEE802154_CAP_24_GHZ: case IEEE802154_CAP_24_GHZ:
case IEEE802154_CAP_AUTO_CSMA:
case IEEE802154_CAP_IRQ_CRC_ERROR:
case IEEE802154_CAP_IRQ_TX_DONE: case IEEE802154_CAP_IRQ_TX_DONE:
case IEEE802154_CAP_IRQ_CCA_DONE: case IEEE802154_CAP_IRQ_CCA_DONE:
case IEEE802154_CAP_IRQ_RX_START: case IEEE802154_CAP_IRQ_RX_START:
case IEEE802154_CAP_IRQ_TX_START: case IEEE802154_CAP_IRQ_TX_START:
case IEEE802154_CAP_AUTO_CSMA:
return true; return true;
default: default:
return false; return false;

View File

@ -544,7 +544,7 @@ void isr_radio(void)
} }
else { else {
DEBUG("[nrf802154] CRC fail.\n"); DEBUG("[nrf802154] CRC fail.\n");
NRF_RADIO->TASKS_START = 1; dev->cb(dev, IEEE802154_RADIO_INDICATION_CRC_ERROR);
} }
break; break;
case STATE_ACK: case STATE_ACK:
@ -645,6 +645,7 @@ static bool _get_cap(ieee802154_dev_t *dev, ieee802154_rf_caps_t cap)
(void) dev; (void) dev;
switch (cap) { switch (cap) {
case IEEE802154_CAP_24_GHZ: case IEEE802154_CAP_24_GHZ:
case IEEE802154_CAP_IRQ_CRC_ERROR:
case IEEE802154_CAP_IRQ_RX_START: case IEEE802154_CAP_IRQ_RX_START:
case IEEE802154_CAP_IRQ_TX_START: case IEEE802154_CAP_IRQ_TX_START:
case IEEE802154_CAP_IRQ_TX_DONE: case IEEE802154_CAP_IRQ_TX_DONE:

View File

@ -92,6 +92,10 @@ typedef enum {
* @brief the device support the IEEE802.15.4 Sub GHz band * @brief the device support the IEEE802.15.4 Sub GHz band
*/ */
IEEE802154_CAP_SUB_GHZ, IEEE802154_CAP_SUB_GHZ,
/**
* @brief the device reports reception off frames with invalid CRC.
*/
IEEE802154_CAP_IRQ_CRC_ERROR,
/** /**
* @brief the device reports when the transmission is done * @brief the device reports when the transmission is done
*/ */
@ -190,6 +194,18 @@ typedef enum {
*/ */
IEEE802154_RADIO_INDICATION_RX_START, IEEE802154_RADIO_INDICATION_RX_START,
/**
* @brief the transceiver received a frame with an invalid crc.
*
* The transceiver might not stay in @ref IEEE802154_TRX_STATE_RX_ON
* after receiving an invalid CRC. Therefore the upper layer must
* set the transceiver state (@ref ieee802154_radio_ops::request_set_trx_state).
* e.g.: @ref IEEE802154_TRX_STATE_TRX_OFF or @ref IEEE802154_TRX_STATE_TX_ON
* to stop listening or @ref IEEE802154_TRX_STATE_RX_ON to keep
* listening.
*/
IEEE802154_RADIO_INDICATION_CRC_ERROR,
/** /**
* @brief the transceiver sent out a valid SFD * @brief the transceiver sent out a valid SFD
* *