mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
wireless/ieee802154: Bind MAC phyif to radio
This commit is contained in:
@@ -172,9 +172,10 @@ struct ieee802154_trans_s
|
|||||||
uint8_t psdu[CONFIG_IEEE802154_MTU];
|
uint8_t psdu[CONFIG_IEEE802154_MTU];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ieee802154_radio_s; /* Forward reference */
|
|
||||||
|
|
||||||
struct ieee802154_phyif_s
|
struct ieee802154_phyif_s; /* Forward Reference */
|
||||||
|
|
||||||
|
struct ieee802154_phyifops_s
|
||||||
{
|
{
|
||||||
CODE int (*poll_csma) (FAR struct ieee802154_phyif_s *phyif,
|
CODE int (*poll_csma) (FAR struct ieee802154_phyif_s *phyif,
|
||||||
FAR struct ieee802154_txdesc_s *tx_desc,
|
FAR struct ieee802154_txdesc_s *tx_desc,
|
||||||
@@ -183,12 +184,19 @@ struct ieee802154_phyif_s
|
|||||||
CODE int (*poll_gts) (FAR struct ieee802154_phyif_s *phyif,
|
CODE int (*poll_gts) (FAR struct ieee802154_phyif_s *phyif,
|
||||||
FAR struct ieee802154_txdesc_s *tx_desc,
|
FAR struct ieee802154_txdesc_s *tx_desc,
|
||||||
uint8_t *buf);
|
uint8_t *buf);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ieee802154_phyif_s
|
||||||
|
{
|
||||||
|
FAR const struct ieee802154_phyifops_s *ops;
|
||||||
|
|
||||||
/* Driver-specific information */
|
/* Driver-specific information */
|
||||||
|
|
||||||
void * priv;
|
void * priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ieee802154_radio_s; /* Forward reference */
|
||||||
|
|
||||||
struct ieee802154_radioops_s
|
struct ieee802154_radioops_s
|
||||||
{
|
{
|
||||||
CODE int (*bind) (FAR struct ieee802154_radio_s *dev,
|
CODE int (*bind) (FAR struct ieee802154_radio_s *dev,
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ struct ieee802154_privmac_s
|
|||||||
{
|
{
|
||||||
FAR struct ieee802154_radio_s *radio; /* Contained IEEE802.15.4 radio dev */
|
FAR struct ieee802154_radio_s *radio; /* Contained IEEE802.15.4 radio dev */
|
||||||
FAR const struct ieee802154_maccb_s *cb; /* Contained MAC callbacks */
|
FAR const struct ieee802154_maccb_s *cb; /* Contained MAC callbacks */
|
||||||
|
FAR struct ieee802154_phyif_s phyif; /* Interface to bind to radio */
|
||||||
|
|
||||||
sem_t excl_sem; /* Support exclusive access */
|
sem_t excl_sem; /* Support exclusive access */
|
||||||
|
|
||||||
@@ -225,6 +226,16 @@ struct mac802154_unsec_mhr_s
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static const struct ieee802154_phyifops_s mac802154_phyifops =
|
||||||
|
{
|
||||||
|
mac802154_poll_csma,
|
||||||
|
mac802154_poll_gts
|
||||||
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -330,6 +341,13 @@ MACHANDLE mac802154_create(FAR struct ieee802154_radio_s *radiodev)
|
|||||||
|
|
||||||
mac802154_defaultmib(mac);
|
mac802154_defaultmib(mac);
|
||||||
mac802154_applymib(mac);
|
mac802154_applymib(mac);
|
||||||
|
|
||||||
|
mac->phyif.ops = &mac802154_phyifops;
|
||||||
|
mac->phyif.priv = mac;
|
||||||
|
|
||||||
|
/* Bind our PHY interface to the radio */
|
||||||
|
|
||||||
|
radiodev->ops->bind(radiodev, mac->phyif);
|
||||||
|
|
||||||
return (MACHANDLE)mac;
|
return (MACHANDLE)mac;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user