[Tinyos-beta-commits] CVS: tinyos-1.x/beta/AT45DB Storage.h, NONE, 1.1 Storage_chip.h, NONE, 1.1 BlockStorage.h, 1.1, 1.2 BlockStorageC.nc, 1.2, 1.3 BlockStorageM.nc, 1.2, 1.3 HALAT45DB.h, 1.1, 1.2 HALAT45DBShare.nc, 1.1, 1.2 StorageManagerC.nc, 1.1, 1.2 StorageManagerM.nc, 1.1, 1.2 HALAT45DB.nc, 1.2, NONE HALAT45DBC.nc, 1.2, NONE HALAT45DBM.nc, 1.2, NONE HPLAT45DB.h, 1.1, NONE HPLAT45DB.nc, 1.2, NONE HPLAT45DBByte.nc, 1.2, NONE PageEEPROMC.nc, 1.1, NONE

David Gay idgay at users.sourceforge.net
Fri Jun 3 17:04:36 PDT 2005


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

Modified Files:
	BlockStorage.h BlockStorageC.nc BlockStorageM.nc HALAT45DB.h 
	HALAT45DBShare.nc StorageManagerC.nc StorageManagerM.nc 
Added Files:
	Storage.h Storage_chip.h 
Removed Files:
	HALAT45DB.nc HALAT45DBC.nc HALAT45DBM.nc HPLAT45DB.h 
	HPLAT45DB.nc HPLAT45DBByte.nc PageEEPROMC.nc 
Log Message:
BlockStorage for mica's for tinyos 1.x
uses a compatibility layer to keep code as close to 2.x as possible
untested (compiles).


--- NEW FILE: Storage.h ---
// $Id: Storage.h,v 1.1 2005/06/04 00:04:34 idgay Exp $

/*									tab:2
 * "Copyright (c) 2000-2005 The Regents of the University  of California.  
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 */

/*
 * @author: Jonathan Hui <jwhui at cs.berkeley.edu>
 */

#ifndef __STORAGE_H__
#define __STORAGE_H__

enum {
  STORAGE_OK,
  STORAGE_FAIL,
};

enum {
  STORAGE_INVALID_ADDR = (uint32_t)0xffff,
};

typedef uint8_t volume_t;
typedef uint8_t volume_id_t;
typedef uint8_t storage_result_t;

#include "Storage_chip.h"

#endif

--- NEW FILE: Storage_chip.h ---
#include "HALAT45DB.h"

Index: BlockStorage.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/AT45DB/BlockStorage.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** BlockStorage.h	22 Jan 2005 00:26:30 -0000	1.1
--- BlockStorage.h	4 Jun 2005 00:04:34 -0000	1.2
***************
*** 29,33 ****
  #define __BLOCK_STORAGE_H__
  
! typedef uint16_t block_addr_t;
  
  #endif
--- 29,34 ----
  #define __BLOCK_STORAGE_H__
  
! typedef uint32_t block_addr_t;
! typedef uint8_t blockstorage_t;
  
  #endif

Index: BlockStorageC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/AT45DB/BlockStorageC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BlockStorageC.nc	2 Feb 2005 22:56:39 -0000	1.2
--- BlockStorageC.nc	4 Jun 2005 00:04:34 -0000	1.3
***************
*** 1,23 ****
  // $Id$
! generic configuration BlockStorageC() {
    provides {
!     interface Mount;
!     interface BlockWrite;
!     interface BlockRead;
    }
  }
  implementation {
!   enum {
!     BLOCK_ID = unique(UQ_BLOCK_STORAGE),
!     VOLUME_ID = unique(UQ_STORAGE_VOLUME)
!   };
!     
!   components BlockStorageM, StorageManagerC;
  
!   Mount = BlockStorageM.Mount[BLOCK_ID];
!   BlockWrite = BlockStorageM.BlockWrite[BLOCK_ID];
!   BlockRead = BlockStorageM.BlockRead[BLOCK_ID];
  
!   BlockStorageM.HALAT45DB[BLOCK_ID] -> StorageManagerC.HALAT45DB[VOLUME_ID];
!   BlockStorageM.ActualMount[BLOCK_ID] -> StorageManagerC.Mount[VOLUME_ID];
  }
--- 1,23 ----
  // $Id$
! includes Storage;
! #define HALAT45DB PageEEPROM
! includes BlockStorage;
! 
! configuration BlockStorageC {
    provides {
!     interface Mount[blockstorage_t blockId];
!     interface BlockRead[blockstorage_t blockId];
!     interface BlockWrite[blockstorage_t blockId];
    }
  }
  implementation {
!   components BlockStorageM, StorageManagerC, Main;
  
!   Mount = BlockStorageM.Mount;
!   BlockWrite = BlockStorageM.BlockWrite;
!   BlockRead = BlockStorageM.BlockRead;
  
!   Main.StdControl -> StorageManagerC;
!   BlockStorageM.HALAT45DB -> StorageManagerC.HALAT45DB;
!   BlockStorageM.ActualMount -> StorageManagerC.Mount;
  }

Index: BlockStorageM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/AT45DB/BlockStorageM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BlockStorageM.nc	2 Feb 2005 22:56:39 -0000	1.2
--- BlockStorageM.nc	4 Jun 2005 00:04:34 -0000	1.3
***************
*** 27,30 ****
--- 27,34 ----
   */
  
+ includes Storage;
+ #define HALAT45DB PageEEPROM
+ includes BlockStorage;
+ 
  module BlockStorageM {
    provides {
***************
*** 57,61 ****
    block_addr_t bytesRemaining;
    uint16_t crc;
!   block_addr_t maxAddr[uniqueCount(UQ_BLOCK_STORAGE)];
  
    void commitSignature();
--- 61,65 ----
    block_addr_t bytesRemaining;
    uint16_t crc;
!   block_addr_t maxAddr[uniqueCount("StorageManager")];
  
    void commitSignature();
***************
*** 131,147 ****
        {
        case S_WRITE:
! 	check(call HALAT45DB.write(page, offset, buf, count));
  	break;
        case S_READ:
! 	check(call HALAT45DB.read(page, offset, buf, count));
  	break;
        case S_CRC: case S_COMMIT:
! 	check(call HALAT45DB.computeCrc(page, offset, count, crc));
  	break;
        }
    }
  
!   void newRequest(uint8_t newState, uint8_t id,
! 		  block_addr_t addr, uint8_t* buf, block_addr_t len) {
      if (admitRequest(newState, id) == FAIL)
        return FAIL;
--- 135,151 ----
        {
        case S_WRITE:
! 	check(call HALAT45DB.write[client](page, offset, buf, count));
  	break;
        case S_READ:
! 	check(call HALAT45DB.read[client](page, offset, buf, count));
  	break;
        case S_CRC: case S_COMMIT:
! 	check(call HALAT45DB.computeCrc[client](page, offset, count));
  	break;
        }
    }
  
!   result_t newRequest(uint8_t newState, uint8_t id,
! 		       block_addr_t addr, uint8_t* buf, block_addr_t len) {
      if (admitRequest(newState, id) == FAIL)
        return FAIL;
***************
*** 158,162 ****
  
    command result_t BlockWrite.write[uint8_t id](block_addr_t addr, uint8_t* buf, block_addr_t len) {
!     result_t ok = newRequest(S_WRITE, addr, buf, len);
  
      if (ok && addr + len > maxAddr[id])
--- 162,166 ----
  
    command result_t BlockWrite.write[uint8_t id](block_addr_t addr, uint8_t* buf, block_addr_t len) {
!     result_t ok = newRequest(S_WRITE, id, addr, buf, len);
  
      if (ok && addr + len > maxAddr[id])
***************
*** 170,174 ****
        return FAIL;
  
!     check(call HALAT45DB.erase(0, AT45_ERASE));
  
      return SUCCESS;
--- 174,178 ----
        return FAIL;
  
!     check(call HALAT45DB.erase[client](0, AT45_ERASE));
  
      return SUCCESS;
***************
*** 176,180 ****
  
    command result_t BlockWrite.commit[uint8_t id]() {
!     return newRequest(S_COMMIT, 0, NULL, maxAddr[id]);
    }
  
--- 180,184 ----
  
    command result_t BlockWrite.commit[uint8_t id]() {
!     return newRequest(S_COMMIT, id, 0, NULL, maxAddr[id]);
    }
  
***************
*** 190,194 ****
      /* Note: bytesRemaining is 0, so multipageDone will got straight to
         signalDone */
!     check(call HALAT45DB.write(0, 1 << AT45_PAGE_SIZE_LOG2, sig, 4));
    }
  
--- 194,198 ----
      /* Note: bytesRemaining is 0, so multipageDone will got straight to
         signalDone */
!     check(call HALAT45DB.write[client](0, 1 << AT45_PAGE_SIZE_LOG2, sig, 4));
    }
  
***************
*** 196,204 ****
    void commitSunc() {
      state = S_COMMIT3;
!     check(call HALAT45DB.syncAll());
    }
  
    command result_t BlockRead.read[uint8_t id](block_addr_t addr, uint8_t* buf, block_addr_t len) {
!     return newRequest(S_READ, addr, buf, len);
    }
  
--- 200,208 ----
    void commitSunc() {
      state = S_COMMIT3;
!     check(call HALAT45DB.syncAll[client]());
    }
  
    command result_t BlockRead.read[uint8_t id](block_addr_t addr, uint8_t* buf, block_addr_t len) {
!     return newRequest(S_READ, id, addr, buf, len);
    }
  
***************
*** 208,212 ****
  
    command result_t BlockRead.computeCrc[uint8_t id](block_addr_t addr, block_addr_t len) {
!     return newRequest(S_CRC, addr, NULL, len);
    }
  
--- 212,216 ----
  
    command result_t BlockRead.computeCrc[uint8_t id](block_addr_t addr, block_addr_t len) {
!     return newRequest(S_CRC, id, addr, NULL, len);
    }
  
***************
*** 218,245 ****
    }
  
!   event result_t HALAT45DB.writeDone(result_t result) {
      return multipageDone(result);
    }
  
!   event result_t HALAT45DB.readDone(result_t result) {
      return multipageDone(result);
    }
  
!   event result_t HALAT45DB.computeCrcDone(result_t result, uint16_t newCrc) {
!     crc = newCrc;
      return multipageDone(result);
    }
  
!   event result_t HALAT45DB.eraseDone(result_t result) {
      signalDone(result);
      return SUCCESS;
    }
  
!   event result_t HALAT45DB.syncDone(result_t result) {
      signalDone(result);
      return SUCCESS;
    }
  
!   event result_t HALAT45DB.flushDone(result_t result) {
      return SUCCESS;
    }
--- 222,249 ----
    }
  
!   event result_t HALAT45DB.writeDone[uint8_t id](result_t result) {
      return multipageDone(result);
    }
  
!   event result_t HALAT45DB.readDone[uint8_t id](result_t result) {
      return multipageDone(result);
    }
  
!   event result_t HALAT45DB.computeCrcDone[uint8_t id](result_t result, uint16_t newCrc) {
!     crc = crc + newCrc; // this is undoubtably horrible and wrong.
      return multipageDone(result);
    }
  
!   event result_t HALAT45DB.eraseDone[uint8_t id](result_t result) {
      signalDone(result);
      return SUCCESS;
    }
  
!   event result_t HALAT45DB.syncDone[uint8_t id](result_t result) {
      signalDone(result);
      return SUCCESS;
    }
  
!   event result_t HALAT45DB.flushDone[uint8_t id](result_t result) {
      return SUCCESS;
    }

Index: HALAT45DB.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/AT45DB/HALAT45DB.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** HALAT45DB.h	22 Jan 2005 00:26:31 -0000	1.1
--- HALAT45DB.h	4 Jun 2005 00:04:34 -0000	1.2
***************
*** 1,50 ****
! // $Id$
  
! /*									tab:4
!  * "Copyright (c) 2000-2003 The Regents of the University  of California.  
!  * All rights reserved.
!  *
!  * Permission to use, copy, modify, and distribute this software and its
!  * documentation for any purpose, without fee, and without written agreement is
!  * hereby granted, provided that the above copyright notice, the following
!  * two paragraphs and the author appear in all copies of this software.
!  * 
!  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
!  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
!  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
!  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  * 
!  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
!  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
!  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
!  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
!  *
!  * Copyright (c) 2002-2003 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.
!  */
! #ifndef HALAT45DB_H
! #define HALAT45DB_H
  
! // flash characteristics
! enum {
!   AT45_MAX_PAGES = 2048,
!   AT45_PAGE_SIZE = 264,
!   AT45_PAGE_SIZE_LOG2 = 8 // For those who want to ignore the last 8 bytes
! };
  
  enum {
!   AT45_ERASE,
!   AT45_DONT_ERASE,
!   AT45_PREVIOUSLY_ERASED
  };
  
- typedef uint16_t at45page_t;
- typedef uint16_t at45pageoffset_t; /* 0 to AT45_PAGE_SIZE - 1 */
- 
  #endif
--- 1,20 ----
! #ifndef AT45COMPAT_H
! #define AT45COMPAT_H
  
! /* Make the 1.x interfaces appear like the 2.x AT45DB HAL */
  
! #include "PageEEPROM.h"
! 
! typedef eeprompage_t at45page_t;
! typedef eeprompageoffset_t at45pageoffset_t;
  
  enum {
!   AT45_MAX_PAGES = TOS_EEPROM_MAX_PAGES,
!   AT45_PAGE_SIZE = TOS_EEPROM_PAGE_SIZE,
!   AT45_PAGE_SIZE_LOG2 = TOS_EEPROM_PAGE_SIZE_LOG2,
!   AT45_ERASE = TOS_EEPROM_ERASE,
!   AT45_DONT_ERASE = TOS_EEPROM_DONT_ERASE,
!   AT45_PREVIOUSLY_ERASED = TOS_EEPROM_PREVIOUSLY_ERASED
  };
  
  #endif

Index: HALAT45DBShare.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/AT45DB/HALAT45DBShare.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** HALAT45DBShare.nc	2 Feb 2005 22:56:40 -0000	1.1
--- HALAT45DBShare.nc	4 Jun 2005 00:04:34 -0000	1.2
***************
*** 36,39 ****
--- 36,43 ----
   * - does page remapping so you can use volume-relative page numbers
   */
+ 
+ includes Storage;
+ #define HALAT45DB PageEEPROM
+ 
  module HALAT45DBShare {
    provides interface HALAT45DB[volume_t volume];
***************
*** 43,47 ****
  implementation {
    enum {
!     NCLIENTS = uniqueCount(UQ_STORAGE_VOLUME)
    };
    volume_t lastClient;
--- 47,51 ----
  implementation {
    enum {
!     NCLIENTS = uniqueCount("StorageManager")
    };
    volume_t lastClient;
***************
*** 73,79 ****
    inline at45page_t remap(at45page_t page) {
      if (NCLIENTS != 1)
!       return call AT45Remap(lastClient, page);
      else
!       return call AT45Remap(0, page);
    }
  
--- 77,83 ----
    inline at45page_t remap(at45page_t page) {
      if (NCLIENTS != 1)
!       return call AT45Remap.remap(lastClient, page);
      else
!       return call AT45Remap.remap(0, page);
    }
  

Index: StorageManagerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/AT45DB/StorageManagerC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** StorageManagerC.nc	2 Feb 2005 22:56:40 -0000	1.1
--- StorageManagerC.nc	4 Jun 2005 00:04:34 -0000	1.2
***************
*** 1,2 ****
--- 1,6 ----
+ includes Storage;
+ #define HALAT45DB PageEEPROM
+ includes BlockStorage;
+ 
  configuration StorageManagerC {
    provides {
***************
*** 7,18 ****
  }
  implementation {
!   components StorageManagerM, HALAT45DBC, HALAT45DBShare;
  
    StdControl = StorageManagerM;
    StdControl = HALAT45DBC;
    Mount = StorageManagerM;
!   HALAT45DBC = HALAT45DBShare;
  
!   HALAT45DBShare.ActualAT45 -> HALAT45DBC;
    HALAT45DBShare.AT45Remap -> StorageManagerM;
  }
--- 11,22 ----
  }
  implementation {
!   components StorageManagerM, PageEEPROMC as HALAT45DBC, HALAT45DBShare;
  
    StdControl = StorageManagerM;
    StdControl = HALAT45DBC;
    Mount = StorageManagerM;
!   HALAT45DB = HALAT45DBShare;
  
!   HALAT45DBShare.ActualAT45 -> HALAT45DBC.PageEEPROM[unique("PageEEPROM")];
    HALAT45DBShare.AT45Remap -> StorageManagerM;
  }

Index: StorageManagerM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/AT45DB/StorageManagerM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** StorageManagerM.nc	2 Feb 2005 22:56:40 -0000	1.1
--- StorageManagerM.nc	4 Jun 2005 00:04:34 -0000	1.2
***************
*** 3,7 ****
      interface StdControl;
      interface Mount[volume_t volume];
!     interface AT45Remap[volume_t volume];
    }
  }
--- 3,7 ----
      interface StdControl;
      interface Mount[volume_t volume];
!     interface AT45Remap;
    }
  }
***************
*** 33,37 ****
    }
  
!   command at45page_t AT45Remap.remap[volume_t volume](volume_t volume, at45page_t volumePage) {
      if (volume == 0)
        return volumePage;
--- 33,37 ----
    }
  
!   command at45page_t AT45Remap.remap(volume_t volume, at45page_t volumePage) {
      if (volume == 0)
        return volumePage;

--- HALAT45DB.nc DELETED ---

--- HALAT45DBC.nc DELETED ---

--- HALAT45DBM.nc DELETED ---

--- HPLAT45DB.h DELETED ---

--- HPLAT45DB.nc DELETED ---

--- HPLAT45DBByte.nc DELETED ---

--- PageEEPROMC.nc DELETED ---



More information about the Tinyos-beta-commits mailing list