From: janhauer Date: Wed, 25 Mar 2009 16:47:49 +0000 (+0000) Subject: Fixed an issue with indirect transmissions in nonbeacon-enabled mode: DispatchUnslott... X-Git-Tag: rc_6_tinyos_2_1_1~446 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=519673769e4a40805dc68b99f9e9ceb739d64800 Fixed an issue with indirect transmissions in nonbeacon-enabled mode: DispatchUnslottedCsmaP didn't check whether it already had the RadioToken before making a new request --- diff --git a/tos/lib/mac/tkn154/DebugC.nc b/tos/lib/mac/tkn154/DebugC.nc index 91d3dde9..6af96f46 100644 --- a/tos/lib/mac/tkn154/DebugC.nc +++ b/tos/lib/mac/tkn154/DebugC.nc @@ -36,7 +36,13 @@ configuration DebugC { } implementation { - components DebugP, LedsC; + components DebugP, LedsC, MainC; + DebugP.Boot -> MainC; DebugP.Leds -> LedsC; + +#if defined(PLATFORM_TELOSB) + components UserButtonC; + DebugP.ButtonPressed -> UserButtonC; +#endif } diff --git a/tos/lib/mac/tkn154/DebugP.nc b/tos/lib/mac/tkn154/DebugP.nc index 8cad827c..954e516c 100644 --- a/tos/lib/mac/tkn154/DebugP.nc +++ b/tos/lib/mac/tkn154/DebugP.nc @@ -40,9 +40,18 @@ #else #include #endif +#if defined(PLATFORM_TELOSB) +#include +#endif module DebugP { - uses interface Leds; + uses { + interface Boot; + interface Leds; +#if defined(PLATFORM_TELOSB) + interface Notify as ButtonPressed; +#endif + } } implementation { @@ -70,6 +79,19 @@ implementation { norace char m_assertFilename[MAX_LEN_FILENAME]; norace char m_assertFunction[MAX_LEN_FUNNAME]; + event void Boot.booted() { +#if defined(PLATFORM_TELOSB) + call ButtonPressed.enable(); +#endif + } + +#if defined(PLATFORM_TELOSB) + event void ButtonPressed.notify( button_state_t val ) + { + dbg_serial_flush(); + } +#endif + task void assertFailTask() { if (m_assertCounter == 0) { diff --git a/tos/lib/mac/tkn154/DispatchUnslottedCsmaP.nc b/tos/lib/mac/tkn154/DispatchUnslottedCsmaP.nc index 7c916dc2..f997b798 100644 --- a/tos/lib/mac/tkn154/DispatchUnslottedCsmaP.nc +++ b/tos/lib/mac/tkn154/DispatchUnslottedCsmaP.nc @@ -175,6 +175,7 @@ implementation post signalStartConfirmTask(); status = IEEE154_SUCCESS; } + dbg_serial("DispatchUnslottedCsmaP", "MLME_START.request -> result: %lu\n", (uint32_t) status); return status; } @@ -191,7 +192,10 @@ implementation return IEEE154_TRANSACTION_OVERFLOW; } else { setCurrentFrame(frame); - call RadioToken.request(); + if (call RadioToken.isOwner()) + updateState(); + else + call RadioToken.request(); return IEEE154_SUCCESS; } } diff --git a/tos/lib/mac/tkn154/IndirectTxP.nc b/tos/lib/mac/tkn154/IndirectTxP.nc index e1eacd6f..773bdf5b 100644 --- a/tos/lib/mac/tkn154/IndirectTxP.nc +++ b/tos/lib/mac/tkn154/IndirectTxP.nc @@ -276,6 +276,7 @@ implementation { uint8_t i; // TODO: if CSMA-CA algorithm failed, then frame shall still remain in transaction queue + dbg_serial("IndirectTxP", "transmitDone(), status: %lu\n", (uint32_t) status); for (i=0; iclient](txFrame, status); post tryCoordCapTxTask(); - dbg_serial("IndirectTxP", "transmitDone()\n"); } command ieee154_txframe_t* GetIndirectTxFrame.get() { return m_pendingTxFrame;}