[Tinyos-commits] CVS: tinyos-1.x/apps/TestNewFlash/Format FormatC.nc, NONE, 1.1 FormatM.nc, NONE, 1.1 Makefile, NONE, 1.1 README.txt, NONE, 1.1

David Gay idgay at users.sourceforge.net
Mon Jul 11 16:27:40 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/apps/TestNewFlash/Format
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24401/Format

Added Files:
	FormatC.nc FormatM.nc Makefile README.txt 
Log Message:
tests for new flash abstraction


--- NEW FILE: FormatC.nc ---
/* $Id: FormatC.nc,v 1.1 2005/07/11 23:27:38 idgay Exp $
 * Copyright (c) 2005 Intel Corporation
 * 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.
 */
/**
 * @author David Gay
 */
configuration FormatC { }
implementation {
  components Main, FormatM, FormatStorageC, LedsC;

  Main.StdControl -> FormatM;
  FormatM.FormatStorage -> FormatStorageC;
  FormatM.Leds -> LedsC;
}

--- NEW FILE: FormatM.nc ---
/* $Id: FormatM.nc,v 1.1 2005/07/11 23:27:38 idgay Exp $
 * Copyright (c) 2005 Intel Corporation
 * 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.
 */
/**
 * @author David Gay
 */
module FormatM {
  provides interface StdControl;
  uses {
    interface Leds;
    interface FormatStorage;
  }
}
implementation {
  command result_t StdControl.init() {
    call Leds.init();
    return SUCCESS;
  }

  void rcheck(result_t ok) {
    if (ok == FAIL)
      call Leds.redOn();
  }

  command result_t StdControl.start() {
    call Leds.yellowOn();

    call FormatStorage.init();

    rcheck(call FormatStorage.allocateFixed(11, 0, 256));
    rcheck(!call FormatStorage.allocateFixed(22, 65536L, 1025));
    rcheck(!call FormatStorage.allocateFixed(22, 65534L, 1024));
    rcheck(call FormatStorage.allocateFixed(22, 65536L, 1024));
    rcheck(call FormatStorage.allocateFixed(12, 1024, 32768L));
    rcheck(call FormatStorage.allocate(1, 262144L));
    rcheck(!call FormatStorage.allocate(2, 262144L));
    rcheck(!call FormatStorage.allocate(1, 256));
    rcheck(call FormatStorage.commit());

    return SUCCESS;
  }

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

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

--- NEW FILE: Makefile ---
COMPONENT=FormatC
include ../../Makerules



--- NEW FILE: README.txt ---
Application to test formatting the flash with the new volume management system.
Use this before running the other tests.

Should turn on the green and yellow leds when installed.




More information about the Tinyos-commits mailing list