mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 16:59:28 +08:00
ieee802154: Notify radio layer of changes in devmode
This commit is contained in:
@@ -133,8 +133,14 @@ int mac802154_req_associate(MACHANDLE mac,
|
|||||||
|
|
||||||
/* Copy in the capabilities information bitfield */
|
/* Copy in the capabilities information bitfield */
|
||||||
|
|
||||||
priv->devmode = (req->capabilities.devtype) ?
|
if (req->capabilities.devtype)
|
||||||
IEEE802154_DEVMODE_COORD : IEEE802154_DEVMODE_ENDPOINT;
|
{
|
||||||
|
mac802154_setdevmode(priv, IEEE802154_DEVMODE_COORD);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mac802154_setdevmode(priv, IEEE802154_DEVMODE_ENDPOINT);
|
||||||
|
}
|
||||||
|
|
||||||
mac802154_setrxonidle(priv, req->capabilities.rxonidle);
|
mac802154_setrxonidle(priv, req->capabilities.rxonidle);
|
||||||
|
|
||||||
|
|||||||
@@ -816,15 +816,16 @@ static inline void mac802154_setrxonidle(FAR struct ieee802154_privmac_s *priv,
|
|||||||
mac802154_rxdisable(priv);
|
mac802154_rxdisable(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unlike other attributes, we can't simply cast this one since it is a bit
|
|
||||||
* in a bitfield. Casting it will give us unpredicatble results. Instead
|
|
||||||
* of creating a ieee802154_attr_u, we use a local bool. Allocating the
|
|
||||||
* ieee802154_attr_u value would take up more room on the stack since it is
|
|
||||||
* as large as the largest attribute type.
|
|
||||||
*/
|
|
||||||
|
|
||||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_RX_ON_WHEN_IDLE,
|
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_RX_ON_WHEN_IDLE,
|
||||||
(FAR const union ieee802154_attr_u *)&rxonidle);
|
(FAR const union ieee802154_attr_u *)&rxonidle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void mac802154_setdevmode(FAR struct ieee802154_privmac_s *priv,
|
||||||
|
enum ieee802154_devmode_e mode)
|
||||||
|
{
|
||||||
|
priv->devmode = mode;
|
||||||
|
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_RX_ON_WHEN_IDLE,
|
||||||
|
(FAR const union ieee802154_attr_u *)&mode);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __WIRELESS_IEEE802154__MAC802154_INTERNAL_H */
|
#endif /* __WIRELESS_IEEE802154__MAC802154_INTERNAL_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user