[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/Deluge/extra NetProgC.nc, 1.5, 1.6 NetProgM.nc, 1.6, 1.7

Razvan Musaloiu-E. razvanm at users.sourceforge.net
Mon May 19 14:25:11 PDT 2008


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/extra
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv21259/tos/lib/net/Deluge/extra

Modified Files:
	NetProgC.nc NetProgM.nc 
Log Message:
Merge of the latest Deluge T2.


Index: NetProgC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/extra/NetProgC.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** NetProgC.nc	14 Jan 2008 04:22:02 -0000	1.5
--- NetProgC.nc	19 May 2008 21:25:08 -0000	1.6
***************
*** 41,45 ****
  implementation {
  
!   components MainC, InternalFlashC as IFlash, CrcP, NetProgM;
  
    NetProg = NetProgM;
--- 41,46 ----
  implementation {
  
!   components MainC, InternalFlashC as IFlash, CrcP;
!   components NetProgM, ReprogramGuardC;
  
    NetProg = NetProgM;
***************
*** 48,52 ****
    NetProgM.IFlash -> IFlash;
    NetProgM.Crc -> CrcP;
!   
    components LedsC;
    NetProgM.Leds -> LedsC;
--- 49,54 ----
    NetProgM.IFlash -> IFlash;
    NetProgM.Crc -> CrcP;
!   NetProgM.ReprogramGuard -> ReprogramGuardC;
! 
    components LedsC;
    NetProgM.Leds -> LedsC;

Index: NetProgM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/extra/NetProgM.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** NetProgM.nc	18 Jan 2008 18:37:10 -0000	1.6
--- NetProgM.nc	19 May 2008 21:25:08 -0000	1.7
***************
*** 43,46 ****
--- 43,47 ----
      interface CC2420Config;
      async command void setAmAddress(am_addr_t a);
+     interface ReprogramGuard;
    }
  }
***************
*** 48,51 ****
--- 49,54 ----
  implementation {
  
+   uint32_t reprogramImgAddr;
+ 
    command error_t Init.init()
    {
***************
*** 83,92 ****
    command error_t NetProg.programImageAndReboot(uint32_t imgAddr)
    {
      BootArgs bootArgs;
  
      atomic {
        call IFlash.read((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs));
        
!       bootArgs.imageAddr = imgAddr;
        bootArgs.gestureCount = 0xff;
        bootArgs.noReprogram = FALSE;
--- 86,106 ----
    command error_t NetProg.programImageAndReboot(uint32_t imgAddr)
    {
+     reprogramImgAddr = imgAddr;
+     return call ReprogramGuard.okToProgram();
+   }
+ 
+   event void ReprogramGuard.okToProgramDone(bool ok)
+   {
      BootArgs bootArgs;
  
+     if (!ok) {
+       // The voltage is too low. Nothing to do.
+       return;
+     }
+ 
      atomic {
        call IFlash.read((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs));
        
!       bootArgs.imageAddr = reprogramImgAddr;
        bootArgs.gestureCount = 0xff;
        bootArgs.noReprogram = FALSE;
***************
*** 98,107 ****
        netprog_reboot();
      }
- 
-     // couldn't reboot
-     return FAIL;
    }
  
    event void CC2420Config.syncDone(error_t error) {}
- 
  }
--- 112,117 ----



More information about the Tinyos-2-commits mailing list