ieee802.15.4: Changes from review of last PR

This commit is contained in:
Gregory Nutt 2017-04-17 09:53:58 -06:00
parent 9edf6c7b46
commit 6d3ec6e4a4
3 changed files with 31 additions and 33 deletions

View File

@ -268,7 +268,8 @@ static void mrf24j40_dopoll_csma(FAR struct ieee802154_radio_s *radio)
FAR struct mrf24j40_radio_s *dev = (FAR struct mrf24j40_radio_s *)radio; FAR struct mrf24j40_radio_s *dev = (FAR struct mrf24j40_radio_s *)radio;
/* Need to get exlusive access to the device so that we can use the copy /* Need to get exlusive access to the device so that we can use the copy
* buffer */ * buffer.
*/
while (sem_wait(&dev->exclsem) < 0) { } while (sem_wait(&dev->exclsem) < 0) { }
@ -318,13 +319,14 @@ static void mrf24j40_txnotify_gts(FAR struct ieee802154_radio_s *radio)
FAR struct mrf24j40_radio_s *dev = (FAR struct mrf24j40_radio_s *)radio; FAR struct mrf24j40_radio_s *dev = (FAR struct mrf24j40_radio_s *)radio;
/* Need to get exclusive access to the device so that we can use the copy /* Need to get exclusive access to the device so that we can use the copy
* buffer */ * buffer.
*/
while (sem_wait(dev->exclsem) < 0) { } while (sem_wait(dev->exclsem) < 0) { }
for(gts = 0; gts < MRF24J40_GTS_SLOTS, gts++) for (gts = 0; gts < MRF24J40_GTS_SLOTS, gts++)
{ {
if(!dev->gts_txdesc[i].busy) if (!dev->gts_txdesc[i].busy)
{ {
ret = dev->phyif->poll_gts(dev->phyif, &radio->gts_txdesc[i], ret = dev->phyif->poll_gts(dev->phyif, &radio->gts_txdesc[i],
&dev->tx_buf[0]); &dev->tx_buf[0]);

View File

@ -157,6 +157,7 @@ struct ieee802154_netradio_s
#endif #endif
/* IEEE802.15.4 Radio Interface Operations **********************************/ /* IEEE802.15.4 Radio Interface Operations **********************************/
struct ieee802154_txdesc_s struct ieee802154_txdesc_s
{ {
uint8_t psdu_handle; /* The psdu handle identifying the transaction */ uint8_t psdu_handle; /* The psdu handle identifying the transaction */
@ -171,12 +172,9 @@ struct ieee802154_phyif_s; /* Forward Reference */
struct ieee802154_phyifops_s 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, FAR uint8_t *buf);
uint8_t *buf);
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, FAR uint8_t *buf);
uint8_t *buf);
}; };
struct ieee802154_phyif_s struct ieee802154_phyif_s
@ -185,7 +183,7 @@ struct ieee802154_phyif_s
/* Driver-specific information */ /* Driver-specific information */
void * priv; FAR void * priv;
}; };
struct ieee802154_radio_s; /* Forward reference */ struct ieee802154_radio_s; /* Forward reference */
@ -194,13 +192,10 @@ struct ieee802154_radioops_s
{ {
CODE int (*bind) (FAR struct ieee802154_radio_s *dev, CODE int (*bind) (FAR struct ieee802154_radio_s *dev,
FAR const struct ieee802154_phyif_s *phyif); FAR const struct ieee802154_phyif_s *phyif);
CODE int (*ioctl)(FAR struct ieee802154_radio_s *ieee, int cmd, CODE int (*ioctl)(FAR struct ieee802154_radio_s *ieee, int cmd,
unsigned long arg); unsigned long arg);
CODE int (*rxenable)(FAR struct ieee802154_radio_s *dev, bool state, CODE int (*rxenable)(FAR struct ieee802154_radio_s *dev, bool state,
FAR struct ieee802154_packet_s *packet); FAR struct ieee802154_packet_s *packet);
CODE int (*txnotify_csma)(FAR struct ieee802154_radio_s *dev); CODE int (*txnotify_csma)(FAR struct ieee802154_radio_s *dev);
CODE int (*txnotify_gts)(FAR struct ieee802154_radio_s *dev); CODE int (*txnotify_gts)(FAR struct ieee802154_radio_s *dev);
}; };

View File

@ -66,10 +66,10 @@ struct mac802154_trans_s
uint8_t msdu_handle; uint8_t msdu_handle;
uint8_t *mhr_buf; FAR uint8_t *mhr_buf;
uint8_t mhr_len; uint8_t mhr_len;
uint8_t *d_buf; FAR uint8_t *d_buf;
uint8_t d_len; uint8_t d_len;
sem_t sem; sem_t sem;
@ -78,10 +78,11 @@ struct mac802154_trans_s
struct mac802154_unsec_mhr_s struct mac802154_unsec_mhr_s
{ {
uint8_t length; uint8_t length;
union { union
{
uint16_t frame_control; uint16_t frame_control;
uint8_t data[IEEE802154_MAX_UNSEC_MHR_OVERHEAD]; uint8_t data[IEEE802154_MAX_UNSEC_MHR_OVERHEAD];
}; } u;
}; };
/* The privmac structure holds the internal state of the MAC and is the /* The privmac structure holds the internal state of the MAC and is the
@ -530,7 +531,7 @@ int mac802154_req_data(MACHANDLE mac, FAR struct ieee802154_data_req_s *req)
* from the transmitted frame. [1] pg. 41. * from the transmitted frame. [1] pg. 41.
*/ */
if(req->dest_addr.panid == priv->addr.panid) if (req->dest_addr.panid == priv->addr.panid)
{ {
mhr.frame_control |= IEEE802154_FRAMECTRL_PANIDCOMP; mhr.frame_control |= IEEE802154_FRAMECTRL_PANIDCOMP;
} }