[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/at45db ConfigStorageP.nc, 1.1.2.4, 1.1.2.5

David Gay idgay at users.sourceforge.net
Wed May 31 07:57:47 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv32011

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	ConfigStorageP.nc 
Log Message:
Add valid command


Index: ConfigStorageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/ConfigStorageP.nc,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** ConfigStorageP.nc	30 May 2006 21:36:27 -0000	1.1.2.4
--- ConfigStorageP.nc	31 May 2006 14:57:43 -0000	1.1.2.5
***************
*** 56,59 ****
--- 56,60 ----
      S_CLEAN,
      S_DIRTY,
+     S_INVALID
    };
  
***************
*** 115,120 ****
  
    void mountVerifyDone(uint8_t id, error_t error) {
!     if (error != SUCCESS) // try the other half?
        {
  	bool isflipped = call BConfig.flipped[id]();
  
--- 116,124 ----
  
    void mountVerifyDone(uint8_t id, error_t error) {
!     if (error == SUCCESS) 
!       state[id] = S_CLEAN;
!     else
        {
+ 	// try the other half?
  	bool isflipped = call BConfig.flipped[id]();
  
***************
*** 129,134 ****
  	/* both halves bad, just declare success and use the current half :-) 
  	   (we did need to verify to find the end-of-block) */
        }
-     state[id] = S_CLEAN;
      signal Mount.mountDone[id](SUCCESS);
    }
--- 133,138 ----
  	/* both halves bad, just declare success and use the current half :-) 
  	   (we did need to verify to find the end-of-block) */
+ 	state[id] = S_INVALID;
        }
      signal Mount.mountDone[id](SUCCESS);
    }
***************
*** 140,144 ****
    command error_t ConfigStorage.read[configstorage_t id](storage_addr_t addr, void* buf, storage_len_t len) {
      /* Read from current half using BlockRead */
!     if (!(state[id] == S_CLEAN || state[id] == S_DIRTY))
        return EOFF;
  
--- 144,148 ----
    command error_t ConfigStorage.read[configstorage_t id](storage_addr_t addr, void* buf, storage_len_t len) {
      /* Read from current half using BlockRead */
!     if (state[id] < S_CLEAN)
        return EOFF;
  
***************
*** 159,163 ****
         2: Write to current half using BlockWrite */
  
!     if (!(state[id] == S_CLEAN || state[id] == S_DIRTY))
        return EOFF;
      return call BlockWrite.write[id](addr + sizeof(uint32_t), buf, len);
--- 163,167 ----
         2: Write to current half using BlockWrite */
  
!     if (state[id] < S_CLEAN)
        return EOFF;
      return call BlockWrite.write[id](addr + sizeof(uint32_t), buf, len);
***************
*** 168,172 ****
  
    command int BConfig.writeHook[configstorage_t id]() {
!     if (state[id] == S_DIRTY) // no work if already dirty
        return FALSE;
  
--- 172,176 ----
  
    command int BConfig.writeHook[configstorage_t id]() {
!     if (state[id] != S_CLEAN) // no work if dirty or invalid
        return FALSE;
  
***************
*** 242,246 ****
      /* Call BlockWrite.commit */
      /* Could special-case attempt to commit clean block */
!     if (!(state[id] == S_CLEAN || state[id] == S_DIRTY))
        return EOFF;
      return call BlockWrite.commit[id]();
--- 246,250 ----
      /* Call BlockWrite.commit */
      /* Could special-case attempt to commit clean block */
!     if (state[id] < S_CLEAN)
        return EOFF;
      return call BlockWrite.commit[id]();
***************
*** 262,265 ****
--- 266,277 ----
  
    /* ------------------------------------------------------------------ */
+   /* Valid								*/
+   /* ------------------------------------------------------------------ */
+ 
+   command bool ConfigStorage.valid[configstorage_t id]() {
+     return state[id] != S_INVALID;
+   }
+ 
+   /* ------------------------------------------------------------------ */
    /* Interface with BlockStorageP					*/
    /* ------------------------------------------------------------------ */



More information about the Tinyos-2-commits mailing list