From: razvanm Date: Tue, 10 Jul 2007 01:17:39 +0000 (+0000) Subject: This commit from Chieh-Jan (Mike) Liang fixes the following issues: X-Git-Tag: release_tools_1_2_4_1~60 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=2d422c11d7a829ca46b5440a7ba123ae2a5b94d9 This commit from Chieh-Jan (Mike) Liang fixes the following issues: - Add a new command to reprogram the network (instead of motes automatically reprogram after they receive an image). - Update the documentation to reflect the new command. - Add README.txt files for the examples. --- diff --git a/apps/tests/deluge/Blink/README.txt b/apps/tests/deluge/Blink/README.txt new file mode 100644 index 00000000..4be92bc6 --- /dev/null +++ b/apps/tests/deluge/Blink/README.txt @@ -0,0 +1,38 @@ +README for apps/tests/deluge/Blink +Author/Contact: + +Chieh-Jan Mike Liang +Razvan Musaloiu-E. + +Description: + +This is a sample application referenced in the Deluge T2 manual to show +some of the basics in reprogramming. + +The burn script performs the following tasks on the basestation: + 1) Compile and load the program normally. + 2) Compile another version of blink that blinks differently. + 3) Upload the new blink to flash volume 0. + 4) Instruct the mote to reprogram with the new blink. + +Alternatively, you can reprogram the whole network (non-basestation +motes) by first uploading the image to the base station. Then, tell the +base station to disseminate the image. For example, + + tos-deluge /dev/ttyUSB0 telosb -d 0 + +Finally, after the image has been disseminated, instruct the base +station to disseminate the command to reprogram. For example, + + tos-deluge /dev/ttyUSB0 telosb -r 0 + +For a more detailed discussion on Deluge T2, please refer to the Deluge +T2 manual. + +Prerequisites: + +Python 2.4 with pySerial + +References: + +The Deluge T2 manual is available under $TOS_DIR/doc/html/. diff --git a/apps/tests/deluge/GoldenImage/README.txt b/apps/tests/deluge/GoldenImage/README.txt new file mode 100644 index 00000000..39dd3f59 --- /dev/null +++ b/apps/tests/deluge/GoldenImage/README.txt @@ -0,0 +1,32 @@ +README for apps/tests/deluge/GoldenImage +Author/Contact: + +Chieh-Jan Mike Liang +Razvan Musaloiu-E. + +Description: + +This is a sample application for Deluge T2. The application is similar +to Null, but it includes Deluge T2. + +You can reprogram the whole network (non-basestation motes) by first +uploading the image to the base station. Then, tell the base station to +disseminate the image. Example: + + tos-deluge /dev/ttyUSB0 telosb -d 0 + +Finally, after the image has been disseminated, instruct the base +station to disseminate the command to reprogram. Example: + + tos-deluge /dev/ttyUSB0 telosb -r 0 + +For a more detailed discussion on Deluge T2, please refer to the Deluge +T2 manual. + +Prerequisites: + +Python 2.4 with pySerial + +References: + +The Deluge T2 manual is available under $TOS_DIR/doc/html/. diff --git a/apps/tests/deluge/SerialBlink/README.txt b/apps/tests/deluge/SerialBlink/README.txt new file mode 100644 index 00000000..c5ea55bf --- /dev/null +++ b/apps/tests/deluge/SerialBlink/README.txt @@ -0,0 +1,32 @@ +README for apps/tests/deluge/SerialBlink +Author/Contact: + +Chieh-Jan Mike Liang +Razvan Musaloiu-E. + +Description: + +This is a sample application for Deluge T2. The program blinks and send +a serial msg every second. + +You can reprogram the whole network (non-basestation motes) by first +uploading the image to the base station. Then, tell the base station to +disseminate the image. Example: + + tos-deluge /dev/ttyUSB0 telosb -d 0 + +Finally, after the image has been disseminated, instruct the base +station to disseminate the command to reprogram. Example: + + tos-deluge /dev/ttyUSB0 telosb -r 0 + +For a more detailed discussion on Deluge T2, please refer to the Deluge +T2 manual. + +Prerequisites: + +Python 2.4 with pySerial + +References: + +The Deluge T2 manual is available under $TOS_DIR/doc/html/. diff --git a/doc/html/deluge-t2-manual.css b/doc/html/deluge-t2-manual.css index 02a6f88f..a443e35d 100644 --- a/doc/html/deluge-t2-manual.css +++ b/doc/html/deluge-t2-manual.css @@ -16,6 +16,8 @@ .title { font-size: 200%; font-weight: normal; + margin-top: 2.8em; + text-align: center; } .partheading { @@ -94,12 +96,6 @@ list-style-type: upper-alpha; } - /* - .verbatim { - color: #4d0000; - } - */ - tt i { font-family: serif; } @@ -108,9 +104,15 @@ font-family: serif; } + /* + .verbatim { + color: #4d0000; + } + */ + .scheme em { - font-family: serif; color: black; + font-family: serif; } .scheme { @@ -183,11 +185,11 @@ .colophon { color: gray; font-size: 80%; + font-style: italic; text-align: right; } .colophon a { color: gray; } - \ No newline at end of file diff --git a/doc/html/deluge-t2-manual.html b/doc/html/deluge-t2-manual.html index 2248f683..3dd87e3f 100644 --- a/doc/html/deluge-t2-manual.html +++ b/doc/html/deluge-t2-manual.html @@ -9,6 +9,8 @@ Deluge T2 - Programming Manual +
+

@@ -19,11 +21,11 @@ Deluge T2 - Programming Manual

-



Deluge T2 - Programming Manual

+

Deluge T2 - Programming Manual

Chieh-Jan Mike Liang
-Razvan Musaloiu-E.

June 21, 2007

+Razvan Musaloiu-E.

July 9, 2007

@@ -214,7 +216,7 @@ You should see something similar to the output below.

first test on the base station by issuing the reboot command. For example,

-
   % tos-deluge /dev/ttyUSB0 telosb -r 1
+
   % tos-deluge /dev/ttyUSB0 telosb -b 1
 

After a few moments, the mote will begin quickly flashing the LEDs to signify the reprogramming process.

@@ -225,10 +227,14 @@ the network. For example,
   % tos-deluge /dev/ttyUSB0 telosb -d 1
 

This command instructs the base station to notify the whole network of -the availablility of a new program image. This notification is currently +the availability of a new program image. This notification is currently done via TinyOS dissemination service, and it triggers all motes in the -network to get the new program image. Upon receiving the complete image -over-the-air, each node automatically reboots and reprograms itself.

+network to get the new program image. After all motes receive the image +over-the-air, you can instruct the base station to disseminate a command +to reprogram the network. For example, +

+
   % tos-deluge /dev/ttyUSB0 telosb -r 1
+

@@ -281,9 +287,8 @@ reprogram themselves.

directly connected mote.

-
-Last modified: Thursday, June 21st, 2007
-HTML conversion by TeX2page 2004-09-11
+

+
Last modified: Monday, July 9th, 2007 8:43:40pm
diff --git a/doc/pdf/deluge-t2-manual.pdf b/doc/pdf/deluge-t2-manual.pdf index 1dccd028..98025dd3 100644 Binary files a/doc/pdf/deluge-t2-manual.pdf and b/doc/pdf/deluge-t2-manual.pdf differ diff --git a/tools/tinyos/misc/tos-deluge b/tools/tinyos/misc/tos-deluge index 88e132b0..5a3c1bb6 100755 --- a/tools/tinyos/misc/tos-deluge +++ b/tools/tinyos/misc/tos-deluge @@ -47,11 +47,12 @@ SERIAL_AMID = 0xAB SERIAL_DATA_LENGTH = 28 - 1 - 1 - 2 - 2 # Serial message types -MSG_ERASE = 0 -MSG_WRITE = 1 -MSG_READ = 2 -MSG_REPROG = 5 -MSG_DISS = 6 +MSG_ERASE = 0 +MSG_WRITE = 1 +MSG_READ = 2 +MSG_REPROG = 5 +MSG_DISS = 6 +MSG_REPROG_BS = 7 ERROR_SUCCESS = 0 # T2-compatible ERROR_FAIL = 1 # T2-compatible @@ -320,12 +321,12 @@ def op_inject(s, img_num, tos_image_xml): return False -# Requests the mote to reboot and reprogram itself -def op_reprog(s, img_num): +# Requests the base station to reprogram itself +def op_reprog_bs(s, img_num): if getMetaData(s, img_num) == None: print "ERROR: No proper Deluge image found!" else: - sreqpkt = SerialReqPacket((MSG_REPROG, img_num, 0, 0, [])) + sreqpkt = SerialReqPacket((MSG_REPROG_BS, img_num, 0, 0, [])) success = s.write_packet(SERIAL_AMGROUP, SERIAL_AMID, sreqpkt.payload()) if success == True: packet = s.read_packet(SERIAL_AMGROUP, SERIAL_AMID) @@ -333,12 +334,27 @@ def op_reprog(s, img_num): if sreplypkt.error == ERROR_SUCCESS: return True else: - print "ERROR: Unable to reboot the mote" + print "ERROR: Unable to reprogram the base station" return False print "ERROR: Unable to send the command" return False +# Requests the network to reprogram with the specified image number +def op_reprog(s, img_num): + sreqpkt = SerialReqPacket((MSG_REPROG, img_num, 0, 0, [])) + success = s.write_packet(SERIAL_AMGROUP, SERIAL_AMID, sreqpkt.payload()) + if success == True: + packet = s.read_packet(SERIAL_AMGROUP, SERIAL_AMID) + sreplypkt = SerialReplyPacket(packet[1]) + if sreplypkt.error == ERROR_SUCCESS: + return True + else: + print "ERROR: Unable to reprogram the network" + return False + + print "ERROR: Unable to send the command" + # Requests the mote to disseminate an image def op_diss(s, img_num): if getMetaData(s, img_num) == None: @@ -386,7 +402,8 @@ def print_usage(): print " -p --ping\n Provide status of the image in the external flash" print " -i --inject\n Inject a compiled TinyOS application" print " [options]: tos_image.xml file path" - print " -r --reboot\n Reboot and reprogram the directly-connected mote" + print " -r --reprogram\n Reprogram the network" + print " -b --reprogram_bs\n Reprogram only the directly-connected mote" print " -d --dissemination\n Disseminate the image in the external flash to the network" print " -e --erase\n Erase an image in the external flash" print " -s --reset\n Reset the versioning information for a given image" @@ -415,9 +432,12 @@ if len(sys.argv) >= num_req_arg: elif sys.argv[3] in ["-i", "--inject"] and len(sys.argv) == (num_req_arg + 1): print "Pinging node ..." op_inject(s, sys.argv[4], sys.argv[5]) - elif sys.argv[3] in ["-r", "--reboot"]: + elif sys.argv[3] in ["-r", "--reprogram"]: if op_reprog(s, sys.argv[4]): print "Command sent" + elif sys.argv[3] in ["-b", "--reprogram_bs"]: + if op_reprog_bs(s, sys.argv[4]): + print "Command sent" elif sys.argv[3] in ["-d", "--dissemination"]: if op_diss(s, sys.argv[4]): print "Command sent" diff --git a/tos/lib/net/Deluge/Deluge.h b/tos/lib/net/Deluge/Deluge.h index c9ec9cbe..8a9f504f 100644 --- a/tos/lib/net/Deluge/Deluge.h +++ b/tos/lib/net/Deluge/Deluge.h @@ -29,12 +29,16 @@ #include "DelugeMetadata.h" +#define DISSMSG_DISS 0 +#define DISSMSG_REPROG 1 + enum { DELUGE_INVALID_UID = 0xffffffff, DELUGE_NUM_VOLUMES = 2, }; typedef nx_struct DelugeDissemination { + nx_uint8_t msg_type; nx_uint32_t uid; // unique id of image nx_uint16_t vNum; // version num of image nx_uint8_t imgNum; // image number diff --git a/tos/lib/net/Deluge/DelugeC.nc b/tos/lib/net/Deluge/DelugeC.nc index caea5305..4759e4da 100644 --- a/tos/lib/net/Deluge/DelugeC.nc +++ b/tos/lib/net/Deluge/DelugeC.nc @@ -37,7 +37,8 @@ implementation components SerialStarterC; components new FlashVolumeManagerC(0xAB); - DelugeP.ReprogNotify -> FlashVolumeManagerC; + DelugeP.DissNotify -> FlashVolumeManagerC.DissNotify; + DelugeP.ReprogNotify -> FlashVolumeManagerC.ReprogNotify; FlashVolumeManagerC.BlockRead[VOLUME_DELUGE0] -> DelugeStorageC.BlockRead[VOLUME_DELUGE0]; FlashVolumeManagerC.BlockWrite[VOLUME_DELUGE0] -> DelugeStorageC.BlockWrite[VOLUME_DELUGE0]; FlashVolumeManagerC.DelugeStorage[VOLUME_DELUGE0] -> DelugeStorageC.DelugeStorage[VOLUME_DELUGE0]; diff --git a/tos/lib/net/Deluge/DelugeMsgs.h b/tos/lib/net/Deluge/DelugeMsgs.h index 82b0b91e..449bcf1d 100644 --- a/tos/lib/net/Deluge/DelugeMsgs.h +++ b/tos/lib/net/Deluge/DelugeMsgs.h @@ -42,26 +42,26 @@ enum { }; typedef nx_struct DelugeAdvMsg { - nx_uint16_t sourceAddr; - nx_uint8_t version; // Deluge Version - nx_uint8_t type; + nx_uint16_t sourceAddr; + nx_uint8_t version; // Deluge Version + nx_uint8_t type; DelugeObjDesc objDesc; - nx_uint8_t reserved; + nx_uint8_t reserved; } DelugeAdvMsg; typedef nx_struct DelugeReqMsg { - nx_uint16_t dest; - nx_uint16_t sourceAddr; - nx_object_id_t objid; - nx_page_num_t pgNum; - nx_uint8_t requestedPkts[DELUGE_PKT_BITVEC_SIZE]; + nx_uint16_t dest; + nx_uint16_t sourceAddr; + nx_object_id_t objid; + nx_page_num_t pgNum; + nx_uint8_t requestedPkts[DELUGE_PKT_BITVEC_SIZE]; } DelugeReqMsg; typedef nx_struct DelugeDataMsg { nx_object_id_t objid; - nx_page_num_t pgNum; - nx_uint8_t pktNum; - nx_uint8_t data[DELUGE_PKT_PAYLOAD_SIZE]; + nx_page_num_t pgNum; + nx_uint8_t pktNum; + nx_uint8_t data[DELUGE_PKT_PAYLOAD_SIZE]; } DelugeDataMsg; #endif diff --git a/tos/lib/net/Deluge/DelugeP.nc b/tos/lib/net/Deluge/DelugeP.nc index d49bac41..8adcf1d6 100644 --- a/tos/lib/net/Deluge/DelugeP.nc +++ b/tos/lib/net/Deluge/DelugeP.nc @@ -39,6 +39,7 @@ module DelugeP interface SplitControl as RadioSplitControl; #ifdef DELUGE_BASESTATION + interface Notify as DissNotify; interface Notify as ReprogNotify; #endif } @@ -46,7 +47,7 @@ module DelugeP implementation { - uint8_t img_num; + //uint8_t img_num; /** * Starts the radio @@ -60,28 +61,42 @@ implementation /** * Starts disseminating image information */ - event void ReprogNotify.notify(uint8_t new_img_num) + event void DissNotify.notify(uint8_t new_img_num) { - DelugeDissemination delugeDis; - DelugeImgDesc *imgDesc; - - imgDesc = call DelugeMetadata.getImgDesc(new_img_num); + DelugeImgDesc* imgDesc = call DelugeMetadata.getImgDesc(new_img_num); if (imgDesc->uid != DELUGE_INVALID_UID) { + DelugeDissemination delugeDis; + call ObjectTransfer.stop(); call Leds.led0Toggle(); - img_num = new_img_num; delugeDis.uid = imgDesc->uid; delugeDis.vNum = imgDesc->vNum; - delugeDis.imgNum = img_num; + delugeDis.imgNum = new_img_num; delugeDis.size = imgDesc->size; + delugeDis.msg_type = DISSMSG_DISS; - call DisseminationUpdate.change(&delugeDis); // Disseminates image information + call DisseminationUpdate.change(&delugeDis); // Disseminates command call ObjectTransfer.publish(delugeDis.uid, delugeDis.size, delugeDis.imgNum); // Prepares to publish image data } } + + event void ReprogNotify.notify(uint8_t new_img_num) + { + DelugeDissemination delugeDis; + + call Leds.led2Toggle(); + + delugeDis.uid = 0; + delugeDis.vNum = 0; + delugeDis.imgNum = new_img_num; + delugeDis.size = 0; + delugeDis.msg_type = DISSMSG_REPROG; + + call DisseminationUpdate.change(&delugeDis); // Disseminates command + } #endif /** @@ -93,26 +108,39 @@ implementation const DelugeDissemination *delugeDis = call DisseminationValue.get(); DelugeImgDesc *imgDesc = call DelugeMetadata.getImgDesc(delugeDis->imgNum); - if (imgDesc->uid == delugeDis->uid) { - if (imgDesc->vNum < delugeDis->vNum) { - img_num = delugeDis->imgNum; // Note which image number to boot - call ObjectTransfer.receive(delugeDis->uid, delugeDis->size, delugeDis->imgNum); - } - } else { - img_num = delugeDis->imgNum; // Note which image number to boot - call ObjectTransfer.receive(delugeDis->uid, delugeDis->size, delugeDis->imgNum); + switch (delugeDis->msg_type) { + case DISSMSG_DISS: + if (imgDesc->uid == delugeDis->uid && imgDesc->uid != DELUGE_INVALID_UID) { + if (imgDesc->vNum < delugeDis->vNum) { + call ObjectTransfer.receive(delugeDis->uid, delugeDis->size, delugeDis->imgNum); + } + } else { + call ObjectTransfer.receive(delugeDis->uid, delugeDis->size, delugeDis->imgNum); + } + + break; + case DISSMSG_REPROG: + if (imgDesc->uid != DELUGE_INVALID_UID) { + DelugeNodeDesc nodeDesc; + call IFlash.read((uint8_t*)IFLASH_NODE_DESC_ADDR, + &nodeDesc, + sizeof(DelugeNodeDesc)); // Reads which image was just reprogrammed + if (nodeDesc.uid != imgDesc->uid || nodeDesc.vNum != imgDesc->vNum) { + call NetProg.programImgAndReboot(delugeDis->imgNum); + } + } + + break; } } - - /** - * Reboots and reprograms with the newly received image - */ + event void ObjectTransfer.receiveDone(error_t error) { + //call ObjectTransfer.publish(imgDesc->uid, imgDesc->size, imgDesc->imgNum); call ObjectTransfer.stop(); - if (error == SUCCESS) { - call NetProg.programImgAndReboot(img_num); - } +// if (error == SUCCESS) { +// call NetProg.programImgAndReboot(img_num); +// } } /** @@ -121,16 +149,16 @@ implementation event void RadioSplitControl.startDone(error_t error) { if (error == SUCCESS) { - // Start publishing the current image - DelugeImgDesc *imgDesc; - DelugeNodeDesc nodeDesc; - call IFlash.read((uint8_t*)IFLASH_NODE_DESC_ADDR, - &nodeDesc, - sizeof(DelugeNodeDesc)); // Reads which image was just reprogrammed - imgDesc = call DelugeMetadata.getImgDesc(nodeDesc.imgNum); - if (nodeDesc.uid == imgDesc->uid && imgDesc->uid != DELUGE_INVALID_UID) { - call ObjectTransfer.publish(imgDesc->uid, imgDesc->size, imgDesc->imgNum); - } +// // Start publishing the current image +// DelugeImgDesc *imgDesc; +// DelugeNodeDesc nodeDesc; +// call IFlash.read((uint8_t*)IFLASH_NODE_DESC_ADDR, +// &nodeDesc, +// sizeof(DelugeNodeDesc)); // Reads which image was just reprogrammed +// imgDesc = call DelugeMetadata.getImgDesc(nodeDesc.imgNum); +// if (nodeDesc.uid == imgDesc->uid && imgDesc->uid != DELUGE_INVALID_UID) { +// call ObjectTransfer.publish(imgDesc->uid, imgDesc->size, imgDesc->imgNum); +// } call StdControlDissemination.start(); } diff --git a/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManager.h b/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManager.h index 5c0a597c..9ca55a45 100644 --- a/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManager.h +++ b/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManager.h @@ -27,13 +27,14 @@ #ifndef FLASHVOLUMEMANAGER_H #define FLASHVOLUMEMANAGER_H -#define SERIALMSG_ERASE 0 -#define SERIALMSG_WRITE 1 -#define SERIALMSG_READ 2 -#define SERIALMSG_CRC 3 -#define SERIALMSG_ADDR 4 -#define SERIALMSG_REPROG 5 -#define SERIALMSG_DISS 6 +#define SERIALMSG_ERASE 0 +#define SERIALMSG_WRITE 1 +#define SERIALMSG_READ 2 +#define SERIALMSG_CRC 3 +#define SERIALMSG_ADDR 4 +#define SERIALMSG_REPROG 5 +#define SERIALMSG_DISS 6 +#define SERIALMSG_REPROG_BS 7 typedef nx_struct SerialReqPacket { nx_uint8_t msg_type; diff --git a/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerC.nc b/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerC.nc index 12e7779e..d1f9fbe7 100644 --- a/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerC.nc +++ b/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerC.nc @@ -30,7 +30,8 @@ generic configuration FlashVolumeManagerC(am_id_t AMId) { #ifdef DELUGE - provides interface Notify; + provides interface Notify as DissNotify; + provides interface Notify as ReprogNotify; #endif uses { interface BlockRead[uint8_t img_num]; @@ -63,6 +64,7 @@ implementation FlashVolumeManagerP.Timer -> TimerMilliC; FlashVolumeManagerP.DelugeStorage[VOLUME_DELUGE0] = DelugeStorage[VOLUME_DELUGE0]; FlashVolumeManagerP.DelugeStorage[VOLUME_DELUGE1] = DelugeStorage[VOLUME_DELUGE1]; - Notify = FlashVolumeManagerP.Notify; + DissNotify = FlashVolumeManagerP.DissNotify; + ReprogNotify = FlashVolumeManagerP.ReprogNotify; #endif } diff --git a/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc b/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc index 78cda769..216c00d2 100644 --- a/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc +++ b/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc @@ -29,7 +29,10 @@ generic module FlashVolumeManagerP() { #ifdef DELUGE - provides interface Notify; + provides { + interface Notify as DissNotify; + interface Notify as ReprogNotify; + } #endif uses { interface BlockRead[uint8_t img_num]; @@ -183,14 +186,18 @@ implementation (uint32_t)call DelugeStorage.getPhysicalAddress[img_num](0); sendReply(SUCCESS, sizeof(SerialReplyPacket) + 4); break; - case SERIALMSG_REPROG: // === Reboots and reprograms === + case SERIALMSG_REPROG_BS: // === Reprograms only the base station === state = S_REPROG; sendReply(SUCCESS, sizeof(SerialReplyPacket)); img_num_reboot = img_num; call Timer.startOneShot(1024); break; case SERIALMSG_DISS: // === Starts disseminating a volume === - signal Notify.notify(img_num); // Notifies Deluge to start disseminate + signal DissNotify.notify(img_num); // Notifies Deluge to start disseminate + sendReply(SUCCESS, sizeof(SerialReplyPacket)); + break; + case SERIALMSG_REPROG: // === Reprograms the network (except the base station) === + signal ReprogNotify.notify(img_num); sendReply(SUCCESS, sizeof(SerialReplyPacket)); break; #endif @@ -215,8 +222,10 @@ implementation call NetProg.programImgAndReboot(img_num_reboot); } - command error_t Notify.enable() { return SUCCESS; } - command error_t Notify.disable() { return SUCCESS; } + command error_t DissNotify.enable() { return SUCCESS; } + command error_t DissNotify.disable() { return SUCCESS; } + command error_t ReprogNotify.enable() { return SUCCESS; } + command error_t ReprogNotify.disable() { return SUCCESS; } default command storage_addr_t DelugeStorage.getPhysicalAddress[uint8_t img_num](storage_addr_t addr) { return 0; } #endif diff --git a/tos/lib/net/Deluge/ObjectTransferP.nc b/tos/lib/net/Deluge/ObjectTransferP.nc index ed9da3de..777a6cfa 100644 --- a/tos/lib/net/Deluge/ObjectTransferP.nc +++ b/tos/lib/net/Deluge/ObjectTransferP.nc @@ -112,6 +112,7 @@ implementation } else { call DelugePageTransfer.setWorkingPage(DELUGE_INVALID_OBJID, DELUGE_INVALID_PGNUM); state = S_SYNC; + call ObjectTransfer.stop(); call BlockWrite.sync[cont_receive_img_num](); } } @@ -209,7 +210,6 @@ implementation error_t error; call ObjectTransfer.stop(); - state = S_STOPPED; //call StatsCollector.startStatsCollector(); cont_receive_new_objid = new_objid; @@ -228,12 +228,13 @@ implementation { call Timer.stop(); call DelugePageTransfer.stop(); + state = S_STOPPED; //call StatsCollector.stopStatsCollector(); - state = S_STOPPED; curObjDesc.objid = DELUGE_INVALID_OBJID; curObjDesc.numPgs = DELUGE_INVALID_PGNUM; curObjDesc.numPgsComplete = DELUGE_INVALID_PGNUM; + advTimers.periodLog2 = 0; return SUCCESS; } @@ -248,6 +249,7 @@ implementation } else { call DelugePageTransfer.setWorkingPage(curObjDesc.objid, curObjDesc.numPgsComplete); state = S_SYNC; + call ObjectTransfer.stop(); call BlockWrite.sync[cont_receive_img_num](); } } @@ -256,9 +258,6 @@ implementation event void BlockWrite.syncDone[uint8_t img_num](error_t error) { if (state == S_SYNC) { - if (error != SUCCESS) { - call Leds.led2On(); - } post signalObjRecvDone(); } } @@ -317,7 +316,7 @@ implementation } event void Timer.fired() - { + { updateTimers(); if (advTimers.overheard == 0) { diff --git a/tos/lib/net/Deluge/extra/NetProgM.nc b/tos/lib/net/Deluge/extra/NetProgM.nc index ab122f4d..413abc00 100644 --- a/tos/lib/net/Deluge/extra/NetProgM.nc +++ b/tos/lib/net/Deluge/extra/NetProgM.nc @@ -122,6 +122,7 @@ implementation { 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