X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=blobdiff_plain;f=tos%2Fchips%2Fmsp430%2Fadc12%2FMsp430Adc12ImplP.nc;h=e9e7f68e869dd8f07bee73dbd5bb08d86d407252;hp=0ce8a5450799aa351bee46ebf8407da3ba35afbc;hb=e9bfab607e051bae6afb47b44892ce37541d1b44;hpb=adf1de6c009d13b7b52e68535c63b28f59c97400 diff --git a/tos/chips/msp430/adc12/Msp430Adc12ImplP.nc b/tos/chips/msp430/adc12/Msp430Adc12ImplP.nc index 0ce8a545..e9e7f68e 100644 --- a/tos/chips/msp430/adc12/Msp430Adc12ImplP.nc +++ b/tos/chips/msp430/adc12/Msp430Adc12ImplP.nc @@ -63,7 +63,11 @@ module Msp430Adc12ImplP @safe() } implementation { -#warning Accessing TimerA for ADC12 + +#ifdef ADC12_TIMERA_ENABLED + #warning Accessing TimerA for ADC12 +#endif + enum { SINGLE_DATA = 1, SINGLE_DATA_REPEAT = 2, @@ -218,6 +222,10 @@ implementation { error_t result = ERESERVE; #ifdef ADC12_CHECK_ARGS +#ifndef ADC12_TIMERA_ENABLED + if (jiffies>0) + return EINVAL; +#endif if (!config || jiffies == 1 || jiffies == 2) return EINVAL; #endif @@ -266,6 +274,10 @@ implementation { error_t result = ERESERVE; #ifdef ADC12_CHECK_ARGS +#ifndef ADC12_TIMERA_ENABLED + if (jiffies>0) + return EINVAL; +#endif if (!config || !buf || !length || jiffies == 1 || jiffies == 2) return EINVAL; #endif @@ -323,6 +335,10 @@ implementation { error_t result = ERESERVE; #ifdef ADC12_CHECK_ARGS +#ifndef ADC12_TIMERA_ENABLED + if (jiffies>0) + return EINVAL; +#endif if (!config || !buf || !length || length > 16 || jiffies == 1 || jiffies == 2) return EINVAL; #endif @@ -379,7 +395,7 @@ implementation { atomic { if (call ADCArbiterInfo.userId() == id){ - if (state & MULTIPLE_DATA_REPEAT && !resultBufferStart) + if ((state & MULTIPLE_DATA_REPEAT) && !resultBufferStart) return EINVAL; if (state & ADC_BUSY) return EBUSY; @@ -402,6 +418,10 @@ implementation { error_t result = ERESERVE; #ifdef ADC12_CHECK_ARGS +#ifndef ADC12_TIMERA_ENABLED + if (jiffies>0) + return EINVAL; +#endif if (!config || !memctl || !numMemctl || numMemctl > 15 || !numSamples || !buf || jiffies == 1 || jiffies == 2 || numSamples % (numMemctl+1) != 0) return EINVAL; @@ -554,7 +574,7 @@ implementation case MULTI_CHANNEL: { uint16_t i = 0, k; - resultBuffer = resultBufferStart; + resultBuffer = resultBufferStart + resultBufferIndex; do { *resultBuffer++ = call HplAdc12.getMem(i); } while (++i < numChannels); @@ -566,7 +586,7 @@ implementation resultBufferIndex = 0; signal MultiChannel.dataReady[clientID](resultBuffer, overflow ? k : resultBufferLength); - } else call HplAdc12.enableConversion(); + } } break; case MULTIPLE_DATA: