From 06b44b12c7fa65c135405dc1e3e1a897c0dc78be Mon Sep 17 00:00:00 2001 From: Maciej Fabia Date: Thu, 17 Sep 2020 14:28:22 +0200 Subject: [PATCH] drivers: ieee802154: Add more error codes to nrf5 driver tx Add separate error codes in tx function for busy channel error and ACK-related errors. Signed-off-by: Maciej Fabia --- drivers/ieee802154/ieee802154_nrf5.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 575c63b47b6..406b430ff4c 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -414,14 +414,25 @@ static int nrf5_tx(const struct device *dev, LOG_DBG("Result: %d", nrf5_data.tx_result); - if (nrf5_radio->tx_result == NRF_802154_TX_ERROR_NONE) { + switch (nrf5_radio->tx_result) { + case NRF_802154_TX_ERROR_NONE: if (nrf5_radio->ack_frame.psdu == NULL) { /* No ACK was requested. */ return 0; } - /* Handle ACK packet. */ return handle_ack(nrf5_radio); + case NRF_802154_TX_ERROR_NO_MEM: + return -ENOBUFS; + case NRF_802154_TX_ERROR_BUSY_CHANNEL: + return -EBUSY; + case NRF_802154_TX_ERROR_INVALID_ACK: + case NRF_802154_TX_ERROR_NO_ACK: + return -ENOMSG; + case NRF_802154_TX_ERROR_ABORTED: + case NRF_802154_TX_ERROR_TIMESLOT_DENIED: + case NRF_802154_TX_ERROR_TIMESLOT_ENDED: + return -EIO; } return -EIO;