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

Razvan Musaloiu-E. razvanm at users.sourceforge.net
Fri Jun 1 17:09:17 PDT 2007


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

Modified Files:
	FlashVolumeManagerC.nc FlashVolumeManagerP.nc 
Log Message:
Add support for MicaZ to Deluge T2.


Index: FlashVolumeManagerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** FlashVolumeManagerC.nc	22 May 2007 20:34:24 -0000	1.1
--- FlashVolumeManagerC.nc	2 Jun 2007 00:09:14 -0000	1.2
***************
*** 35,39 ****
      interface BlockRead[uint8_t img_num];
      interface BlockWrite[uint8_t img_num];
!     interface StorageMap[uint8_t img_num];
    }
  }
--- 35,39 ----
      interface BlockRead[uint8_t img_num];
      interface BlockWrite[uint8_t img_num];
!     interface DelugeStorage[uint8_t img_num];
    }
  }
***************
*** 48,58 ****
    FlashVolumeManagerP.BlockRead[0] = BlockRead[0];
    FlashVolumeManagerP.BlockWrite[0] = BlockWrite[0];
!   FlashVolumeManagerP.StorageMap[0] = StorageMap[0];
    FlashVolumeManagerP.BlockRead[1] = BlockRead[1];
    FlashVolumeManagerP.BlockWrite[1] = BlockWrite[1];
!   FlashVolumeManagerP.StorageMap[1] = StorageMap[1];
    FlashVolumeManagerP.SerialAMSender -> SerialAMSenderC;
    FlashVolumeManagerP.SerialAMReceiver -> SerialAMReceiverC;
!   FlashVolumeManagerP.Leds -> NoLedsC;
  
  #ifdef DELUGE  
--- 48,58 ----
    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  

Index: FlashVolumeManagerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** FlashVolumeManagerP.nc	22 May 2007 20:34:24 -0000	1.1
--- FlashVolumeManagerP.nc	2 Jun 2007 00:09:14 -0000	1.2
***************
*** 35,39 ****
      interface BlockRead[uint8_t img_num];
      interface BlockWrite[uint8_t img_num];
!     interface StorageMap[uint8_t img_num];
      interface AMSend as SerialAMSender;
      interface Receive as SerialAMReceiver;
--- 35,39 ----
      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;
***************
*** 122,125 ****
--- 122,132 ----
    {
      if (state == S_ERASE) {
+       call BlockWrite.sync[img_num]();
+     }
+   }
+   
+   event void BlockWrite.syncDone[uint8_t img_num](error_t error)
+   {
+     if (state == S_ERASE) {
        state = S_IDLE;
        sendReply(error, sizeof(SerialReplyPacket));
***************
*** 127,132 ****
    }
    
-   event void BlockWrite.syncDone[uint8_t img_num](error_t error) {}
-   
    event void SerialAMSender.sendDone(message_t* msg, error_t error) {}
    
--- 134,137 ----
***************
*** 137,150 ****
      SerialReplyPacket *serialMsg_payload =
                                (SerialReplyPacket *)call SerialAMSender.getPayload(&serialMsg);
      
      switch (srpkt->msg_type) {
        case SERIALMSG_ERASE:    // === Erases a volume ===
          state = S_ERASE;
!         error = call BlockWrite.erase[srpkt->img_num]();
          break;
        case SERIALMSG_WRITE:    // === Writes to a volume ===
          state = S_WRITE;
          memcpy(buffer, srpkt->data, srpkt->len);
!         error = call BlockWrite.write[srpkt->img_num](srpkt->offset,
                                                        buffer,
                                                        srpkt->len);
--- 142,166 ----
      SerialReplyPacket *serialMsg_payload =
                                (SerialReplyPacket *)call SerialAMSender.getPayload(&serialMsg);
+     uint8_t img_num = 0xFF;
+     
+     // Converts the image number that the user wants to the real image number
+     switch (srpkt->img_num) {
+       case 0:
+         img_num = VOLUME_DELUGE0;
+         break;
+       case 1:
+         img_num = VOLUME_DELUGE1;
+         break;
+     }
      
      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);
***************
*** 152,156 ****
        case SERIALMSG_READ:     // === Reads a portion of a volume ===
          state = S_READ;
!         error = call BlockRead.read[srpkt->img_num](srpkt->offset,
                                                      serialMsg_payload->data,
                                                      srpkt->len);
--- 168,172 ----
        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);
***************
*** 158,167 ****
        case SERIALMSG_CRC:      // === Computes CRC over a portion of a volume ===
          state = S_CRC;
!         error = call BlockRead.computeCrc[srpkt->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 StorageMap.getPhysicalAddress[srpkt->img_num](0);
  	sendReply(SUCCESS, sizeof(SerialReplyPacket) + 4);
          break;
--- 174,183 ----
        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;
***************
*** 170,178 ****
          state = S_REPROG;
          sendReply(SUCCESS, sizeof(SerialReplyPacket));
!         img_num_reboot = srpkt->img_num;
  	call Timer.startOneShot(1024);
  	break;
        case SERIALMSG_DISS:     // === Starts disseminating a volume ===
! 	signal Notify.notify(srpkt->img_num);   // Notifies Deluge to start disseminate
  	sendReply(SUCCESS, sizeof(SerialReplyPacket));
  	break;
--- 186,194 ----
          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;
***************
*** 206,209 ****
    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 StorageMap.getPhysicalAddress[uint8_t img_num](storage_addr_t addr) { return 0; }
  }
--- 222,225 ----
    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; }
  }



More information about the Tinyos-2-commits mailing list