[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/Deluge/FlashVolumeManager FlashVolumeManagerC.nc, 1.2, 1.3 FlashVolumeManagerP.nc, 1.2, 1.3

Razvan Musaloiu-E. razvanm at users.sourceforge.net
Wed Jun 27 13:05:00 PDT 2007


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

Modified Files:
	FlashVolumeManagerC.nc FlashVolumeManagerP.nc 
Log Message:
This commit from Chieh-Jan (Mike) Liang fixes the following issues:
- DelugeStorage is no longer included when DELUGE flag is not defined.
- Fix a problem related to the way MicaZ storage driver allocates volumes in reverse order than the one defined in XML file. The symptom here is that --diss command will disseminate the wrong volume.
- Fix the problem of not changing local node ID properly. The problem was reported by Ryan Stinnett.
- After a page is received and written to flash, sync the flash (especially for AT45DB).


Index: FlashVolumeManagerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FlashVolumeManagerC.nc	2 Jun 2007 00:09:14 -0000	1.2
--- FlashVolumeManagerC.nc	27 Jun 2007 20:04:57 -0000	1.3
***************
*** 26,29 ****
--- 26,30 ----
  
  #include "AM.h"
+ #include "StorageVolumes.h"
  
  generic configuration FlashVolumeManagerC(am_id_t AMId)
***************
*** 35,39 ****
--- 36,42 ----
      interface BlockRead[uint8_t img_num];
      interface BlockWrite[uint8_t img_num];
+ #ifdef DELUGE
      interface DelugeStorage[uint8_t img_num];
+ #endif
    }
  }
***************
*** 46,64 ****
               NoLedsC, LedsC;
    
!   FlashVolumeManagerP.BlockRead[0] = BlockRead[0];
!   FlashVolumeManagerP.BlockWrite[0] = BlockWrite[0];
!   FlashVolumeManagerP.DelugeStorage[0] = DelugeStorage[0];
!   FlashVolumeManagerP.BlockRead[1] = BlockRead[1];
!   FlashVolumeManagerP.BlockWrite[1] = BlockWrite[1];
!   FlashVolumeManagerP.DelugeStorage[1] = DelugeStorage[1];
    FlashVolumeManagerP.SerialAMSender -> SerialAMSenderC;
    FlashVolumeManagerP.SerialAMReceiver -> SerialAMReceiverC;
!   FlashVolumeManagerP.Leds -> LedsC;
  
  #ifdef DELUGE  
    components NetProgC, new TimerMilliC();
    FlashVolumeManagerP.NetProg -> NetProgC;
    FlashVolumeManagerP.Timer -> TimerMilliC;
!   
    Notify = FlashVolumeManagerP.Notify;
  #endif
--- 49,67 ----
               NoLedsC, LedsC;
    
!   FlashVolumeManagerP.BlockRead[VOLUME_DELUGE0] = BlockRead[VOLUME_DELUGE0];
!   FlashVolumeManagerP.BlockWrite[VOLUME_DELUGE0] = BlockWrite[VOLUME_DELUGE0];
!   FlashVolumeManagerP.BlockRead[VOLUME_DELUGE1] = BlockRead[VOLUME_DELUGE1];
!   FlashVolumeManagerP.BlockWrite[VOLUME_DELUGE1] = BlockWrite[VOLUME_DELUGE1];
    FlashVolumeManagerP.SerialAMSender -> SerialAMSenderC;
    FlashVolumeManagerP.SerialAMReceiver -> SerialAMReceiverC;
!   FlashVolumeManagerP.Leds -> NoLedsC;
  
  #ifdef DELUGE  
    components NetProgC, new TimerMilliC();
+   
    FlashVolumeManagerP.NetProg -> NetProgC;
    FlashVolumeManagerP.Timer -> TimerMilliC;
!   FlashVolumeManagerP.DelugeStorage[VOLUME_DELUGE0] = DelugeStorage[VOLUME_DELUGE0];
!   FlashVolumeManagerP.DelugeStorage[VOLUME_DELUGE1] = DelugeStorage[VOLUME_DELUGE1];
    Notify = FlashVolumeManagerP.Notify;
  #endif

Index: FlashVolumeManagerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FlashVolumeManagerP.nc	2 Jun 2007 00:09:14 -0000	1.2
--- FlashVolumeManagerP.nc	27 Jun 2007 20:04:57 -0000	1.3
***************
*** 35,46 ****
      interface BlockRead[uint8_t img_num];
      interface BlockWrite[uint8_t img_num];
-     interface DelugeStorage[uint8_t img_num];
-     interface AMSend as SerialAMSender;
-     interface Receive as SerialAMReceiver;
-     interface Leds;
  #ifdef DELUGE
      interface NetProg;
      interface Timer<TMilli> as Timer;
  #endif
    }
  }
--- 35,46 ----
      interface BlockRead[uint8_t img_num];
      interface BlockWrite[uint8_t img_num];
  #ifdef DELUGE
+     interface DelugeStorage[uint8_t img_num];
      interface NetProg;
      interface Timer<TMilli> as Timer;
  #endif
+     interface AMSend as SerialAMSender;
+     interface Receive as SerialAMReceiver;
+     interface Leds;
    }
  }
***************
*** 154,197 ****
      }
      
!     switch (srpkt->msg_type) {
!       case SERIALMSG_ERASE:    // === Erases a volume ===
!         state = S_ERASE;
!         error = call BlockWrite.erase[img_num]();
!         break;
!       case SERIALMSG_WRITE:    // === Writes to a volume ===
!         state = S_WRITE;
!         memcpy(buffer, srpkt->data, srpkt->len);
!         error = call BlockWrite.write[img_num](srpkt->offset,
!                                                       buffer,
                                                        srpkt->len);
!         break;
!       case SERIALMSG_READ:     // === Reads a portion of a volume ===
!         state = S_READ;
!         error = call BlockRead.read[img_num](srpkt->offset,
!                                                     serialMsg_payload->data,
!                                                     srpkt->len);
!         break;
!       case SERIALMSG_CRC:      // === Computes CRC over a portion of a volume ===
!         state = S_CRC;
!         error = call BlockRead.computeCrc[img_num](srpkt->offset,
!                                                           srpkt->len, 0);
!         break;
!       case SERIALMSG_ADDR:     // === Gets the physical starting address of a volume ===
! 	*(nx_uint32_t*)(&serialMsg_payload->data) =
! 	                      (uint32_t)call DelugeStorage.getPhysicalAddress[img_num](0);
! 	sendReply(SUCCESS, sizeof(SerialReplyPacket) + 4);
!         break;
! #ifdef DELUGE
!       case SERIALMSG_REPROG:   // === Reboots and reprograms ===
!         state = S_REPROG;
!         sendReply(SUCCESS, sizeof(SerialReplyPacket));
!         img_num_reboot = img_num;
! 	call Timer.startOneShot(1024);
! 	break;
!       case SERIALMSG_DISS:     // === Starts disseminating a volume ===
! 	signal Notify.notify(img_num);   // Notifies Deluge to start disseminate
! 	sendReply(SUCCESS, sizeof(SerialReplyPacket));
! 	break;
! #endif
      }
      
--- 154,201 ----
      }
      
!     if (img_num != 0xFF) {
!       switch (srpkt->msg_type) {
!         case SERIALMSG_ERASE:    // === Erases a volume ===
!           state = S_ERASE;
!           error = call BlockWrite.erase[img_num]();
!           break;
!         case SERIALMSG_WRITE:    // === Writes to a volume ===
!           state = S_WRITE;
!           memcpy(buffer, srpkt->data, srpkt->len);
!           error = call BlockWrite.write[img_num](srpkt->offset,
!                                                         buffer,
!                                                         srpkt->len);
!           break;
!         case SERIALMSG_READ:     // === Reads a portion of a volume ===
!           state = S_READ;
!           error = call BlockRead.read[img_num](srpkt->offset,
!                                                       serialMsg_payload->data,
                                                        srpkt->len);
!           break;
!         case SERIALMSG_CRC:      // === Computes CRC over a portion of a volume ===
!           state = S_CRC;
!           error = call BlockRead.computeCrc[img_num](srpkt->offset,
!                                                             srpkt->len, 0);
!           break;
!   #ifdef DELUGE
!         case SERIALMSG_ADDR:     // === Gets the physical starting address of a volume ===
!           *(nx_uint32_t*)(&serialMsg_payload->data) =
!                                   (uint32_t)call DelugeStorage.getPhysicalAddress[img_num](0);
!           sendReply(SUCCESS, sizeof(SerialReplyPacket) + 4);
!           break;
!         case SERIALMSG_REPROG:   // === Reboots and reprograms ===
!           state = S_REPROG;
!           sendReply(SUCCESS, sizeof(SerialReplyPacket));
!           img_num_reboot = img_num;
!           call Timer.startOneShot(1024);
!           break;
!         case SERIALMSG_DISS:     // === Starts disseminating a volume ===
!           signal Notify.notify(img_num);   // Notifies Deluge to start disseminate
!           sendReply(SUCCESS, sizeof(SerialReplyPacket));
!           break;
!   #endif
!       }
!     } else {
!       error = FAIL;
      }
      
***************
*** 214,217 ****
--- 218,223 ----
    command error_t Notify.enable() { return SUCCESS; }
    command error_t Notify.disable() { return SUCCESS; }
+   
+   default command storage_addr_t DelugeStorage.getPhysicalAddress[uint8_t img_num](storage_addr_t addr) { return 0; }
  #endif
  
***************
*** 221,225 ****
    default command error_t BlockRead.read[uint8_t img_num](storage_addr_t addr, void* buf, storage_len_t len) { return FAIL; }
    default command error_t BlockRead.computeCrc[uint8_t img_num](storage_addr_t addr, storage_len_t len, uint16_t crc) { return FAIL; }
- 
-   default command storage_addr_t DelugeStorage.getPhysicalAddress[uint8_t img_num](storage_addr_t addr) { return 0; }
  }
--- 227,229 ----



More information about the Tinyos-2-commits mailing list