]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
deputize
authorregehr <regehr>
Wed, 25 Jun 2008 16:36:29 +0000 (16:36 +0000)
committerregehr <regehr>
Wed, 25 Jun 2008 16:36:29 +0000 (16:36 +0000)
tos/chips/msp430/adc12/AdcStreamP.nc

index 7ccc83e681c08ca9ce849edc604980460a2c8592..7bc24f87ba6918540151e09ab2bd93b621de56f3 100644 (file)
@@ -71,7 +71,7 @@ implementation {
   };
   struct list_entry_t *bufferQueue[NSTREAM];
   struct list_entry_t * ONE_NOK * bufferQueueEnd[NSTREAM];
   };
   struct list_entry_t *bufferQueue[NSTREAM];
   struct list_entry_t * ONE_NOK * bufferQueueEnd[NSTREAM];
-  uint16_t * ONE_NOK lastBuffer, lastCount;
+  uint16_t * COUNT_NOK(lastCount) lastBuffer, lastCount;
 
   norace uint16_t count;
   norace uint16_t * COUNT_NOK(count) buffer; 
 
   norace uint16_t count;
   norace uint16_t * COUNT_NOK(count) buffer; 
@@ -187,6 +187,7 @@ implementation {
         bufferQueue[client] = entry->next;
         if (!bufferQueue[client])
           bufferQueueEnd[client] = &bufferQueue[client];
         bufferQueue[client] = entry->next;
         if (!bufferQueue[client])
           bufferQueueEnd[client] = &bufferQueue[client];
+       pos = buffer = NULL;
         count = entry->count;
         tmp_count = count;
        pos = buffer = TCAST(uint16_t * COUNT_NOK(tmp_count), entry);
         count = entry->count;
         tmp_count = count;
        pos = buffer = TCAST(uint16_t * COUNT_NOK(tmp_count), entry);
@@ -242,7 +243,7 @@ implementation {
     else
     {
       *pos++ = data;
     else
     {
       *pos++ = data;
-      if (!--count)
+      if (pos == buffer + count)
       {
         atomic
         {
       {
         atomic
         {
@@ -255,8 +256,8 @@ implementation {
           }
           else
           {
           }
           else
           {
+           lastCount = count;
             lastBuffer = buffer;
             lastBuffer = buffer;
-            lastCount = pos - buffer;
           }
         }
         post bufferDone();
           }
         }
         post bufferDone();