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

David Gay idgay at users.sourceforge.net
Mon May 1 12:19:33 PDT 2006


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

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	RandRWAppC.nc RandRWC.nc 
Log Message:
report status over serial port (helpful for mica2dots, which are short of leds)


Index: RandRWAppC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/storage/Block/Attic/RandRWAppC.nc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** RandRWAppC.nc	4 Feb 2006 01:10:33 -0000	1.1.2.3
--- RandRWAppC.nc	1 May 2006 19:19:28 -0000	1.1.2.4
***************
*** 20,27 ****
  implementation {
    components RandRWC, new BlockStorageC(VOLUME_BLOCKTEST),
!     MainC, LedsC, PlatformC;
  
    MainC.Boot <- RandRWC;
!   
    RandRWC.BlockRead -> BlockStorageC.BlockRead;
    RandRWC.BlockWrite -> BlockStorageC.BlockWrite;
--- 20,30 ----
  implementation {
    components RandRWC, new BlockStorageC(VOLUME_BLOCKTEST),
!     MainC, LedsC, PlatformC, SerialActiveMessageC;
  
    MainC.Boot <- RandRWC;
!   MainC.SoftwareInit -> SerialActiveMessageC;
! 
!   RandRWC.SerialControl -> SerialActiveMessageC;
!   RandRWC.AMSend -> SerialActiveMessageC.AMSend[1];
    RandRWC.BlockRead -> BlockStorageC.BlockRead;
    RandRWC.BlockWrite -> BlockStorageC.BlockWrite;

Index: RandRWC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/storage/Block/Attic/RandRWC.nc,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -d -r1.1.2.7 -r1.1.2.8
*** RandRWC.nc	29 Jan 2006 18:01:55 -0000	1.1.2.7
--- RandRWC.nc	1 May 2006 19:19:29 -0000	1.1.2.8
***************
*** 26,29 ****
--- 26,31 ----
      interface BlockRead;
      interface BlockWrite;
+     interface AMSend;
+     interface SplitControl as SerialControl;
    }
  }
***************
*** 73,86 ****
    uint32_t addr, len;
    uint16_t offset;
  
!   bool scheck(error_t r) __attribute__((noinline)) {
!     if (r != SUCCESS)
        call Leds.led0On();
-     return r == SUCCESS;
    }
  
!   bool rcheck(error_t r) {
!     if (r != SUCCESS)
        call Leds.led0On();
      return r == SUCCESS;
    }
--- 75,101 ----
    uint32_t addr, len;
    uint16_t offset;
+   message_t reportmsg;
  
!   void report(error_t e) {
!     uint8_t *msg = call AMSend.getPayload(&reportmsg);
! 
!     msg[0] = e;
!     if (call AMSend.send(AM_BROADCAST_ADDR, &reportmsg, 1) != SUCCESS)
        call Leds.led0On();
    }
  
!   event void AMSend.sendDone(message_t* msg, error_t error) {
!     if (error != SUCCESS)
        call Leds.led0On();
+   }
+ 
+   void fail(error_t e) {
+     call Leds.led0On();
+     report(e);
+   }
+ 
+   bool scheck(error_t r) __attribute__((noinline)) {
+     if (r != SUCCESS)
+       fail(r);
      return r == SUCCESS;
    }
***************
*** 88,92 ****
    bool bcheck(bool b) {
      if (!b)
!       call Leds.led0On();
      return b;
    }
--- 103,107 ----
    bool bcheck(bool b) {
      if (!b)
!       fail(FAIL);
      return b;
    }
***************
*** 103,108 ****
--- 118,135 ----
  
    event void Boot.booted() {
+     call SerialControl.start();
+   }
+ 
+   event void SerialControl.stopDone(error_t e) { }
+ 
+   event void SerialControl.startDone(error_t e) {
      int i;
  
+     if (e != SUCCESS)
+       {
+ 	call Leds.led0On();
+ 	return;
+       }
+ 
      resetSeed();
      for (i = 0; i < sizeof data; i++)
***************
*** 112,121 ****
        {
  	state = S_ERASE;
! 	rcheck(call BlockWrite.erase());
        }
      else
        {
  	state = S_VERIFY;
! 	rcheck(call BlockRead.verify());
        }
    }
--- 139,148 ----
        {
  	state = S_ERASE;
! 	scheck(call BlockWrite.erase());
        }
      else
        {
  	state = S_VERIFY;
! 	scheck(call BlockRead.verify());
        }
    }
***************
*** 125,133 ****
        {
  	call Leds.led1On();
        }
      else
        {
  	setParameters();
! 	rcheck(call BlockRead.read(addr, rdata, len));
        }
    }
--- 152,161 ----
        {
  	call Leds.led1On();
+ 	report(0xc0);
        }
      else
        {
  	setParameters();
! 	scheck(call BlockRead.read(addr, rdata, len));
        }
    }
***************
*** 138,147 ****
  	call Leds.led2Toggle();
  	state = S_COMMIT;
! 	rcheck(call BlockWrite.commit());
        }
      else
        {
  	setParameters();
! 	rcheck(call BlockWrite.write(addr, data + offset, len));
        }
    }
--- 166,175 ----
  	call Leds.led2Toggle();
  	state = S_COMMIT;
! 	scheck(call BlockWrite.commit());
        }
      else
        {
  	setParameters();
! 	scheck(call BlockWrite.write(addr, data + offset, len));
        }
    }
***************
*** 170,177 ****
  	    call Leds.led2Toggle();
  	    state = S_VERIFY;
! 	    rcheck(call BlockRead.verify());
  	  }
  	else
! 	  call Leds.led1On();
        }
    }
--- 198,208 ----
  	    call Leds.led2Toggle();
  	    state = S_VERIFY;
! 	    scheck(call BlockRead.verify());
  	  }
  	else
! 	  {
! 	    call Leds.led1On();
! 	    report(0x80);
! 	  }
        }
    }
***************
*** 196,198 ****
--- 227,230 ----
    event void BlockRead.computeCrcDone(storage_addr_t x, storage_len_t y, uint16_t z, error_t result) {
    }
+ 
  }



More information about the Tinyos-2-commits mailing list