[Tinyos-beta-commits] CVS: tinyos-1.x/beta/STM25P/TestStorage Makefile, NONE, 1.1 TestFormatStorage.nc, NONE, 1.1 TestFormatStorageM.nc, NONE, 1.1

Jonathan Hui jwhui at users.sourceforge.net
Fri Mar 11 13:44:14 PST 2005


Update of /cvsroot/tinyos/tinyos-1.x/beta/STM25P/TestStorage
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25492/TestStorage

Added Files:
	Makefile TestFormatStorage.nc TestFormatStorageM.nc 
Log Message:
- This directory contains the storage stack implementation for the
STM25P family of chips. The implementation follows proposed TinyOS
Storage Abstraction being introduced in TinyOS 2.x and detailed in
tep103.

- The new storage stack now requires formatting the flash before it
can be used. The flash is partitioned into segments with size equal to
a multiple of STORAGE_BLOCK_SIZE. An example for formating the flash
is included in beta/STM25P/TestStorage/.

- Implementation Status:
  - BlockStorage: nearly complete except commit()/verify(). Well
  tested under Deluge.
  - LogStorage: nearly complete except seek()/sync(). Limited testing.
  - ConfigStorage: not implemented



--- NEW FILE: Makefile ---
#COMPONENT?=TestLogStorage
#COMPONENT?=TestBlockStorage
COMPONENT?=TestFormatStorage
#COMPONENT?=TestHALSTM25P
#COMPONENT?=TestStorageManager
include $(TOSDIR)/../apps/Makerules


--- NEW FILE: TestFormatStorage.nc ---
// $Id: TestFormatStorage.nc,v 1.1 2005/03/11 21:44:11 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>
 */

configuration TestFormatStorage {
}

implementation {

  components Main, TestFormatStorageM, FormatStorageC, TimerC, LedsC;

  Main.StdControl -> TestFormatStorageM;
  Main.StdControl -> TimerC;
  
  TestFormatStorageM.FormatStorage -> FormatStorageC;
  TestFormatStorageM.Leds -> LedsC;
  TestFormatStorageM.Timer -> TimerC.Timer[unique("Timer")];

}

--- NEW FILE: TestFormatStorageM.nc ---
// $Id: TestFormatStorageM.nc,v 1.1 2005/03/11 21:44:11 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>
 */

module TestFormatStorageM {
  provides {
    interface StdControl;
  }
  uses {
    interface FormatStorage;
    interface Leds;
    interface Timer;
  }
}

implementation {

  command result_t StdControl.init() {
    call Leds.init();
    return SUCCESS;
  }

  command result_t StdControl.start() {
    call Timer.start(TIMER_ONE_SHOT, 1024);
    return SUCCESS;
  }

  command result_t StdControl.stop() {
    return SUCCESS;
  }

  event result_t Timer.fired() {

    result_t result;

    call Leds.yellowOn();

    result = call FormatStorage.init();
    result = rcombine(call FormatStorage.allocate(0xD0, STORAGE_BLOCK_SIZE), result);
    result = rcombine(call FormatStorage.allocate(0xD1, STORAGE_BLOCK_SIZE), result);
    result = rcombine(call FormatStorage.allocateFixed(0xDF, 0xF0000, STORAGE_BLOCK_SIZE), result);
    result = rcombine(call FormatStorage.commit(), result);

    if (result != SUCCESS)
      call Leds.yellowOff();

    return SUCCESS;

  }

  event void FormatStorage.commitDone(storage_result_t result) {
    if (result == STORAGE_OK)
      call Leds.greenOn();
    else
      call Leds.redOn();
  }

}



More information about the Tinyos-beta-commits mailing list