1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

netdev: Add common ieee802154 reset function

Resets flags, sequence number and protocol.
This commit is contained in:
Koen Zandberg 2018-07-10 14:27:52 +02:00
parent 15b0fe4368
commit 123b275b23
No known key found for this signature in database
GPG Key ID: 0895A893E6D2985B
2 changed files with 24 additions and 0 deletions

View File

@ -121,6 +121,17 @@ typedef struct {
*/
typedef struct netdev_radio_rx_info netdev_ieee802154_rx_info_t;
/**
* @brief Reset function for ieee802154 common fields
*
* Supposed to be used by netdev drivers to reset the ieee802154 fields when
* resetting the device
*
* @param[in] dev network device descriptor
*/
void netdev_ieee802154_reset(netdev_ieee802154_t *dev);
/**
* @brief Fallback function for netdev IEEE 802.15.4 devices' _get function
*

View File

@ -50,6 +50,19 @@ static int _get_iid(netdev_ieee802154_t *dev, eui64_t *value, size_t max_len)
return sizeof(eui64_t);
}
void netdev_ieee802154_reset(netdev_ieee802154_t *dev)
{
dev->seq = 0;
dev->flags = 0;
/* set default protocol */
#ifdef MODULE_GNRC_SIXLOWPAN
dev->proto = GNRC_NETTYPE_SIXLOWPAN;
#elif MODULE_GNRC
dev->proto = GNRC_NETTYPE_UNDEF;
#endif
}
int netdev_ieee802154_get(netdev_ieee802154_t *dev, netopt_t opt, void *value,
size_t max_len)
{