[Tinyos-beta-commits] CVS: tinyos-1.x/beta/Deluge/Deluge/TOSBoot Voltage.nc, NONE, 1.1 TOSBoot.nc, 1.4, 1.5 TOSBootM.nc, 1.7, 1.8

Jonathan Hui jwhui at users.sourceforge.net
Thu Jun 9 12:29:02 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/TOSBoot
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29678

Modified Files:
	TOSBoot.nc TOSBootM.nc 
Added Files:
	Voltage.nc 
Log Message:
- Check voltage before writing to the flash. If the voltage is below
the specified operating voltage, TOSBoot will execute the currently
programmed TinyOS application. No golden gesture is allowed since the
golden image can't be programmed and detecting the gesture requires
writing to the internal flash anyways. On the msp430 platform, the
minimum voltage is 2.7V.



--- NEW FILE: Voltage.nc ---
// $Id: Voltage.nc,v 1.1 2005/06/09 19:29:00 jwhui Exp $

/*									tab:2
 *
 *
 * "Copyright (c) 2000-2004 The Regents of the University  of California.  
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * 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
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 */

/**
 * @author Jonathan Hui <jwhui at cs.berkeley.edu>
 */

interface Voltage {
  command bool okToProgram();
}

Index: TOSBoot.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/TOSBoot/TOSBoot.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TOSBoot.nc	2 May 2005 04:55:52 -0000	1.4
--- TOSBoot.nc	9 Jun 2005 19:29:00 -0000	1.5
***************
*** 44,48 ****
      PluginC,
      ProgFlashM as ProgFlash,
!     STM25PC as ExtFlash;
  
    TOSBootM.SubControl -> ExtFlash.StdControl;
--- 44,49 ----
      PluginC,
      ProgFlashM as ProgFlash,
!     STM25PC as ExtFlash,
!     VoltageC;
  
    TOSBootM.SubControl -> ExtFlash.StdControl;
***************
*** 53,56 ****
--- 54,58 ----
    TOSBootM.Leds -> LedsC;
    TOSBootM.ProgFlash -> ProgFlash;
+   TOSBootM.Voltage -> VoltageC;
  
  }

Index: TOSBootM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/TOSBoot/TOSBootM.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** TOSBootM.nc	18 May 2005 06:44:45 -0000	1.7
--- TOSBootM.nc	9 Jun 2005 19:29:00 -0000	1.8
***************
*** 36,39 ****
--- 36,40 ----
      interface TOSBootProgFlash as ProgFlash;
      interface StdControl as SubControl;
+     interface Voltage;
    }
  }
***************
*** 201,204 ****
--- 202,214 ----
      uint8_t  flags;
  
+     // check voltage and make sure flash can be programmed
+     //   if not, just run the app, can't check for gestures
+     //   if we can't write to the internal flash anyway
+     if ( !call Voltage.okToProgram() ) {
+       // give user some time and count down LEDs
+       startupLeds();
+       runApp();
+     }
+ 
      // get current value of counter
      call IntFlash.read((uint8_t*)TOSBOOT_GESTURE_COUNT_ADDR, &gestureCount, sizeof(gestureCount));



More information about the Tinyos-beta-commits mailing list