net: ieee802154: Allow event callback configuration

Implement a way to pass handler for various events from
radio driver

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
This commit is contained in:
Marek Porwisz 2020-02-28 15:41:05 +01:00 committed by Jukka Rissanen
commit bca112f073

View file

@ -26,8 +26,6 @@ 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 */
@ -48,6 +46,16 @@ enum ieee802154_filter_type {
IEEE802154_FILTER_TYPE_SRC_SHORT_ADDR,
};
enum ieee802154_event {
IEEE802154_EVENT_TX_STARTED /* Data transmission started */
};
typedef void (*energy_scan_done_cb_t)(struct device *dev, s16_t max_ed);
typedef void (*ieee802154_event_cb_t)(struct device *dev,
enum ieee802154_event evt,
void *event_params);
struct ieee802154_filter {
/** @cond ignore */
union {
@ -98,6 +106,11 @@ enum ieee802154_config_type {
/** Enable/disable promiscuous mode. */
IEEE802154_CONFIG_PROMISCUOUS,
/** Specifies new radio event handler. Specifying NULL as a handler
* will disable radio events notification.
*/
IEEE802154_CONFIG_EVENT_HANDLER
};
/** IEEE802.15.4 driver configuration data. */
@ -121,6 +134,9 @@ struct ieee802154_config {
/** ``IEEE802154_CONFIG_PROMISCUOUS`` */
bool promiscuous;
/** ``IEEE802154_CONFIG_EVENT_HANDLER`` */
ieee802154_event_cb_t event_handler;
};
};