[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/Deluge ReprogramGuard.nc, NONE, 1.1 imgNum2volumeId.h, NONE, 1.1 Deluge.h, 1.4, 1.5 DelugeC.nc, 1.7, 1.8 DelugeManagerP.nc, 1.5, 1.6 DelugeMetadataP.nc, 1.1, 1.2
Razvan Musaloiu-E.
razvanm at users.sourceforge.net
Mon May 19 14:25:11 PDT 2008
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tools/tinyos/misc tos.py, NONE, 1.1 Makefile.am, 1.6, 1.7 tos-build-deluge-image, 1.3, 1.4 tos-deluge, 1.12, 1.13 tinyos.py, 1.4, NONE
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/Deluge/extra/micaz ReprogramGuardC.nc, NONE, 1.1 ReprogramGuardP.nc, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv21259/tos/lib/net/Deluge
Modified Files:
Deluge.h DelugeC.nc DelugeManagerP.nc DelugeMetadataP.nc
Added Files:
ReprogramGuard.nc imgNum2volumeId.h
Log Message:
Merge of the latest Deluge T2.
--- NEW FILE: ReprogramGuard.nc ---
interface ReprogramGuard
{
command error_t okToProgram();
event void okToProgramDone(bool ok);
}
--- NEW FILE: imgNum2volumeId.h ---
#ifndef __IMGNUM2VOLUMEID_H__
#define __IMGNUM2VOLUMEID_H__
uint8_t _imgNum2volumeId[] = {
VOLUME_GOLDENIMAGE,
VOLUME_DELUGE1,
VOLUME_DELUGE2,
VOLUME_DELUGE3
};
enum {
NON_DELUGE_VOLUME = 0xFF
};
uint8_t imgNum2volumeId(uint8_t imgNum)
{
return imgNum < DELUGE_NUM_VOLUMES ? _imgNum2volumeId[imgNum] : NON_DELUGE_VOLUME;
}
#endif
Index: Deluge.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/Deluge.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Deluge.h 14 Jan 2008 04:22:01 -0000 1.4
--- Deluge.h 19 May 2008 21:25:08 -0000 1.5
***************
*** 45,48 ****
--- 45,51 ----
DELUGE_INVALID_UID = 0xffffffff,
DELUGE_NUM_VOLUMES = 4,
+ DELUGE_KEY = 0xDE00,
+ DELUGE_AM_FLASH_VOL_MANAGER = 0xAB,
+ DELUGE_AM_DELUGE_MANAGER = 0xAC,
};
Index: DelugeC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/DelugeC.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** DelugeC.nc 14 Jan 2008 04:22:01 -0000 1.7
--- DelugeC.nc 19 May 2008 21:25:08 -0000 1.8
***************
*** 54,58 ****
ObjectTransferC.Leds = Leds;
! components new DisseminatorC(DelugeCmd, 0xDE00);
components DisseminationC;
components ActiveMessageC;
--- 54,58 ----
ObjectTransferC.Leds = Leds;
! components new DisseminatorC(DelugeCmd, DELUGE_KEY);
components DisseminationC;
components ActiveMessageC;
***************
*** 68,72 ****
--- 68,74 ----
DelugeP.Boot -> MainC;
DelugeP.Leds = Leds;
+ #ifndef DELUGE_BASESTATION
DelugeP.DisseminationValue -> DisseminatorC;
+ #endif
DelugeP.DisseminationStdControl -> DisseminationC;
DelugeP.ObjectTransfer -> ObjectTransferC;
***************
*** 79,86 ****
DelugeP.Resource -> BlockStorageLockClientC;
! #ifdef DELUGE_BASESTATION
components SerialStarterC;
! components new FlashVolumeManagerC(0xAB);
! components new DelugeManagerC(0xAC);
DelugeManagerC.DisseminationUpdate -> DisseminatorC;
--- 81,91 ----
DelugeP.Resource -> BlockStorageLockClientC;
! #if defined(DELUGE_BASESTATION) || defined(DELUGE_LIGHT_BASESTATION)
components SerialStarterC;
! components new FlashVolumeManagerC(DELUGE_AM_FLASH_VOL_MANAGER);
! #endif
!
! #ifdef DELUGE_BASESTATION
! components new DelugeManagerC(DELUGE_AM_DELUGE_MANAGER);
DelugeManagerC.DisseminationUpdate -> DisseminatorC;
Index: DelugeManagerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/DelugeManagerP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DelugeManagerP.nc 22 Jan 2008 00:40:59 -0000 1.5
--- DelugeManagerP.nc 19 May 2008 21:25:08 -0000 1.6
***************
*** 25,28 ****
--- 25,30 ----
*/
+ #include "imgNum2volumeId.h"
+
generic module DelugeManagerP()
{
***************
*** 56,65 ****
message_t serialMsg;
DelugeCmd delugeCmd;
- uint8_t imgNum2volumeId[] = {
- VOLUME_GOLDENIMAGE,
- VOLUME_DELUGE1,
- VOLUME_DELUGE2,
- VOLUME_DELUGE3
- };
void sendReply(error_t error)
--- 58,61 ----
***************
*** 78,84 ****
SerialReqPacket *request = (SerialReqPacket *)payload;
memset(&delugeCmd, 0, sizeof(DelugeCmd));
-
call stop();
delugeCmd.type = request->cmd;
switch (request->cmd) {
--- 74,81 ----
SerialReqPacket *request = (SerialReqPacket *)payload;
memset(&delugeCmd, 0, sizeof(DelugeCmd));
call stop();
delugeCmd.type = request->cmd;
+ // Converts the image number that the user wants to the real image number
+ request->imgNum = imgNum2volumeId(request->imgNum);
switch (request->cmd) {
***************
*** 91,98 ****
case DELUGE_CMD_ONLY_DISSEMINATE:
case DELUGE_CMD_DISSEMINATE_AND_REPROGRAM:
! if (request->imgNum < DELUGE_NUM_VOLUMES &&
(call Resource.isOwner() ||
call Resource.immediateRequest() == SUCCESS)) {
! call DelugeMetadata.read(imgNum2volumeId[request->imgNum]);
} else {
sendReply(FAIL);
--- 88,95 ----
case DELUGE_CMD_ONLY_DISSEMINATE:
case DELUGE_CMD_DISSEMINATE_AND_REPROGRAM:
! if (request->imgNum != NON_DELUGE_VOLUME &&
(call Resource.isOwner() ||
call Resource.immediateRequest() == SUCCESS)) {
! call DelugeMetadata.read(request->imgNum);
} else {
sendReply(FAIL);
***************
*** 100,109 ****
break;
case DELUGE_CMD_REPROGRAM:
! if (!(request->imgNum < DELUGE_NUM_VOLUMES)) {
sendReply(FAIL);
break;
}
! case DELUGE_CMD_REBOOT:
! delugeCmd.imgNum = imgNum2volumeId[request->imgNum];
call DelayTimer.startOneShot(1024);
sendReply(SUCCESS);
--- 97,106 ----
break;
case DELUGE_CMD_REPROGRAM:
! case DELUGE_CMD_REBOOT:
! if (request->imgNum == NON_DELUGE_VOLUME) {
sendReply(FAIL);
break;
}
! delugeCmd.imgNum = request->imgNum;
call DelayTimer.startOneShot(1024);
sendReply(SUCCESS);
Index: DelugeMetadataP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/DelugeMetadataP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DelugeMetadataP.nc 14 Jan 2008 04:22:01 -0000 1.1
--- DelugeMetadataP.nc 19 May 2008 21:25:08 -0000 1.2
***************
*** 25,28 ****
--- 25,30 ----
*/
+ #include "imgNum2volumeId.h"
+
module DelugeMetadataP
{
***************
*** 49,53 ****
DelugeIdent ident;
uint8_t state;
! uint8_t currentImage;
uint8_t currentPage;
nx_uint16_t currentCrc;
--- 51,56 ----
DelugeIdent ident;
uint8_t state;
! uint8_t currentVolume;
! uint8_t currentImageIdx;
uint8_t currentPage;
nx_uint16_t currentCrc;
***************
*** 56,62 ****
void nextImage()
{
! if (currentImage < DELUGE_NUM_VOLUMES) {
state = S_READ_IDENT;
! call BlockRead.read[currentImage](0, &ident, sizeof(ident));
} else {
signal storageReady();
--- 59,65 ----
void nextImage()
{
! if (currentImageIdx < DELUGE_NUM_VOLUMES) {
state = S_READ_IDENT;
! call BlockRead.read[currentVolume](0, &ident, sizeof(ident));
} else {
signal storageReady();
***************
*** 83,87 ****
// block.
state = S_READ_IDENT;
! currentImage = 0;
nextImage();
}
--- 86,91 ----
// block.
state = S_READ_IDENT;
! currentImageIdx = 0;
! currentVolume = _imgNum2volumeId[currentImageIdx];
nextImage();
}
***************
*** 111,117 ****
currentPage = 0;
state = S_READ_CRC;
! call BlockRead.read[currentImage](calcCrcAddr(), ¤tCrc, sizeof(currentCrc));
} else {
! currentImage++;
nextImage();
}
--- 115,121 ----
currentPage = 0;
state = S_READ_CRC;
! call BlockRead.read[currentVolume](calcCrcAddr(), ¤tCrc, sizeof(currentCrc));
} else {
! currentImageIdx++;
nextImage();
}
***************
*** 120,124 ****
case S_READ_CRC:
state = S_CRC;
! call BlockRead.computeCrc[currentImage](calcPageAddr(), DELUGE_BYTES_PER_PAGE, 0);
break;
}
--- 124,128 ----
case S_READ_CRC:
state = S_CRC;
! call BlockRead.computeCrc[currentVolume](calcPageAddr(), DELUGE_BYTES_PER_PAGE, 0);
break;
}
***************
*** 132,143 ****
// printf("%04x %04x\n", crc, currentCrc);
// invalidate the image by erasing it
! call BlockWrite.erase[currentImage]();
} else {
currentPage++;
if (currentPage < ident.numPgs) {
state = S_READ_CRC;
! call BlockRead.read[currentImage](calcCrcAddr(), ¤tCrc, sizeof(currentCrc));
} else {
! currentImage++;
nextImage();
}
--- 136,148 ----
// printf("%04x %04x\n", crc, currentCrc);
// invalidate the image by erasing it
! call BlockWrite.erase[currentVolume]();
} else {
currentPage++;
if (currentPage < ident.numPgs) {
state = S_READ_CRC;
! call BlockRead.read[currentVolume](calcCrcAddr(), ¤tCrc, sizeof(currentCrc));
} else {
! currentImageIdx++;
! currentVolume = _imgNum2volumeId[currentImageIdx];
nextImage();
}
***************
*** 158,162 ****
break;
case S_CRC:
! currentImage++;
nextImage();
break;
--- 163,168 ----
break;
case S_CRC:
! currentImageIdx++;
! currentVolume = _imgNum2volumeId[currentImageIdx];
nextImage();
break;
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tools/tinyos/misc tos.py, NONE, 1.1 Makefile.am, 1.6, 1.7 tos-build-deluge-image, 1.3, 1.4 tos-deluge, 1.12, 1.13 tinyos.py, 1.4, NONE
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/Deluge/extra/micaz ReprogramGuardC.nc, NONE, 1.1 ReprogramGuardP.nc, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list