]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/mac/tkn154/DispatchUnslottedCsmaP.nc
Indirect transmissions in nonbeacon-enabled PANs on coordinator side were not properl...
[tinyos-2.x.git] / tos / lib / mac / tkn154 / DispatchUnslottedCsmaP.nc
index 7c916dc2490cb6f0de03077b84bc5ffaf20df46e..53ebe948a6b9800f630e641dbb9467b2adf9b37b 100644 (file)
  * not part of the MAC implementation but of the chip-specific radio driver.
  */
 
-#if IEEE154_BEACON_ENABLED_PAN
-#error "The IEEE154_BEACON_ENABLED_PAN macro MUST NOT be set when using this component!"
-#endif
-
 module DispatchUnslottedCsmaP
 {
   provides
@@ -169,12 +165,12 @@ implementation
       call MLME_SET.macPANId(panID);
       call MLME_SET.phyCurrentChannel(logicalChannel);
       call MLME_SET.macBeaconOrder(beaconOrder);
-      call SetMacSuperframeOrder.set(superframeOrder);
       call SetMacPanCoordinator.set(panCoordinator);
       //TODO: check realignment
       post signalStartConfirmTask();
       status = IEEE154_SUCCESS;
     }      
+    dbg_serial("DispatchUnslottedCsmaP", "MLME_START.request -> result: %lu\n", (uint32_t) status);
     return status;
   }
 
@@ -191,7 +187,10 @@ implementation
       return IEEE154_TRANSACTION_OVERFLOW;
     } else {
       setCurrentFrame(frame);
-      call RadioToken.request();
+      if (call RadioToken.isOwner())
+        updateState();
+      else
+        call RadioToken.request();      
       return IEEE154_SUCCESS;
     }
   }
@@ -464,9 +463,10 @@ implementation
     uint8_t *mhr = MHR(frame);
     uint8_t frameType = mhr[MHR_INDEX_FC1] & FC1_FRAMETYPE_MASK;
 
-    dbg("DispatchUnslottedCsmaP", "Received frame, DSN: %lu, result: 0x%lx\n", (uint32_t) mhr[MHR_INDEX_SEQNO]);
     if (frameType == FC1_FRAMETYPE_CMD)
       frameType += payload[0];
+    dbg("DispatchUnslottedCsmaP", "Received frame, DSN: %lu, type: 0x%lu\n", 
+        (uint32_t) mhr[MHR_INDEX_SEQNO], (uint32_t) frameType);
     atomic {
       if (m_indirectTxPending) {
         message_t* frameBuf;