[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/at45db At45dbBlockConfig.nc, NONE, 1.1.2.1 At45dbP.nc, 1.1.2.4, 1.1.2.5 BlockStorageP.nc, 1.1.2.8, 1.1.2.9 ConfigStorageC.nc, 1.1.2.1, 1.1.2.2 ConfigStorageP.nc, 1.1.2.1, 1.1.2.2 HplAt45dbByteC.nc, 1.1.2.6, 1.1.2.7 At45dbBlockLog.nc, 1.1.2.1, NONE

David Gay idgay at users.sourceforge.net
Thu May 25 15:31:30 PDT 2006


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

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	At45dbP.nc BlockStorageP.nc ConfigStorageC.nc 
	ConfigStorageP.nc HplAt45dbByteC.nc 
Added Files:
      Tag: tinyos-2_0_devel-BRANCH
	At45dbBlockConfig.nc 
Removed Files:
      Tag: tinyos-2_0_devel-BRANCH
	At45dbBlockLog.nc 
Log Message:
config storage passes its test


--- NEW FILE: At45dbBlockConfig.nc ---
// $Id: At45dbBlockConfig.nc,v 1.1.2.1 2006/05/25 22:31:28 idgay Exp $

/*									tab:4
 * Copyright (c) 2002-2006 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */

/**
 * Private interface between the AT45DB implementations of config and block storage
 *
 * @author: David Gay <dgay at acm.org>
 */

interface At45dbBlockConfig {
  /**
   * Set which half of the block is used by the current config state
   * @param flip TRUE for 2nd half, FALSE for 1st half
   */
  command void setFlip(bool flip);
  /**
   * Query which half of the block is used by the current config state
   * @return TRUE for 2nd half, FALSE for 1st half
   */
  command bool flipped();

  /**
   * Hook called by block storage just before the start of each write
   * @return TRUE to delay the write until <code>writeContinue</code>
   *    is called, FALSE to proceed immediately.
   */
  event bool writeHook();
  /**
   * Continue or abort write suspended as a result of a <code>writeHook</code>
   * event
   * @param error SUCCESS to continue write, anything else to abort write 
   *   returning that error code
   */
  command void writeContinue(error_t error);

  /**
   * Return size of a config volume in pages (half of the actual block)
   * @return Config volume size
   */
  command at45page_t npages();

  /**
   * Map a volume-relative page to an absolute flash page, taking account
   * of the current flipped status
   * @param page Volume-relative page
   * @return Actual flash page for <code>page</code>
   */
  command at45page_t remap(at45page_t page);
}

Index: At45dbP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/At45dbP.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
*** At45dbP.nc	25 May 2006 18:23:46 -0000	1.1.2.4
--- At45dbP.nc	25 May 2006 22:31:28 -0000	1.1.2.5
***************
*** 360,363 ****
--- 360,364 ----
        case R_FLUSH: case R_FLUSHALL: signal At45db.flushDone(result); break;
        case R_ERASE: signal At45db.eraseDone(result); break;
+       case R_COPY: signal At45db.copyPageDone(result); break;
        }
    }

Index: BlockStorageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/BlockStorageP.nc,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -d -r1.1.2.8 -r1.1.2.9
*** BlockStorageP.nc	25 May 2006 18:23:46 -0000	1.1.2.8
--- BlockStorageP.nc	25 May 2006 22:31:28 -0000	1.1.2.9
***************
*** 44,48 ****
      interface BlockWrite[blockstorage_t blockId];
      interface BlockRead[blockstorage_t blockId];
!     interface At45dbBlockLog as BLog[blockstorage_t blockId];
    }
    uses {
--- 44,48 ----
      interface BlockWrite[blockstorage_t blockId];
      interface BlockRead[blockstorage_t blockId];
!     interface At45dbBlockConfig as BConfig[blockstorage_t blockId];
    }
    uses {
***************
*** 65,69 ****
  
    enum {
!     N = uniqueCount(UQ_BLOCK_STORAGE) + uniqueCount(UQ_LOG_STORAGE),
      NO_CLIENT = 0xff
    };
--- 65,69 ----
  
    enum {
!     N = uniqueCount(UQ_BLOCK_STORAGE) + uniqueCount(UQ_CONFIG_STORAGE),
      NO_CLIENT = 0xff
    };
***************
*** 75,79 ****
    /* The requests */
    uint8_t state[N]; /* automatically initialised to S_IDLE */
!   uint8_t flipped[N / 8];
    uint8_t *bufPtr[N];
    storage_addr_t curAddr[N];
--- 75,79 ----
    /* The requests */
    uint8_t state[N]; /* automatically initialised to S_IDLE */
!   uint8_t flipped[(N + 7) / 8];
    uint8_t *bufPtr[N];
    storage_addr_t curAddr[N];
***************
*** 83,105 ****
    uint8_t sig[8];
  
!   inline int logClient(blockstorage_t id) {
      return id >= uniqueCount(UQ_BLOCK_STORAGE);
    }
  
    at45page_t pageRemap(at45page_t p) {
!     return call BLog.remap[client](p);
    }
  
!   command at45page_t BLog.npages[blockstorage_t id]() {
      return call At45dbVolume.volumeSize[id]() >> (AT45_PAGE_SIZE_LOG2 + 1);
    }
  
!   command at45page_t BLog.remap[blockstorage_t id](at45page_t page) {
!     if (logClient(id) && call BLog.flipped[id]())
        page += call At45dbVolume.volumeSize[id]() >> (AT45_PAGE_SIZE_LOG2 + 1);
      return call At45dbVolume.remap[id](page);
    }
  
!   command void BLog.setFlip[blockstorage_t blockId](bool flip) {
      if (flip)
        flipped[blockId >> 3] |= 1 << (blockId & 7);
--- 83,105 ----
    uint8_t sig[8];
  
!   inline int configClient(blockstorage_t id) {
      return id >= uniqueCount(UQ_BLOCK_STORAGE);
    }
  
    at45page_t pageRemap(at45page_t p) {
!     return call BConfig.remap[client](p);
    }
  
!   command at45page_t BConfig.npages[blockstorage_t id]() {
      return call At45dbVolume.volumeSize[id]() >> (AT45_PAGE_SIZE_LOG2 + 1);
    }
  
!   command at45page_t BConfig.remap[blockstorage_t id](at45page_t page) {
!     if (configClient(id) && call BConfig.flipped[id]())
        page += call At45dbVolume.volumeSize[id]() >> (AT45_PAGE_SIZE_LOG2 + 1);
      return call At45dbVolume.remap[id](page);
    }
  
!   command void BConfig.setFlip[blockstorage_t blockId](bool flip) {
      if (flip)
        flipped[blockId >> 3] |= 1 << (blockId & 7);
***************
*** 108,112 ****
    }
  
!   inline command bool BLog.flipped[blockstorage_t blockId]() {
      return (flipped[blockId >> 3] & (1 << (blockId & 7))) != 0;
    }
--- 108,112 ----
    }
  
!   inline command bool BConfig.flipped[blockstorage_t blockId]() {
      return (flipped[blockId >> 3] & (1 << (blockId & 7))) != 0;
    }
***************
*** 142,147 ****
      crc = 0;
  
!     if (logClient(blockId) && state[blockId] == S_WRITE &&
! 	signal BLog.writeHook[blockId]())
        /* Log write intercept. We'll get a writeContinue when it's
  	 time to resume. */
--- 142,147 ----
      crc = 0;
  
!     if (configClient(blockId) && state[blockId] == S_WRITE &&
! 	signal BConfig.writeHook[blockId]())
        /* Log write intercept. We'll get a writeContinue when it's
  	 time to resume. */
***************
*** 151,155 ****
    }
  
!   default event bool BLog.writeHook[blockstorage_t blockId]() {
      return FALSE;
    }
--- 151,155 ----
    }
  
!   default event bool BConfig.writeHook[blockstorage_t blockId]() {
      return FALSE;
    }
***************
*** 157,161 ****
    void signalDone(error_t result);
  
!   command void BLog.writeContinue[blockstorage_t blockId](error_t error) {
      client = blockId;
      if (error == SUCCESS)
--- 157,161 ----
    void signalDone(error_t result);
  
!   command void BConfig.writeContinue[blockstorage_t blockId](error_t error) {
      client = blockId;
      if (error == SUCCESS)
***************
*** 214,218 ****
  	    actualSignal(SUCCESS);
  	  else
! 	    actualSignal(FAIL);
  	  break;
  	default: post signalSuccess(); break;
--- 214,221 ----
  	    actualSignal(SUCCESS);
  	  else
! 	    {
! 	      maxAddr[client] = 0;
! 	      actualSignal(FAIL);
! 	    }
  	  break;
  	default: post signalSuccess(); break;
***************
*** 318,328 ****
      if (sig[6] == 0xb1 && sig[7] == 0x0c)
        {
! 	maxAddr[client] = sig[2] | (uint32_t)sig[3] << 8 |
  	  (uint32_t)sig[4] << 16 | (uint32_t)sig[5] << 24;
! 	setupRequest(S_VERIFY2, client, 0, NULL, maxAddr[client]);
! 	signal Resource.granted[client]();
        }
!     else
!       actualSignal(FAIL);
    }
  
--- 321,343 ----
      if (sig[6] == 0xb1 && sig[7] == 0x0c)
        {
! 	uint32_t max = sig[2] | (uint32_t)sig[3] << 8 |
  	  (uint32_t)sig[4] << 16 | (uint32_t)sig[5] << 24;
! 	storage_len_t vsize;
! 
! 	if (configClient(client))
! 	  vsize = call BConfig.npages[client]() << AT45_PAGE_SIZE_LOG2;
! 	else
! 	  vsize = call At45dbVolume.volumeSize[client]();
! 
! 	/* Ignore maxAddress values that are too large */
! 	if (max <= vsize)
! 	  {
! 	    maxAddr[client] = max;
! 	    setupRequest(S_VERIFY2, client, 0, NULL, max);
! 	    signal Resource.granted[client]();
! 	    return;
! 	  }
        }
!     actualSignal(FAIL);
    }
  

Index: ConfigStorageC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/ConfigStorageC.nc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** ConfigStorageC.nc	25 May 2006 18:23:46 -0000	1.1.2.1
--- ConfigStorageC.nc	25 May 2006 22:31:28 -0000	1.1.2.2
***************
*** 40,44 ****
    ConfigStorageP.BlockRead[CONFIG_ID] -> BlockStorageP.BlockRead[BLOCK_ID];
    ConfigStorageP.BlockWrite[CONFIG_ID] -> BlockStorageP.BlockWrite[BLOCK_ID];
!   ConfigStorageP.BLog[CONFIG_ID] -> BlockStorageP.BLog[BLOCK_ID];
  
    BlockStorageP.At45dbVolume[BLOCK_ID] -> StorageManagerP.At45dbVolume[volid];
--- 40,44 ----
    ConfigStorageP.BlockRead[CONFIG_ID] -> BlockStorageP.BlockRead[BLOCK_ID];
    ConfigStorageP.BlockWrite[CONFIG_ID] -> BlockStorageP.BlockWrite[BLOCK_ID];
!   ConfigStorageP.BConfig[CONFIG_ID] -> BlockStorageP.BConfig[BLOCK_ID];
  
    BlockStorageP.At45dbVolume[BLOCK_ID] -> StorageManagerP.At45dbVolume[volid];

Index: ConfigStorageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/ConfigStorageP.nc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** ConfigStorageP.nc	25 May 2006 18:23:46 -0000	1.1.2.1
--- ConfigStorageP.nc	25 May 2006 22:31:28 -0000	1.1.2.2
***************
*** 27,31 ****
    uses {
      interface At45db;
!     interface At45dbBlockLog as BLog[configstorage_t id];
      interface BlockRead[configstorage_t id];
      interface BlockWrite[configstorage_t id];
--- 27,31 ----
    uses {
      interface At45db;
!     interface At45dbBlockConfig as BConfig[configstorage_t id];
      interface BlockRead[configstorage_t id];
      interface BlockWrite[configstorage_t id];
***************
*** 59,63 ****
  
    enum {
!     N = uniqueCount(UQ_LOG_STORAGE),
      NO_CLIENT = 0xff,
    };
--- 59,63 ----
  
    enum {
!     N = uniqueCount(UQ_CONFIG_STORAGE),
      NO_CLIENT = 0xff,
    };
***************
*** 76,80 ****
  
      state[id] = S_MOUNT;
!     call BLog.setFlip(FALSE);
      call BlockRead.read[id](0, &lowVersion[id], sizeof lowVersion[id]);
  
--- 76,80 ----
  
      state[id] = S_MOUNT;
!     call BConfig.setFlip[id](FALSE);
      call BlockRead.read[id](0, &lowVersion[id], sizeof lowVersion[id]);
  
***************
*** 86,99 ****
        {
  	state[id] = S_STOPPED;
! 	signal SplitControl.startDone(FAIL);
        }
!     else if (!call BLog.flipped[id]())
        {
! 	call BLog.setFlip(TRUE);
  	call BlockRead.read[id](0, &highVersion[id], sizeof highVersion[id]);
        }
      else
        {
! 	call BLog.setFlip[id](highVersion[id] > lowVersion[id]);
  	call BlockRead.verify[id]();
        }
--- 86,99 ----
        {
  	state[id] = S_STOPPED;
! 	signal SplitControl.startDone[id](FAIL);
        }
!     else if (!call BConfig.flipped[id]())
        {
! 	call BConfig.setFlip[id](TRUE);
  	call BlockRead.read[id](0, &highVersion[id], sizeof highVersion[id]);
        }
      else
        {
! 	call BConfig.setFlip[id](highVersion[id] > lowVersion[id]);
  	call BlockRead.verify[id]();
        }
***************
*** 103,112 ****
      if (error != SUCCESS) // try the other half?
        {
! 	bool flipped = call BLog.flipped[id]();
  
  	if ((highVersion[id] > lowVersion[id]) == flipped)
  	  {
! 	    call BLog.setFlip[id](!flipped);
! 	    call BLog.verify[id]();
  	    return;
  	  }
--- 103,112 ----
      if (error != SUCCESS) // try the other half?
        {
! 	bool flipped = call BConfig.flipped[id]();
  
  	if ((highVersion[id] > lowVersion[id]) == flipped)
  	  {
! 	    call BConfig.setFlip[id](!flipped);
! 	    call BlockRead.verify[id]();
  	    return;
  	  }
***************
*** 115,119 ****
        }
      state[id] = S_CLEAN;
!     signal SplitControl.startDone(SUCCESS);
    }
  
--- 115,119 ----
        }
      state[id] = S_CLEAN;
!     signal SplitControl.startDone[id](SUCCESS);
    }
  
***************
*** 136,140 ****
      if (!(state[id] == S_CLEAN || state[id] == S_DIRTY))
        return FAIL;
!     return call BlockWrite.write(addr + sizeof(uint32_t), buf, len);
    }
  
--- 136,140 ----
      if (!(state[id] == S_CLEAN || state[id] == S_DIRTY))
        return FAIL;
!     return call BlockWrite.write[id](addr + sizeof(uint32_t), buf, len);
    }
  
***************
*** 142,146 ****
    void writeContinue(error_t error);
  
!   event bool BLog.writeHook[configstorage_t id]() {
      if (state[id] == S_DIRTY) // no work if already dirty
        return FALSE;
--- 142,146 ----
    void writeContinue(error_t error);
  
!   event bool BConfig.writeHook[configstorage_t id]() {
      if (state[id] == S_DIRTY) // no work if already dirty
        return FALSE;
***************
*** 148,153 ****
      /* Time to do the copy, version update dance */
      client = id;
!     nextPage = call BLog.npages[id]();
      copyCopyPageDone(SUCCESS);
    }
  
--- 148,155 ----
      /* Time to do the copy, version update dance */
      client = id;
!     nextPage = call BConfig.npages[id]();
      copyCopyPageDone(SUCCESS);
+ 
+     return TRUE;
    }
  
***************
*** 160,164 ****
  
  	// Set version number
! 	if (call BLog.flipped[client]())
  	  {
  	    lowVersion[client] = highVersion[client] + 1;
--- 162,166 ----
  
  	// Set version number
! 	if (call BConfig.flipped[client]())
  	  {
  	    lowVersion[client] = highVersion[client] + 1;
***************
*** 170,184 ****
  	    version = &highVersion[client];
  	  }
! 	call At45db.write(call BLog.remap[client](0), 0,
  			  version, sizeof *version);
        }
      else
        {
! 	at45page_t from = --nextPage, to = nextPage;
  
! 	if (call BLog.flipped[client]())
! 	  from += npages();
  	else
! 	  to += npages();
  	call At45db.copyPage(from, to);
        }
--- 172,188 ----
  	    version = &highVersion[client];
  	  }
! 	call At45db.write(call BConfig.remap[client](0), 0,
  			  version, sizeof *version);
        }
      else
        {
! 	at45page_t from, to, npages = call BConfig.npages[client]();
  
! 	to = from = call BConfig.remap[client](--nextPage);
! 	if (call BConfig.flipped[client]())
! 	  to -= npages;
  	else
! 	  to += npages;
! 
  	call At45db.copyPage(from, to);
        }
***************
*** 188,192 ****
      if (error == SUCCESS)
        {
! 	call BLog.setFlip[client](!call BLog.flipped[client]);
  	state[client] = S_DIRTY;
        }
--- 192,196 ----
      if (error == SUCCESS)
        {
! 	call BConfig.setFlip[client](!call BConfig.flipped[client]());
  	state[client] = S_DIRTY;
        }
***************
*** 198,208 ****
  
      client = NO_CLIENT;
!     signal BLog.writeContinue[id]();
    }
  
    command error_t ConfigStorage.commit[configstorage_t id]() {
      /* Call BlockWrite.commit */
!     /* Could special-case attempt to commit clean log */
!     return call BlockWrite[id].commit();
    }
  
--- 202,212 ----
  
      client = NO_CLIENT;
!     call BConfig.writeContinue[id](error);
    }
  
    command error_t ConfigStorage.commit[configstorage_t id]() {
      /* Call BlockWrite.commit */
!     /* Could special-case attempt to commit clean block */
!     return call BlockWrite.commit[id]();
    }
  
***************
*** 225,230 ****
  
    event void BlockWrite.writeDone[configstorage_t id]( storage_addr_t addr, void* buf, storage_len_t len, error_t error ) {
!     signal ConfigStorage.writeDone(addr - sizeof(uint32_t), buf, len, error);
!     }
    }
  
--- 229,233 ----
  
    event void BlockWrite.writeDone[configstorage_t id]( storage_addr_t addr, void* buf, storage_len_t len, error_t error ) {
!     signal ConfigStorage.writeDone[id](addr - sizeof(uint32_t), buf, len, error);
    }
  
***************
*** 250,252 ****
--- 253,284 ----
    event void At45db.readDone(error_t error) {}
    event void At45db.computeCrcDone(error_t error, uint16_t crc) {}
+ 
+   default event void SplitControl.startDone[configstorage_t id](error_t error) { }
+   default event void ConfigStorage.readDone[configstorage_t id](storage_addr_t addr, void* buf, storage_len_t len, error_t error) {}
+   default event void ConfigStorage.writeDone[configstorage_t id](storage_addr_t addr, void* buf, storage_len_t len, error_t error) {}
+   default event void ConfigStorage.commitDone[configstorage_t id](error_t error) {}
+ 
+   default command void BConfig.setFlip[configstorage_t id](bool flip) {}
+   default command bool BConfig.flipped[configstorage_t id]() {
+     return FALSE;
+   }
+   default command void BConfig.writeContinue[configstorage_t id](error_t error) {}
+   default command at45page_t BConfig.npages[configstorage_t id]() {
+     return 0;
+   }
+   default command at45page_t BConfig.remap[configstorage_t id](at45page_t page) {
+     return AT45_MAX_PAGES;
+   }
+   default command error_t BlockRead.read[configstorage_t id]( storage_addr_t addr, void* buf, storage_len_t len ) {
+     return SUCCESS;
+   }
+   default command error_t BlockRead.verify[configstorage_t id]() {
+     return SUCCESS;
+   }
+   default command error_t BlockWrite.write[configstorage_t id]( storage_addr_t addr, void* buf, storage_len_t len ) {
+     return SUCCESS;
+   }
+   default command error_t BlockWrite.commit[configstorage_t id]() {
+     return SUCCESS;
+   }
  }

Index: HplAt45dbByteC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/HplAt45dbByteC.nc,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** HplAt45dbByteC.nc	17 Feb 2006 22:05:06 -0000	1.1.2.6
--- HplAt45dbByteC.nc	25 May 2006 22:31:28 -0000	1.1.2.7
***************
*** 99,158 ****
      uint16_t crc = (uint16_t)data;
  
!     /* For a 3% speedup, we could use labels and goto *.
!        But: very gcc-specific. Also, need to do
!        asm ("ijmp" : : "z" (state))
!        instead of goto *state
!     */
  
!     ptr = flashCmd;
!     lphase = P_SEND_CMD;
!     count = 4 + dontCare;
  
!     call HplAt45dbByte.select();
!     for (;;)
!       {
! 	if (lphase == P_READ_CRC)
  	  {
! 	    crc = crcByte(crc, in);
  
! 	    --count;
! 	    if (!count)
! 	      break;
! 	  }
! 	else if (lphase == P_SEND_CMD)
! 	  {
! 	    // Note: the dontCare bytes are read after the end of cmd...
! 	    out = *ptr++;
! 	    count--;
! 	    if (!count)
  	      {
! 		lphase = status;
! 		ptr = data;
! 		count = dataCount;
  	      }
! 	  }
! 	else if (lphase == P_READ)
! 	  {
! 	    *ptr++ = in;
! 	    --count;
! 	    if (!count)
! 	      break;
! 	  }
! 	else if (lphase == P_WRITE)
! 	  {
! 	    if (!count)
! 	      break;
  
! 	    out = *ptr++;
! 	    --count;
! 	  }
! 	else /* P_COMMAND */
! 	  break;
  	
! 	call FlashSpi.write(out, &in);
        }
-     call HplAt45dbByte.deselect();
-     call Resource.release();
  
      complete(crc);
    }
--- 99,161 ----
      uint16_t crc = (uint16_t)data;
  
!     if (dataCount) // skip 0-byte ops
!       {
! 	/* For a 3% speedup, we could use labels and goto *.
! 	   But: very gcc-specific. Also, need to do
! 	   asm ("ijmp" : : "z" (state))
! 	   instead of goto *state
! 	*/
  
! 	ptr = flashCmd;
! 	lphase = P_SEND_CMD;
! 	count = 4 + dontCare;
  
! 	call HplAt45dbByte.select();
! 	for (;;)
  	  {
! 	    if (lphase == P_READ_CRC)
! 	      {
! 		crc = crcByte(crc, in);
  
! 		--count;
! 		if (!count)
! 		  break;
! 	      }
! 	    else if (lphase == P_SEND_CMD)
  	      {
! 		// Note: the dontCare bytes are read after the end of cmd...
! 		out = *ptr++;
! 		count--;
! 		if (!count)
! 		  {
! 		    lphase = status;
! 		    ptr = data;
! 		    count = dataCount;
! 		  }
  	      }
! 	    else if (lphase == P_READ)
! 	      {
! 		*ptr++ = in;
! 		--count;
! 		if (!count)
! 		  break;
! 	      }
! 	    else if (lphase == P_WRITE)
! 	      {
! 		if (!count)
! 		  break;
  
! 		out = *ptr++;
! 		--count;
! 	      }
! 	    else /* P_COMMAND */
! 	      break;
  	
! 	    call FlashSpi.write(out, &in);
! 	  }
! 	call HplAt45dbByte.deselect();
        }
  
+     call Resource.release();
      complete(crc);
    }
***************
*** 212,228 ****
  
    command void HplAt45db.fill(uint8_t cmd, at45page_t page) {
!     execCommand(P_FILL, cmd, 0, page, 0, NULL, 0);
    }
  
    command void HplAt45db.flush(uint8_t cmd, at45page_t page) {
!     execCommand(P_FLUSH, cmd, 0, page, 0, NULL, 0);
    }
  
    command void HplAt45db.compare(uint8_t cmd, at45page_t page) {
!     execCommand(P_COMPARE, cmd, 0, page, 0, NULL, 0);
    }
  
    command void HplAt45db.erase(uint8_t cmd, at45page_t page) {
!     execCommand(P_ERASE, cmd, 0, page, 0, NULL, 0);
    }
  
--- 215,231 ----
  
    command void HplAt45db.fill(uint8_t cmd, at45page_t page) {
!     execCommand(P_FILL, cmd, 0, page, 0, NULL, 1);
    }
  
    command void HplAt45db.flush(uint8_t cmd, at45page_t page) {
!     execCommand(P_FLUSH, cmd, 0, page, 0, NULL, 1);
    }
  
    command void HplAt45db.compare(uint8_t cmd, at45page_t page) {
!     execCommand(P_COMPARE, cmd, 0, page, 0, NULL, 1);
    }
  
    command void HplAt45db.erase(uint8_t cmd, at45page_t page) {
!     execCommand(P_ERASE, cmd, 0, page, 0, NULL, 1);
    }
  

--- At45dbBlockLog.nc DELETED ---



More information about the Tinyos-2-commits mailing list