[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/at45db
At45dbBlockConfig.nc, 1.1.2.1, 1.1.2.2 BlockStorageC.nc,
1.1.2.5, 1.1.2.6 BlockStorageP.nc, 1.1.2.9,
1.1.2.10 ConfigStorageC.nc, 1.1.2.2, 1.1.2.3 ConfigStorageP.nc,
1.1.2.2, 1.1.2.3 WireConfigStorageP.nc, 1.1.2.1, 1.1.2.2
David Gay
idgay at users.sourceforge.net
Thu May 25 15:57:21 PDT 2006
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/lis3l02dq
HplLIS3L02DQ.nc, NONE, 1.1.2.1 HplLIS3L02DQLogicSPIP.nc, NONE,
1.1.2.1 LIS3L02DQ.h, NONE, 1.1.2.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestNetwork test.py,
NONE, 1.1.2.1 topo.txt, NONE, 1.1.2.1 TestNetworkAppC.nc,
1.1.2.2, 1.1.2.3 TestNetworkC.nc, 1.1.2.2, 1.1.2.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv6979
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
At45dbBlockConfig.nc BlockStorageC.nc BlockStorageP.nc
ConfigStorageC.nc ConfigStorageP.nc WireConfigStorageP.nc
Log Message:
cleanup block - config connection
config volumes are now low numbered blocks, so can use pass through
between ConfigStorageP and BlockStorageP
Index: At45dbBlockConfig.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/At45dbBlockConfig.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
*** At45dbBlockConfig.nc 25 May 2006 22:31:28 -0000 1.1.2.1
--- At45dbBlockConfig.nc 25 May 2006 22:57:19 -0000 1.1.2.2
***************
*** 19,22 ****
--- 19,28 ----
interface At45dbBlockConfig {
/**
+ * Check if this block is a config volumes
+ * @return TRUE for config volumes, FALSE for block volumes
+ */
+ command int isConfig();
+
+ /**
* Set which half of the block is used by the current config state
* @param flip TRUE for 2nd half, FALSE for 1st half
***************
*** 27,31 ****
* @return TRUE for 2nd half, FALSE for 1st half
*/
! command bool flipped();
/**
--- 33,37 ----
* @return TRUE for 2nd half, FALSE for 1st half
*/
! command int flipped();
/**
***************
*** 34,38 ****
* is called, FALSE to proceed immediately.
*/
! event bool writeHook();
/**
* Continue or abort write suspended as a result of a <code>writeHook</code>
--- 40,44 ----
* is called, FALSE to proceed immediately.
*/
! command int writeHook();
/**
* Continue or abort write suspended as a result of a <code>writeHook</code>
***************
*** 41,45 ****
* returning that error code
*/
! command void writeContinue(error_t error);
/**
--- 47,51 ----
* returning that error code
*/
! event void writeContinue(error_t error);
/**
***************
*** 47,51 ****
* @return Config volume size
*/
! command at45page_t npages();
/**
--- 53,57 ----
* @return Config volume size
*/
! event at45page_t npages();
/**
***************
*** 55,58 ****
* @return Actual flash page for <code>page</code>
*/
! command at45page_t remap(at45page_t page);
}
--- 61,64 ----
* @return Actual flash page for <code>page</code>
*/
! event at45page_t remap(at45page_t page);
}
Index: BlockStorageC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/BlockStorageC.nc,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** BlockStorageC.nc 27 Jan 2006 00:57:20 -0000 1.1.2.5
--- BlockStorageC.nc 25 May 2006 22:57:19 -0000 1.1.2.6
***************
*** 27,31 ****
implementation {
enum {
! BLOCK_ID = unique(UQ_BLOCK_STORAGE),
RESOURCE_ID = unique(UQ_AT45DB)
};
--- 27,31 ----
implementation {
enum {
! BLOCK_ID = unique(UQ_BLOCK_STORAGE) + uniqueCount(UQ_CONFIG_STORAGE),
RESOURCE_ID = unique(UQ_AT45DB)
};
Index: BlockStorageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/BlockStorageP.nc,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -C2 -d -r1.1.2.9 -r1.1.2.10
*** BlockStorageP.nc 25 May 2006 22:31:28 -0000 1.1.2.9
--- BlockStorageP.nc 25 May 2006 22:57:19 -0000 1.1.2.10
***************
*** 44,48 ****
interface BlockWrite[blockstorage_t blockId];
interface BlockRead[blockstorage_t blockId];
- interface At45dbBlockConfig as BConfig[blockstorage_t blockId];
}
uses {
--- 44,47 ----
***************
*** 50,53 ****
--- 49,53 ----
interface At45dbVolume[blockstorage_t blockId];
interface Resource[blockstorage_t blockId];
+ interface At45dbBlockConfig as BConfig[blockstorage_t blockId];
}
}
***************
*** 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];
--- 75,78 ----
***************
*** 84,113 ****
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);
! else
! flipped[blockId >> 3] &= ~(1 << (blockId & 7));
}
! inline command bool BConfig.flipped[blockstorage_t blockId]() {
! return (flipped[blockId >> 3] & (1 << (blockId & 7))) != 0;
}
--- 83,109 ----
inline int configClient(blockstorage_t id) {
! return id < uniqueCount(UQ_CONFIG_STORAGE);
}
at45page_t pageRemap(at45page_t p) {
! return signal BConfig.remap[client](p);
}
! event at45page_t BConfig.npages[blockstorage_t id]() {
return call At45dbVolume.volumeSize[id]() >> (AT45_PAGE_SIZE_LOG2 + 1);
}
! event at45page_t BConfig.remap[blockstorage_t id](at45page_t page) {
! if (call BConfig.isConfig[id]() && call BConfig.flipped[id]())
! page += signal BConfig.npages[id]();
return call At45dbVolume.remap[id](page);
}
! default command int BConfig.isConfig[blockstorage_t blockId]() {
! return FALSE;
}
! default command int BConfig.flipped[blockstorage_t blockId]() {
! return FALSE;
}
***************
*** 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. */
--- 138,142 ----
crc = 0;
! if (state[blockId] == S_WRITE && call BConfig.writeHook[blockId]())
/* Log write intercept. We'll get a writeContinue when it's
time to resume. */
***************
*** 151,155 ****
}
! default event bool BConfig.writeHook[blockstorage_t blockId]() {
return FALSE;
}
--- 146,150 ----
}
! default command int BConfig.writeHook[blockstorage_t blockId]() {
return FALSE;
}
***************
*** 157,161 ****
void signalDone(error_t result);
! command void BConfig.writeContinue[blockstorage_t blockId](error_t error) {
client = blockId;
if (error == SUCCESS)
--- 152,156 ----
void signalDone(error_t result);
! event void BConfig.writeContinue[blockstorage_t blockId](error_t error) {
client = blockId;
if (error == SUCCESS)
***************
*** 325,330 ****
storage_len_t vsize;
! if (configClient(client))
! vsize = call BConfig.npages[client]() << AT45_PAGE_SIZE_LOG2;
else
vsize = call At45dbVolume.volumeSize[client]();
--- 320,325 ----
storage_len_t vsize;
! if (call BConfig.isConfig[client]())
! vsize = signal BConfig.npages[client]() << AT45_PAGE_SIZE_LOG2;
else
vsize = call At45dbVolume.volumeSize[client]();
Index: ConfigStorageC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/ConfigStorageC.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** ConfigStorageC.nc 25 May 2006 22:31:28 -0000 1.1.2.2
--- ConfigStorageC.nc 25 May 2006 22:57:19 -0000 1.1.2.3
***************
*** 28,32 ****
enum {
CONFIG_ID = unique(UQ_CONFIG_STORAGE),
- BLOCK_ID = uniqueCount(UQ_BLOCK_STORAGE) + CONFIG_ID,
RESOURCE_ID = unique(UQ_AT45DB)
};
--- 28,31 ----
***************
*** 38,46 ****
ConfigStorage = ConfigStorageP.ConfigStorage[CONFIG_ID];
! 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];
! BlockStorageP.Resource[BLOCK_ID] -> At45dbC.Resource[RESOURCE_ID];
}
--- 37,41 ----
ConfigStorage = ConfigStorageP.ConfigStorage[CONFIG_ID];
! BlockStorageP.At45dbVolume[CONFIG_ID] -> StorageManagerP.At45dbVolume[volid];
! BlockStorageP.Resource[CONFIG_ID] -> At45dbC.Resource[RESOURCE_ID];
}
Index: ConfigStorageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/ConfigStorageP.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** ConfigStorageP.nc 25 May 2006 22:31:28 -0000 1.1.2.2
--- ConfigStorageP.nc 25 May 2006 22:57:19 -0000 1.1.2.3
***************
*** 24,31 ****
interface SplitControl[configstorage_t id];
interface ConfigStorage[configstorage_t id];
}
uses {
interface At45db;
- interface At45dbBlockConfig as BConfig[configstorage_t id];
interface BlockRead[configstorage_t id];
interface BlockWrite[configstorage_t id];
--- 24,31 ----
interface SplitControl[configstorage_t id];
interface ConfigStorage[configstorage_t id];
+ interface At45dbBlockConfig as BConfig[blockstorage_t id];
}
uses {
interface At45db;
interface BlockRead[configstorage_t id];
interface BlockWrite[configstorage_t id];
***************
*** 44,51 ****
underlying BlockStorage commit's operation.
! Note: all of this depends on the ay45db's implementation of
BlockStorageP. It will not work over an arbitrary BlockStorageP
implementation (additionally, it uses hooks in BlockStorageP to
! support the half-volume operation).
*/
--- 44,52 ----
underlying BlockStorage commit's operation.
! Note: all of this depends on the at45db's implementation of
BlockStorageP. It will not work over an arbitrary BlockStorageP
implementation (additionally, it uses hooks in BlockStorageP to
! support the half-volume operation). Additionally, the code assumes
! that the config volumes all have lower ids than the block volumes.
*/
***************
*** 65,72 ****
--- 66,88 ----
uint8_t state[N];
uint32_t lowVersion[N], highVersion[N];
+ uint8_t flipped[(N + 7) / 8];
uint8_t client = NO_CLIENT;
at45page_t nextPage;
+ command int BConfig.isConfig[blockstorage_t id]() {
+ return id < N;
+ }
+
+ command void BConfig.setFlip[blockstorage_t id](bool flip) {if (flip)
+ flipped[id >> 3] |= 1 << (id & 7);
+ else
+ flipped[id >> 3] &= ~(1 << (id & 7));
+ }
+
+ inline command int BConfig.flipped[blockstorage_t id]() {
+ return (flipped[id >> 3] & (1 << (id & 7))) != 0;
+ }
+
command error_t SplitControl.start[uint8_t id]() {
/* Read version on both halves. Validate higher. Validate lower if
***************
*** 103,111 ****
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;
--- 119,127 ----
if (error != SUCCESS) // try the other half?
{
! bool isflipped = call BConfig.flipped[id]();
! if ((highVersion[id] > lowVersion[id]) == isflipped)
{
! call BConfig.setFlip[id](!isflipped);
call BlockRead.verify[id]();
return;
***************
*** 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;
--- 158,162 ----
void writeContinue(error_t error);
! command int BConfig.writeHook[configstorage_t id]() {
if (state[id] == S_DIRTY) // no work if already dirty
return FALSE;
***************
*** 148,152 ****
/* Time to do the copy, version update dance */
client = id;
! nextPage = call BConfig.npages[id]();
copyCopyPageDone(SUCCESS);
--- 164,168 ----
/* Time to do the copy, version update dance */
client = id;
! nextPage = signal BConfig.npages[id]();
copyCopyPageDone(SUCCESS);
***************
*** 172,183 ****
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;
--- 188,199 ----
version = &highVersion[client];
}
! call At45db.write(signal BConfig.remap[client](0), 0,
version, sizeof *version);
}
else
{
! at45page_t from, to, npages = signal BConfig.npages[client]();
! to = from = signal BConfig.remap[client](--nextPage);
if (call BConfig.flipped[client]())
to -= npages;
***************
*** 202,206 ****
client = NO_CLIENT;
! call BConfig.writeContinue[id](error);
}
--- 218,222 ----
client = NO_CLIENT;
! signal BConfig.writeContinue[id](error);
}
***************
*** 218,237 ****
event void BlockRead.readDone[configstorage_t id](storage_addr_t addr, void* buf, storage_len_t len, error_t error) {
! if (state[id] == S_MOUNT)
! mountReadDone(id, error);
! else
! signal ConfigStorage.readDone[id](addr - sizeof(uint32_t), buf, len, error);
}
event void BlockRead.verifyDone[configstorage_t id]( error_t error ) {
! mountVerifyDone(id, error);
}
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);
}
event void BlockWrite.commitDone[configstorage_t id]( error_t error ) {
! commitDone(id, error);
}
--- 234,257 ----
event void BlockRead.readDone[configstorage_t id](storage_addr_t addr, void* buf, storage_len_t len, error_t error) {
! if (id < N)
! if (state[id] == S_MOUNT)
! mountReadDone(id, error);
! else
! signal ConfigStorage.readDone[id](addr - sizeof(uint32_t), buf, len, error);
}
event void BlockRead.verifyDone[configstorage_t id]( error_t error ) {
! if (id < N)
! mountVerifyDone(id, error);
}
event void BlockWrite.writeDone[configstorage_t id]( storage_addr_t addr, void* buf, storage_len_t len, error_t error ) {
! if (id < N)
! signal ConfigStorage.writeDone[id](addr - sizeof(uint32_t), buf, len, error);
}
event void BlockWrite.commitDone[configstorage_t id]( error_t error ) {
! if (id < N)
! commitDone(id, error);
}
***************
*** 258,284 ****
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;
- }
}
--- 278,280 ----
Index: WireConfigStorageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/WireConfigStorageP.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
*** WireConfigStorageP.nc 25 May 2006 18:23:46 -0000 1.1.2.1
--- WireConfigStorageP.nc 25 May 2006 22:57:19 -0000 1.1.2.2
***************
*** 18,23 ****
configuration WireConfigStorageP { }
implementation {
! components ConfigStorageP, At45dbC;
ConfigStorageP.At45db -> At45dbC;
}
--- 18,26 ----
configuration WireConfigStorageP { }
implementation {
! components ConfigStorageP, BlockStorageP, At45dbC;
ConfigStorageP.At45db -> At45dbC;
+ ConfigStorageP.BlockRead -> BlockStorageP;
+ ConfigStorageP.BlockWrite -> BlockStorageP;
+ ConfigStorageP.BConfig <- BlockStorageP;
}
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/lis3l02dq
HplLIS3L02DQ.nc, NONE, 1.1.2.1 HplLIS3L02DQLogicSPIP.nc, NONE,
1.1.2.1 LIS3L02DQ.h, NONE, 1.1.2.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestNetwork test.py,
NONE, 1.1.2.1 topo.txt, NONE, 1.1.2.1 TestNetworkAppC.nc,
1.1.2.2, 1.1.2.3 TestNetworkC.nc, 1.1.2.2, 1.1.2.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list