[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/Deluge DelugeStorage.nc, NONE, 1.1 DelugeC.nc, 1.1, 1.2 DelugePageTransfer.h, 1.2, 1.3 DelugeStorageC.nc, 1.1, 1.2 DelugeStorageP.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
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19802/tos/lib/net/Deluge

Modified Files:
	DelugeC.nc DelugePageTransfer.h DelugeStorageC.nc 
	DelugeStorageP.nc 
Added Files:
	DelugeStorage.nc 
Log Message:
Add support for MicaZ to Deluge T2.


--- NEW FILE: DelugeStorage.nc ---
/*
 * Copyright (c) 2005-2006 Arch Rock Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * - Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the
 *   distribution.
 * - Neither the name of the Arch Rock Corporation nor the names of
 *   its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
 * ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE
 */

/**
 * An abstraction to map volume addresses to physical addresses.
 *
 * @author Jonathan Hui <jhui at archrock.com>
 * @version $Revision: 1.1 $ $Date: 2007/06/02 00:09:14 $
 */

/**
 * The same as StorageMap interface for STM25P.
 *
 * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
 * @author Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
 */

interface DelugeStorage {

  /**
   * Get the physical address of a volume address.
   *
   * @param addr the volume addres.
   * @return the physical address.
   */
  command storage_addr_t getPhysicalAddress(storage_addr_t addr);
}

Index: DelugeC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/DelugeC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DelugeC.nc	22 May 2007 20:34:22 -0000	1.1
--- DelugeC.nc	2 Jun 2007 00:09:14 -0000	1.2
***************
*** 40,47 ****
    FlashVolumeManagerC.BlockRead[0] -> DelugeStorageC.BlockRead[0];
    FlashVolumeManagerC.BlockWrite[0] -> DelugeStorageC.BlockWrite[0];
!   FlashVolumeManagerC.StorageMap[0] -> DelugeStorageC.StorageMap[0];
    FlashVolumeManagerC.BlockRead[1] -> DelugeStorageC.BlockRead[1];
    FlashVolumeManagerC.BlockWrite[1] -> DelugeStorageC.BlockWrite[1];
!   FlashVolumeManagerC.StorageMap[1] -> DelugeStorageC.StorageMap[1];
  #endif
    
--- 40,47 ----
    FlashVolumeManagerC.BlockRead[0] -> DelugeStorageC.BlockRead[0];
    FlashVolumeManagerC.BlockWrite[0] -> DelugeStorageC.BlockWrite[0];
!   FlashVolumeManagerC.DelugeStorage[0] -> DelugeStorageC.DelugeStorage[0];
    FlashVolumeManagerC.BlockRead[1] -> DelugeStorageC.BlockRead[1];
    FlashVolumeManagerC.BlockWrite[1] -> DelugeStorageC.BlockWrite[1];
!   FlashVolumeManagerC.DelugeStorage[1] -> DelugeStorageC.DelugeStorage[1];
  #endif
    

Index: DelugePageTransfer.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/DelugePageTransfer.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DelugePageTransfer.h	25 May 2007 17:26:12 -0000	1.2
--- DelugePageTransfer.h	2 Jun 2007 00:09:14 -0000	1.3
***************
*** 32,36 ****
  #define DELUGEPAGETRANSFER_H
  
! #include "extra/telosb/TOSBoot_platform.h"
  #include <message.h>
  
--- 32,43 ----
  #define DELUGEPAGETRANSFER_H
  
! #if defined(PLATFORM_TELOSB)
!   #include "extra/telosb/TOSBoot_platform.h"
! #elif defined(PLATFORM_MICAZ)
!   #include "extra/micaz/TOSBoot_platform.h"
! #else
!   #error "Target platform is not currently supported by Deluge T2"
! #endif
! 
  #include <message.h>
  

Index: DelugeStorageC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/DelugeStorageC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DelugeStorageC.nc	22 May 2007 20:34:23 -0000	1.1
--- DelugeStorageC.nc	2 Jun 2007 00:09:14 -0000	1.2
***************
*** 32,36 ****
      interface BlockRead[uint8_t img_num];
      interface BlockWrite[uint8_t img_num];
!     interface StorageMap[uint8_t img_num];
      interface DelugeMetadata;
      
--- 32,36 ----
      interface BlockRead[uint8_t img_num];
      interface BlockWrite[uint8_t img_num];
!     interface DelugeStorage[uint8_t img_num];
      interface DelugeMetadata;
      
***************
*** 41,60 ****
  implementation
  {
-   components new BlockStorageC(VOLUME_DELUGE0) as BlockStorageC_0;
-   components new BlockStorageC(VOLUME_DELUGE1) as BlockStorageC_1;
    components DelugeStorageP;
  
!   BlockRead[0] = DelugeStorageP.BlockRead[0];
!   BlockWrite[0] = DelugeStorageP.BlockWrite[0];
!   StorageMap[0] = BlockStorageC_0;
!   BlockRead[1] = DelugeStorageP.BlockRead[1];
!   BlockWrite[1] = DelugeStorageP.BlockWrite[1];
!   StorageMap[1] = BlockStorageC_1;
    DelugeMetadata = DelugeStorageP.DelugeMetadata;
  
!   DelugeStorageP.SubBlockRead[0] -> BlockStorageC_0;
!   DelugeStorageP.SubBlockWrite[0] -> BlockStorageC_0;
!   DelugeStorageP.SubBlockRead[1] -> BlockStorageC_1;
!   DelugeStorageP.SubBlockWrite[1] -> BlockStorageC_1;
    
    components LedsC, MainC;
--- 41,72 ----
  implementation
  {
    components DelugeStorageP;
  
!   BlockRead[VOLUME_DELUGE0] = DelugeStorageP.BlockRead[VOLUME_DELUGE0];
!   BlockWrite[VOLUME_DELUGE0] = DelugeStorageP.BlockWrite[VOLUME_DELUGE0];
!   BlockRead[VOLUME_DELUGE1] = DelugeStorageP.BlockRead[VOLUME_DELUGE1];
!   BlockWrite[VOLUME_DELUGE1] = DelugeStorageP.BlockWrite[VOLUME_DELUGE1];
    DelugeMetadata = DelugeStorageP.DelugeMetadata;
+  
+   components new BlockStorageC(VOLUME_DELUGE0) as BlockStorageC_0;
+   components new BlockStorageC(VOLUME_DELUGE1) as BlockStorageC_1;
+   DelugeStorageP.SubBlockRead[VOLUME_DELUGE0] -> BlockStorageC_0;
+   DelugeStorageP.SubBlockWrite[VOLUME_DELUGE0] -> BlockStorageC_0;
+   DelugeStorageP.SubBlockRead[VOLUME_DELUGE1] -> BlockStorageC_1;
+   DelugeStorageP.SubBlockWrite[VOLUME_DELUGE1] -> BlockStorageC_1;
+   
+ #if defined(PLATFORM_TELOSB)
+   DelugeStorageP.StorageMap[VOLUME_DELUGE0] -> BlockStorageC_0;
+   DelugeStorageP.StorageMap[VOLUME_DELUGE1] -> BlockStorageC_1;
+ #elif defined(PLATFORM_MICAZ)
+   components At45dbStorageManagerC;
+   DelugeStorageP.At45dbVolume[VOLUME_DELUGE0] -> At45dbStorageManagerC.At45dbVolume[VOLUME_DELUGE0];
+   DelugeStorageP.At45dbVolume[VOLUME_DELUGE1] -> At45dbStorageManagerC.At45dbVolume[VOLUME_DELUGE1];
+ #else
+   #error "Target platform is not currently supported by Deluge T2"
+ #endif
  
!   DelugeStorage[VOLUME_DELUGE0] = DelugeStorageP.DelugeStorage[VOLUME_DELUGE0];
!   DelugeStorage[VOLUME_DELUGE1] = DelugeStorageP.DelugeStorage[VOLUME_DELUGE1];
    
    components LedsC, MainC;

Index: DelugeStorageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/DelugeStorageP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DelugeStorageP.nc	22 May 2007 20:34:23 -0000	1.1
--- DelugeStorageP.nc	2 Jun 2007 00:09:14 -0000	1.2
***************
*** 34,41 ****
--- 34,47 ----
      interface Boot;
      interface Leds;
+ #if defined(PLATFORM_TELOSB)
+     interface StorageMap[uint8_t img_num];
+ #elif defined(PLATFORM_MICAZ)
+     interface At45dbVolume[volume_id_t img_num];
+ #endif
    }
    provides {
      interface BlockRead[uint8_t img_num];
      interface BlockWrite[uint8_t img_num];
+     interface DelugeStorage[uint8_t img_num];
      interface DelugeMetadata;
      
***************
*** 171,174 ****
--- 177,197 ----
    }
  
+   command storage_addr_t DelugeStorage.getPhysicalAddress[uint8_t img_num](storage_addr_t addr)
+   {
+     storage_addr_t p_addr = 0xFFFFFFFF;
+     
+     #if defined(PLATFORM_TELOSB)
+       p_addr = call StorageMap.getPhysicalAddress[img_num](addr);
+     #elif defined(PLATFORM_MICAZ)
+       at45page_t page = call At45dbVolume.remap[img_num]((addr >> AT45_PAGE_SIZE_LOG2));
+       at45pageoffset_t offset = addr & ((1 << AT45_PAGE_SIZE_LOG2) - 1);
+       p_addr = page;
+       p_addr = p_addr << AT45_PAGE_SIZE_LOG2;
+       p_addr += offset;
+     #endif
+     
+     return p_addr;
+   }
+ 
    default event void BlockRead.readDone[uint8_t img_num](storage_addr_t addr, void* buf, storage_len_t len, error_t error) {}
    default event void BlockRead.computeCrcDone[uint8_t img_num](storage_addr_t addr, storage_len_t len, uint16_t crc, error_t error) {}
***************
*** 186,188 ****
--- 209,217 ----
    command error_t Notify.enable() { return SUCCESS; }
    command error_t Notify.disable() { return SUCCESS; }
+   
+ #if defined(PLATFORM_TELOSB)
+   default command storage_addr_t StorageMap.getPhysicalAddress[uint8_t img_num](storage_addr_t addr) { return 0xFFFFFFFF; }
+ #elif defined(PLATFORM_MICAZ)
+   default command at45page_t At45dbVolume.remap[volume_id_t volid](at45page_t volumePage) { return 0xFFFF; };
+ #endif
  }



More information about the Tinyos-2-commits mailing list