[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/Deluge/extra
NetProg.h, 1.1, 1.2 NetProg.nc, 1.1, 1.2 NetProgC.nc, 1.4,
1.5 NetProgM.nc, 1.4, 1.5
Razvan Musaloiu-E.
razvanm at users.sourceforge.net
Sun Jan 13 20:22:04 PST 2008
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/extra
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20053/tos/lib/net/Deluge/extra
Modified Files:
NetProg.h NetProg.nc NetProgC.nc NetProgM.nc
Log Message:
Super Duper update to Deluge T2. The manual and the testing scripts are temporary out-of-date.
Some of the improvements are:
- simplified images (ident and metadata were merged)
- network-order representation of fields
- new version of tinyos.py
- improved sharing of volumes.
Index: NetProg.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/extra/NetProg.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** NetProg.h 22 May 2007 20:34:24 -0000 1.1
--- NetProg.h 14 Jan 2008 04:22:02 -0000 1.2
***************
*** 39,43 ****
static const uint32_t DELUGE_IMAGE_UID = IDENT_UID_HASH;
!
typedef struct NetProg_TOSInfo {
uint16_t addr;
--- 39,43 ----
static const uint32_t DELUGE_IMAGE_UID = IDENT_UID_HASH;
! /*
typedef struct NetProg_TOSInfo {
uint16_t addr;
***************
*** 45,48 ****
uint16_t crc;
} NetProg_TOSInfo;
!
#endif
--- 45,48 ----
uint16_t crc;
} NetProg_TOSInfo;
! */
#endif
Index: NetProg.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/extra/NetProg.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** NetProg.nc 22 May 2007 20:34:24 -0000 1.1
--- NetProg.nc 14 Jan 2008 04:22:02 -0000 1.2
***************
*** 43,57 ****
/**
! * Reboot into the image specified by <code>imgNum</code>. This
! * assumes that an image has been downloaded into slot <code>imgNum</code>
! * using Deluge.
*
! * @param imgNum Number of image to boot in to.
* @return <code>FAIL</code> if the reboot command fails to
! * complete due to an invalid imgNum or incomplete
! * image,
! * does not return, otherwise.
*/
! command error_t programImgAndReboot(uint8_t imgNum);
}
--- 43,55 ----
/**
! * Reboot into the image specified by <code>imageAddr</code>. This
! * assumes that an image is present into the external flash
! * at the <code>imageAddr</code> address.
*
! * @param imageAddr Address in external flash
* @return <code>FAIL</code> if the reboot command fails to
! * complete, does not return, otherwise.
*/
! command error_t programImageAndReboot(uint32_t imageAddr);
}
Index: NetProgC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/extra/NetProgC.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** NetProgC.nc 20 Dec 2007 02:31:40 -0000 1.4
--- NetProgC.nc 14 Jan 2008 04:22:02 -0000 1.5
***************
*** 41,55 ****
implementation {
! components MainC, InternalFlashC as IFlash, CrcP,
! DelugeStorageC, NetProgM;
NetProg = NetProgM;
MainC.SoftwareInit -> NetProgM.Init;
- NetProgM.DelugeStorage[VOLUME_GOLDENIMAGE] -> DelugeStorageC.DelugeStorage[VOLUME_GOLDENIMAGE];
- NetProgM.DelugeStorage[VOLUME_DELUGE1] -> DelugeStorageC.DelugeStorage[VOLUME_DELUGE1];
- NetProgM.DelugeStorage[VOLUME_DELUGE2] -> DelugeStorageC.DelugeStorage[VOLUME_DELUGE2];
- NetProgM.DelugeStorage[VOLUME_DELUGE3] -> DelugeStorageC.DelugeStorage[VOLUME_DELUGE3];
- NetProgM.DelugeMetadata -> DelugeStorageC;
NetProgM.IFlash -> IFlash;
NetProgM.Crc -> CrcP;
--- 41,49 ----
implementation {
! components MainC, InternalFlashC as IFlash, CrcP, NetProgM;
NetProg = NetProgM;
MainC.SoftwareInit -> NetProgM.Init;
NetProgM.IFlash -> IFlash;
NetProgM.Crc -> CrcP;
Index: NetProgM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/extra/NetProgM.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** NetProgM.nc 10 Jul 2007 01:17:40 -0000 1.4
--- NetProgM.nc 14 Jan 2008 04:22:02 -0000 1.5
***************
*** 26,31 ****
/**
* @author Jonathan Hui <jwhui at cs.berkeley.edu>
- * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
* @author Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
*/
--- 26,31 ----
/**
* @author Jonathan Hui <jwhui at cs.berkeley.edu>
* @author Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
+ * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
*/
***************
*** 38,45 ****
}
uses {
- interface DelugeStorage[uint8_t img_num];
interface InternalFlash as IFlash;
interface Crc;
- interface DelugeMetadata;
interface Leds;
interface CC2420Config;
--- 38,43 ----
***************
*** 50,95 ****
implementation {
- uint16_t computeTosInfoCrc(NetProg_TOSInfo* tosInfo)
- {
- return call Crc.crc16(tosInfo, sizeof(NetProg_TOSInfo)-2);
- }
-
- void writeTOSinfo()
- {
- NetProg_TOSInfo tosInfo;
- uint16_t crc;
- call IFlash.read((uint8_t*)IFLASH_TOS_INFO_ADDR, &tosInfo, sizeof(tosInfo));
- tosInfo.addr = TOS_NODE_ID;
- tosInfo.groupId = TOS_AM_GROUP;
- crc = computeTosInfoCrc(&tosInfo);
- // don't write if data is already correct
- if (tosInfo.crc == crc)
- return;
- tosInfo.crc = crc;
- call IFlash.write((uint8_t*)IFLASH_TOS_INFO_ADDR, &tosInfo, sizeof(tosInfo));
- }
-
command error_t Init.init()
{
! NetProg_TOSInfo tosInfo;
!
! call IFlash.read((uint8_t*)IFLASH_TOS_INFO_ADDR, &tosInfo, sizeof(tosInfo));
!
! if (tosInfo.crc == computeTosInfoCrc(&tosInfo)) {
! // TOS_AM_GROUP is not a variable in T2
! // TOS_AM_GROUP = tosInfo.groupId;
!
! // Updates local node ID
! atomic {
! TOS_NODE_ID = tosInfo.addr;
! call setAmAddress(tosInfo.addr);
! }
! call CC2420Config.setShortAddr(tosInfo.addr);
! call CC2420Config.sync();
! }
! else {
! writeTOSinfo();
}
return SUCCESS;
--- 48,63 ----
implementation {
command error_t Init.init()
{
+ BootArgs bootArgs;
+ call IFlash.read((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs));
! // Update the local node ID
! if (bootArgs.address != 0xFFFF) {
! TOS_NODE_ID = bootArgs.address;
! call setAmAddress(bootArgs.address);
}
+ call CC2420Config.setShortAddr(bootArgs.address);
+ call CC2420Config.sync();
return SUCCESS;
***************
*** 98,129 ****
command error_t NetProg.reboot()
{
atomic {
! writeTOSinfo();
netprog_reboot();
}
return FAIL;
}
! command error_t NetProg.programImgAndReboot(uint8_t img_num)
{
! tosboot_args_t args;
! DelugeNodeDesc nodeDesc;
! DelugeImgDesc *imgDesc;
!
atomic {
! writeTOSinfo();
!
! args.imageAddr = call DelugeStorage.getPhysicalAddress[img_num](0);
! args.gestureCount = 0xff;
! args.noReprogram = FALSE;
! call IFlash.write((uint8_t*)TOSBOOT_ARGS_ADDR, &args, sizeof(args));
!
! // Write info about what img to disseminate after reboot
! imgDesc = call DelugeMetadata.getImgDesc(img_num);
! nodeDesc.uid = imgDesc->uid;
! nodeDesc.imgNum = img_num;
! nodeDesc.vNum = imgDesc->vNum;
! call IFlash.write((uint8_t*)IFLASH_NODE_DESC_ADDR, &nodeDesc, sizeof(nodeDesc));
// reboot
netprog_reboot();
--- 66,97 ----
command error_t NetProg.reboot()
{
+ BootArgs bootArgs;
+
atomic {
! call IFlash.read((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs));
!
! if (bootArgs.address != TOS_NODE_ID) {
! bootArgs.address = TOS_NODE_ID;
! call IFlash.write((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs));
! }
netprog_reboot();
}
+
return FAIL;
}
! command error_t NetProg.programImageAndReboot(uint32_t imgAddr)
{
! BootArgs bootArgs;
!
atomic {
! call IFlash.read((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs));
+ bootArgs.imageAddr = imgAddr;
+ bootArgs.gestureCount = 0xff;
+ bootArgs.noReprogram = FALSE;
+
+ call IFlash.write((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs));
+
// reboot
netprog_reboot();
***************
*** 136,140 ****
event void CC2420Config.syncDone(error_t error) {}
- default command storage_addr_t DelugeStorage.getPhysicalAddress[uint8_t img_num](storage_addr_t addr) { return 0xFFFFFFFF; }
-
}
--- 104,106 ----
More information about the Tinyos-2-commits
mailing list