ieee802.15.4: Cosmetic changes from review of last PR.

This commit is contained in:
Gregory Nutt 2017-04-18 14:25:23 -06:00
parent ea224e8ddb
commit 35756d6295
3 changed files with 40 additions and 40 deletions

View file

@ -90,9 +90,9 @@
/* Definitions for PA control on high power modules */
#define MRF24J40_PA_AUTO 1
#define MRF24J40_PA_ED 2
#define MRF24J40_PA_SLEEP 3
#define MRF24J40_PA_AUTO 1
#define MRF24J40_PA_ED 2
#define MRF24J40_PA_SLEEP 3
#define MRF24J40_GTS_SLOTS 2
@ -111,7 +111,7 @@ struct mrf24j40_txdesc_s
struct mrf24j40_radio_s
{
struct ieee802154_radio_s radio; /* The public device instance */
struct ieee802154_radio_s radio; /* The public device instance */
/* Reference to the bound upper layer via the phyif interface */
@ -120,11 +120,11 @@ struct mrf24j40_radio_s
/* Low-level MCU-specific support */
FAR const struct mrf24j40_lower_s *lower;
FAR struct spi_dev_s *spi; /* Saved SPI interface instance */
FAR struct spi_dev_s *spi; /* Saved SPI interface instance */
struct work_s irqwork; /* For deferring interrupt work to work queue */
struct work_s pollwork; /* For deferring poll work to the work queue */
sem_t exclsem; /* Exclusive access to this struct */
sem_t exclsem; /* Exclusive access to this struct */
uint16_t panid; /* PAN identifier, FFFF = not set */
uint16_t saddr; /* short address, FFFF = not set */
@ -134,7 +134,7 @@ struct mrf24j40_radio_s
uint8_t paenabled; /* enable usage of PA */
uint8_t rxmode; /* Reception mode: Main, no CRC, promiscuous */
int32_t txpower; /* TX power in mBm = dBm/100 */
struct ieee802154_cca_s cca; /* Clear channel assessement method */
struct ieee802154_cca_s cca; /* Clear channel assessement method */
/* Buffer Allocations */
@ -171,9 +171,9 @@ static void mrf24j40_dopoll_csma(FAR void *arg);
static void mrf24j40_dopoll_gts(FAR void *arg);
static int mrf24j40_csma_setup(FAR struct mrf24j40_radio_s *dev,
uint8_t *buf, uint16_t buf_len);
uint8_t *buf, uint16_t buf_len);
static int mrf24j40_gts_setup(FAR struct mrf24j40_radio_s *dev, uint8_t gts,
uint8_t *buf, uint16_t buf_len);
uint8_t *buf, uint16_t buf_len);
/* IOCTL helpers */
@ -338,7 +338,6 @@ static void mrf24j40_dopoll_csma(FAR void *arg)
ret = dev->phyif->ops->poll_csma(dev->phyif,
&dev->csma_desc.pub,
&dev->tx_buf[0]);
if (ret > 0)
{
/* Now the txdesc is in use */
@ -352,7 +351,6 @@ static void mrf24j40_dopoll_csma(FAR void *arg)
}
/* Setup the transmit on the device */
}
sem_post(&dev->exclsem);
@ -435,7 +433,6 @@ static void mrf24j40_dopoll_gts(FAR void *arg)
{
ret = dev->phyif->ops->poll_gts(dev->phyif, &dev->gts_desc[gts].pub,
&dev->tx_buf[0]);
if (ret > 0)
{
/* Now the txdesc is in use */
@ -953,12 +950,11 @@ static int mrf24j40_setdevmode(FAR struct mrf24j40_radio_s *dev,
}
else
{
return -EINVAL;
return -EINVAL;
}
mrf24j40_setreg(dev->spi, MRF24J40_RXMCR, reg);
dev->devmode = mode;
return ret;
}
@ -974,7 +970,6 @@ static int mrf24j40_getdevmode(FAR struct mrf24j40_radio_s *dev,
FAR uint8_t *mode)
{
*mode = dev->devmode;
return OK;
}
@ -1074,7 +1069,6 @@ static int mrf24j40_gettxpower(FAR struct mrf24j40_radio_s *dev,
FAR int32_t *txpwr)
{
*txpwr = dev->txpower;
return OK;
}
@ -1134,7 +1128,6 @@ static int mrf24j40_getcca(FAR struct mrf24j40_radio_s *dev,
FAR struct ieee802154_cca_s *cca)
{
memcpy(cca, &dev->cca, sizeof(struct ieee802154_cca_s));
return OK;
}
@ -1285,7 +1278,7 @@ static int mrf24j40_ioctl(FAR struct ieee802154_radio_s *radio, int cmd,
return -ENOTTY;
}
return ret;
return ret;
}
/****************************************************************************
@ -1422,7 +1415,6 @@ static int mrf24j40_transmit(FAR struct ieee802154_radio_s *radio,
/* Trigger packet emission */
mrf24j40_setreg(dev->spi, MRF24J40_TXNCON, reg);
return ret;
}
@ -1473,11 +1465,11 @@ static void mrf24j40_irqwork_tx(FAR struct mrf24j40_radio_s *dev)
/* 1 means it failed, we want 1 to mean it worked. */
/*
#if 0
dev->radio.txok = (reg & MRF24J40_TXSTAT_TXNSTAT) != MRF24J40_TXSTAT_TXNSTAT;
dev->radio.txretries = (reg & MRF24J40_TXSTAT_X_MASK) >> MRF24J40_TXSTAT_X_SHIFT;
dev->radio.txbusy = (reg & MRF24J40_TXSTAT_CCAFAIL) == MRF24J40_TXSTAT_CCAFAIL;
*/
#endif
//wlinfo("TXSTAT%02X!\n", txstat);
#warning TODO report errors
@ -1568,7 +1560,9 @@ static void mrf24j40_irqwork_rx(FAR struct mrf24j40_radio_s *dev)
dev->radio.rxbuf->lqi = mrf24j40_getreg(dev->spi, addr++);
dev->radio.rxbuf->rssi = mrf24j40_getreg(dev->spi, addr++);
/* Reduce len by 2, we only receive frames with correct crc, no check required */
/* Reduce len by 2, we only receive frames with correct crc, no check
* required.
*/
dev->radio.rxbuf->len -= 2;

View file

@ -401,7 +401,8 @@ struct ieee802154_data_req_s
* to be transmitted by the MAC sublayer enitity
* Note: This could be a uint8_t but if anyone ever wants to use
* non-standard frame lengths, they may want a length larger than
* a uint8_t */
* a uint8_t.
*/
uint16_t msdu_length;
@ -611,7 +612,8 @@ struct ieee802154_assoc_rsp_s
struct ieee802154_assoc_conf_s
{
/* Associated device address ALWAYS passed in short address mode. The
* address will be IEEE802154_SADDR_UNSPEC if association was unsuccessful.
* address will be IEEE802154_SADDR_UNSPEC if association was
* unsuccessful.
*/
struct ieee802154_addr_s dev_addr;

View file

@ -245,12 +245,12 @@ static int mac802154_applymib(FAR struct ieee802154_privmac_s *priv);
/* IEEE 802.15.4 PHY Interface OPs */
static int mac802154_poll_csma(FAR struct ieee802154_phyif_s *phyif,
FAR struct ieee802154_txdesc_s *tx_desc,
uint8_t *buf);
FAR struct ieee802154_txdesc_s *tx_desc,
FAR uint8_t *buf);
static int mac802154_poll_gts(FAR struct ieee802154_phyif_s *phyif,
FAR struct ieee802154_txdesc_s *tx_desc,
uint8_t *buf);
FAR struct ieee802154_txdesc_s *tx_desc,
FAR uint8_t *buf);
/****************************************************************************
* Private Data
@ -301,6 +301,7 @@ static inline int mac802154_takesem(sem_t *sem)
static int mac802154_defaultmib(FAR struct ieee802154_privmac_s *priv)
{
/* TODO: Set all MAC fields to default values */
return OK;
}
@ -475,8 +476,9 @@ int mac802154_req_data(MACHANDLE mac, FAR struct ieee802154_data_req_s *req)
mhr.length = 2;
/* Do a preliminary check to make sure the MSDU isn't too long for even the
* best case */
/* Do a preliminary check to make sure the MSDU isn't too long for even
* the best case.
*/
if (req->msdu_length > IEEE802154_MAX_MAC_PAYLOAD_SIZE)
{
@ -492,8 +494,8 @@ int mac802154_req_data(MACHANDLE mac, FAR struct ieee802154_data_req_s *req)
mhr.u.frame_control |= IEEE802154_FRAME_DATA <<
IEEE802154_FRAMECTRL_SHIFT_FTYPE;
/* If the msduLength is greater than aMaxMACSafePayloadSize, the MAC sublayer
* will set the Frame Version to one. [1] pg. 118.
/* If the msduLength is greater than aMaxMACSafePayloadSize, the MAC
* sublayer will set the Frame Version to one. [1] pg. 118.
*/
if (req->msdu_length > IEEE802154_MAX_SAFE_MAC_PAYLOAD_SIZE)
@ -501,8 +503,8 @@ int mac802154_req_data(MACHANDLE mac, FAR struct ieee802154_data_req_s *req)
mhr.u.frame_control |= IEEE802154_FRAMECTRL_VERSION;
}
/* If the TXOptions parameter specifies that an acknowledged transmission is
* required, the AR field will be set appropriately, as described in
/* If the TXOptions parameter specifies that an acknowledged transmission
* is required, the AR field will be set appropriately, as described in
* 5.1.6.4 [1] pg. 118.
*/
@ -700,8 +702,8 @@ int mac802154_req_data(MACHANDLE mac, FAR struct ieee802154_data_req_s *req)
/* Called from interrupt level or worker thread with interrupts disabled */
static int mac802154_poll_csma(FAR struct ieee802154_phyif_s *phyif,
FAR struct ieee802154_txdesc_s *tx_desc,
uint8_t *buf)
FAR struct ieee802154_txdesc_s *tx_desc,
FAR uint8_t *buf)
{
FAR struct ieee802154_privmac_s *priv =
(FAR struct ieee802154_privmac_s *)&phyif->priv;
@ -711,7 +713,8 @@ static int mac802154_poll_csma(FAR struct ieee802154_phyif_s *phyif,
DEBUGASSERT(priv != 0);
/* Get exclusive access to the driver structure. We don't care about any
* signals so if we see one, just go back to trying to get access again */
* signals so if we see one, just go back to trying to get access again.
*/
while (mac802154_takesem(&priv->exclsem) != 0);
@ -751,8 +754,8 @@ static int mac802154_poll_csma(FAR struct ieee802154_phyif_s *phyif,
}
static int mac802154_poll_gts(FAR struct ieee802154_phyif_s *phyif,
FAR struct ieee802154_txdesc_s *tx_desc,
uint8_t *buf)
FAR struct ieee802154_txdesc_s *tx_desc,
FAR uint8_t *buf)
{
return 0;
}
@ -797,7 +800,8 @@ int mac802154_req_associate(MACHANDLE mac,
/* Set the macPANId */
/* Set either the macCoordExtendedAddress and macCoordShortAddress
* depending on the CoordAddrMode in the primitive */
* depending on the CoordAddrMode in the primitive.
*/
if (req->coord_addr.mode == IEEE802154_ADDRMODE_EXTENDED)
{