[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/at45db LogStorageC.nc,
1.1.2.2, 1.1.2.3 LogStorageP.nc, 1.1.2.10, 1.1.2.11
David Gay
idgay at users.sourceforge.net
Thu Jun 1 09:53:15 PDT 2006
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/storage/Log
RandRWAppC.nc, 1.1.2.2, 1.1.2.3
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x/tos/platforms/intelmote2/chips/pxa271
BlockStorageC.nc, NONE, 1.1.2.1 Flash.nc, NONE,
1.1.2.1 FlashC.nc, NONE, 1.1.2.1 HalP30P.nc, NONE,
1.1.2.1 Storage_chip.h, NONE, 1.1.2.1
- 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-serv15388
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
LogStorageC.nc LogStorageP.nc
Log Message:
use generic component arg rather than multiple interafces to distinguish
linear vs circular logs
Index: LogStorageC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/LogStorageC.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
*** LogStorageC.nc 24 May 2006 17:40:50 -0000 1.1.2.2
--- LogStorageC.nc 1 Jun 2006 16:53:13 -0000 1.1.2.3
***************
*** 19,28 ****
#include "Storage.h"
! generic configuration LogStorageC(volume_id_t volid) {
provides {
! interface LogWrite as LinearWrite;
! interface LogRead as LinearRead;
! interface LogWrite as CircularWrite;
! interface LogRead as CircularRead;
}
}
--- 19,26 ----
#include "Storage.h"
! generic configuration LogStorageC(volume_id_t volid, bool circular) {
provides {
! interface LogWrite;
! interface LogRead;
}
}
***************
*** 30,33 ****
--- 28,32 ----
enum {
LOG_ID = unique(UQ_LOG_STORAGE),
+ INTF_ID = LOG_ID << 1 | circular,
RESOURCE_ID = unique(UQ_AT45DB)
};
***************
*** 35,42 ****
components LogStorageP, WireLogStorageP, StorageManagerP, At45dbC;
! LinearWrite = LogStorageP.LinearWrite[LOG_ID];
! LinearRead = LogStorageP.LinearRead[LOG_ID];
! CircularWrite = LogStorageP.CircularWrite[LOG_ID];
! CircularRead = LogStorageP.CircularRead[LOG_ID];
LogStorageP.At45dbVolume[LOG_ID] -> StorageManagerP.At45dbVolume[volid];
--- 34,39 ----
components LogStorageP, WireLogStorageP, StorageManagerP, At45dbC;
! LogWrite = LogStorageP.LogWrite[INTF_ID];
! LogRead = LogStorageP.LogRead[INTF_ID];
LogStorageP.At45dbVolume[LOG_ID] -> StorageManagerP.At45dbVolume[volid];
Index: LogStorageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/Attic/LogStorageP.nc,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -C2 -d -r1.1.2.10 -r1.1.2.11
*** LogStorageP.nc 1 Jun 2006 16:35:53 -0000 1.1.2.10
--- LogStorageP.nc 1 Jun 2006 16:53:13 -0000 1.1.2.11
***************
*** 41,48 ****
module LogStorageP {
provides {
! interface LogWrite as LinearWrite[logstorage_t logId];
! interface LogRead as LinearRead[logstorage_t logId];
! interface LogWrite as CircularWrite[logstorage_t logId];
! interface LogRead as CircularRead[logstorage_t logId];
}
uses {
--- 41,46 ----
module LogStorageP {
provides {
! interface LogRead[logstorage_t logId];
! interface LogWrite[logstorage_t logId];
}
uses {
***************
*** 216,247 ****
call Resource.release[c]();
! if (s[c].circular)
! switch (request)
! {
! case R_ERASE: signal CircularWrite.eraseDone[c](ok); break;
! case R_APPEND: signal CircularWrite.appendDone[c](ptr, actualLen, ok); break;
! case R_SYNC: signal CircularWrite.syncDone[c](ok); break;
! case R_READ: signal CircularRead.readDone[c](ptr, actualLen, ok); break;
! }
! else
! switch (request)
! {
! case R_ERASE: signal LinearWrite.eraseDone[c](ok); break;
! case R_APPEND: signal LinearWrite.appendDone[c](ptr, actualLen, ok); break;
! case R_SYNC: signal LinearWrite.syncDone[c](ok); break;
! case R_READ: signal LinearRead.readDone[c](ptr, actualLen, ok); break;
! }
}
! error_t newRequest(uint8_t newRequest, logstorage_t id, bool circular,
uint8_t *buf, storage_len_t length) {
if (s[id].request != R_IDLE)
return EBUSY;
- /* You can make the transition from linear->circular once. */
- if (s[id].circular && !circular)
- return FAIL;
- s[id].circular = circular;
-
s[id].request = newRequest;
s[id].buf = buf;
--- 214,236 ----
call Resource.release[c]();
! c = c << 1 | s[c].circular;
! switch (request)
! {
! case R_ERASE: signal LogWrite.eraseDone[c](ok); break;
! case R_APPEND: signal LogWrite.appendDone[c](ptr, actualLen, ok); break;
! case R_SYNC: signal LogWrite.syncDone[c](ok); break;
! case R_READ: signal LogRead.readDone[c](ptr, actualLen, ok); break;
! case R_SEEK: signal LogRead.seekDone[c](ok); break;
! }
}
! error_t newRequest(uint8_t newRequest, logstorage_t id,
uint8_t *buf, storage_len_t length) {
+ s[id >> 1].circular = id & 1;
+ id >>= 1;
+
if (s[id].request != R_IDLE)
return EBUSY;
s[id].request = newRequest;
s[id].buf = buf;
***************
*** 258,263 ****
}
! command error_t LinearWrite.append[logstorage_t id](void* buf, storage_len_t length) {
! if (len > call LinearRead.getSize[id]() - PAGE_SIZE)
/* Writes greater than the volume size are invalid.
Writes equal to the volume size could break the log volume
--- 247,252 ----
}
! command error_t LogWrite.append[logstorage_t id](void* buf, storage_len_t length) {
! if (len > call LogRead.getSize[id]() - PAGE_SIZE)
/* Writes greater than the volume size are invalid.
Writes equal to the volume size could break the log volume
***************
*** 268,341 ****
return EINVAL;
else
! return newRequest(R_APPEND, id, FALSE, buf, length);
}
! command storage_cookie_t LinearWrite.currentOffset[logstorage_t id]() {
! return s[id].wpos;
}
! command error_t LinearWrite.erase[logstorage_t id]() {
! return newRequest(R_ERASE, id, FALSE, NULL, 0);
}
! command error_t LinearWrite.sync[logstorage_t id]() {
! return newRequest(R_SYNC, id, FALSE, NULL, 0);
}
! command error_t LinearRead.read[logstorage_t id](void* buf, storage_len_t length) {
! return newRequest(R_READ, id, FALSE, buf, length);
}
! command storage_cookie_t LinearRead.currentOffset[logstorage_t id]() {
return s[id].rvalid ? s[id].rpos : SEEK_BEGINNING;
}
! command error_t LinearRead.seek[logstorage_t id](storage_cookie_t offset) {
! return newRequest(R_SEEK, id, FALSE, (void *)(offset >> 16), offset);
! }
!
! command storage_len_t LinearRead.getSize[logstorage_t id]() {
! return call At45dbVolume.volumeSize[id]() * (storage_len_t)PAGE_SIZE;
! }
!
! command error_t CircularWrite.append[logstorage_t id](void* buf, storage_len_t length) {
! if (len > call CircularRead.getSize[id]() - PAGE_SIZE)
! /* Writes greater than the volume size are invalid.
! Writes equal to the volume size could break the log volume
! invariant (see next comment).
! Writes that span the whole volume could lead to problems
! at boot time (no valid block with a record boundary).
! Refuse them all. */
! return EINVAL;
! else
! return newRequest(R_APPEND, id, TRUE, buf, length);
! }
!
! command uint32_t CircularWrite.currentOffset[logstorage_t id]() {
! return s[id].wpos;
! }
!
! command error_t CircularWrite.erase[logstorage_t id]() {
! return newRequest(R_ERASE, id, TRUE, NULL, 0);
! }
!
! command error_t CircularWrite.sync[logstorage_t id]() {
! return newRequest(R_SYNC, id, TRUE, NULL, 0);
! }
!
! command error_t CircularRead.read[logstorage_t id](void* buf, storage_len_t length) {
! return newRequest(R_READ, id, TRUE, buf, length);
! }
!
! command uint32_t CircularRead.currentOffset[logstorage_t id]() {
! return call LinearRead.currentOffset[id]();
! }
!
! command error_t CircularRead.seek[logstorage_t id](storage_cookie_t offset) {
! return newRequest(R_SEEK, id, TRUE, (void *)(offset >> 16), offset);
}
! command storage_len_t CircularRead.getSize[logstorage_t id]() {
! return call LinearRead.getSize[id]();
}
--- 257,290 ----
return EINVAL;
else
! return newRequest(R_APPEND, id, buf, length);
}
! command storage_cookie_t LogWrite.currentOffset[logstorage_t id]() {
! return s[id >> 1].wpos;
}
! command error_t LogWrite.erase[logstorage_t id]() {
! return newRequest(R_ERASE, id, NULL, 0);
}
! command error_t LogWrite.sync[logstorage_t id]() {
! return newRequest(R_SYNC, id, NULL, 0);
}
! command error_t LogRead.read[logstorage_t id](void* buf, storage_len_t length) {
! return newRequest(R_READ, id, buf, length);
}
! command storage_cookie_t LogRead.currentOffset[logstorage_t id]() {
! id >>= 1;
return s[id].rvalid ? s[id].rpos : SEEK_BEGINNING;
}
! command error_t LogRead.seek[logstorage_t id](storage_cookie_t offset) {
! return newRequest(R_SEEK, id, (void *)(offset >> 16), offset);
}
! command storage_len_t LogRead.getSize[logstorage_t id]() {
! return call At45dbVolume.volumeSize[id >> 1]() * (storage_len_t)PAGE_SIZE;
}
***************
*** 906,920 ****
event void At45db.copyPageDone(error_t error) { }
! default event void LinearWrite.appendDone[logstorage_t logId](void* buf, storage_len_t l, error_t error) { }
! default event void LinearWrite.eraseDone[logstorage_t logId](error_t error) { }
! default event void LinearWrite.syncDone[logstorage_t logId](error_t error) { }
! default event void LinearRead.readDone[logstorage_t logId](void* buf, storage_len_t l, error_t error) { }
! default event void LinearRead.seekDone[logstorage_t logId](error_t error) {}
!
! default event void CircularWrite.appendDone[logstorage_t logId](void* buf, storage_len_t l, error_t error) { }
! default event void CircularWrite.eraseDone[logstorage_t logId](error_t error) { }
! default event void CircularWrite.syncDone[logstorage_t logId](error_t error) { }
! default event void CircularRead.readDone[logstorage_t logId](void* buf, storage_len_t l, error_t error) { }
! default event void CircularRead.seekDone[logstorage_t logId](error_t error) {}
default command at45page_t At45dbVolume.remap[logstorage_t logId](at45page_t volumePage) {return 0;}
--- 855,863 ----
event void At45db.copyPageDone(error_t error) { }
! default event void LogWrite.appendDone[logstorage_t logId](void* buf, storage_len_t l, error_t error) { }
! default event void LogWrite.eraseDone[logstorage_t logId](error_t error) { }
! default event void LogWrite.syncDone[logstorage_t logId](error_t error) { }
! default event void LogRead.readDone[logstorage_t logId](void* buf, storage_len_t l, error_t error) { }
! default event void LogRead.seekDone[logstorage_t logId](error_t error) {}
default command at45page_t At45dbVolume.remap[logstorage_t logId](at45page_t volumePage) {return 0;}
***************
*** 922,925 ****
default async command error_t Resource.request[logstorage_t logId]() {return SUCCESS;}
default async command void Resource.release[logstorage_t logId]() { }
-
}
--- 865,867 ----
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/storage/Log
RandRWAppC.nc, 1.1.2.2, 1.1.2.3
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x/tos/platforms/intelmote2/chips/pxa271
BlockStorageC.nc, NONE, 1.1.2.1 Flash.nc, NONE,
1.1.2.1 FlashC.nc, NONE, 1.1.2.1 HalP30P.nc, NONE,
1.1.2.1 Storage_chip.h, NONE, 1.1.2.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list