Beacon logic: Damage control. Looks like something went wrong with the PR merge.

This commit is contained in:
Gregory Nutt 2017-06-26 11:03:44 -06:00
parent 2069a90220
commit 1f81b14610
8 changed files with 32 additions and 32 deletions

View File

@ -281,7 +281,7 @@ enum ieee802154_status_e
/* This first section of enums is defined in the standard. [1] pg. 70
* They must be in this order
*/
IEEE802154_STATUS_SUCCESS = 0,
IEEE802154_STATUS_OUT_OF_CAPACITY,
IEEE802154_STATUS_DENIED,
@ -906,7 +906,7 @@ struct ieee802154_assoc_req_s
* enabled PAN or non-beacon enabled PAN. If it is beacon-enabled, the MAC
* will track the beacon first before transmitting the association. This can
* take some time depending on the beacon interval. If the PAN is non-beacon
* enabled, the association request is sent immediately via CSMA.
* enabled, the association request is sent immediately via CSMA.
*
* The catch 22: The standard outlines the procedure for associating: reset
* the MAC, scan to find PAN's and pass coordinator address info to
@ -927,7 +927,7 @@ struct ieee802154_assoc_req_s
* info if it is not associated.
*/
bool beacon;
bool beacon;
/* Coordinator Address with which to associate */

View File

@ -93,7 +93,7 @@ struct ieee802154_beaconframe_s
{
uint8_t bf_data[IEEE802154_MAX_PHY_PACKET_SIZE];
uint8_t bf_len;
uint8_t bf_offset;
uint8_t bf_offset;
};
enum ieee802154_sfevent_e

View File

@ -5,4 +5,4 @@ NOTE: Throughout the code, excerpts from the standard are quoted as to make
the code thoroughly readable. I have tried, to always put a reference [1] and
page number. Below is the references that correspond with the reference number
[1]
[1]

View File

@ -399,7 +399,7 @@ void mac802154_updatebeacon(FAR struct ieee802154_privmac_s *priv)
/* Clear the frame control fields */
beacon->bf_data[0] = 0;
beacon->bf_data[0] = 0;
beacon->bf_data[1] = 0;
beacon->bf_len = 2;
@ -410,7 +410,7 @@ void mac802154_updatebeacon(FAR struct ieee802154_privmac_s *priv)
*/
/* TODO: handle broadcast frame */
DEBUGASSERT(priv->addr.mode != IEEE802154_ADDRMODE_NONE);
IEEE802154_SETDADDRMODE(beacon->bf_data, 0, IEEE802154_ADDRMODE_NONE);
@ -471,7 +471,7 @@ void mac802154_updatebeacon(FAR struct ieee802154_privmac_s *priv)
/* Skip the pending address specification field for now */
pendaddrspec_ind = beacon->bf_len++;
txdesc = (FAR struct ieee802154_txdesc_s *)sq_peek(&priv->indirect_queue);
while(txdesc != NULL)
@ -488,7 +488,7 @@ void mac802154_updatebeacon(FAR struct ieee802154_privmac_s *priv)
IEEE802154_EADDRCOPY(&beacon->bf_data[beacon->bf_len], txdesc->destaddr.eaddr);
beacon->bf_len += IEEE802154_EADDRSIZE;
}
/* Check if we are up to 7 addresses yet */
if ((pendsaddr + pendeaddr) == 7)
@ -500,11 +500,11 @@ void mac802154_updatebeacon(FAR struct ieee802154_privmac_s *priv)
txdesc = (FAR struct ieee802154_txdesc_s *)sq_next((FAR sq_entry_t *)txdesc);
}
/* At this point, we know how many of each transaction we have, we can setup
* the Pending Address Specification field
*/
beacon->bf_data[pendaddrspec_ind] = (pendsaddr & 0x07) | ((pendeaddr << 4) & 0x70);
/* Copy in the beacon payload */
@ -1035,7 +1035,7 @@ static void mac802154_rxframe_worker(FAR void *arg)
{
/* The source PAN ID is equal to the destination PAN ID */
IEEE802154_PANIDCOPY(ind->src.panid, ind->dest.panid);
IEEE802154_PANIDCOPY(ind->src.panid, ind->dest.panid);
}
else
{
@ -1570,7 +1570,7 @@ static void mac802154_rxbeaconframe(FAR struct ieee802154_privmac_s *priv,
pandesc.sfspec.beaconorder = IEEE802154_GETBEACONORDER(iob->io_data,
iob->io_offset);
pandesc.sfspec.sforder = IEEE802154_GETSFORDER(iob->io_data, iob->io_offset);
pandesc.sfspec.sforder = IEEE802154_GETSFORDER(iob->io_data, iob->io_offset);
pandesc.sfspec.final_capslot = IEEE802154_GETFINCAPSLOT(iob->io_data,
iob->io_offset);
pandesc.sfspec.ble = IEEE802154_GETBLE(iob->io_data, iob->io_offset);
@ -1595,11 +1595,11 @@ static void mac802154_rxbeaconframe(FAR struct ieee802154_privmac_s *priv,
for (i = 0; i < priv->npandesc; i++)
{
if (priv->currscan.channels[priv->scanindex] != priv->pandescs[i].chan)
if (priv->currscan.channels[priv->scanindex] != priv->pandescs[i].chan)
{
continue;
}
if (memcmp(&ind->src, &priv->pandescs[i].coordaddr,
sizeof(struct ieee802154_addr_s)))
{
@ -1607,10 +1607,10 @@ static void mac802154_rxbeaconframe(FAR struct ieee802154_privmac_s *priv,
}
/* The beacon is the same as another, so discard it */
return;
}
/* Copy the pan desc to the list of pan desc */
memcpy(&priv->pandescs[priv->npandesc], &pandesc,
@ -1703,12 +1703,12 @@ static void mac802154_rxbeaconframe(FAR struct ieee802154_privmac_s *priv,
*/
/* Check the superframe structure and update the appropriate attributes. */
if (memcmp(&priv->sfspec, &pandesc.sfspec,
sizeof(struct ieee802154_superframespec_s)) != 0)
{
/* Copy in the new superframe spec */
memcpy(&priv->sfspec, &pandesc.sfspec,
sizeof(struct ieee802154_superframespec_s));

View File

@ -318,9 +318,9 @@ int mac802154_resp_associate(MACHANDLE mac,
* Destination PAN Identifier field shall contain the value of macPANId, while
* the Source PAN Identifier field shall be omitted. [1] pg. 69
*/
mac802154_putpanid(iob, priv->addr.panid);
/* The Destination Address field shall contain the extended address of the
* device requesting association. [1] pg. 69 */

View File

@ -235,7 +235,7 @@ void mac802154_txdone_datareq_poll(FAR struct ieee802154_privmac_s *priv,
* the corresponding data frame from the coordinator. [1] pg.43
*/
mac802154_rxenable(priv);
mac802154_rxenable(priv);
/* Start a timer, if we receive the data frame, we will cancel
* the timer, otherwise it will expire and we will notify the

View File

@ -105,9 +105,9 @@ int mac802154_req_scan(MACHANDLE mac, FAR struct ieee802154_scan_req_s *req)
}
priv->curr_op = MAC802154_OP_SCAN;
/* Get exclusive access to the MAC */
ret = mac802154_takesem(&priv->exclsem, true);
if (ret < 0)
{
@ -115,7 +115,7 @@ int mac802154_req_scan(MACHANDLE mac, FAR struct ieee802154_scan_req_s *req)
ret = -EINTR;
goto errout;
}
/* Copy the request so we have a reference */
memcpy(&priv->currscan, req, sizeof(struct ieee802154_scan_req_s));
@ -139,7 +139,7 @@ int mac802154_req_scan(MACHANDLE mac, FAR struct ieee802154_scan_req_s *req)
* shall restore the value of macPANId to the value stored before the
* scan began. [1] pg. 24
*/
IEEE802154_PANIDCOPY(priv->panidbeforescan, priv->addr.panid);
mac802154_setpanid(priv, (const uint8_t *)&IEEE802154_PANID_UNSPEC);
@ -148,7 +148,7 @@ int mac802154_req_scan(MACHANDLE mac, FAR struct ieee802154_scan_req_s *req)
* [aBaseSuperframeDuration × (2 * n + 1)],
* where n is the value of the ScanDuration parameter. [1] pg. 25
*/
mac802154_rxenable(priv);
priv->scansymdur = IEEE802154_BASE_SUPERFRAME_DURATION *
@ -219,7 +219,7 @@ void mac802154_scanfinish(FAR struct ieee802154_privmac_s *priv,
memcpy(notif->u.scanconf.unscanned, &priv->currscan.channels[priv->scanindex],
notif->u.scanconf.numunscanned);
}
notif->u.scanconf.numdesc = priv->npandesc;
memcpy(notif->u.scanconf.pandescs, priv->pandescs,
sizeof(struct ieee802154_pandesc_s) * priv->npandesc);
@ -270,7 +270,7 @@ static void mac802154_scantimeout(FAR struct ieee802154_privmac_s *priv)
}
return;
}
mac802154_setchannel(priv, priv->currscan.channels[priv->scanindex]);
/* ...after switching to the channel for a passive scan, the device
@ -278,7 +278,7 @@ static void mac802154_scantimeout(FAR struct ieee802154_privmac_s *priv)
* [aBaseSuperframeDuration × (2 * n + 1)],
* where n is the value of the ScanDuration parameter. [1] pg. 25
*/
mac802154_rxenable(priv);
mac802154_timerstart(priv, priv->scansymdur, mac802154_scantimeout);
}

View File

@ -110,7 +110,7 @@ int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req)
* contain the value of macExtendedAddress if macShortAddress is equal to
* 0xfffe or macShortAddress otherwise. [1] pg. 32
*/
if (IEEE802154_SADDRCMP(priv->addr.saddr, &IEEE802154_SADDR_BCAST))
{
priv->addr.mode = IEEE802154_ADDRMODE_EXTENDED;
@ -167,7 +167,7 @@ int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req)
priv->sfspec.ble = req->battlifeext;
/* For now we just set the CAP Slot to 15 */
priv->sfspec.final_capslot = 15;
/* If the PAN coordinator parameter is set to TRUE, the MLME ignores the