#include <p802_15_4csmaca.h>
Collaboration diagram for CsmaCA802_15_4:

Definition at line 61 of file p802_15_4csmaca.h.
Public Member Functions | |
| CsmaCA802_15_4 (Phy802_15_4 *p, Mac802_15_4 *m) | |
| ~CsmaCA802_15_4 () | |
Protected Member Functions | |
| double | adjustTime (double wtime) |
| void | backoffHandler (void) |
| void | bcnOtherHandler (void) |
| void | cancel (void) |
| bool | canProceed (double wtime, bool afterCCA=false) |
| void | CCA_confirm (PHYenum status) |
| void | deferCCAHandler (void) |
| void | newBeacon (char trx) |
| void | reset (void) |
| void | RX_ON_confirm (PHYenum status) |
| void | start (bool firsttime, Packet *pkt=0, bool ackreq=0) |
Private Attributes | |
| bool | ackReq |
| macBackoffTimer * | backoffT |
| macBeaconOtherTimer * | bcnOtherT |
| double | bcnRxTime |
| double | bcnTxTime |
| UINT_8 | BE |
| bool | beaconEnabled |
| bool | beaconOther |
| double | bPeriod |
| int | bPeriodsLeft |
| UINT_8 | CW |
| macDeferCCATimer * | deferCCAT |
| Mac802_15_4 * | mac |
| UINT_8 | NB |
| Phy802_15_4 * | phy |
| Packet * | txPkt |
| bool | waitNextBeacon |
Friends | |
| class | Mac802_15_4 |
| class | macBackoffTimer |
| class | macBeaconOtherTimer |
| class | macDeferCCATimer |
|
||||||||||||
|
Definition at line 58 of file p802_15_4csmaca.cc. References backoffT, bcnOtherT, deferCCAT, mac, macBackoffTimer, macBeaconOtherTimer, macDeferCCATimer, phy, txPkt, and waitNextBeacon. 00059 { 00060 phy = p; 00061 mac = m; 00062 txPkt = 0; 00063 waitNextBeacon = false; 00064 backoffT = new macBackoffTimer(this); 00065 assert(backoffT); 00066 bcnOtherT = new macBeaconOtherTimer(this); 00067 assert(bcnOtherT); 00068 deferCCAT = new macDeferCCATimer(this); 00069 assert(deferCCAT); 00070 }
|
|
|
Definition at line 72 of file p802_15_4csmaca.cc. References backoffT, bcnOtherT, and deferCCAT.
|
|
|
Definition at line 96 of file p802_15_4csmaca.cc. References bcnTxTime, Mac802_15_4::beaconPeriods, bPeriod, CURRENT_TIME, mac, MAC_PIB::macBeaconOrder, Mac802_15_4::mpib, Mac802_15_4::toParent(), and txPkt. Referenced by newBeacon(), and start(). 00097 { 00098 //find the beginning point of CAP and adjust the scheduled time 00099 //if it comes before CAP 00100 double neg; 00101 double tmpf; 00102 00103 assert(txPkt); 00104 if (!mac->toParent(txPkt)) 00105 { 00106 if (mac->mpib.macBeaconOrder != 15) 00107 { 00108 /* Linux floating number compatibility 00109 neg = (CURRENT_TIME + wtime - bcnTxTime) - mac->beaconPeriods * bPeriod; 00110 */ 00111 { 00112 tmpf = mac->beaconPeriods * bPeriod; 00113 tmpf = CURRENT_TIME - tmpf; 00114 tmpf += wtime; 00115 neg = tmpf - bcnTxTime; 00116 } 00117 00118 if (neg < 0.0) 00119 wtime -= neg; 00120 return wtime; 00121 } 00122 else 00123 return wtime; 00124 } 00125 else 00126 { 00127 if (mac->macBeaconOrder2 != 15) 00128 { 00129 /* Linux floating number compatibility 00130 neg = (CURRENT_TIME + wtime - bcnRxTime) - mac->beaconPeriods2 * bPeriod; 00131 */ 00132 { 00133 tmpf = mac->beaconPeriods2 * bPeriod; 00134 tmpf = CURRENT_TIME - tmpf; 00135 tmpf += wtime; 00136 neg = tmpf - bcnRxTime; 00137 } 00138 00139 if (neg < 0.0) 00140 wtime -= neg; 00141 return wtime; 00142 } 00143 else 00144 return wtime; 00145 } 00146 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 494 of file p802_15_4csmaca.cc. References mac, p_RX_ON, Mac802_15_4::taskP, taskPending::taskStatus(), and TP_RX_ON_csmaca. Referenced by CCA_confirm(), macBackoffTimer::handle(), newBeacon(), and RX_ON_confirm(). 00495 { 00496 mac->taskP.taskStatus(TP_RX_ON_csmaca) = true; 00497 mac->plme_set_trx_state_request(p_RX_ON); 00498 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 529 of file p802_15_4csmaca.cc. References newBeacon(). Referenced by macBeaconOtherTimer::handle(). 00530 { 00531 newBeacon('R'); 00532 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 481 of file p802_15_4csmaca.cc. References backoffT, bcnOtherT, Mac802_15_4Timer::busy(), deferCCAT, mac, Mac802_15_4Timer::stop(), Mac802_15_4::taskP, taskPending::taskStatus(), and TP_CCA_csmaca. Referenced by Mac802_15_4::csmacaBegin(), Mac802_15_4::mlme_scan_request(), and Mac802_15_4::recvAck(). 00482 { 00483 if (bcnOtherT->busy()) 00484 bcnOtherT->stop(); 00485 else if (backoffT->busy()) 00486 backoffT->stop(); 00487 else if (deferCCAT->busy()) 00488 deferCCAT->stop(); 00489 else 00490 mac->taskP.taskStatus(TP_CCA_csmaca) = false; 00491 txPkt = 0; 00492 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
Definition at line 148 of file p802_15_4csmaca.cc. References aUnitBackoffPeriod, bcnTxTime, Mac802_15_4::beaconPeriods, SuperframeSpec::BLE, bPeriod, bPeriodsLeft, CURRENT_TIME, SuperframeSpec::FinCAP, Mac802_15_4::getBattLifeExtSlotNum(), Mac802_15_4::locateBoundary(), mac, MAC_PIB::macBeaconOrder, Mac802_15_4::mpib, SuperframeSpec::sd, Mac802_15_4::sfSpec, Mac802_15_4::toParent(), txPkt, and waitNextBeacon. Referenced by CCA_confirm(), newBeacon(), and start(). 00149 { 00150 //check if can proceed within the current superframe 00151 //(in the case the node acts as both a coordinator and a device, both the superframes from and to this node should be taken into account) 00152 bool ok; 00153 UINT_16 t_bPeriods,t_CAP; 00154 double t_fCAP,t_CCATime,t_IFS,t_transacTime,bcnOtherTime,BI2; 00155 00156 waitNextBeacon = false; 00157 wtime = mac->locateBoundary(mac->toParent(txPkt),wtime); 00158 if (!mac->toParent(txPkt)) 00159 { 00160 if (mac->mpib.macBeaconOrder != 15) 00161 { 00162 if (mac->sfSpec.BLE) 00163 t_CAP = mac->getBattLifeExtSlotNum(); 00164 else 00165 t_CAP = (mac->sfSpec.FinCAP + 1) * (mac->sfSpec.sd / aUnitBackoffPeriod) - mac->beaconPeriods; //(mac->sfSpec.sd % aUnitBackoffPeriod) = 0 00166 00167 /* Linux floating number compatibility 00168 t_bPeriods = (UINT_16)(((CURRENT_TIME + wtime - bcnTxTime) / bPeriod) - mac->beaconPeriods); 00169 */ 00170 { 00171 double tmpf; 00172 tmpf = CURRENT_TIME + wtime; 00173 tmpf -= bcnTxTime; 00174 tmpf /= bPeriod; 00175 t_bPeriods = (UINT_16)(tmpf - mac->beaconPeriods); 00176 } 00177 00178 /* Linux floating number compatibility 00179 if (fmod(CURRENT_TIME + wtime - bcnTxTime, bPeriod) > 0.0) 00180 */ 00181 double tmpf; 00182 tmpf = CURRENT_TIME + wtime; 00183 tmpf -= bcnTxTime; 00184 if (fmod(tmpf, bPeriod) > 0.0) 00185 t_bPeriods++; 00186 bPeriodsLeft = t_bPeriods - t_CAP; 00187 } 00188 else 00189 bPeriodsLeft = -1; 00190 } 00191 else 00192 { 00193 if (mac->macBeaconOrder2 != 15) 00194 { 00195 BI2 = mac->sfSpec2.BI / phy->getRate('s'); 00196 00197 /* Linux floating number compatibility 00198 t_CAP = (UINT_16)((mac->macBcnRxTime + (mac->sfSpec2.FinCAP + 1) * mac->sfSpec2.sd ) / phy->getRate('s')); 00199 */ 00200 { 00201 double tmpf; 00202 tmpf = (mac->sfSpec2.FinCAP + 1) * mac->sfSpec2.sd; 00203 tmpf += mac->macBcnRxTime; 00204 t_CAP = (UINT_16)(tmpf / phy->getRate('s')); 00205 } 00206 00207 /* Linux floating number compatibility 00208 if (t_CAP + aMaxLostBeacons * BI2 < CURRENT_TIME) 00209 */ 00210 double tmpf; 00211 tmpf = aMaxLostBeacons * BI2; 00212 if (t_CAP + tmpf < CURRENT_TIME) 00213 bPeriodsLeft = -1; 00214 else 00215 { 00216 if (mac->sfSpec2.BLE) 00217 t_CAP = mac->getBattLifeExtSlotNum(); 00218 else 00219 t_CAP = (mac->sfSpec2.FinCAP + 1) * (mac->sfSpec2.sd / aUnitBackoffPeriod) - mac->beaconPeriods2; 00220 00221 /* Linux floating number compatibility 00222 t_bPeriods = (UINT_16)(((CURRENT_TIME + wtime - bcnRxTime) / bPeriod) - mac->beaconPeriods2); 00223 */ 00224 { 00225 double tmpf; 00226 tmpf = CURRENT_TIME + wtime; 00227 tmpf -= bcnRxTime; 00228 tmpf /= bPeriod; 00229 t_bPeriods = (UINT_16)(tmpf - mac->beaconPeriods2); 00230 } 00231 00232 /* Linux floating number compatibility 00233 if (fmod(CURRENT_TIME + wtime - bcnRxTime, bPeriod) > 0.0) 00234 */ 00235 double tmpf; 00236 tmpf = CURRENT_TIME + wtime; 00237 tmpf -= bcnRxTime; 00238 if (fmod(tmpf, bPeriod) > 0.0) 00239 t_bPeriods++; 00240 bPeriodsLeft = t_bPeriods - t_CAP; 00241 } 00242 } 00243 else 00244 bPeriodsLeft = -1; 00245 } 00246 00247 ok = true; 00248 if (bPeriodsLeft > 0) 00249 ok = false; 00250 else if (bPeriodsLeft == 0) 00251 { 00252 if ((!mac->toParent(txPkt)) 00253 && (!mac->sfSpec.BLE)) 00254 ok = false; 00255 else if ((mac->toParent(txPkt)) 00256 && (!mac->sfSpec2.BLE)) 00257 ok = false; 00258 } 00259 if (!ok) 00260 { 00261 #ifdef DEBUG802_15_4 00262 fprintf(stdout,"[%s::%s][%f](node %d) cannot proceed: bPeriodsLeft = %d, orders = %d/%d/%d, type = %s, src = %d, dst = %d, uid = %d, mac_uid = %ld, size = %d\n",__FILE__,__FUNCTION__,CURRENT_TIME,mac->index_,bPeriodsLeft,mac->mpib.macBeaconOrder,mac->macBeaconOrder2,mac->macBeaconOrder3,wpan_pName(txPkt),p802_15_4macSA(txPkt),p802_15_4macDA(txPkt),ch->uid(),HDR_LRWPAN(txPkt)->uid,ch->size()); 00263 #endif 00264 if (mac->macBeaconOrder2 != 15) 00265 if (!mac->bcnRxT->busy()) 00266 mac->bcnRxT->start(); 00267 waitNextBeacon = true; 00268 return false; 00269 } 00270 00271 //calculate the time needed to finish the transaction 00272 t_CCATime = 8 / phy->getRate('s'); 00273 if (HDR_CMN(txPkt)->size() <= aMaxSIFSFrameSize) 00274 t_IFS = aMinSIFSPeriod; 00275 else 00276 t_IFS = aMinLIFSPeriod; 00277 t_IFS /= phy->getRate('s'); 00278 t_transacTime = mac->locateBoundary(mac->toParent(txPkt),wtime) - wtime; //boundary location time -- should be 0 here, since we have already located the boundary 00279 if (!afterCCA) 00280 { 00281 t_transacTime += t_CCATime; //first CCA time 00282 t_transacTime += mac->locateBoundary(mac->toParent(txPkt),t_transacTime) - (t_transacTime); //boundary location time for second CCA 00283 t_transacTime += t_CCATime; //second CCA time 00284 } 00285 t_transacTime += mac->locateBoundary(mac->toParent(txPkt),t_transacTime) - (t_transacTime); //boundary location time for transmission 00286 t_transacTime += phy->trxTime(txPkt); //packet transmission time 00287 if (ackReq) 00288 { 00289 t_transacTime += mac->mpib.macAckWaitDuration/phy->getRate('s'); //ack. waiting time (this value does not include round trip propagation delay) 00290 t_transacTime += 2*max_pDelay; //round trip propagation delay (802.15.4 ignores this, but it should be there even though it is very small) 00291 t_transacTime += t_IFS; //IFS time -- not only ensure that the sender can finish the transaction, but also the receiver 00292 t_fCAP = mac->getCAP(true); 00293 00294 /* Linux floating number compatibility 00295 if (CURRENT_TIME + wtime + t_transacTime > t_fCAP) 00296 */ 00297 double tmpf; 00298 tmpf = CURRENT_TIME + wtime; 00299 tmpf += t_transacTime; 00300 if (tmpf > t_fCAP) 00301 ok = false; 00302 else 00303 ok= true; 00304 } 00305 else 00306 { 00307 //in this case, we need to handle individual CAP 00308 ok = true; 00309 t_fCAP = mac->getCAPbyType(1); 00310 00311 /* Linux floating number compatibility 00312 if (CURRENT_TIME + wtime + t_transacTime > t_fCAP) 00313 */ 00314 double tmpf; 00315 tmpf = CURRENT_TIME + wtime; 00316 tmpf += t_transacTime; 00317 if (tmpf > t_fCAP) 00318 ok = false; 00319 if (ok) 00320 { 00321 t_fCAP = mac->getCAPbyType(2); 00322 t_transacTime += max_pDelay; //one-way trip propagation delay (802.15.4 ignores this, but it should be there even though it is very small) 00323 t_transacTime += 12/phy->getRate('s'); //transceiver turn-around time (receiver may need to do this to transmit next beacon) 00324 t_transacTime += t_IFS; //IFS time -- not only ensure that the sender can finish the transaction, but also the receiver 00325 00326 /* Linux floating number compatibility 00327 if (CURRENT_TIME + wtime + t_transacTime > t_fCAP) 00328 */ 00329 double tmpf; 00330 tmpf = CURRENT_TIME + wtime; 00331 tmpf += t_transacTime; 00332 if (tmpf > t_fCAP) 00333 ok = false; 00334 } 00335 if (ok) 00336 { 00337 t_fCAP = mac->getCAPbyType(3); 00338 t_transacTime -= t_IFS; //the third node does not need to handle the transaction 00339 00340 /* Linux floating number compatibility 00341 if (CURRENT_TIME + wtime + t_transacTime > t_fCAP) 00342 */ 00343 double tmpf; 00344 tmpf = CURRENT_TIME + wtime; 00345 tmpf += t_transacTime; 00346 if (tmpf > t_fCAP) 00347 ok = false; 00348 } 00349 } 00350 00351 //check if have enough CAP to finish the transaction 00352 if (!ok) 00353 { 00354 bPeriodsLeft = 0; 00355 if ((mac->mpib.macBeaconOrder == 15) 00356 && (mac->macBeaconOrder2 == 15) 00357 && (mac->macBeaconOrder3 != 15)) 00358 { 00359 /* Linux floating number compatibility 00360 bcnOtherTime = (mac->macBcnOtherRxTime + mac->sfSpec3.BI) / phy->getRate('s'); 00361 */ 00362 { 00363 double tmpf; 00364 tmpf = (mac->macBcnOtherRxTime + mac->sfSpec3.BI); 00365 bcnOtherTime = tmpf / phy->getRate('s'); 00366 } 00367 00368 while (bcnOtherTime < CURRENT_TIME) 00369 bcnOtherTime += (mac->sfSpec3.BI / phy->getRate('s')); 00370 bcnOtherT->start(bcnOtherTime - CURRENT_TIME); 00371 } 00372 #ifdef DEBUG802_15_4 00373 fprintf(stdout,"[%s::%s][%f](node %d) cannot proceed: orders = %d/%d/%d, type = %s, src = %d, dst = %d, uid = %d, mac_uid = %ld, size = %d\n",__FILE__,__FUNCTION__,CURRENT_TIME,mac->index_,mac->mpib.macBeaconOrder,mac->macBeaconOrder2,mac->macBeaconOrder3,wpan_pName(txPkt),p802_15_4macSA(txPkt),p802_15_4macDA(txPkt),ch->uid(),HDR_LRWPAN(txPkt)->uid,ch->size()); 00374 #endif 00375 if (mac->macBeaconOrder2 != 15) 00376 if (!mac->bcnRxT->busy()) 00377 mac->bcnRxT->start(); 00378 waitNextBeacon = true; 00379 return false; 00380 } 00381 else 00382 { 00383 bPeriodsLeft = -1; 00384 return true; 00385 } 00386 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 540 of file p802_15_4csmaca.cc. References aMaxBE, backoffHandler(), BE, beaconEnabled, beaconOther, bPeriodsLeft, canProceed(), Mac802_15_4::csmacaCallBack(), CW, mac, MAC_PIB::macMaxCSMABackoffs, Mac802_15_4::mpib, NB, p_BUSY, p_IDLE, and start(). Referenced by Mac802_15_4::PLME_CCA_confirm(). 00541 { 00542 //This function should be called when mac receiving CCA_confirm. 00543 bool idle; 00544 00545 idle = (status == p_IDLE)?1:0; 00546 if (idle) 00547 { 00548 if ((!beaconEnabled)&&(!beaconOther)) 00549 { 00550 txPkt = 0; 00551 mac->csmacaCallBack(p_IDLE); 00552 } 00553 else 00554 { 00555 if (beaconEnabled) 00556 CW--; 00557 else 00558 CW = 0; 00559 if (CW == 0) 00560 { 00561 //timing condition may not still hold -- check again 00562 if (canProceed(0.0, true)) 00563 { 00564 txPkt = 0; 00565 mac->csmacaCallBack(p_IDLE); 00566 } 00567 else //postpone until next beacon sent or received 00568 { 00569 if (beaconEnabled) CW = 2; 00570 bPeriodsLeft = 0; 00571 } 00572 } 00573 else //perform CCA again 00574 backoffHandler(); 00575 } 00576 } 00577 else //busy 00578 { 00579 if (beaconEnabled) CW = 2; 00580 NB++; 00581 if (NB > mac->mpib.macMaxCSMABackoffs) 00582 { 00583 txPkt = 0; 00584 mac->csmacaCallBack(p_BUSY); 00585 } 00586 else //backoff again 00587 { 00588 BE++; 00589 if (BE > aMaxBE) 00590 BE = aMaxBE; 00591 start(false); 00592 } 00593 } 00594 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 534 of file p802_15_4csmaca.cc. References mac, phy, Phy802_15_4::PLME_CCA_request(), Mac802_15_4::taskP, taskPending::taskStatus(), and TP_CCA_csmaca. Referenced by macDeferCCATimer::handle(). 00535 { 00536 mac->taskP.taskStatus(TP_CCA_csmaca) = true; 00537 phy->PLME_CCA_request(); 00538 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 388 of file p802_15_4csmaca.cc. References adjustTime(), aUnitBackoffPeriod, backoffHandler(), backoffT, bcnOtherT, bcnRxTime, bcnTxTime, beaconEnabled, beaconOther, bPeriod, bPeriodsLeft, Mac802_15_4Timer::busy(), canProceed(), Phy802_15_4::getRate(), mac, Mac802_15_4::macBcnRxTime, Mac802_15_4::macBcnTxTime, MAC_PIB::macBeaconOrder, Mac802_15_4::macBeaconOrder2, Mac802_15_4::macBeaconOrder3, Mac802_15_4::mpib, p_RX_ON, phy, reset(), Mac802_15_4Timer::start(), Mac802_15_4Timer::stop(), Mac802_15_4::txAck, and waitNextBeacon. Referenced by bcnOtherHandler(), Mac802_15_4::recvBeacon(), and Mac802_15_4::taskSuccess(). 00389 { 00390 //this function will be called by MAC each time a new beacon received or sent within the current PAN 00391 double rate,wtime; 00392 00393 if (!mac->txAck) 00394 mac->plme_set_trx_state_request(p_RX_ON); 00395 00396 if (bcnOtherT->busy()) 00397 bcnOtherT->stop(); 00398 00399 //update values 00400 beaconEnabled = ((mac->mpib.macBeaconOrder != 15)||(mac->macBeaconOrder2 != 15)); 00401 beaconOther = (mac->macBeaconOrder3 != 15); 00402 reset(); 00403 rate = phy->getRate('s'); 00404 bcnTxTime = mac->macBcnTxTime / rate; 00405 bcnRxTime = mac->macBcnRxTime / rate; 00406 bPeriod = aUnitBackoffPeriod / rate; 00407 00408 if (waitNextBeacon) 00409 if ((txPkt) 00410 && (!backoffT->busy())) 00411 { 00412 assert(bPeriodsLeft >= 0); 00413 if (bPeriodsLeft == 0) 00414 { 00415 wtime = adjustTime(0.0); 00416 if (canProceed(wtime)); 00417 backoffHandler(); //no need to resume backoff 00418 } 00419 else 00420 { 00421 wtime = adjustTime(0.0); 00422 wtime += bPeriodsLeft * bPeriod; 00423 if (canProceed(wtime)); 00424 backoffT->start(wtime); 00425 } 00426 } 00427 waitNextBeacon = false; 00428 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 79 of file p802_15_4csmaca.cc. References BE, beaconEnabled, CW, mac, MAC_PIB::macBattLifeExt, MAC_PIB::macMinBE, Mac802_15_4::mpib, and NB. Referenced by newBeacon(), and start(). 00080 { 00081 if (beaconEnabled) 00082 { 00083 NB = 0; 00084 CW = 2; 00085 BE = mac->mpib.macMinBE; 00086 if ((mac->mpib.macBattLifeExt)&&(BE > 2)) 00087 BE = 2; 00088 } 00089 else 00090 { 00091 NB = 0; 00092 BE = mac->mpib.macMinBE; 00093 } 00094 }
|
|
|
Definition at line 500 of file p802_15_4csmaca.cc. References backoffHandler(), beaconEnabled, CURRENT_TIME, deferCCAT, Mac802_15_4::locateBoundary(), mac, p_BUSY_TX, p_RX_ON, phy, Phy802_15_4::PLME_CCA_request(), Mac802_15_4Timer::start(), Mac802_15_4::taskP, taskPending::taskStatus(), Mac802_15_4::toParent(), TP_CCA_csmaca, and TP_RX_ON_csmaca. Referenced by Mac802_15_4::PLME_SET_TRX_STATE_confirm(). 00501 { 00502 double now,wtime; 00503 00504 if (status != p_RX_ON) 00505 { 00506 if (status == p_BUSY_TX) 00507 mac->taskP.taskStatus(TP_RX_ON_csmaca) = true; 00508 else 00509 backoffHandler(); 00510 return; 00511 } 00512 00513 //locate backoff boundary if needed 00514 now = CURRENT_TIME; 00515 if (beaconEnabled) 00516 wtime = mac->locateBoundary(mac->toParent(txPkt),0.0); 00517 else 00518 wtime = 0.0; 00519 00520 if (wtime == 0.0) 00521 { 00522 mac->taskP.taskStatus(TP_CCA_csmaca) = true; 00523 phy->PLME_CCA_request(); 00524 } 00525 else 00526 deferCCAT->start(wtime); 00527 }
Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
Definition at line 430 of file p802_15_4csmaca.cc. References ackReq, adjustTime(), aUnitBackoffPeriod, Mac802_15_4::backoffStatus, backoffT, bcnRxTime, bcnTxTime, BE, beaconEnabled, beaconOther, SuperframeSpec::BI, bPeriod, Mac802_15_4Timer::busy(), canProceed(), CURRENT_TIME, Phy802_15_4::getRate(), Mac802_15_4::locateBoundary(), mac, Mac802_15_4::macBcnRxTime, Mac802_15_4::macBcnTxTime, MAC_PIB::macBeaconOrder, Mac802_15_4::macBeaconOrder2, Mac802_15_4::macBeaconOrder3, Mac802_15_4::mpib, phy, Random::random(), reset(), Mac802_15_4::sfSpec2, Mac802_15_4Timer::start(), Mac802_15_4::toParent(), and Mac802_15_4::txAck. Referenced by CCA_confirm(), and Mac802_15_4::csmacaResume(). 00431 { 00432 bool backoff; 00433 double rate,wtime,BI2; 00434 00435 00436 if (mac->txAck) 00437 { 00438 mac->backoffStatus = 0; 00439 txPkt = 0; 00440 return; 00441 } 00442 00443 assert(backoffT->busy() == 0); 00444 if (firsttime) 00445 { 00446 beaconEnabled = ((mac->mpib.macBeaconOrder != 15)||(mac->macBeaconOrder2 != 15)); 00447 beaconOther = (mac->macBeaconOrder3 != 15); 00448 reset(); 00449 assert(txPkt == 0); 00450 txPkt = pkt; 00451 ackReq = ackreq; 00452 rate = phy->getRate('s'); 00453 bPeriod = aUnitBackoffPeriod / rate; 00454 if (beaconEnabled) 00455 { 00456 bcnTxTime = mac->macBcnTxTime / rate; 00457 bcnRxTime = mac->macBcnRxTime / rate; 00458 //it's possible we missed some beacons 00459 BI2 = (mac->sfSpec2.BI / phy->getRate('s')); 00460 if (mac->macBeaconOrder2 != 15) 00461 while (bcnRxTime + BI2 < CURRENT_TIME) 00462 bcnRxTime += BI2; 00463 } 00464 } 00465 00466 wtime = (Random::random() % (1<<BE)) * bPeriod; 00467 wtime = adjustTime(wtime); 00468 backoff = true; 00469 if (beaconEnabled||beaconOther) 00470 { 00471 if (beaconEnabled) 00472 if (firsttime) 00473 wtime = mac->locateBoundary(mac->toParent(txPkt),wtime); 00474 if (!canProceed(wtime)) 00475 backoff = false; 00476 } 00477 if (backoff) 00478 backoffT->start(wtime); 00479 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 66 of file p802_15_4csmaca.h. |
|
|
Definition at line 63 of file p802_15_4csmaca.h. Referenced by CsmaCA802_15_4(). |
|
|
Definition at line 64 of file p802_15_4csmaca.h. Referenced by CsmaCA802_15_4(). |
|
|
Definition at line 65 of file p802_15_4csmaca.h. Referenced by CsmaCA802_15_4(). |
|
|
Definition at line 96 of file p802_15_4csmaca.h. Referenced by start(). |
|
|
Definition at line 86 of file p802_15_4csmaca.h. Referenced by cancel(), CsmaCA802_15_4(), newBeacon(), start(), and ~CsmaCA802_15_4(). |
|
|
Definition at line 87 of file p802_15_4csmaca.h. Referenced by cancel(), CsmaCA802_15_4(), newBeacon(), and ~CsmaCA802_15_4(). |
|
|
Definition at line 99 of file p802_15_4csmaca.h. Referenced by newBeacon(), and start(). |
|
|
Definition at line 99 of file p802_15_4csmaca.h. Referenced by adjustTime(), canProceed(), newBeacon(), and start(). |
|
|
Definition at line 94 of file p802_15_4csmaca.h. Referenced by CCA_confirm(), reset(), and start(). |
|
|
Definition at line 97 of file p802_15_4csmaca.h. Referenced by CCA_confirm(), newBeacon(), reset(), RX_ON_confirm(), and start(). |
|
|
Definition at line 97 of file p802_15_4csmaca.h. Referenced by CCA_confirm(), newBeacon(), and start(). |
|
|
Definition at line 100 of file p802_15_4csmaca.h. Referenced by adjustTime(), canProceed(), newBeacon(), and start(). |
|
|
Definition at line 101 of file p802_15_4csmaca.h. Referenced by canProceed(), CCA_confirm(), and newBeacon(). |
|
|
Definition at line 93 of file p802_15_4csmaca.h. Referenced by CCA_confirm(), and reset(). |
|
|
Definition at line 88 of file p802_15_4csmaca.h. Referenced by cancel(), CsmaCA802_15_4(), RX_ON_confirm(), and ~CsmaCA802_15_4(). |
|
|
Definition at line 91 of file p802_15_4csmaca.h. Referenced by adjustTime(), backoffHandler(), cancel(), canProceed(), CCA_confirm(), CsmaCA802_15_4(), deferCCAHandler(), newBeacon(), reset(), RX_ON_confirm(), and start(). |
|
|
Definition at line 92 of file p802_15_4csmaca.h. Referenced by CCA_confirm(), and reset(). |
|
|
Definition at line 90 of file p802_15_4csmaca.h. Referenced by CsmaCA802_15_4(), deferCCAHandler(), newBeacon(), RX_ON_confirm(), and start(). |
|
|
Definition at line 102 of file p802_15_4csmaca.h. Referenced by adjustTime(), canProceed(), and CsmaCA802_15_4(). |
|
|
Definition at line 98 of file p802_15_4csmaca.h. Referenced by canProceed(), CsmaCA802_15_4(), and newBeacon(). |
1.4.6