From 93123addd02f543de90866c1fe58783312105b55 Mon Sep 17 00:00:00 2001 From: regehr Date: Wed, 25 Jun 2008 16:36:29 +0000 Subject: [PATCH] deputize --- tos/chips/msp430/adc12/AdcStreamP.nc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tos/chips/msp430/adc12/AdcStreamP.nc b/tos/chips/msp430/adc12/AdcStreamP.nc index 7ccc83e6..7bc24f87 100644 --- a/tos/chips/msp430/adc12/AdcStreamP.nc +++ b/tos/chips/msp430/adc12/AdcStreamP.nc @@ -71,7 +71,7 @@ implementation { }; 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; @@ -187,6 +187,7 @@ implementation { 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); @@ -242,7 +243,7 @@ implementation { else { *pos++ = data; - if (!--count) + if (pos == buffer + count) { atomic { @@ -255,8 +256,8 @@ implementation { } else { + lastCount = count; lastBuffer = buffer; - lastCount = pos - buffer; } } post bufferDone(); -- 2.39.2