drivers: ieee082154_nrf5: Tx started notification

Notify about actual data transmission start.
Needed when ACK timeout is disabled in the radio driver.

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
This commit is contained in:
Marek Porwisz 2020-02-28 15:48:57 +01:00 committed by Jukka Rissanen
commit f6aa72a4d7
2 changed files with 22 additions and 0 deletions

View file

@ -325,6 +325,18 @@ free_nrf_ack:
return err;
}
static void nrf5_tx_started(struct device *dev,
struct net_pkt *pkt,
struct net_buf *frag)
{
ARG_UNUSED(pkt);
if (nrf5_data.event_handler) {
nrf5_data.event_handler(dev, IEEE802154_EVENT_TX_STARTED,
(void *)frag);
}
}
static int nrf5_tx(struct device *dev,
enum ieee802154_tx_mode mode,
struct net_pkt *pkt,
@ -365,6 +377,8 @@ static int nrf5_tx(struct device *dev,
return -EIO;
}
nrf5_tx_started(dev, pkt, frag);
LOG_DBG("Sending frame (ch:%d, txpower:%d)",
nrf_802154_channel_get(), nrf_802154_tx_power_get());
@ -520,6 +534,9 @@ int nrf5_configure(struct device *dev, enum ieee802154_config_type type,
nrf_802154_promiscuous_set(config->promiscuous);
break;
case IEEE802154_CONFIG_EVENT_HANDLER:
nrf5_data.event_handler = config->event_handler;
default:
return -EINVAL;
}

View file

@ -70,6 +70,11 @@ struct nrf5_802154_data {
* It shall be NULL if energy scan is not in progress.
*/
energy_scan_done_cb_t energy_scan_done;
/* Callback handler to notify of any important radio events.
* Can be NULL if event notification is not needed.
*/
ieee802154_event_cb_t event_handler;
};
#endif /* ZEPHYR_DRIVERS_IEEE802154_IEEE802154_NRF5_H_ */