1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

cpu/nrf52/radio/nrf802154: remove driver ACK

This commit is contained in:
Fabian Hüßler 2025-09-10 09:55:14 +02:00
parent 6b065bcea7
commit 4b24183e81
2 changed files with 20 additions and 48 deletions

View File

@ -14,6 +14,7 @@ ifneq (,$(filter nrf802154,$(USEMODULE)))
USEMODULE += luid
ifneq (,$(filter netdev,$(USEMODULE)))
USEMODULE += netdev_ieee802154_submac
USEMODULE += netdev_ieee802154_submac_soft_ack
endif
endif

View File

@ -69,7 +69,6 @@
static uint8_t rxbuf[IEEE802154_FRAME_LEN_MAX + 3]; /* len PHR + PSDU + LQI */
static uint8_t txbuf[IEEE802154_FRAME_LEN_MAX + 3]; /* len PHR + PSDU + LQI */
static uint8_t ack[IEEE802154_ACK_FRAME_LEN];
typedef enum {
STATE_IDLE,
@ -430,30 +429,6 @@ static void _set_ifs_timer(bool lifs)
timer_start(NRF802154_TIMER);
}
static void _timer_cb(void *arg, int chan)
{
(void)arg;
ieee802154_dev_t *dev = nrf802154_hal_dev;
if (chan == MAC_TIMER_CHAN_ACK) {
/* Copy sqn */
ack[1] = IEEE802154_FCF_TYPE_ACK;
if (cfg.pending) {
ack[1] |= IEEE802154_FCF_FRAME_PEND;
}
ack[3] = rxbuf[3];
NRF_RADIO->PACKETPTR = (uint32_t) &ack;
NRF_RADIO->TASKS_TXEN = 1;
dev->cb(dev, IEEE802154_RADIO_INDICATION_RX_DONE);
}
else if (chan == MAC_TIMER_CHAN_IFS) {
cfg.ifs = false;
}
timer_stop(NRF802154_TIMER);
}
/**
* @brief Set radio into DISABLED state
*/
@ -463,16 +438,6 @@ int nrf802154_init(void)
/* reset buffer */
rxbuf[0] = 0;
txbuf[0] = 0;
ack[0] = IEEE802154_ACK_FRAME_LEN; /* PSDU length */
ack[1] = IEEE802154_FCF_TYPE_ACK; /* FCF */
ack[2] = 0; /* FCF */
int result = timer_init(NRF802154_TIMER, TIMER_FREQ, _timer_cb, NULL);
assert(result >= 0);
(void)result;
timer_stop(NRF802154_TIMER);
/* power off peripheral (but do not release the HFXO as we never requested
* it so far) */
NRF_RADIO->POWER = 0;
@ -528,9 +493,7 @@ void isr_radio(void)
case STATE_RX:
if (NRF_RADIO->CRCSTATUS) {
bool l2filter_passed = _l2filter(rxbuf+1);
bool is_auto_ack_en = !IS_ACTIVE(CONFIG_IEEE802154_AUTO_ACK_DISABLE);
bool is_ack = rxbuf[1] & IEEE802154_FCF_TYPE_ACK;
bool ack_req = rxbuf[1] & IEEE802154_FCF_ACK_REQ;
/* If radio is in promiscuos mode, indicate packet and
* don't event think of sending an ACK frame :) */
@ -543,17 +506,9 @@ void isr_radio(void)
* directly or if the driver should send an ACK frame before
* the indication */
else if (l2filter_passed) {
if (ack_req && is_auto_ack_en) {
timer_set(NRF802154_TIMER, MAC_TIMER_CHAN_ACK, IEEE802154_SIFS_SYMS);
timer_start(NRF802154_TIMER);
_disable();
_state = STATE_ACK;
}
else {
DEBUG("[nrf802154] RX frame doesn't require ACK frame.\n");
_state = STATE_IDLE;
dev->cb(dev, IEEE802154_RADIO_INDICATION_RX_DONE);
}
DEBUG("[nrf802154] RX frame doesn't require ACK frame.\n");
_state = STATE_IDLE;
dev->cb(dev, IEEE802154_RADIO_INDICATION_RX_DONE);
}
/* In case the packet is an ACK and the ACK filter is disabled,
* indicate the frame reception */
@ -770,6 +725,21 @@ static int _set_frame_filter_mode(ieee802154_dev_t *dev, ieee802154_filter_mode_
return 0;
}
static int _get_frame_filter_mode(ieee802154_dev_t *dev, ieee802154_filter_mode_t *mode)
{
(void) dev;
if (cfg.promisc) {
*mode = IEEE802154_FILTER_PROMISC;
}
else if (!cfg.ack_filter) {
*mode = IEEE802154_FILTER_ACK_ONLY;
}
else {
*mode = IEEE802154_FILTER_ACCEPT;
}
return 0;
}
static int _set_csma_params(ieee802154_dev_t *dev, const ieee802154_csma_be_t *bd,
int8_t retries)
{
@ -823,4 +793,5 @@ static const ieee802154_radio_ops_t nrf802154_ops = {
.config_addr_filter = _config_addr_filter,
.config_src_addr_match = _config_src_addr_match,
.set_frame_filter_mode = _set_frame_filter_mode,
.get_frame_filter_mode = _get_frame_filter_mode,
};