[Tinyos-beta-commits] CVS: tinyos-1.x/beta/Deluge/Deluge DelugeC.nc, 1.3, 1.4 DelugeM.nc, 1.5, 1.6 DelugeMetadataM.nc, 1.6, 1.7 DelugePageTransferC.nc, 1.3, 1.4 DelugeStorageC.nc, 1.4, 1.5 DelugeStorageM.nc, 1.4, 1.5

Jonathan Hui jwhui at users.sourceforge.net
Wed Jan 19 17:36:46 PST 2005


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

Modified Files:
	DelugeC.nc DelugeM.nc DelugeMetadataM.nc 
	DelugePageTransferC.nc DelugeStorageC.nc DelugeStorageM.nc 
Log Message:
- Support StdControl.start/stop behavior for real in Deluge.



Index: DelugeC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeC.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DelugeC.nc	27 Nov 2004 04:50:30 -0000	1.3
--- DelugeC.nc	20 Jan 2005 01:36:43 -0000	1.4
***************
*** 69,78 ****
    StdControl = DelugeM;
  
    DelugeM.MetadataControl -> Metadata;
!   DelugeM.SubStdControl -> Comm;
!   DelugeM.SubStdControl -> NetProgC;
!   DelugeM.SubStdControl -> PageTransfer;
!   DelugeM.SubStdControl -> SharedMsgBufM;
!   DelugeM.SubStdControl -> TimerC;
  
    DelugeM.Leds -> Leds;
--- 69,79 ----
    StdControl = DelugeM;
  
+   Main.StdControl -> Comm;
+   Main.StdControl -> NetProgC;
+   Main.StdControl -> SharedMsgBufM;
+   Main.StdControl -> TimerC;
+ 
    DelugeM.MetadataControl -> Metadata;
!   DelugeM.PageTransferControl -> PageTransfer;
  
    DelugeM.Leds -> Leds;

Index: DelugeM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeM.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DelugeM.nc	3 Jan 2005 17:34:54 -0000	1.5
--- DelugeM.nc	20 Jan 2005 01:36:43 -0000	1.6
***************
*** 44,48 ****
      interface SharedMsgBuf;
      interface SplitControl as MetadataControl;
!     interface StdControl as SubStdControl;
      interface Timer;
    }
--- 44,48 ----
      interface SharedMsgBuf;
      interface SplitControl as MetadataControl;
!     interface StdControl as PageTransferControl;
      interface Timer;
    }
***************
*** 55,58 ****
--- 55,66 ----
    };
  
+   enum {
+     S_ENABLED,
+     S_DISABLED,
+     S_INITIALIZING,
+   };
+ 
+   uint8_t state;
+   
    DelugeAdvTimer advTimers[DELUGE_NUM_TIMERS];
    DelugeNodeDesc nodeDesc;
***************
*** 120,139 ****
    command result_t StdControl.init() {
      result_t result;
      call IFlash.read((uint16_t*)IFLASH_NODE_DESC_ADDR, &nodeDesc, sizeof(nodeDesc));
      result = call Leds.init();
!     result = rcombine(call SubStdControl.init(), result);
      result = rcombine(call MetadataControl.init(), result);
      return result;
    }
  
    command result_t StdControl.start() {
!     result_t result = SUCCESS;;
!     result = call SubStdControl.start();
!     result = rcombine(call MetadataControl.start(), result);
      return result;
    }
  
    command result_t StdControl.stop() {
!     return SUCCESS;
    }
  
--- 128,173 ----
    command result_t StdControl.init() {
      result_t result;
+     state = S_DISABLED;
      call IFlash.read((uint16_t*)IFLASH_NODE_DESC_ADDR, &nodeDesc, sizeof(nodeDesc));
      result = call Leds.init();
!     result = rcombine(call PageTransferControl.init(), result);
      result = rcombine(call MetadataControl.init(), result);
      return result;
    }
  
+   void realStart() {
+     uint8_t i;
+ 
+     if (state != S_INITIALIZING)
+       return;
+ 
+     state = S_ENABLED;
+ 
+     setNextPage();
+ 
+     for ( i = 0; i < DELUGE_NUM_TIMERS; i++ ) {
+       advTimers[i].periodLog2 = DELUGE_MIN_ADV_PERIOD_LOG2;
+       setupAdvTimer(i);
+     }
+     rebootDelay = 0;
+ 
+     startTimer();
+   }
+ 
    command result_t StdControl.start() {
!     result_t result;
!     result = call PageTransferControl.start();
! 
!     state = S_INITIALIZING;
!     if (call MetadataControl.start() == FAIL)
!       realStart();
! 
      return result;
    }
  
    command result_t StdControl.stop() {
!     if (state == S_ENABLED)
!       state = S_DISABLED;
!     return call PageTransferControl.stop();
    }
  
***************
*** 144,158 ****
    event result_t MetadataControl.startDone() { 
  
!     uint8_t i;
! 
!     setNextPage();
! 
!     for ( i = 0; i < DELUGE_NUM_TIMERS; i++ ) {
!       advTimers[i].periodLog2 = DELUGE_MIN_ADV_PERIOD_LOG2;
!       setupAdvTimer(i);
!     }
!     rebootDelay = 0;
! 
!     startTimer();
  
      return SUCCESS; 
--- 178,182 ----
    event result_t MetadataControl.startDone() { 
  
!     realStart();
  
      return SUCCESS; 
***************
*** 239,242 ****
--- 263,269 ----
      dm_cmp_t cmpResult = call Metadata.compareImgDesc(&(rxAdvMsg->imgDesc));
  
+     if (state != S_ENABLED)
+       return pMsg;
+ 
      if (rxAdvMsg->version != DELUGE_VERSION
  	|| !call Metadata.isImgDescValid(&(rxAdvMsg->imgDesc))

Index: DelugeMetadataM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeMetadataM.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** DelugeMetadataM.nc	18 Jan 2005 20:49:28 -0000	1.6
--- DelugeMetadataM.nc	20 Jan 2005 01:36:43 -0000	1.7
***************
*** 55,58 ****
--- 55,60 ----
  
    enum {
+     S_RADIO_STARTING,
+     S_WAITING_FOR_RADIO,
      S_INIT,
      S_IDLE,
***************
*** 94,98 ****
--- 96,104 ----
      result_t result;
  
+ #ifdef PLATFORM_TELOSB
+     state = S_RADIO_STARTING;
+ #else
      state = S_INIT;
+ #endif
  
      result = call SubControl.init();
***************
*** 126,133 ****
  
    command result_t SplitControl.start() {
! #ifndef PLATFORM_TELOSB
!     return realStart();
! #endif
!     return SUCCESS;
    }
  
--- 132,143 ----
  
    command result_t SplitControl.start() {
!     if (state == S_RADIO_STARTING) {
!       state = S_WAITING_FOR_RADIO;
!       return SUCCESS;
!     }
!     else if (state == S_INIT)
!       return realStart();
! 
!     return FAIL;
    }
  
***************
*** 139,143 ****
    event result_t RadioControl.initDone() { return SUCCESS; }
    event result_t RadioControl.startDone() {
!     return realStart();
    }
    event result_t RadioControl.stopDone() { return SUCCESS; }
--- 149,161 ----
    event result_t RadioControl.initDone() { return SUCCESS; }
    event result_t RadioControl.startDone() {
!     if (state == S_RADIO_STARTING) {
!       state = S_INIT;
!     }
!     else if (state == S_WAITING_FOR_RADIO) {
!       state = S_INIT;
!       return realStart();
!     }
! 
!     return SUCCESS;
    }
    event result_t RadioControl.stopDone() { return SUCCESS; }

Index: DelugePageTransferC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugePageTransferC.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DelugePageTransferC.nc	26 Nov 2004 18:59:10 -0000	1.3
--- DelugePageTransferC.nc	20 Jan 2005 01:36:43 -0000	1.4
***************
*** 47,50 ****
--- 47,51 ----
  
    components
+     Main,
      DelugePageTransferM,
      BitVecUtilsC,
***************
*** 58,64 ****
    DelugePageTransfer = DelugePageTransferM;
    Leds = DelugePageTransferM;
!   
    DelugePageTransferM.SubControl -> Storage;
-   DelugePageTransferM.SubControl -> TimerC;
  
    DelugePageTransferM.BitVecUtils -> BitVecUtilsC;
--- 59,66 ----
    DelugePageTransfer = DelugePageTransferM;
    Leds = DelugePageTransferM;
! 
!   Main.StdControl -> TimerC;
! 
    DelugePageTransferM.SubControl -> Storage;
  
    DelugePageTransferM.BitVecUtils -> BitVecUtilsC;

Index: DelugeStorageC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeStorageC.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DelugeStorageC.nc	3 Jan 2005 17:31:14 -0000	1.4
--- DelugeStorageC.nc	20 Jan 2005 01:36:43 -0000	1.5
***************
*** 44,47 ****
--- 44,48 ----
  
    components
+     Main,
      DelugeStorageM as Storage,
      BlockStorageC,
***************
*** 56,60 ****
    MetadataWrite = Storage;
  
!   Storage.SubControl -> BlockStorageC;
    Storage.ImageVolume -> FlashVolumeC;
    Storage.ImageRead -> BlockStorageC;
--- 57,62 ----
    MetadataWrite = Storage;
  
!   Main.StdControl -> BlockStorageC;
! 
    Storage.ImageVolume -> FlashVolumeC;
    Storage.ImageRead -> BlockStorageC;

Index: DelugeStorageM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeStorageM.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DelugeStorageM.nc	3 Jan 2005 17:31:14 -0000	1.4
--- DelugeStorageM.nc	20 Jan 2005 01:36:43 -0000	1.5
***************
*** 42,46 ****
      interface BlockWrite as ImageWrite[uint8_t id];
      interface FlashVolume as ImageVolume[uint8_t id];
-     interface StdControl as SubControl;
    }
  }
--- 42,45 ----
***************
*** 78,84 ****
    }
  
!   command result_t StdControl.init() { 
!     return call SubControl.init();
!   }
  
    command result_t StdControl.start() { 
--- 77,81 ----
    }
  
!   command result_t StdControl.init() { return SUCCESS; }
  
    command result_t StdControl.start() { 
***************
*** 86,90 ****
      call ImageVolume.mount[DELUGE_VOLUMES[1]](0);
      call ImageVolume.mount[DELUGE_VOLUMES[2]](1);
!     return call SubControl.start();
    }
  
--- 83,87 ----
      call ImageVolume.mount[DELUGE_VOLUMES[1]](0);
      call ImageVolume.mount[DELUGE_VOLUMES[2]](1);
!     return SUCCESS;
    }
  



More information about the Tinyos-beta-commits mailing list