]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
deputy-fixes
authoridgay <idgay>
Fri, 27 Jun 2008 18:05:23 +0000 (18:05 +0000)
committeridgay <idgay>
Fri, 27 Jun 2008 18:05:23 +0000 (18:05 +0000)
tos/chips/msp430/adc12/AdcP.nc
tos/chips/msp430/adc12/Msp430Adc12ImplP.nc
tos/chips/msp430/adc12/Msp430Adc12SingleChannel.nc

index 620f480a06784a0d50b657c387d02b9885ab87e7..b8dea93f104ee859a79385dd5c35d97b291fe218 100644 (file)
@@ -159,7 +159,7 @@ implementation
   }
 
   async event uint16_t* SingleChannel.multipleDataReady[uint8_t client](
-      uint16_t * COUNT_NOK(length) buf, uint16_t length)
+      uint16_t *buf, uint16_t numSamples)
   {
     // error !
     return 0;
index a5df7bfeed65169a6c884943d93a9443e72dab88..0ce8a5450799aa351bee46ebf8407da3ba35afbc 100644 (file)
@@ -81,7 +81,6 @@ implementation
   
   uint16_t resultBufferLength;    /* length of buffer */
   uint16_t *COUNT_NOK(resultBufferLength) resultBufferStart;
-  uint16_t *BND_NOK(resultBufferStart, resultBufferStart+resultBufferLength) resultBuffer;         /* conversion results */
   uint16_t resultBufferIndex;     /* offset into buffer */
   uint8_t numChannels;            /* number of channels (multi-channel conversion) */
   uint8_t clientID;               /* ID of client that called getData() */
@@ -296,8 +295,9 @@ implementation
         ctl0.sht1 = config->sht;
 
         state = MULTIPLE_DATA;
-        resultBuffer = buf;
+       resultBufferStart = NULL;
         resultBufferLength = length;
+        resultBufferStart = buf;
         resultBufferIndex = 0;
         call HplAdc12.setCtl0(ctl0);
         call HplAdc12.setCtl1(ctl1);
@@ -352,8 +352,9 @@ implementation
         ctl0.sht1 = config->sht;
 
         state = MULTIPLE_DATA_REPEAT;
-        resultBuffer = buf;
+       resultBufferStart = NULL;
         resultBufferLength = length;
+        resultBufferStart = buf;
         resultBufferIndex = 0;            
         
         call HplAdc12.setCtl0(ctl0);
@@ -378,7 +379,7 @@ implementation
   {
     atomic {
       if (call ADCArbiterInfo.userId() == id){
-        if (state & MULTIPLE_DATA_REPEAT && !resultBuffer)
+        if (state & MULTIPLE_DATA_REPEAT && !resultBufferStart)
           return EINVAL;
         if (state & ADC_BUSY)
           return EBUSY;
@@ -431,8 +432,9 @@ implementation
         ctl0.sht1 = config->sht;
 
         state = MULTI_CHANNEL;
-        resultBuffer = buf;
+       resultBufferStart = NULL;
         resultBufferLength = numSamples;
+        resultBufferStart = buf;
         resultBufferIndex = 0;
         numChannels = numMemctl+1;
         call HplAdc12.setCtl0(ctl0);
@@ -461,7 +463,7 @@ implementation
     uint8_t i;
     atomic {
       if (call ADCArbiterInfo.userId() == id){
-        if (!resultBuffer)
+        if (!resultBufferStart)
           return EINVAL;
         if (state & ADC_BUSY)
           return EBUSY;
@@ -522,6 +524,8 @@ implementation
   async event void HplAdc12.conversionDone(uint16_t iv)
   {
     bool overflow = FALSE;
+    uint16_t *resultBuffer;
+
     if (iv <= 4){ // check for overflow
       if (iv == 2)
         signal Overflow.memOverflow[clientID]();
@@ -550,7 +554,7 @@ implementation
       case MULTI_CHANNEL:
         {
           uint16_t i = 0, k;
-          resultBufferStart = resultBuffer;
+          resultBuffer = resultBufferStart;
           do {
             *resultBuffer++ = call HplAdc12.getMem(i);
           } while (++i < numChannels);
@@ -568,7 +572,7 @@ implementation
       case MULTIPLE_DATA:
         {
           uint16_t i = 0, length, k;
-          resultBufferStart = resultBuffer;
+          resultBuffer = resultBufferStart + resultBufferIndex;
           if (resultBufferLength - resultBufferIndex > 16) 
             length = 16;
           else
@@ -597,15 +601,15 @@ implementation
       case MULTIPLE_DATA_REPEAT:
         {
           uint8_t i = 0;
-          resultBufferStart = resultBuffer;
+          resultBuffer = resultBufferStart;
           do {
             *resultBuffer++ = call HplAdc12.getMem(i);
           } while (++i < resultBufferLength);
           
-          resultBuffer = signal SingleChannel.multipleDataReady[clientID](
+          resultBufferStart = signal SingleChannel.multipleDataReady[clientID](
               resultBuffer-resultBufferLength,
               overflow ? 0 : resultBufferLength);
-          if (!resultBuffer)  
+          if (!resultBufferStart)  
             stopConversion();
           break;
         }
@@ -619,7 +623,7 @@ implementation
   }
    
   default async event uint16_t* SingleChannel.multipleDataReady[uint8_t id](
-      uint16_t *buf, uint16_t length)
+      uint16_t *buf, uint16_t numSamples)
   {
     return 0;
   }
index 2a9154902f7c1858572439fed0c4687a4c171d52..e0958ede0b7498996bb5080a9b23f14877cf646d 100644 (file)
@@ -224,7 +224,7 @@ interface Msp430Adc12SingleChannel
    * <code>numSamples</code> entries. The return value is ignored if the ADC
    * was configured with <code>configureMultiple()</code>.
    */    
-  async event uint16_t * ONE_NOK multipleDataReady(uint16_t *COUNT(numSamples) buffer, uint16_t numSamples); 
+  async event uint16_t * COUNT_NOK(numSamples) multipleDataReady(uint16_t *COUNT(numSamples) buffer, uint16_t numSamples); 
 
 }