diff --git a/drivers/wireless/ieee802154/mrf24j40.c b/drivers/wireless/ieee802154/mrf24j40.c index 90fd913334..b08524cd4d 100644 --- a/drivers/wireless/ieee802154/mrf24j40.c +++ b/drivers/wireless/ieee802154/mrf24j40.c @@ -103,12 +103,11 @@ #define MRF24J40_GTS_SLOTS 2 -/* - * Formula for calculating default macMaxFrameWaitTime is on pg. 130 - * +/* Formula for calculating default macMaxFrameWaitTime is on pg. 130 + * * For PHYs other than CSS and UWB, the attribute phyMaxFrameDuration is given by: * - * phyMaxFrameDuration = phySHRDuration + + * phyMaxFrameDuration = phySHRDuration + * ceiling([aMaxPHYPacketSize + 1] x phySymbolsPerOctet) * * where ceiling() is a function that returns the smallest integer value greater @@ -335,7 +334,7 @@ static int mrf24j40_txnotify(FAR struct ieee802154_radio_s *radio, bool gts) * * Description: * Transmit a packet without regard to supeframe structure after a certain - * number of symbols. This function is used to send Data Request responses. + * number of symbols. This function is used to send Data Request responses. * It can also be used to send data immediately if the delay is set to 0. * * Parameters: @@ -354,7 +353,7 @@ static int mrf24j40_txdelayed(FAR struct ieee802154_radio_s *radio, { FAR struct mrf24j40_radio_s *dev = (FAR struct mrf24j40_radio_s *)radio; uint8_t reg; - + /* Get exclusive access to the radio device */ if (sem_wait(&dev->exclsem) != 0) @@ -439,21 +438,25 @@ static int mrf24j40_get_attr(FAR struct ieee802154_radio_s *radio, ret = IEEE802154_STATUS_SUCCESS; } break; + case IEEE802154_ATTR_MAC_MAX_FRAME_WAITTIME: { attrval->mac.max_frame_waittime = dev->max_frame_waittime; ret = IEEE802154_STATUS_SUCCESS; } break; + case IEEE802154_ATTR_PHY_SYMBOL_DURATION: { attrval->phy.symdur_picosec = MRF24J40_SYMBOL_DURATION_PS; ret = IEEE802154_STATUS_SUCCESS; } break; + default: ret = IEEE802154_STATUS_UNSUPPORTED_ATTRIBUTE; } + return ret; } @@ -472,32 +475,36 @@ static int mrf24j40_set_attr(FAR struct ieee802154_radio_s *radio, ret = IEEE802154_STATUS_SUCCESS; } break; + case IEEE802154_ATTR_MAC_SHORT_ADDRESS: { mrf24j40_setsaddr(dev, attrval->mac.saddr); ret = IEEE802154_STATUS_SUCCESS; } break; + case IEEE802154_ATTR_MAC_EXTENDED_ADDR: { mrf24j40_seteaddr(dev, &attrval->mac.eaddr[0]); ret = IEEE802154_STATUS_SUCCESS; } break; + case IEEE802154_ATTR_MAC_PROMISCUOUS_MODE: { if (attrval->mac.promisc_mode) { - mrf24j40_setrxmode(dev, MRF24J40_RXMODE_PROMISC); + mrf24j40_setrxmode(dev, MRF24J40_RXMODE_PROMISC); } else { - mrf24j40_setrxmode(dev, MRF24J40_RXMODE_NORMAL); + mrf24j40_setrxmode(dev, MRF24J40_RXMODE_NORMAL); } ret = IEEE802154_STATUS_SUCCESS; } break; + case IEEE802154_ATTR_MAC_RX_ON_WHEN_IDLE: { dev->rxonidle = attrval->mac.rxonidle; @@ -505,6 +512,7 @@ static int mrf24j40_set_attr(FAR struct ieee802154_radio_s *radio, ret = IEEE802154_STATUS_SUCCESS; } break; + default: ret = IEEE802154_STATUS_UNSUPPORTED_ATTRIBUTE; break; @@ -587,7 +595,7 @@ static void mrf24j40_dopoll_csma(FAR void *arg) if (!dev->csma_busy) { len = dev->radiocb->poll(dev->radiocb, false, &dev->csma_desc); - + if (len > 0) { /* Now the txdesc is in use */ @@ -1594,7 +1602,7 @@ static void mrf24j40_irqwork_txnorm(FAR struct mrf24j40_radio_s *dev) * indicates if the failed transmission was due to the channel busy * (CSMA-CA timed out). */ - + if (reg & MRF24J40_TXSTAT_CCAFAIL) { status = IEEE802154_STATUS_CHANNEL_ACCESS_FAILURE; @@ -1608,7 +1616,7 @@ static void mrf24j40_irqwork_txnorm(FAR struct mrf24j40_radio_s *dev) { status = IEEE802154_STATUS_SUCCESS; } - + framepending = (mrf24j40_getreg(dev->spi, MRF24J40_TXNCON) & MRF24J40_TXNCON_FPSTAT); @@ -1853,7 +1861,7 @@ static void mrf24j40_irqworker(FAR void *arg) /* As of now the only use for the MAC timer is for delayed transactions. * Therefore, all we do here is trigger the TX norm FIFO */ - + mrf24j40_norm_trigger(dev); /* Timers are one-shot, so disable the interrupt */ @@ -1890,7 +1898,7 @@ static void mrf24j40_irqworker(FAR void *arg) mrf24j40_irqwork_txgts(dev, 1); } - + /* Unlock the radio device */ sem_post(&dev->exclsem); @@ -2014,8 +2022,8 @@ FAR struct ieee802154_radio_s *mrf24j40_init(FAR struct spi_dev_s *spi, /* For now, we want to always just have the frame pending bit set when * acknowledging a Data Request command. The standard says that the coordinator * can do this if it needs time to figure out whether it has data or not - */ - + */ + mrf24j40_setreg(dev->spi, MRF24J40_ACKTMOUT, 0x39 | MRF24J40_ACKTMOUT_DRPACK); dev->lower->enable(dev->lower, true); diff --git a/include/nuttx/wireless/ieee802154/ieee802154_mac.h b/include/nuttx/wireless/ieee802154/ieee802154_mac.h index ac51825c9a..d9732d4dd5 100644 --- a/include/nuttx/wireless/ieee802154/ieee802154_mac.h +++ b/include/nuttx/wireless/ieee802154/ieee802154_mac.h @@ -202,7 +202,7 @@ enum ieee802154_status_e { IEEE802154_STATUS_SUCCESS = 0, IEEE802154_STATUS_FAILURE, /* This value is not outlined in the standard. It - * is a catch-all for any failures that are not + * is a catch-all for any failures that are not * outlined in the standard */ IEEE802154_STATUS_BEACON_LOSS, @@ -228,7 +228,7 @@ enum ieee802154_status_e IEEE802154_STATUS_UNSUPPORTED_ATTRIBUTE, }; -static const char *IEEE802154_STATUS_STRING[] = +static const char *IEEE802154_STATUS_STRING[] = { "Success", "Failure", @@ -414,7 +414,7 @@ struct ieee802154_addr_s enum ieee802154_addrmode_e mode; - uint16_t panid; /* PAN identifier, can be + uint16_t panid; /* PAN identifier, can be * IEEE802154_PAN_UNSPEC */ uint16_t saddr; /* short address */ uint8_t eaddr[IEEE802154_EADDR_LEN]; /* extended address */ @@ -679,13 +679,13 @@ struct ieee802154_data_conf_s * the beginning of the ranging exchange */ - uint32_t rng_counter_start; + uint32_t rng_counter_start; /* A count of the time units corresponding to an RMARKER at the antenna at * end of the ranging exchange */ - uint32_t rng_counter_stop; + uint32_t rng_counter_stop; /* A count of the time units in a message exchange over which the tracking * offset was measured @@ -698,10 +698,10 @@ struct ieee802154_data_conf_s */ uint32_t rng_offset; - - /* The Figure of Merit (FoM) characterizing the ranging measurement */ - uint8_t rng_fom; + /* The Figure of Merit (FoM) characterizing the ranging measurement */ + + uint8_t rng_fom; #endif }; @@ -1250,12 +1250,12 @@ struct ieee802154_get_req_s * Description: * Attempts to write the given value to the indicated PIB attribute. * - * NOTE: The standard specifies that confirmation should be indicated via + * NOTE: The standard specifies that confirmation should be indicated via * the asynchronous MLME-SET.confirm primitve. However, in our implementation * there is no reason not to synchronously return the status immediately. - * Therefore, we do merge the functionality of the MLME-SET.request and + * Therefore, we do merge the functionality of the MLME-SET.request and * MLME-SET.confirm primitives together. - * + * *****************************************************************************/ struct ieee802154_set_req_s diff --git a/wireless/ieee802154/mac802154.c b/wireless/ieee802154/mac802154.c index 51395e531b..755cdc035e 100644 --- a/wireless/ieee802154/mac802154.c +++ b/wireless/ieee802154/mac802154.c @@ -96,7 +96,7 @@ static void mac802154_purge_worker(FAR void *arg); /* Watchdog Timeout Functions */ static void mac802154_timeout_expiry(int argc, uint32_t arg, ...); - + static uint32_t mac802154_symtoticks(FAR struct ieee802154_privmac_s *priv, uint32_t symbols); @@ -133,7 +133,7 @@ static void mac802154_resetqueues(FAR struct ieee802154_privmac_s *priv) sem_init(&priv->txdesc_sem, 0, CONFIG_MAC802154_NTXDESC); /* Initialize the notifcation allocation pool */ - + mac802154_notifpool_init(priv); } @@ -169,7 +169,7 @@ int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv, */ ret = sem_trywait(&priv->txdesc_sem); - + if (ret == OK) { *txdesc = (FAR struct ieee802154_txdesc_s *)sq_remfirst(&priv->txdesc_queue); @@ -195,8 +195,8 @@ int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv, /* If we've taken a count from the semaphore, we have "reserved" the struct * but now we need to pop it off of the free list. We need to re-lock the * MAC in order to ensure this happens correctly. - */ - + */ + ret = mac802154_takesem(&priv->exclsem, allow_interrupt); if (ret < 0) { @@ -205,10 +205,10 @@ int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv, } /* We can now safely unlink the next free structure from the free list */ - + *txdesc = (FAR struct ieee802154_txdesc_s *)sq_remfirst(&priv->txdesc_queue); } - + /* We have now successfully allocated the tx descriptor. Now we need to allocate * the notification for the data confirmation that gets passed along with the * tx descriptor. These are allocated together, but not freed together. @@ -220,7 +220,7 @@ int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv, /* The mac802154_notif_alloc function follows the same rules as this * function. If it returns -EINTR, the MAC layer is already released */ - + /* We need to free the txdesc */ mac802154_txdesc_free(priv, *txdesc); @@ -228,7 +228,7 @@ int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv, } (*txdesc)->conf = ¬if->u.dataconf; - + return OK; } @@ -242,7 +242,7 @@ int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv, * time. * * Assumptions: - * Called with the MAC locked + * Called with the MAC locked * ****************************************************************************/ @@ -267,7 +267,7 @@ void mac802154_setupindirect(FAR struct ieee802154_privmac_s *priv, if (priv->beaconorder < 15) { - symbols = priv->trans_persisttime * + symbols = priv->trans_persisttime * (IEEE802154_BASE_SUPERFRAME_DURATION * (1 << priv->beaconorder)); } else @@ -406,7 +406,7 @@ static int mac802154_poll(FAR const struct ieee802154_radiocb_s *radiocb, { return (*txdesc)->frame->io_len; } - + return 0; } @@ -554,9 +554,9 @@ static void mac802154_txdone_worker(FAR void *arg) default: /* We can deallocate the data conf notification as it is no * longer needed. We can't use the public function here - * since we already have the MAC locked. - */ - + * since we already have the MAC locked. + */ + privnotif->flink = priv->notif_free; priv->notif_free = privnotif; break; @@ -567,9 +567,9 @@ static void mac802154_txdone_worker(FAR void *arg) { /* We can deallocate the data conf notification as it is no longer * needed. We can't use the public function here since we already - * have the MAC locked. - */ - + * have the MAC locked. + */ + privnotif->flink = priv->notif_free; priv->notif_free = privnotif; } @@ -678,7 +678,7 @@ static void mac802154_rxframe_worker(FAR void *arg) frame = ind->frame; - /* Set a local pointer to the frame control then move the offset past + /* Set a local pointer to the frame control then move the offset past * the frame control field */ @@ -716,7 +716,7 @@ static void mac802154_rxframe_worker(FAR void *arg) } else if (ind->dest.mode == IEEE802154_ADDRMODE_EXTENDED) { - memcpy(&ind->dest.eaddr[0], &frame->io_data[frame->io_offset], + memcpy(&ind->dest.eaddr[0], &frame->io_data[frame->io_offset], IEEE802154_EADDR_LEN); frame->io_offset += IEEE802154_EADDR_LEN; } @@ -739,7 +739,7 @@ static void mac802154_rxframe_worker(FAR void *arg) memcpy(&ind->src.panid, &frame->io_data[frame->io_offset], 2); frame->io_offset += 2; } - + if (ind->src.mode == IEEE802154_ADDRMODE_SHORT) { memcpy(&ind->src.saddr, &frame->io_data[frame->io_offset], 2); @@ -747,7 +747,7 @@ static void mac802154_rxframe_worker(FAR void *arg) } else if (ind->src.mode == IEEE802154_ADDRMODE_EXTENDED) { - memcpy(&ind->src.eaddr[0], &frame->io_data[frame->io_offset], + memcpy(&ind->src.eaddr[0], &frame->io_data[frame->io_offset], IEEE802154_EADDR_LEN); frame->io_offset += 8; } @@ -755,7 +755,7 @@ static void mac802154_rxframe_worker(FAR void *arg) ftype = (*frame_ctrl & IEEE802154_FRAMECTRL_FTYPE) >> IEEE802154_FRAMECTRL_SHIFT_FTYPE; - + switch (ftype) { case IEEE802154_FRAME_DATA: @@ -770,9 +770,9 @@ static void mac802154_rxframe_worker(FAR void *arg) * field after the MHR. Consu;me the byte by increasing offset so that * subsequent functions can start from the byte after the command ID. */ - + uint8_t cmdtype = frame->io_data[frame->io_offset++]; - + switch (cmdtype) { case IEEE802154_CMD_ASSOC_REQ: @@ -797,7 +797,7 @@ static void mac802154_rxframe_worker(FAR void *arg) case IEEE802154_CMD_GTS_REQ: break; } - + /* Free the data indication struct from the pool */ ieee802154_ind_free(ind); @@ -818,7 +818,7 @@ static void mac802154_rxframe_worker(FAR void *arg) case IEEE802154_FRAME_ACK: { - /* The radio layer is responsible for handling all ACKs and retries. + /* The radio layer is responsible for handling all ACKs and retries. * If for some reason an ACK gets here, just throw it out. */ @@ -834,7 +834,7 @@ static void mac802154_rxframe_worker(FAR void *arg) * Name: mac802154_rx_dataframe * * Description: - * Function called from the generic RX Frame worker to parse and handle the + * Function called from the generic RX Frame worker to parse and handle the * reception of a data frame. * ****************************************************************************/ @@ -860,14 +860,14 @@ static void mac802154_rx_dataframe(FAR struct ieee802154_privmac_s *priv, * wouldn't be performing a POLL operation. Meaning: * * If the current operation is POLL, we aren't the PAN coordinator - * so the incoming frame CAN'T + * so the incoming frame CAN'T * * FIXME: Fix documentation */ if (priv->curr_op == MAC802154_OP_POLL || priv->curr_op == MAC802154_OP_ASSOC) { - /* If we are in promiscuous mode, we need to check if the + /* If we are in promiscuous mode, we need to check if the * frame is even for us first. If the address is not ours, * then handle the frame like a normal transaction. */ @@ -922,7 +922,7 @@ static void mac802154_rx_dataframe(FAR struct ieee802154_privmac_s *priv, /* If we've gotten this far, the frame is our extracted data. Cancel the * timeout */ - + mac802154_timercancel(priv); /* If a frame is received from the coordinator with a zero length payload @@ -931,7 +931,7 @@ static void mac802154_rx_dataframe(FAR struct ieee802154_privmac_s *priv, */ mac802154_notif_alloc(priv, ¬if, false); - + if (priv->curr_op == MAC802154_OP_POLL) { notif->notiftype = IEEE802154_NOTIFY_CONF_POLL; @@ -941,7 +941,7 @@ static void mac802154_rx_dataframe(FAR struct ieee802154_privmac_s *priv, ieee802154_ind_free(ind); notif->u.pollconf.status = IEEE802154_STATUS_NO_DATA; } - else + else { notif->u.pollconf.status = IEEE802154_STATUS_SUCCESS; } @@ -951,7 +951,7 @@ static void mac802154_rx_dataframe(FAR struct ieee802154_privmac_s *priv, /* If we ever receive a data frame back as a response to the * association request, we assume it means there wasn't any data. */ - + notif->notiftype = IEEE802154_NOTIFY_CONF_ASSOC; notif->u.assocconf.status = IEEE802154_STATUS_NO_DATA; } @@ -961,11 +961,11 @@ static void mac802154_rx_dataframe(FAR struct ieee802154_privmac_s *priv, priv->curr_op = MAC802154_OP_NONE; priv->cmd_desc = NULL; mac802154_givesem(&priv->op_sem); - + /* Release the MAC */ mac802154_givesem(&priv->exclsem); - + priv->cb->notify(priv->cb, notif); /* If there was data, pass it along */ @@ -1004,7 +1004,7 @@ notify_without_lock: * Name: mac802154_rx_datareq * * Description: - * Function called from the generic RX Frame worker to parse and handle the + * Function called from the generic RX Frame worker to parse and handle the * reception of an Data Request MAC command frame. * ****************************************************************************/ @@ -1031,7 +1031,7 @@ static void mac802154_rx_datareq(FAR struct ieee802154_privmac_s *priv, */ txdesc = (FAR struct ieee802154_txdesc_s *)sq_peek(&priv->indirect_queue); - + if (txdesc == NULL) { goto no_data; @@ -1097,10 +1097,10 @@ no_data: */ /* Allocate an IOB to put the frame in */ - + iob = iob_alloc(false); DEBUGASSERT(iob != NULL); - + iob->io_flink = NULL; iob->io_len = 0; iob->io_offset = 0; @@ -1127,7 +1127,7 @@ no_data: iob->io_data[iob->io_len++] = priv->dsn++; - /* Use the source address information from the received data request to + /* Use the source address information from the received data request to * respond. */ @@ -1221,7 +1221,7 @@ static uint32_t mac802154_symtoticks(FAR struct ieee802154_privmac_s *priv, &attrval); /* After this step, ret represents microseconds */ - + ret = ((uint64_t)attrval.phy.symdur_picosec * symbols) / (1000 * 1000); /* This method should only be used for things that can be late. For instance, @@ -1238,7 +1238,7 @@ static uint32_t mac802154_symtoticks(FAR struct ieee802154_privmac_s *priv, ret = ret/USEC_PER_TICK; ret++; } - + return ret; } @@ -1403,6 +1403,6 @@ MACHANDLE mac802154_create(FAR struct ieee802154_radio_s *radiodev) memcpy(&mac->addr.eaddr, &eaddr[0], IEEE802154_EADDR_LEN); mac->radio->set_attr(mac->radio, IEEE802154_ATTR_MAC_EXTENDED_ADDR, (union ieee802154_attr_u *)&eaddr[0]); - + return (MACHANDLE)mac; } diff --git a/wireless/ieee802154/mac802154.h b/wireless/ieee802154/mac802154.h index 8eb104d5d3..40d00c9d69 100644 --- a/wireless/ieee802154/mac802154.h +++ b/wireless/ieee802154/mac802154.h @@ -139,7 +139,7 @@ int mac802154_get_mhrlen(MACHANDLE mac, * ****************************************************************************/ -int mac802154_req_data(MACHANDLE mac, +int mac802154_req_data(MACHANDLE mac, FAR const struct ieee802154_frame_meta_s *meta, FAR struct iob_s *frame); @@ -151,10 +151,10 @@ int mac802154_req_data(MACHANDLE mac, * an MSDU from the transaction queue. Confirmation is returned via * the struct mac802154_maccb_s->conf_purge callback. * - * NOTE: The standard specifies that confirmation should be indicated via + * NOTE: The standard specifies that confirmation should be indicated via * the asynchronous MLME-PURGE.confirm primitve. However, in our * implementation we synchronously return the status from the request. - * Therefore, we merge the functionality of the MLME-PURGE.request and + * Therefore, we merge the functionality of the MLME-PURGE.request and * MLME-PURGE.confirm primitives together. * ****************************************************************************/ @@ -279,9 +279,9 @@ int mac802154_req_get(MACHANDLE mac, enum ieee802154_attr_e , * * Description: * The MLME-SET.request primitive attempts to write the given value to the - * indicated MAC PIB attribute. + * indicated MAC PIB attribute. * - * NOTE: The standard specifies that confirmation should be indicated via + * NOTE: The standard specifies that confirmation should be indicated via * the asynchronous MLME-SET.confirm primitve. However, in our implementation * we synchronously return the status from the request. Therefore, we do merge * the functionality of the MLME-SET.request and MLME-SET.confirm primitives diff --git a/wireless/ieee802154/mac802154_assoc.c b/wireless/ieee802154/mac802154_assoc.c index 0e4eee7238..d0d77302a2 100644 --- a/wireless/ieee802154/mac802154_assoc.c +++ b/wireless/ieee802154/mac802154_assoc.c @@ -108,7 +108,7 @@ int mac802154_req_associate(MACHANDLE mac, priv->curr_cmd = IEEE802154_CMD_ASSOC_REQ; /* Get exclusive access to the MAC */ - + ret = mac802154_takesem(&priv->exclsem, true); if (ret < 0) { @@ -155,7 +155,7 @@ int mac802154_req_associate(MACHANDLE mac, /* Copy in the capabilities information bitfield */ - priv->devmode = (req->capabilities.devtype) ? + priv->devmode = (req->capabilities.devtype) ? IEEE802154_DEVMODE_COORD : IEEE802154_DEVMODE_ENDPOINT; /* Unlike other attributes, we can't simply cast this one since it is a bit @@ -167,8 +167,8 @@ int mac802154_req_associate(MACHANDLE mac, rxonidle = req->capabilities.rxonidle; priv->radio->set_attr(priv->radio, IEEE802154_ATTR_MAC_RX_ON_WHEN_IDLE, - (FAR const union ieee802154_attr_u *)&rxonidle); - + (FAR const union ieee802154_attr_u *)&rxonidle); + /* Allocate an IOB to put the frame in */ iob = iob_alloc(false); @@ -231,8 +231,8 @@ int mac802154_req_associate(MACHANDLE mac, IEEE802154_EADDR_LEN); iob->io_len += IEEE802154_EADDR_LEN; } - - /* The Source PAN Identifier field shall contain the broadcast PAN identifier.*/ + + /* The Source PAN Identifier field shall contain the broadcast PAN identifier.*/ u16 = (uint16_t *)&iob->io_data[iob->io_len]; *u16 = IEEE802154_SADDR_BCAST; @@ -249,19 +249,19 @@ int mac802154_req_associate(MACHANDLE mac, iob->io_data[iob->io_len++] = IEEE802154_CMD_ASSOC_REQ; /* Copy in the capability information bits */ - + iob->io_data[iob->io_len] = 0; - iob->io_data[iob->io_len] |= (req->capabilities.devtype << + iob->io_data[iob->io_len] |= (req->capabilities.devtype << IEEE802154_CAPABILITY_SHIFT_DEVTYPE); - iob->io_data[iob->io_len] |= (req->capabilities.powersource << + iob->io_data[iob->io_len] |= (req->capabilities.powersource << IEEE802154_CAPABILITY_SHIFT_PWRSRC); - iob->io_data[iob->io_len] |= (req->capabilities.rxonidle << + iob->io_data[iob->io_len] |= (req->capabilities.rxonidle << IEEE802154_CAPABILITY_SHIFT_RXONIDLE); - iob->io_data[iob->io_len] |= (req->capabilities.security << + iob->io_data[iob->io_len] |= (req->capabilities.security << IEEE802154_CAPABILITY_SHIFT_SECURITY); - iob->io_data[iob->io_len] |= (req->capabilities.allocaddr << + iob->io_data[iob->io_len] |= (req->capabilities.allocaddr << IEEE802154_CAPABILITY_SHIFT_ALLOCADDR); - + iob->io_len++; txdesc->frame = iob; @@ -272,7 +272,7 @@ int mac802154_req_associate(MACHANDLE mac, */ memcpy(&txdesc->destaddr, &req->coordaddr, sizeof(struct ieee802154_addr_s)); - + /* Save a reference of the tx descriptor */ priv->cmd_desc = txdesc; @@ -310,7 +310,7 @@ int mac802154_resp_associate(MACHANDLE mac, FAR struct iob_s *iob; FAR uint16_t *u16; int ret; - + /* Allocate an IOB to put the frame in */ iob = iob_alloc(false); @@ -352,14 +352,14 @@ int mac802154_resp_associate(MACHANDLE mac, /* In accordance with this value of the PAN ID Compression field, the * Destination PAN Identifier field shall contain the value of macPANId, while * the Source PAN Identifier field shall be omitted. [1] pg. 69 - */ + */ memcpy(&iob->io_data[iob->io_len], &priv->addr.panid, 2); iob->io_len += 2; /* The Destination Address field shall contain the extended address of the * device requesting association. [1] pg. 69 */ - + memcpy(&iob->io_data[iob->io_len], &resp->devaddr[0], IEEE802154_EADDR_LEN); iob->io_len += IEEE802154_EADDR_LEN; @@ -382,7 +382,7 @@ int mac802154_resp_associate(MACHANDLE mac, iob->io_data[iob->io_len++] = resp->status; /* Get exclusive access to the MAC */ - + ret = mac802154_takesem(&priv->exclsem, true); if (ret < 0) { @@ -436,7 +436,7 @@ void mac802154_txdone_assocreq(FAR struct ieee802154_privmac_s *priv, enum ieee802154_status_e status; FAR struct mac802154_notif_s *privnotif = (FAR struct mac802154_notif_s *)txdesc->conf; - FAR struct ieee802154_notif_s *notif = &privnotif->pub; + FAR struct ieee802154_notif_s *notif = &privnotif->pub; FAR struct ieee802154_txdesc_s *respdesc; if(txdesc->conf->status != IEEE802154_STATUS_SUCCESS) @@ -445,7 +445,7 @@ void mac802154_txdone_assocreq(FAR struct ieee802154_privmac_s *priv, * channel access failure, the MAC sublayer shall notify the next * higher layer. [1] pg. 33 */ - + /* We can actually high-jack the data conf notification since it * is allocated as an ieee80215_notif_s anyway. Before we overwrite * any data though, we need to get the status from the data @@ -500,7 +500,7 @@ void mac802154_txdone_assocreq(FAR struct ieee802154_privmac_s *priv, * can inform the next highest layer if the association attempt fails * due to NO_DATA. */ - + mac802154_timerstart(priv, priv->resp_waittime*IEEE802154_BASE_SUPERFRAME_DURATION, mac802154_timeout_assoc); @@ -518,9 +518,9 @@ void mac802154_txdone_assocreq(FAR struct ieee802154_privmac_s *priv, /* We can deallocate the data conf notification as it is no longer * needed. We can't use the public function here since we already - * have the MAC locked. - */ - + * have the MAC locked. + */ + privnotif->flink = priv->notif_free; priv->notif_free = privnotif; } @@ -545,7 +545,7 @@ void mac802154_txdone_datareq_assoc(FAR struct ieee802154_privmac_s *priv, enum ieee802154_status_e status; FAR struct mac802154_notif_s *privnotif = (FAR struct mac802154_notif_s *)txdesc->conf; - FAR struct ieee802154_notif_s *notif = &privnotif->pub; + FAR struct ieee802154_notif_s *notif = &privnotif->pub; /* If the data request failed to be sent, notify the next layer * that the association has failed. @@ -610,14 +610,14 @@ void mac802154_txdone_datareq_assoc(FAR struct ieee802154_privmac_s *priv, * the timer, otherwise it will expire and we will notify the * next highest layer of the failure. */ - + mac802154_timerstart(priv, priv->max_frame_waittime, mac802154_timeout_assoc); /* We can deallocate the data conf notification as it is no longer * needed. We can't use the public function here since we already - * have the MAC locked. - */ + * have the MAC locked. + */ privnotif->flink = priv->notif_free; priv->notif_free = privnotif; @@ -629,7 +629,7 @@ void mac802154_txdone_datareq_assoc(FAR struct ieee802154_privmac_s *priv, * Name: mac802154_rx_assocreq * * Description: - * Function called from the generic RX Frame worker to parse and handle the + * Function called from the generic RX Frame worker to parse and handle the * reception of an Association Request MAC command frame. * ****************************************************************************/ @@ -654,7 +654,7 @@ void mac802154_rx_assocreq(FAR struct ieee802154_privmac_s *priv, * addressing mode set to extended mode. Throw out any request received * without addressing set to extended */ - + if (ind->src.mode != IEEE802154_ADDRMODE_EXTENDED) { goto errout_with_sem; @@ -664,7 +664,7 @@ void mac802154_rx_assocreq(FAR struct ieee802154_privmac_s *priv, memcpy(¬if->u.assocind.devaddr[0], &ind->src.eaddr[0], sizeof(struct ieee802154_addr_s)); - + /* Copy in the capability information from the frame to the notification */ cap = frame->io_data[frame->io_offset++]; @@ -702,7 +702,7 @@ errout_with_sem: * Name: mac802154_rx_assocresp * * Description: - * Function called from the generic RX Frame worker to parse and handle the + * Function called from the generic RX Frame worker to parse and handle the * reception of an Association Response MAC command frame. * ****************************************************************************/ @@ -721,7 +721,7 @@ void mac802154_rx_assocresp(FAR struct ieee802154_privmac_s *priv, { return; } - + /* Cancel the timeout used if we didn't get a response */ mac802154_timercancel(priv); @@ -744,7 +744,7 @@ void mac802154_rx_assocresp(FAR struct ieee802154_privmac_s *priv, priv->radio->set_attr(priv->radio, IEEE802154_ATTR_MAC_SHORT_ADDRESS, (FAR union ieee802154_attr_u *)&priv->addr.saddr); - + /* A Short Address field value equal to 0xfffe shall indicate that the device * has been successfully associated with a PAN but has not been allocated a * short address. In this case, the device shall communicate on the PAN using @@ -757,7 +757,7 @@ void mac802154_rx_assocresp(FAR struct ieee802154_privmac_s *priv, priv->addr.mode = IEEE802154_ADDRMODE_SHORT; } - + /* Parse the status from the response */ notif->u.assocconf.status = frame->io_data[frame->io_offset++]; @@ -813,7 +813,7 @@ static void mac802154_timeout_assoc(FAR struct ieee802154_privmac_s *priv) * in 6.2.2.4, with a status of NO_DATA, and the association attempt * shall be deemed a failure. [1] pg. 33 */ - + /* Allocate a notification struct to pass to the next highest layer. * Don't allow EINTR to interrupt. */ @@ -833,7 +833,7 @@ static void mac802154_timeout_assoc(FAR struct ieee802154_privmac_s *priv) notif->notiftype = IEEE802154_NOTIFY_CONF_ASSOC; notif->u.assocconf.status = IEEE802154_STATUS_NO_DATA; notif->u.assocconf.saddr = IEEE802154_SADDR_UNSPEC; - + priv->cb->notify(priv->cb, notif); } @@ -844,7 +844,7 @@ static void mac802154_timeout_assoc(FAR struct ieee802154_privmac_s *priv) * Send a data request to the coordinator to extract the association response. * * Assumptions: - * MAC is locked when called. + * MAC is locked when called. * * TODO: Can this be used for general data extraction? * @@ -858,30 +858,30 @@ static FAR struct ieee802154_txdesc_s * FAR uint16_t *u16; /* Allocate an IOB to put the frame in */ - + iob = iob_alloc(false); DEBUGASSERT(iob != NULL); - + iob->io_flink = NULL; iob->io_len = 0; iob->io_offset = 0; iob->io_pktlen = 0; - /* Allocate a tx descriptor */ + /* Allocate a tx descriptor */ mac802154_txdesc_alloc(priv, &txdesc, false); priv->curr_cmd = IEEE802154_CMD_DATA_REQ; /* Get a uin16_t reference to the first two bytes. ie frame control field */ - + u16 = (FAR uint16_t *)&iob->io_data[0]; - + *u16 = (IEEE802154_FRAME_COMMAND << IEEE802154_FRAMECTRL_SHIFT_FTYPE); *u16 |= IEEE802154_FRAMECTRL_ACKREQ; *u16 |= (priv->coordaddr.mode << IEEE802154_FRAMECTRL_SHIFT_DADDR); *u16 |= (IEEE802154_ADDRMODE_EXTENDED << IEEE802154_FRAMECTRL_SHIFT_SADDR); - + /* If the Destination Addressing Mode field is set to indicate that * destination addressing information is not present, the PAN ID Compression * field shall be set to zero and the source PAN identifier shall contain the @@ -893,32 +893,32 @@ static FAR struct ieee802154_txdesc_s * * The destination address for a data request to extract an assoication request * should never be set to none. So we always set the PAN ID compression field */ - + DEBUGASSERT(priv->coordaddr.mode != IEEE802154_ADDRMODE_NONE); - + *u16 |= IEEE802154_FRAMECTRL_PANIDCOMP; - + iob->io_len = 2; - + /* Each time a data or a MAC command frame is generated, the MAC sublayer * shall copy the value of macDSN into the Sequence Number field of the * MHR of the outgoing frame and then increment it by one. [1] pg. 40. */ - + iob->io_data[iob->io_len++] = priv->dsn++; - + /* The Destination PAN Identifier field shall contain the identifier of * the PAN to which to associate. [1] pg. 68 */ - + memcpy(&iob->io_data[iob->io_len], &priv->coordaddr.panid, 2); iob->io_len += 2; - + /* The Destination Address field shall contain the address from the * beacon frame that was transmitted by the coordinator to which the * association request command is being sent. [1] pg. 68 */ - + if (priv->coordaddr.mode == IEEE802154_ADDRMODE_SHORT) { memcpy(&iob->io_data[iob->io_len], &priv->coordaddr.saddr, 2); @@ -930,9 +930,9 @@ static FAR struct ieee802154_txdesc_s * IEEE802154_EADDR_LEN); iob->io_len += IEEE802154_EADDR_LEN; } - + /* The Source Address field shall contain the value of macExtendedAddress. */ - + memcpy(&iob->io_data[iob->io_len], &priv->addr.eaddr[0], IEEE802154_EADDR_LEN); iob->io_len += IEEE802154_EADDR_LEN; diff --git a/wireless/ieee802154/mac802154_data.c b/wireless/ieee802154/mac802154_data.c index fb89d1858d..34e3eabd50 100644 --- a/wireless/ieee802154/mac802154_data.c +++ b/wireless/ieee802154/mac802154_data.c @@ -71,7 +71,7 @@ * ****************************************************************************/ -int mac802154_req_data(MACHANDLE mac, +int mac802154_req_data(MACHANDLE mac, FAR const struct ieee802154_frame_meta_s *meta, FAR struct iob_s *frame) { @@ -289,7 +289,7 @@ int mac802154_req_data(MACHANDLE mac, * error, since this really shouldn't be happening. */ - if (priv->devmode >= IEEE802154_DEVMODE_COORD && + if (priv->devmode >= IEEE802154_DEVMODE_COORD && meta->destaddr.mode != IEEE802154_ADDRMODE_NONE) { /* Copy in a reference to the destination address to assist in diff --git a/wireless/ieee802154/mac802154_device.c b/wireless/ieee802154/mac802154_device.c index 85a52c0051..b03ce94ba8 100644 --- a/wireless/ieee802154/mac802154_device.c +++ b/wireless/ieee802154/mac802154_device.c @@ -115,7 +115,7 @@ struct mac802154_chardevice_s bool readpending; /* Is there a read using the semaphore? */ sem_t readsem; /* Signaling semaphore for waiting read */ - sq_queue_t dataind_queue; + sq_queue_t dataind_queue; #ifndef CONFIG_DISABLE_SIGNALS /* MAC Service notification information */ @@ -254,7 +254,7 @@ static inline FAR struct ieee802154_notif_s * { dev->event_head = NULL; } - + notif->flink = NULL; } @@ -406,7 +406,7 @@ static int mac802154dev_close(FAR struct file *filep) /* If there are now no open instances of the driver and a signal handler is * not registered, purge the list of events. */ - + if (dev->md_open) { FAR struct ieee802154_notif_s *notif; @@ -474,7 +474,7 @@ static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer, /* Try popping a data indication off the list */ ind = (FAR struct ieee802154_data_ind_s *)sq_remfirst(&dev->dataind_queue); - + /* If the indication is not null, we can exit the loop and copy the data */ if (ind != NULL) @@ -483,8 +483,8 @@ static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer, break; } - /* If this is a non-blocking call, or if there is another read operation - * already pending, don't block. This driver returns EAGAIN even when + /* If this is a non-blocking call, or if there is another read operation + * already pending, don't block. This driver returns EAGAIN even when * configured as non-blocking if another read operation is already pending * This situation should be rare. It will only occur when there are 2 calls * to read from separate threads and there was no data in the rx list. @@ -500,7 +500,7 @@ static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer, mac802154dev_givesem(&dev->md_exclsem); /* Wait to be signaled when a frame is added to the list */ - + if (sem_wait(&dev->readsem) < 0) { DEBUGASSERT(errno == EINTR); @@ -512,18 +512,18 @@ static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer, * time, it should have a data indication */ } - + rx->length = (ind->frame->io_len - ind->frame->io_offset); /* Copy the data from the IOB to the user supplied struct */ memcpy(&rx->payload[0], &ind->frame->io_data[ind->frame->io_offset], - rx->length); + rx->length); memcpy(&rx->meta, ind, sizeof(struct ieee802154_data_ind_s)); /* Zero out the forward link and IOB reference */ - + rx->meta.flink = NULL; rx->meta.frame = NULL; @@ -701,7 +701,7 @@ static int mac802154dev_ioctl(FAR struct file *filep, int cmd, ret = OK; break; } - + /* If this is a non-blocking call, or if there is another getevent * operation already pending, don't block. This driver returns * EAGAIN even when configured as non-blocking if another getevent @@ -741,7 +741,7 @@ static int mac802154dev_ioctl(FAR struct file *filep, int cmd, } } break; - + case MAC802154IOC_ENABLE_EVENTS: { dev->enableevents = (bool)arg; @@ -752,7 +752,7 @@ static int mac802154dev_ioctl(FAR struct file *filep, int cmd, default: { /* Forward any unrecognized commands to the MAC layer */ - + ret = mac802154_ioctl(dev->md_mac, cmd, arg); } break; @@ -783,7 +783,7 @@ static void mac802154dev_notify(FAR const struct mac802154_maccb_s *maccb, * notifications. */ - if (dev->enableevents && (dev->md_open != NULL || dev->notify_registered)) + if (dev->enableevents && (dev->md_open != NULL || dev->notify_registered)) { mac802154dev_pushevent(dev, notif); @@ -797,7 +797,7 @@ static void mac802154dev_notify(FAR const struct mac802154_maccb_s *maccb, sem_post(&dev->geteventsem); } -#ifndef CONFIG_DISABLE_SIGNALS +#ifndef CONFIG_DISABLE_SIGNALS if (dev->notify_registered) { @@ -810,7 +810,7 @@ static void mac802154dev_notify(FAR const struct mac802154_maccb_s *maccb, (FAR void *)notif->notiftype); #endif } -#endif +#endif } else { @@ -854,7 +854,7 @@ static void mac802154dev_rxframe(FAR const struct mac802154_maccb_s *maccb, dev->readpending = false; sem_post(&dev->readsem); } - + /* Release the driver */ mac802154dev_givesem(&dev->md_exclsem); @@ -901,7 +901,7 @@ int mac802154dev_register(MACHANDLE mac, int minor) dev->md_mac = mac; sem_init(&dev->md_exclsem, 0, 1); /* Allow the device to be opened once * before blocking */ - + sem_init(&dev->readsem, 0, 0); sem_setprotocol(&dev->readsem, SEM_PRIO_NONE); dev->readpending = false; diff --git a/wireless/ieee802154/mac802154_get_mhrlen.c b/wireless/ieee802154/mac802154_get_mhrlen.c index 608acd8067..63f6f49455 100644 --- a/wireless/ieee802154/mac802154_get_mhrlen.c +++ b/wireless/ieee802154/mac802154_get_mhrlen.c @@ -83,7 +83,7 @@ int mac802154_get_mhrlen(MACHANDLE mac, /* The source address can only be set to NONE if the device is the PAN coord */ - if (meta->srcaddr_mode == IEEE802154_ADDRMODE_NONE && + if (meta->srcaddr_mode == IEEE802154_ADDRMODE_NONE && priv->devmode != IEEE802154_DEVMODE_PANCOORD) { return -EINVAL; diff --git a/wireless/ieee802154/mac802154_getset.c b/wireless/ieee802154/mac802154_getset.c index f32559b9ab..0173d40911 100644 --- a/wireless/ieee802154/mac802154_getset.c +++ b/wireless/ieee802154/mac802154_getset.c @@ -103,7 +103,7 @@ int mac802154_req_get(MACHANDLE mac, enum ieee802154_attr_e attr, ret = priv->radio->set_attr(priv->radio, attr, attrval); break; } - + return ret; } @@ -112,9 +112,9 @@ int mac802154_req_get(MACHANDLE mac, enum ieee802154_attr_e attr, * * Description: * The MLME-SET.request primitive attempts to write the given value to the - * indicated MAC PIB attribute. + * indicated MAC PIB attribute. * - * NOTE: The standard specifies that confirmation should be indicated via + * NOTE: The standard specifies that confirmation should be indicated via * the asynchronous MLME-SET.confirm primitve. However, in our implementation * we synchronously return the status from the request. Therefore, we do merge * the functionality of the MLME-SET.request and MLME-SET.confirm primitives @@ -138,7 +138,7 @@ int mac802154_req_set(MACHANDLE mac, enum ieee802154_attr_e attr, /* Tell the radio about the attribute */ priv->radio->set_attr(priv->radio, attr, attrval); - + ret = IEEE802154_STATUS_SUCCESS; } break; @@ -149,7 +149,7 @@ int mac802154_req_set(MACHANDLE mac, enum ieee802154_attr_e attr, /* Tell the radio about the attribute */ priv->radio->set_attr(priv->radio, attr, attrval); - + ret = IEEE802154_STATUS_SUCCESS; } break; @@ -163,7 +163,7 @@ int mac802154_req_set(MACHANDLE mac, enum ieee802154_attr_e attr, /* Tell the radio about the attribute */ priv->radio->set_attr(priv->radio, attr, attrval); - + ret = IEEE802154_STATUS_SUCCESS; } break; diff --git a/wireless/ieee802154/mac802154_internal.h b/wireless/ieee802154/mac802154_internal.h index 0e49c4654d..fc85d7a009 100644 --- a/wireless/ieee802154/mac802154_internal.h +++ b/wireless/ieee802154/mac802154_internal.h @@ -88,12 +88,12 @@ #if !defined(CONFIG_MAC802154_NNOTIF) || CONFIG_MAC802154_NNOTIF <= 0 # undef CONFIG_MAC802154_NNOTIF -# define CONFIG_MAC802154_NNOTIF 6 +# define CONFIG_MAC802154_NNOTIF 6 #endif #if !defined(CONFIG_MAC802154_NTXDESC) || CONFIG_MAC802154_NTXDESC <= 0 # undef CONFIG_MAC802154_NTXDESC -# define CONFIG_MAC802154_NTXDESC 3 +# define CONFIG_MAC802154_NTXDESC 3 #endif #if CONFIG_MAC802154_NTXDESC > CONFIG_MAC802154_NNOTIF @@ -154,7 +154,7 @@ struct ieee802154_privmac_s /* Only support a single command at any given time. As of now I see no * condition where you need to have more than one command frame simultaneously - */ + */ sem_t op_sem; /* Exclusive operations */ enum mac802154_operation_e curr_op; /* The current overall operation */ @@ -192,7 +192,7 @@ struct ieee802154_privmac_s * list should also be used to populate the address list of the outgoing * beacon frame. */ - + sq_queue_t indirect_queue; /* Support a singly linked list of frames received */ @@ -320,7 +320,7 @@ struct ieee802154_privmac_s /* What type of device is this node acting as */ enum ieee802154_devmode_e devmode : 2; - + uint32_t max_csmabackoffs : 3; /* Max num backoffs for CSMA algorithm * before declaring ch access failure */ @@ -332,7 +332,7 @@ struct ieee802154_privmac_s }; /**************************************************************************** - * Inline Functions + * Inline Functions ****************************************************************************/ #define mac802154_givesem(s) sem_post(s); @@ -373,7 +373,7 @@ static inline void mac802154_txdesc_free(FAR struct ieee802154_privmac_s *priv, * Name: mac802154_timercancel * * Description: - * Cancel timer and remove reference to callback function + * Cancel timer and remove reference to callback function * * Assumptions: * priv MAC struct is locked when calling. diff --git a/wireless/ieee802154/mac802154_notif.c b/wireless/ieee802154/mac802154_notif.c index 314e6bf5f3..15368a5483 100644 --- a/wireless/ieee802154/mac802154_notif.c +++ b/wireless/ieee802154/mac802154_notif.c @@ -77,9 +77,9 @@ int mac802154_notif_free(MACHANDLE mac, FAR struct mac802154_notif_s *privnotif = (FAR struct mac802154_notif_s *)notif; /* Get exclusive access to the MAC */ - + mac802154_takesem(&priv->exclsem, false); - + privnotif->flink = priv->notif_free; priv->notif_free = privnotif; mac802154_givesem(&priv->notif_sem); @@ -160,7 +160,7 @@ int mac802154_notif_alloc(FAR struct ieee802154_privmac_s *priv, */ ret = sem_trywait(&priv->notif_sem); - + if (ret == OK) { privnotif = priv->notif_free; @@ -187,21 +187,21 @@ int mac802154_notif_alloc(FAR struct ieee802154_privmac_s *priv, /* If we've taken a count from the semaphore, we have "reserved" the struct * but now we need to pop it off of the free list. We need to re-lock the * MAC in order to ensure this happens correctly. - */ - + */ + ret = mac802154_takesem(&priv->exclsem, allow_interrupt); if (ret < 0) { mac802154_givesem(&priv->notif_sem); return -EINTR; } - + /* We can now safely unlink the next free structure from the free list */ - + privnotif = priv->notif_free; priv->notif_free = privnotif->flink; } - + *notif = (FAR struct ieee802154_notif_s *)privnotif; return OK; diff --git a/wireless/ieee802154/mac802154_poll.c b/wireless/ieee802154/mac802154_poll.c index 58b6217211..377dd104ab 100644 --- a/wireless/ieee802154/mac802154_poll.c +++ b/wireless/ieee802154/mac802154_poll.c @@ -112,7 +112,7 @@ int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req) priv->curr_cmd = IEEE802154_CMD_DATA_REQ; /* Get exclusive access to the MAC */ - + ret = mac802154_takesem(&priv->exclsem, true); if (ret < 0) { @@ -121,10 +121,10 @@ int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req) } /* Allocate an IOB to put the frame in */ - + iob = iob_alloc(false); DEBUGASSERT(iob != NULL); - + iob->io_flink = NULL; iob->io_len = 0; iob->io_offset = 0; @@ -142,10 +142,10 @@ int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req) } /* Get a uin16_t reference to the first two bytes. ie frame control field */ - + frame_ctrl = (FAR uint16_t *)&iob->io_data[0]; iob->io_len = 2; - + *frame_ctrl = (IEEE802154_FRAME_COMMAND << IEEE802154_FRAMECTRL_SHIFT_FTYPE); *frame_ctrl |= IEEE802154_FRAMECTRL_ACKREQ; @@ -153,7 +153,7 @@ int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req) * shall copy the value of macDSN into the Sequence Number field of the * MHR of the outgoing frame and then increment it by one. [1] pg. 40. */ - + iob->io_data[iob->io_len++] = priv->dsn++; /* If the destination address is present, copy the PAN ID and one of the @@ -192,7 +192,7 @@ int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req) { *frame_ctrl |= IEEE802154_FRAMECTRL_PANIDCOMP; } - else + else { memcpy(&iob->io_data[iob->io_len], &priv->addr.panid, 2); iob->io_len += 2; @@ -215,7 +215,7 @@ int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req) memcpy(&iob->io_data[iob->io_len], &priv->addr.saddr, 2); iob->io_len += 2; } - + /* Copy in the Command Frame Identifier */ iob->io_data[iob->io_len++] = IEEE802154_CMD_DATA_REQ; @@ -273,7 +273,7 @@ void mac802154_txdone_datareq_poll(FAR struct ieee802154_privmac_s *priv, enum ieee802154_status_e status; FAR struct mac802154_notif_s *privnotif = (FAR struct mac802154_notif_s *)txdesc->conf; - FAR struct ieee802154_notif_s *notif = &privnotif->pub; + FAR struct ieee802154_notif_s *notif = &privnotif->pub; /* If the data request failed to be sent, notify the next layer * that the poll has failed. @@ -324,14 +324,14 @@ void mac802154_txdone_datareq_poll(FAR struct ieee802154_privmac_s *priv, * the timer, otherwise it will expire and we will notify the * next highest layer of the failure. */ - + mac802154_timerstart(priv, priv->max_frame_waittime, mac802154_timeout_poll); /* We can deallocate the data conf notification as it is no longer * needed. We can't use the public function here since we already - * have the MAC locked. - */ + * have the MAC locked. + */ privnotif->flink = priv->notif_free; priv->notif_free = privnotif; @@ -371,6 +371,6 @@ static void mac802154_timeout_poll(FAR struct ieee802154_privmac_s *priv) notif->notiftype = IEEE802154_NOTIFY_CONF_POLL; notif->u.pollconf.status = IEEE802154_STATUS_NO_DATA; - + priv->cb->notify(priv->cb, notif); } \ No newline at end of file diff --git a/wireless/ieee802154/mac802154_purge.c b/wireless/ieee802154/mac802154_purge.c index 8249cb5678..6073c61f8c 100644 --- a/wireless/ieee802154/mac802154_purge.c +++ b/wireless/ieee802154/mac802154_purge.c @@ -66,10 +66,10 @@ * an MSDU from the transaction queue. Confirmation is returned via * the struct mac802154_maccb_s->conf_purge callback. * - * NOTE: The standard specifies that confirmation should be indicated via + * NOTE: The standard specifies that confirmation should be indicated via * the asynchronous MLME-PURGE.confirm primitve. However, in our * implementation we synchronously return the status from the request. - * Therefore, we merge the functionality of the MLME-PURGE.request and + * Therefore, we merge the functionality of the MLME-PURGE.request and * MLME-PURGE.confirm primitives together. * ****************************************************************************/ diff --git a/wireless/ieee802154/mac802154_start.c b/wireless/ieee802154/mac802154_start.c index 6b0c051717..263703b9e8 100644 --- a/wireless/ieee802154/mac802154_start.c +++ b/wireless/ieee802154/mac802154_start.c @@ -71,7 +71,7 @@ int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req) int ret; /* Get exclusive access to the MAC */ - + ret = mac802154_takesem(&priv->exclsem, true); if (ret < 0) { @@ -94,7 +94,7 @@ int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req) return -ENOTTY; } - + /* Set the PANID attribute */ priv->addr.panid = req->panid; @@ -107,7 +107,7 @@ int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req) priv->radio->set_attr(priv->radio, IEEE802154_ATTR_PHY_CURRENT_PAGE, (FAR const union ieee802154_attr_u *)&req->chpage); - + /* Set the beacon order */ @@ -120,7 +120,7 @@ int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req) priv->beaconorder = req->beaconorder; /* The value of macSuperframeOrder shall be ignored if macBeaconOrder = 15. pg. 19 */ - + if (priv->beaconorder < 15) { /* Set the superframe order */ @@ -145,7 +145,7 @@ int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req) /* If the BeaconOrder parameter is less than 15, the MLME sets macBattLifeExt to * the value of the BatteryLifeExtension parameter. If the BeaconOrder parameter - * equals 15, the value of the BatteryLifeExtension parameter is ignored. + * equals 15, the value of the BatteryLifeExtension parameter is ignored. * [1] pg. 106 */