[Tinyos-beta-commits] CVS: tinyos-1.x/beta/Deluge/Deluge Deluge.h,
1.6, 1.7 DelugeDataRead.nc, 1.2, 1.3 DelugeDataWrite.nc, 1.2,
1.3 DelugeM.nc, 1.8, 1.9 DelugeMetadata.nc, 1.2,
1.3 DelugeMetadataC.nc, 1.3, 1.4 DelugeMetadataM.nc, 1.8,
1.9 DelugeMetadataRead.nc, 1.2, 1.3 DelugeMetadataWrite.nc,
1.2, 1.3 DelugePageTransferM.nc, 1.5, 1.6 DelugeStorage.nc,
1.3, 1.4 DelugeStorageC.nc, 1.7, 1.8 DelugeStorageM.nc, 1.6,
1.7 NetProgM.nc, 1.3, 1.4
Jonathan Hui
jwhui at users.sourceforge.net
Fri Mar 11 13:46:45 PST 2005
Update of /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26392/Deluge
Modified Files:
Deluge.h DelugeDataRead.nc DelugeDataWrite.nc DelugeM.nc
DelugeMetadata.nc DelugeMetadataC.nc DelugeMetadataM.nc
DelugeMetadataRead.nc DelugeMetadataWrite.nc
DelugePageTransferM.nc DelugeStorage.nc DelugeStorageC.nc
DelugeStorageM.nc NetProgM.nc
Log Message:
- Match changes with new storage stack.
Index: Deluge.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/Deluge.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Deluge.h 9 Feb 2005 02:54:30 -0000 1.6
--- Deluge.h 11 Mar 2005 21:46:37 -0000 1.7
***************
*** 67,83 ****
enum {
! DELUGE_VOLUME_ID_0 = unique("BlockStorage"),
! DELUGE_VOLUME_ID_1 = unique("BlockStorage"),
! DELUGE_VOLUME_ID_2 = unique("BlockStorage"),
! };
!
! enum {
! DELUGE_IMAGE_0 = 0,
! DELUGE_IMAGE_1 = 1,
! DELUGE_IMAGE_2 = 2,
};
#include "Storage.h"
- #include "StorageManager.h"
struct deluge_image_t {
--- 67,76 ----
enum {
! DELUGE_VOLUME_ID_0 = unique("StorageManager"),
! DELUGE_VOLUME_ID_1 = unique("StorageManager"),
! DELUGE_VOLUME_ID_2 = unique("StorageManager"),
};
#include "Storage.h"
struct deluge_image_t {
***************
*** 87,93 ****
static const struct deluge_image_t DELUGE_IMAGES[DELUGE_NUM_IMAGES] = {
! { DELUGE_IMAGE_0, SM_GOLDEN_IMAGE },
! { DELUGE_IMAGE_1, 0 },
! { DELUGE_IMAGE_2, 1 },
};
--- 80,86 ----
static const struct deluge_image_t DELUGE_IMAGES[DELUGE_NUM_IMAGES] = {
! { DELUGE_VOLUME_ID_0, 0xDF },
! { DELUGE_VOLUME_ID_1, 0xD0 },
! { DELUGE_VOLUME_ID_2, 0xD1 },
};
Index: DelugeDataRead.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeDataRead.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DelugeDataRead.nc 26 Nov 2004 18:59:10 -0000 1.2
--- DelugeDataRead.nc 11 Mar 2005 21:46:37 -0000 1.3
***************
*** 34,43 ****
interface DelugeDataRead {
! command result_t read(imgnum_t imgNum, block_addr_t addr,
! uint8_t* buf, block_addr_t len);
! event result_t readDone(result_t result);
!
command result_t verify(imgnum_t imgNum, pgnum_t addr);
! event result_t verifyDone(result_t result);
}
--- 34,42 ----
interface DelugeDataRead {
! command result_t read(imgnum_t imgNum, block_addr_t addr, uint8_t* buf, block_addr_t len);
! event void readDone(storage_result_t result);
!
command result_t verify(imgnum_t imgNum, pgnum_t addr);
! event void verifyDone(storage_result_t result);
}
Index: DelugeDataWrite.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeDataWrite.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DelugeDataWrite.nc 26 Nov 2004 18:59:10 -0000 1.2
--- DelugeDataWrite.nc 11 Mar 2005 21:46:37 -0000 1.3
***************
*** 31,40 ****
interface DelugeDataWrite {
! command result_t write(imgnum_t imgNum, block_addr_t addr,
! uint8_t* source, block_addr_t len);
! event result_t writeDone(result_t result);
command result_t erase(imgnum_t imgNum);
! event result_t eraseDone(result_t result);
}
--- 31,39 ----
interface DelugeDataWrite {
! command result_t write(imgnum_t imgNum, block_addr_t addr, uint8_t* source, block_addr_t len);
! event void writeDone(storage_result_t result);
command result_t erase(imgnum_t imgNum);
! event void eraseDone(storage_result_t result);
}
Index: DelugeM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeM.nc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** DelugeM.nc 9 Feb 2005 00:48:33 -0000 1.8
--- DelugeM.nc 11 Mar 2005 21:46:37 -0000 1.9
***************
*** 331,337 ****
}
! event result_t Metadata.setupNewImageDone(result_t result) {
setNextPage();
- return SUCCESS;
}
--- 331,336 ----
}
! event void Metadata.setupNewImageDone(result_t result) {
setNextPage();
}
***************
*** 351,356 ****
return SUCCESS;
}
!
! event result_t Metadata.receivedPageDone(result_t result) {
imgnum_t imgNum;
--- 350,355 ----
return SUCCESS;
}
!
! event void Metadata.receivedPageDone(result_t result) {
imgnum_t imgNum;
***************
*** 366,371 ****
startTimer();
- return SUCCESS;
-
}
--- 365,368 ----
Index: DelugeMetadata.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeMetadata.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DelugeMetadata.nc 26 Nov 2004 18:59:10 -0000 1.2
--- DelugeMetadata.nc 11 Mar 2005 21:46:37 -0000 1.3
***************
*** 35,39 ****
command result_t setupNewImage(DelugeImgDesc* imgDesc);
! event result_t setupNewImageDone(result_t result);
command result_t getImgDesc(imgnum_t imgNum, DelugeImgDesc* imgDesc);
command dm_cmp_t compareImgDesc(DelugeImgDesc* imgDesc);
--- 35,39 ----
command result_t setupNewImage(DelugeImgDesc* imgDesc);
! event void setupNewImageDone(result_t result);
command result_t getImgDesc(imgnum_t imgNum, DelugeImgDesc* imgDesc);
command dm_cmp_t compareImgDesc(DelugeImgDesc* imgDesc);
***************
*** 43,47 ****
command result_t receivedPage(imgnum_t imgNum, pgnum_t pgNum);
! event result_t receivedPageDone(result_t result);
}
--- 43,47 ----
command result_t receivedPage(imgnum_t imgNum, pgnum_t pgNum);
! event void receivedPageDone(result_t result);
}
Index: DelugeMetadataC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeMetadataC.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DelugeMetadataC.nc 27 Nov 2004 17:36:41 -0000 1.3
--- DelugeMetadataC.nc 11 Mar 2005 21:46:38 -0000 1.4
***************
*** 55,61 ****
DelugeMetadataM.DataRead -> Storage.DataRead[unique("DelugeDataRead")];
DelugeMetadataM.DataWrite -> Storage.DataWrite[unique("DelugeDataWrite")];
DelugeMetadataM.MetadataRead -> Storage.MetadataRead[unique("DelugeMetadataRead")];
DelugeMetadataM.MetadataWrite -> Storage.MetadataWrite[unique("DelugeMetadataWrite")];
- DelugeMetadataM.SubControl -> Storage;
}
--- 55,61 ----
DelugeMetadataM.DataRead -> Storage.DataRead[unique("DelugeDataRead")];
DelugeMetadataM.DataWrite -> Storage.DataWrite[unique("DelugeDataWrite")];
+ DelugeMetadataM.DelugeStorage -> Storage;
DelugeMetadataM.MetadataRead -> Storage.MetadataRead[unique("DelugeMetadataRead")];
DelugeMetadataM.MetadataWrite -> Storage.MetadataWrite[unique("DelugeMetadataWrite")];
}
Index: DelugeMetadataM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeMetadataM.nc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** DelugeMetadataM.nc 9 Feb 2005 00:48:33 -0000 1.8
--- DelugeMetadataM.nc 11 Mar 2005 21:46:38 -0000 1.9
***************
*** 39,43 ****
interface DelugeMetadataRead as MetadataRead;
interface DelugeMetadataWrite as MetadataWrite;
! interface StdControl as SubControl;
#ifdef PLATFORM_TELOSB
interface SplitControl as RadioControl;
--- 39,43 ----
interface DelugeMetadataRead as MetadataRead;
interface DelugeMetadataWrite as MetadataWrite;
! interface DelugeStorage;
#ifdef PLATFORM_TELOSB
interface SplitControl as RadioControl;
***************
*** 94,99 ****
command result_t SplitControl.init() {
- result_t result;
-
#ifdef PLATFORM_TELOSB
state = S_RADIO_STARTING;
--- 94,97 ----
***************
*** 102,107 ****
#endif
- result = call SubControl.init();
-
#ifdef PLATFORM_PC
if (TOS_LOCAL_ADDRESS == 0) {
--- 100,103 ----
***************
*** 117,138 ****
}
- void halt() {
- TOSH_CLR_YELLOW_LED_PIN();
- TOSH_SET_GREEN_LED_PIN();
- TOSH_CLR_RED_LED_PIN();
- while(1);
- }
-
result_t realStart() {
! result_t result;
!
! result = call SubControl.start();
state = S_READ_IMG_DESC;
curImage = 0;
if (call MetadataRead.read(curImage, &(imgDesc[curImage])) == FAIL)
post retry();
-
- return SUCCESS;
}
--- 113,125 ----
}
result_t realStart() {
! return call DelugeStorage.loadImages();
! }
+ event void DelugeStorage.loadImagesDone(result_t result) {
state = S_READ_IMG_DESC;
curImage = 0;
if (call MetadataRead.read(curImage, &(imgDesc[curImage])) == FAIL)
post retry();
}
***************
*** 230,241 ****
}
! event result_t DataRead.verifyDone(result_t result) {
switch(state) {
case S_FIND_INCOMPLETE_PAGE:
! if (result == FAIL) {
state = S_READ_IMG_DESC;
! return readNextMetadata();
}
--- 217,229 ----
}
! event void DataRead.verifyDone(storage_result_t result) {
switch(state) {
case S_FIND_INCOMPLETE_PAGE:
! if (result != STORAGE_OK) {
state = S_READ_IMG_DESC;
! readNextMetadata();
! return;
}
***************
*** 243,247 ****
if (imgDesc[curImage].numPgsComplete == imgDesc[curImage].numPgs) {
state = S_READ_IMG_DESC;
! return readNextMetadata();
}
--- 231,236 ----
if (imgDesc[curImage].numPgsComplete == imgDesc[curImage].numPgs) {
state = S_READ_IMG_DESC;
! readNextMetadata();
! return;
}
***************
*** 253,262 ****
case S_VERIFY:
! if (result == FAIL) {
imgDesc[curImage].numPgsComplete = 0;
state = S_ERASE_IMAGE;
if (call DataWrite.erase(curImage) == FAIL)
post retry();
! return SUCCESS;
}
--- 242,251 ----
case S_VERIFY:
! if (result != STORAGE_OK) {
imgDesc[curImage].numPgsComplete = 0;
state = S_ERASE_IMAGE;
if (call DataWrite.erase(curImage) == FAIL)
post retry();
! return;
}
***************
*** 273,278 ****
}
- return SUCCESS;
-
}
--- 262,265 ----
***************
*** 338,342 ****
}
! event result_t MetadataRead.readDone(result_t result) {
if (imgDesc[curImage].numPgsComplete == DELUGE_INVALID_PGNUM
--- 325,329 ----
}
! event void MetadataRead.readDone(storage_result_t result) {
if (imgDesc[curImage].numPgsComplete == DELUGE_INVALID_PGNUM
***************
*** 347,351 ****
imgDesc[curImage].crc = 0;
imgDesc[curImage].numPgsComplete = 0;
! return readNextMetadata();
}
--- 334,339 ----
imgDesc[curImage].crc = 0;
imgDesc[curImage].numPgsComplete = 0;
! readNextMetadata();
! return;
}
***************
*** 354,391 ****
if (call DataRead.verify(curImage, imgDesc[curImage].numPgsComplete) == FAIL)
post retry();
- return SUCCESS;
}
- return SUCCESS;
-
}
! event result_t DataWrite.eraseDone(result_t result) {
switch(state) {
case S_ERASE_IMAGE:
state = S_IDLE;
! return signal Metadata.receivedPageDone[client](FAIL);
case S_SETUP_NEW_IMAGE:
if (call MetadataWrite.write(curImage, &(imgDesc[curImage])) == FAIL)
post retry();
! return SUCCESS;
}
- return FAIL;
}
! event result_t MetadataWrite.writeDone(result_t result) {
uint8_t tmpState = state;
state = S_IDLE;
switch(tmpState) {
case S_SETUP_NEW_IMAGE:
! return signal Metadata.setupNewImageDone[client](result);
}
- return SUCCESS;
}
! event result_t DataRead.readDone(result_t result) { return SUCCESS; }
! event result_t DataWrite.writeDone(result_t result) { return SUCCESS; }
! default event result_t Metadata.setupNewImageDone[uint8_t id](result_t result) { return SUCCESS; }
! default event result_t Metadata.receivedPageDone[uint8_t id](result_t result) { return SUCCESS; }
}
--- 342,376 ----
if (call DataRead.verify(curImage, imgDesc[curImage].numPgsComplete) == FAIL)
post retry();
}
}
! event void DataWrite.eraseDone(storage_result_t result) {
switch(state) {
case S_ERASE_IMAGE:
state = S_IDLE;
! signal Metadata.receivedPageDone[client](result);
! break;
case S_SETUP_NEW_IMAGE:
if (call MetadataWrite.write(curImage, &(imgDesc[curImage])) == FAIL)
post retry();
! break;
}
}
! event void MetadataWrite.writeDone(storage_result_t result) {
uint8_t tmpState = state;
state = S_IDLE;
switch(tmpState) {
case S_SETUP_NEW_IMAGE:
! signal Metadata.setupNewImageDone[client](result);
! break;
}
}
! event void DataRead.readDone(result_t result) { ; }
! event void DataWrite.writeDone(result_t result) { ; }
! default event void Metadata.setupNewImageDone[uint8_t id](result_t result) { ; }
! default event void Metadata.receivedPageDone[uint8_t id](result_t result) { ; }
}
Index: DelugeMetadataRead.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeMetadataRead.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DelugeMetadataRead.nc 26 Nov 2004 18:59:10 -0000 1.2
--- DelugeMetadataRead.nc 11 Mar 2005 21:46:38 -0000 1.3
***************
*** 32,36 ****
command result_t read(imgnum_t imgNum, DelugeImgDesc* imgDesc);
! event result_t readDone(result_t result);
}
--- 32,36 ----
command result_t read(imgnum_t imgNum, DelugeImgDesc* imgDesc);
! event void readDone(storage_result_t result);
}
Index: DelugeMetadataWrite.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeMetadataWrite.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DelugeMetadataWrite.nc 26 Nov 2004 18:59:10 -0000 1.2
--- DelugeMetadataWrite.nc 11 Mar 2005 21:46:38 -0000 1.3
***************
*** 32,36 ****
command result_t write(imgnum_t imgNum, DelugeImgDesc* imgDesc);
! event result_t writeDone(result_t result);
}
--- 32,36 ----
command result_t write(imgnum_t imgNum, DelugeImgDesc* imgDesc);
! event void writeDone(storage_result_t result);
}
Index: DelugePageTransferM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugePageTransferM.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DelugePageTransferM.nc 9 Feb 2005 00:48:33 -0000 1.5
--- DelugePageTransferM.nc 11 Mar 2005 21:46:38 -0000 1.6
***************
*** 186,194 ****
uint16_t nextPkt;
if (state != S_SENDING && state != S_TX_LOCKING)
return;
- signal PageTransfer.suppressMsgs(vars.tx.imgToSend);
-
if (state == S_TX_LOCKING) {
if (call SharedMsgBuf.lock() == FAIL) {
--- 186,194 ----
uint16_t nextPkt;
+ signal PageTransfer.suppressMsgs(vars.tx.imgToSend);
+
if (state != S_SENDING && state != S_TX_LOCKING)
return;
if (state == S_TX_LOCKING) {
if (call SharedMsgBuf.lock() == FAIL) {
***************
*** 415,426 ****
}
! event result_t DataRead.readDone(result_t result) {
TOS_MsgPtr pMsgBuf = call SharedMsgBuf.getMsgBuf();
if (state != S_SENDING)
! return SUCCESS;
! if (result == SUCCESS) {
// success, begin sending
if (call SendDataMsg.send(vars.tx.dest, sizeof(DelugeDataMsg), pMsgBuf) == FAIL)
--- 415,426 ----
}
! event void DataRead.readDone(storage_result_t result) {
TOS_MsgPtr pMsgBuf = call SharedMsgBuf.getMsgBuf();
if (state != S_SENDING)
! return;
! if (result == STORAGE_OK) {
// success, begin sending
if (call SendDataMsg.send(vars.tx.dest, sizeof(DelugeDataMsg), pMsgBuf) == FAIL)
***************
*** 432,440 ****
}
- return SUCCESS;
-
}
! event result_t DataWrite.writeDone(result_t result) {
uint16_t tmp;
--- 432,438 ----
}
}
! event void DataWrite.writeDone(storage_result_t result) {
uint16_t tmp;
***************
*** 458,467 ****
}
- return SUCCESS;
-
}
- event result_t DataRead.verifyDone(result_t result) { return SUCCESS; }
-
event result_t SendReqMsg.sendDone(TOS_MsgPtr pMsg, result_t success) {
--- 456,461 ----
***************
*** 503,509 ****
}
! event result_t DataWrite.eraseDone(result_t result) { return SUCCESS; }
! event result_t Metadata.setupNewImageDone(result_t result) { return SUCCESS; }
! event result_t Metadata.receivedPageDone(result_t result) { return SUCCESS; }
event result_t SharedMsgBuf.bufFree() { return SUCCESS; }
--- 497,504 ----
}
! event void DataRead.verifyDone(storage_result_t result) { ; }
! event void DataWrite.eraseDone(storage_result_t result) { ; }
! event void Metadata.setupNewImageDone(result_t result) { ; }
! event void Metadata.receivedPageDone(result_t result) { ; }
event result_t SharedMsgBuf.bufFree() { return SUCCESS; }
Index: DelugeStorage.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeStorage.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DelugeStorage.nc 9 Feb 2005 00:48:33 -0000 1.3
--- DelugeStorage.nc 11 Mar 2005 21:46:38 -0000 1.4
***************
*** 30,33 ****
--- 30,35 ----
interface DelugeStorage {
+ command result_t loadImages();
+ event void loadImagesDone(result_t result);
command uint32_t imgNum2Addr(imgnum_t imgNum);
}
Index: DelugeStorageC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeStorageC.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** DelugeStorageC.nc 9 Feb 2005 02:54:30 -0000 1.7
--- DelugeStorageC.nc 11 Mar 2005 21:46:38 -0000 1.8
***************
*** 29,37 ****
*/
- includes StorageManager;
-
configuration DelugeStorageC {
provides {
- interface StdControl;
interface DelugeDataRead as DataRead[uint8_t id];
interface DelugeDataWrite as DataWrite[uint8_t id];
--- 29,34 ----
***************
*** 46,52 ****
Main,
DelugeStorageM as Storage,
! BlockStorageC;
- StdControl = Storage;
DataRead = Storage;
DataWrite = Storage;
--- 43,49 ----
Main,
DelugeStorageM as Storage,
! BlockStorageC,
! LedsC as Leds;
DataRead = Storage;
DataWrite = Storage;
***************
*** 55,72 ****
MetadataWrite = Storage;
! Storage.ImageRead[DELUGE_IMAGE_0] -> BlockStorageC.BlockRead[DELUGE_VOLUME_ID_0];
! Storage.ImageWrite[DELUGE_IMAGE_0] -> BlockStorageC.BlockWrite[DELUGE_VOLUME_ID_0];
! Storage.Mount[DELUGE_IMAGE_0] -> BlockStorageC.Mount[DELUGE_VOLUME_ID_0];
! Storage.StorageRemap[DELUGE_IMAGE_0] -> BlockStorageC.StorageRemap[DELUGE_VOLUME_ID_0];
! Storage.ImageRead[DELUGE_IMAGE_1] -> BlockStorageC.BlockRead[DELUGE_VOLUME_ID_1];
! Storage.ImageWrite[DELUGE_IMAGE_1] -> BlockStorageC.BlockWrite[DELUGE_VOLUME_ID_1];
! Storage.Mount[DELUGE_IMAGE_1] -> BlockStorageC.Mount[DELUGE_VOLUME_ID_1];
! Storage.StorageRemap[DELUGE_IMAGE_1] -> BlockStorageC.StorageRemap[DELUGE_VOLUME_ID_1];
! Storage.ImageRead[DELUGE_IMAGE_2] -> BlockStorageC.BlockRead[DELUGE_VOLUME_ID_2];
! Storage.ImageWrite[DELUGE_IMAGE_2] -> BlockStorageC.BlockWrite[DELUGE_VOLUME_ID_2];
! Storage.Mount[DELUGE_IMAGE_2] -> BlockStorageC.Mount[DELUGE_VOLUME_ID_2];
! Storage.StorageRemap[DELUGE_IMAGE_2] -> BlockStorageC.StorageRemap[DELUGE_VOLUME_ID_2];
}
--- 52,73 ----
MetadataWrite = Storage;
! Main.StdControl -> Storage;
! Storage.Leds -> Leds;
! Storage.ImageRead[DELUGE_VOLUME_ID_0] -> BlockStorageC.BlockRead[DELUGE_VOLUME_ID_0];
! Storage.ImageWrite[DELUGE_VOLUME_ID_0] -> BlockStorageC.BlockWrite[DELUGE_VOLUME_ID_0];
! Storage.Mount[DELUGE_VOLUME_ID_0] -> BlockStorageC.Mount[DELUGE_VOLUME_ID_0];
! Storage.StorageRemap[DELUGE_VOLUME_ID_0] -> BlockStorageC.StorageRemap[DELUGE_VOLUME_ID_0];
!
! Storage.ImageRead[DELUGE_VOLUME_ID_1] -> BlockStorageC.BlockRead[DELUGE_VOLUME_ID_1];
! Storage.ImageWrite[DELUGE_VOLUME_ID_1] -> BlockStorageC.BlockWrite[DELUGE_VOLUME_ID_1];
! Storage.Mount[DELUGE_VOLUME_ID_1] -> BlockStorageC.Mount[DELUGE_VOLUME_ID_1];
! Storage.StorageRemap[DELUGE_VOLUME_ID_1] -> BlockStorageC.StorageRemap[DELUGE_VOLUME_ID_1];
!
! Storage.ImageRead[DELUGE_VOLUME_ID_2] -> BlockStorageC.BlockRead[DELUGE_VOLUME_ID_2];
! Storage.ImageWrite[DELUGE_VOLUME_ID_2] -> BlockStorageC.BlockWrite[DELUGE_VOLUME_ID_2];
! Storage.Mount[DELUGE_VOLUME_ID_2] -> BlockStorageC.Mount[DELUGE_VOLUME_ID_2];
! Storage.StorageRemap[DELUGE_VOLUME_ID_2] -> BlockStorageC.StorageRemap[DELUGE_VOLUME_ID_2];
}
Index: DelugeStorageM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/DelugeStorageM.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** DelugeStorageM.nc 9 Feb 2005 00:48:33 -0000 1.6
--- DelugeStorageM.nc 11 Mar 2005 21:46:38 -0000 1.7
***************
*** 31,35 ****
module DelugeStorageM {
provides {
- interface StdControl;
interface DelugeMetadataRead as MetadataRead[uint8_t id];
interface DelugeMetadataWrite as MetadataWrite[uint8_t id];
--- 31,34 ----
***************
*** 37,40 ****
--- 36,40 ----
interface DelugeDataWrite as DataWrite[uint8_t id];
interface DelugeStorage;
+ interface StdControl;
}
uses {
***************
*** 43,46 ****
--- 43,47 ----
interface Mount[blockstorage_t blockId];
interface StorageRemap[blockstorage_t blockId];
+ interface Leds;
}
}
***************
*** 49,52 ****
--- 50,55 ----
enum {
+ S_NEVER_USED,
+ S_MOUNTING,
S_IDLE,
S_READ_METADATA,
***************
*** 78,98 ****
}
! command result_t StdControl.init() { return SUCCESS; }
command result_t StdControl.start() {
- call Mount.mount[DELUGE_IMAGES[0].imageNum](DELUGE_IMAGES[0].volumeId);
return SUCCESS;
}
! command result_t StdControl.stop() { return SUCCESS; }
event void Mount.mountDone[volume_t volume](storage_result_t result, volume_id_t id) {
uint8_t i;
for ( i = 0; i < DELUGE_NUM_IMAGES-1; i++ ) {
if (id == DELUGE_IMAGES[i].volumeId) {
! call Mount.mount[DELUGE_IMAGES[i+1].imageNum](DELUGE_IMAGES[i+1].volumeId);
! break;
}
}
}
--- 81,136 ----
}
! command result_t StdControl.init() {
! state = S_NEVER_USED;
! return SUCCESS;
! }
command result_t StdControl.start() {
return SUCCESS;
}
! command result_t StdControl.stop() {
! return SUCCESS;
! }
!
! command result_t DelugeStorage.loadImages() {
!
! if (state != S_NEVER_USED)
! return FAIL;
!
! state = S_MOUNTING;
! if (call Mount.mount[DELUGE_IMAGES[0].imageNum](DELUGE_IMAGES[0].volumeId) == FAIL) {
! state = S_NEVER_USED;
! return FAIL;
! }
!
! return SUCCESS;
!
! }
event void Mount.mountDone[volume_t volume](storage_result_t result, volume_id_t id) {
+
uint8_t i;
+
+ if (result != STORAGE_OK) {
+ signal DelugeStorage.loadImagesDone(FAIL);
+ return;
+ }
+
+ // mount next image
for ( i = 0; i < DELUGE_NUM_IMAGES-1; i++ ) {
if (id == DELUGE_IMAGES[i].volumeId) {
! if (call Mount.mount[DELUGE_IMAGES[i+1].imageNum](DELUGE_IMAGES[i+1].volumeId) == FAIL) {
! state = S_NEVER_USED;
! signal DelugeStorage.loadImagesDone(FAIL);
! }
! return;
}
}
+
+ // mounted all images
+ state = S_IDLE;
+ signal DelugeStorage.loadImagesDone(SUCCESS);
+
}
***************
*** 205,210 ****
case S_READ_CRC:
state = S_COMPUTE_CRC;
! if (computeCrc(i) == FAIL)
! signalDone(FAIL);
break;
default:
--- 243,248 ----
case S_READ_CRC:
state = S_COMPUTE_CRC;
! if (computeCrc(i) != SUCCESS)
! signalDone(STORAGE_FAIL);
break;
default:
***************
*** 214,235 ****
}
! event void ImageRead.readDone[uint8_t volume](result_t result) {
flashReqDone(volume, result);
}
! event void ImageRead.computeCrcDone[uint8_t volume](result_t result, uint16_t crcResult) {
! flashReqDone(volume, (crc == crcResult) ? SUCCESS : FAIL);
}
! event void ImageWrite.writeDone[uint8_t volume](result_t result) {
flashReqDone(volume, result);
}
! event void ImageWrite.eraseDone[uint8_t volume](result_t result) {
flashReqDone(volume, result);
}
! event void ImageRead.verifyDone[uint8_t volume](result_t result) { ; }
! event void ImageWrite.commitDone[uint8_t volume](result_t result) { ; }
default command result_t ImageRead.read[blockstorage_t blockId](block_addr_t addr, uint8_t* buf, block_addr_t len) { return FAIL; }
--- 252,273 ----
}
! event void ImageRead.readDone[uint8_t volume](storage_result_t result, block_addr_t addr, uint8_t* buf, block_addr_t len) {
flashReqDone(volume, result);
}
! event void ImageRead.computeCrcDone[uint8_t volume](storage_result_t result, uint16_t crcResult, block_addr_t addr, block_addr_t len) {
! flashReqDone(volume, (crc == crcResult) ? STORAGE_OK : STORAGE_FAIL);
}
! event void ImageWrite.writeDone[uint8_t volume](storage_result_t result, block_addr_t addr, uint8_t* buf, block_addr_t len) {
flashReqDone(volume, result);
}
! event void ImageWrite.eraseDone[uint8_t volume](storage_result_t result) {
flashReqDone(volume, result);
}
! event void ImageRead.verifyDone[uint8_t volume](storage_result_t result) { ; }
! event void ImageWrite.commitDone[uint8_t volume](storage_result_t result) { ; }
default command result_t ImageRead.read[blockstorage_t blockId](block_addr_t addr, uint8_t* buf, block_addr_t len) { return FAIL; }
***************
*** 240,251 ****
default command result_t ImageWrite.commit[blockstorage_t blockId]() { return FAIL; }
default command result_t Mount.mount[blockstorage_t blockId](volume_id_t id) { return FAIL; }
! default command uint32_t StorageRemap.physicalAddr[blockstorage_t blockId](uint32_t id) { return SM_INVALID_ADDR; }
! default event result_t DataRead.readDone[uint8_t id](result_t result) { return SUCCESS; }
! default event result_t DataRead.verifyDone[uint8_t id](result_t result) { return SUCCESS; }
! default event result_t DataWrite.writeDone[uint8_t id](result_t result) { return SUCCESS; }
! default event result_t DataWrite.eraseDone[uint8_t id](result_t result) { return SUCCESS; }
! default event result_t MetadataRead.readDone[uint8_t id](result_t result) { return SUCCESS; }
! default event result_t MetadataWrite.writeDone[uint8_t id](result_t result) { return SUCCESS; }
}
--- 278,289 ----
default command result_t ImageWrite.commit[blockstorage_t blockId]() { return FAIL; }
default command result_t Mount.mount[blockstorage_t blockId](volume_id_t id) { return FAIL; }
! default command uint32_t StorageRemap.physicalAddr[blockstorage_t blockId](uint32_t id) { return STORAGE_INVALID_ADDR; }
! default event void DataRead.readDone[uint8_t id](storage_result_t result) { ; }
! default event void DataRead.verifyDone[uint8_t id](storage_result_t result) { ; }
! default event void DataWrite.writeDone[uint8_t id](storage_result_t result) { ; }
! default event void DataWrite.eraseDone[uint8_t id](storage_result_t result) { ; }
! default event void MetadataRead.readDone[uint8_t id](storage_result_t result) { ; }
! default event void MetadataWrite.writeDone[uint8_t id](storage_result_t result) { ; }
}
Index: NetProgM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/NetProgM.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** NetProgM.nc 9 Feb 2005 00:48:33 -0000 1.3
--- NetProgM.nc 11 Mar 2005 21:46:38 -0000 1.4
***************
*** 139,144 ****
}
! event result_t Metadata.setupNewImageDone(result_t result) { return SUCCESS; }
! event result_t Metadata.receivedPageDone(result_t result) { return SUCCESS; }
}
--- 139,145 ----
}
! event void Metadata.setupNewImageDone(result_t result) { ; }
! event void Metadata.receivedPageDone(result_t result) { ; }
! event void Storage.loadImagesDone(result_t result) { ; }
}
More information about the Tinyos-beta-commits
mailing list