[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/atm1281/adc Atm128AdcP.nc, 1.1, 1.2 HplAtm128AdcP.nc, 1.1, 1.2

Janos Sallai sallai at users.sourceforge.net
Mon Jul 7 12:52:54 PDT 2008


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/atm1281/adc
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13394/adc

Modified Files:
	Atm128AdcP.nc HplAtm128AdcP.nc 
Log Message:
added safe tinyos annotations

Index: Atm128AdcP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm1281/adc/Atm128AdcP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Atm128AdcP.nc	5 Nov 2007 20:36:42 -0000	1.1
--- Atm128AdcP.nc	7 Jul 2008 19:52:52 -0000	1.2
***************
*** 1,4 ****
  /* $Id$
!  * "Copyright (c) 2000-2003 The Regents of the University  of California.  
   * All rights reserved.
   *
--- 1,4 ----
  /* $Id$
!  * "Copyright (c) 2000-2003 The Regents of the University  of California.
   * All rights reserved.
   *
***************
*** 7,16 ****
   * hereby granted, provided that the above copyright notice, the following
   * two paragraphs and the author appear in all copies of this software.
!  * 
   * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
   * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
   * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
   * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  * 
   * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
--- 7,16 ----
   * hereby granted, provided that the above copyright notice, the following
   * two paragraphs and the author appear in all copies of this software.
!  *
   * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
   * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
   * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
   * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  *
   * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
***************
*** 22,28 ****
   * All rights reserved.
   *
!  * This file is distributed under the terms in the attached INTEL-LICENSE     
   * file. If you do not find these files, copies can be found by writing to
!  * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
   * 94704.  Attention:  Intel License Inquiry.
   *
--- 22,28 ----
   * All rights reserved.
   *
!  * This file is distributed under the terms in the attached INTEL-LICENSE
   * file. If you do not find these files, copies can be found by writing to
!  * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
   * 94704.  Attention:  Intel License Inquiry.
   *
***************
*** 33,48 ****
   * hereby granted, provided that the above copyright notice, the following
   * two paragraphs and the author appear in all copies of this software.
!  * 
!  * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO 
!  * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 
   * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
!  * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
!  * DAMAGE. 
   *
   * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
!  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 
!  * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY 
!  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
   * MODIFICATIONS.
   *
--- 33,48 ----
   * hereby granted, provided that the above copyright notice, the following
   * two paragraphs and the author appear in all copies of this software.
!  *
!  * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO
!  * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
   * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
!  * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
!  * DAMAGE.
   *
   * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
!  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
!  * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY
!  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
   * MODIFICATIONS.
   *
***************
*** 54,63 ****
   * hereby granted, provided that the above copyright notice, the following
   * two paragraphs and the author appear in all copies of this software.
!  * 
   * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
   * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
   * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
   * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  * 
   * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
--- 54,63 ----
   * hereby granted, provided that the above copyright notice, the following
   * two paragraphs and the author appear in all copies of this software.
!  *
   * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
   * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
   * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
   * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  *
   * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
***************
*** 82,86 ****
   */
  
! module Atm128AdcP 
  {
    provides {
--- 82,86 ----
   */
  
! module Atm128AdcP @safe()
  {
    provides {
***************
*** 96,100 ****
  }
  implementation
! {  
    /* State for the current and next (multiple-sampling only) conversion */
    struct {
--- 96,100 ----
  }
  implementation
! {
    /* State for the current and next (multiple-sampling only) conversion */
    struct {
***************
*** 103,107 ****
      uint8_t channel : 5;	/* what channel did this sample come from? */
    } f, nextF;
!   
    command error_t Init.init() {
      atomic
--- 103,107 ----
      uint8_t channel : 5;	/* what channel did this sample come from? */
    } f, nextF;
! 
    command error_t Init.init() {
      atomic
***************
*** 110,117 ****
  
  	adcsr.aden = ATM128_ADC_ENABLE_OFF;
! 	adcsr.adsc = ATM128_ADC_START_CONVERSION_OFF;  
! 	adcsr.adate= ATM128_ADC_FREE_RUNNING_OFF; 
! 	adcsr.adif = ATM128_ADC_INT_FLAG_OFF;               
! 	adcsr.adie = ATM128_ADC_INT_ENABLE_OFF;       
  	adcsr.adps = ATM128_ADC_PRESCALE_2;
  	call HplAtm128Adc.setAdcsra(adcsr);
--- 110,117 ----
  
  	adcsr.aden = ATM128_ADC_ENABLE_OFF;
! 	adcsr.adsc = ATM128_ADC_START_CONVERSION_OFF;
! 	adcsr.adate= ATM128_ADC_FREE_RUNNING_OFF;
! 	adcsr.adif = ATM128_ADC_INT_FLAG_OFF;
! 	adcsr.adie = ATM128_ADC_INT_ENABLE_OFF;
  	adcsr.adps = ATM128_ADC_PRESCALE_2;
  	call HplAtm128Adc.setAdcsra(adcsr);
***************
*** 122,126 ****
    /* We enable the A/D when start is called, and disable it when stop is
       called. This drops A/D conversion latency by a factor of two (but
!      increases idle mode power consumption a little). 
    */
    async command error_t AsyncStdControl.start() {
--- 122,126 ----
    /* We enable the A/D when start is called, and disable it when stop is
       called. This drops A/D conversion latency by a factor of two (but
!      increases idle mode power consumption a little).
    */
    async command error_t AsyncStdControl.start() {
***************
*** 148,152 ****
      uint8_t channel;
  
!     atomic 
        {
  	channel = f.channel;
--- 148,152 ----
      uint8_t channel;
  
!     atomic
        {
  	channel = f.channel;
***************
*** 175,179 ****
  	Atm128Admux_t admux;
  
! 	atomic 
  	  {
  	    admux = call HplAtm128Adc.getAdmux();
--- 175,179 ----
  	Atm128Admux_t admux;
  
! 	atomic
  	  {
  	    admux = call HplAtm128Adc.getAdmux();

Index: HplAtm128AdcP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm1281/adc/HplAtm128AdcP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** HplAtm128AdcP.nc	5 Nov 2007 20:36:42 -0000	1.1
--- HplAtm128AdcP.nc	7 Jul 2008 19:52:52 -0000	1.2
***************
*** 7,23 ****
   * hereby granted, provided that the above copyright notice, the following
   * two paragraphs and the author appear in all copies of this software.
!  * 
!  * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO 
!  * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 
   * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
!  * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
!  * DAMAGE. 
   *
   * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
!  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 
!  * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY 
!  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
!  * MODIFICATIONS. 
   */
  
--- 7,23 ----
   * hereby granted, provided that the above copyright notice, the following
   * two paragraphs and the author appear in all copies of this software.
!  *
!  * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO
!  * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
   * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
!  * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
!  * DAMAGE.
   *
   * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
!  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
!  * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY
!  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
!  * MODIFICATIONS.
   */
  
***************
*** 30,39 ****
   * hereby granted, provided that the above copyright notice, the following
   * two paragraphs and the author appear in all copies of this software.
!  * 
   * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
   * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
   * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
   * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  * 
   * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
--- 30,39 ----
   * hereby granted, provided that the above copyright notice, the following
   * two paragraphs and the author appear in all copies of this software.
!  *
   * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
   * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
   * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
   * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  *
   * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
***************
*** 56,60 ****
   */
  
! module HplAtm128AdcP {
    provides interface HplAtm128Adc;
    uses interface McuPowerState;
--- 56,60 ----
   */
  
! module HplAtm128AdcP @safe() {
    provides interface HplAtm128Adc;
    uses interface McuPowerState;
***************
*** 62,73 ****
  implementation {
    //=== Direct read of HW registers. =================================
!   async command Atm128Admux_t HplAtm128Adc.getAdmux() { 
!     return *(Atm128Admux_t*)&ADMUX; 
    }
!   async command Atm128Adcsra_t HplAtm128Adc.getAdcsra() { 
!     return *(Atm128Adcsra_t*)&ADCSRA; 
    }
!   async command uint16_t HplAtm128Adc.getValue() { 
!     return ADC; 
    }
  
--- 62,73 ----
  implementation {
    //=== Direct read of HW registers. =================================
!   async command Atm128Admux_t HplAtm128Adc.getAdmux() {
!     return *(Atm128Admux_t*)&ADMUX;
    }
!   async command Atm128Adcsra_t HplAtm128Adc.getAdcsra() {
!     return *(Atm128Adcsra_t*)&ADCSRA;
    }
!   async command uint16_t HplAtm128Adc.getValue() {
!     return ADC;
    }
  
***************
*** 76,88 ****
  
    //=== Direct write of HW registers. ================================
!   async command void HplAtm128Adc.setAdmux( Atm128Admux_t x ) { 
!     ADMUX = Admux2int(x); 
    }
!   async command void HplAtm128Adc.setAdcsra( Atm128Adcsra_t x ) { 
!     ADCSRA = Adcsra2int(x); 
    }
  
    async command void HplAtm128Adc.setPrescaler(uint8_t scale){
!     Atm128Adcsra_t  current_val = call HplAtm128Adc.getAdcsra(); 
      current_val.adif = FALSE;
      current_val.adps = scale;
--- 76,88 ----
  
    //=== Direct write of HW registers. ================================
!   async command void HplAtm128Adc.setAdmux( Atm128Admux_t x ) {
!     ADMUX = Admux2int(x);
    }
!   async command void HplAtm128Adc.setAdcsra( Atm128Adcsra_t x ) {
!     ADCSRA = Adcsra2int(x);
    }
  
    async command void HplAtm128Adc.setPrescaler(uint8_t scale){
!     Atm128Adcsra_t  current_val = call HplAtm128Adc.getAdcsra();
      current_val.adif = FALSE;
      current_val.adps = scale;
***************
*** 93,107 ****
    // It's not clear these are that useful...
    async command void HplAtm128Adc.enableAdc() {
!     SET_BIT(ADCSRA, ADEN); 
      call McuPowerState.update();
    }
    async command void HplAtm128Adc.disableAdc() {
!     CLR_BIT(ADCSRA, ADEN); 
      call McuPowerState.update();
    }
    async command void HplAtm128Adc.enableInterruption() { SET_BIT(ADCSRA, ADIE); }
    async command void HplAtm128Adc.disableInterruption() { CLR_BIT(ADCSRA, ADIE); }
!   async command void HplAtm128Adc.setContinuous() { 
!     ((Atm128Adcsrb_t*)&ADCSRB)->adts = 0; 
      SET_BIT(ADCSRA, ADATE);
    }
--- 93,107 ----
    // It's not clear these are that useful...
    async command void HplAtm128Adc.enableAdc() {
!     SET_BIT(ADCSRA, ADEN);
      call McuPowerState.update();
    }
    async command void HplAtm128Adc.disableAdc() {
!     CLR_BIT(ADCSRA, ADEN);
      call McuPowerState.update();
    }
    async command void HplAtm128Adc.enableInterruption() { SET_BIT(ADCSRA, ADIE); }
    async command void HplAtm128Adc.disableInterruption() { CLR_BIT(ADCSRA, ADIE); }
!   async command void HplAtm128Adc.setContinuous() {
!     ((Atm128Adcsrb_t*)&ADCSRB)->adts = 0;
      SET_BIT(ADCSRA, ADATE);
    }
***************
*** 112,125 ****
  
    /* A/D status checks */
!   async command bool HplAtm128Adc.isEnabled()     {       
!     return (call HplAtm128Adc.getAdcsra()).aden; 
    }
  
    async command bool HplAtm128Adc.isStarted()     {
!     return (call HplAtm128Adc.getAdcsra()).adsc; 
    }
!   
    async command bool HplAtm128Adc.isComplete()    {
!     return (call HplAtm128Adc.getAdcsra()).adif; 
    }
  
--- 112,125 ----
  
    /* A/D status checks */
!   async command bool HplAtm128Adc.isEnabled()     {
!     return (call HplAtm128Adc.getAdcsra()).aden;
    }
  
    async command bool HplAtm128Adc.isStarted()     {
!     return (call HplAtm128Adc.getAdcsra()).adsc;
    }
! 
    async command bool HplAtm128Adc.isComplete()    {
!     return (call HplAtm128Adc.getAdcsra()).adif;
    }
  
***************
*** 127,131 ****
    AVR_ATOMIC_HANDLER(SIG_ADC) {
      uint16_t data = call HplAtm128Adc.getValue();
!     
      __nesc_enable_interrupt();
      signal HplAtm128Adc.dataReady(data);
--- 127,131 ----
    AVR_ATOMIC_HANDLER(SIG_ADC) {
      uint16_t data = call HplAtm128Adc.getValue();
! 
      __nesc_enable_interrupt();
      signal HplAtm128Adc.dataReady(data);
***************
*** 134,138 ****
    default async event void HplAtm128Adc.dataReady(uint16_t done) { }
  
!   async command bool HplAtm128Adc.cancel() { 
      /* This is tricky */
      atomic
--- 134,138 ----
    default async event void HplAtm128Adc.dataReady(uint16_t done) { }
  
!   async command bool HplAtm128Adc.cancel() {
      /* This is tricky */
      atomic



More information about the Tinyos-2-commits mailing list