drivers: ieee802154_nrf5: Switch to ACK timeout at nRF driver level

nRF radio driver will call `nrf_802154_transmit_failed` callback in case
no ACK is received, so we do not need to set timeout at the shim layer
anymore.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2020-04-03 13:04:11 +02:00 committed by Carles Cufí
commit 86f56fcd36

View file

@ -48,13 +48,6 @@ struct nrf5_802154_config {
static struct nrf5_802154_data nrf5_data;
/* Increase ACK timeout to cover the maximum CSMA CA time in default
* configuration. 40ms is enough time to cover worst-case CSMA/CA scenario in
* default configuration (CSMA/CA + transmit + ACK delay).
* TODO Switch to ACK timeout at driver level.
*/
#define ACK_TIMEOUT K_MSEC(40)
/* Convenience defines for RADIO */
#define NRF5_802154_DATA(dev) \
((struct nrf5_802154_data * const)(dev)->driver_data)
@ -382,16 +375,8 @@ static int nrf5_tx(struct device *dev,
LOG_DBG("Sending frame (ch:%d, txpower:%d)",
nrf_802154_channel_get(), nrf_802154_tx_power_get());
/* Wait for ack to be received */
if (k_sem_take(&nrf5_radio->tx_wait, ACK_TIMEOUT)) {
LOG_DBG("ACK not received");
if (!nrf_802154_receive()) {
LOG_ERR("Failed to switch back to receive state");
}
return -EIO;
}
/* Wait for the callback from the radio driver. */
k_sem_take(&nrf5_radio->tx_wait, K_FOREVER);
LOG_DBG("Result: %d", nrf5_data.tx_result);