[Tinyos-beta-commits] CVS: tinyos-1.x/beta/Deluge/Deluge DelugeM.nc, 1.19, 1.20 DelugeMetadataC.nc, 1.7, 1.8 DelugeMetadataM.nc, 1.16, 1.17 DelugeMsgs.h, 1.4, 1.5

Jonathan Hui jwhui at users.sourceforge.net
Tue Jun 21 16:35:04 PDT 2005


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

Modified Files:
	DelugeM.nc DelugeMetadataC.nc DelugeMetadataM.nc DelugeMsgs.h 
Log Message:
No longer support automatic cloning of Golden Image into external
flash. There are many complications with doing so since compile-time
information is hard to get at. Removing Golden Image cloning code
saves over 1K of program space. The Deluge java app is used to inject
a program image into the Golden Image slot.



Index: DelugeM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeM.nc,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** DelugeM.nc	12 Jun 2005 19:22:33 -0000	1.19
--- DelugeM.nc	21 Jun 2005 23:34:31 -0000	1.20
***************
*** 119,128 ****
      uint8_t i;
  
!     for ( i = 1; i < DELUGE_NUM_IMAGES; i++ ) {
        imgDesc = call Metadata.getImgDesc(i);
        if (imgDesc->numPgs != imgDesc->numPgsComplete) {
  	call PageTransfer.setWorkingPage(i, imgDesc->numPgsComplete);
! 	advTimers[i-1].newAdvs = DELUGE_NUM_NEWDATA_ADVS_REQUIRED;    
! 	resetTimer(i-1);
  	call Leds.redOff();
  	return;
--- 119,130 ----
      uint8_t i;
  
!     for ( i = 0; i < DELUGE_NUM_IMAGES; i++ ) {
        imgDesc = call Metadata.getImgDesc(i);
        if (imgDesc->numPgs != imgDesc->numPgsComplete) {
  	call PageTransfer.setWorkingPage(i, imgDesc->numPgsComplete);
! 	if (i > 0) {
! 	  advTimers[i-1].newAdvs = DELUGE_NUM_NEWDATA_ADVS_REQUIRED;    
! 	  resetTimer(i-1);
! 	}
  	call Leds.redOff();
  	return;
***************
*** 284,288 ****
  
      // don't listen to advertisements about the golden image
!     if (imgNum != DELUGE_GOLDEN_IMAGE_NUM) {
        if (cmpImgDesc->vNum != curImgDesc->vNum) {
  	// image is newer
--- 286,292 ----
  
      // don't listen to advertisements about the golden image
!     //   unless it's from the PC and source address is TOS_UART_ADDR
!     if (imgNum != DELUGE_GOLDEN_IMAGE_NUM
! 	|| (rxAdvMsg->type == DELUGE_ADV_PC && rxAdvMsg->sourceAddr == TOS_UART_ADDR)) {
        if (cmpImgDesc->vNum != curImgDesc->vNum) {
  	// image is newer
***************
*** 294,312 ****
        // image is larger
        else if (cmpImgDesc->numPgsComplete > curImgDesc->numPgsComplete) {
! 	if (advTimers[imgNum-1].newAdvs == 0)
  	  call PageTransfer.dataAvailable(rxAdvMsg->sourceAddr, imgNum);
        }
        // image is smaller
!       else if (cmpImgDesc->numPgsComplete < curImgDesc->numPgsComplete) {
  	advTimers[imgNum-1].newAdvs = DELUGE_NUM_NEWDATA_ADVS_REQUIRED;
        }      
        // image is the same
        else {
  	advTimers[imgNum-1].overheard = 1;
  	isEqual = TRUE;
        }      
! 
!       if (!isEqual || rxAdvMsg->nodeDesc.vNum != nodeDesc.vNum)
  	resetTimer(imgNum-1);
      }
  
--- 298,323 ----
        // image is larger
        else if (cmpImgDesc->numPgsComplete > curImgDesc->numPgsComplete) {
! 	if (imgNum == DELUGE_GOLDEN_IMAGE_NUM
! 	    || advTimers[imgNum-1].newAdvs == 0)
  	  call PageTransfer.dataAvailable(rxAdvMsg->sourceAddr, imgNum);
        }
        // image is smaller
!       else if (imgNum != DELUGE_GOLDEN_IMAGE_NUM
! 	       && cmpImgDesc->numPgsComplete < curImgDesc->numPgsComplete) {
  	advTimers[imgNum-1].newAdvs = DELUGE_NUM_NEWDATA_ADVS_REQUIRED;
        }      
        // image is the same
        else {
+ 	if (imgNum == DELUGE_GOLDEN_IMAGE_NUM)
+ 	  imgNum = 1;
  	advTimers[imgNum-1].overheard = 1;
  	isEqual = TRUE;
        }      
!       
!       if (!isEqual || rxAdvMsg->nodeDesc.vNum != nodeDesc.vNum) {
! 	if (imgNum == DELUGE_GOLDEN_IMAGE_NUM)
! 	  imgNum = 1;
  	resetTimer(imgNum-1);
+       }
      }
  
***************
*** 339,343 ****
  
    event void PageTransfer.suppressMsgs(imgnum_t imgNum) {
!     advTimers[imgNum-1].overheard = 1;
    }
    
--- 350,355 ----
  
    event void PageTransfer.suppressMsgs(imgnum_t imgNum) {
!     if (imgNum != DELUGE_GOLDEN_IMAGE_NUM)
!       advTimers[imgNum-1].overheard = 1;
    }
    

Index: DelugeMetadataC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeMetadataC.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** DelugeMetadataC.nc	17 May 2005 20:55:47 -0000	1.7
--- DelugeMetadataC.nc	21 Jun 2005 23:34:31 -0000	1.8
***************
*** 46,49 ****
--- 46,50 ----
      DelugeMetadataM,
      DelugeStorageC as Storage,
+     FlashWPC,
      Main,
      LedsC as Leds,
***************
*** 54,57 ****
--- 55,59 ----
    Metadata = DelugeMetadataM;
  
+   Main.StdControl -> FlashWPC;
    Main.StdControl -> TimerC;
  
***************
*** 60,63 ****
--- 62,66 ----
    DelugeMetadataM.DataWrite -> Storage.DataWrite[unique("DelugeDataWrite")];
    DelugeMetadataM.DelugeStorage -> Storage;
+   DelugeMetadataM.FlashWP -> FlashWPC;
    DelugeMetadataM.Leds -> Leds;
    DelugeMetadataM.Timer -> TimerC.Timer[unique("Timer")];

Index: DelugeMetadataM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeMetadataM.nc,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** DelugeMetadataM.nc	17 May 2005 20:55:47 -0000	1.16
--- DelugeMetadataM.nc	21 Jun 2005 23:34:31 -0000	1.17
***************
*** 40,43 ****
--- 40,44 ----
      interface DelugeDataWrite as DataWrite;
      interface DelugeStorage;
+     interface FlashWP;
      interface Leds;
      interface Timer;
***************
*** 59,64 ****
      S_SCAN_DATA,
      S_IDLE,
!     S_VERIFY,
      S_SETUP,
    };
  
--- 60,67 ----
      S_SCAN_DATA,
      S_IDLE,
!     S_CLEAR_WP,
      S_SETUP,
+     S_VERIFY,
+     S_SET_WP,
    };
  
***************
*** 103,106 ****
--- 106,112 ----
  				  sizeof(DelugeImgDesc));
        break;
+     case S_CLEAR_WP:
+       result = call FlashWP.clrWP();
+       break;
      case S_SETUP:
        result = call DataWrite.erase(curImage);
***************
*** 110,113 ****
--- 116,122 ----
        result = SUCCESS;
        break;
+     case S_SET_WP:
+       result = call FlashWP.setWP();
+       break;
      }
  
***************
*** 223,227 ****
  
        imgDesc[curImage].numPgsComplete++;
!       signalDone(SUCCESS);
  
      }
--- 232,245 ----
  
        imgDesc[curImage].numPgsComplete++;
! 
!       if (imgDesc[curImage].imgNum == DELUGE_GOLDEN_IMAGE_NUM
! 	  && imgDesc[curImage].numPgs == imgDesc[curImage].numPgsComplete) {
! 	state = S_SET_WP;
! 	if (call FlashWP.setWP() == FAIL)
! 	  call Timer.start(TIMER_ONE_SHOT, 512);
!       }
!       else {
! 	signalDone(SUCCESS);
!       }
  
      }
***************
*** 277,287 ****
        return FAIL;
  
-     state = S_SETUP;
      client = id;
      curImage = newImgDesc->imgNum;
      
      memcpy(&(imgDesc[curImage]), newImgDesc, sizeof(DelugeImgDesc));
!     if (curImage != DELUGE_GOLDEN_IMAGE_NUM)
!       imgDesc[curImage].numPgsComplete = 0;
  
      call Timer.start(TIMER_ONE_SHOT, 1);
--- 295,304 ----
        return FAIL;
  
      client = id;
      curImage = newImgDesc->imgNum;
+     state = (curImage == DELUGE_GOLDEN_IMAGE_NUM) ? S_CLEAR_WP : S_SETUP;
      
      memcpy(&(imgDesc[curImage]), newImgDesc, sizeof(DelugeImgDesc));
!     imgDesc[curImage].numPgsComplete = 0;
  
      call Timer.start(TIMER_ONE_SHOT, 1);
***************
*** 295,298 ****
--- 312,325 ----
    }
  
+   event void FlashWP.clrWPDone() {
+     state = S_SETUP;
+     call Timer.start(TIMER_ONE_SHOT, 1);
+   }
+ 
+   event void FlashWP.setWPDone() {
+     state = S_VERIFY;
+     signalDone(SUCCESS);
+   }
+ 
    event void DataWrite.eraseDone(storage_result_t result) {
  

Index: DelugeMsgs.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeMsgs.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DelugeMsgs.h	17 May 2005 20:55:48 -0000	1.4
--- DelugeMsgs.h	21 Jun 2005 23:34:31 -0000	1.5
***************
*** 48,53 ****
    DELUGE_ADV_NORMAL    = 0,
    DELUGE_ADV_PC        = 1,
-   DELUGE_ADV_PING      = 2,
-   DELUGE_ADV_NOT_READY = 3,
  };
  
--- 48,51 ----



More information about the Tinyos-beta-commits mailing list