]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
- age cache whenever a new messages arrives
authorandreaskoepke <andreaskoepke>
Thu, 4 Oct 2007 09:40:49 +0000 (09:40 +0000)
committerandreaskoepke <andreaskoepke>
Thu, 4 Oct 2007 09:40:49 +0000 (09:40 +0000)
- add debug interface

tos/chips/tda5250/mac/DuplicateC.nc
tos/chips/tda5250/mac/DuplicateP.nc

index b57c166b27a838222a2bc449aa5d7d9a2d788cdc..64bc4199e682c966198a354b54b37f67139ecba3 100644 (file)
@@ -47,4 +47,10 @@ implementation {
     Duplicate = DuplicateP;
     DuplicateP.Timer -> Timer;        // make information soft state
     MainC.SoftwareInit -> DuplicateP; 
+
+#ifdef DUPLICATE_DEBUG
+    components new SerialDebugC() as SD;
+    DuplicateP.SerialDebug -> SD;
+#endif
+
 }
index b07b5686676e83d889ea751b5151fed9780da243..e5df65084f862a9eb3c7333bcae6e4616b334a07 100644 (file)
@@ -39,11 +39,35 @@ module DuplicateP {
   }
   uses {
       interface Timer<TMilli> as Timer;
+#ifdef DUPLICATE_DEBUG
+      interface SerialDebug;
+#endif
   }
 }
-implementation {    
+implementation {
     known_t knownTable[TABLE_ENTRIES];
-
+    
+#ifdef DUPLICATE_DEBUG
+    void sdDebug(uint16_t p) {
+        call SerialDebug.putPlace(p);
+    }
+    known_t dupOldest;
+    unsigned last;
+    task void dump() {
+        sdDebug(3000 + last);
+        sdDebug(dupOldest.src);
+        sdDebug(dupOldest.seqno);
+        sdDebug(dupOldest.age);
+        sdDebug(4000);
+        sdDebug(knownTable[last].src);
+        sdDebug(knownTable[last].seqno);
+        sdDebug(knownTable[last].age);
+        sdDebug(5000);
+    }
+#else
+    void sdDebug(uint16_t p) {};
+#endif
+    
     /** helper functions */
     task void ageMsgsTask() {
         unsigned i;
@@ -80,14 +104,22 @@ implementation {
                 break;
             }
         }
+        sdDebug(100 + rVal);
+        sdDebug(200 + i);
         return rVal;
     }
     
     async command void Duplicate.remember(am_addr_t src, uint8_t seqno) {
         unsigned oldest = findOldest();
+#ifdef DUPLICATE_DEBUG
+        dupOldest = knownTable[oldest];
+        last = oldest;
+        post dump();
+#endif
         knownTable[oldest].src = src;
         knownTable[oldest].seqno = seqno;
         knownTable[oldest].age = 0;
+        post ageMsgsTask();
     }
 
     /** helper interfaces */
@@ -99,7 +131,7 @@ implementation {
         uint8_t i;
         for(i = 0; i < TABLE_ENTRIES; i++) {
             atomic {
-                    knownTable[i].age = MAX_AGE;
+                knownTable[i].age = MAX_AGE;
             }
         }
         call Timer.startPeriodic(AGE_INTERVALL);