From: janhauer Date: Thu, 7 May 2009 12:41:36 +0000 (+0000) Subject: PIB attribute macMaxFrameTotalWaitTime was not calculated correctly and PIB attribut... X-Git-Tag: rc_6_tinyos_2_1_1~393 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=000887fbfc824a9a8632ba3c3a71e23524d516a8 PIB attribute macMaxFrameTotalWaitTime was not calculated correctly and PIB attribute macPersistenceTime was not converted correctly. This is now fixed. --- diff --git a/tos/lib/mac/tkn154/IndirectTxP.nc b/tos/lib/mac/tkn154/IndirectTxP.nc index 773bdf5b..0ab73abb 100644 --- a/tos/lib/mac/tkn154/IndirectTxP.nc +++ b/tos/lib/mac/tkn154/IndirectTxP.nc @@ -89,13 +89,19 @@ implementation return SUCCESS; } - uint32_t getPersistenceTime() + uint32_t getPersistenceTimeSymbols() { - uint32_t persistenceTime; - persistenceTime = call MLME_GET.macTransactionPersistenceTime(); - persistenceTime *= IEEE154_aBaseSuperframeDuration; - persistenceTime *= ((uint16_t) 1) << call MLME_GET.macBeaconOrder(); - return persistenceTime; + // transform macTransactionPersistenceTime PIB attribute + // from "unit periods" to symbols (cf. page 166) + uint32_t unitPeriod; + ieee154_macBeaconOrder_t BO = call MLME_GET.macBeaconOrder(); + + if (BO <= 14) { + unitPeriod = IEEE154_aBaseSuperframeDuration; + unitPeriod *= ((uint16_t) 1) << BO; + } else + unitPeriod = IEEE154_aBaseSuperframeDuration; + return unitPeriod * call MLME_GET.macTransactionPersistenceTime(); } command ieee154_status_t Purge.purge(uint8_t msduHandle) @@ -157,7 +163,7 @@ implementation else if ((txFrame->header->mhr[MHR_INDEX_FC2] & FC2_DEST_MODE_MASK) == FC2_DEST_MODE_EXTENDED) m_numExtPending++; if (!call IndirectTxTimeout.isRunning()) - call IndirectTxTimeout.startOneShot(getPersistenceTime()); + call IndirectTxTimeout.startOneShot(getPersistenceTimeSymbols()); dbg_serial("IndirectTxP", "Preparing a transmission.\n"); signal PendingAddrSpecUpdated.notify(TRUE); return IEEE154_SUCCESS; @@ -245,7 +251,7 @@ implementation { // a transaction has expired uint32_t now = call IndirectTxTimeout.getNow(), dt=0; - uint32_t persistenceTime = getPersistenceTime(); + uint32_t persistenceTime = getPersistenceTimeSymbols(); uint8_t i; for (i=0; i