From 5c57f382de787a10bc95f9b97fc0ec9d686921af Mon Sep 17 00:00:00 2001 From: Marek Porwisz Date: Tue, 25 Feb 2020 11:16:05 +0100 Subject: [PATCH] net: ieee802154: Extend radio api to support energy scan feature Add the Energy Scan capability to the possible capabilities list. Create new energy scan callback function type to make its usage more readable. Signed-off-by: Marek Porwisz --- include/net/ieee802154_radio.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/include/net/ieee802154_radio.h b/include/net/ieee802154_radio.h index 6726eea6060..b4c27352a34 100644 --- a/include/net/ieee802154_radio.h +++ b/include/net/ieee802154_radio.h @@ -26,14 +26,17 @@ extern "C" { * @{ */ +typedef void (*energy_scan_done_cb_t)(struct device *dev, s16_t max_ed); + enum ieee802154_hw_caps { - IEEE802154_HW_FCS = BIT(0), /* Frame Check-Sum supported */ - IEEE802154_HW_PROMISC = BIT(1), /* Promiscuous mode supported */ - IEEE802154_HW_FILTER = BIT(2), /* Filters PAN ID, long/short addr */ - IEEE802154_HW_CSMA = BIT(3), /* CSMA-CA supported */ - IEEE802154_HW_2_4_GHZ = BIT(4), /* 2.4Ghz radio supported */ - IEEE802154_HW_TX_RX_ACK = BIT(5), /* Handles ACK request on TX */ - IEEE802154_HW_SUB_GHZ = BIT(6), /* Sub-GHz radio supported */ + IEEE802154_HW_FCS = BIT(0), /* Frame Check-Sum supported */ + IEEE802154_HW_PROMISC = BIT(1), /* Promiscuous mode supported */ + IEEE802154_HW_FILTER = BIT(2), /* Filter PAN ID, long/short addr */ + IEEE802154_HW_CSMA = BIT(3), /* CSMA-CA supported */ + IEEE802154_HW_2_4_GHZ = BIT(4), /* 2.4Ghz radio supported */ + IEEE802154_HW_TX_RX_ACK = BIT(5), /* Handles ACK request on TX */ + IEEE802154_HW_SUB_GHZ = BIT(6), /* Sub-GHz radio supported */ + IEEE802154_HW_ENERGY_SCAN = BIT(7) /* Energy scan supported */ }; enum ieee802154_filter_type { @@ -149,8 +152,7 @@ struct ieee802154_radio_api { */ int (*ed_scan)(struct device *dev, u16_t duration, - void (*done_cb)(struct device *dev, - s16_t max_ed)); + energy_scan_done_cb_t done_cb); #endif /* CONFIG_NET_L2_OPENTHREAD */ };