[Tinyos-beta-commits] CVS: tinyos-1.x/beta/Deluge/Deluge DelugeC.nc, 1.2, 1.3 DelugeM.nc, 1.3, 1.4

Jonathan Hui jwhui at users.sourceforge.net
Fri Nov 26 20:50:34 PST 2004


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

Modified Files:
	DelugeC.nc DelugeM.nc 
Log Message:
- Fixed a bug where nodes refuse to reboot to golden image.

- Added compile-time flag to enable/disable LEDs.



Index: DelugeC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DelugeC.nc	26 Nov 2004 18:59:10 -0000	1.2
--- DelugeC.nc	27 Nov 2004 04:50:30 -0000	1.3
***************
*** 51,55 ****
      DelugePageTransferC as PageTransfer,
      GenericComm as Comm,
-     LedsC as Leds,
      NetProgC,
      RandomLFSR,
--- 51,54 ----
***************
*** 57,60 ****
--- 56,65 ----
      TimerC;
  
+ #ifdef DELUGE_LEDS
+   components LedsC as Leds;
+ #else
+   components NoLeds as Leds;
+ #endif
+ 
  #ifndef PLATFORM_PC
    components InternalFlashC as IFlash;

Index: DelugeM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeM.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DelugeM.nc	26 Nov 2004 18:59:10 -0000	1.3
--- DelugeM.nc	27 Nov 2004 04:50:30 -0000	1.4
***************
*** 111,115 ****
  
    command result_t StdControl.start() {
!     result_t result;
      result = call SubStdControl.start();
      result = rcombine(call MetadataControl.start(), result);
--- 111,115 ----
  
    command result_t StdControl.start() {
!     result_t result = SUCCESS;;
      result = call SubStdControl.start();
      result = rcombine(call MetadataControl.start(), result);
***************
*** 185,188 ****
--- 185,189 ----
      if (rebootDelay > 0) {
        if (rebootDelay == 1) {
+ 	call IFlash.write((uint16_t*)IFLASH_NODE_DESC_ADDR, &nodeDesc, sizeof(nodeDesc));
  	call NetProg.programImgAndReboot(nodeDesc.imgNum); // SHOULD NOT RETURN!
  	// XXX: WHAT DO WE DO HERE?
***************
*** 246,275 ****
  
      // don't listen to advertisements about the factory image
!     if (imgNum == DELUGE_FACTORY_IMAGE_NUM)
!       return pMsg;
! 
!     switch (cmpResult) {
!     case DELUGE_IMGDESC_EQUAL:
!       advTimers[imgNum-1].overheard = 1;
!       break;
!     case DELUGE_IMGDESC_NEWER:
!       call Metadata.setupNewImage(&(rxAdvMsg->imgDesc));
!       break;
!     case DELUGE_IMGDESC_LARGER:
!       // notify page transfer of more data
!       if (advTimers[imgNum-1].newAdvs == 0)
! 	call PageTransfer.dataAvailable(rxAdvMsg->sourceAddr, imgNum);
!       break;
!     case DELUGE_IMGDESC_OLDER:
!     case DELUGE_IMGDESC_SMALLER:
!       advTimers[imgNum-1].newAdvs = DELUGE_NUM_NEWDATA_ADVS_REQUIRED;
!       break;
!     }
  
!     if (cmpResult != DELUGE_IMGDESC_EQUAL
! 	&& advTimers[imgNum-1].periodLog2 != DELUGE_MIN_ADV_PERIOD_LOG2) {
!       advTimers[imgNum-1].periodLog2 = DELUGE_MIN_ADV_PERIOD_LOG2;
!       setupAdvTimer(imgNum-1);
!       startTimer();
      }
  
--- 247,275 ----
  
      // don't listen to advertisements about the factory image
!     if (imgNum != DELUGE_FACTORY_IMAGE_NUM) {
!       switch (cmpResult) {
!       case DELUGE_IMGDESC_EQUAL:
! 	advTimers[imgNum-1].overheard = 1;
! 	break;
!       case DELUGE_IMGDESC_NEWER:
! 	call Metadata.setupNewImage(&(rxAdvMsg->imgDesc));
! 	break;
!       case DELUGE_IMGDESC_LARGER:
! 	// notify page transfer of more data
! 	if (advTimers[imgNum-1].newAdvs == 0)
! 	  call PageTransfer.dataAvailable(rxAdvMsg->sourceAddr, imgNum);
! 	break;
!       case DELUGE_IMGDESC_OLDER:
!       case DELUGE_IMGDESC_SMALLER:
! 	advTimers[imgNum-1].newAdvs = DELUGE_NUM_NEWDATA_ADVS_REQUIRED;
! 	break;
!       }
  
!       if (cmpResult != DELUGE_IMGDESC_EQUAL
! 	  && advTimers[imgNum-1].periodLog2 != DELUGE_MIN_ADV_PERIOD_LOG2) {
! 	advTimers[imgNum-1].periodLog2 = DELUGE_MIN_ADV_PERIOD_LOG2;
! 	setupAdvTimer(imgNum-1);
! 	startTimer();
!       }
      }
  
***************
*** 277,286 ****
  	&& rxAdvMsg->nodeDesc.vNum != DELUGE_INVALID_VNUM
  	&& call Metadata.isComplete(imgNum)) {
        call Leds.yellowOn();
        nodeDesc = rxAdvMsg->nodeDesc;
!       call IFlash.write((uint16_t*)IFLASH_NODE_DESC_ADDR, &nodeDesc, sizeof(nodeDesc));
!       advTimers[imgNum-1].periodLog2 = DELUGE_MIN_ADV_PERIOD_LOG2;
        rebootDelay = DELUGE_REBOOT_DELAY;
!       setupAdvTimer(imgNum-1);
        startTimer();
      }
--- 277,286 ----
  	&& rxAdvMsg->nodeDesc.vNum != DELUGE_INVALID_VNUM
  	&& call Metadata.isComplete(imgNum)) {
+       imgnum_t tmpImgNum = (imgNum > 0) ? imgNum : 1;
        call Leds.yellowOn();
        nodeDesc = rxAdvMsg->nodeDesc;
!       advTimers[tmpImgNum-1].periodLog2 = DELUGE_MIN_ADV_PERIOD_LOG2;
        rebootDelay = DELUGE_REBOOT_DELAY;
!       setupAdvTimer(tmpImgNum-1);
        startTimer();
      }



More information about the Tinyos-beta-commits mailing list