From 2f3b4d843e48cfe098d8b01159d756fddd6420b8 Mon Sep 17 00:00:00 2001 From: idgay Date: Mon, 23 Jun 2008 22:44:27 +0000 Subject: [PATCH] deputy-fixes --- tos/chips/atm128/adc/AdcStreamP.nc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tos/chips/atm128/adc/AdcStreamP.nc b/tos/chips/atm128/adc/AdcStreamP.nc index b5a844f4..4af74c3f 100644 --- a/tos/chips/atm128/adc/AdcStreamP.nc +++ b/tos/chips/atm128/adc/AdcStreamP.nc @@ -72,7 +72,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; @@ -208,6 +208,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); @@ -228,7 +229,7 @@ implementation { else { *pos++ = data; - if (!--count) + if (pos == buffer + count) { atomic { @@ -241,8 +242,8 @@ implementation { } else { + lastCount = count; lastBuffer = buffer; - lastCount = pos - buffer; } } post bufferDone(); -- 2.39.2