[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/storage/Block README.txt, 1.1.2.3, 1.1.2.4 RandRWC.nc, 1.1.2.8, 1.1.2.9

David Gay idgay at users.sourceforge.net
Fri Jun 16 15:53:12 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/storage/Block
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv22588/Block

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	README.txt RandRWC.nc 
Log Message:
switch to TKK id's, where KK is the seed and T the action. T=0 is 
"run full test" for all 4 tests.


Index: README.txt
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/storage/Block/Attic/README.txt,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** README.txt	3 Feb 2006 23:25:03 -0000	1.1.2.3
--- README.txt	16 Jun 2006 22:53:10 -0000	1.1.2.4
***************
*** 5,20 ****
  
  Application to test the BlockStorageC abstraction. There must be a
! volumes-<chip>.xml file in this directory describing the test volume
! for your flash chip.
  
! Install this application with a moteid of k*4 + 3 to do a full flash test.
! If you install with an id of k*4+1, only the write portion of the test will
! be performed.
! If you install with an id of k*4, data from a previous installation will be
! read (the test will fail if you didn't previously install with an id of
! k*4+1 or k*4+3).
  
! Different values of k run the test with different initial random seeds
! (and test a different pattern of reads/writes).
  
  A successful test will blink the yellow led a few times, then turn on the
--- 5,21 ----
  
  Application to test the BlockStorageC abstraction. There must be a
! volumes-<chip>.xml file in this directory describing the a 256kB volume
! named BLOCKTEST for your flash chip.
  
! The mote id is of the form T*100 + k, where k is a random seed and
! T specifies the test to be performed:
  
! T = 0: perform a full test
! T = 2: read a previously written block with the same seed
! T = 3: write a block with the given seed
! 
! For example, install with an id of 310 to write some data to the flash,
! then with an id of 210 to check that the data is correct. Or install
! with an id of 10 to do a combined write+read test.
  
  A successful test will blink the yellow led a few times, then turn on the

Index: RandRWC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/storage/Block/Attic/RandRWC.nc,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -d -r1.1.2.8 -r1.1.2.9
*** RandRWC.nc	1 May 2006 19:19:29 -0000	1.1.2.8
--- RandRWC.nc	16 Jun 2006 22:53:10 -0000	1.1.2.9
***************
*** 32,43 ****
  implementation {
    enum {
-     S_ERASE,
-     S_WRITE,
-     S_COMMIT,
-     S_VERIFY,
-     S_READ
-   } state;
- 
-   enum {
      SIZE = 1024L * 256,
      NWRITES = SIZE / 4096,
--- 32,35 ----
***************
*** 66,80 ****
  
    void resetSeed() {
!     shiftReg = 119 * 119 * ((TOS_NODE_ID >> 2) + 1);
      initSeed = shiftReg;
!     mask = 137 * 29 * ((TOS_NODE_ID >> 2) + 1);
    }
    
    uint8_t data[512], rdata[512];
!   int count;
    uint32_t addr, len;
    uint16_t offset;
    message_t reportmsg;
  
    void report(error_t e) {
      uint8_t *msg = call AMSend.getPayload(&reportmsg);
--- 58,74 ----
  
    void resetSeed() {
!     shiftReg = 119 * 119 * ((TOS_NODE_ID % 100) + 1);
      initSeed = shiftReg;
!     mask = 137 * 29 * ((TOS_NODE_ID % 100) + 1);
    }
    
    uint8_t data[512], rdata[512];
!   int count, testCount;
    uint32_t addr, len;
    uint16_t offset;
    message_t reportmsg;
  
+   void done();
+ 
    void report(error_t e) {
      uint8_t *msg = call AMSend.getPayload(&reportmsg);
***************
*** 95,98 ****
--- 89,97 ----
    }
  
+   void success() {
+     call Leds.led1On();
+     report(0x80);
+   }
+ 
    bool scheck(error_t r) __attribute__((noinline)) {
      if (r != SUCCESS)
***************
*** 136,157 ****
        data[i++] = rand() >> 8;
  
!     if (TOS_NODE_ID & 1)
!       {
! 	state = S_ERASE;
! 	scheck(call BlockWrite.erase());
!       }
!     else
!       {
! 	state = S_VERIFY;
! 	scheck(call BlockRead.verify());
!       }
    }
  
    void nextRead() {
      if (++count == NWRITES)
!       {
! 	call Leds.led1On();
! 	report(0xc0);
!       }
      else
        {
--- 135,144 ----
        data[i++] = rand() >> 8;
  
!     done();
    }
  
    void nextRead() {
      if (++count == NWRITES)
!       done();
      else
        {
***************
*** 165,169 ****
        {
  	call Leds.led2Toggle();
- 	state = S_COMMIT;
  	scheck(call BlockWrite.commit());
        }
--- 152,155 ----
***************
*** 184,190 ****
        {
  	call Leds.led2Toggle();
- 	state = S_WRITE;
- 	count = 0;
- 	resetSeed();
  	nextWrite();
        }
--- 170,173 ----
***************
*** 193,209 ****
    event void BlockWrite.commitDone(error_t result) {
      if (scheck(result))
!       {
! 	if (TOS_NODE_ID & 2)
! 	  {
! 	    call Leds.led2Toggle();
! 	    state = S_VERIFY;
! 	    scheck(call BlockRead.verify());
! 	  }
! 	else
! 	  {
! 	    call Leds.led1On();
! 	    report(0x80);
! 	  }
!       }
    }
  
--- 176,180 ----
    event void BlockWrite.commitDone(error_t result) {
      if (scheck(result))
!       done();
    }
  
***************
*** 218,224 ****
        {
  	call Leds.led2Toggle();
- 	state = S_READ;
- 	count = 0;
- 	resetSeed();
  	nextRead();
        }
--- 189,192 ----
***************
*** 228,230 ****
--- 196,248 ----
    }
  
+   enum { A_READ = 2, A_WRITE };
+ 
+   void doAction(int act) {
+     count = 0;
+     resetSeed();
+ 
+     switch (act)
+       {
+       case A_WRITE:
+ 	scheck(call BlockWrite.erase());
+ 	break;
+       case A_READ:
+ 	scheck(call BlockRead.verify());
+ 	break;
+       }
+   }
+ 
+   const uint8_t actions[] = {
+     A_WRITE,
+     A_READ
+   };
+ 
+   void done() {
+     uint8_t act = TOS_NODE_ID / 100;
+ 
+     call Leds.led2Toggle();
+ 
+     switch (act)
+       {
+       case 0:
+ 	if (testCount < sizeof actions)
+ 	  doAction(actions[testCount]);
+ 	else
+ 	  success();
+ 	break;
+ 
+       case A_READ: case A_WRITE:
+ 	if (testCount)
+ 	  success();
+ 	else
+ 	  doAction(act);
+ 	break;
+ 
+       default:
+ 	fail(FAIL);
+ 	break;
+       }
+     testCount++;
+   }
+ 
  }



More information about the Tinyos-2-commits mailing list