[Tinyos-beta-commits] CVS: tinyos-1.x/beta/Deluge/Deluge Deluge.h, 1.4, 1.5 DelugeM.nc, 1.7, 1.8 DelugeMetadataM.nc, 1.7, 1.8 DelugePageTransferC.nc, 1.4, 1.5 DelugePageTransferM.nc, 1.4, 1.5 DelugeStorage.nc, 1.2, 1.3 DelugeStorageC.nc, 1.5, 1.6 DelugeStorageM.nc, 1.5, 1.6 NetProg.nc, 1.1, 1.2 NetProgM.nc, 1.2, 1.3

Jonathan Hui jwhui at users.sourceforge.net
Tue Feb 8 16:48:36 PST 2005


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

Modified Files:
	Deluge.h DelugeM.nc DelugeMetadataM.nc DelugePageTransferC.nc 
	DelugePageTransferM.nc DelugeStorage.nc DelugeStorageC.nc 
	DelugeStorageM.nc NetProg.nc NetProgM.nc 
Log Message:
- Match changes in STM25P library.



Index: Deluge.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/Deluge.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Deluge.h	3 Jan 2005 17:34:54 -0000	1.4
--- Deluge.h	9 Feb 2005 00:48:27 -0000	1.5
***************
*** 59,63 ****
    DELUGE_CRC_SIZE                   = sizeof(uint16_t),
    DELUGE_CRC_BLOCK_SIZE             = DELUGE_MAX_PAGES*DELUGE_CRC_SIZE,
!   DELUGE_FACTORY_IMAGE_NUM          = 0x0,
    DELUGE_INVALID_VNUM               = -1,
    DELUGE_INVALID_IMGNUM             = 0xff,
--- 59,63 ----
    DELUGE_CRC_SIZE                   = sizeof(uint16_t),
    DELUGE_CRC_BLOCK_SIZE             = DELUGE_MAX_PAGES*DELUGE_CRC_SIZE,
!   DELUGE_GOLDEN_IMAGE_NUM           = 0x0,
    DELUGE_INVALID_VNUM               = -1,
    DELUGE_INVALID_IMGNUM             = 0xff,
***************
*** 66,83 ****
  };
  
! static const uint8_t DELUGE_VOLUMES[] = {
!   unique("FlashVolume"),
!   unique("FlashVolume"),
!   unique("FlashVolume"),
  };
  
! /*
! typedef struct DelugeAdvTimer {
!   uint32_t timer      : 24;
!   uint32_t periodLog2 : 7;
!   uint32_t overheard  : 1;
!   uint8_t  newAdvs;
! } DelugeAdvTime;r
! */
  
  typedef struct DelugeAdvTimer {
--- 66,88 ----
  };
  
! enum {
!   DELUGE_IMAGE_0 = 0,
!   DELUGE_IMAGE_1 = 1,
!   DELUGE_IMAGE_2 = 2,
  };
  
! #include "Storage.h"
! #include "StorageManager.h"
! 
! struct deluge_image_t {
!   imgnum_t imageNum;
!   volume_id_t volumeId;
! };
! 
! static const struct deluge_image_t DELUGE_IMAGES[DELUGE_NUM_IMAGES] = {
!   { DELUGE_IMAGE_0, SM_GOLDEN_IMAGE },
!   { DELUGE_IMAGE_1, 0 },
!   { DELUGE_IMAGE_2, 1 },
! };
  
  typedef struct DelugeAdvTimer {

Index: DelugeM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeM.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** DelugeM.nc	20 Jan 2005 21:32:27 -0000	1.7
--- DelugeM.nc	9 Feb 2005 00:48:33 -0000	1.8
***************
*** 287,291 ****
  
      // don't listen to advertisements about the factory image
!     if (imgNum != DELUGE_FACTORY_IMAGE_NUM) {
        switch (cmpResult) {
        case DELUGE_IMGDESC_EQUAL:
--- 287,291 ----
  
      // don't listen to advertisements about the factory image
!     if (imgNum != DELUGE_GOLDEN_IMAGE_NUM) {
        switch (cmpResult) {
        case DELUGE_IMGDESC_EQUAL:

Index: DelugeMetadataM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeMetadataM.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** DelugeMetadataM.nc	20 Jan 2005 01:36:43 -0000	1.7
--- DelugeMetadataM.nc	9 Feb 2005 00:48:33 -0000	1.8
***************
*** 110,114 ****
        imgDesc[0].numPgs = 5;
        imgDesc[0].numPgsComplete = 5;
-       imgDesc[0].numImages = DELUGE_NUM_IMAGES;
      }
  #endif
--- 110,113 ----
***************
*** 118,121 ****
--- 117,127 ----
    }
  
+   void halt() {
+     TOSH_CLR_YELLOW_LED_PIN();
+     TOSH_SET_GREEN_LED_PIN();
+     TOSH_CLR_RED_LED_PIN();
+     while(1);
+   }
+ 
    result_t realStart() {
      result_t result;
***************
*** 204,210 ****
      curImage = imgNum;
  
! //    if (call DataRead.verify(curImage, pgNum) == FAIL)
! //      post retry();
!     signal DataRead.verifyDone(SUCCESS);
  
      return SUCCESS;
--- 210,215 ----
      curImage = imgNum;
  
!     if (call DataRead.verify(curImage, pgNum) == FAIL)
!       post retry();
  
      return SUCCESS;
***************
*** 283,289 ****
  
      memcpy(&(imgDesc[imgNum]), newImgDesc, sizeof(DelugeImgDesc));
!     if (imgNum != DELUGE_FACTORY_IMAGE_NUM)
        imgDesc[imgNum].numPgsComplete = 0;
-     imgDesc[imgNum].numImages = DELUGE_NUM_IMAGES;
  
      state = S_SETUP_NEW_IMAGE;
--- 288,293 ----
  
      memcpy(&(imgDesc[imgNum]), newImgDesc, sizeof(DelugeImgDesc));
!     if (imgNum != DELUGE_GOLDEN_IMAGE_NUM)
        imgDesc[imgNum].numPgsComplete = 0;
  
      state = S_SETUP_NEW_IMAGE;
***************
*** 302,306 ****
  
      memcpy(newImgDesc, &(imgDesc[imgNum]), sizeof(DelugeImgDesc));
!     
      return SUCCESS;
  
--- 306,311 ----
  
      memcpy(newImgDesc, &(imgDesc[imgNum]), sizeof(DelugeImgDesc));
!     newImgDesc->numImages = DELUGE_NUM_IMAGES;
! 
      return SUCCESS;
  
***************
*** 342,346 ****
        imgDesc[curImage].crc = 0;
        imgDesc[curImage].numPgsComplete = 0;
-       imgDesc[curImage].numImages = DELUGE_NUM_IMAGES;
        return readNextMetadata();
      }
--- 347,350 ----

Index: DelugePageTransferC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugePageTransferC.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DelugePageTransferC.nc	20 Jan 2005 01:36:43 -0000	1.4
--- DelugePageTransferC.nc	9 Feb 2005 00:48:33 -0000	1.5
***************
*** 62,67 ****
    Main.StdControl -> TimerC;
  
-   DelugePageTransferM.SubControl -> Storage;
- 
    DelugePageTransferM.BitVecUtils -> BitVecUtilsC;
    DelugePageTransferM.DataRead -> Storage.DataRead[unique("DelugeDataRead")];
--- 62,65 ----

Index: DelugePageTransferM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugePageTransferM.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DelugePageTransferM.nc	3 Jan 2005 17:34:54 -0000	1.4
--- DelugePageTransferM.nc	9 Feb 2005 00:48:33 -0000	1.5
***************
*** 46,50 ****
      interface SendMsg as SendReqMsg;
      interface SharedMsgBuf;
-     interface StdControl as SubControl;
      interface Timer as ReqTimer;
      interface Timer as SendTimer;
--- 46,49 ----
***************
*** 116,120 ****
      workingImgNum = DELUGE_INVALID_IMGNUM;
      workingPgNum = DELUGE_INVALID_PGNUM;
!     return call SubControl.init();
    }
  
--- 115,119 ----
      workingImgNum = DELUGE_INVALID_IMGNUM;
      workingPgNum = DELUGE_INVALID_PGNUM;
!     return SUCCESS;
    }
  
***************
*** 122,126 ****
      changeState(S_IDLE);
      dataQHead = dataQLen = 0;
!     return call SubControl.start();
    }
  
--- 121,125 ----
      changeState(S_IDLE);
      dataQHead = dataQLen = 0;
!     return SUCCESS;
    }
  

Index: DelugeStorage.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeStorage.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DelugeStorage.nc	26 Nov 2004 18:59:10 -0000	1.2
--- DelugeStorage.nc	9 Feb 2005 00:48:33 -0000	1.3
***************
*** 31,34 ****
  interface DelugeStorage {
    command uint32_t imgNum2Addr(imgnum_t imgNum);
-   command imgnum_t addr2ImgNum(uint32_t addr);
  }
--- 31,33 ----

Index: DelugeStorageC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeStorageC.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DelugeStorageC.nc	20 Jan 2005 01:36:43 -0000	1.5
--- DelugeStorageC.nc	9 Feb 2005 00:48:33 -0000	1.6
***************
*** 29,33 ****
   */
  
! includes FlashVolume;
  
  configuration DelugeStorageC {
--- 29,33 ----
   */
  
! includes StorageManager;
  
  configuration DelugeStorageC {
***************
*** 46,54 ****
      Main,
      DelugeStorageM as Storage,
!     BlockStorageC,
!     FlashVolumeC;
      
    StdControl = Storage;
-   StdControl = FlashVolumeC;
    DataRead = Storage;
    DataWrite = Storage;
--- 46,54 ----
      Main,
      DelugeStorageM as Storage,
!     new BlockStorageC() as BlockStorage0,
!     new BlockStorageC() as BlockStorage1,
!     new BlockStorageC() as BlockStorage2;
      
    StdControl = Storage;
    DataRead = Storage;
    DataWrite = Storage;
***************
*** 57,65 ****
    MetadataWrite = Storage;
  
!   Main.StdControl -> BlockStorageC;
  
!   Storage.ImageVolume -> FlashVolumeC;
!   Storage.ImageRead -> BlockStorageC;
!   Storage.ImageWrite -> BlockStorageC;
  
  }
--- 57,74 ----
    MetadataWrite = Storage;
  
!   Storage.ImageRead[DELUGE_IMAGE_0] -> BlockStorage0;
!   Storage.ImageWrite[DELUGE_IMAGE_0] -> BlockStorage0;
!   Storage.Mount[DELUGE_IMAGE_0] -> BlockStorage0;
!   Storage.StorageRemap[DELUGE_IMAGE_0] -> BlockStorage0;
  
!   Storage.ImageRead[DELUGE_IMAGE_1] -> BlockStorage1;
!   Storage.ImageWrite[DELUGE_IMAGE_1] -> BlockStorage1;
!   Storage.Mount[DELUGE_IMAGE_1] -> BlockStorage1;
!   Storage.StorageRemap[DELUGE_IMAGE_1] -> BlockStorage1;
! 
!   Storage.ImageRead[DELUGE_IMAGE_2] -> BlockStorage2;
!   Storage.ImageWrite[DELUGE_IMAGE_2] -> BlockStorage2;
!   Storage.Mount[DELUGE_IMAGE_2] -> BlockStorage2;
!   Storage.StorageRemap[DELUGE_IMAGE_2] -> BlockStorage2;
  
  }

Index: DelugeStorageM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeStorageM.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DelugeStorageM.nc	20 Jan 2005 01:36:43 -0000	1.5
--- DelugeStorageM.nc	9 Feb 2005 00:48:33 -0000	1.6
***************
*** 39,45 ****
    }
    uses {
!     interface BlockRead as ImageRead[uint8_t id];
!     interface BlockWrite as ImageWrite[uint8_t id];
!     interface FlashVolume as ImageVolume[uint8_t id];
    }
  }
--- 39,46 ----
    }
    uses {
!     interface BlockRead as ImageRead[blockstorage_t blockId];
!     interface BlockWrite as ImageWrite[blockstorage_t blockId];
!     interface Mount[blockstorage_t blockId];
!     interface StorageRemap[blockstorage_t blockId];
    }
  }
***************
*** 80,86 ****
  
    command result_t StdControl.start() { 
!     call ImageVolume.mount[DELUGE_VOLUMES[0]](FV_FACTORY_IMAGE);
!     call ImageVolume.mount[DELUGE_VOLUMES[1]](0);
!     call ImageVolume.mount[DELUGE_VOLUMES[2]](1);
      return SUCCESS;
    }
--- 81,85 ----
  
    command result_t StdControl.start() { 
!     call Mount.mount[DELUGE_IMAGES[0].imageNum](DELUGE_IMAGES[0].volumeId);
      return SUCCESS;
    }
***************
*** 88,102 ****
    command result_t StdControl.stop() { return SUCCESS; }
  
!   command uint32_t DelugeStorage.imgNum2Addr(imgnum_t imgNum) {
!     uint32_t addr = call ImageVolume.physicalAddr[DELUGE_VOLUMES[imgNum]](0);
!     return addr + (uint32_t)DELUGE_DATA_OFFSET + (uint32_t)DELUGE_CRC_BLOCK_SIZE;
    }
  
!   command imgnum_t DelugeStorage.addr2ImgNum(uint32_t addr) {
!     uint8_t volume = call ImageVolume.physicalAddrToVolume[DELUGE_VOLUMES[0]](addr);
!     if (volume == FV_FACTORY_IMAGE)
!       return DELUGE_FACTORY_IMAGE_NUM;
!     else
!       return volume+1;
    }
  
--- 87,103 ----
    command result_t StdControl.stop() { return SUCCESS; }
  
!   event void Mount.mountDone[volume_t volume](storage_result_t result, volume_id_t id) { 
!     uint8_t i;
!     for ( i = 0; i < DELUGE_NUM_IMAGES-1; i++ ) {
!       if (id == DELUGE_IMAGES[i].volumeId) {
! 	call Mount.mount[DELUGE_IMAGES[i+1].imageNum](DELUGE_IMAGES[i+1].volumeId);
! 	break;
!       }
!     }
    }
  
!   command uint32_t DelugeStorage.imgNum2Addr(imgnum_t imgNum) {
!     uint32_t addr = call StorageRemap.physicalAddr[DELUGE_IMAGES[imgNum].imageNum](0);
!     return addr + (uint32_t)DELUGE_DATA_OFFSET + (uint32_t)DELUGE_CRC_BLOCK_SIZE;
    }
  
***************
*** 115,119 ****
      }
  
!     return call ImageRead.computeCrc[DELUGE_VOLUMES[imgNum]](blockAddr, len);
  
    }
--- 116,120 ----
      }
  
!     return call ImageRead.computeCrc[DELUGE_IMAGES[imgNum].imageNum](blockAddr, len);
  
    }
***************
*** 136,151 ****
      switch(newState) {
      case S_READ_METADATA: case S_READ_DATA:
!       result = call ImageRead.read[DELUGE_VOLUMES[imgNum]](addr, buf, len);
        break;
      case S_WRITE_METADATA: case S_WRITE_DATA:
!       result = call ImageWrite.write[DELUGE_VOLUMES[imgNum]](addr, buf, len);
        break;
      case S_ERASE_DATA:
!       result = call ImageWrite.erase[DELUGE_VOLUMES[imgNum]]();
        break;
      case S_READ_CRC:
        page = addr;
        crcAddr = DELUGE_DATA_OFFSET + sizeof(crc)*page;
!       result = call ImageRead.read[DELUGE_VOLUMES[imgNum]](crcAddr, (uint8_t*)&crc, sizeof(crc));
        break;
      default:
--- 137,152 ----
      switch(newState) {
      case S_READ_METADATA: case S_READ_DATA:
!       result = call ImageRead.read[DELUGE_IMAGES[imgNum].imageNum](addr, buf, len);
        break;
      case S_WRITE_METADATA: case S_WRITE_DATA:
!       result = call ImageWrite.write[DELUGE_IMAGES[imgNum].imageNum](addr, buf, len);
        break;
      case S_ERASE_DATA:
!       result = call ImageWrite.erase[DELUGE_IMAGES[imgNum].imageNum]();
        break;
      case S_READ_CRC:
        page = addr;
        crcAddr = DELUGE_DATA_OFFSET + sizeof(crc)*page;
!       result = call ImageRead.read[DELUGE_IMAGES[imgNum].imageNum](crcAddr, (uint8_t*)&crc, sizeof(crc));
        break;
      default:
***************
*** 194,198 ****
  
      for ( i = 0; i < DELUGE_NUM_IMAGES; i++ ) {
!       if (volume == DELUGE_VOLUMES[i])
  	break;
      }
--- 195,199 ----
  
      for ( i = 0; i < DELUGE_NUM_IMAGES; i++ ) {
!       if (volume == DELUGE_IMAGES[i].imageNum)
  	break;
      }
***************
*** 213,238 ****
    }
  
!   event result_t ImageRead.readDone[uint8_t volume](result_t result) {
      flashReqDone(volume, result);
-     return SUCCESS;
    }
  
!   event result_t ImageRead.computeCrcDone[uint8_t volume](result_t result, uint16_t crcResult) {
      flashReqDone(volume, (crc == crcResult) ? SUCCESS : FAIL);
-     return SUCCESS;
    }
  
!   event result_t ImageWrite.writeDone[uint8_t volume](result_t result) {
      flashReqDone(volume, result);
-     return SUCCESS;
    }
  
!   event result_t ImageWrite.eraseDone[uint8_t volume](result_t result) { 
      flashReqDone(volume, result);
-     return SUCCESS; 
    } 
  
!   event result_t ImageRead.verifyDone[uint8_t volume](result_t result) { return SUCCESS; }
!   event result_t ImageWrite.commitDone[uint8_t volume](result_t result) { return SUCCESS; }
  
    default event result_t DataRead.readDone[uint8_t id](result_t result) { return SUCCESS; }
--- 214,244 ----
    }
  
!   event void ImageRead.readDone[uint8_t volume](result_t result) {
      flashReqDone(volume, result);
    }
  
!   event void ImageRead.computeCrcDone[uint8_t volume](result_t result, uint16_t crcResult) {
      flashReqDone(volume, (crc == crcResult) ? SUCCESS : FAIL);
    }
  
!   event void ImageWrite.writeDone[uint8_t volume](result_t result) {
      flashReqDone(volume, result);
    }
  
!   event void ImageWrite.eraseDone[uint8_t volume](result_t result) { 
      flashReqDone(volume, result);
    } 
  
!   event void ImageRead.verifyDone[uint8_t volume](result_t result) { ; }
!   event void ImageWrite.commitDone[uint8_t volume](result_t result) { ; }
! 
!   default command result_t ImageRead.read[blockstorage_t blockId](block_addr_t addr, uint8_t* buf, block_addr_t len) { return FAIL; }
!   default command result_t ImageRead.verify[blockstorage_t blockId]() { return FAIL; }
!   default command result_t ImageRead.computeCrc[blockstorage_t blockId](block_addr_t addr, block_addr_t len) { return FAIL; }
!   default command result_t ImageWrite.write[blockstorage_t blockId](block_addr_t addr, uint8_t* buf, block_addr_t len) { return FAIL; }
!   default command result_t ImageWrite.erase[blockstorage_t blockId]() { return FAIL; }
!   default command result_t ImageWrite.commit[blockstorage_t blockId]() { return FAIL; }
!   default command result_t Mount.mount[blockstorage_t blockId](volume_id_t id) { return FAIL; }
!   default command uint32_t StorageRemap.physicalAddr[blockstorage_t blockId](uint32_t id) { return SM_INVALID_ADDR; }
  
    default event result_t DataRead.readDone[uint8_t id](result_t result) { return SUCCESS; }

Index: NetProg.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/NetProg.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** NetProg.nc	22 Nov 2004 05:30:57 -0000	1.1
--- NetProg.nc	9 Feb 2005 00:48:33 -0000	1.2
***************
*** 54,64 ****
    command result_t programImgAndReboot(uint8_t imgNum);
  
-   /**
-    * Get the image number currently executing.
-    *
-    * @return        The image number of the executing image,
-    *                <code>DELUGE_INVALID_IMGNUM</code> otherwise.
-    */
-   command uint8_t  getExecutingImgNum();
- 
  }
--- 54,56 ----

Index: NetProgM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/NetProgM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** NetProgM.nc	26 Nov 2004 18:59:10 -0000	1.2
--- NetProgM.nc	9 Feb 2005 00:48:33 -0000	1.3
***************
*** 44,49 ****
  implementation {
  
-   imgnum_t imgNum;
- 
    uint8_t checkSum(uint16_t _addr, uint8_t _group) {
      return ~(_addr + _group);
--- 44,47 ----
***************
*** 79,84 ****
      }
  
-     imgNum = call Storage.addr2ImgNum(curImageAddr);
- 
      return result;
  
--- 77,80 ----
***************
*** 143,148 ****
    }
  
-   command uint8_t NetProg.getExecutingImgNum() { return imgNum; }
- 
    event result_t Metadata.setupNewImageDone(result_t result) { return SUCCESS; }
    event result_t Metadata.receivedPageDone(result_t result) { return SUCCESS; }
--- 139,142 ----



More information about the Tinyos-beta-commits mailing list