[Tinyos-beta-commits] CVS: tinyos-1.x/beta/STM25P/STM25P StorageManagerM.nc, 1.2, 1.3

Jonathan Hui jwhui at users.sourceforge.net
Mon Mar 14 23:19:20 PST 2005


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

Modified Files:
	StorageManagerM.nc 
Log Message:
- Fixed a bug in restoring the sector table when erasing a sector.



Index: StorageManagerM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/STM25P/STM25P/StorageManagerM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** StorageManagerM.nc	15 Mar 2005 06:23:21 -0000	1.2
--- StorageManagerM.nc	15 Mar 2005 07:19:18 -0000	1.3
***************
*** 195,198 ****
--- 195,200 ----
        if (i == STM25P_NUM_SECTORS) {
  	state = S_MOUNT;
+ 	call Leds.set(5);
+ 	while(1);
  	return formatFlash();
        }
***************
*** 251,254 ****
--- 253,261 ----
        return FAIL;
  
+     if (physicalAddr(addr) >= STORAGE_BLOCK_SIZE && volume == 1) {
+       call Leds.set(5);
+       while(1);
+     }
+ 
      return call HALSTM25P.read(physicalAddr(addr), data, len);
  
***************
*** 266,269 ****
--- 273,281 ----
      state = S_WRITE;
  
+     if (physicalAddr(addr) >= STORAGE_BLOCK_SIZE && volume == 1) {
+       call Leds.set(5);
+       while(1);
+     }
+ 
      if (call HALSTM25P.pageProgram(rwAddr, data, calcNumBytes()) == FAIL) {
        state = S_READY;
***************
*** 277,284 ****
    command result_t SectorStorage.erase[volume_t volume](stm25p_addr_t addr) {
  
      if ( admitRequest(volume) == FAIL )
        return FAIL;
  
!     rwAddr = physicalAddr(addr);
      rwLen = 0;
  
--- 289,298 ----
    command result_t SectorStorage.erase[volume_t volume](stm25p_addr_t addr) {
  
+     stm25p_addr_t sector = addr / STORAGE_BLOCK_SIZE;
+ 
      if ( admitRequest(volume) == FAIL )
        return FAIL;
  
!     rwAddr = STM25P_SECTOR_SIZE*(baseSector[volume]+sector) + STORAGE_BLOCK_SIZE;
      rwLen = 0;
  
***************
*** 299,302 ****
--- 313,321 ----
        return FAIL;
  
+     if (physicalAddr(addr) >= STORAGE_BLOCK_SIZE && volume == 1) {
+       call Leds.set(5);
+       while(1);
+     }
+ 
      return call HALSTM25P.computeCrc(crcResult, crc, physicalAddr(addr), len);
  



More information about the Tinyos-beta-commits mailing list