From e9bfab607e051bae6afb47b44892ce37541d1b44 Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Fri, 7 May 2010 14:42:29 -0600 Subject: [PATCH] Merge TinyOS 2.1.1 into master. How this merge was done: * Rebase patchset/2.1.0-4.2 onto tinyos/2.1.1 as topic/patchup211 * cp topic/patchup211 tree to tmp dir * Checkout master, rm all files, cp in from tmp dir, git add . Future work on TinyOS 2.1.0 w/TMI enhancements via release/2.1.0. --- apps/6lowpancli/CliAppC.nc | 86 - apps/6lowpancli/CliC.nc | 256 - apps/6lowpancli/Makefile | 12 - apps/6lowpancli/README | 42 - apps/AntiTheft/Nodes/AntiTheftC.nc | 4 +- apps/AntiTheft/Nodes/Makefile | 6 + apps/AntiTheft/Root/AntiTheftRootC.nc | 2 +- apps/AntiTheft/Root/Makefile | 6 + apps/BaseStation/BaseStationC.nc | 2 +- apps/BaseStation/Makefile | 1 + apps/BaseStation/README.txt | 2 +- apps/Blink/BlinkAppC.nc | 2 +- apps/IPBaseStation/BaseStationC.nc | 138 + apps/IPBaseStation/BaseStationP.nc | 448 + apps/IPBaseStation/Makefile | 39 + apps/IPBaseStation/README | 74 + apps/IPBaseStation/Reset.h | 59 + apps/IPBaseStation/Reset.nc | 47 + .../CrcP.nc => apps/IPBaseStation/ResetC.nc | 48 +- apps/MViz/MVizC.nc | 4 +- .../MultihopOscilloscopeC.nc | 2 +- apps/MultihopOscilloscope/oscilloscope.py | 30 + apps/Null/NullC.nc | 2 +- apps/Oscilloscope/OscilloscopeC.nc | 2 +- apps/Oscilloscope/java/Window.java | 432 +- apps/Oscilloscope/oscilloscope.py | 29 + apps/Powerup/PowerupC.nc | 2 +- apps/RadioCountToLeds/Makefile | 1 + apps/RadioSenseToLeds/RadioSenseToLedsC.nc | 2 +- apps/TCPEcho/HttpdP.nc | 152 + apps/TCPEcho/Makefile | 26 + apps/TCPEcho/README | 15 + apps/TCPEcho/TCPEchoC.nc | 65 + apps/TCPEcho/TCPEchoP.nc | 161 + apps/TCPEcho/UDPReport.h | 36 + apps/UDPEcho/Makefile | 30 + apps/UDPEcho/Makefile.local | 32 + .../NodeConnectivity/NodeConnectivity.nc | 28 + .../NodeConnectivity/TestbedConnectivityM.nc | 70 + .../createNodeConnectivityM.pl | 167 + apps/UDPEcho/NodeConnectivity/exampleMap.txt | 16 + apps/UDPEcho/NodeConnectivity/testBed.nss | 63 + apps/UDPEcho/NodeConnectivity/testBedMap.txt | 8 + apps/UDPEcho/README | 11 + apps/UDPEcho/UDPEchoC.nc | 78 + apps/UDPEcho/UDPEchoP.nc | 115 + apps/UDPEcho/UDPReport.h | 36 + apps/UDPEcho/tests/echotest.pl | 46 + apps/UDPEcho/tests/seqtest.pl | 50 + apps/UDPEcho/util/Listener.py | 22 + apps/UDPEcho/util/MySQLListener.py | 90 + apps/UDPEcho/util/UdpReport.py | 1452 +++ apps/UDPEcho/volumes-at45db.xml | 6 + apps/UDPEcho/volumes-stm25p.xml | 6 + apps/tests/NxFloat/.cvsignore | 4 + apps/tests/NxFloat/Makefile | 15 + apps/tests/NxFloat/README.txt | 29 + apps/tests/NxFloat/TestSerial.h | 13 + apps/tests/NxFloat/TestSerial.java | 106 + apps/tests/NxFloat/TestSerialAppC.nc | 67 + apps/tests/NxFloat/TestSerialC.nc | 130 + apps/tests/TestDhv/DhvInject.java | 71 + apps/tests/TestDhv/Makefile | 53 + apps/tests/TestDhv/README | 59 + apps/tests/TestDhv/TestDhv.h | 8 + apps/tests/TestDhv/TestDhvC-Master.nc | 29 + apps/tests/TestDhv/TestDhvC.nc | 284 + apps/tests/TestDhv/TestDhvP-Master.nc | 93 + apps/tests/TestDhv/TestDhvP.nc | 674 ++ apps/tests/TestDhv/TestDipP.nc | 674 ++ apps/tests/TestDhv/gentest.py | 61 + apps/tests/TestDip/Makefile | 7 + apps/tests/TestDip/README | 12 +- apps/tests/TestDip/TestDipC-Master.nc | 5 +- apps/tests/TestDip/TestDipP-Master.nc | 24 +- apps/tests/TestDissemination/Makefile | 2 + apps/tests/TestEui/Makefile | 4 + apps/tests/TestEui/README.txt | 23 + apps/tests/TestEui/TestEuiAppC.nc | 43 + apps/tests/TestEui/TestEuiC.nc | 63 + .../TestFtsp/{ => Ftsp}/FtspDataAnalyzer.m | 0 .../TestFtsp/{ => Ftsp}/FtspDataLogger.java | 0 apps/tests/TestFtsp/Ftsp/FtspDataLogger.py | 33 + apps/tests/TestFtsp/{ => Ftsp}/Makefile | 0 apps/tests/TestFtsp/Ftsp/README.MATLAB.txt | 46 + apps/tests/TestFtsp/{ => Ftsp}/README.txt | 0 apps/tests/TestFtsp/{ => Ftsp}/TestFtsp.h | 2 +- .../tests/TestFtsp/{ => Ftsp}/TestFtspAppC.nc | 0 apps/tests/TestFtsp/{ => Ftsp}/TestFtspC.nc | 0 apps/tests/TestFtsp/FtspLpl/FtspDataLogger.py | 33 + apps/tests/TestFtsp/FtspLpl/Makefile | 16 + apps/tests/TestFtsp/FtspLpl/README | 31 + apps/tests/TestFtsp/FtspLpl/TestFtsp.h | 49 + apps/tests/TestFtsp/FtspLpl/TestFtspAppC.nc | 66 + apps/tests/TestFtsp/FtspLpl/TestFtspC.nc | 120 + apps/tests/TestFtsp/FtspLpl/TestFtspMsg.py | 744 ++ apps/tests/TestFtsp/FtspLplBeaconer/Makefile | 7 + .../FtspLplBeaconer/RadioCountToLeds.h | 41 + .../FtspLplBeaconer/RadioCountToLedsAppC.nc | 74 + .../FtspLplBeaconer/RadioCountToLedsC.nc | 148 + apps/tests/TestLocalTime/README.txt | 3 + apps/tests/TestLocalTime/dump.py | 22 + apps/tests/TestLpl/README.txt | 10 +- apps/tests/TestLpl/TestLplAppC.nc | 4 +- apps/tests/TestLpl/TestLplC.nc | 16 +- apps/tests/TestNetwork/README.txt | 18 + apps/tests/TestNetwork/TestNetworkAppC.nc | 4 +- apps/tests/TestNetwork/TestNetworkC.nc | 32 +- apps/tests/TestNetworkLpl/Makefile | 73 + apps/tests/TestNetworkLpl/README.txt | 19 + .../TestNetworkLpl/TestNetworkLplAppC.nc | 68 + apps/tests/TestNetworkLpl/TestNetworkLplC.nc | 214 + apps/tests/TestNetworkLpl/ctp-dump.py | 49 + apps/tests/TestSerial/README.txt | 5 +- apps/tests/TestSerialBandwidth/Makefile | 1 + .../TestSerialBandwidth/TestSerialMsg.java | 318 - apps/tests/TestSimComm/README | 31 +- apps/tests/TestSimComm/run | 4 +- apps/tests/TestSimComm/test-asym.py | 2 +- apps/tests/TestSimComm/test-equal.py | 2 +- apps/tests/TestSimComm/test-unequal.py | 2 +- apps/tests/TestSimTimers/README | 6 +- .../TestTrickleTimer/TestTrickleTimerAppC.nc | 4 +- .../TestTrickleTimer/TestTrickleTimerAppP.nc | 11 +- apps/tests/TestTrickleTimer/test.py | 4 +- .../tests/arbiters/TestFcfsArbiter/README.txt | 2 +- .../TestFcfsArbiter/TestFcfsArbiterAppC.nc | 2 +- .../TestFcfsArbiter/TestFcfsArbiterC.nc | 2 +- .../arbiters/TestRoundRobinArbiter/README.txt | 2 +- .../TestRoundRobinArbiterAppC.nc | 2 +- .../TestRoundRobinArbiterC.nc | 2 +- .../cc2420/LplBroadcastCountToLeds/Makefile | 1 + .../RadioCountMsg.java | 158 - .../RadioCountToLedsAppC.nc | 2 +- .../RadioCountToLedsC.nc | 4 +- .../LplBroadcastPeriodicDelivery/README.txt | 3 + .../TestPeriodicAppC.nc | 2 +- .../TestPeriodicC.nc | 4 +- .../TestPeriodicAppC.nc | 2 +- .../TestPeriodicC.nc | 4 +- apps/tests/cc2420/RssiToSerial/Makefile | 2 +- apps/tests/cc2420/TestPacketLink/Makefile | 3 +- apps/tests/cc2420/TestPacketLink/README.txt | 2 +- .../TestSecurity/BaseStation/BaseStationC.nc | 92 + .../TestSecurity/BaseStation/BaseStationP.nc | 307 + .../cc2420/TestSecurity/BaseStation/Makefile | 8 + apps/tests/cc2420/TestSecurity/README.txt | 49 + .../TestSecurity/RadioCountToLeds1/Makefile | 8 + .../RadioCountToLeds1/RadioCountToLeds.h | 42 + .../RadioCountToLeds1/RadioCountToLedsAppC.nc | 64 + .../RadioCountToLeds1/RadioCountToLedsC.nc | 158 + apps/tests/cc2420/TxThroughput/Makefile | 3 +- .../deluge/Basestation/BasestationAppC.nc | 33 + apps/tests/deluge/Basestation/Makefile | 6 + apps/tests/deluge/Basestation/README.txt | 22 + .../deluge/Basestation/volumes-at45db.xml | 6 + .../deluge/Basestation/volumes-stm25p.xml | 6 + apps/tests/deluge/Blink/BlinkAppC.nc | 2 +- apps/tests/deluge/Blink/burn | 63 +- apps/tests/deluge/Blink/burn-net | 47 +- .../deluge/GoldenImage/GoldenImageAppC.nc | 3 + apps/tests/deluge/GoldenImage/Makefile | 3 +- apps/tests/deluge/GoldenImage/README.txt | 9 +- apps/tests/eyesIFX/RadioCountToFlash/Makefile | 1 + apps/tests/msp430/Adc12/TestAdcAppC.nc | 4 +- apps/tests/msp430/Adc12/TestAdcMultiC.nc | 16 +- apps/tests/msp430/Adc12/TestAdcSingleC.nc | 69 +- apps/tests/rf230/Ieee154CountToLeds/Makefile | 3 + .../Ieee154CountToLeds/RadioCountToLeds.h | 41 + .../RadioCountToLedsAppC.nc | 61 + .../Ieee154CountToLeds/RadioCountToLedsC.nc | 139 + apps/tests/rf230/RF230Sniffer/Makefile | 3 +- .../tests/rf230/RF230Sniffer/RF230SnifferC.nc | 31 +- .../tests/rf230/RF230Sniffer/RF230SnifferP.nc | 2 - apps/tests/rf230/RF230Test/RF230TestC.nc | 4 +- .../RadioCountToDiag/RadioCountToDiagC.nc | 4 +- .../RadioCountToDiag/RadioCountToDiagP.nc | 12 +- apps/tests/storage/Config/volumes-at45db.xml | 2 +- apps/tests/storage/Log/RandRWC.nc | 10 +- apps/tests/tkn154/Makefile.include | 8 +- apps/tests/tkn154/README.txt | 10 +- apps/tests/tkn154/TestAssociate/README.txt | 48 - apps/tests/tkn154/TestData/README.txt | 45 - .../tkn154/TestData/coordinator/Makefile | 3 - apps/tests/tkn154/TestIndirect/README.txt | 43 - apps/tests/tkn154/TestPromiscuous/Makefile | 5 - apps/tests/tkn154/TestStartSync/README.txt | 41 - .../tkn154/TestStartSync/coordinator/Makefile | 3 - .../beacon-enabled/TestAssociate/README.txt | 44 + .../TestAssociate/app_profile.h | 0 .../TestAssociate/coordinator/Makefile | 2 +- .../coordinator/TestAssociateAppC.nc | 20 +- .../TestAssociate/coordinator/TestCoordC.nc | 8 +- .../TestAssociate/device/Makefile | 4 + .../TestAssociate/device/TestAssociateAppC.nc | 24 +- .../TestAssociate/device/TestDeviceC.nc | 40 +- .../tkn154/beacon-enabled/TestData/README.txt | 47 + .../TestData/app_profile.h | 1 + .../TestData/coordinator}/Makefile | 2 +- .../coordinator/TestCoordReceiverC.nc | 3 +- .../TestData/coordinator/TestDataAppC.nc | 18 +- .../beacon-enabled/TestData/device/Makefile | 4 + .../TestData/device/TestDataAppC.nc | 26 +- .../TestData/device/TestDeviceSenderC.nc | 61 +- .../beacon-enabled/TestIndirect/README.txt | 43 + .../TestIndirect/app_profile.h | 0 .../TestIndirect/coordinator/Makefile | 2 +- .../coordinator/TestCoordSenderC.nc | 42 +- .../coordinator/TestIndirectAppC.nc | 18 +- .../TestIndirect/device/Makefile | 2 +- .../device/TestDeviceReceiverC.nc | 12 +- .../TestIndirect/device/TestIndirectAppC.nc | 20 +- .../beacon-enabled/TestStartSync/README.txt | 40 + .../TestStartSync/app_profile.h | 0 .../TestStartSync/coordinator/Makefile | 4 + .../TestStartSync/coordinator/TestCoordC.nc | 2 +- .../coordinator/TestStartSyncAppC.nc | 12 +- .../TestStartSync/device/Makefile | 2 +- .../TestStartSync/device/TestDeviceC.nc | 9 +- .../TestStartSync/device/TestStartSyncAppC.nc | 18 +- apps/tests/tkn154/makeall.sh | 26 + .../TestActiveScan/README.txt | 40 + .../TestActiveScan/app_profile.h | 38 +- .../TestActiveScan/coordinator/Makefile | 3 + .../coordinator/TestActiveScanCoordAppC.nc | 52 + .../coordinator/TestActiveScanCoordC.nc | 92 + .../TestActiveScan/device/Makefile | 3 + .../device/TestActiveScanDeviceAppC.nc | 59 + .../device/TestActiveScanDeviceC.nc | 125 + .../TestAssociate/README.txt | 44 + .../TestAssociate/app_profile.h | 45 + .../TestAssociate/coordinator}/Makefile | 2 +- .../coordinator/TestAssociateAppC.nc | 52 + .../TestAssociate/coordinator/TestCoordC.nc | 136 + .../TestAssociate/device/Makefile | 3 + .../TestAssociate/device/TestAssociateAppC.nc | 53 + .../TestAssociate/device/TestDeviceC.nc | 158 + .../TestIndirectData/README.txt | 42 + .../TestIndirectData/app_profile.h | 21 +- .../TestIndirectData/coordinator/Makefile | 3 + .../coordinator/TestIndirectDataCoordAppC.nc | 58 + .../coordinator/TestIndirectDataCoordC.nc | 151 + .../TestIndirectData/device/Makefile | 3 + .../device/TestIndirectDataDeviceAppC.nc | 54 + .../device/TestIndirectDataDeviceC.nc | 108 + .../TestPromiscuous/Makefile | 5 + .../TestPromiscuous/README.txt | 19 +- .../TestPromiscuous/TestPromiscuousAppC.nc | 16 +- .../TestPromiscuous/TestPromiscuousC.nc | 22 +- .../apps/BaseStation/BaseSendReceiveP.nc | 27 + .../apps/BaseStation/BaseStationAppC.nc | 35 +- .../apps/BaseStation/BaseStationC.nc | 27 + apps/tosthreads/apps/BaseStation/README | 2 +- apps/tosthreads/apps/Blink/BlinkAppC.nc | 6 + apps/tosthreads/apps/Blink/BlinkC.nc | 6 + apps/tosthreads/apps/Blink/README | 2 +- .../apps/Blink_DynamicThreads/BlinkAppC.nc | 45 + .../apps/Blink_DynamicThreads/BlinkC.nc | 73 + .../apps/Blink_DynamicThreads/Makefile | 3 + .../apps/Blink_DynamicThreads/README | 21 + apps/tosthreads/apps/Bounce/README | 2 +- apps/tosthreads/apps/RadioStress/README | 2 +- .../apps/TestBasicsbSensors/Makefile | 2 +- .../TestBasicsbSensorsAppC.nc | 18 +- .../TestBasicsbSensors/TestBasicsbSensorsC.nc | 1 + .../TestBlockStorage/TestBlockStorageAppC.nc | 12 + .../TestBlockStorage/TestBlockStorageP.nc | 12 + apps/tosthreads/apps/TestCollection/README | 10 +- .../apps/TestCollection/TestCollectionAppC.nc | 25 +- .../apps/TestCollection/TestCollectionC.nc | 25 +- apps/tosthreads/apps/TestJoin/Makefile | 3 + apps/tosthreads/apps/TestJoin/README | 32 + apps/tosthreads/apps/TestJoin/TestJoinAppC.nc | 67 + apps/tosthreads/apps/TestJoin/TestJoinC.nc | 90 + apps/tosthreads/apps/TestPrintf/README | 5 +- .../apps/TestPrintf/TestPrintfAppC.nc | 4 + .../tosthreads/apps/TestPrintf/TestPrintfC.nc | 4 + apps/tosthreads/apps/TestSineSensor/README | 2 +- .../apps/TestSineSensor/TestSineSensorAppC.nc | 7 + .../apps/TestSineSensor/TestSineSensorC.nc | 7 + .../capps/BaseStation/BaseStation.c | 27 +- apps/tosthreads/capps/BaseStation/README | 2 +- apps/tosthreads/capps/Blink/Blink.c | 6 + apps/tosthreads/capps/Blink/README | 2 +- apps/tosthreads/capps/Bounce/Bounce.c | 25 + apps/tosthreads/capps/Bounce/README | 2 +- apps/tosthreads/capps/Null/Null.c | 6 + apps/tosthreads/capps/Null/README | 7 +- apps/tosthreads/capps/RadioStress/README | 2 +- apps/tosthreads/capps/SenseAndSend/Makefile | 2 +- .../capps/SenseAndSend/SenseAndSend.c | 17 + .../SenseStoreAndForward.c | 28 + apps/tosthreads/capps/TestCollection/Makefile | 4 +- apps/tosthreads/capps/TestCollection/README | 25 +- .../capps/TestCollection/TestCollection.c | 52 +- apps/tosthreads/capps/TestJoin/Makefile | 3 + apps/tosthreads/capps/TestJoin/README | 32 + apps/tosthreads/capps/TestJoin/TestJoin.c | 96 + apps/tosthreads/capps/TestJoin/stack.h | 41 + apps/tosthreads/capps/TestLogStorage/Makefile | 4 +- apps/tosthreads/capps/TestLogStorage/README | 47 +- .../capps/TestLogStorage/TestLogStorage.c | 24 + apps/tosthreads/capps/TestPrintf/README | 4 +- apps/tosthreads/capps/TestPrintf/TestPrintf.c | 4 + apps/tosthreads/capps/TestSineSensor/README | 4 +- .../capps/TestSineSensor/TestSineSensor.c | 7 + apps/tosthreads/capps/ThreadStress/README | 2 +- .../capps/ThreadStress/ThreadStress.c | 12 + .../tinyld/LoadFromRAM/LoadFromRAMAppC.nc | 42 + .../tinyld/LoadFromRAM/LoadFromRAMP.nc | 143 + apps/tosthreads/tinyld/LoadFromRAM/Makefile | 17 + apps/tosthreads/tinyld/LoadFromRAM/README | 22 + .../tinyld/LoadFromRAM/volumes-at45db.xml | 3 + .../tinyld/LoadFromRAM/volumes-stm25p.xml | 3 + apps/tosthreads/tinyld/Makefile | 57 + apps/tosthreads/tinyld/SerialLoader/Makefile | 25 + apps/tosthreads/tinyld/SerialLoader/README | 33 + .../tinyld/SerialLoader/SerialLoader.h | 56 + .../tinyld/SerialLoader/SerialLoaderAppC.nc | 56 + .../tinyld/SerialLoader/SerialLoaderP.nc | 161 + .../tinyld/SerialLoader/serialloader.py | 232 + apps/tosthreads/tinyld/SerialLoader/tinyos.py | 223 + .../SerialLoaderFlash/FlashVolumeManager.h | 55 + .../SerialLoaderFlash/FlashVolumeManagerC.nc | 62 + .../SerialLoaderFlash/FlashVolumeManagerP.nc | 159 + .../tinyld/SerialLoaderFlash/Makefile | 22 + .../tinyld/SerialLoaderFlash/README | 34 + .../SerialLoaderFlashAppC.nc | 54 + .../tinyld/SerialLoaderFlash/serialloader.py | 229 + .../tinyld/SerialLoaderFlash/tinyos.py | 223 + .../SerialLoaderFlash/volumes-at45db.xml | 3 + .../SerialLoaderFlash/volumes-stm25p.xml | 3 + .../Base/LowPowerSensingBaseAppC.nc | 2 +- .../Base/LowPowerSensingBaseC.nc | 2 +- .../LowPowerSensingPeriodicSamplerAppC.nc | 2 +- .../LowPowerSensingPeriodicSamplerC.nc | 4 +- .../RssiDemo/RssiBase/RssiBaseAppC.nc | 4 +- doc/html/deluge-t2-manual.html | 312 - doc/html/tep102.html | 172 +- doc/html/tep109.html | 6 +- doc/html/tep112.html | 25 +- doc/html/tep115.html | 2 +- doc/html/tep116.html | 2 +- doc/html/tep118.html | 2 +- doc/html/tep119.html | 413 +- doc/html/tep121.html | 6 +- doc/html/tep123.html | 162 +- doc/html/tep124.html | 87 +- doc/html/tep125.html | 12 +- doc/html/tep131.html | 147 +- doc/html/tep132.html | 4 +- doc/html/tep133.html | 4 +- doc/html/tep134.html | 143 +- doc/html/tep135.html | 102 +- doc/html/tep136.html | 558 + doc/html/tep137.html | 563 + doc/html/tep2.html | 2 +- doc/html/tep4.html | 34 +- doc/pdf/deluge-t2-manual.pdf | Bin 49027 -> 0 bytes doc/stylesheets/deluge-t2-manual.css | 195 - doc/txt/tep109.txt | 5 +- doc/txt/tep112.txt | 23 +- doc/txt/tep119.txt | 434 +- doc/txt/tep123.txt | 106 +- doc/txt/tep124.txt | 73 +- doc/txt/tep135.txt | 19 +- doc/txt/tep136.txt | 291 + doc/txt/tep137.txt | 266 + doc/txt/tep3.txt | 4 +- doc/txt/tep4.txt | 4 +- licenses/INTEL-LICENSE.txt | 28 + overall-todo.txt | 119 - release-notes.txt | 20 + support/make/Makerules | 4 +- support/make/avr/avr-studio-debug.extra | 23 + support/make/avr/avr.rules | 25 +- support/make/avr/avrisp.extra | 2 +- support/make/avr/avrispmkii.extra | 31 + support/make/avr/mib510.extra | 3 + support/make/avr/xnp.extra | 9 - support/make/blip.extra | 33 + support/make/clean.target | 1 + support/make/cthreads.extra | 1 + support/make/dynthreads.extra | 7 + support/make/epic.target | 27 + support/make/epic/digi.extra | 1 + support/make/epic/epic.rules | 0 support/make/epic/miniprog.extra | 5 + support/make/iris.target | 5 - support/make/m16c62p/crt.S | 196 + support/make/m16c62p/debug.extra | 4 + support/make/m16c62p/debugopt.extra | 4 + support/make/m16c62p/install.extra | 10 + support/make/m16c62p/m16c.x | 176 + support/make/m16c62p/m16c62p.rules | 130 + support/make/m16c62p/reinstall.extra | 6 + support/make/m16c62p/sm16cf.extra | 27 + support/make/msp/msp.rules | 10 +- support/make/mulle.target | 50 + support/make/null/null.rules | 10 +- support/make/safe.extra | 2 +- support/make/shimmer.target | 34 +- support/make/shimmer2.target | 17 + support/make/sim.extra | 8 +- support/make/stack-check.extra | 3 + support/make/threads.extra | 17 +- support/make/tosboot.extra | 27 +- support/sdk/c/blip/Makefile.am | 3 + support/sdk/c/blip/bootstrap.sh | 3 + support/sdk/c/blip/configure.ac | 20 + support/sdk/c/blip/driver/Makefile.am | 19 + support/sdk/c/blip/driver/config.c | 121 + support/sdk/c/blip/driver/config.h | 43 + support/sdk/c/blip/driver/hashtable.c | 276 + support/sdk/c/blip/driver/hashtable.h | 199 + support/sdk/c/blip/driver/hashtable_private.h | 106 + support/sdk/c/blip/driver/logging.c | 107 + support/sdk/c/blip/driver/logging.h | 71 + support/sdk/c/blip/driver/mcast.c | 212 + support/sdk/c/blip/driver/mcast.h | 30 + support/sdk/c/blip/driver/netlink.c | 213 + support/sdk/c/blip/driver/netlink.h | 40 + support/sdk/c/blip/driver/nwstate.c | 630 ++ support/sdk/c/blip/driver/nwstate.h | 133 + support/sdk/c/blip/driver/radvd-1.0/CHANGES | 346 + support/sdk/c/blip/driver/radvd-1.0/COPYRIGHT | 37 + .../sdk/c/blip/driver/radvd-1.0/INTRO.html | 142 + .../sdk/c/blip/driver/radvd-1.0/Makefile.am | 63 + support/sdk/c/blip/driver/radvd-1.0/README | 61 + support/sdk/c/blip/driver/radvd-1.0/TODO | 59 + support/sdk/c/blip/driver/radvd-1.0/VERSION | 6 + .../sdk/c/blip/driver/radvd-1.0/config.guess | 1319 +++ .../sdk/c/blip/driver/radvd-1.0/config.h.in | 95 + .../sdk/c/blip/driver/radvd-1.0/config.sub | 1440 +++ .../sdk/c/blip/driver/radvd-1.0/configure.in | 157 + .../c/blip/driver/radvd-1.0/copyright.blurb | 14 + .../sdk/c/blip/driver/radvd-1.0/defaults.h | 226 + support/sdk/c/blip/driver/radvd-1.0/depcomp | 479 + .../c/blip/driver/radvd-1.0/device-bsd44.c | 251 + .../c/blip/driver/radvd-1.0/device-common.c | 101 + .../c/blip/driver/radvd-1.0/device-linux.c | 298 + support/sdk/c/blip/driver/radvd-1.0/gram.c | 2390 +++++ support/sdk/c/blip/driver/radvd-1.0/gram.h | 160 + support/sdk/c/blip/driver/radvd-1.0/gram.y | 621 ++ .../sdk/c/blip/driver/radvd-1.0/includes.h | 99 + .../sdk/c/blip/driver/radvd-1.0/install-sh | 251 + .../sdk/c/blip/driver/radvd-1.0/interface.c | 248 + support/sdk/c/blip/driver/radvd-1.0/log.c | 182 + support/sdk/c/blip/driver/radvd-1.0/missing | 336 + .../sdk/c/blip/driver/radvd-1.0/mkinstalldirs | 40 + .../sdk/c/blip/driver/radvd-1.0/pathnames.h | 48 + support/sdk/c/blip/driver/radvd-1.0/process.c | 454 + .../sdk/c/blip/driver/radvd-1.0/radvd.8.man | 173 + support/sdk/c/blip/driver/radvd-1.0/radvd.c | 638 ++ .../c/blip/driver/radvd-1.0/radvd.conf.5.man | 591 ++ .../blip/driver/radvd-1.0/radvd.conf.example | 116 + support/sdk/c/blip/driver/radvd-1.0/radvd.h | 225 + .../c/blip/driver/radvd-1.0/radvdump.8.man | 87 + .../sdk/c/blip/driver/radvd-1.0/radvdump.c | 477 + support/sdk/c/blip/driver/radvd-1.0/recv.c | 119 + support/sdk/c/blip/driver/radvd-1.0/scanner.c | 2398 +++++ support/sdk/c/blip/driver/radvd-1.0/scanner.l | 153 + support/sdk/c/blip/driver/radvd-1.0/send.c | 359 + support/sdk/c/blip/driver/radvd-1.0/socket.c | 107 + support/sdk/c/blip/driver/radvd-1.0/stamp-h | 1 + .../sdk/c/blip/driver/radvd-1.0/stamp-h.in | 0 support/sdk/c/blip/driver/radvd-1.0/timer.c | 204 + support/sdk/c/blip/driver/radvd-1.0/util.c | 65 + support/sdk/c/blip/driver/radvd-wrapper.c | 198 + support/sdk/c/blip/driver/routing.c | 425 + support/sdk/c/blip/driver/routing.h | 90 + support/sdk/c/blip/driver/serial_tun.c | 1501 +++ support/sdk/c/blip/driver/tun_dev.c | 212 + support/sdk/c/blip/driver/tun_dev.h | 64 + support/sdk/c/blip/driver/tunnel.c | 70 + support/sdk/c/blip/driver/vty/Makefile | 6 + support/sdk/c/blip/driver/vty/test_srv.c | 69 + support/sdk/c/blip/driver/vty/vty-util.c | 45 + support/sdk/c/blip/driver/vty/vty.c | 335 + support/sdk/c/blip/driver/vty/vty.h | 74 + support/sdk/c/blip/lib6lowpan/6lowpan.h | 190 + support/sdk/c/blip/lib6lowpan/IEEE154Packet.h | 49 + support/sdk/c/blip/lib6lowpan/Makefile.am | 8 + support/sdk/c/blip/lib6lowpan/TrackFlows.h | 68 + .../sdk/c/blip/lib6lowpan/blip-platform.h | 65 +- support/sdk/c/blip/lib6lowpan/devconf.h | 106 + support/sdk/c/blip/lib6lowpan/in_cksum.c | 222 + support/sdk/c/blip/lib6lowpan/in_cksum.h | 45 + support/sdk/c/blip/lib6lowpan/ip.h | 332 + support/sdk/c/blip/lib6lowpan/ip_malloc.c | 118 + support/sdk/c/blip/lib6lowpan/ip_malloc.h | 49 + support/sdk/c/blip/lib6lowpan/lib6lowpan.c | 346 + support/sdk/c/blip/lib6lowpan/lib6lowpan.h | 212 + .../sdk/c/blip/lib6lowpan/lib6lowpanFrag.c | 205 + support/sdk/c/blip/lib6lowpan/lib6lowpanIP.c | 678 ++ support/sdk/c/blip/lib6lowpan/nwbyte.h | 54 + support/sdk/c/blip/lib6lowpan/printpacket.c | 101 + support/sdk/c/blip/libtcp/Makefile | 20 + support/sdk/c/blip/libtcp/circ.c | 147 + support/sdk/c/blip/libtcp/circ.h | 48 + support/sdk/c/blip/libtcp/tcplib.c | 712 ++ support/sdk/c/blip/libtcp/tcplib.h | 206 + support/sdk/c/blip/libtcp/test_circ.c | 124 + support/sdk/c/blip/libtcp/test_server.c | 225 + support/sdk/c/blip/serial_tun.conf | 22 + support/sdk/c/sf/Makefile.am | 5 +- support/sdk/c/sf/message.c | 8 + support/sdk/c/sf/message.h | 5 + support/sdk/c/sf/serialsource.c | 151 +- support/sdk/c/sf/serialsource.h | 15 +- support/sdk/c/sf/sf.c | 1 + support/sdk/c/sf/sfsource.c | 2 +- support/sdk/cpp/sf/serialcomm.cpp | 333 +- support/sdk/cpp/sf/serialcomm.h | 33 +- support/sdk/cpp/sf/sfcontrol.cpp | 2 + support/sdk/cpp/sf/sfpacket.cpp | 1 + support/sdk/cpp/sf/tcpcomm.cpp | 3 +- support/sdk/java/net/tinyos/tools/.cvsignore | 1 + support/sdk/python/tos.py | 977 +- tinyos.sh | 2 +- tools/configure.ac | 2 +- tools/platforms/msp430/cppbsl/Makefile.in | 217 +- tools/platforms/msp430/cppbsl/aclocal.m4 | 679 +- tools/platforms/msp430/cppbsl/config.h.in | 67 + .../msp430/cppbsl/config/Makefile.in | 88 +- tools/platforms/msp430/cppbsl/configure | 6044 ++++++----- tools/platforms/msp430/cppbsl/configure.in | 17 +- tools/platforms/msp430/cppbsl/src/Makefile.in | 134 +- tools/platforms/msp430/cppbsl/src/Serial.cc | 50 +- .../platforms/msp430/pybsl/serial/__init__.py | 2 +- .../msp430/pybsl/serial/serialjava.py | 2 +- .../msp430/pybsl/serial/serialposix.py | 2 +- .../msp430/pybsl/serial/serialwin32.py | 2 +- tools/release/build-rpms | 52 +- tools/release/deputy.files | 11 + tools/release/deputy.spec | 44 + tools/release/external-tools/avarice.spec | 48 + tools/release/external-tools/avr-gcc.spec | 65 + tools/release/external-tools/avr-insight.spec | 47 + tools/release/external-tools/avr-libc.spec | 59 + tools/release/external-tools/binutils.spec | 73 + tools/release/external-tools/msp430-libc.spec | 76 + .../external-tools/xscale-elf.gcc.spec | 62 + tools/release/extractor | 5 +- tools/release/nesc.spec | 64 + tools/release/tinyos-tools.files | 21 +- tools/release/tinyos-tools.spec | 5 +- tools/release/tinyos.files | 62 +- tools/release/tinyos.filter | 49 - tools/release/tinyos.spec | 6 +- tools/tinyos/java/env/Makefile.am | 5 +- tools/tinyos/java/serial/Makefile.am | 5 +- tools/tinyos/misc/Makefile.am | 3 +- tools/tinyos/misc/tos-build-deluge-image | 5 +- tools/tinyos/misc/tos-deluge | 73 +- tools/tinyos/misc/tos-dump.py | 17 + tools/tinyos/misc/tos-nwprog | 308 + tools/tinyos/misc/tos-storage-at45db.1 | 4 +- tools/tinyos/misc/tos-storage-at45db.in | 29 +- tools/tinyos/misc/tos-storage-pxa27xp30.in | 14 +- tools/tinyos/misc/tos-storage-stm25p.in | 14 +- tools/tinyos/ncc/nesdoc-py/archive.py | 32 +- tools/tinyos/ncc/nesdoc.1 | 7 +- tools/tinyos/ncc/nesdoc.in | 2 +- tools/tinyos/safe/.cvsignore | 2 + tools/tinyos/safe/Makefile.am | 4 +- tools/tinyos/safe/tos-ramsize | 1710 +++ tools/tinyos/safe/tos-ramsize.1 | 16 + tools/tinyos/tosthreads/Makefile.am | 6 +- .../tosthreads/tosthreads-gen-dynamic-app | 85 + .../tosthreads/tosthreads-gen-dynamic-app.1 | 63 + .../tosthreads/tosthreads_standard_api.py | 7 +- .../tinyos/tosthreads/tosthreads_tenet_api.py | 59 - tos.mk | 2 +- tos/chips/atm128/Atm128Uart.h | 22 + tos/chips/atm128/atm128hardware.h | 19 +- tos/chips/atm128/i2c/Atm128I2C.h | 4 + .../atm128/i2c/Atm128I2CMasterPacketP.nc | 196 +- tos/chips/atm128/spi/Atm128SpiC.nc | 2 + tos/chips/atm128/spi/Atm128SpiP.nc | 34 + tos/chips/atm1281/McuSleepC.nc | 4 +- tos/chips/atm1281/atm128hardware.h | 18 + tos/chips/bq2403x/BQ2403X.h | 6 +- tos/chips/bq2403x/BQ2403X.nc | 6 +- tos/chips/bq2403x/BQ2403XC.nc | 6 +- tos/chips/bq2403x/BQ2403XP.nc | 8 +- tos/chips/cc1000/CC1000ActiveMessageC.nc | 13 +- tos/chips/cc1000/CC1000CsmaP.nc | 32 +- tos/chips/cc1000/CC1000CsmaRadioC.nc | 29 +- tos/chips/cc1000/CC1000Msg.h | 8 +- tos/chips/cc1000/CC1000SendReceiveP.nc | 121 +- .../CC1000TimeSyncMessage.h} | 5 +- tos/chips/cc1000/CC1000TimeSyncMessageC.nc | 87 + tos/chips/cc1000/CC1000TimeSyncMessageP.nc | 178 + tos/chips/cc1000/LowPowerListening.nc | 131 - tos/chips/cc1000/PacketTimeSyncOffset.nc | 63 + tos/chips/cc2420/CC2420.h | 46 +- tos/chips/cc2420/CC2420ActiveMessageC.nc | 64 +- tos/chips/cc2420/CC2420ActiveMessageP.nc | 45 +- tos/chips/cc2420/CC2420Ieee154MessageC.nc | 107 + tos/chips/cc2420/CC2420Ieee154MessageP.nc | 175 + tos/chips/cc2420/CC2420RadioC.nc | 108 + tos/chips/cc2420/CC2420TimeSyncMessage.h | 11 + tos/chips/cc2420/CC2420TimeSyncMessageC.nc | 25 +- tos/chips/cc2420/CC2420TimeSyncMessageP.nc | 126 +- tos/chips/cc2420/control/CC2420ControlP.nc | 2 +- tos/chips/cc2420/csma/CC2420CsmaP.nc | 6 +- tos/chips/cc2420/interfaces/CC2420Keys.nc | 33 + tos/chips/cc2420/interfaces/CC2420Packet.nc | 5 + .../cc2420/interfaces/CC2420SecurityMode.nc | 35 + tos/chips/cc2420/link/PacketLinkC.nc | 4 +- tos/chips/cc2420/link/PacketLinkDummyC.nc | 4 +- tos/chips/cc2420/link/PacketLinkP.nc | 2 +- .../cc2420/lowpan/CC2420TinyosNetworkC.nc | 31 +- .../cc2420/lowpan/CC2420TinyosNetworkP.nc | 170 +- tos/chips/cc2420/lpl/DefaultLpl.h | 8 - tos/chips/cc2420/lpl/DefaultLplC.nc | 8 +- tos/chips/cc2420/lpl/DefaultLplP.nc | 145 +- tos/chips/cc2420/lpl/DummyLplP.nc | 32 +- tos/chips/cc2420/lpl/PowerCycleC.nc | 1 - tos/chips/cc2420/lpl/PowerCycleP.nc | 3 +- tos/chips/cc2420/packet/CC2420PacketC.nc | 3 - tos/chips/cc2420/packet/CC2420PacketP.nc | 22 +- tos/chips/cc2420/receive/CC2420ReceiveC.nc | 9 + tos/chips/cc2420/receive/CC2420ReceiveP.nc | 405 +- tos/chips/cc2420/security/CC2420KeysC.nc | 46 + tos/chips/cc2420/security/CC2420KeysP.nc | 85 + tos/chips/cc2420/security/SecAMSenderC.nc | 59 + tos/chips/cc2420/security/SecAMSenderP.nc | 174 + tos/chips/cc2420/spi/CC2420SpiC.nc | 12 + tos/chips/cc2420/transmit/CC2420TransmitC.nc | 7 + tos/chips/cc2420/transmit/CC2420TransmitP.nc | 161 +- .../cc2420_tkn154/CC2420AsyncSplitControl.nc | 44 +- tos/chips/cc2420_tkn154/CC2420ControlP.nc | 113 +- .../cc2420_tkn154/CC2420ControlTransmitC.nc | 9 +- tos/chips/cc2420_tkn154/CC2420Power.nc | 10 +- tos/chips/cc2420_tkn154/CC2420Receive.nc | 2 +- tos/chips/cc2420_tkn154/CC2420ReceiveC.nc | 2 - tos/chips/cc2420_tkn154/CC2420ReceiveP.nc | 191 +- tos/chips/cc2420_tkn154/CC2420Rx.nc | 2 +- tos/chips/cc2420_tkn154/CC2420TKN154C.nc | 10 +- tos/chips/cc2420_tkn154/CC2420TKN154P.nc | 883 +- tos/chips/cc2420_tkn154/CC2420TransmitP.nc | 638 +- tos/chips/cc2420_tkn154/CC2420Tx.nc | 4 +- tos/chips/cc2420_tkn154/CaptureTime.nc | 16 +- tos/chips/cc2420_tkn154/ReferenceTime.nc | 6 +- tos/chips/cc2420_tkn154/ReliableWait.nc | 17 +- tos/chips/cc2420_tkn154/TKN154_PHY.h | 6 +- tos/chips/cc2420_tkn154/Timestamp.nc | 2 +- tos/chips/cp210x/CP210X.nc | 6 +- tos/chips/cp210x/CP210XC.nc | 6 +- tos/chips/cp210x/CP210XP.nc | 8 +- tos/chips/ds2401/CachedIeeeEui64P.nc | 47 + tos/chips/ds2401/Ds2401.h | 42 + tos/chips/ds2401/Ds2401ToIeeeEui64C.nc | 63 + tos/chips/ds2401/HplDs2401.nc | 38 + tos/chips/ds2401/HplDs2401C.nc | 66 + tos/chips/ds2401/OneWireMaster.nc | 69 + tos/chips/ds2401/OneWireMasterC.nc | 128 + tos/chips/ds2782/DS2782.h | 97 + tos/chips/ds2782/HplDS2782.nc | 210 + tos/chips/ds2782/HplDS2782LogicP.nc | 324 + tos/chips/m16c62p/McuSleepC.nc | 59 + tos/chips/m16c62p/McuSleepP.nc | 66 + tos/chips/m16c62p/adc/Adc.h | 23 + tos/chips/m16c62p/adc/AdcP.nc | 151 + tos/chips/m16c62p/adc/AdcReadClientC.nc | 40 + tos/chips/m16c62p/adc/AdcReadNowClientC.nc | 43 + tos/chips/m16c62p/adc/AdcReadStreamClientC.nc | 40 + tos/chips/m16c62p/adc/AdcStreamP.nc | 270 + tos/chips/m16c62p/adc/HplM16c62pAdc.nc | 165 + tos/chips/m16c62p/adc/HplM16c62pAdcC.nc | 43 + tos/chips/m16c62p/adc/HplM16c62pAdcP.nc | 160 + tos/chips/m16c62p/adc/M16c62pAdc.h | 168 + tos/chips/m16c62p/adc/M16c62pAdcC.nc | 69 + tos/chips/m16c62p/adc/M16c62pAdcConfig.nc | 42 + tos/chips/m16c62p/adc/M16c62pAdcMultiple.nc | 119 + tos/chips/m16c62p/adc/M16c62pAdcP.nc | 220 + tos/chips/m16c62p/adc/M16c62pAdcPlatform.nc | 6 + tos/chips/m16c62p/adc/M16c62pAdcSingle.nc | 81 + tos/chips/m16c62p/adc/WireAdcP.nc | 37 + tos/chips/m16c62p/adc/WireAdcStreamP.nc | 40 + tos/chips/m16c62p/bits.h | 74 + tos/chips/m16c62p/control/M16c62pControl.h | 79 + tos/chips/m16c62p/control/M16c62pControl.nc | 63 + tos/chips/m16c62p/control/M16c62pControlC.nc | 54 + tos/chips/m16c62p/control/M16c62pControlP.nc | 349 + .../m16c62p/control/M16c62pControlPlatform.nc | 57 + tos/chips/m16c62p/control/StopModeControl.nc | 52 + tos/chips/m16c62p/control/StopModeControlC.nc | 59 + .../m16c62p/control/SystemClockControl.nc | 50 + .../m16c62p/control/SystemClockControlC.nc | 59 + tos/chips/m16c62p/dac/HplM16c62pDac.nc | 35 + tos/chips/m16c62p/dac/HplM16c62pDacC.nc | 17 + tos/chips/m16c62p/dac/HplM16c62pDacP.nc | 41 + tos/chips/m16c62p/interrupts.h | 127 + tos/chips/m16c62p/iom16c62p.h | 2757 +++++ tos/chips/m16c62p/m16c62phardware.h | 197 + .../m16c62p/pins/HplM16c62pGeneralIOC.nc | 308 + .../m16c62p/pins/HplM16c62pGeneralIOPinP.nc | 88 + .../pins/HplM16c62pGeneralIOPinPRC2P.nc | 80 + .../m16c62p/pins/HplM16c62pGeneralIOPortP.nc | 103 + tos/chips/m16c62p/pins/HplM16c62pInterrupt.nc | 106 + .../m16c62p/pins/HplM16c62pInterruptC.nc | 104 + .../m16c62p/pins/HplM16c62pInterruptPinP.nc | 119 + .../m16c62p/pins/HplM16c62pInterruptSig.nc | 79 + .../m16c62p/pins/HplM16c62pInterruptSigP.nc | 115 + tos/chips/m16c62p/pins/M16c62pInterruptC.nc | 111 + tos/chips/m16c62p/pins/M16c62pPin.h | 60 + tos/chips/m16c62p/printf/elib.c | 491 + tos/chips/m16c62p/printf/m16c62p_printf.h | 481 + tos/chips/m16c62p/timer/HplM16c62pTimer.nc | 143 + .../m16c62p/timer/HplM16c62pTimerACtrl.nc | 72 + .../m16c62p/timer/HplM16c62pTimerACtrlP.nc | 131 + .../m16c62p/timer/HplM16c62pTimerBCtrl.nc | 61 + .../m16c62p/timer/HplM16c62pTimerBCtrlP.nc | 61 + tos/chips/m16c62p/timer/HplM16c62pTimerC.nc | 168 + .../m16c62p/timer/HplM16c62pTimerInterrupt.nc | 49 + .../timer/HplM16c62pTimerInterruptP.nc | 126 + tos/chips/m16c62p/timer/HplM16c62pTimerP.nc | 117 + tos/chips/m16c62p/timer/M16c62pAlarm16C.nc | 117 + tos/chips/m16c62p/timer/M16c62pAlarm32C.nc | 163 + tos/chips/m16c62p/timer/M16c62pCounter16C.nc | 71 + tos/chips/m16c62p/timer/M16c62pCounter32C.nc | 79 + tos/chips/m16c62p/timer/M16c62pTimer.h | 181 + tos/chips/m16c62p/timer/M16c62pTimerAInitC.nc | 107 + tos/chips/m16c62p/timer/M16c62pTimerBInitC.nc | 103 + tos/chips/m16c62p/uart/HplM16c62pUart.nc | 98 + tos/chips/m16c62p/uart/HplM16c62pUartC.nc | 145 + .../m16c62p/uart/HplM16c62pUartInterrupt.nc | 54 + .../m16c62p/uart/HplM16c62pUartInterruptP.nc | 89 + tos/chips/m16c62p/uart/HplM16c62pUartP.nc | 372 + tos/chips/m16c62p/uart/M16c62pUart.h | 72 + tos/chips/m16c62p/uart/M16c62pUartC.nc | 128 + tos/chips/m16c62p/uart/M16c62pUartP.nc | 377 + tos/chips/mma7261qt/HplMMA7261QT.h | 54 + tos/chips/mma7261qt/HplMMA7261QTControl.nc | 49 + tos/chips/mma7261qt/HplMMA7261QTControlC.nc | 56 + tos/chips/mma7261qt/HplMMA7261QTControlP.nc | 81 + tos/chips/mma7261qt/HplMMA7261QTReaderC.nc | 56 + tos/chips/msp430/McuSleepC.nc | 4 +- tos/chips/msp430/adc12/AdcStreamP.nc | 15 +- tos/chips/msp430/adc12/HplAdc12P.nc | 35 +- tos/chips/msp430/adc12/Msp430Adc12ImplP.nc | 28 +- .../msp430/adc12/Msp430Adc12MultiChannel.nc | 4 +- .../msp430/adc12/Msp430RefVoltGeneratorP.nc | 376 +- tos/chips/msp430/clock2/Msp430ClockP.nc | 10 +- tos/chips/msp430/msp430hardware.h | 21 +- .../msp430/pins/HplMsp430GeneralIORenP.nc | 6 +- tos/chips/msp430/timer/Msp430ClockC.nc | 3 +- tos/chips/msp430/timer/Msp430ClockP.nc | 4 + tos/chips/msp430/timer/Msp430TimerCapComP.nc | 2 +- tos/chips/msp430/usart/msp430usart.h | 30 + tos/chips/msp430/usci/AsyncConfigure.nc | 4 +- tos/chips/msp430/usci/HplMsp430UsciC.nc | 6 +- tos/chips/msp430/usci/HplMsp430UsciInt.nc | 6 +- tos/chips/msp430/usci/HplMsp430UsciInt0P.nc | 8 +- tos/chips/msp430/usci/HplMsp430UsciInt1P.nc | 8 +- tos/chips/msp430/usci/HplMsp430UsciReg.nc | 4 +- tos/chips/msp430/usci/HplMsp430UsciRegP.nc | 6 +- tos/chips/msp430/usci/Msp430SpiA0C.nc | 4 +- tos/chips/msp430/usci/Msp430SpiB0C.nc | 4 +- tos/chips/msp430/usci/Msp430SpiB1C.nc | 4 +- tos/chips/msp430/usci/Msp430SpiP.nc | 6 +- tos/chips/msp430/usci/Msp430UartA0C.nc | 4 +- tos/chips/msp430/usci/Msp430UartA1C.nc | 4 +- tos/chips/msp430/usci/Msp430UartP.nc | 6 +- tos/chips/msp430/usci/Msp430Usci.h | 6 +- tos/chips/msp430/usci/Msp430UsciA0C.nc | 6 +- tos/chips/msp430/usci/Msp430UsciA1C.nc | 6 +- tos/chips/msp430/usci/Msp430UsciB0C.nc | 6 +- tos/chips/msp430/usci/Msp430UsciB1C.nc | 6 +- .../msp430/usci/Msp430UsciIntDispatchP.nc | 6 +- .../pxa27x/cif/HplPXA27XQuickCaptIntM.nc | 13 +- tos/chips/pxa27x/cif/dmaArray.h | 2 +- tos/chips/pxa27x/i2c/HplPXA27xI2CP.nc | 12 +- tos/chips/pxa27x/ssp/HplPXA27xSSP2C.nc | 2 +- tos/chips/rf230/ActiveMessageLayerC.nc | 107 - tos/chips/rf230/IEEE154NetworkLayerP.nc | 87 - tos/chips/rf230/IEEE154PacketP.nc | 294 - tos/chips/rf230/RF230ActiveMessageC.nc | 146 - tos/chips/rf230/RF230LayerC.nc | 81 - tos/chips/rf230/RF230PacketP.nc | 291 - tos/chips/rf230/RF230TimeSyncMessageP.nc | 187 - tos/chips/rf2xx/README | 76 + tos/chips/rf2xx/layers/ActiveMessageConfig.nc | 53 + .../layers/ActiveMessageLayer.h} | 18 +- tos/chips/rf2xx/layers/ActiveMessageLayerC.nc | 61 + tos/chips/rf2xx/layers/ActiveMessageLayerP.nc | 258 + .../rf2xx/layers/AutoResourceAcquireLayerC.nc | 77 + .../{rf230 => rf2xx/layers}/CsmaConfig.nc | 0 .../{rf230 => rf2xx/layers}/CsmaLayerC.nc | 0 .../{rf230 => rf2xx/layers}/CsmaLayerP.nc | 0 .../{rf230 => rf2xx/layers}/DummyConfig.nc | 0 .../{rf230 => rf2xx/layers}/DummyLayerC.nc | 18 +- .../rf2xx/layers/Ieee154MessageLayerC.nc | 145 + .../layers/Ieee154PacketLayer.h} | 20 +- .../layers/Ieee154PacketLayer.nc} | 43 +- tos/chips/rf2xx/layers/Ieee154PacketLayerC.nc | 48 + tos/chips/rf2xx/layers/Ieee154PacketLayerP.nc | 285 + .../rf2xx/layers/LowPowerListeningConfig.nc | 38 + .../layers/LowPowerListeningDummyC.nc} | 30 +- .../rf2xx/layers/LowPowerListeningDummyP.nc | 38 + .../layers/LowPowerListeningLayer.h} | 20 +- .../layers}/LowPowerListeningLayerC.nc | 22 +- .../layers}/LowPowerListeningLayerP.nc | 153 +- .../layers}/MessageBufferLayerC.nc | 12 +- .../layers}/MessageBufferLayerP.nc | 75 +- tos/chips/rf2xx/layers/MetadataFlagsLayer.h | 33 + tos/chips/rf2xx/layers/MetadataFlagsLayerC.nc | 109 + tos/chips/rf2xx/layers/PacketLinkLayer.h | 33 + tos/chips/rf2xx/layers/PacketLinkLayerC.nc | 87 + tos/chips/rf2xx/layers/PacketLinkLayerP.nc | 255 + .../layers}/RandomCollisionConfig.nc | 0 .../layers}/RandomCollisionLayerC.nc | 0 .../layers}/RandomCollisionLayerP.nc | 0 .../layers}/SlottedCollisionConfig.nc | 6 - .../layers}/SlottedCollisionLayerC.nc | 2 +- .../layers}/SlottedCollisionLayerP.nc | 33 +- .../layers}/SoftwareAckConfig.nc | 11 +- .../layers}/SoftwareAckLayerC.nc | 7 +- .../layers}/SoftwareAckLayerP.nc | 30 +- tos/chips/rf2xx/layers/TimeStampingLayer.h | 32 + tos/chips/rf2xx/layers/TimeStampingLayerC.nc | 54 + tos/chips/rf2xx/layers/TimeStampingLayerP.nc | 135 + tos/chips/rf2xx/layers/TimeSyncMessageLayer.h | 49 + .../rf2xx/layers/TimeSyncMessageLayerC.nc | 87 + .../rf2xx/layers/TimeSyncMessageLayerP.nc | 266 + tos/chips/rf2xx/layers/TinyosNetworkLayer.h | 36 + tos/chips/rf2xx/layers/TinyosNetworkLayerC.nc | 220 + .../layers}/TrafficMonitorConfig.nc | 6 - .../layers}/TrafficMonitorLayerC.nc | 2 +- .../layers}/TrafficMonitorLayerP.nc | 11 +- .../{rf230 => rf2xx/layers}/UniqueConfig.nc | 0 .../{rf230 => rf2xx/layers}/UniqueLayerC.nc | 4 +- .../{rf230 => rf2xx/layers}/UniqueLayerP.nc | 18 +- tos/chips/rf2xx/rf212/README | 38 + tos/chips/rf2xx/rf212/RF212ActiveMessageC.nc | 91 + .../rf212/RF212DriverConfig.nc} | 40 +- tos/chips/rf2xx/rf212/RF212DriverLayer.h | 180 + tos/chips/rf2xx/rf212/RF212DriverLayerC.nc | 106 + tos/chips/rf2xx/rf212/RF212DriverLayerP.nc | 978 ++ tos/chips/rf2xx/rf212/RF212Ieee154MessageC.nc | 87 + .../rf212/RF212Radio.h} | 61 +- tos/chips/rf2xx/rf212/RF212RadioC.nc | 256 + tos/chips/rf2xx/rf212/RF212RadioP.nc | 335 + .../rf212/RF212TimeSyncMessageC.nc} | 48 +- tos/chips/rf2xx/rf230/README | 56 + tos/chips/rf2xx/rf230/RF230ActiveMessageC.nc | 91 + tos/chips/rf2xx/rf230/RF230DriverConfig.nc | 55 + tos/chips/rf2xx/rf230/RF230DriverHwAckC.nc | 126 + tos/chips/rf2xx/rf230/RF230DriverHwAckP.nc | 1019 ++ .../rf230/RF230DriverLayer.h} | 28 +- tos/chips/rf2xx/rf230/RF230DriverLayerC.nc | 106 + .../rf230/RF230DriverLayerP.nc} | 336 +- tos/chips/rf2xx/rf230/RF230Ieee154MessageC.nc | 87 + .../rf230/RF230Radio.h} | 52 +- tos/chips/rf2xx/rf230/RF230RadioC.nc | 277 + .../rf230/RF230RadioP.nc} | 183 +- .../rf2xx/rf230/RF230TimeSyncMessageC.nc | 75 + tos/chips/rf2xx/util/BareReceive.nc | 32 + tos/chips/rf2xx/util/BareSend.nc | 54 + tos/chips/rf2xx/util/MetadataFlagC.nc | 37 + .../{rf230 => rf2xx/util}/Neighborhood.h | 0 .../{rf230 => rf2xx/util}/Neighborhood.nc | 0 .../{rf230 => rf2xx/util}/NeighborhoodC.nc | 0 .../{rf230 => rf2xx/util}/NeighborhoodFlag.nc | 0 .../util}/NeighborhoodFlagC.nc | 0 .../{rf230 => rf2xx/util}/NeighborhoodP.nc | 0 .../{rf230 => rf2xx/util}/PacketField.nc | 0 tos/chips/rf2xx/util/PacketFlag.nc | 45 + tos/chips/{rf230 => rf2xx/util}/RadioAlarm.nc | 0 .../{rf230 => rf2xx/util}/RadioAlarmC.nc | 2 +- .../{rf230 => rf2xx/util}/RadioAlarmP.nc | 2 +- tos/chips/{rf230 => rf2xx/util}/RadioAssert.h | 2 +- tos/chips/{rf230 => rf2xx/util}/RadioCCA.nc | 0 tos/chips/rf2xx/util/RadioChannel.nc | 43 + tos/chips/rf2xx/util/RadioPacket.nc | 60 + .../{rf230 => rf2xx/util}/RadioReceive.nc | 0 tos/chips/{rf230 => rf2xx/util}/RadioSend.nc | 0 tos/chips/{rf230 => rf2xx/util}/RadioState.nc | 5 + tos/chips/{rf230 => rf2xx/util}/Tasklet.h | 2 +- tos/chips/{rf230 => rf2xx/util}/Tasklet.nc | 0 tos/chips/{rf230 => rf2xx/util}/TaskletC.nc | 0 tos/chips/scp1000/Scp1000.h | 6 +- tos/chips/scp1000/Scp1000C.nc | 6 +- tos/chips/scp1000/Scp1000P.nc | 6 +- tos/chips/sht11/SensirionBusyWaitC.nc | 6 +- tos/chips/stm25p/Stm25pLogP.nc | 8 +- tos/chips/tda5250/mac/CsmaMacC.nc | 13 +- tos/chips/tda5250/mac/CsmaMacP.nc | 287 +- tos/chips/tda5250/mac/RedMacP.nc | 9 +- tos/chips/tda5250/mac/SpeckMacDP.nc | 9 +- tos/chips/xe1205/XE1205SendReceiveP.nc | 4 +- tos/chips/xe1205/phy/XE1205PhyP.nc | 6 +- .../HplRF230.nc => interfaces/FastSpiByte.nc} | 42 +- tos/interfaces/Ieee154Packet.nc | 43 + tos/interfaces/Ieee154Send.nc | 114 + tos/interfaces/LocalIeeeEui64.nc | 38 + tos/interfaces/LowPowerListening.nc | 96 +- tos/interfaces/ResourceQueue.nc | 10 +- tos/interfaces/SystemLowPowerListening.nc | 8 + tos/interfaces/UartControl.nc | 120 + tos/lib/byte_radio/PacketSerializerP.nc | 302 +- tos/lib/diagmsg/DiagMsgC.nc | 10 +- tos/lib/diagmsg/{DiagMsgM.nc => DiagMsgP.nc} | 44 +- tos/lib/ftsp/TimeSync32kC.nc | 16 +- tos/lib/ftsp/TimeSyncC.nc | 7 +- tos/lib/ftsp/TimeSyncMsg.h | 2 +- tos/lib/ftsp/TimeSyncP.nc | 15 +- tos/lib/mac/tkn154/AssociateP.nc | 219 +- tos/lib/mac/tkn154/BeaconRequestRxP.nc | 172 + tos/lib/mac/tkn154/BeaconSynchronizeP.nc | 633 +- tos/lib/mac/tkn154/BeaconTransmitP.nc | 659 +- tos/lib/mac/tkn154/CapP.nc | 753 -- tos/lib/mac/tkn154/CoordBroadcastP.nc | 28 +- tos/lib/mac/tkn154/CoordRealignmentP.nc | 29 +- tos/lib/mac/tkn154/DataP.nc | 40 +- tos/lib/mac/tkn154/DebugC.nc | 48 + tos/lib/mac/tkn154/DebugP.nc | 169 + tos/lib/mac/tkn154/DisassociateP.nc | 254 + .../{CapQueueP.nc => DispatchQueueP.nc} | 69 +- tos/lib/mac/tkn154/DispatchSlottedCsmaP.nc | 764 ++ tos/lib/mac/tkn154/DispatchUnslottedCsmaP.nc | 533 + tos/lib/mac/tkn154/IndirectTxP.nc | 167 +- tos/lib/mac/tkn154/PibP.nc | 335 +- tos/lib/mac/tkn154/PollP.nc | 67 +- tos/lib/mac/tkn154/PromiscuousModeP.nc | 150 + tos/lib/mac/tkn154/README.txt | 62 +- tos/lib/mac/tkn154/RadioClientC.nc | 44 +- ...eDispatchImplP.nc => RadioControlImplP.nc} | 160 +- .../{FrameDispatchP.nc => RadioControlP.nc} | 57 +- tos/lib/mac/tkn154/RxEnableP.nc | 220 +- tos/lib/mac/tkn154/ScanP.nc | 347 +- .../SimpleRoundRobinTransferArbiterC.nc | 98 - tos/lib/mac/tkn154/SimpleTransferArbiterP.nc | 44 +- tos/lib/mac/tkn154/TKN154.h | 33 +- .../{TKN154P.nc => TKN154BeaconEnabledP.nc} | 354 +- tos/lib/mac/tkn154/TKN154NonBeaconEnabledP.nc | 357 + tos/lib/mac/tkn154/TKN154_DEBUG.h | 231 - tos/lib/mac/tkn154/TKN154_MAC.h | 131 +- tos/lib/mac/tkn154/TKN154_PIB.h | 163 +- tos/lib/mac/tkn154/TransferClientP.nc | 76 - tos/lib/mac/tkn154/dummies/NoAssociateP.nc | 131 + .../tkn154/dummies/NoBeaconSynchronizeP.nc | 99 +- .../mac/tkn154/dummies/NoBeaconTransmitP.nc | 102 +- .../mac/tkn154/dummies/NoCoordBroadcastP.nc | 85 + tos/lib/mac/tkn154/dummies/NoCoordCfpP.nc | 49 +- .../mac/tkn154/dummies/NoCoordRealignmentP.nc | 99 + tos/lib/mac/tkn154/dummies/NoDeviceCfpP.nc | 48 +- tos/lib/mac/tkn154/dummies/NoDisassociateP.nc | 113 + .../{NoCapQueueP.nc => NoDispatchQueueP.nc} | 34 +- .../{NoCapP.nc => NoDispatchSlottedCsmaP.nc} | 93 +- .../mac/tkn154/dummies/NoPromiscuousModeP.nc | 80 + tos/lib/mac/tkn154/dummies/NoRxEnableP.nc | 86 + tos/lib/mac/tkn154/dummies/NoScanP.nc | 23 +- .../mac/tkn154/interfaces/MCPS/MCPS_DATA.nc | 47 +- .../mac/tkn154/interfaces/MCPS/MCPS_PURGE.nc | 12 +- .../tkn154/interfaces/MLME/MLME_ASSOCIATE.nc | 15 +- .../interfaces/MLME/MLME_BEACON_NOTIFY.nc | 22 +- .../interfaces/MLME/MLME_COMM_STATUS.nc | 8 + .../interfaces/MLME/MLME_DISASSOCIATE.nc | 12 +- .../mac/tkn154/interfaces/MLME/MLME_GET.nc | 19 +- .../mac/tkn154/interfaces/MLME/MLME_GTS.nc | 7 + .../mac/tkn154/interfaces/MLME/MLME_ORPHAN.nc | 6 + .../mac/tkn154/interfaces/MLME/MLME_POLL.nc | 6 + .../mac/tkn154/interfaces/MLME/MLME_RESET.nc | 17 +- .../tkn154/interfaces/MLME/MLME_RX_ENABLE.nc | 6 + .../mac/tkn154/interfaces/MLME/MLME_SCAN.nc | 6 + .../mac/tkn154/interfaces/MLME/MLME_SET.nc | 16 +- .../mac/tkn154/interfaces/MLME/MLME_START.nc | 10 +- .../mac/tkn154/interfaces/MLME/MLME_SYNC.nc | 8 + .../tkn154/interfaces/MLME/MLME_SYNC_LOSS.nc | 7 + .../interfaces/private/EnergyDetection.nc | 10 +- .../mac/tkn154/interfaces/private/FrameRx.nc | 3 +- .../mac/tkn154/interfaces/private/FrameTx.nc | 6 +- .../tkn154/interfaces/private/FrameTxNow.nc | 6 +- .../mac/tkn154/interfaces/private/RadioOff.nc | 22 +- .../mac/tkn154/interfaces/private/RadioRx.nc | 69 +- .../mac/tkn154/interfaces/private/RadioTx.nc | 166 +- .../interfaces/private/ResourceTransfer.nc | 58 - .../private/ResourceTransferConnector.nc | 38 - .../private/ResourceTransferControl.nc | 38 - .../interfaces/private/ResourceTransferred.nc | 46 - .../interfaces/private/SlottedCsmaCa.nc | 117 + .../interfaces/private/SuperframeStructure.nc | 115 + .../private/TransferableResource.nc | 136 + .../interfaces/private/UnslottedCsmaCa.nc | 90 + .../interfaces/public/IEEE154BeaconFrame.nc | 6 +- .../tkn154/interfaces/public/IEEE154Frame.nc | 20 +- .../public/IEEE154TxBeaconPayload.nc | 58 +- tos/lib/net/4bitle/LinkEstimator.h | 7 +- tos/lib/net/4bitle/LinkEstimatorP.nc | 168 +- .../BlockStorageManagerC.nc | 2 +- .../BlockStorageManagerP.nc | 10 +- tos/lib/net/Deluge/Deluge.h | 2 +- tos/lib/net/Deluge/DelugeMetadataP.nc | 7 +- tos/lib/net/Deluge/DelugeP.nc | 2 +- tos/lib/net/Deluge/DelugePageTransfer.h | 6 +- .../FlashVolumeManager/FlashVolumeManagerP.nc | 6 +- tos/lib/net/Deluge/ObjectTransferC.nc | 4 +- tos/lib/net/Deluge/extra/NetProgC.nc | 12 +- tos/lib/net/Deluge/extra/NetProgM.nc | 7 +- .../net/Deluge/extra/epic/TOSBoot_platform.h | 38 + tos/lib/net/Deluge/extra/iris/NetProgC.nc | 4 +- .../Deluge/extra/m16c62p/HplM16c62pFlash.nc | 71 + .../Deluge/extra/m16c62p/HplM16c62pFlashC.nc | 241 + .../Deluge/extra/m16c62p/InternalFlashC.nc | 52 + .../Deluge/extra/m16c62p/InternalFlashP.nc | 83 + .../net/Deluge/extra/m16c62p/M16c62pFlash.h | 65 + .../net/Deluge/extra/msp430/InternalFlashC.nc | 2 - .../net/Deluge/extra/mulle/NetProg_platform.h | 58 + .../net/Deluge/extra/mulle/ReprogramGuardC.nc | 11 + .../net/Deluge/extra/mulle/ReprogramGuardP.nc | 22 + .../net/Deluge/extra/mulle/TOSBoot_platform.h | 15 + .../net/Deluge/extra/telos/ReprogramGuardC.nc | 13 + .../net/Deluge/extra/telos/ReprogramGuardP.nc | 23 + .../tinynode/NetProg_platform.h} | 20 +- tos/lib/net/Deluge/extra/tinynode/README | 15 + .../Deluge/extra/tinynode/ReprogramGuardC.nc | 13 + .../Deluge/extra/tinynode/ReprogramGuardP.nc | 18 + .../Deluge/extra/tinynode/TOSBoot_platform.h | 38 + tos/lib/net/TrickleTimerImplP.nc | 50 +- tos/lib/net/blip/ICMP.h | 106 + tos/lib/net/blip/ICMPResponderC.nc | 57 + tos/lib/net/blip/ICMPResponderP.nc | 446 + tos/lib/net/blip/IPAddressC.nc | 37 + tos/lib/net/blip/IPAddressP.nc | 109 + tos/lib/net/blip/IPDispatch.h | 243 + tos/lib/net/blip/IPDispatchC.nc | 125 + tos/lib/net/blip/IPDispatchP.nc | 1073 ++ tos/lib/net/blip/IPExtensionP.nc | 144 + tos/lib/net/blip/IPExtensionsP.nc | 33 + tos/lib/net/blip/IPRoutingP.nc | 1421 +++ tos/lib/net/blip/PrintfUART.h | 368 + tos/lib/net/blip/ReadLqiC.nc | 30 + tos/lib/net/blip/ResourceSendP.nc | 62 + tos/lib/net/blip/Statistics.h | 88 + tos/lib/net/blip/TcpC.nc | 17 + tos/lib/net/blip/TcpP.nc | 154 + tos/lib/net/blip/TcpSocketC.nc | 11 + tos/lib/net/blip/TrackFlowsC.nc | 16 + tos/lib/net/blip/TrackFlowsP.nc | 140 + tos/lib/net/blip/UdpC.nc | 16 + tos/lib/net/blip/UdpP.nc | 199 + tos/lib/net/blip/UdpSocketC.nc | 9 + tos/lib/net/blip/doc/README | 94 + tos/lib/net/blip/doc/README-IP | 56 + tos/lib/net/blip/doc/README-MERAKI | 53 + tos/lib/net/blip/doc/README-NWPROG | 70 + tos/lib/net/blip/doc/README-SHELL | 55 + tos/lib/net/blip/doc/README-SIM | 43 + tos/lib/net/blip/doc/README-TCP | 101 + tos/lib/net/blip/doc/README-UDP | 70 + tos/lib/net/blip/interfaces/ICMP.nc | 37 + tos/lib/net/blip/interfaces/ICMPPing.nc | 12 + tos/lib/net/blip/interfaces/IP.nc | 27 + tos/lib/net/blip/interfaces/IPAddress.nc | 37 + tos/lib/net/blip/interfaces/IPExtensions.nc | 19 + tos/lib/net/blip/interfaces/IPRouting.nc | 91 + .../blip/interfaces/InternalIPExtension.nc | 8 + tos/lib/net/blip/interfaces/ReadLqi.nc | 4 + tos/lib/net/blip/interfaces/Statistics.nc | 36 + tos/lib/net/blip/interfaces/TLVHeader.nc | 9 + tos/lib/net/blip/interfaces/Tcp.nc | 55 + tos/lib/net/blip/interfaces/UDP.nc | 27 + tos/lib/net/blip/nwprog/BootImage.nc | 8 + tos/lib/net/blip/nwprog/Deluge.h | 126 + tos/lib/net/blip/nwprog/DelugePatch.nc | 14 + tos/lib/net/blip/nwprog/DelugePatchC.nc | 60 + tos/lib/net/blip/nwprog/DelugePatchClientC.nc | 40 + tos/lib/net/blip/nwprog/DelugePatchP.nc | 244 + tos/lib/net/blip/nwprog/DelugeReadIdent.nc | 20 + tos/lib/net/blip/nwprog/DelugeReadIdentC.nc | 51 + .../net/blip/nwprog/DelugeReadIdentClientC.nc | 40 + tos/lib/net/blip/nwprog/DelugeReadIdentP.nc | 147 + tos/lib/net/blip/nwprog/DelugeVerify.nc | 14 + tos/lib/net/blip/nwprog/DelugeVerifyC.nc | 60 + .../net/blip/nwprog/DelugeVerifyClientC.nc | 40 + tos/lib/net/blip/nwprog/DelugeVerifyP.nc | 161 + tos/lib/net/blip/nwprog/NWProgC.nc | 51 + tos/lib/net/blip/nwprog/NWProgP.nc | 339 + tos/lib/net/blip/platform/CC2420ReadLqiC.nc | 15 + tos/lib/net/blip/platform/RF230ReadLqiC.nc | 15 + tos/lib/net/blip/serial/SerialDevConf.h | 29 + tos/lib/net/blip/serial/SerialDevConfC.nc | 69 + .../blip/serial/SerialPacketInfoDevConfP.nc | 57 + tos/lib/net/blip/shell/FlashShellC.nc | 14 + tos/lib/net/blip/shell/FlashShellP.nc | 46 + .../net/blip/shell/RegisterShellCommand.nc | 4 + tos/lib/net/blip/shell/Shell.h | 29 + tos/lib/net/blip/shell/ShellCommand.nc | 25 + tos/lib/net/blip/shell/ShellCommandC.nc | 14 + tos/lib/net/blip/shell/ShellCommandP.nc | 8 + tos/lib/net/blip/shell/UDPShellC.nc | 47 + tos/lib/net/blip/shell/UDPShellP.nc | 291 + tos/lib/net/blip/table.c | 52 + tos/lib/net/blip/table.h | 37 + tos/lib/net/ctp/CompareBit.nc | 8 +- tos/lib/net/ctp/Ctp.h | 1 + tos/lib/net/ctp/CtpForwardingEngine.h | 36 +- tos/lib/net/ctp/CtpForwardingEngineP.nc | 704 +- tos/lib/net/ctp/CtpInfo.nc | 6 +- tos/lib/net/ctp/CtpP.nc | 5 +- tos/lib/net/ctp/CtpRoutingEngineP.nc | 53 +- tos/lib/net/ctp/CtpRoutingPacket.nc | 2 +- tos/lib/net/dhv/AMDhvC.nc | 46 + tos/lib/net/dhv/AMDhvP.nc | 158 + tos/lib/net/dhv/Dhv.h | 123 + tos/lib/net/dhv/DhvDataC.nc | 44 + tos/lib/net/dhv/DhvDataP.nc | 127 + tos/lib/net/dhv/DhvHSumC.nc | 29 + tos/lib/net/dhv/DhvHSumP.nc | 89 + tos/lib/net/dhv/DhvLogicC.nc | 84 + tos/lib/net/dhv/DhvLogicP.nc | 402 + tos/lib/net/dhv/DhvSummaryC.nc | 32 + tos/lib/net/dhv/DhvSummaryP.nc | 79 + tos/lib/net/dhv/DhvTrickleMilliC.nc | 62 + tos/lib/net/dhv/DhvTrickleMilliP.nc | 120 + tos/lib/net/dhv/DhvVBitC.nc | 35 + tos/lib/net/dhv/DhvVBitP.nc | 221 + tos/lib/net/dhv/DhvVectorC.nc | 35 + tos/lib/net/dhv/DhvVectorP.nc | 163 + tos/lib/net/dhv/DhvVersionC.nc | 29 + tos/lib/net/dhv/DhvVersionP.nc | 321 + tos/lib/net/dhv/DisseminationC.nc | 11 + tos/lib/net/dhv/DisseminatorC.nc | 77 + tos/lib/net/dhv/DisseminatorP.nc | 109 + tos/lib/net/dhv/README | 29 + tos/lib/net/dhv/interfaces/DhvCache.nc | 12 + tos/lib/net/dhv/interfaces/DhvDecision.nc | 6 + tos/lib/net/dhv/interfaces/DhvEstimates.nc | 15 + tos/lib/net/dhv/interfaces/DhvHelp.nc | 15 + tos/lib/net/dhv/interfaces/DhvLogic.nc | 9 + tos/lib/net/dhv/interfaces/DhvNeighbour.nc | 5 + tos/lib/net/dhv/interfaces/DhvReceive.nc | 4 + tos/lib/net/dhv/interfaces/DhvSend.nc | 6 + tos/lib/net/dhv/interfaces/DhvStateLogic.nc | 12 + tos/lib/net/dhv/interfaces/DhvTrickleTimer.nc | 90 + tos/lib/net/dhv/interfaces/DhvVersion.nc | 7 + tos/lib/net/dip/AMDipC.nc | 4 - tos/lib/net/dip/AMDipP.nc | 16 - tos/lib/net/dip/Dip.h | 16 +- tos/lib/net/dip/DipLogicP.nc | 2 + tos/lib/net/dip/DipSummaryP.nc | 30 +- tos/lib/net/dip/DipVersionP.nc | 3 + tos/lib/net/dip/README | 2 +- tos/lib/net/le/LinkEstimatorP.nc | 6 +- tos/lib/net/tymo/ForwardingEngineM.nc | 2 + tos/lib/net/tymo/LinkMonitor.nc | 4 +- tos/lib/net/tymo/dymo/DymoTableM.nc | 7 + tos/lib/net/tymo/mh/MHPacketM.nc | 2 +- .../AssociationExample/AssociationExample.nc | 61 - .../AssociationExample/AssociationExampleC.nc | 61 + ...tionExampleM.nc => AssociationExampleP.nc} | 2 +- .../zigbee/apps/AssociationExample/Makefile | 2 +- .../apps/DataSendExample/DataSendExample.nc | 60 - .../apps/DataSendExample/DataSendExampleC.nc | 60 + ...ataSendExampleM.nc => DataSendExampleP.nc} | 2 +- .../net/zigbee/apps/DataSendExample/Makefile | 2 +- .../GTSManagementExample.nc | 61 - .../GTSManagementExampleC.nc | 61 + ...ntExampleM.nc => GTSManagementExampleP.nc} | 2 +- .../zigbee/apps/GTSManagementExample/Makefile | 2 +- .../zigbee/apps/SimpleRoutingExample/Makefile | 2 +- .../SimpleRoutingExample.nc | 61 - .../SimpleRoutingExampleC.nc | 61 + ...ngExampleM.nc => SimpleRoutingExampleP.nc} | 2 +- tos/lib/net/zigbee/apps/Test_APL/Makefile | 35 +- tos/lib/net/zigbee/apps/Test_APL/Test_APL.nc | 68 - tos/lib/net/zigbee/apps/Test_APL/Test_APLC.nc | 75 + .../Test_APL/{Test_APLM.nc => Test_APLP.nc} | 45 +- tos/lib/net/zigbee/cc2420/CC2420Config.nc | 103 + tos/lib/net/zigbee/cc2420/CC2420ReceiveP.nc | 2 +- .../includes/{PrintfUART.h => printfUART.h} | 2 +- .../zigbee/ieee802154/mac/{Mac.nc => MacC.nc} | 66 +- .../ieee802154/mac/{MacM.nc => MacP.nc} | 6 +- .../ieee802154/macTDBS/{Mac.nc => MacC.nc} | 68 +- .../ieee802154/macTDBS/{MacM.nc => MacP.nc} | 21 +- .../ieee802154/macTDBS/mac_enumerations.h | 9 +- tos/lib/net/zigbee/ieee802154/nwk/Makefile | 2 +- tos/lib/net/zigbee/ieee802154/nwk/NWK.nc | 111 - tos/lib/net/zigbee/ieee802154/nwk/NWKC.nc | 141 + .../ieee802154/nwk/{NWKM.nc => NWKP.nc} | 98 +- tos/lib/net/zigbee/ieee802154/nwk/nwk_const.h | 2 +- .../zigbee/ieee802154/phy/{Phy.nc => PhyC.nc} | 40 +- .../ieee802154/phy/{PhyM.nc => PhyP.nc} | 2 +- tos/lib/net/zigbee/readme.txt | 19 +- tos/lib/net/zigbee/wrapper/WrapperC.nc | 94 + tos/lib/net/zigbee/wrapper/WrapperP.nc | 602 ++ .../zigbee/wrapper/includes/frame_format.h | 220 + .../net/zigbee/wrapper/includes/mac_const.h | 225 + .../wrapper/includes/mac_enumerations.h | 118 + .../net/zigbee/wrapper/includes/mac_func.h | 384 + .../net/zigbee/wrapper/includes/nwk_func.h | 141 + .../net/zigbee/wrapper/includes/phy_const.h | 32 + .../wrapper/includes/phy_enumerations.h | 33 + .../net/zigbee/wrapper/includes/printfUART.h | 336 + .../interfaces/mac/OPENZB_MCPS_DATA.nc | 19 + .../interfaces/mac/OPENZB_MCPS_PURGE.nc | 16 + .../interfaces/mac/OPENZB_MLME_ASSOCIATE.nc | 22 + .../mac/OPENZB_MLME_BEACON_NOTIFY.nc | 17 + .../mac/OPENZB_MLME_DISASSOCIATE.nc | 18 + .../wrapper/interfaces/mac/OPENZB_MLME_GET.nc | 16 + .../wrapper/interfaces/mac/OPENZB_MLME_GTS.nc | 17 + .../interfaces/mac/OPENZB_MLME_ORPHAN.nc | 18 + .../interfaces/mac/OPENZB_MLME_POLL.nc | 17 + .../interfaces/mac/OPENZB_MLME_RESET.nc | 20 + .../interfaces/mac/OPENZB_MLME_RX_ENABLE.nc | 20 + .../interfaces/mac/OPENZB_MLME_SCAN.nc | 19 + .../wrapper/interfaces/mac/OPENZB_MLME_SET.nc | 17 + .../interfaces/mac/OPENZB_MLME_START.nc | 19 + .../interfaces/mac/OPENZB_MLME_SYNC.nc | 17 + .../interfaces/mac/OPENZB_MLME_SYNC_LOSS.nc | 15 + tos/lib/power/DeferredPowerManagerP.nc | 18 +- tos/lib/printf/PrintfP.nc | 11 +- tos/lib/printf/generic_printf.h | 482 + tos/lib/printf/printf.h | 11 +- tos/lib/safe/SafeFailureHandlerC.nc | 13 + tos/lib/safe/SafeFailureHandlerP.nc | 143 + tos/lib/safe/avr/fail.c | 184 - tos/lib/safe/include/deputy/checks.h | 2 +- tos/lib/safe/msp430/fail.c | 152 - tos/lib/serial/SerialActiveMessageP.nc | 5 + tos/lib/serial/SerialDispatcherP.nc | 5 +- tos/lib/timer/VirtualizeAlarmC.nc | 2 +- tos/lib/tosboot/Makefile | 27 +- tos/lib/tosboot/{TOSBoot.h => TosBoot.h} | 0 tos/lib/tosboot/{TOSBoot.nc => TosBootC.nc} | 34 +- tos/lib/tosboot/{TOSBootM.nc => TosBootP.nc} | 18 +- tos/lib/tosboot/at45db/ExtFlashC.nc | 11 + tos/lib/tosboot/avr/InternalFlashC.nc | 2 +- .../avr/{ProgFlashM.nc => ProgFlashC.nc} | 2 +- .../epic/ExtFlashC.nc} | 28 +- tos/lib/tosboot/epic/ExtFlashP.nc | 98 + tos/lib/tosboot/epic/hardware.h | 86 + .../iris/{ProgFlashM.nc => ProgFlashC.nc} | 2 +- tos/lib/tosboot/m16c62p/HardwareC.nc | 72 + tos/lib/tosboot/m16c62p/ProgFlashC.nc | 53 + tos/lib/tosboot/m16c62p/ProgFlashP.nc | 113 + tos/lib/tosboot/micaz/TOSBoot_platform.h | 12 +- tos/lib/tosboot/micaz/hardware.h | 6 + .../msp430/{HPLUSART0M.nc => HplUsart0C.nc} | 24 +- ...{HPLUSARTControl.nc => HplUsartControl.nc} | 4 +- tos/lib/tosboot/msp430/InternalFlashC.nc | 2 - .../msp430/{ProgFlashM.nc => ProgFlashC.nc} | 2 +- .../{telosb => msp430f1611}/PluginC.nc | 8 +- .../PowerOffM.nc => msp430f1611/PowerOffC.nc} | 2 +- .../TOSBoot_platform.h | 12 +- tos/lib/tosboot/mulle/ExecC.nc | 61 + tos/lib/tosboot/mulle/PluginC.nc | 54 + tos/lib/tosboot/mulle/VoltageC.nc | 58 + tos/lib/tosboot/mulle/hardware.h | 88 + tos/lib/tosboot/mulle/m16chardware.h | 123 + tos/lib/tosboot/stm25p/ExtFlashC.nc | 12 +- .../stm25p/{ExtFlashM.nc => ExtFlashP.nc} | 28 +- .../InternalFlash.nc => tinynode/ExecC.nc} | 30 +- tos/lib/tosboot/tinynode/ExtFlashC.nc | 160 + tos/lib/tosboot/tinynode/PowerOffC.nc | 89 + tos/lib/tosboot/tinynode/README | 15 + tos/lib/tosboot/tinynode/TOSBoot_platform.h | 43 + .../tinynode/VoltageC.nc} | 51 +- tos/lib/tosboot/tinynode/hardware.h | 84 + tos/lib/tossim/CpmModelC.nc | 56 +- tos/lib/tossim/GainRadioModel.nc | 1 + tos/lib/tossim/HilTimerMilliC.nc | 173 - tos/lib/tossim/TOSSIM.py | 394 +- tos/lib/tossim/TossimPacketModelC.nc | 1 + tos/lib/tossim/tossim.c | 6 +- tos/lib/tossim/tossim.i | 4 +- tos/lib/tossim/tossim_wrap.cxx | 9251 ++++++++++++----- .../chips/cc2420/CC2420ActiveMessageC.nc | 66 +- .../chips/cc2420/CC2420ActiveMessageP.nc | 53 +- .../BlockingMsp430InternalTemperatureC.nc | 67 + .../sensors/BlockingMsp430InternalVoltageC.nc | 66 + .../chips/rf230/ActiveMessageLayerC.nc | 112 +- .../chips/rf230/ActiveMessageLayerP.nc | 272 + .../chips/rf230/RF230ActiveMessageC.nc | 141 +- tos/lib/tosthreads/chips/rf230/RF230RadioC.nc | 266 + tos/lib/tosthreads/csystem/CAMRadioC.nc | 5 - tos/lib/tosthreads/csystem/CAMRadioP.nc | 48 +- tos/lib/tosthreads/csystem/CAMSerialC.nc | 4 - tos/lib/tosthreads/csystem/CAMSerialP.nc | 46 +- tos/lib/tosthreads/csystem/CBlockStorageP.nc | 10 +- tos/lib/tosthreads/csystem/CConfigStorageC.nc | 39 + tos/lib/tosthreads/csystem/CConfigStorageP.nc | 59 + tos/lib/tosthreads/csystem/CLedsP.nc | 22 +- tos/lib/tosthreads/csystem/CLinkedListP.nc | 40 +- tos/lib/tosthreads/csystem/CLogStorageP.nc | 16 +- tos/lib/tosthreads/csystem/CQueueC.nc | 14 +- tos/lib/tosthreads/csystem/CRandomC.nc | 35 + tos/lib/tosthreads/csystem/CRandomP.nc | 46 + tos/lib/tosthreads/csystem/CThreadP.nc | 13 +- .../csystem/CThreadSynchronizationP.nc | 38 +- tos/lib/tosthreads/csystem/TosThreadApiC.nc | 4 + tos/lib/tosthreads/csystem/VolumeMapC.nc | 6 + tos/lib/tosthreads/csystem/VolumeMapP.nc | 74 + tos/lib/tosthreads/csystem/tosthread.h | 13 + .../csystem/tosthread_configstorage.h | 39 + tos/lib/tosthreads/csystem/tosthread_random.h | 36 + tos/lib/tosthreads/csystem/tosthread_tenet.h | 39 - .../tosthreads/interfaces/BlockingConfig.nc | 36 + .../tosthreads/interfaces/BlockingMount.nc | 52 + .../tosthreads/interfaces/DynamicThread.nc | 13 + tos/lib/tosthreads/interfaces/Thread.nc | 1 + tos/lib/tosthreads/interfaces/ThreadInfo.nc | 1 + .../tosthreads/interfaces/ThreadScheduler.nc | 1 + .../lib/net/BlockingCollectionControlC.nc | 8 +- .../lib/net/BlockingCollectionControlP.nc | 45 +- tos/lib/tosthreads/lib/net/CCollectionId.nc | 30 + .../BlockingCollectionSenderImplP.nc | 0 .../{ => ctp}/BlockingCollectionSenderP.nc | 0 .../tosthreads/lib/net/ctp/CCollectionC.nc | 12 +- .../tosthreads/lib/net/ctp/CCollectionIdP.nc | 52 + .../lib/net/{ => ctp}/CCollectionP.nc | 48 +- tos/lib/tosthreads/lib/net/ctp/ccollection.h | 46 + .../lib/net/lqi/BlockingCollectionSenderC.nc | 2 +- .../net/lqi/BlockingCollectionSenderImplP.nc | 116 + .../lib/net/lqi/BlockingCollectionSenderP.nc | 57 + .../tosthreads/lib/net/lqi/CCollectionC.nc | 13 +- .../tosthreads/lib/net/lqi/CCollectionIdP.nc | 52 + .../tosthreads/lib/net/lqi/CCollectionP.nc | 124 + tos/lib/tosthreads/lib/net/lqi/ccollection.h | 46 + .../tosthreads/lib/net/tosthread_collection.h | 7 +- .../lib/serial/SerialActiveMessageC.nc | 64 + .../lib/serial/SerialActiveMessageP.nc | 197 + tos/lib/tosthreads/lib/tinyld/BigCrc.nc | 4 + tos/lib/tosthreads/lib/tinyld/BigCrcC.nc | 12 + tos/lib/tosthreads/lib/tinyld/BigCrcP.nc | 44 + tos/lib/tosthreads/lib/tinyld/DynamicLoader.h | 52 + .../tosthreads/lib/tinyld/DynamicLoader.nc | 35 + .../tosthreads/lib/tinyld/DynamicLoaderC.nc | 63 + .../tosthreads/lib/tinyld/DynamicLoaderP.nc | 471 + .../tosthreads/lib/tinyld/LoadSourceMapC.nc | 46 + .../tosthreads/lib/tinyld/LoadSourceMapP.nc | 105 + .../tosthreads/lib/tinyld/MemoryStorageC.nc | 40 + .../tosthreads/lib/tinyld/MemoryStorageP.nc | 56 + .../tosthreads/lib/tinyld/NullVolumeMapC.nc | 18 + .../tinyld/PMManager.nc} | 10 +- tos/lib/tosthreads/lib/tinyld/PMManagerC.nc | 44 + tos/lib/tosthreads/lib/tinyld/PMManagerP.nc | 139 + .../tosthreads/lib/tinyld/TosThreadApiC.nc | 100 + tos/lib/tosthreads/lib/tinyld/UserButton.nc | 4 + tos/lib/tosthreads/lib/tinyld/UserButtonC.nc | 48 + tos/lib/tosthreads/lib/tinyld/UserButtonP.nc | 77 + tos/lib/tosthreads/lib/tinyld/slcs_types.h | 75 + .../lib/tinyld/tosthread_slcs_types.h | 102 + .../platforms/epic/ActiveMessageC.nc | 82 + .../tosthreads/platforms/epic/TelosSerialP.nc | 23 + .../platforms/iris/ActiveMessageC.nc | 54 +- .../sensorboards/basicsb/CPhotoP.nc | 4 +- .../tosthreads/sensorboards/basicsb/CTempP.nc | 4 +- .../tmote_onboard/CHamamatsuS10871TsrC.nc | 2 + .../tmote_onboard/CHamamatsuS10871TsrP.nc | 18 +- .../tmote_onboard/CHamamatsuS1087ParC.nc | 2 + .../tmote_onboard/CHamamatsuS1087ParP.nc | 18 +- .../tmote_onboard/CSensirionSht11C.nc | 2 + .../tmote_onboard/CSensirionSht11P.nc | 24 +- .../sensorboards/universal/CSineSensorP.nc | 2 +- .../tosthreads/system/BlockingAMReceiverC.nc | 2 - .../system/BlockingAMReceiverImplP.nc | 2 +- .../tosthreads/system/BlockingAMSenderC.nc | 2 - .../system/BlockingAMSenderImplP.nc | 36 +- .../tosthreads/system/BlockingAMSnooperC.nc | 2 - .../system/BlockingActiveMessageC.nc | 11 +- .../system/BlockingConfigStorageC.nc | 49 + .../system/BlockingConfigStorageImplP.nc | 233 + .../system/BlockingConfigStorageP.nc | 54 + .../system/BlockingLogStorageImplP.nc | 10 + .../tosthreads/system/BlockingResourceC.nc | 4 +- .../tosthreads/system/BlockingResourceP.nc | 33 +- tos/lib/tosthreads/system/BlockingSendC.nc | 47 + .../tosthreads/system/BlockingSendImplP.nc | 100 + tos/lib/tosthreads/system/BlockingSendP.nc | 49 + .../system/BlockingSerialAMReceiverC.nc | 2 - .../system/BlockingSerialAMSenderC.nc | 2 - .../system/BlockingSerialActiveMessageC.nc | 9 +- .../system/BlockingStdControlImplP.nc | 4 +- tos/lib/tosthreads/system/DynamicThreadP.nc | 7 + tos/lib/tosthreads/system/MainC.nc | 4 + tos/lib/tosthreads/system/StaticThreadP.nc | 10 +- tos/lib/tosthreads/system/ThreadInfoP.nc | 10 +- tos/lib/tosthreads/system/ThreadMapP.nc | 9 + tos/lib/tosthreads/system/ThreadSleepP.nc | 14 +- tos/lib/tosthreads/system/TinyOSMainP.nc | 10 + .../tosthreads/system/TinyThreadSchedulerC.nc | 3 + .../tosthreads/system/TinyThreadSchedulerP.nc | 97 +- tos/lib/tosthreads/system/TosMallocC.nc | 4 +- tos/lib/tosthreads/types/thread.h | 2 +- tos/platforms/btnode3/hardware.h | 6 + tos/platforms/epic/.platform | 80 + tos/platforms/epic/DemoSensorC.nc | 57 + tos/platforms/epic/DemoSensorNowC.nc | 61 + tos/platforms/epic/DemoSensorStreamC.nc | 57 + tos/platforms/epic/HplUserButtonC.nc | 54 + tos/platforms/epic/Ieee154MessageC.nc | 60 + tos/platforms/epic/MoteClockC.nc | 48 + tos/platforms/epic/MoteClockP.nc | 107 + tos/platforms/epic/MotePlatformC.nc | 48 + tos/platforms/epic/PlatformC.nc | 48 + tos/platforms/epic/PlatformLedsC.nc | 30 + tos/platforms/epic/PlatformP.nc | 56 + tos/platforms/epic/UserButton.h | 44 + tos/platforms/epic/UserButtonC.nc | 63 + tos/platforms/epic/UserButtonP.nc | 75 + tos/platforms/epic/VoltageC.nc | 50 + tos/platforms/epic/VoltageStreamC.nc | 50 + tos/platforms/epic/chips/at45db/HplAt45dbC.nc | 50 + tos/platforms/epic/chips/at45db/HplAt45dbP.nc | 71 + .../epic/chips/at45db/HplAt45db_chip.h | 45 + .../epic/chips/ds2411/CachedIeeeEui64C.nc | 40 + .../epic/chips/ds2411/LocalIeeeEui64C.nc | 45 + .../epic/chips/ds2411/PlatformIeeeEui64.h | 37 + tos/platforms/epic/hardware.h | 95 + tos/platforms/epic/platform.h | 0 tos/platforms/epic/platform_message.h | 58 + tos/platforms/eyesIFX/RadioDataLinkC.nc | 12 +- tos/platforms/eyesIFX/WhiteBitAccessorC.nc | 49 + .../byte_radio/RssiFixedThresholdCMP.nc | 6 +- tos/platforms/eyesIFX/eyesIFXv1/hardware.h | 6 + tos/platforms/eyesIFX/eyesIFXv2/hardware.h | 6 + .../eyesIFX/net/lqi/CC2420ActiveMessageC.nc | 62 + tos/platforms/eyesIFX/net/lqi/CC2420Packet.nc | 74 + tos/platforms/intelmote2/.platform | 1 + tos/platforms/intelmote2/hardware.h | 9 + tos/platforms/iris/.platform | 8 +- tos/platforms/iris/ActiveMessageC.nc | 40 +- tos/platforms/iris/Ieee154MessageC.nc | 67 + tos/platforms/iris/TimeSyncMessageC.nc | 34 +- .../iris/chips/ds2401/PlatformIeeeEui64.h | 41 + tos/platforms/iris/chips/rf230/HplRF230C.nc | 16 +- tos/platforms/iris/chips/rf230/HplRF230P.nc | 50 - .../chips/rf230/{HplRF230.h => RadioConfig.h} | 63 +- tos/platforms/iris/platform_message.h | 41 +- tos/platforms/mica/Counter32khz32C.nc | 2 +- tos/platforms/mica2/ActiveMessageC.nc | 6 + tos/platforms/mica2/TimeSyncMessageC.nc | 74 + .../mica2/chips/ds2401/CachedIeeeEui64C.nc | 40 + .../mica2/chips/ds2401/LocalIeeeEui64C.nc | 48 + tos/platforms/mica2/hardware.h | 6 + tos/platforms/mica2dot/hardware.h | 6 + tos/platforms/micaz/.platform | 1 + tos/platforms/micaz/ActiveMessageC.nc | 8 +- tos/platforms/micaz/Ieee154MessageC.nc | 60 + tos/platforms/micaz/TimeSyncMessageC.nc | 4 + tos/platforms/micaz/hardware.h | 6 + .../micaz/mac/tkn154/Makefile.include | 4 + tos/platforms/micaz/mac/tkn154/README.txt | 12 + .../micaz/mac/tkn154/TKN154TimingP.nc | 150 + .../micaz/mac/tkn154/TKN154_platform.h} | 57 +- .../micaz/mac/tkn154/platform_message.h | 25 + tos/platforms/micaz/sim/.platform | 6 +- tos/platforms/mulle/.platform | 42 + .../mulle/ActiveMessageC.nc} | 58 +- tos/platforms/mulle/DemoSensorC.nc | 62 + tos/platforms/mulle/DemoSensorNowC.nc | 27 + tos/platforms/mulle/DemoSensorP.nc | 36 + tos/platforms/mulle/DemoSensorStreamC.nc | 34 + tos/platforms/mulle/Ieee154MessageC.nc | 67 + tos/platforms/mulle/PlatformC.nc | 74 + tos/platforms/mulle/PlatformLedsC.nc | 59 + tos/platforms/mulle/PlatformP.nc | 111 + tos/platforms/mulle/PlatformSerialC.nc | 66 + tos/platforms/mulle/PlatformSerialP.nc | 72 + tos/platforms/mulle/TimeSyncMessageC.nc | 70 + tos/platforms/mulle/button/HplUserButtonC.nc | 86 + tos/platforms/mulle/button/UserButton.h | 81 + tos/platforms/mulle/button/UserButtonC.nc | 97 + tos/platforms/mulle/button/UserButtonP.nc | 123 + tos/platforms/mulle/chips/at45db/At45dbSpi.h | 47 + .../mulle/chips/at45db/HplAt45dbC.nc | 70 + .../mulle/chips/at45db/HplAt45dbP.nc | 131 + .../mulle/chips/at45db/HplAt45db_chip.h | 45 + .../mulle/chips/at45db/SoftSpiAt45dbC.nc | 63 + .../mulle/chips/at45db/SoftSpiAt45dbP.nc | 66 + .../mulle/chips/ds2782/DS2782InternalC.nc | 57 + .../chips/m16c62p/M16c62pAdcPlatformC.nc | 52 + .../chips/m16c62p/M16c62pAdcPlatformP.nc | 59 + .../chips/m16c62p/M16c62pControlPlatformC.nc | 70 + .../mulle/chips/mma7261qt/HplMMA7261QTC.nc | 84 + .../mulle/chips/mma7261qt/HplMMA7261QTP.nc | 131 + tos/platforms/mulle/chips/rf230/HplRF230C.nc | 94 + tos/platforms/mulle/chips/rf230/HplRF230P.nc | 126 + .../mulle/chips/rf230/Mulle_RF230Spi.h | 47 + .../mulle/chips/rf230/RF230SplitControlP.nc | 85 + tos/platforms/mulle/chips/rf230/RadioConfig.h | 139 + .../mulle/chips/rf230/SoftSpiRF230C.nc | 65 + .../mulle/chips/rf230/SoftSpiRF230P.nc | 69 + tos/platforms/mulle/chips/rv8564/RV8564.nc | 109 + tos/platforms/mulle/chips/rv8564/RV8564C.nc | 63 + tos/platforms/mulle/chips/rv8564/RV8564P.nc | 194 + tos/platforms/mulle/chips/rv8564/rv8564.h | 103 + tos/platforms/mulle/debug/m_printf.h | 276 + tos/platforms/mulle/hardware.h | 55 + tos/platforms/mulle/platform.h | 55 + tos/platforms/mulle/platform_message.h | 61 + tos/platforms/mulle/softwarei2c/MulleI2C.h | 45 + .../softwarei2c/SoftI2CBatteryMonitorRTCC.nc | 63 + .../softwarei2c/SoftI2CBatteryMonitorRTCP.nc | 68 + tos/platforms/mulle/softwarei2c/SoftI2CBus.nc | 95 + .../mulle/softwarei2c/SoftI2CBusP.nc | 264 + .../mulle/softwarei2c/SoftI2CMasterImplP.nc | 174 + .../mulle/softwarei2c/SoftI2CMasterP.nc | 103 + .../mulle/softwarei2c/SoftI2CMasterPacketP.nc | 266 + tos/platforms/mulle/softwarespi/SoftSpiBus.nc | 75 + .../mulle/softwarespi/SoftSpiBusP.nc | 129 + .../mulle/softwarespi/SoftSpiMasterImplP.nc | 170 + .../mulle/softwarespi/SoftSpiMasterP.nc | 104 + .../mulle/softwarespi/SoftSpiMasterPacketP.nc | 189 + tos/platforms/mulle/system/LedsP.nc | 152 + tos/platforms/mulle/timers/AlarmMicro16C.nc | 70 + tos/platforms/mulle/timers/AlarmMicro32C.nc | 55 + tos/platforms/mulle/timers/BusyWaitMicroC.nc | 75 + tos/platforms/mulle/timers/CounterMicro16C.nc | 76 + tos/platforms/mulle/timers/CounterMicro32C.nc | 56 + tos/platforms/mulle/timers/HilTimerMilliC.nc | 90 + tos/platforms/mulle/timers/LocalTimeMicroC.nc | 46 + tos/platforms/mulle/timers/TimerConfig.h | 114 + .../mulle/timers/rf230/AlarmRF23016C.nc | 70 + .../mulle/timers/rf230/CounterRF23016C.nc | 64 + .../timers/stop/RV8564AlarmCounterMilli32C.nc | 104 + .../timers/stop/RV8564AlarmCounterMilli32P.nc | 55 + .../mulle/timers/wait/AlarmCounterMilli32C.nc | 93 + tos/platforms/null/.platform | 6 +- tos/platforms/null/hardware.h | 22 + tos/platforms/olimexp169/DemoSensorC.nc | 6 +- tos/platforms/olimexp169/DemoSensorNowC.nc | 4 +- tos/platforms/olimexp169/DemoSensorStreamC.nc | 6 +- tos/platforms/olimexp169/HplUserButtonC.nc | 4 +- tos/platforms/olimexp169/MotePlatformC.nc | 6 +- tos/platforms/olimexp169/PlatformLedsC.nc | 4 +- tos/platforms/olimexp169/PlatformSerialP.nc | 4 +- tos/platforms/olimexp169/SwitchToggleC.nc | 4 +- tos/platforms/olimexp169/UserButton.h | 4 +- tos/platforms/olimexp169/UserButtonC.nc | 4 +- tos/platforms/olimexp169/UserButtonP.nc | 10 +- tos/platforms/shimmer/.platform | 4 + tos/platforms/shimmer/ActiveMessageC.nc | 4 +- tos/platforms/shimmer/HplUserButtonC.nc | 57 + tos/platforms/shimmer/Ieee154MessageC.nc | 60 + tos/platforms/shimmer/MotePlatformC.nc | 219 +- tos/platforms/shimmer/Msp430Timer32khzMapC.nc | 28 +- tos/platforms/shimmer/PlatformLedsC.nc | 9 + tos/platforms/shimmer/SwitchToggleC.nc | 73 + tos/platforms/shimmer/TimeSyncMessageC.nc | 4 + tos/platforms/shimmer/UserButton.h | 44 + tos/platforms/shimmer/UserButtonC.nc | 65 + tos/platforms/shimmer/UserButtonP.nc | 74 + .../shimmer/chips/bluetooth/Bluetooth.nc | 106 + .../shimmer/chips/bluetooth/RovingNetworks.h | 32 + .../chips/bluetooth/RovingNetworksC.nc | 70 + .../chips/bluetooth/RovingNetworksP.nc | 555 + .../bluetooth/bluetoothBaudrateConversion.pdf | Bin 0 -> 212941 bytes .../shimmer/chips/msp430/msp430hardware.h | 288 + tos/platforms/shimmer/chips/sd/SD.nc | 60 +- tos/platforms/shimmer/chips/sd/SDC.nc | 26 +- tos/platforms/shimmer/chips/sd/SDP.nc | 330 +- tos/platforms/shimmer/hardware.h | 182 +- tos/platforms/shimmer/shimmerMessage.h | 382 + tos/platforms/shimmer2/.platform | 85 + tos/platforms/shimmer2/ActiveMessageC.nc | 77 + tos/platforms/shimmer2/HplUserButtonC.nc | 57 + tos/platforms/shimmer2/Leds.nc | 125 + tos/platforms/shimmer2/LedsC.nc | 48 + tos/platforms/shimmer2/LedsP.nc | 148 + tos/platforms/shimmer2/MoteClockC.nc | 47 + tos/platforms/shimmer2/MotePlatformC.nc | 230 + .../shimmer2/Msp430Timer32khzMapC.nc | 75 + tos/platforms/shimmer2/NoLedsC.nc | 57 + tos/platforms/shimmer2/PlatformC.nc | 38 + tos/platforms/shimmer2/PlatformLedsC.nc | 58 + tos/platforms/shimmer2/PlatformP.nc | 19 + tos/platforms/shimmer2/PlatformSerialC.nc | 52 + tos/platforms/shimmer2/ShimmerSerialP.nc | 75 + .../shimmer2/chips/cc2420/HplCC2420AlarmC.nc | 54 + .../chips/cc2420/HplCC2420InterruptsC.nc | 84 + .../chips/cc2420/HplCC2420InterruptsP.nc | 73 + .../shimmer2/chips/cc2420/HplCC2420PinsC.nc | 86 + .../shimmer2/chips/cc2420/HplCC2420SpiC.nc | 62 + .../shimmer2/chips/tilt/HplTiltDetectorC.nc | 57 + .../shimmer2/chips/tilt/TiltDetectorC.nc | 63 + tos/platforms/shimmer2/hardware.h | 154 + tos/platforms/shimmer2/platform.h | 0 tos/platforms/shimmer2/platform_message.h | 59 + tos/platforms/telosa/ActiveMessageC.nc | 2 + tos/platforms/telosa/Ieee154MessageC.nc | 60 + tos/platforms/telosa/TimeSyncMessageC.nc | 4 + .../telosa/chips/at45db/HplAt45dbC.nc | 18 +- .../telosa/chips/at45db/HplAt45dbP.nc | 26 +- tos/platforms/telosa/hardware.h | 6 + tos/platforms/telosb/.platform | 1 + tos/platforms/telosb/hardware.h | 9 +- ...154MacC.nc => Ieee802154BeaconEnabledC.nc} | 22 +- .../mac/tkn154/Ieee802154NonBeaconEnabledC.nc | 149 + .../telosb/mac/tkn154/Makefile.include | 4 + .../telosb/mac/tkn154/TKN154TimingP.nc | 103 +- .../telosb/mac/tkn154/TKN154_platform.h | 34 +- .../telosb/mac/tkn154/platform_message.h | 22 +- .../tkn154/timer/Alarm32khz32VirtualizedP.nc | 2 - .../timer/Alarm32khzTo62500hzTransformC.nc | 37 +- .../mac/tkn154/timer/Alarm62500hz32C.nc | 17 + .../mac/tkn154/timer/Alarm62500hz32P.nc | 88 + tos/platforms/tinynode/hardware.h | 5 + tos/platforms/tmicore/DemoSensorC.nc | 6 +- tos/platforms/tmicore/DemoSensorNowC.nc | 4 +- tos/platforms/tmicore/DemoSensorStreamC.nc | 6 +- tos/platforms/tmicore/HplUserButtonC.nc | 4 +- tos/platforms/tmicore/MoteClockC.nc | 6 +- tos/platforms/tmicore/MoteClockP.nc | 4 +- tos/platforms/tmicore/MotePlatformC.nc | 6 +- tos/platforms/tmicore/PlatformLedsC.nc | 4 +- tos/platforms/tmicore/PlatformSerialC.nc | 4 +- tos/platforms/tmicore/SwitchToggleC.nc | 4 +- tos/platforms/tmicore/UserButton.h | 4 +- tos/platforms/tmicore/UserButtonC.nc | 4 +- tos/platforms/tmicore/UserButtonP.nc | 10 +- .../tmicore/chips/at25df/At25dfSpiConfigP.nc | 8 +- .../tmicore/chips/at25df/NoMsp430GpioC.nc | 6 +- .../tmicore/chips/bq2403x/BQ2403XPinsC.nc | 6 +- .../tmicore/chips/cp210x/CP210XPinsC.nc | 6 +- tos/platforms/tmirws/MotePlatformC.nc | 6 +- .../tmirws/chips/scp1000/Scp1000PinsC.nc | 6 +- .../tmirws/chips/scp1000/Scp1000PinsP.nc | 6 +- .../tmirws/chips/scp1000/Scp1000SpiC.nc | 6 +- .../tmirws/chips/scp1000/Scp1000SpiConfigC.nc | 8 +- .../tmirws/chips/sht11/HalSensirionSht11C.nc | 2 +- .../tmirws/chips/sht11/HplSensirionSht11C.nc | 2 +- .../tmirws/chips/sht11/HplSensirionSht11P.nc | 2 +- .../tmirws/chips/sht11/Msp430OpenDrainC.nc | 4 +- .../tmirws/chips/sht11/Msp430OpenDrainP.nc | 4 +- .../tmirws/chips/sht11/OpenDrainC.nc | 4 +- .../tmirws/chips/sht11/OpenDrainP.nc | 4 +- tos/system/AMSenderC.nc | 19 +- tos/system/ArbiterP.nc | 1 + tos/system/BitVectorC.nc | 8 +- tos/system/DirectAMSenderC.nc | 59 + tos/system/FcfsResourceQueueC.nc | 4 +- tos/system/LplAMSenderC.nc | 28 + tos/system/LplAMSenderP.nc | 23 + tos/system/MainC.nc | 4 + tos/system/PoolP.nc | 2 +- tos/system/QueueC.nc | 4 +- tos/system/SimpleArbiterP.nc | 1 + tos/system/SystemLowPowerListeningC.nc | 10 + tos/system/SystemLowPowerListeningP.nc | 18 + tos/types/Ieee154.h | 40 + tos/types/IeeeEui64.h | 36 + tos/types/Lpl.h | 23 + tos/types/message.h | 7 + 1649 files changed, 124263 insertions(+), 21979 deletions(-) delete mode 100644 apps/6lowpancli/CliAppC.nc delete mode 100644 apps/6lowpancli/CliC.nc delete mode 100644 apps/6lowpancli/Makefile delete mode 100644 apps/6lowpancli/README create mode 100644 apps/IPBaseStation/BaseStationC.nc create mode 100644 apps/IPBaseStation/BaseStationP.nc create mode 100644 apps/IPBaseStation/Makefile create mode 100644 apps/IPBaseStation/README create mode 100644 apps/IPBaseStation/Reset.h create mode 100644 apps/IPBaseStation/Reset.nc rename tos/lib/net/Deluge/CrcP.nc => apps/IPBaseStation/ResetC.nc (60%) create mode 100644 apps/MultihopOscilloscope/oscilloscope.py create mode 100644 apps/Oscilloscope/oscilloscope.py create mode 100644 apps/TCPEcho/HttpdP.nc create mode 100644 apps/TCPEcho/Makefile create mode 100644 apps/TCPEcho/README create mode 100644 apps/TCPEcho/TCPEchoC.nc create mode 100644 apps/TCPEcho/TCPEchoP.nc create mode 100644 apps/TCPEcho/UDPReport.h create mode 100644 apps/UDPEcho/Makefile create mode 100644 apps/UDPEcho/Makefile.local create mode 100644 apps/UDPEcho/NodeConnectivity/NodeConnectivity.nc create mode 100644 apps/UDPEcho/NodeConnectivity/TestbedConnectivityM.nc create mode 100644 apps/UDPEcho/NodeConnectivity/createNodeConnectivityM.pl create mode 100644 apps/UDPEcho/NodeConnectivity/exampleMap.txt create mode 100644 apps/UDPEcho/NodeConnectivity/testBed.nss create mode 100644 apps/UDPEcho/NodeConnectivity/testBedMap.txt create mode 100644 apps/UDPEcho/README create mode 100644 apps/UDPEcho/UDPEchoC.nc create mode 100644 apps/UDPEcho/UDPEchoP.nc create mode 100644 apps/UDPEcho/UDPReport.h create mode 100644 apps/UDPEcho/tests/echotest.pl create mode 100755 apps/UDPEcho/tests/seqtest.pl create mode 100644 apps/UDPEcho/util/Listener.py create mode 100644 apps/UDPEcho/util/MySQLListener.py create mode 100644 apps/UDPEcho/util/UdpReport.py create mode 100644 apps/UDPEcho/volumes-at45db.xml create mode 100644 apps/UDPEcho/volumes-stm25p.xml create mode 100644 apps/tests/NxFloat/.cvsignore create mode 100644 apps/tests/NxFloat/Makefile create mode 100644 apps/tests/NxFloat/README.txt create mode 100644 apps/tests/NxFloat/TestSerial.h create mode 100644 apps/tests/NxFloat/TestSerial.java create mode 100644 apps/tests/NxFloat/TestSerialAppC.nc create mode 100644 apps/tests/NxFloat/TestSerialC.nc create mode 100644 apps/tests/TestDhv/DhvInject.java create mode 100644 apps/tests/TestDhv/Makefile create mode 100644 apps/tests/TestDhv/README create mode 100644 apps/tests/TestDhv/TestDhv.h create mode 100644 apps/tests/TestDhv/TestDhvC-Master.nc create mode 100644 apps/tests/TestDhv/TestDhvC.nc create mode 100644 apps/tests/TestDhv/TestDhvP-Master.nc create mode 100644 apps/tests/TestDhv/TestDhvP.nc create mode 100644 apps/tests/TestDhv/TestDipP.nc create mode 100644 apps/tests/TestDhv/gentest.py create mode 100644 apps/tests/TestEui/Makefile create mode 100644 apps/tests/TestEui/README.txt create mode 100644 apps/tests/TestEui/TestEuiAppC.nc create mode 100644 apps/tests/TestEui/TestEuiC.nc rename apps/tests/TestFtsp/{ => Ftsp}/FtspDataAnalyzer.m (100%) mode change 100644 => 100755 rename apps/tests/TestFtsp/{ => Ftsp}/FtspDataLogger.java (100%) mode change 100644 => 100755 create mode 100755 apps/tests/TestFtsp/Ftsp/FtspDataLogger.py rename apps/tests/TestFtsp/{ => Ftsp}/Makefile (100%) mode change 100644 => 100755 create mode 100755 apps/tests/TestFtsp/Ftsp/README.MATLAB.txt rename apps/tests/TestFtsp/{ => Ftsp}/README.txt (100%) mode change 100644 => 100755 rename apps/tests/TestFtsp/{ => Ftsp}/TestFtsp.h (97%) mode change 100644 => 100755 rename apps/tests/TestFtsp/{ => Ftsp}/TestFtspAppC.nc (100%) mode change 100644 => 100755 rename apps/tests/TestFtsp/{ => Ftsp}/TestFtspC.nc (100%) mode change 100644 => 100755 create mode 100755 apps/tests/TestFtsp/FtspLpl/FtspDataLogger.py create mode 100755 apps/tests/TestFtsp/FtspLpl/Makefile create mode 100755 apps/tests/TestFtsp/FtspLpl/README create mode 100755 apps/tests/TestFtsp/FtspLpl/TestFtsp.h create mode 100755 apps/tests/TestFtsp/FtspLpl/TestFtspAppC.nc create mode 100755 apps/tests/TestFtsp/FtspLpl/TestFtspC.nc create mode 100755 apps/tests/TestFtsp/FtspLpl/TestFtspMsg.py create mode 100755 apps/tests/TestFtsp/FtspLplBeaconer/Makefile create mode 100755 apps/tests/TestFtsp/FtspLplBeaconer/RadioCountToLeds.h create mode 100755 apps/tests/TestFtsp/FtspLplBeaconer/RadioCountToLedsAppC.nc create mode 100755 apps/tests/TestFtsp/FtspLplBeaconer/RadioCountToLedsC.nc create mode 100644 apps/tests/TestLocalTime/dump.py create mode 100644 apps/tests/TestNetworkLpl/Makefile create mode 100644 apps/tests/TestNetworkLpl/README.txt create mode 100644 apps/tests/TestNetworkLpl/TestNetworkLplAppC.nc create mode 100644 apps/tests/TestNetworkLpl/TestNetworkLplC.nc create mode 100644 apps/tests/TestNetworkLpl/ctp-dump.py delete mode 100644 apps/tests/TestSerialBandwidth/TestSerialMsg.java delete mode 100644 apps/tests/cc2420/LplBroadcastCountToLeds/RadioCountMsg.java create mode 100644 apps/tests/cc2420/TestSecurity/BaseStation/BaseStationC.nc create mode 100644 apps/tests/cc2420/TestSecurity/BaseStation/BaseStationP.nc create mode 100644 apps/tests/cc2420/TestSecurity/BaseStation/Makefile create mode 100644 apps/tests/cc2420/TestSecurity/README.txt create mode 100644 apps/tests/cc2420/TestSecurity/RadioCountToLeds1/Makefile create mode 100644 apps/tests/cc2420/TestSecurity/RadioCountToLeds1/RadioCountToLeds.h create mode 100644 apps/tests/cc2420/TestSecurity/RadioCountToLeds1/RadioCountToLedsAppC.nc create mode 100644 apps/tests/cc2420/TestSecurity/RadioCountToLeds1/RadioCountToLedsC.nc create mode 100644 apps/tests/deluge/Basestation/BasestationAppC.nc create mode 100644 apps/tests/deluge/Basestation/Makefile create mode 100644 apps/tests/deluge/Basestation/README.txt create mode 100644 apps/tests/deluge/Basestation/volumes-at45db.xml create mode 100644 apps/tests/deluge/Basestation/volumes-stm25p.xml create mode 100644 apps/tests/rf230/Ieee154CountToLeds/Makefile create mode 100644 apps/tests/rf230/Ieee154CountToLeds/RadioCountToLeds.h create mode 100644 apps/tests/rf230/Ieee154CountToLeds/RadioCountToLedsAppC.nc create mode 100644 apps/tests/rf230/Ieee154CountToLeds/RadioCountToLedsC.nc delete mode 100644 apps/tests/tkn154/TestAssociate/README.txt delete mode 100644 apps/tests/tkn154/TestData/README.txt delete mode 100644 apps/tests/tkn154/TestData/coordinator/Makefile delete mode 100644 apps/tests/tkn154/TestIndirect/README.txt delete mode 100644 apps/tests/tkn154/TestPromiscuous/Makefile delete mode 100644 apps/tests/tkn154/TestStartSync/README.txt delete mode 100644 apps/tests/tkn154/TestStartSync/coordinator/Makefile create mode 100644 apps/tests/tkn154/beacon-enabled/TestAssociate/README.txt rename apps/tests/tkn154/{ => beacon-enabled}/TestAssociate/app_profile.h (100%) rename apps/tests/tkn154/{ => beacon-enabled}/TestAssociate/coordinator/Makefile (62%) rename apps/tests/tkn154/{ => beacon-enabled}/TestAssociate/coordinator/TestAssociateAppC.nc (82%) rename apps/tests/tkn154/{ => beacon-enabled}/TestAssociate/coordinator/TestCoordC.nc (95%) create mode 100644 apps/tests/tkn154/beacon-enabled/TestAssociate/device/Makefile rename apps/tests/tkn154/{ => beacon-enabled}/TestAssociate/device/TestAssociateAppC.nc (80%) rename apps/tests/tkn154/{ => beacon-enabled}/TestAssociate/device/TestDeviceC.nc (89%) create mode 100644 apps/tests/tkn154/beacon-enabled/TestData/README.txt rename apps/tests/tkn154/{ => beacon-enabled}/TestData/app_profile.h (98%) rename apps/tests/tkn154/{TestData/device => beacon-enabled/TestData/coordinator}/Makefile (60%) rename apps/tests/tkn154/{ => beacon-enabled}/TestData/coordinator/TestCoordReceiverC.nc (98%) rename apps/tests/tkn154/{ => beacon-enabled}/TestData/coordinator/TestDataAppC.nc (86%) create mode 100644 apps/tests/tkn154/beacon-enabled/TestData/device/Makefile rename apps/tests/tkn154/{ => beacon-enabled}/TestData/device/TestDataAppC.nc (81%) rename apps/tests/tkn154/{ => beacon-enabled}/TestData/device/TestDeviceSenderC.nc (82%) create mode 100644 apps/tests/tkn154/beacon-enabled/TestIndirect/README.txt rename apps/tests/tkn154/{ => beacon-enabled}/TestIndirect/app_profile.h (100%) rename apps/tests/tkn154/{ => beacon-enabled}/TestIndirect/coordinator/Makefile (77%) rename apps/tests/tkn154/{ => beacon-enabled}/TestIndirect/coordinator/TestCoordSenderC.nc (97%) rename apps/tests/tkn154/{ => beacon-enabled}/TestIndirect/coordinator/TestIndirectAppC.nc (85%) rename apps/tests/tkn154/{ => beacon-enabled}/TestIndirect/device/Makefile (73%) rename apps/tests/tkn154/{ => beacon-enabled}/TestIndirect/device/TestDeviceReceiverC.nc (96%) rename apps/tests/tkn154/{ => beacon-enabled}/TestIndirect/device/TestIndirectAppC.nc (84%) create mode 100644 apps/tests/tkn154/beacon-enabled/TestStartSync/README.txt rename apps/tests/tkn154/{ => beacon-enabled}/TestStartSync/app_profile.h (100%) create mode 100644 apps/tests/tkn154/beacon-enabled/TestStartSync/coordinator/Makefile rename apps/tests/tkn154/{ => beacon-enabled}/TestStartSync/coordinator/TestCoordC.nc (98%) rename apps/tests/tkn154/{ => beacon-enabled}/TestStartSync/coordinator/TestStartSyncAppC.nc (88%) rename apps/tests/tkn154/{ => beacon-enabled}/TestStartSync/device/Makefile (73%) rename apps/tests/tkn154/{ => beacon-enabled}/TestStartSync/device/TestDeviceC.nc (95%) rename apps/tests/tkn154/{ => beacon-enabled}/TestStartSync/device/TestStartSyncAppC.nc (85%) create mode 100755 apps/tests/tkn154/makeall.sh create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/README.txt rename tos/lib/mac/tkn154/dummies/NoDebugP.nc => apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/app_profile.h (78%) create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/coordinator/Makefile create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/coordinator/TestActiveScanCoordAppC.nc create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/coordinator/TestActiveScanCoordC.nc create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/device/Makefile create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/device/TestActiveScanDeviceAppC.nc create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/device/TestActiveScanDeviceC.nc create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestAssociate/README.txt create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestAssociate/app_profile.h rename apps/tests/tkn154/{TestAssociate/device => nonbeacon-enabled/TestAssociate/coordinator}/Makefile (62%) create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestAssociate/coordinator/TestAssociateAppC.nc create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestAssociate/coordinator/TestCoordC.nc create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestAssociate/device/Makefile create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestAssociate/device/TestAssociateAppC.nc create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestAssociate/device/TestDeviceC.nc create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/README.txt rename tos/lib/mac/tkn154/interfaces/private/Ieee802154Debug.nc => apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/app_profile.h (86%) create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/coordinator/Makefile create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/coordinator/TestIndirectDataCoordAppC.nc create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/coordinator/TestIndirectDataCoordC.nc create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/device/Makefile create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/device/TestIndirectDataDeviceAppC.nc create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/device/TestIndirectDataDeviceC.nc create mode 100644 apps/tests/tkn154/nonbeacon-enabled/TestPromiscuous/Makefile rename apps/tests/tkn154/{ => nonbeacon-enabled}/TestPromiscuous/README.txt (58%) rename apps/tests/tkn154/{ => nonbeacon-enabled}/TestPromiscuous/TestPromiscuousAppC.nc (87%) rename apps/tests/tkn154/{ => nonbeacon-enabled}/TestPromiscuous/TestPromiscuousC.nc (90%) create mode 100644 apps/tosthreads/apps/Blink_DynamicThreads/BlinkAppC.nc create mode 100644 apps/tosthreads/apps/Blink_DynamicThreads/BlinkC.nc create mode 100644 apps/tosthreads/apps/Blink_DynamicThreads/Makefile create mode 100644 apps/tosthreads/apps/Blink_DynamicThreads/README create mode 100644 apps/tosthreads/apps/TestJoin/Makefile create mode 100644 apps/tosthreads/apps/TestJoin/README create mode 100644 apps/tosthreads/apps/TestJoin/TestJoinAppC.nc create mode 100644 apps/tosthreads/apps/TestJoin/TestJoinC.nc create mode 100644 apps/tosthreads/capps/TestJoin/Makefile create mode 100644 apps/tosthreads/capps/TestJoin/README create mode 100644 apps/tosthreads/capps/TestJoin/TestJoin.c create mode 100644 apps/tosthreads/capps/TestJoin/stack.h create mode 100644 apps/tosthreads/tinyld/LoadFromRAM/LoadFromRAMAppC.nc create mode 100644 apps/tosthreads/tinyld/LoadFromRAM/LoadFromRAMP.nc create mode 100644 apps/tosthreads/tinyld/LoadFromRAM/Makefile create mode 100644 apps/tosthreads/tinyld/LoadFromRAM/README create mode 100644 apps/tosthreads/tinyld/LoadFromRAM/volumes-at45db.xml create mode 100755 apps/tosthreads/tinyld/LoadFromRAM/volumes-stm25p.xml create mode 100644 apps/tosthreads/tinyld/Makefile create mode 100755 apps/tosthreads/tinyld/SerialLoader/Makefile create mode 100644 apps/tosthreads/tinyld/SerialLoader/README create mode 100755 apps/tosthreads/tinyld/SerialLoader/SerialLoader.h create mode 100755 apps/tosthreads/tinyld/SerialLoader/SerialLoaderAppC.nc create mode 100755 apps/tosthreads/tinyld/SerialLoader/SerialLoaderP.nc create mode 100755 apps/tosthreads/tinyld/SerialLoader/serialloader.py create mode 100755 apps/tosthreads/tinyld/SerialLoader/tinyos.py create mode 100755 apps/tosthreads/tinyld/SerialLoaderFlash/FlashVolumeManager.h create mode 100755 apps/tosthreads/tinyld/SerialLoaderFlash/FlashVolumeManagerC.nc create mode 100755 apps/tosthreads/tinyld/SerialLoaderFlash/FlashVolumeManagerP.nc create mode 100755 apps/tosthreads/tinyld/SerialLoaderFlash/Makefile create mode 100755 apps/tosthreads/tinyld/SerialLoaderFlash/README create mode 100755 apps/tosthreads/tinyld/SerialLoaderFlash/SerialLoaderFlashAppC.nc create mode 100755 apps/tosthreads/tinyld/SerialLoaderFlash/serialloader.py create mode 100755 apps/tosthreads/tinyld/SerialLoaderFlash/tinyos.py create mode 100644 apps/tosthreads/tinyld/SerialLoaderFlash/volumes-at45db.xml create mode 100755 apps/tosthreads/tinyld/SerialLoaderFlash/volumes-stm25p.xml delete mode 100644 doc/html/deluge-t2-manual.html create mode 100644 doc/html/tep136.html create mode 100644 doc/html/tep137.html delete mode 100644 doc/pdf/deluge-t2-manual.pdf delete mode 100644 doc/stylesheets/deluge-t2-manual.css create mode 100644 doc/txt/tep136.txt create mode 100644 doc/txt/tep137.txt create mode 100644 licenses/INTEL-LICENSE.txt delete mode 100644 overall-todo.txt create mode 100644 support/make/avr/avr-studio-debug.extra create mode 100644 support/make/avr/avrispmkii.extra delete mode 100644 support/make/avr/xnp.extra create mode 100644 support/make/blip.extra create mode 100644 support/make/epic.target create mode 100644 support/make/epic/digi.extra create mode 100644 support/make/epic/epic.rules create mode 100644 support/make/epic/miniprog.extra create mode 100755 support/make/m16c62p/crt.S create mode 100755 support/make/m16c62p/debug.extra create mode 100755 support/make/m16c62p/debugopt.extra create mode 100755 support/make/m16c62p/install.extra create mode 100755 support/make/m16c62p/m16c.x create mode 100755 support/make/m16c62p/m16c62p.rules create mode 100644 support/make/m16c62p/reinstall.extra create mode 100755 support/make/m16c62p/sm16cf.extra create mode 100755 support/make/mulle.target create mode 100644 support/make/shimmer2.target create mode 100644 support/make/stack-check.extra create mode 100644 support/sdk/c/blip/Makefile.am create mode 100755 support/sdk/c/blip/bootstrap.sh create mode 100644 support/sdk/c/blip/configure.ac create mode 100644 support/sdk/c/blip/driver/Makefile.am create mode 100644 support/sdk/c/blip/driver/config.c create mode 100644 support/sdk/c/blip/driver/config.h create mode 100644 support/sdk/c/blip/driver/hashtable.c create mode 100644 support/sdk/c/blip/driver/hashtable.h create mode 100644 support/sdk/c/blip/driver/hashtable_private.h create mode 100644 support/sdk/c/blip/driver/logging.c create mode 100644 support/sdk/c/blip/driver/logging.h create mode 100644 support/sdk/c/blip/driver/mcast.c create mode 100644 support/sdk/c/blip/driver/mcast.h create mode 100644 support/sdk/c/blip/driver/netlink.c create mode 100644 support/sdk/c/blip/driver/netlink.h create mode 100644 support/sdk/c/blip/driver/nwstate.c create mode 100644 support/sdk/c/blip/driver/nwstate.h create mode 100644 support/sdk/c/blip/driver/radvd-1.0/CHANGES create mode 100644 support/sdk/c/blip/driver/radvd-1.0/COPYRIGHT create mode 100644 support/sdk/c/blip/driver/radvd-1.0/INTRO.html create mode 100644 support/sdk/c/blip/driver/radvd-1.0/Makefile.am create mode 100644 support/sdk/c/blip/driver/radvd-1.0/README create mode 100644 support/sdk/c/blip/driver/radvd-1.0/TODO create mode 100644 support/sdk/c/blip/driver/radvd-1.0/VERSION create mode 100755 support/sdk/c/blip/driver/radvd-1.0/config.guess create mode 100644 support/sdk/c/blip/driver/radvd-1.0/config.h.in create mode 100755 support/sdk/c/blip/driver/radvd-1.0/config.sub create mode 100644 support/sdk/c/blip/driver/radvd-1.0/configure.in create mode 100644 support/sdk/c/blip/driver/radvd-1.0/copyright.blurb create mode 100644 support/sdk/c/blip/driver/radvd-1.0/defaults.h create mode 100755 support/sdk/c/blip/driver/radvd-1.0/depcomp create mode 100644 support/sdk/c/blip/driver/radvd-1.0/device-bsd44.c create mode 100644 support/sdk/c/blip/driver/radvd-1.0/device-common.c create mode 100644 support/sdk/c/blip/driver/radvd-1.0/device-linux.c create mode 100644 support/sdk/c/blip/driver/radvd-1.0/gram.c create mode 100644 support/sdk/c/blip/driver/radvd-1.0/gram.h create mode 100644 support/sdk/c/blip/driver/radvd-1.0/gram.y create mode 100644 support/sdk/c/blip/driver/radvd-1.0/includes.h create mode 100755 support/sdk/c/blip/driver/radvd-1.0/install-sh create mode 100644 support/sdk/c/blip/driver/radvd-1.0/interface.c create mode 100644 support/sdk/c/blip/driver/radvd-1.0/log.c create mode 100755 support/sdk/c/blip/driver/radvd-1.0/missing create mode 100755 support/sdk/c/blip/driver/radvd-1.0/mkinstalldirs create mode 100644 support/sdk/c/blip/driver/radvd-1.0/pathnames.h create mode 100644 support/sdk/c/blip/driver/radvd-1.0/process.c create mode 100644 support/sdk/c/blip/driver/radvd-1.0/radvd.8.man create mode 100644 support/sdk/c/blip/driver/radvd-1.0/radvd.c create mode 100644 support/sdk/c/blip/driver/radvd-1.0/radvd.conf.5.man create mode 100644 support/sdk/c/blip/driver/radvd-1.0/radvd.conf.example create mode 100644 support/sdk/c/blip/driver/radvd-1.0/radvd.h create mode 100644 support/sdk/c/blip/driver/radvd-1.0/radvdump.8.man create mode 100644 support/sdk/c/blip/driver/radvd-1.0/radvdump.c create mode 100644 support/sdk/c/blip/driver/radvd-1.0/recv.c create mode 100644 support/sdk/c/blip/driver/radvd-1.0/scanner.c create mode 100644 support/sdk/c/blip/driver/radvd-1.0/scanner.l create mode 100644 support/sdk/c/blip/driver/radvd-1.0/send.c create mode 100644 support/sdk/c/blip/driver/radvd-1.0/socket.c create mode 100644 support/sdk/c/blip/driver/radvd-1.0/stamp-h create mode 100644 support/sdk/c/blip/driver/radvd-1.0/stamp-h.in create mode 100644 support/sdk/c/blip/driver/radvd-1.0/timer.c create mode 100644 support/sdk/c/blip/driver/radvd-1.0/util.c create mode 100644 support/sdk/c/blip/driver/radvd-wrapper.c create mode 100644 support/sdk/c/blip/driver/routing.c create mode 100644 support/sdk/c/blip/driver/routing.h create mode 100644 support/sdk/c/blip/driver/serial_tun.c create mode 100644 support/sdk/c/blip/driver/tun_dev.c create mode 100644 support/sdk/c/blip/driver/tun_dev.h create mode 100644 support/sdk/c/blip/driver/tunnel.c create mode 100644 support/sdk/c/blip/driver/vty/Makefile create mode 100644 support/sdk/c/blip/driver/vty/test_srv.c create mode 100644 support/sdk/c/blip/driver/vty/vty-util.c create mode 100644 support/sdk/c/blip/driver/vty/vty.c create mode 100644 support/sdk/c/blip/driver/vty/vty.h create mode 100644 support/sdk/c/blip/lib6lowpan/6lowpan.h create mode 100644 support/sdk/c/blip/lib6lowpan/IEEE154Packet.h create mode 100644 support/sdk/c/blip/lib6lowpan/Makefile.am create mode 100644 support/sdk/c/blip/lib6lowpan/TrackFlows.h rename tos/lib/tosboot/telosb/InternalFlash.h => support/sdk/c/blip/lib6lowpan/blip-platform.h (55%) create mode 100644 support/sdk/c/blip/lib6lowpan/devconf.h create mode 100644 support/sdk/c/blip/lib6lowpan/in_cksum.c create mode 100644 support/sdk/c/blip/lib6lowpan/in_cksum.h create mode 100644 support/sdk/c/blip/lib6lowpan/ip.h create mode 100644 support/sdk/c/blip/lib6lowpan/ip_malloc.c create mode 100644 support/sdk/c/blip/lib6lowpan/ip_malloc.h create mode 100644 support/sdk/c/blip/lib6lowpan/lib6lowpan.c create mode 100644 support/sdk/c/blip/lib6lowpan/lib6lowpan.h create mode 100644 support/sdk/c/blip/lib6lowpan/lib6lowpanFrag.c create mode 100644 support/sdk/c/blip/lib6lowpan/lib6lowpanIP.c create mode 100644 support/sdk/c/blip/lib6lowpan/nwbyte.h create mode 100644 support/sdk/c/blip/lib6lowpan/printpacket.c create mode 100644 support/sdk/c/blip/libtcp/Makefile create mode 100644 support/sdk/c/blip/libtcp/circ.c create mode 100644 support/sdk/c/blip/libtcp/circ.h create mode 100644 support/sdk/c/blip/libtcp/tcplib.c create mode 100644 support/sdk/c/blip/libtcp/tcplib.h create mode 100644 support/sdk/c/blip/libtcp/test_circ.c create mode 100644 support/sdk/c/blip/libtcp/test_server.c create mode 100644 support/sdk/c/blip/serial_tun.conf create mode 100644 support/sdk/java/net/tinyos/tools/.cvsignore create mode 100755 tools/release/deputy.files create mode 100644 tools/release/deputy.spec create mode 100755 tools/release/external-tools/avarice.spec create mode 100755 tools/release/external-tools/avr-gcc.spec create mode 100755 tools/release/external-tools/avr-insight.spec create mode 100644 tools/release/external-tools/avr-libc.spec create mode 100755 tools/release/external-tools/binutils.spec create mode 100755 tools/release/external-tools/msp430-libc.spec create mode 100755 tools/release/external-tools/xscale-elf.gcc.spec create mode 100644 tools/release/nesc.spec delete mode 100644 tools/release/tinyos.filter create mode 100644 tools/tinyos/misc/tos-dump.py create mode 100755 tools/tinyos/misc/tos-nwprog create mode 100644 tools/tinyos/safe/.cvsignore create mode 100755 tools/tinyos/safe/tos-ramsize create mode 100755 tools/tinyos/safe/tos-ramsize.1 create mode 100755 tools/tinyos/tosthreads/tosthreads-gen-dynamic-app create mode 100755 tools/tinyos/tosthreads/tosthreads-gen-dynamic-app.1 delete mode 100644 tools/tinyos/tosthreads/tosthreads_tenet_api.py rename tos/chips/{rf230/TimeSyncMessage.h => cc1000/CC1000TimeSyncMessage.h} (91%) create mode 100644 tos/chips/cc1000/CC1000TimeSyncMessageC.nc create mode 100644 tos/chips/cc1000/CC1000TimeSyncMessageP.nc delete mode 100644 tos/chips/cc1000/LowPowerListening.nc create mode 100644 tos/chips/cc1000/PacketTimeSyncOffset.nc create mode 100644 tos/chips/cc2420/CC2420Ieee154MessageC.nc create mode 100644 tos/chips/cc2420/CC2420Ieee154MessageP.nc create mode 100644 tos/chips/cc2420/CC2420RadioC.nc create mode 100644 tos/chips/cc2420/interfaces/CC2420Keys.nc create mode 100644 tos/chips/cc2420/interfaces/CC2420SecurityMode.nc create mode 100644 tos/chips/cc2420/security/CC2420KeysC.nc create mode 100644 tos/chips/cc2420/security/CC2420KeysP.nc create mode 100644 tos/chips/cc2420/security/SecAMSenderC.nc create mode 100644 tos/chips/cc2420/security/SecAMSenderP.nc create mode 100644 tos/chips/ds2401/CachedIeeeEui64P.nc create mode 100644 tos/chips/ds2401/Ds2401.h create mode 100644 tos/chips/ds2401/Ds2401ToIeeeEui64C.nc create mode 100644 tos/chips/ds2401/HplDs2401.nc create mode 100644 tos/chips/ds2401/HplDs2401C.nc create mode 100644 tos/chips/ds2401/OneWireMaster.nc create mode 100644 tos/chips/ds2401/OneWireMasterC.nc create mode 100644 tos/chips/ds2782/DS2782.h create mode 100644 tos/chips/ds2782/HplDS2782.nc create mode 100644 tos/chips/ds2782/HplDS2782LogicP.nc create mode 100755 tos/chips/m16c62p/McuSleepC.nc create mode 100755 tos/chips/m16c62p/McuSleepP.nc create mode 100755 tos/chips/m16c62p/adc/Adc.h create mode 100755 tos/chips/m16c62p/adc/AdcP.nc create mode 100755 tos/chips/m16c62p/adc/AdcReadClientC.nc create mode 100755 tos/chips/m16c62p/adc/AdcReadNowClientC.nc create mode 100755 tos/chips/m16c62p/adc/AdcReadStreamClientC.nc create mode 100755 tos/chips/m16c62p/adc/AdcStreamP.nc create mode 100755 tos/chips/m16c62p/adc/HplM16c62pAdc.nc create mode 100755 tos/chips/m16c62p/adc/HplM16c62pAdcC.nc create mode 100755 tos/chips/m16c62p/adc/HplM16c62pAdcP.nc create mode 100755 tos/chips/m16c62p/adc/M16c62pAdc.h create mode 100755 tos/chips/m16c62p/adc/M16c62pAdcC.nc create mode 100755 tos/chips/m16c62p/adc/M16c62pAdcConfig.nc create mode 100755 tos/chips/m16c62p/adc/M16c62pAdcMultiple.nc create mode 100755 tos/chips/m16c62p/adc/M16c62pAdcP.nc create mode 100644 tos/chips/m16c62p/adc/M16c62pAdcPlatform.nc create mode 100755 tos/chips/m16c62p/adc/M16c62pAdcSingle.nc create mode 100755 tos/chips/m16c62p/adc/WireAdcP.nc create mode 100755 tos/chips/m16c62p/adc/WireAdcStreamP.nc create mode 100755 tos/chips/m16c62p/bits.h create mode 100644 tos/chips/m16c62p/control/M16c62pControl.h create mode 100755 tos/chips/m16c62p/control/M16c62pControl.nc create mode 100755 tos/chips/m16c62p/control/M16c62pControlC.nc create mode 100755 tos/chips/m16c62p/control/M16c62pControlP.nc create mode 100644 tos/chips/m16c62p/control/M16c62pControlPlatform.nc create mode 100644 tos/chips/m16c62p/control/StopModeControl.nc create mode 100644 tos/chips/m16c62p/control/StopModeControlC.nc create mode 100644 tos/chips/m16c62p/control/SystemClockControl.nc create mode 100644 tos/chips/m16c62p/control/SystemClockControlC.nc create mode 100755 tos/chips/m16c62p/dac/HplM16c62pDac.nc create mode 100755 tos/chips/m16c62p/dac/HplM16c62pDacC.nc create mode 100755 tos/chips/m16c62p/dac/HplM16c62pDacP.nc create mode 100755 tos/chips/m16c62p/interrupts.h create mode 100755 tos/chips/m16c62p/iom16c62p.h create mode 100755 tos/chips/m16c62p/m16c62phardware.h create mode 100755 tos/chips/m16c62p/pins/HplM16c62pGeneralIOC.nc create mode 100755 tos/chips/m16c62p/pins/HplM16c62pGeneralIOPinP.nc create mode 100755 tos/chips/m16c62p/pins/HplM16c62pGeneralIOPinPRC2P.nc create mode 100755 tos/chips/m16c62p/pins/HplM16c62pGeneralIOPortP.nc create mode 100755 tos/chips/m16c62p/pins/HplM16c62pInterrupt.nc create mode 100755 tos/chips/m16c62p/pins/HplM16c62pInterruptC.nc create mode 100755 tos/chips/m16c62p/pins/HplM16c62pInterruptPinP.nc create mode 100755 tos/chips/m16c62p/pins/HplM16c62pInterruptSig.nc create mode 100755 tos/chips/m16c62p/pins/HplM16c62pInterruptSigP.nc create mode 100755 tos/chips/m16c62p/pins/M16c62pInterruptC.nc create mode 100644 tos/chips/m16c62p/pins/M16c62pPin.h create mode 100644 tos/chips/m16c62p/printf/elib.c create mode 100644 tos/chips/m16c62p/printf/m16c62p_printf.h create mode 100755 tos/chips/m16c62p/timer/HplM16c62pTimer.nc create mode 100755 tos/chips/m16c62p/timer/HplM16c62pTimerACtrl.nc create mode 100755 tos/chips/m16c62p/timer/HplM16c62pTimerACtrlP.nc create mode 100755 tos/chips/m16c62p/timer/HplM16c62pTimerBCtrl.nc create mode 100755 tos/chips/m16c62p/timer/HplM16c62pTimerBCtrlP.nc create mode 100755 tos/chips/m16c62p/timer/HplM16c62pTimerC.nc create mode 100755 tos/chips/m16c62p/timer/HplM16c62pTimerInterrupt.nc create mode 100755 tos/chips/m16c62p/timer/HplM16c62pTimerInterruptP.nc create mode 100755 tos/chips/m16c62p/timer/HplM16c62pTimerP.nc create mode 100755 tos/chips/m16c62p/timer/M16c62pAlarm16C.nc create mode 100755 tos/chips/m16c62p/timer/M16c62pAlarm32C.nc create mode 100755 tos/chips/m16c62p/timer/M16c62pCounter16C.nc create mode 100755 tos/chips/m16c62p/timer/M16c62pCounter32C.nc create mode 100755 tos/chips/m16c62p/timer/M16c62pTimer.h create mode 100755 tos/chips/m16c62p/timer/M16c62pTimerAInitC.nc create mode 100755 tos/chips/m16c62p/timer/M16c62pTimerBInitC.nc create mode 100755 tos/chips/m16c62p/uart/HplM16c62pUart.nc create mode 100755 tos/chips/m16c62p/uart/HplM16c62pUartC.nc create mode 100755 tos/chips/m16c62p/uart/HplM16c62pUartInterrupt.nc create mode 100755 tos/chips/m16c62p/uart/HplM16c62pUartInterruptP.nc create mode 100755 tos/chips/m16c62p/uart/HplM16c62pUartP.nc create mode 100644 tos/chips/m16c62p/uart/M16c62pUart.h create mode 100755 tos/chips/m16c62p/uart/M16c62pUartC.nc create mode 100755 tos/chips/m16c62p/uart/M16c62pUartP.nc create mode 100644 tos/chips/mma7261qt/HplMMA7261QT.h create mode 100644 tos/chips/mma7261qt/HplMMA7261QTControl.nc create mode 100644 tos/chips/mma7261qt/HplMMA7261QTControlC.nc create mode 100644 tos/chips/mma7261qt/HplMMA7261QTControlP.nc create mode 100644 tos/chips/mma7261qt/HplMMA7261QTReaderC.nc delete mode 100644 tos/chips/rf230/ActiveMessageLayerC.nc delete mode 100644 tos/chips/rf230/IEEE154NetworkLayerP.nc delete mode 100644 tos/chips/rf230/IEEE154PacketP.nc delete mode 100644 tos/chips/rf230/RF230ActiveMessageC.nc delete mode 100644 tos/chips/rf230/RF230LayerC.nc delete mode 100644 tos/chips/rf230/RF230PacketP.nc delete mode 100644 tos/chips/rf230/RF230TimeSyncMessageP.nc create mode 100644 tos/chips/rf2xx/README create mode 100755 tos/chips/rf2xx/layers/ActiveMessageConfig.nc rename tos/chips/{rf230/ActiveMessageConfig.nc => rf2xx/layers/ActiveMessageLayer.h} (79%) create mode 100755 tos/chips/rf2xx/layers/ActiveMessageLayerC.nc create mode 100644 tos/chips/rf2xx/layers/ActiveMessageLayerP.nc create mode 100644 tos/chips/rf2xx/layers/AutoResourceAcquireLayerC.nc rename tos/chips/{rf230 => rf2xx/layers}/CsmaConfig.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/CsmaLayerC.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/CsmaLayerP.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/DummyConfig.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/DummyLayerC.nc (88%) create mode 100644 tos/chips/rf2xx/layers/Ieee154MessageLayerC.nc rename tos/chips/{rf230/IEEE154Packet.h => rf2xx/layers/Ieee154PacketLayer.h} (83%) rename tos/chips/{rf230/IEEE154Packet.nc => rf2xx/layers/Ieee154PacketLayer.nc} (84%) create mode 100644 tos/chips/rf2xx/layers/Ieee154PacketLayerC.nc create mode 100644 tos/chips/rf2xx/layers/Ieee154PacketLayerP.nc create mode 100644 tos/chips/rf2xx/layers/LowPowerListeningConfig.nc rename tos/chips/{rf230/IEEE154NetworkLayerC.nc => rf2xx/layers/LowPowerListeningDummyC.nc} (71%) create mode 100644 tos/chips/rf2xx/layers/LowPowerListeningDummyP.nc rename tos/chips/{rf230/IEEE154PacketC.nc => rf2xx/layers/LowPowerListeningLayer.h} (78%) rename tos/chips/{rf230 => rf2xx/layers}/LowPowerListeningLayerC.nc (78%) rename tos/chips/{rf230 => rf2xx/layers}/LowPowerListeningLayerP.nc (67%) rename tos/chips/{rf230 => rf2xx/layers}/MessageBufferLayerC.nc (90%) rename tos/chips/{rf230 => rf2xx/layers}/MessageBufferLayerP.nc (87%) create mode 100644 tos/chips/rf2xx/layers/MetadataFlagsLayer.h create mode 100644 tos/chips/rf2xx/layers/MetadataFlagsLayerC.nc create mode 100644 tos/chips/rf2xx/layers/PacketLinkLayer.h create mode 100644 tos/chips/rf2xx/layers/PacketLinkLayerC.nc create mode 100644 tos/chips/rf2xx/layers/PacketLinkLayerP.nc rename tos/chips/{rf230 => rf2xx/layers}/RandomCollisionConfig.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/RandomCollisionLayerC.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/RandomCollisionLayerP.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/SlottedCollisionConfig.nc (92%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/SlottedCollisionLayerC.nc (98%) rename tos/chips/{rf230 => rf2xx/layers}/SlottedCollisionLayerP.nc (93%) rename tos/chips/{rf230 => rf2xx/layers}/SoftwareAckConfig.nc (93%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/SoftwareAckLayerC.nc (88%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/SoftwareAckLayerP.nc (85%) create mode 100644 tos/chips/rf2xx/layers/TimeStampingLayer.h create mode 100644 tos/chips/rf2xx/layers/TimeStampingLayerC.nc create mode 100644 tos/chips/rf2xx/layers/TimeStampingLayerP.nc create mode 100644 tos/chips/rf2xx/layers/TimeSyncMessageLayer.h create mode 100644 tos/chips/rf2xx/layers/TimeSyncMessageLayerC.nc create mode 100644 tos/chips/rf2xx/layers/TimeSyncMessageLayerP.nc create mode 100644 tos/chips/rf2xx/layers/TinyosNetworkLayer.h create mode 100644 tos/chips/rf2xx/layers/TinyosNetworkLayerC.nc rename tos/chips/{rf230 => rf2xx/layers}/TrafficMonitorConfig.nc (94%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/TrafficMonitorLayerC.nc (99%) rename tos/chips/{rf230 => rf2xx/layers}/TrafficMonitorLayerP.nc (97%) rename tos/chips/{rf230 => rf2xx/layers}/UniqueConfig.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/UniqueLayerC.nc (96%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/UniqueLayerP.nc (88%) mode change 100644 => 100755 create mode 100644 tos/chips/rf2xx/rf212/README create mode 100644 tos/chips/rf2xx/rf212/RF212ActiveMessageC.nc rename tos/chips/{rf230/RF230Config.nc => rf2xx/rf212/RF212DriverConfig.nc} (56%) create mode 100644 tos/chips/rf2xx/rf212/RF212DriverLayer.h create mode 100644 tos/chips/rf2xx/rf212/RF212DriverLayerC.nc create mode 100644 tos/chips/rf2xx/rf212/RF212DriverLayerP.nc create mode 100644 tos/chips/rf2xx/rf212/RF212Ieee154MessageC.nc rename tos/chips/{rf230/DummyLayerP.nc => rf2xx/rf212/RF212Radio.h} (52%) create mode 100644 tos/chips/rf2xx/rf212/RF212RadioC.nc create mode 100644 tos/chips/rf2xx/rf212/RF212RadioP.nc rename tos/chips/{rf230/RF230TimeSyncMessageC.nc => rf2xx/rf212/RF212TimeSyncMessageC.nc} (55%) create mode 100644 tos/chips/rf2xx/rf230/README create mode 100644 tos/chips/rf2xx/rf230/RF230ActiveMessageC.nc create mode 100644 tos/chips/rf2xx/rf230/RF230DriverConfig.nc create mode 100644 tos/chips/rf2xx/rf230/RF230DriverHwAckC.nc create mode 100644 tos/chips/rf2xx/rf230/RF230DriverHwAckP.nc rename tos/chips/{rf230/RF230.h => rf2xx/rf230/RF230DriverLayer.h} (90%) create mode 100644 tos/chips/rf2xx/rf230/RF230DriverLayerC.nc rename tos/chips/{rf230/RF230LayerP.nc => rf2xx/rf230/RF230DriverLayerP.nc} (69%) create mode 100644 tos/chips/rf2xx/rf230/RF230Ieee154MessageC.nc rename tos/chips/{rf230/RF230Packet.h => rf2xx/rf230/RF230Radio.h} (64%) create mode 100644 tos/chips/rf2xx/rf230/RF230RadioC.nc rename tos/chips/{rf230/RF230ActiveMessageP.nc => rf2xx/rf230/RF230RadioP.nc} (58%) create mode 100644 tos/chips/rf2xx/rf230/RF230TimeSyncMessageC.nc create mode 100644 tos/chips/rf2xx/util/BareReceive.nc create mode 100644 tos/chips/rf2xx/util/BareSend.nc create mode 100644 tos/chips/rf2xx/util/MetadataFlagC.nc rename tos/chips/{rf230 => rf2xx/util}/Neighborhood.h (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/Neighborhood.nc (100%) rename tos/chips/{rf230 => rf2xx/util}/NeighborhoodC.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/NeighborhoodFlag.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/NeighborhoodFlagC.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/NeighborhoodP.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/PacketField.nc (100%) create mode 100644 tos/chips/rf2xx/util/PacketFlag.nc rename tos/chips/{rf230 => rf2xx/util}/RadioAlarm.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/RadioAlarmC.nc (96%) rename tos/chips/{rf230 => rf2xx/util}/RadioAlarmP.nc (98%) rename tos/chips/{rf230 => rf2xx/util}/RadioAssert.h (98%) rename tos/chips/{rf230 => rf2xx/util}/RadioCCA.nc (100%) mode change 100644 => 100755 create mode 100644 tos/chips/rf2xx/util/RadioChannel.nc create mode 100644 tos/chips/rf2xx/util/RadioPacket.nc rename tos/chips/{rf230 => rf2xx/util}/RadioReceive.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/RadioSend.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/RadioState.nc (95%) rename tos/chips/{rf230 => rf2xx/util}/Tasklet.h (98%) rename tos/chips/{rf230 => rf2xx/util}/Tasklet.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/TaskletC.nc (100%) mode change 100644 => 100755 rename tos/{platforms/iris/chips/rf230/HplRF230.nc => interfaces/FastSpiByte.nc} (57%) create mode 100644 tos/interfaces/Ieee154Packet.nc create mode 100644 tos/interfaces/Ieee154Send.nc create mode 100644 tos/interfaces/LocalIeeeEui64.nc create mode 100644 tos/interfaces/SystemLowPowerListening.nc create mode 100644 tos/interfaces/UartControl.nc rename tos/lib/diagmsg/{DiagMsgM.nc => DiagMsgP.nc} (91%) mode change 100644 => 100755 tos/lib/ftsp/TimeSync32kC.nc create mode 100644 tos/lib/mac/tkn154/BeaconRequestRxP.nc delete mode 100644 tos/lib/mac/tkn154/CapP.nc create mode 100644 tos/lib/mac/tkn154/DebugC.nc create mode 100644 tos/lib/mac/tkn154/DebugP.nc create mode 100644 tos/lib/mac/tkn154/DisassociateP.nc rename tos/lib/mac/tkn154/{CapQueueP.nc => DispatchQueueP.nc} (68%) create mode 100644 tos/lib/mac/tkn154/DispatchSlottedCsmaP.nc create mode 100644 tos/lib/mac/tkn154/DispatchUnslottedCsmaP.nc create mode 100644 tos/lib/mac/tkn154/PromiscuousModeP.nc rename tos/lib/mac/tkn154/{FrameDispatchImplP.nc => RadioControlImplP.nc} (56%) rename tos/lib/mac/tkn154/{FrameDispatchP.nc => RadioControlP.nc} (62%) delete mode 100644 tos/lib/mac/tkn154/SimpleRoundRobinTransferArbiterC.nc rename tos/lib/mac/tkn154/{TKN154P.nc => TKN154BeaconEnabledP.nc} (60%) create mode 100644 tos/lib/mac/tkn154/TKN154NonBeaconEnabledP.nc delete mode 100644 tos/lib/mac/tkn154/TKN154_DEBUG.h delete mode 100644 tos/lib/mac/tkn154/TransferClientP.nc create mode 100644 tos/lib/mac/tkn154/dummies/NoAssociateP.nc create mode 100644 tos/lib/mac/tkn154/dummies/NoCoordBroadcastP.nc create mode 100644 tos/lib/mac/tkn154/dummies/NoCoordRealignmentP.nc create mode 100644 tos/lib/mac/tkn154/dummies/NoDisassociateP.nc rename tos/lib/mac/tkn154/dummies/{NoCapQueueP.nc => NoDispatchQueueP.nc} (76%) rename tos/lib/mac/tkn154/dummies/{NoCapP.nc => NoDispatchSlottedCsmaP.nc} (58%) create mode 100644 tos/lib/mac/tkn154/dummies/NoPromiscuousModeP.nc create mode 100644 tos/lib/mac/tkn154/dummies/NoRxEnableP.nc delete mode 100644 tos/lib/mac/tkn154/interfaces/private/ResourceTransfer.nc delete mode 100644 tos/lib/mac/tkn154/interfaces/private/ResourceTransferConnector.nc delete mode 100644 tos/lib/mac/tkn154/interfaces/private/ResourceTransferControl.nc delete mode 100644 tos/lib/mac/tkn154/interfaces/private/ResourceTransferred.nc create mode 100644 tos/lib/mac/tkn154/interfaces/private/SlottedCsmaCa.nc create mode 100644 tos/lib/mac/tkn154/interfaces/private/SuperframeStructure.nc create mode 100644 tos/lib/mac/tkn154/interfaces/private/TransferableResource.nc create mode 100644 tos/lib/mac/tkn154/interfaces/private/UnslottedCsmaCa.nc create mode 100644 tos/lib/net/Deluge/extra/epic/TOSBoot_platform.h create mode 100644 tos/lib/net/Deluge/extra/m16c62p/HplM16c62pFlash.nc create mode 100644 tos/lib/net/Deluge/extra/m16c62p/HplM16c62pFlashC.nc create mode 100644 tos/lib/net/Deluge/extra/m16c62p/InternalFlashC.nc create mode 100644 tos/lib/net/Deluge/extra/m16c62p/InternalFlashP.nc create mode 100644 tos/lib/net/Deluge/extra/m16c62p/M16c62pFlash.h create mode 100644 tos/lib/net/Deluge/extra/mulle/NetProg_platform.h create mode 100644 tos/lib/net/Deluge/extra/mulle/ReprogramGuardC.nc create mode 100644 tos/lib/net/Deluge/extra/mulle/ReprogramGuardP.nc create mode 100644 tos/lib/net/Deluge/extra/mulle/TOSBoot_platform.h create mode 100644 tos/lib/net/Deluge/extra/telos/ReprogramGuardC.nc create mode 100644 tos/lib/net/Deluge/extra/telos/ReprogramGuardP.nc rename tos/lib/net/Deluge/{Crc.nc => extra/tinynode/NetProg_platform.h} (83%) create mode 100644 tos/lib/net/Deluge/extra/tinynode/README create mode 100644 tos/lib/net/Deluge/extra/tinynode/ReprogramGuardC.nc create mode 100644 tos/lib/net/Deluge/extra/tinynode/ReprogramGuardP.nc create mode 100644 tos/lib/net/Deluge/extra/tinynode/TOSBoot_platform.h create mode 100644 tos/lib/net/blip/ICMP.h create mode 100644 tos/lib/net/blip/ICMPResponderC.nc create mode 100644 tos/lib/net/blip/ICMPResponderP.nc create mode 100644 tos/lib/net/blip/IPAddressC.nc create mode 100644 tos/lib/net/blip/IPAddressP.nc create mode 100644 tos/lib/net/blip/IPDispatch.h create mode 100644 tos/lib/net/blip/IPDispatchC.nc create mode 100644 tos/lib/net/blip/IPDispatchP.nc create mode 100644 tos/lib/net/blip/IPExtensionP.nc create mode 100644 tos/lib/net/blip/IPExtensionsP.nc create mode 100644 tos/lib/net/blip/IPRoutingP.nc create mode 100644 tos/lib/net/blip/PrintfUART.h create mode 100644 tos/lib/net/blip/ReadLqiC.nc create mode 100644 tos/lib/net/blip/ResourceSendP.nc create mode 100644 tos/lib/net/blip/Statistics.h create mode 100644 tos/lib/net/blip/TcpC.nc create mode 100644 tos/lib/net/blip/TcpP.nc create mode 100644 tos/lib/net/blip/TcpSocketC.nc create mode 100644 tos/lib/net/blip/TrackFlowsC.nc create mode 100644 tos/lib/net/blip/TrackFlowsP.nc create mode 100644 tos/lib/net/blip/UdpC.nc create mode 100644 tos/lib/net/blip/UdpP.nc create mode 100644 tos/lib/net/blip/UdpSocketC.nc create mode 100644 tos/lib/net/blip/doc/README create mode 100644 tos/lib/net/blip/doc/README-IP create mode 100644 tos/lib/net/blip/doc/README-MERAKI create mode 100644 tos/lib/net/blip/doc/README-NWPROG create mode 100644 tos/lib/net/blip/doc/README-SHELL create mode 100644 tos/lib/net/blip/doc/README-SIM create mode 100644 tos/lib/net/blip/doc/README-TCP create mode 100644 tos/lib/net/blip/doc/README-UDP create mode 100644 tos/lib/net/blip/interfaces/ICMP.nc create mode 100644 tos/lib/net/blip/interfaces/ICMPPing.nc create mode 100644 tos/lib/net/blip/interfaces/IP.nc create mode 100644 tos/lib/net/blip/interfaces/IPAddress.nc create mode 100644 tos/lib/net/blip/interfaces/IPExtensions.nc create mode 100644 tos/lib/net/blip/interfaces/IPRouting.nc create mode 100644 tos/lib/net/blip/interfaces/InternalIPExtension.nc create mode 100644 tos/lib/net/blip/interfaces/ReadLqi.nc create mode 100644 tos/lib/net/blip/interfaces/Statistics.nc create mode 100644 tos/lib/net/blip/interfaces/TLVHeader.nc create mode 100644 tos/lib/net/blip/interfaces/Tcp.nc create mode 100644 tos/lib/net/blip/interfaces/UDP.nc create mode 100644 tos/lib/net/blip/nwprog/BootImage.nc create mode 100644 tos/lib/net/blip/nwprog/Deluge.h create mode 100644 tos/lib/net/blip/nwprog/DelugePatch.nc create mode 100644 tos/lib/net/blip/nwprog/DelugePatchC.nc create mode 100644 tos/lib/net/blip/nwprog/DelugePatchClientC.nc create mode 100644 tos/lib/net/blip/nwprog/DelugePatchP.nc create mode 100644 tos/lib/net/blip/nwprog/DelugeReadIdent.nc create mode 100644 tos/lib/net/blip/nwprog/DelugeReadIdentC.nc create mode 100644 tos/lib/net/blip/nwprog/DelugeReadIdentClientC.nc create mode 100644 tos/lib/net/blip/nwprog/DelugeReadIdentP.nc create mode 100644 tos/lib/net/blip/nwprog/DelugeVerify.nc create mode 100644 tos/lib/net/blip/nwprog/DelugeVerifyC.nc create mode 100644 tos/lib/net/blip/nwprog/DelugeVerifyClientC.nc create mode 100644 tos/lib/net/blip/nwprog/DelugeVerifyP.nc create mode 100644 tos/lib/net/blip/nwprog/NWProgC.nc create mode 100644 tos/lib/net/blip/nwprog/NWProgP.nc create mode 100644 tos/lib/net/blip/platform/CC2420ReadLqiC.nc create mode 100644 tos/lib/net/blip/platform/RF230ReadLqiC.nc create mode 100644 tos/lib/net/blip/serial/SerialDevConf.h create mode 100644 tos/lib/net/blip/serial/SerialDevConfC.nc create mode 100644 tos/lib/net/blip/serial/SerialPacketInfoDevConfP.nc create mode 100644 tos/lib/net/blip/shell/FlashShellC.nc create mode 100644 tos/lib/net/blip/shell/FlashShellP.nc create mode 100644 tos/lib/net/blip/shell/RegisterShellCommand.nc create mode 100644 tos/lib/net/blip/shell/Shell.h create mode 100644 tos/lib/net/blip/shell/ShellCommand.nc create mode 100644 tos/lib/net/blip/shell/ShellCommandC.nc create mode 100644 tos/lib/net/blip/shell/ShellCommandP.nc create mode 100644 tos/lib/net/blip/shell/UDPShellC.nc create mode 100644 tos/lib/net/blip/shell/UDPShellP.nc create mode 100644 tos/lib/net/blip/table.c create mode 100644 tos/lib/net/blip/table.h create mode 100755 tos/lib/net/dhv/AMDhvC.nc create mode 100755 tos/lib/net/dhv/AMDhvP.nc create mode 100755 tos/lib/net/dhv/Dhv.h create mode 100755 tos/lib/net/dhv/DhvDataC.nc create mode 100755 tos/lib/net/dhv/DhvDataP.nc create mode 100755 tos/lib/net/dhv/DhvHSumC.nc create mode 100755 tos/lib/net/dhv/DhvHSumP.nc create mode 100755 tos/lib/net/dhv/DhvLogicC.nc create mode 100755 tos/lib/net/dhv/DhvLogicP.nc create mode 100755 tos/lib/net/dhv/DhvSummaryC.nc create mode 100755 tos/lib/net/dhv/DhvSummaryP.nc create mode 100755 tos/lib/net/dhv/DhvTrickleMilliC.nc create mode 100755 tos/lib/net/dhv/DhvTrickleMilliP.nc create mode 100755 tos/lib/net/dhv/DhvVBitC.nc create mode 100755 tos/lib/net/dhv/DhvVBitP.nc create mode 100755 tos/lib/net/dhv/DhvVectorC.nc create mode 100755 tos/lib/net/dhv/DhvVectorP.nc create mode 100755 tos/lib/net/dhv/DhvVersionC.nc create mode 100755 tos/lib/net/dhv/DhvVersionP.nc create mode 100755 tos/lib/net/dhv/DisseminationC.nc create mode 100755 tos/lib/net/dhv/DisseminatorC.nc create mode 100755 tos/lib/net/dhv/DisseminatorP.nc create mode 100755 tos/lib/net/dhv/README create mode 100755 tos/lib/net/dhv/interfaces/DhvCache.nc create mode 100755 tos/lib/net/dhv/interfaces/DhvDecision.nc create mode 100755 tos/lib/net/dhv/interfaces/DhvEstimates.nc create mode 100755 tos/lib/net/dhv/interfaces/DhvHelp.nc create mode 100755 tos/lib/net/dhv/interfaces/DhvLogic.nc create mode 100755 tos/lib/net/dhv/interfaces/DhvNeighbour.nc create mode 100755 tos/lib/net/dhv/interfaces/DhvReceive.nc create mode 100755 tos/lib/net/dhv/interfaces/DhvSend.nc create mode 100755 tos/lib/net/dhv/interfaces/DhvStateLogic.nc create mode 100755 tos/lib/net/dhv/interfaces/DhvTrickleTimer.nc create mode 100755 tos/lib/net/dhv/interfaces/DhvVersion.nc delete mode 100644 tos/lib/net/zigbee/apps/AssociationExample/AssociationExample.nc create mode 100644 tos/lib/net/zigbee/apps/AssociationExample/AssociationExampleC.nc rename tos/lib/net/zigbee/apps/AssociationExample/{AssociationExampleM.nc => AssociationExampleP.nc} (99%) delete mode 100644 tos/lib/net/zigbee/apps/DataSendExample/DataSendExample.nc create mode 100644 tos/lib/net/zigbee/apps/DataSendExample/DataSendExampleC.nc rename tos/lib/net/zigbee/apps/DataSendExample/{DataSendExampleM.nc => DataSendExampleP.nc} (99%) delete mode 100644 tos/lib/net/zigbee/apps/GTSManagementExample/GTSManagementExample.nc create mode 100644 tos/lib/net/zigbee/apps/GTSManagementExample/GTSManagementExampleC.nc rename tos/lib/net/zigbee/apps/GTSManagementExample/{GTSManagementExampleM.nc => GTSManagementExampleP.nc} (99%) delete mode 100644 tos/lib/net/zigbee/apps/SimpleRoutingExample/SimpleRoutingExample.nc create mode 100644 tos/lib/net/zigbee/apps/SimpleRoutingExample/SimpleRoutingExampleC.nc rename tos/lib/net/zigbee/apps/SimpleRoutingExample/{SimpleRoutingExampleM.nc => SimpleRoutingExampleP.nc} (99%) delete mode 100644 tos/lib/net/zigbee/apps/Test_APL/Test_APL.nc create mode 100644 tos/lib/net/zigbee/apps/Test_APL/Test_APLC.nc rename tos/lib/net/zigbee/apps/Test_APL/{Test_APLM.nc => Test_APLP.nc} (98%) create mode 100644 tos/lib/net/zigbee/cc2420/CC2420Config.nc rename tos/lib/net/zigbee/ieee802154/includes/{PrintfUART.h => printfUART.h} (99%) rename tos/lib/net/zigbee/ieee802154/mac/{Mac.nc => MacC.nc} (57%) rename tos/lib/net/zigbee/ieee802154/mac/{MacM.nc => MacP.nc} (99%) rename tos/lib/net/zigbee/ieee802154/macTDBS/{Mac.nc => MacC.nc} (57%) rename tos/lib/net/zigbee/ieee802154/macTDBS/{MacM.nc => MacP.nc} (99%) delete mode 100644 tos/lib/net/zigbee/ieee802154/nwk/NWK.nc create mode 100644 tos/lib/net/zigbee/ieee802154/nwk/NWKC.nc rename tos/lib/net/zigbee/ieee802154/nwk/{NWKM.nc => NWKP.nc} (97%) rename tos/lib/net/zigbee/ieee802154/phy/{Phy.nc => PhyC.nc} (57%) rename tos/lib/net/zigbee/ieee802154/phy/{PhyM.nc => PhyP.nc} (99%) create mode 100644 tos/lib/net/zigbee/wrapper/WrapperC.nc create mode 100644 tos/lib/net/zigbee/wrapper/WrapperP.nc create mode 100644 tos/lib/net/zigbee/wrapper/includes/frame_format.h create mode 100644 tos/lib/net/zigbee/wrapper/includes/mac_const.h create mode 100644 tos/lib/net/zigbee/wrapper/includes/mac_enumerations.h create mode 100644 tos/lib/net/zigbee/wrapper/includes/mac_func.h create mode 100644 tos/lib/net/zigbee/wrapper/includes/nwk_func.h create mode 100644 tos/lib/net/zigbee/wrapper/includes/phy_const.h create mode 100644 tos/lib/net/zigbee/wrapper/includes/phy_enumerations.h create mode 100644 tos/lib/net/zigbee/wrapper/includes/printfUART.h create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MCPS_DATA.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MCPS_PURGE.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_ASSOCIATE.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_BEACON_NOTIFY.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_DISASSOCIATE.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_GET.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_GTS.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_ORPHAN.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_POLL.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_RESET.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_RX_ENABLE.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_SCAN.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_SET.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_START.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_SYNC.nc create mode 100644 tos/lib/net/zigbee/wrapper/interfaces/mac/OPENZB_MLME_SYNC_LOSS.nc create mode 100644 tos/lib/printf/generic_printf.h create mode 100644 tos/lib/safe/SafeFailureHandlerC.nc create mode 100644 tos/lib/safe/SafeFailureHandlerP.nc delete mode 100644 tos/lib/safe/avr/fail.c delete mode 100644 tos/lib/safe/msp430/fail.c rename tos/lib/tosboot/{TOSBoot.h => TosBoot.h} (100%) rename tos/lib/tosboot/{TOSBoot.nc => TosBootC.nc} (73%) rename tos/lib/tosboot/{TOSBootM.nc => TosBootP.nc} (96%) rename tos/lib/tosboot/avr/{ProgFlashM.nc => ProgFlashC.nc} (98%) rename tos/lib/{net/Deluge/extra/telosb/InternalFlash.nc => tosboot/epic/ExtFlashC.nc} (75%) create mode 100644 tos/lib/tosboot/epic/ExtFlashP.nc create mode 100644 tos/lib/tosboot/epic/hardware.h rename tos/lib/tosboot/iris/{ProgFlashM.nc => ProgFlashC.nc} (98%) create mode 100644 tos/lib/tosboot/m16c62p/HardwareC.nc create mode 100644 tos/lib/tosboot/m16c62p/ProgFlashC.nc create mode 100644 tos/lib/tosboot/m16c62p/ProgFlashP.nc rename tos/lib/tosboot/msp430/{HPLUSART0M.nc => HplUsart0C.nc} (81%) rename tos/lib/tosboot/msp430/{HPLUSARTControl.nc => HplUsartControl.nc} (96%) rename tos/lib/tosboot/msp430/{ProgFlashM.nc => ProgFlashC.nc} (99%) rename tos/lib/tosboot/{telosb => msp430f1611}/PluginC.nc (90%) rename tos/lib/tosboot/{telosb/PowerOffM.nc => msp430f1611/PowerOffC.nc} (99%) rename tos/lib/tosboot/{telosb => msp430f1611}/TOSBoot_platform.h (80%) create mode 100644 tos/lib/tosboot/mulle/ExecC.nc create mode 100644 tos/lib/tosboot/mulle/PluginC.nc create mode 100644 tos/lib/tosboot/mulle/VoltageC.nc create mode 100644 tos/lib/tosboot/mulle/hardware.h create mode 100644 tos/lib/tosboot/mulle/m16chardware.h rename tos/lib/tosboot/stm25p/{ExtFlashM.nc => ExtFlashP.nc} (79%) rename tos/lib/tosboot/{telosb/InternalFlash.nc => tinynode/ExecC.nc} (76%) create mode 100644 tos/lib/tosboot/tinynode/ExtFlashC.nc create mode 100644 tos/lib/tosboot/tinynode/PowerOffC.nc create mode 100644 tos/lib/tosboot/tinynode/README create mode 100644 tos/lib/tosboot/tinynode/TOSBoot_platform.h rename tos/lib/{net/Deluge/extra/telosb/InternalFlash.h => tosboot/tinynode/VoltageC.nc} (60%) create mode 100644 tos/lib/tosboot/tinynode/hardware.h delete mode 100644 tos/lib/tossim/HilTimerMilliC.nc create mode 100644 tos/lib/tosthreads/chips/msp430/sensors/BlockingMsp430InternalTemperatureC.nc create mode 100644 tos/lib/tosthreads/chips/msp430/sensors/BlockingMsp430InternalVoltageC.nc create mode 100644 tos/lib/tosthreads/chips/rf230/ActiveMessageLayerP.nc create mode 100644 tos/lib/tosthreads/chips/rf230/RF230RadioC.nc create mode 100644 tos/lib/tosthreads/csystem/CConfigStorageC.nc create mode 100644 tos/lib/tosthreads/csystem/CConfigStorageP.nc create mode 100644 tos/lib/tosthreads/csystem/CRandomC.nc create mode 100644 tos/lib/tosthreads/csystem/CRandomP.nc create mode 100644 tos/lib/tosthreads/csystem/tosthread_configstorage.h create mode 100644 tos/lib/tosthreads/csystem/tosthread_random.h delete mode 100644 tos/lib/tosthreads/csystem/tosthread_tenet.h create mode 100644 tos/lib/tosthreads/interfaces/BlockingConfig.nc create mode 100644 tos/lib/tosthreads/interfaces/BlockingMount.nc create mode 100644 tos/lib/tosthreads/lib/net/CCollectionId.nc rename tos/lib/tosthreads/lib/net/{ => ctp}/BlockingCollectionSenderImplP.nc (100%) rename tos/lib/tosthreads/lib/net/{ => ctp}/BlockingCollectionSenderP.nc (100%) create mode 100644 tos/lib/tosthreads/lib/net/ctp/CCollectionIdP.nc rename tos/lib/tosthreads/lib/net/{ => ctp}/CCollectionP.nc (71%) create mode 100644 tos/lib/tosthreads/lib/net/ctp/ccollection.h create mode 100644 tos/lib/tosthreads/lib/net/lqi/BlockingCollectionSenderImplP.nc create mode 100644 tos/lib/tosthreads/lib/net/lqi/BlockingCollectionSenderP.nc create mode 100644 tos/lib/tosthreads/lib/net/lqi/CCollectionIdP.nc create mode 100644 tos/lib/tosthreads/lib/net/lqi/CCollectionP.nc create mode 100644 tos/lib/tosthreads/lib/net/lqi/ccollection.h create mode 100644 tos/lib/tosthreads/lib/serial/SerialActiveMessageC.nc create mode 100644 tos/lib/tosthreads/lib/serial/SerialActiveMessageP.nc create mode 100644 tos/lib/tosthreads/lib/tinyld/BigCrc.nc create mode 100644 tos/lib/tosthreads/lib/tinyld/BigCrcC.nc create mode 100644 tos/lib/tosthreads/lib/tinyld/BigCrcP.nc create mode 100755 tos/lib/tosthreads/lib/tinyld/DynamicLoader.h create mode 100755 tos/lib/tosthreads/lib/tinyld/DynamicLoader.nc create mode 100755 tos/lib/tosthreads/lib/tinyld/DynamicLoaderC.nc create mode 100755 tos/lib/tosthreads/lib/tinyld/DynamicLoaderP.nc create mode 100755 tos/lib/tosthreads/lib/tinyld/LoadSourceMapC.nc create mode 100755 tos/lib/tosthreads/lib/tinyld/LoadSourceMapP.nc create mode 100755 tos/lib/tosthreads/lib/tinyld/MemoryStorageC.nc create mode 100755 tos/lib/tosthreads/lib/tinyld/MemoryStorageP.nc create mode 100755 tos/lib/tosthreads/lib/tinyld/NullVolumeMapC.nc rename tos/lib/tosthreads/{interfaces/BlockingBlockWrite.nc => lib/tinyld/PMManager.nc} (87%) create mode 100644 tos/lib/tosthreads/lib/tinyld/PMManagerC.nc create mode 100644 tos/lib/tosthreads/lib/tinyld/PMManagerP.nc create mode 100644 tos/lib/tosthreads/lib/tinyld/TosThreadApiC.nc create mode 100755 tos/lib/tosthreads/lib/tinyld/UserButton.nc create mode 100755 tos/lib/tosthreads/lib/tinyld/UserButtonC.nc create mode 100755 tos/lib/tosthreads/lib/tinyld/UserButtonP.nc create mode 100755 tos/lib/tosthreads/lib/tinyld/slcs_types.h create mode 100755 tos/lib/tosthreads/lib/tinyld/tosthread_slcs_types.h create mode 100644 tos/lib/tosthreads/platforms/epic/ActiveMessageC.nc create mode 100644 tos/lib/tosthreads/platforms/epic/TelosSerialP.nc create mode 100644 tos/lib/tosthreads/system/BlockingConfigStorageC.nc create mode 100644 tos/lib/tosthreads/system/BlockingConfigStorageImplP.nc create mode 100644 tos/lib/tosthreads/system/BlockingConfigStorageP.nc create mode 100644 tos/lib/tosthreads/system/BlockingSendC.nc create mode 100644 tos/lib/tosthreads/system/BlockingSendImplP.nc create mode 100644 tos/lib/tosthreads/system/BlockingSendP.nc create mode 100644 tos/platforms/epic/.platform create mode 100644 tos/platforms/epic/DemoSensorC.nc create mode 100644 tos/platforms/epic/DemoSensorNowC.nc create mode 100644 tos/platforms/epic/DemoSensorStreamC.nc create mode 100644 tos/platforms/epic/HplUserButtonC.nc create mode 100644 tos/platforms/epic/Ieee154MessageC.nc create mode 100644 tos/platforms/epic/MoteClockC.nc create mode 100644 tos/platforms/epic/MoteClockP.nc create mode 100644 tos/platforms/epic/MotePlatformC.nc create mode 100644 tos/platforms/epic/PlatformC.nc create mode 100644 tos/platforms/epic/PlatformLedsC.nc create mode 100644 tos/platforms/epic/PlatformP.nc create mode 100644 tos/platforms/epic/UserButton.h create mode 100644 tos/platforms/epic/UserButtonC.nc create mode 100644 tos/platforms/epic/UserButtonP.nc create mode 100644 tos/platforms/epic/VoltageC.nc create mode 100644 tos/platforms/epic/VoltageStreamC.nc create mode 100644 tos/platforms/epic/chips/at45db/HplAt45dbC.nc create mode 100644 tos/platforms/epic/chips/at45db/HplAt45dbP.nc create mode 100644 tos/platforms/epic/chips/at45db/HplAt45db_chip.h create mode 100644 tos/platforms/epic/chips/ds2411/CachedIeeeEui64C.nc create mode 100644 tos/platforms/epic/chips/ds2411/LocalIeeeEui64C.nc create mode 100644 tos/platforms/epic/chips/ds2411/PlatformIeeeEui64.h create mode 100644 tos/platforms/epic/hardware.h create mode 100644 tos/platforms/epic/platform.h create mode 100644 tos/platforms/epic/platform_message.h create mode 100644 tos/platforms/eyesIFX/WhiteBitAccessorC.nc create mode 100644 tos/platforms/eyesIFX/net/lqi/CC2420ActiveMessageC.nc create mode 100644 tos/platforms/eyesIFX/net/lqi/CC2420Packet.nc create mode 100644 tos/platforms/iris/Ieee154MessageC.nc create mode 100644 tos/platforms/iris/chips/ds2401/PlatformIeeeEui64.h rename tos/platforms/iris/chips/rf230/{HplRF230.h => RadioConfig.h} (59%) create mode 100644 tos/platforms/mica2/TimeSyncMessageC.nc create mode 100644 tos/platforms/mica2/chips/ds2401/CachedIeeeEui64C.nc create mode 100644 tos/platforms/mica2/chips/ds2401/LocalIeeeEui64C.nc create mode 100644 tos/platforms/micaz/Ieee154MessageC.nc create mode 100644 tos/platforms/micaz/mac/tkn154/Makefile.include create mode 100644 tos/platforms/micaz/mac/tkn154/README.txt create mode 100644 tos/platforms/micaz/mac/tkn154/TKN154TimingP.nc rename tos/{lib/mac/tkn154/dummies/NoDeviceCapQueueP.nc => platforms/micaz/mac/tkn154/TKN154_platform.h} (67%) create mode 100644 tos/platforms/micaz/mac/tkn154/platform_message.h create mode 100755 tos/platforms/mulle/.platform rename tos/{chips/rf230/RF230PacketC.nc => platforms/mulle/ActiveMessageC.nc} (54%) mode change 100644 => 100755 create mode 100755 tos/platforms/mulle/DemoSensorC.nc create mode 100644 tos/platforms/mulle/DemoSensorNowC.nc create mode 100644 tos/platforms/mulle/DemoSensorP.nc create mode 100644 tos/platforms/mulle/DemoSensorStreamC.nc create mode 100644 tos/platforms/mulle/Ieee154MessageC.nc create mode 100755 tos/platforms/mulle/PlatformC.nc create mode 100755 tos/platforms/mulle/PlatformLedsC.nc create mode 100755 tos/platforms/mulle/PlatformP.nc create mode 100755 tos/platforms/mulle/PlatformSerialC.nc create mode 100644 tos/platforms/mulle/PlatformSerialP.nc create mode 100755 tos/platforms/mulle/TimeSyncMessageC.nc create mode 100644 tos/platforms/mulle/button/HplUserButtonC.nc create mode 100644 tos/platforms/mulle/button/UserButton.h create mode 100644 tos/platforms/mulle/button/UserButtonC.nc create mode 100644 tos/platforms/mulle/button/UserButtonP.nc create mode 100644 tos/platforms/mulle/chips/at45db/At45dbSpi.h create mode 100644 tos/platforms/mulle/chips/at45db/HplAt45dbC.nc create mode 100644 tos/platforms/mulle/chips/at45db/HplAt45dbP.nc create mode 100644 tos/platforms/mulle/chips/at45db/HplAt45db_chip.h create mode 100755 tos/platforms/mulle/chips/at45db/SoftSpiAt45dbC.nc create mode 100755 tos/platforms/mulle/chips/at45db/SoftSpiAt45dbP.nc create mode 100644 tos/platforms/mulle/chips/ds2782/DS2782InternalC.nc create mode 100644 tos/platforms/mulle/chips/m16c62p/M16c62pAdcPlatformC.nc create mode 100644 tos/platforms/mulle/chips/m16c62p/M16c62pAdcPlatformP.nc create mode 100644 tos/platforms/mulle/chips/m16c62p/M16c62pControlPlatformC.nc create mode 100644 tos/platforms/mulle/chips/mma7261qt/HplMMA7261QTC.nc create mode 100644 tos/platforms/mulle/chips/mma7261qt/HplMMA7261QTP.nc create mode 100755 tos/platforms/mulle/chips/rf230/HplRF230C.nc create mode 100755 tos/platforms/mulle/chips/rf230/HplRF230P.nc create mode 100755 tos/platforms/mulle/chips/rf230/Mulle_RF230Spi.h create mode 100644 tos/platforms/mulle/chips/rf230/RF230SplitControlP.nc create mode 100644 tos/platforms/mulle/chips/rf230/RadioConfig.h create mode 100755 tos/platforms/mulle/chips/rf230/SoftSpiRF230C.nc create mode 100755 tos/platforms/mulle/chips/rf230/SoftSpiRF230P.nc create mode 100755 tos/platforms/mulle/chips/rv8564/RV8564.nc create mode 100755 tos/platforms/mulle/chips/rv8564/RV8564C.nc create mode 100755 tos/platforms/mulle/chips/rv8564/RV8564P.nc create mode 100755 tos/platforms/mulle/chips/rv8564/rv8564.h create mode 100644 tos/platforms/mulle/debug/m_printf.h create mode 100755 tos/platforms/mulle/hardware.h create mode 100755 tos/platforms/mulle/platform.h create mode 100755 tos/platforms/mulle/platform_message.h create mode 100755 tos/platforms/mulle/softwarei2c/MulleI2C.h create mode 100755 tos/platforms/mulle/softwarei2c/SoftI2CBatteryMonitorRTCC.nc create mode 100644 tos/platforms/mulle/softwarei2c/SoftI2CBatteryMonitorRTCP.nc create mode 100755 tos/platforms/mulle/softwarei2c/SoftI2CBus.nc create mode 100755 tos/platforms/mulle/softwarei2c/SoftI2CBusP.nc create mode 100755 tos/platforms/mulle/softwarei2c/SoftI2CMasterImplP.nc create mode 100755 tos/platforms/mulle/softwarei2c/SoftI2CMasterP.nc create mode 100755 tos/platforms/mulle/softwarei2c/SoftI2CMasterPacketP.nc create mode 100755 tos/platforms/mulle/softwarespi/SoftSpiBus.nc create mode 100755 tos/platforms/mulle/softwarespi/SoftSpiBusP.nc create mode 100755 tos/platforms/mulle/softwarespi/SoftSpiMasterImplP.nc create mode 100755 tos/platforms/mulle/softwarespi/SoftSpiMasterP.nc create mode 100755 tos/platforms/mulle/softwarespi/SoftSpiMasterPacketP.nc create mode 100755 tos/platforms/mulle/system/LedsP.nc create mode 100755 tos/platforms/mulle/timers/AlarmMicro16C.nc create mode 100755 tos/platforms/mulle/timers/AlarmMicro32C.nc create mode 100755 tos/platforms/mulle/timers/BusyWaitMicroC.nc create mode 100755 tos/platforms/mulle/timers/CounterMicro16C.nc create mode 100755 tos/platforms/mulle/timers/CounterMicro32C.nc create mode 100755 tos/platforms/mulle/timers/HilTimerMilliC.nc create mode 100755 tos/platforms/mulle/timers/LocalTimeMicroC.nc create mode 100755 tos/platforms/mulle/timers/TimerConfig.h create mode 100644 tos/platforms/mulle/timers/rf230/AlarmRF23016C.nc create mode 100644 tos/platforms/mulle/timers/rf230/CounterRF23016C.nc create mode 100755 tos/platforms/mulle/timers/stop/RV8564AlarmCounterMilli32C.nc create mode 100755 tos/platforms/mulle/timers/stop/RV8564AlarmCounterMilli32P.nc create mode 100755 tos/platforms/mulle/timers/wait/AlarmCounterMilli32C.nc create mode 100644 tos/platforms/shimmer/HplUserButtonC.nc create mode 100644 tos/platforms/shimmer/Ieee154MessageC.nc create mode 100644 tos/platforms/shimmer/SwitchToggleC.nc create mode 100644 tos/platforms/shimmer/UserButton.h create mode 100644 tos/platforms/shimmer/UserButtonC.nc create mode 100644 tos/platforms/shimmer/UserButtonP.nc create mode 100644 tos/platforms/shimmer/chips/bluetooth/Bluetooth.nc create mode 100644 tos/platforms/shimmer/chips/bluetooth/RovingNetworks.h create mode 100644 tos/platforms/shimmer/chips/bluetooth/RovingNetworksC.nc create mode 100644 tos/platforms/shimmer/chips/bluetooth/RovingNetworksP.nc create mode 100644 tos/platforms/shimmer/chips/bluetooth/bluetoothBaudrateConversion.pdf create mode 100644 tos/platforms/shimmer/chips/msp430/msp430hardware.h create mode 100644 tos/platforms/shimmer/shimmerMessage.h create mode 100644 tos/platforms/shimmer2/.platform create mode 100644 tos/platforms/shimmer2/ActiveMessageC.nc create mode 100644 tos/platforms/shimmer2/HplUserButtonC.nc create mode 100644 tos/platforms/shimmer2/Leds.nc create mode 100644 tos/platforms/shimmer2/LedsC.nc create mode 100644 tos/platforms/shimmer2/LedsP.nc create mode 100644 tos/platforms/shimmer2/MoteClockC.nc create mode 100644 tos/platforms/shimmer2/MotePlatformC.nc create mode 100644 tos/platforms/shimmer2/Msp430Timer32khzMapC.nc create mode 100644 tos/platforms/shimmer2/NoLedsC.nc create mode 100644 tos/platforms/shimmer2/PlatformC.nc create mode 100644 tos/platforms/shimmer2/PlatformLedsC.nc create mode 100644 tos/platforms/shimmer2/PlatformP.nc create mode 100644 tos/platforms/shimmer2/PlatformSerialC.nc create mode 100644 tos/platforms/shimmer2/ShimmerSerialP.nc create mode 100644 tos/platforms/shimmer2/chips/cc2420/HplCC2420AlarmC.nc create mode 100644 tos/platforms/shimmer2/chips/cc2420/HplCC2420InterruptsC.nc create mode 100644 tos/platforms/shimmer2/chips/cc2420/HplCC2420InterruptsP.nc create mode 100644 tos/platforms/shimmer2/chips/cc2420/HplCC2420PinsC.nc create mode 100644 tos/platforms/shimmer2/chips/cc2420/HplCC2420SpiC.nc create mode 100644 tos/platforms/shimmer2/chips/tilt/HplTiltDetectorC.nc create mode 100644 tos/platforms/shimmer2/chips/tilt/TiltDetectorC.nc create mode 100644 tos/platforms/shimmer2/hardware.h create mode 100644 tos/platforms/shimmer2/platform.h create mode 100644 tos/platforms/shimmer2/platform_message.h create mode 100644 tos/platforms/telosa/Ieee154MessageC.nc rename tos/platforms/telosb/mac/tkn154/{Ieee802154MacC.nc => Ieee802154BeaconEnabledC.nc} (93%) create mode 100644 tos/platforms/telosb/mac/tkn154/Ieee802154NonBeaconEnabledC.nc create mode 100644 tos/platforms/telosb/mac/tkn154/timer/Alarm62500hz32C.nc create mode 100644 tos/platforms/telosb/mac/tkn154/timer/Alarm62500hz32P.nc create mode 100644 tos/system/DirectAMSenderC.nc create mode 100644 tos/system/LplAMSenderC.nc create mode 100644 tos/system/LplAMSenderP.nc create mode 100644 tos/system/SystemLowPowerListeningC.nc create mode 100644 tos/system/SystemLowPowerListeningP.nc create mode 100644 tos/types/Ieee154.h create mode 100644 tos/types/IeeeEui64.h create mode 100644 tos/types/Lpl.h diff --git a/apps/6lowpancli/CliAppC.nc b/apps/6lowpancli/CliAppC.nc deleted file mode 100644 index 5c6fd648..00000000 --- a/apps/6lowpancli/CliAppC.nc +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2007 Matus Harvan - * All rights reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "printf.h" - -#if defined(ENABLE_MICAZ_TEMP_SENSOR) || defined(ENABLE_TELOSB_TEMP_SENSOR) -#define ENABLE_TEMP_SENSOR -#endif /* ENABLE_MICAZ_TEMP_SENSOR || ENABLE_TELOSB_TEMP_SENSOR */ - -#if defined(ENABLE_MICAZ_LIGHT_SENSOR) || defined(ENABLE_TELOSB_LIGHT_SENSOR) -#define ENABLE_LIGHT_SENSOR -#endif /* ENABLE_MICAZ_LIGHT_SENSOR || ENABLE_TELOSB_LIGHT_SENSOR */ - -enum { - AM_IP_MSG = 0x41, -}; - -configuration CliAppC {} -implementation { - components CliC as App, LedsC, MainC; - components IPC; - - App.Boot -> MainC.Boot; - App.Leds -> LedsC; - App.IPControl -> IPC.IPControl; - App.IP -> IPC.IP; - App.UDPClient -> IPC.UDPClient[unique("UDPClient")]; - -#ifdef ENABLE_SOUNDER - components SounderC; - App.Sounder -> SounderC; -#endif /* ENABLE_SOUNDER */ - -#ifdef ENABLE_MICAZ_TEMP_SENSOR - components new TempC(); // telosb temp/humidity sensor - App.TempSensorC -> TempC; -#endif /* ENABLE_MICAZ_TEMP_SENSOR */ - -#ifdef ENABLE_TELOSB_TEMP_SENSOR - components new SensirionSht11C(); // telosb temp/humidity sensor - App.TempSensorC -> SensirionSht11C.Temperature; -#endif /* ENABLE_TELOSB_TEMP_SENSOR */ - -#ifdef ENABLE_MICAZ_LIGHT_SENSOR - components new PhotoC();// telosb visible light sensor - App.LightSensorC -> PhotoC; -#endif /* ENABLE_MICAZ_TEMP_SENSOR */ - -#ifdef ENABLE_TELOSB_LIGHT_SENSOR - // total solar radiation sensor - //new HamamatsuS10871TsrC() as Sensor, // telosb (IR) light sensor - // photosynthetically-active radiation sensor - components new HamamatsuS1087ParC();// telosb visible light sensor - App.LightSensorC -> HamamatsuS1087ParC; -#endif /* ENABLE_TELOSB_TEMP_SENSOR */ -} - - - diff --git a/apps/6lowpancli/CliC.nc b/apps/6lowpancli/CliC.nc deleted file mode 100644 index 89225cd9..00000000 --- a/apps/6lowpancli/CliC.nc +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2007 Matus Harvan - * All rights reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "Timer.h" - -#define min(a,b) ( (a>b) ? b : a ) -#define max(a,b) ( (a>b) ? a : b ) - -module CliC { - uses { - interface Leds; - interface Boot; - interface IP; - interface UDPClient; - interface SplitControl as IPControl; -#ifdef ENABLE_SOUNDER - interface Mts300Sounder as Sounder; -#endif /* ENABLE_SOUNDER */ -#ifdef ENABLE_TEMP_SENSOR - interface Read as TempSensorC; -#endif /* ENABLE_TEMP_SENSOR */ -#ifdef ENABLE_LIGHT_SENSOR - interface Read as LightSensorC; -#endif /* ENABLE_LIGHT_SENSOR */ - } -} -implementation { -#ifndef MINIMIZE_MEMORY - char *help_buf = "6lowpan cli supported commands:\n" - "\tset led {0,1,2} {on,off} -- toggle leds\n" -#ifdef ENABLE_SOUNDER - "\tsounder time_in_ms\n" -#endif /* ENABLE_SOUNDER */ -#ifdef ENABLE_TEMP_SENSOR - "\tget temp\n" -#endif /* ENABLE_TEMP_SENSOR */ -#ifdef ENABLE_LIGHT_SENSOR - "\tget light\n" -#endif /* ENABLE_LIGHT_SENSOR */ - "\tsend small udp\n" - "\tsend large udp\n" - "\thelp\n"; - char *small_udp_buf = "\n"; - char *large_udp_buf = "\n"; - /* - char *small_udp_buf = "----- SMALL UDP DATA BUFFER -----\n"; - char *large_udp_buf = - "This is a large testing string. It should undergo " \ - "6lowpan fragmentation\n" \ - "0............................................................\n" \ - "1............................................................\n" \ - "2............................................................\n" \ - "3............................................................\n" \ - "4............................................................\n" \ - "5............................................................\n" \ - "6............................................................\n" \ - "7............................................................\n" \ - "8............................................................\n" \ - "9............................................................\n" \ - "A............................................................\n" \ - "B............................................................\n" \ - "C............................................................\n" \ - "D............................................................\n" \ - "E............................................................\n" \ - "10...........................................................\n" \ - "11...........................................................\n" \ - "12...........................................................\n" \ - "13(shorter)\n" \ - "---- END OF THE LARGE UDP DATA ----\n"; - */ -#if defined(ENABLE_TEMP_SENSOR) || defined(ENABLE_LIGHT_SENSOR) - char sensor_buf[15]; - bool sensor_buf_busy = FALSE; - ip6_addr_t sensor_addr; - uint16_t sensor_port; -#endif /* ENABLE_TEMP_SENSOR | ENABLE_LIGHT_SENSOR */ -#endif /* MINIMIZE_MEMORY */ - - event void Boot.booted() { - /* set an IP address */ - ip6_addr_t addr = {{0x20, 0x01, - 0x06, 0x38, - 0x07, 0x09, - 0x12, 0x34, - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00 - }}; - //call IP.setAddress(&addr); - call IP.setAddressAutoconf(&addr); - - call IPControl.start(); - } - - event void IPControl.startDone(error_t err) { - - call UDPClient.listen(1234); - } - event void IPControl.stopDone(error_t err) {} - - event void UDPClient.receive(const ip6_addr_t *addr, const uint16_t port, - uint8_t *buf, uint16_t len ) - { -#ifndef MINIMIZE_MEMORY - if ( strncmp(buf, "set ", min(len, 4)) == 0 && len>0) { - buf += 4; - len -= 4; - if ( strncmp(buf, "led ", min(len, 4)) == 0 && len>0) { - buf += 4; - len -= 4; - - if ( strncmp(buf, "0 ", min(len, 2)) == 0 && len>0) { - buf += 2; - len -= 2; - if ( strncmp(buf, "on", min(len, 2)) == 0 && len>0) { - call Leds.led0On(); - } else if (strncmp(buf, "off", min(len, 3)) == 0 && len>0){ - call Leds.led0Off(); - } - } else if ( strncmp(buf, "1 ", min(len, 2)) == 0 && len>0) { - buf += 2; - len -= 2; - if ( strncmp(buf, "on", min(len, 2)) == 0 && len>0) { - call Leds.led1On(); - } else if (strncmp(buf, "off", min(len, 3)) == 0 && len>0){ - call Leds.led1Off(); - } - } else if ( strncmp(buf, "2 ", min(len, 2)) == 0 && len>0) { - buf += 2; - len -= 2; - if ( strncmp(buf, "on", min(len, 2)) == 0 && len>0) { - call Leds.led2On(); - } else if (strncmp(buf, "off", min(len, 3)) == 0 && len>0){ - call Leds.led2Off(); - } - } - } -#ifdef ENABLE_SOUNDER - } else if ( strncmp(buf, "sounder ", min(len, 8)) == 0 - && len>0) { - buf += 8; - len -= 8; - call Sounder.beep(atoi(buf)); -#endif /* ENABLE_SOUNDER */ - -#ifdef ENABLE_TEMP_SENSOR - } else if ( strncmp(buf, "get temp", min(len, 8)) == 0 - && len>0) { - memcpy(&sensor_addr, addr, sizeof(*addr)); - sensor_port = port; - //call UDPClient.sendTo(addr, port, "reading temp...\n", 16); - call TempSensorC.read(); -#endif /* ENABLE_TEMP_SENSOR */ - -#ifdef ENABLE_LIGHT_SENSOR - } else if ( strncmp(buf, "get light", min(len, 8)) == 0 - && len>0) { - memcpy(&sensor_addr, addr, sizeof(*addr)); - sensor_port = port; - //call UDPClient.sendTo(addr, port, "reading light...\n", 17); - call LightSensorC.read(); -#endif /* ENABLE_LIGHT_SENSOR */ - - } else if (strncmp(buf, "send large udp", min(len, 14)) == 0 - && len>0) { - call UDPClient.sendTo(addr, port, - large_udp_buf, strlen(large_udp_buf)); - } else if (strncmp(buf, "send small udp", min(len, 14)) == 0 - && len>0) { - call UDPClient.sendTo(addr, port, - small_udp_buf, strlen(small_udp_buf)); - } else if (strncmp(buf, "help", min(len, 14)) == 0 - && len>0) { - call UDPClient.sendTo(addr, port, - help_buf, strlen(help_buf)); - } else { - call UDPClient.sendTo(addr, port, - help_buf, strlen(help_buf)); - } -#endif /* MINIMIZE_MEMORY */ - } - - event void UDPClient.sendDone(error_t result, void* buf) - { -#if defined(ENABLE_TEMP_SENSOR) || defined(ENABLE_LIGHT_SENSOR) - if (buf == sensor_buf) { - sensor_buf_busy = FALSE; - } -#endif /* ENABLE_TEMP_SENSOR | ENABLE_LIGHT_SENSOR */ - } - -#ifdef ENABLE_TEMP_SENSOR - event void TempSensorC.readDone(error_t result, uint16_t data) { - if (sensor_buf_busy == FALSE) { - sensor_buf_busy = TRUE; - if (result == SUCCESS) { - snprintf(sensor_buf, sizeof(sensor_buf), "temp: %d\n", data); - } else { - snprintf(sensor_buf, sizeof(sensor_buf), "temp: -\n"); - } - call UDPClient.sendTo(&sensor_addr, sensor_port, - sensor_buf, strlen(sensor_buf)); - } else { - call UDPClient.sendTo(&sensor_addr, sensor_port, - "busy\n", 5); - } - } -#endif /* ENABLE_TEMP_SENSOR */ - -#ifdef ENABLE_LIGHT_SENSOR - event void LightSensorC.readDone(error_t result, uint16_t data) { - if (sensor_buf_busy == FALSE) { - sensor_buf_busy = TRUE; - if (result == SUCCESS) { - snprintf(sensor_buf, sizeof(sensor_buf), "light: %d\n", data); - } else { - snprintf(sensor_buf, sizeof(sensor_buf), "light: -\n"); - } - call UDPClient.sendTo(&sensor_addr, sensor_port, - sensor_buf, strlen(sensor_buf)); - } else { - call UDPClient.sendTo(&sensor_addr, sensor_port, - "busy\n", 5); - } - } -#endif /* ENABLE_LIGHT_SENSOR */ -} diff --git a/apps/6lowpancli/Makefile b/apps/6lowpancli/Makefile deleted file mode 100644 index a4c380e4..00000000 --- a/apps/6lowpancli/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -COMPONENT=CliAppC - -CFLAGS += -I$(TOSDIR)/lib/printf -I$(TOSDIR)/lib/net/6lowpan -D'TOSH_DATA_LENGTH=102' - -# TelosB -# CFLAGS + = "-D'ENABLE_TELOSB_LIGHT_SENSOR=1' -D'ENABLE_TELOSB_TEMP_SENSOR=1'" - -# MicaZ with the mts300 sensorboard -# CFLAGS += "-D'ENABLE_MICAZ_LIGHT_SENSOR=1' -D'ENABLE_MICAZ_TEMP_SENSOR=1' -D'ENABLE_SOUNDER=1'" - - -include $(MAKERULES) diff --git a/apps/6lowpancli/README b/apps/6lowpancli/README deleted file mode 100644 index 0ccacf1d..00000000 --- a/apps/6lowpancli/README +++ /dev/null @@ -1,42 +0,0 @@ -6lowpan cli is a sample application using the 6lowpan stack. It -implements a cli listening on UDP port 1234 for commands and replying -with answers. - -Besides that, the mote answers to pings. - -The IPv6 addresses - * a global address with prefix 2001:0638:0709:1234::/64 - * a link-local address -are assigned using an interface identifier computed from the Active -Message address of the mote. This is almost like the stateless -autoconfiguration, but Duplicate Address Detection or Router -Solicitations are not implemented. - - -Note that you also need a BaseStation application and the serial_tun -daemon running. See tos/lib/net/6lowpan/REAME for more details. - - BUILDING -Debugging output with printf over USB can be enabled with - CFLAGS="-D'ENABLE_PRINTF_DEBUG=1' - -To minimize memory usage, i.e. disable everything (at the moment only -the UDP cli) to determine minimum RAM/ROM requirements, use - CFLAGS="-D'MINIMIZE_MEMORY=1' - - - TESTING -Assuming active message address (mote id) 20 (0x14): - -Small unfragmented ping - sudo ping6 -s 50 2001:638:709:1234::fffe:14 - -Large fragmented ping - sudo ping6 -s 1230 -i 3 2001:638:709:1234::fffe:14 - -Link-local all-nodes ping - sudo ping6 -s 20 ff02::01 - -UDP cli - nc6 -u 2001:638:709:1234::fffe:14 1234 - diff --git a/apps/AntiTheft/Nodes/AntiTheftC.nc b/apps/AntiTheft/Nodes/AntiTheftC.nc index 1e42baa3..3d502a92 100644 --- a/apps/AntiTheft/Nodes/AntiTheftC.nc +++ b/apps/AntiTheft/Nodes/AntiTheftC.nc @@ -138,13 +138,13 @@ implementation } /* Radio started. Now start the collection protocol and set the - radio to a 2% low-power-listening duty cycle */ + wakeup interval for low-power-listening wakeup to half a second. */ event void RadioControl.startDone(error_t ok) { if (ok == SUCCESS) { call DisseminationControl.start(); call CollectionControl.start(); - call LowPowerListening.setLocalDutyCycle(200); + call LowPowerListening.setLocalWakeupInterval(512); } else errorLed(); diff --git a/apps/AntiTheft/Nodes/Makefile b/apps/AntiTheft/Nodes/Makefile index 6d49bff8..f05ae3be 100644 --- a/apps/AntiTheft/Nodes/Makefile +++ b/apps/AntiTheft/Nodes/Makefile @@ -1,5 +1,11 @@ SENSORBOARD=mts300 PFLAGS += -I%T/lib/net/ctp -I%T/lib/net -I%T/lib/net/4bitle -I%T/lib/net/drip COMPONENT=AntiTheftAppC + +#CFLAGS += -DLOW_POWER_LISTENING +#CFLAGS += -DLPL_DEF_LOCAL_WAKEUP=512 +#CFLAGS += -DLPL_DEF_REMOTE_WAKEUP=512 +#CFLAGS += -DDELAY_AFTER_RECEIVE=20 + include $(MAKERULES) diff --git a/apps/AntiTheft/Root/AntiTheftRootC.nc b/apps/AntiTheft/Root/AntiTheftRootC.nc index 896bc812..ada387b5 100644 --- a/apps/AntiTheft/Root/AntiTheftRootC.nc +++ b/apps/AntiTheft/Root/AntiTheftRootC.nc @@ -55,7 +55,7 @@ implementation tree */ if (error == SUCCESS) { - call LowPowerListening.setLocalDutyCycle(200); + call LowPowerListening.setLocalWakeupInterval(512); call DisseminationControl.start(); call CollectionControl.start(); call RootControl.setRoot(); diff --git a/apps/AntiTheft/Root/Makefile b/apps/AntiTheft/Root/Makefile index 247c8a0d..4719dcfc 100644 --- a/apps/AntiTheft/Root/Makefile +++ b/apps/AntiTheft/Root/Makefile @@ -1,4 +1,10 @@ PFLAGS += -I%T/lib/net/ctp -I%T/lib/net -I%T/lib/net/4bitle -I%T/lib/net/drip COMPONENT=AntiTheftRootAppC + +#CFLAGS += -DLOW_POWER_LISTENING +#CFLAGS += -DLPL_DEF_LOCAL_WAKEUP=512 +#CFLAGS += -DLPL_DEF_REMOTE_WAKEUP=512 +#CFLAGS += -DDELAY_AFTER_RECEIVE=20 + include $(MAKERULES) diff --git a/apps/BaseStation/BaseStationC.nc b/apps/BaseStation/BaseStationC.nc index e0727e8f..1a08fc76 100644 --- a/apps/BaseStation/BaseStationC.nc +++ b/apps/BaseStation/BaseStationC.nc @@ -76,7 +76,7 @@ implementation { BaseStationP.SerialControl -> Serial; BaseStationP.UartSend -> Serial; - BaseStationP.UartReceive -> Serial; + BaseStationP.UartReceive -> Serial.Receive; BaseStationP.UartPacket -> Serial; BaseStationP.UartAMPacket -> Serial; diff --git a/apps/BaseStation/Makefile b/apps/BaseStation/Makefile index 3c052e79..98109ed5 100644 --- a/apps/BaseStation/Makefile +++ b/apps/BaseStation/Makefile @@ -1,6 +1,7 @@ COMPONENT=BaseStationC CFLAGS += -DCC2420_NO_ACKNOWLEDGEMENTS CFLAGS += -DCC2420_NO_ADDRESS_RECOGNITION +CFLAGS += -DTASKLET_IS_TASK include $(MAKERULES) diff --git a/apps/BaseStation/README.txt b/apps/BaseStation/README.txt index dedd144f..110eb04d 100644 --- a/apps/BaseStation/README.txt +++ b/apps/BaseStation/README.txt @@ -48,7 +48,7 @@ Other combinations can be defined to meet your application's needs: Tools: -tools/java/net/tinyos/sf/SerialForwarder. +support/sdk/java/net/tinyos/sf/SerialForwarder See the TinyOS Tutorial on Mote-PC serial communication and SerialForwarder on docs.tinyos.net for more details. diff --git a/apps/Blink/BlinkAppC.nc b/apps/Blink/BlinkAppC.nc index 4f828694..e5a672c1 100644 --- a/apps/Blink/BlinkAppC.nc +++ b/apps/Blink/BlinkAppC.nc @@ -30,7 +30,7 @@ */ /** - * Blink is a basic application that toggles the a mote LED periodically. + * Blink is a basic application that toggles a mote's LED periodically. * It does so by starting a Timer that fires every second. It uses the * OSKI TimerMilli service to achieve this goal. * diff --git a/apps/IPBaseStation/BaseStationC.nc b/apps/IPBaseStation/BaseStationC.nc new file mode 100644 index 00000000..8c53be0a --- /dev/null +++ b/apps/IPBaseStation/BaseStationC.nc @@ -0,0 +1,138 @@ +/* + * "Copyright (c) 2008 The Regents of the University of California. + * All rights reserved." + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +z * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + */ +// $Id$ + +/* tab:4 + * "Copyright (c) 2000-2003 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +/** + * The TinyOS 2.x base station that forwards packets between the UART + * and radio.It replaces the GenericBase of TinyOS 1.0 and the + * TOSBase of TinyOS 1.1. + * + *

On the serial link, BaseStation sends and receives simple active + * messages (not particular radio packets): on the radio link, it + * sends radio active messages, whose format depends on the network + * stack being used. BaseStation will copy its compiled-in group ID to + * messages moving from the serial link to the radio, and will filter + * out incoming radio messages that do not contain that group ID.

+ * + *

BaseStation includes queues in both directions, with a guarantee + * that once a message enters a queue, it will eventually leave on the + * other interface. The queues allow the BaseStation to handle load + * spikes.

+ * + *

BaseStation acknowledges a message arriving over the serial link + * only if that message was successfully enqueued for delivery to the + * radio link.

+ * + *

The LEDS are programmed to toggle as follows:

+ *
    + *
  • RED Toggle:: Message bridged from serial to radio
  • + *
  • GREEN Toggle: Message bridged from radio to serial
  • + *
  • YELLOW/BLUE Toggle: Dropped message due to queue overflow in either direction
  • + *
+ * + * @author Phil Buonadonna + * @author Gilman Tolle + * @author David Gay + * @author Philip Levis + * @date August 10 2005 + */ +#include + +configuration BaseStationC { +} +implementation { + + enum { + // becasue we're the only one's using the radio, we're lazy and + // don't acquire the resource. For some reason, it seems to crash + // occasionally if we don't do this. + RESOURCE_IDX = unique(IEEE154_SEND_CLIENT), + }; + + components MainC, BaseStationP, LedsC; + components Ieee154MessageC as Radio; + components SerialDispatcherC as SerialControl, Serial802_15_4C as Serial; + + MainC.Boot <- BaseStationP; + + BaseStationP.RadioControl -> Radio; + BaseStationP.SerialControl -> SerialControl; + BaseStationP.UartSend -> Serial.Send; + BaseStationP.UartReceive -> Serial.Receive; + + + BaseStationP.RadioSend -> Radio; + BaseStationP.RadioReceive -> Radio.Ieee154Receive; + + BaseStationP.RadioPacket -> Radio.Packet; + BaseStationP.RadioIeeePacket -> Radio; + + BaseStationP.Leds -> LedsC; + + BaseStationP.PacketLink -> Radio; + BaseStationP.LowPowerListening -> Radio; + + components ResetC; + BaseStationP.Reset -> ResetC; + + components SerialDevConfC as Configure; + BaseStationP.ConfigureSend -> Configure; + BaseStationP.ConfigureReceive -> Configure; + + components new TimerMilliC(); + BaseStationP.ConfigureTimer -> TimerMilliC; + + components IPAddressC; + BaseStationP.IPAddress -> IPAddressC; + + components CC2420ControlC; + BaseStationP.CC2420Config -> CC2420ControlC; +} diff --git a/apps/IPBaseStation/BaseStationP.nc b/apps/IPBaseStation/BaseStationP.nc new file mode 100644 index 00000000..71645ca9 --- /dev/null +++ b/apps/IPBaseStation/BaseStationP.nc @@ -0,0 +1,448 @@ +/* + * "Copyright (c) 2008 The Regents of the University of California. + * All rights reserved." + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + */ +// $Id$ + +/* tab:4 + * "Copyright (c) 2000-2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2005 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +/* + * @author Phil Buonadonna + * @author Gilman Tolle + * @author David Gay + * Revision: $Id$ + */ + +/* + * BaseStationP bridges packets between a serial channel and the radio. + * Messages moving from serial to radio will be tagged with the group + * ID compiled into the TOSBase, and messages moving from radio to + * serial will be filtered by that same group id. + */ + +#ifndef SIM +#include "CC2420.h" +#endif +#include "AM.h" +#include "Serial.h" +#include "devconf.h" +#include "lib6lowpan.h" + +module BaseStationP { + uses { + interface Boot; + interface SplitControl as SerialControl; + interface SplitControl as RadioControl; + + interface Send as UartSend; + interface Ieee154Send as RadioSend; + + interface Receive as UartReceive; + interface Receive as RadioReceive; + interface Packet as RadioPacket; + + interface Send as ConfigureSend; + interface Receive as ConfigureReceive; + interface Timer as ConfigureTimer; + interface IPAddress; + + + interface Ieee154Packet as RadioIeeePacket; + + interface PacketLink; + interface LowPowerListening; + interface CC2420Config; + + interface Leds; + + interface Reset; + } +} + +implementation +{ + enum { + UART_QUEUE_LEN = 10, + RADIO_QUEUE_LEN = 10, + }; + + uint16_t radioRetries = BLIP_L2_RETRIES; + uint16_t radioDelay = BLIP_L2_DELAY; + + uint16_t serial_read; + uint16_t radio_read; + uint16_t serial_fail; + uint16_t radio_fail; + + bool echo_busy; + message_t echo_buf; + config_reply_t *reply; + + message_t uartQueueBufs[UART_QUEUE_LEN]; + message_t *uartQueue[UART_QUEUE_LEN]; + uint8_t uartIn, uartOut; + bool uartBusy, uartFull; + + message_t radioQueueBufs[RADIO_QUEUE_LEN]; + message_t *radioQueue[RADIO_QUEUE_LEN]; + uint8_t radioIn, radioOut; + bool radioBusy, radioFull; + + task void uartSendTask(); + task void radioSendTask(); + + void dropBlink() { + call Leds.led2Toggle(); + } + + void failBlink() { + call Leds.led2Toggle(); + } + +#ifndef SIM +#define CHECK_NODE_ID if (0) return +#else +#define CHECK_NODE_ID if (TOS_NODE_ID != BASESTATION_ID) return +#endif + task void configureReply() { + if (echo_busy) return; + + reply->addr = call IPAddress.getShortAddr(); + reply->serial_read = serial_read; + reply->radio_read = radio_read; + reply->serial_fail = serial_fail; + reply->radio_fail = radio_fail; + + echo_busy = TRUE; + // delay sending the reply for a bit + // the pc seems to usually drop the packet if we don't do this; + call ConfigureTimer.startOneShot(100); + } + + event void Boot.booted() { + uint8_t i; + + CHECK_NODE_ID; + + for (i = 0; i < UART_QUEUE_LEN; i++) + uartQueue[i] = &uartQueueBufs[i]; + uartIn = uartOut = 0; + uartBusy = FALSE; + uartFull = TRUE; + + for (i = 0; i < RADIO_QUEUE_LEN; i++) + radioQueue[i] = &radioQueueBufs[i]; + radioIn = radioOut = 0; + radioBusy = FALSE; + radioFull = TRUE; + + echo_busy = FALSE; + serial_read = 0; + radio_read = 0; + serial_fail = 0; + radio_fail = 0; + + call RadioControl.start(); + call SerialControl.start(); + + reply = (config_reply_t *)(&(echo_buf.data)); + } + + event void RadioControl.startDone(error_t error) { + CHECK_NODE_ID; + if (error == SUCCESS) { + radioFull = FALSE; +#ifdef LPL_SLEEP_INTERVAL + // SDH : can actually leave the base on full time in most cases. + // call LowPowerListening.setLocalSleepInterval(LPL_SLEEP_INTERVAL); +#endif + } + } + + event void SerialControl.startDone(error_t error) { + CHECK_NODE_ID; + if (error == SUCCESS) { + uartFull = FALSE; + } + reply->error = CONFIG_ERROR_BOOTED; + post configureReply(); + } + + event void SerialControl.stopDone(error_t error) {} + event void RadioControl.stopDone(error_t error) {} + + uint8_t count = 0; + + message_t* receive(message_t* msg, void* payload, uint8_t len); + + event message_t *RadioReceive.receive(message_t *msg, + void *payload, + uint8_t len) { + CHECK_NODE_ID NULL; + dbg("base", "radio message received (%i)\n", len); + return receive(msg, payload, len); + } + + message_t* receive(message_t *msg, void *payload, uint8_t len) { + message_t *ret = msg; + CHECK_NODE_ID NULL; + + atomic { + if (!uartFull) + { + ret = uartQueue[uartIn]; + uartQueue[uartIn] = msg; + + uartIn = (uartIn + 1) % UART_QUEUE_LEN; + + if (uartIn == uartOut) + uartFull = TRUE; + + if (!uartBusy) + { + post uartSendTask(); + uartBusy = TRUE; + } + } + else + dropBlink(); + } + + return ret; + } + + task void uartSendTask() { + uint8_t len; + message_t* msg; + atomic + if (uartIn == uartOut && !uartFull) + { + uartBusy = FALSE; + return; + } + + msg = uartQueue[uartOut]; + + // Since we're forwarding fully formed radio packets, we can use + // these headers. + len = call RadioPacket.payloadLength(msg); + + if (call UartSend.send(uartQueue[uartOut], len) == SUCCESS) { + call Leds.led1Toggle(); + } else + { + failBlink(); + post uartSendTask(); + } + } + + event void UartSend.sendDone(message_t* msg, error_t error) { + if (error != SUCCESS) + failBlink(); + else + atomic + if (msg == uartQueue[uartOut]) + { + if (++uartOut >= UART_QUEUE_LEN) + uartOut = 0; + if (uartFull) + uartFull = FALSE; + } + post uartSendTask(); + + } + + event message_t *UartReceive.receive(message_t *msg, + void *payload, + uint8_t len) { + message_t *ret = msg; + bool reflectToken = FALSE; + CHECK_NODE_ID msg; + dbg("base", "uartreceive len %i of 0x%x\n", len, call SerialAMPacket.destination(msg)); +#if defined(BLIP_WATCHDOG) && (defined(PLATFORM_TELOS) || defined(PLATFORM_TELOSB) || defined(PLATFORM_EPIC)) + WDTCTL = WDT_ARST_1000; +#endif + atomic + if (!radioFull) + { + reflectToken = TRUE; + ret = radioQueue[radioIn]; + radioQueue[radioIn] = msg; + if (++radioIn >= RADIO_QUEUE_LEN) + radioIn = 0; + if (radioIn == radioOut) + radioFull = TRUE; + + if (!radioBusy) + { + post radioSendTask(); + radioBusy = TRUE; + } + } + else + dbg("base", "no enqueue\n"); +// dropBlink(); + + if (reflectToken) { + //call UartTokenReceive.ReflectToken(Token); + } + + return ret; + } + + task void radioSendTask() { + uint8_t len; + ieee154_saddr_t addr; + message_t* msg; + + dbg ("base", "radioSendTask()\n"); + atomic + if (radioIn == radioOut && !radioFull) + { + radioBusy = FALSE; + return; + } + + msg = radioQueue[radioOut]; + len = call RadioPacket.payloadLength(msg); + addr = call RadioIeeePacket.destination(msg); + + if (addr != 0xFFFF) { + call PacketLink.setRetries(msg, radioRetries); + call PacketLink.setRetryDelay(msg, radioDelay); + } else { + call PacketLink.setRetries(msg, 0); + } +#ifdef LPL_SLEEP_INTERVAL + call LowPowerListening.setRemoteWakeupInterval(msg, LPL_SLEEP_INTERVAL); +#endif + dbg("base", "radio send to: 0x%x len: %i\n", addr, len); + if (call RadioSend.send(addr, msg, len) == SUCCESS) + call Leds.led0Toggle(); + else + { + failBlink(); + post radioSendTask(); + } + } + + event void RadioSend.sendDone(message_t* msg, error_t error) { + CHECK_NODE_ID; + dbg("base", "sendDone()\n"); + + //if (!call PacketLink.wasDelivered(msg)) + // failBlink(); + if (error != SUCCESS) + failBlink(); + else + atomic + if (msg == radioQueue[radioOut]) + { + if (++radioOut >= RADIO_QUEUE_LEN) + radioOut = 0; + if (radioFull) + radioFull = FALSE; + } + + post radioSendTask(); + } + +#ifndef SIM + event message_t *ConfigureReceive.receive(message_t *msg, + void *payload, + uint8_t len) { + config_cmd_t *cmd; + uint8_t error = CONFIG_ERROR_OK; +#if defined(BLIP_WATCHDOG) && (defined(PLATFORM_TELOS) || defined(PLATFORM_TELOSB) || defined(PLATFORM_EPIC)) + WDTCTL = WDT_ARST_1000; +#endif + + if (len != sizeof(config_cmd_t) || msg == NULL) return msg; + // don't parse the message if we can't reply + + cmd = (config_cmd_t *)&msg->data; + + switch (cmd->cmd) { + case CONFIG_ECHO: + break; + case CONFIG_SET_PARM: + call CC2420Config.setChannel(cmd->rf.channel); + // IPAddress calls sync() for you, I think, so we'll put it second + call IPAddress.setShortAddr(cmd->rf.addr); + call CC2420Config.sync(); + radioRetries = cmd->retx.retries; + radioDelay = cmd->retx.delay; + break; + case CONFIG_REBOOT: + call Reset.reset(); + break; + case CONFIG_KEEPALIVE: + return msg; + } + if (!echo_busy) { + reply->error = error; + post configureReply(); + } + return msg; + } + + + event void CC2420Config.syncDone(error_t error) { + + } + + event void ConfigureSend.sendDone(message_t *msg, error_t error) { + echo_busy = FALSE; + } + + event void ConfigureTimer.fired() { + call Leds.led2Toggle(); + if (call ConfigureSend.send(&echo_buf, sizeof(config_reply_t)) != SUCCESS) + echo_busy = FALSE; + } +#endif +} diff --git a/apps/IPBaseStation/Makefile b/apps/IPBaseStation/Makefile new file mode 100644 index 00000000..49fd6eec --- /dev/null +++ b/apps/IPBaseStation/Makefile @@ -0,0 +1,39 @@ +COMPONENT=BaseStationC + +# radio options. channel settings will be overridden by the driver +# CFLAGS += -DCC2420_DEF_RFPOWER=4 + +# this is necessary, otherwise we will allocate a heap by including +# the lowpan target +CFLAGS += -DNO_IP_MALLOC + +# this aligns the 802.15.4 payload on the data field of a message_t. +# very convenient for forwarding, and means we don't have to do a +# memmove. This doesn't mean that motes running blip also need this-- +# they can use IFRAMES or IEEE154FRAMES +CFLAGS += -DIEEE154FRAMES_ENABLED + +# if you're worried about your interface mote crashing, enable this to +# turn on a hardware watchdog that will reset it if it does. CFLAGS +# += -DBLIP_WATCHDOG +# +# debugging +# + +# filter packets based on a specified topology +# PFLAGS += -I../UDPEcho/NodeConnectivity -DSW_TOPOLOGY + +# part of the test harness +# CFLAGS += -DDBG_TRACK_FLOWS + +# for simulation +# CFLAGS += -DBASESTATION_ID=100 + +# defs for snooping-- handy for debugging LPL, etc. +# CFLAGS += -DCC2420_NO_UNIQUE +# CFLAGS += -DCC2420_DEF_CHANNEL=15 +# CFLAGS += -DCC2420_NO_ACKNOWLEDGEMENTS +# CFLAGS += -DCC2420_NO_ADDRESS_RECOGNITION + +include $(MAKERULES) + diff --git a/apps/IPBaseStation/README b/apps/IPBaseStation/README new file mode 100644 index 00000000..ca1412af --- /dev/null +++ b/apps/IPBaseStation/README @@ -0,0 +1,74 @@ +README for BaseStation +Author/Contact: tinyos-help@millennium.berkeley.edu + +IPBaseStation is a modification of the generic BaseStation which ships +with tinyOS-2.x. It alters the serial protocol to pass 802.15.4 +frames instead of Serial.h packets. It also adds an out-of-band +configuration protocol which allows a driver running over the serial +port to reboot the mote, and to set the device address, channel, and +retransmission parameters. These changes are useful when one wishes +to use a mote attached to a computer as an 802.15.4 interface rather +then an actual mote. The actual queuing logic for copying packets is +mostly unchanged, and it continues to make use of serial ACKs. + +To build, add the 'blip' make extra. IE, + +$ make blip ... + +For more information on setting up an IPv6 network, please see the tutorial: +http://docs.tinyos.net/index.php/BLIP_Tutorial + +Description of BaseStation: + +BaseStation is an application that acts as a simple Active Message +bridge between the serial and radio links. It replaces the GenericBase +of TinyOS 1.0 and the TOSBase of TinyOS 1.1. + +On the serial link, BaseStation sends and receives simple active +messages (not particular radio packets): on the radio link, it sends +radio active messages, whose format depends on the network stack being +used. BaseStation will copy its compiled-in group ID to messages +moving from the serial link to the radio, and will filter out incoming +radio messages that do not contain that group ID. + +BaseStation includes queues in both directions, with a guarantee that +once a message enters a queue, it will eventually leave on the other +interface. The queues allow the BaseStation to handle load spikes more +gracefully. + +BaseStation acknowledges a message arriving over the serial link only if +that message was successfully enqueued for delivery to the radio link. + +The LEDS are programmed to toggle as follows: + +RED Toggle - Message bridged from serial to radio +GREEN Toggle - Message bridged from radio to serial +YELLOW/BLUE Toggle - Dropped message due to queue overflow + in either direction + +When using a CC2420 radio, several default preprocessor configurations +are defined in the Makefile: + * CC2420_NO_ACKNOWLEDGEMENTS + - Prevents the base station from falsly acknowledging packets + * CC2420_NO_ADDRESS_RECOGNITION + - Allows the base station to sniff packets from any transmitter + +Other combinations can be defined to meet your application's needs: + * CC2420_NO_ADDRESS_RECOGNITION only + - Sniff all packets, but acknowledge packets only if they + are sent to the base station's address + + * Removing all preprocessor definitions in the Makefile + - Only accept packets destined for the base station's address, + and acknowledge those packets + + +Tools: + +tools/java/net/tinyos/sf/SerialForwarder. + +See doc/serialcomm/index.html for more information using these tools. + +Known bugs/limitations: + + diff --git a/apps/IPBaseStation/Reset.h b/apps/IPBaseStation/Reset.h new file mode 100644 index 00000000..59951ef3 --- /dev/null +++ b/apps/IPBaseStation/Reset.h @@ -0,0 +1,59 @@ +// $Id$ + +/* tab:4 + * "Copyright (c) 2000-2003 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +/* + * Authors: Wei Hong + * Intel Research Berkeley Lab + * Date: 7/15/2002 + * + */ + +/** + * @author Wei Hong + * @author Intel Research Berkeley Lab + */ + + +void resetMote() +{ +#if defined(PLATFORM_MICA) || defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT) || defined(PLATFORM_MICAZ) + cli(); + wdt_enable(0); + while (1) { + __asm__ __volatile__("nop" "\n\t" ::); + } +#elif defined(PLATFORM_TELOS) || defined(PLATFORM_TELOSB) || defined(PLATFORM_EPIC) + WDTCTL = 0; +#else +#error "Reset.h not defined/supported for your platform, aborting..." +#endif +} + diff --git a/apps/IPBaseStation/Reset.nc b/apps/IPBaseStation/Reset.nc new file mode 100644 index 00000000..a503b995 --- /dev/null +++ b/apps/IPBaseStation/Reset.nc @@ -0,0 +1,47 @@ +// $Id$ + +/* tab:4 + * "Copyright (c) 2000-2003 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +/* + * Authors: Wei Hong + * Intel Research Berkeley Lab + * Date: 7/15/2002 + * + */ + +/** + * @author Wei Hong + * @author Intel Research Berkeley Lab + */ + + +interface Reset { + command void reset(); +} diff --git a/tos/lib/net/Deluge/CrcP.nc b/apps/IPBaseStation/ResetC.nc similarity index 60% rename from tos/lib/net/Deluge/CrcP.nc rename to apps/IPBaseStation/ResetC.nc index a14a14e2..3684166a 100644 --- a/tos/lib/net/Deluge/CrcP.nc +++ b/apps/IPBaseStation/ResetC.nc @@ -1,5 +1,7 @@ -/* - * "Copyright (c) 2000-2004 The Regents of the University of California. +// $Id$ + +/* tab:4 + * "Copyright (c) 2000-2003 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its @@ -17,32 +19,38 @@ * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +/* + * Authors: Wei Hong + * Intel Research Berkeley Lab + * Date: 7/15/2002 + * */ /** - * @author Jonathan Hui + * @author Wei Hong + * @author Intel Research Berkeley Lab */ -#include "crc.h" +includes Reset; -module CrcP +module ResetC { - provides interface Crc; + provides interface Reset; } - implementation { - // From T1 "tos/system/CrcC.nc" - command uint16_t Crc.crc16(void* buf, uint8_t len) - { - uint8_t* tmpBuf = (uint8_t*)buf; - uint16_t crc; - - for (crc = 0; len > 0; len--) { - crc = crcByte(crc, *tmpBuf); // Calculates running CRC - tmpBuf++; - } - - return crc; - } + command void Reset.reset() + { + resetMote(); + } } diff --git a/apps/MViz/MVizC.nc b/apps/MViz/MVizC.nc index 82f39986..f62a26cb 100644 --- a/apps/MViz/MVizC.nc +++ b/apps/MViz/MVizC.nc @@ -19,7 +19,7 @@ #include "MViz.h" -module MVizC { +module MVizC @safe(){ uses { // Interfaces for initialization: interface Boot; @@ -218,7 +218,7 @@ implementation { } local.reading = data; call CtpInfo.getEtx(&val); - local.link_route_value = val; + local.etx = val; call CtpInfo.getParent(&val); local.link_route_addr = val; local.link_route_value = call LinkEstimator.getLinkQuality(local.link_route_addr); diff --git a/apps/MultihopOscilloscope/MultihopOscilloscopeC.nc b/apps/MultihopOscilloscope/MultihopOscilloscopeC.nc index fab09903..5179b350 100644 --- a/apps/MultihopOscilloscope/MultihopOscilloscopeC.nc +++ b/apps/MultihopOscilloscope/MultihopOscilloscopeC.nc @@ -19,7 +19,7 @@ #include "Timer.h" #include "MultihopOscilloscope.h" -module MultihopOscilloscopeC { +module MultihopOscilloscopeC @safe(){ uses { // Interfaces for initialization: interface Boot; diff --git a/apps/MultihopOscilloscope/oscilloscope.py b/apps/MultihopOscilloscope/oscilloscope.py new file mode 100644 index 00000000..de29c89d --- /dev/null +++ b/apps/MultihopOscilloscope/oscilloscope.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +import sys +import tos + +AM_OSCILLOSCOPE = 0x93 + +class OscilloscopeMsg(tos.Packet): + def __init__(self, packet = None): + tos.Packet.__init__(self, + [('version', 'int', 2), + ('interval', 'int', 2), + ('id', 'int', 2), + ('count', 'int', 2), + ('readings', 'blob', None)], + packet) + +if '-h' in sys.argv: + print "Usage:", sys.argv[0], "serial@/dev/ttyUSB0:57600" + sys.exit() + +am = tos.AM() + +while True: + p = am.read() + if p and p.type == AM_OSCILLOSCOPE: + msg = OscilloscopeMsg(p.data) + print msg.id, msg.count, [i<<8 | j for (i,j) in zip(msg.readings[::2], msg.readings[1::2])] + #print msg + diff --git a/apps/Null/NullC.nc b/apps/Null/NullC.nc index 6320e88e..a25e0c08 100644 --- a/apps/Null/NullC.nc +++ b/apps/Null/NullC.nc @@ -38,7 +38,7 @@ * @author Cory Sharp * @date February 4, 2006 */ -module NullC +module NullC @safe() { uses interface Boot; } diff --git a/apps/Oscilloscope/OscilloscopeC.nc b/apps/Oscilloscope/OscilloscopeC.nc index a73dd60b..c4e0a1c0 100644 --- a/apps/Oscilloscope/OscilloscopeC.nc +++ b/apps/Oscilloscope/OscilloscopeC.nc @@ -16,7 +16,7 @@ #include "Timer.h" #include "Oscilloscope.h" -module OscilloscopeC +module OscilloscopeC @safe() { uses { interface Boot; diff --git a/apps/Oscilloscope/java/Window.java b/apps/Oscilloscope/java/Window.java index 61859994..df26ebaf 100644 --- a/apps/Oscilloscope/java/Window.java +++ b/apps/Oscilloscope/java/Window.java @@ -19,7 +19,7 @@ import java.util.*; class Window { Oscilloscope parent; Graph graph; - + Font smallFont = new Font("Dialog", Font.PLAIN, 8); Font boldFont = new Font("Dialog", Font.BOLD, 12); Font normalFont = new Font("Dialog", Font.PLAIN, 12); @@ -29,279 +29,285 @@ class Window { JFrame frame; Window(Oscilloscope parent) { - this.parent = parent; + this.parent = parent; } /* A model for the mote table, and general utility operations on the mote list */ class MoteTableModel extends AbstractTableModel { - private ArrayList motes = new ArrayList(); - private ArrayList colors = new ArrayList(); - - /* Initial mote colors cycle through this list. Add more colors if - you want. */ - private Color[] cycle = { - Color.RED, Color.WHITE, Color.GREEN, Color.MAGENTA, - Color.YELLOW, Color.GRAY, Color.YELLOW - }; - int cycleIndex; + private ArrayList motes = new ArrayList(); + private ArrayList colors = new ArrayList(); + + /* Initial mote colors cycle through this list. Add more colors if + you want. */ + private Color[] cycle = { + Color.RED, Color.WHITE, Color.GREEN, Color.MAGENTA, + Color.YELLOW, Color.GRAY, Color.YELLOW + }; + int cycleIndex; + + /* TableModel methods for achieving our table appearance */ + public String getColumnName(int col) { + if (col == 0) { + return "Mote"; + } else { + return "Color"; + } + } + + public int getColumnCount() { return 2; } + + public synchronized int getRowCount() { return motes.size(); } + + public synchronized Object getValueAt(int row, int col) { + if (col == 0) { + return motes.get(row); + } else { + return colors.get(row); + } + } - /* TableModel methods for achieving our table appearance */ - public String getColumnName(int col) { - if (col == 0) { - return "Mote"; - } else { - return "Color"; - } - } - public int getColumnCount() { return 2; } - public synchronized int getRowCount() { return motes.size(); } - public synchronized Object getValueAt(int row, int col) { - if (col == 0) { - return motes.get(row); - } else { - return colors.get(row); - } - } public Class getColumnClass(int col) { return getValueAt(0, col).getClass(); } - public boolean isCellEditable(int row, - int col) { return col == 1; } - public synchronized void setValueAt(Object value, - int row, int col) { - colors.set(row, value); - fireTableCellUpdated(row, col); - graph.repaint(); - } - - /* Return mote id of i'th mote */ - int get(int i) { return ((Integer)motes.get(i)).intValue(); } - - /* Return color of i'th mote */ - Color getColor(int i) { return (Color)colors.get(i); } - /* Return number of motes */ - int size() { return motes.size(); } + public boolean isCellEditable(int row, int col) { + return col == 1; + } - /* Add a new mote */ - synchronized void newNode(int nodeId) { - /* Shock, horror. No binary search. */ - int i, len = motes.size(); - - for (i = 0; ; i++) { - if (i == len || nodeId < get(i)) { - motes.add(i, new Integer(nodeId)); - // Cycle through a set of initial colors - colors.add(i, cycle[cycleIndex++ % cycle.length]); - break; - } + public synchronized void setValueAt(Object value, int row, int col) { + colors.set(row, (Color)value); + fireTableCellUpdated(row, col); + graph.repaint(); } - fireTableRowsInserted(i, i); - } - /* Remove all motes */ - void clear() { - motes = new ArrayList(); - colors = new ArrayList(); - fireTableDataChanged(); - } - } + /* Return mote id of i'th mote */ + int get(int i) { return (motes.get(i)).intValue(); } + + /* Return color of i'th mote */ + Color getColor(int i) { return colors.get(i); } + + /* Return number of motes */ + int size() { return motes.size(); } + + /* Add a new mote */ + synchronized void newNode(int nodeId) { + /* Shock, horror. No binary search. */ + int i, len = motes.size(); + + for (i = 0; ; i++) { + if (i == len || nodeId < get(i)) { + motes.add(i, new Integer(nodeId)); + // Cycle through a set of initial colors + colors.add(i, cycle[cycleIndex++ % cycle.length]); + break; + } + } + fireTableRowsInserted(i, i); + } + + /* Remove all motes */ + void clear() { + motes = new ArrayList(); + colors = new ArrayList(); + fireTableDataChanged(); + } + } /* End of MoteTableModel */ /* A simple full-color cell */ static class MoteColor extends JLabel implements TableCellRenderer { - public MoteColor() { setOpaque(true); } - public Component getTableCellRendererComponent - (JTable table, Object color, - boolean isSelected, boolean hasFocus, - int row, int column) { - setBackground((Color)color); - return this; - } + public MoteColor() { setOpaque(true); } + public Component getTableCellRendererComponent + (JTable table, Object color, + boolean isSelected, boolean hasFocus, + int row, int column) { + setBackground((Color)color); + return this; + } } /* Convenience methods for making buttons, labels and textfields. Simplifies code and ensures a consistent style. */ JButton makeButton(String label, ActionListener action) { - JButton button = new JButton(); + JButton button = new JButton(); button.setText(label); button.setFont(boldFont); - button.addActionListener(action); - return button; + button.addActionListener(action); + return button; } JLabel makeLabel(String txt, int alignment) { - JLabel label = new JLabel(txt, alignment); - label.setFont(boldFont); - return label; + JLabel label = new JLabel(txt, alignment); + label.setFont(boldFont); + return label; } - + JLabel makeSmallLabel(String txt, int alignment) { - JLabel label = new JLabel(txt, alignment); - label.setFont(smallFont); - return label; + JLabel label = new JLabel(txt, alignment); + label.setFont(smallFont); + return label; } - + JTextField makeTextField(int columns, ActionListener action) { - JTextField tf = new JTextField(columns); - tf.setFont(normalFont); - tf.setMaximumSize(tf.getPreferredSize()); - tf.addActionListener(action); - return tf; + JTextField tf = new JTextField(columns); + tf.setFont(normalFont); + tf.setMaximumSize(tf.getPreferredSize()); + tf.addActionListener(action); + return tf; } /* Build the GUI */ void setup() { - JPanel main = new JPanel(new BorderLayout()); - - main.setMinimumSize(new Dimension(500, 250)); - main.setPreferredSize(new Dimension(800, 400)); - - // Three panels: mote list, graph, controls - moteListModel = new MoteTableModel(); - JTable moteList = new JTable(moteListModel); - moteList.setDefaultRenderer(Color.class, new MoteColor()); - moteList.setDefaultEditor(Color.class, - new ColorCellEditor("Pick Mote Color")); - moteList.setPreferredScrollableViewportSize(new Dimension(100, 400)); - JScrollPane motePanel = new JScrollPane(); - motePanel.getViewport().add(moteList, null); - main.add(motePanel, BorderLayout.WEST); - - graph = new Graph(this); - main.add(graph, BorderLayout.CENTER); - - // Controls. Organised using box layouts. - - // Sample period. - JLabel sampleLabel = makeLabel("Sample period (ms):", JLabel.RIGHT); - sampleText = makeTextField(6, new ActionListener() { - public void actionPerformed(ActionEvent e) { setSamplePeriod(); } - } ); - updateSamplePeriod(); - - // Clear data. - JButton clearButton = makeButton("Clear data", new ActionListener() { - public void actionPerformed(ActionEvent e) { clearData(); } - } ); - - // Adjust X-axis zoom. - Box xControl = new Box(BoxLayout.Y_AXIS); - xLabel = makeLabel("", JLabel.CENTER); - final JSlider xSlider = new JSlider(JSlider.HORIZONTAL, 0, 8, graph.scale); - Hashtable xTable = new Hashtable(); - for (int i = 0; i <= 8; i += 2) { - xTable.put(new Integer(i), - makeSmallLabel("" + (Graph.MIN_WIDTH << i), - JLabel.CENTER)); - } - xSlider.setLabelTable(xTable); - xSlider.setPaintLabels(true); - graph.updateXLabel(); - graph.setScale(graph.scale); - xSlider.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - //if (!xSlider.getValueIsAdjusting()) - graph.setScale((int)xSlider.getValue()); - } - }); - xControl.add(xLabel); - xControl.add(xSlider); - - // Adjust Y-axis range. - JLabel yLabel = makeLabel("Y:", JLabel.RIGHT); - yText = makeTextField(12, new ActionListener() { - public void actionPerformed(ActionEvent e) { setYAxis(); } - } ); - yText.setText(graph.gy0 + " - " + graph.gy1); - - Box controls = new Box(BoxLayout.X_AXIS); - controls.add(clearButton); - controls.add(Box.createHorizontalGlue()); - controls.add(Box.createRigidArea(new Dimension(20, 0))); - controls.add(sampleLabel); - controls.add(sampleText); - controls.add(Box.createHorizontalGlue()); - controls.add(Box.createRigidArea(new Dimension(20, 0))); - controls.add(xControl); - controls.add(yLabel); - controls.add(yText); - main.add(controls, BorderLayout.SOUTH); - - // The frame part - frame = new JFrame("Oscilloscope"); - frame.setSize(main.getPreferredSize()); - frame.getContentPane().add(main); - frame.setVisible(true); - frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { System.exit(0); } - }); + JPanel main = new JPanel(new BorderLayout()); + + main.setMinimumSize(new Dimension(500, 250)); + main.setPreferredSize(new Dimension(800, 400)); + + // Three panels: mote list, graph, controls + moteListModel = new MoteTableModel(); + JTable moteList = new JTable(moteListModel); + moteList.setDefaultRenderer(Color.class, new MoteColor()); + moteList.setDefaultEditor(Color.class, + new ColorCellEditor("Pick Mote Color")); + moteList.setPreferredScrollableViewportSize(new Dimension(100, 400)); + JScrollPane motePanel = new JScrollPane(); + motePanel.getViewport().add(moteList, null); + main.add(motePanel, BorderLayout.WEST); + + graph = new Graph(this); + main.add(graph, BorderLayout.CENTER); + + // Controls. Organised using box layouts. + + // Sample period. + JLabel sampleLabel = makeLabel("Sample period (ms):", JLabel.RIGHT); + sampleText = makeTextField(6, new ActionListener() { + public void actionPerformed(ActionEvent e) { setSamplePeriod(); } + } ); + updateSamplePeriod(); + + // Clear data. + JButton clearButton = makeButton("Clear data", new ActionListener() { + public void actionPerformed(ActionEvent e) { clearData(); } + } ); + + // Adjust X-axis zoom. + Box xControl = new Box(BoxLayout.Y_AXIS); + xLabel = makeLabel("", JLabel.CENTER); + final JSlider xSlider = new JSlider(JSlider.HORIZONTAL, 0, 8, graph.scale); + Hashtable xTable = new Hashtable(); + for (int i = 0; i <= 8; i += 2) { + xTable.put(new Integer(i), + makeSmallLabel("" + (Graph.MIN_WIDTH << i), + JLabel.CENTER)); + } + xSlider.setLabelTable(xTable); + xSlider.setPaintLabels(true); + graph.updateXLabel(); + graph.setScale(graph.scale); + xSlider.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + //if (!xSlider.getValueIsAdjusting()) + graph.setScale((int)xSlider.getValue()); + } + }); + xControl.add(xLabel); + xControl.add(xSlider); + + // Adjust Y-axis range. + JLabel yLabel = makeLabel("Y:", JLabel.RIGHT); + yText = makeTextField(12, new ActionListener() { + public void actionPerformed(ActionEvent e) { setYAxis(); } + } ); + yText.setText(graph.gy0 + " - " + graph.gy1); + + Box controls = new Box(BoxLayout.X_AXIS); + controls.add(clearButton); + controls.add(Box.createHorizontalGlue()); + controls.add(Box.createRigidArea(new Dimension(20, 0))); + controls.add(sampleLabel); + controls.add(sampleText); + controls.add(Box.createHorizontalGlue()); + controls.add(Box.createRigidArea(new Dimension(20, 0))); + controls.add(xControl); + controls.add(yLabel); + controls.add(yText); + main.add(controls, BorderLayout.SOUTH); + + // The frame part + frame = new JFrame("Oscilloscope"); + frame.setSize(main.getPreferredSize()); + frame.getContentPane().add(main); + frame.setVisible(true); + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { System.exit(0); } + }); } /* User operation: clear data */ void clearData() { - synchronized (parent) { - moteListModel.clear(); - parent.clear(); - graph.newData(); - } + synchronized (parent) { + moteListModel.clear(); + parent.clear(); + graph.newData(); + } } /* User operation: set Y-axis range. */ void setYAxis() { - String val = yText.getText(); - - try { - int dash = val.indexOf('-'); - if (dash >= 0) { - String min = val.substring(0, dash).trim(); - String max = val.substring(dash + 1).trim(); - - if (!graph.setYAxis(Integer.parseInt(min), Integer.parseInt(max))) { - error("Invalid range " - + min - + " - " - + max - + " (expected values between 0 and 65535)"); - } - return; - } - } - catch (NumberFormatException e) { } - error("Invalid range " + val + " (expected NN-MM)"); + String val = yText.getText(); + + try { + int dash = val.indexOf('-'); + if (dash >= 0) { + String min = val.substring(0, dash).trim(); + String max = val.substring(dash + 1).trim(); + + if (!graph.setYAxis(Integer.parseInt(min), Integer.parseInt(max))) { + error("Invalid range " + + min + + " - " + + max + + " (expected values between 0 and 65535)"); + } + return; + } + } + catch (NumberFormatException e) { } + error("Invalid range " + val + " (expected NN-MM)"); } /* User operation: set sample period. */ void setSamplePeriod() { - String periodS = sampleText.getText().trim(); - try { - int newPeriod = Integer.parseInt(periodS); - if (parent.setInterval(newPeriod)) { - return; - } - } - catch (NumberFormatException e) { } - error("Invalid sample period " + periodS); + String periodS = sampleText.getText().trim(); + try { + int newPeriod = Integer.parseInt(periodS); + if (parent.setInterval(newPeriod)) { + return; + } + } + catch (NumberFormatException e) { } + error("Invalid sample period " + periodS); } /* Notification: sample period changed. */ void updateSamplePeriod() { - sampleText.setText("" + parent.interval); + sampleText.setText("" + parent.interval); } /* Notification: new node. */ void newNode(int nodeId) { - moteListModel.newNode(nodeId); + moteListModel.newNode(nodeId); } /* Notification: new data. */ void newData() { - graph.newData(); + graph.newData(); } void error(String msg) { - JOptionPane.showMessageDialog(frame, msg, "Error", - JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(frame, msg, "Error", + JOptionPane.ERROR_MESSAGE); } } diff --git a/apps/Oscilloscope/oscilloscope.py b/apps/Oscilloscope/oscilloscope.py new file mode 100644 index 00000000..3b881add --- /dev/null +++ b/apps/Oscilloscope/oscilloscope.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import sys +import tos + +AM_OSCILLOSCOPE = 0x93 + +class OscilloscopeMsg(tos.Packet): + def __init__(self, packet = None): + tos.Packet.__init__(self, + [('version', 'int', 2), + ('interval', 'int', 2), + ('id', 'int', 2), + ('count', 'int', 2), + ('readings', 'blob', None)], + packet) +if '-h' in sys.argv: + print "Usage:", sys.argv[0], "serial@/dev/ttyUSB0:57600" + sys.exit() + +am = tos.AM() + +while True: + p = am.read() + if p and p.type == AM_OSCILLOSCOPE: + msg = OscilloscopeMsg(p.data) + print msg.id, msg.count, [i<<8 | j for (i,j) in zip(msg.readings[::2], msg.readings[1::2])] + #print msg + diff --git a/apps/Powerup/PowerupC.nc b/apps/Powerup/PowerupC.nc index 3a2c898a..175d2a1a 100644 --- a/apps/Powerup/PowerupC.nc +++ b/apps/Powerup/PowerupC.nc @@ -34,7 +34,7 @@ * * @author Cory Sharp */ -module PowerupC +module PowerupC @safe() { uses interface Boot; uses interface Leds; diff --git a/apps/RadioCountToLeds/Makefile b/apps/RadioCountToLeds/Makefile index 0a8e2eb9..5cab01d6 100644 --- a/apps/RadioCountToLeds/Makefile +++ b/apps/RadioCountToLeds/Makefile @@ -1,5 +1,6 @@ COMPONENT=RadioCountToLedsAppC BUILD_EXTRA_DEPS = RadioCountMsg.py RadioCountMsg.class +CLEAN_EXTRA = RadioCountMsg.py RadioCountMsg.class RadioCountMsg.java RadioCountMsg.py: RadioCountToLeds.h mig python -target=$(PLATFORM) $(CFLAGS) -python-classname=RadioCountMsg RadioCountToLeds.h radio_count_msg -o $@ diff --git a/apps/RadioSenseToLeds/RadioSenseToLedsC.nc b/apps/RadioSenseToLeds/RadioSenseToLedsC.nc index 2762d59d..dd8710b2 100644 --- a/apps/RadioSenseToLeds/RadioSenseToLedsC.nc +++ b/apps/RadioSenseToLeds/RadioSenseToLedsC.nc @@ -43,7 +43,7 @@ * @date June 6 2005 */ -module RadioSenseToLedsC { +module RadioSenseToLedsC @safe(){ uses { interface Leds; interface Boot; diff --git a/apps/TCPEcho/HttpdP.nc b/apps/TCPEcho/HttpdP.nc new file mode 100644 index 00000000..26b1046a --- /dev/null +++ b/apps/TCPEcho/HttpdP.nc @@ -0,0 +1,152 @@ + +module HttpdP { + uses { + interface Leds; + interface Boot; + interface Tcp; + } +} implementation { + + static char *http_okay = "HTTP/1.0 200 OK\r\n\r\n"; + static int http_okay_len = 19; + + enum { + S_IDLE, + S_CONNECTED, + S_REQUEST_PRE, + S_REQUEST, + S_HEADER, + S_BODY, + }; + + enum { + HTTP_GET, + HTTP_POST, + }; + + void process_request(int verb, char *request, int len) { + char reply[24]; + memcpy(reply, "led0: 0 led1: 0 led2: 0\n", 24); + + printfUART("request: '%s'\n", request); + + if (len >= 10 && + request[0] == '/' && + request[1] == 'r' && + request[2] == 'e' && + request[3] == 'a' && + request[4] == 'd' && + request[5] == '/') { + if (request[6] == 'l' && + request[7] == 'e' && + request[8] == 'd' && + request[9] == 's') { + uint8_t bitmap = call Leds.get(); + call Tcp.send(http_okay, http_okay_len); + if (bitmap & 1) reply[6] = '1'; + if (bitmap & 2) reply[14] = '1'; + if (bitmap & 4) reply[22] = '1'; + call Tcp.send(reply, 24); + } + } + call Tcp.close(); + } + + int http_state; + int req_verb; + char request_buf[150], *request; + char tcp_buf[100]; + + event void Boot.booted() { + http_state = S_IDLE; + call Tcp.bind(80); + } + + event bool Tcp.accept(struct sockaddr_in6 *from, + void **tx_buf, int *tx_buf_len) { + if (http_state == S_IDLE) { + http_state = S_CONNECTED; + *tx_buf = tcp_buf; + *tx_buf_len = 100; + return TRUE; + } + printfUART("rejecting connection\n"); + return FALSE; + } + event void Tcp.connectDone(error_t e) { + + } + event void Tcp.recv(void *payload, uint16_t len) { + static int crlf_pos; + char *msg = payload; + switch (http_state) { + case S_CONNECTED: + crlf_pos = 0; + request = request_buf; + if (len < 3) { + call Tcp.close(); + return; + } + if (msg[0] == 'G') { + req_verb = HTTP_GET; + msg += 3; + len -= 3; + } + http_state = S_REQUEST_PRE; + case S_REQUEST_PRE: + while (len > 0 && *msg == ' ') { + len--; msg++; + } + if (len == 0) break; + http_state = S_REQUEST; + case S_REQUEST: + while (len > 0 && *msg != ' ') { + *request++ = *msg++; + len--; + } + if (len == 0) break; + *request++ = '\0'; + http_state = S_HEADER; + case S_HEADER: + while (len > 0) { + switch (crlf_pos) { + case 0: + case 2: + if (*msg == '\r') crlf_pos ++; + else if (*msg == '\n') crlf_pos += 2; + else crlf_pos = 0; + break; + case 1: + case 3: + if (*msg == '\n') crlf_pos ++; + else crlf_pos = 0; + break; + } + len--; msg++; + // if crlf == 2, we just finished a header line. you know. fyi. + if (crlf_pos == 4) { + http_state = S_BODY; + process_request(req_verb, request_buf, request - request_buf - 1); + break; + } + } + if (crlf_pos < 4) break; + + case S_BODY: + // len might be zero here... just a note. + default: + call Tcp.close(); + } + } + + event void Tcp.closed(error_t e) { + call Leds.led2Toggle(); + + call Tcp.bind(80); + http_state = S_IDLE; + } + + event void Tcp.acked() { + + } +} diff --git a/apps/TCPEcho/Makefile b/apps/TCPEcho/Makefile new file mode 100644 index 00000000..a8a9101e --- /dev/null +++ b/apps/TCPEcho/Makefile @@ -0,0 +1,26 @@ +COMPONENT=TCPEchoC + +# uncomment this for network programming support +# BOOTLOADER=tosboot + +# radio opts +CFLAGS += -DCC2420_DEF_CHANNEL=15 +# CFLAGS += -DCC2420_DEF_RFPOWER=4 + + +# CFLAGS += -DNO_LIB6LOWPAN_ASCII + +# if this is set, motes will send debugging information to the address +# listed. +# CFLAGS += -DREPORT_DEST=\"2001:470:1f04:56d::64\" + +# sim/test harness +# CFLAGS += -I../IPBaseStation +# CFLAGS += -DDBG_TRACK_FLOWS -DDBG_FLOWS_REPORT + +# printf debugs. works only on telosb/tmote sky +# CFLAGS += -DPRINTFUART_ENABLED + + +include $(MAKERULES) + diff --git a/apps/TCPEcho/README b/apps/TCPEcho/README new file mode 100644 index 00000000..4d6e1d68 --- /dev/null +++ b/apps/TCPEcho/README @@ -0,0 +1,15 @@ + +A simple application which verifies the 6loWPAN stack is functioning +correctly. A mote running this will respond to ICMP Echo requests +(0x80), and provide a UDP echo service on port 7 (a la rfc862). + +It also provides a TCP echo service on port 7, and a simple HTTP +server on port 80. The only resource supported is '/read/leds'. This +functionality can be used to verify that the TCP stack is functional. + +To build, use the 'blip' make target extra. IE, + +$ make blip ... + +For more information on setting up an IPv6 network, please see the tutorial: +http://docs.tinyos.net/index.php/BLIP_Tutorial diff --git a/apps/TCPEcho/TCPEchoC.nc b/apps/TCPEcho/TCPEchoC.nc new file mode 100644 index 00000000..7f9e28fa --- /dev/null +++ b/apps/TCPEcho/TCPEchoC.nc @@ -0,0 +1,65 @@ +/* + * "Copyright (c) 2008 The Regents of the University of California. + * All rights reserved." + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + */ + +#include <6lowpan.h> + +configuration TCPEchoC { + +} implementation { + components MainC, LedsC; + components TCPEchoP; + + TCPEchoP.Boot -> MainC; + TCPEchoP.Leds -> LedsC; + + components new TimerMilliC(); + components IPDispatchC; + + TCPEchoP.RadioControl -> IPDispatchC; + components new UdpSocketC() as Echo, + new UdpSocketC() as Status; + TCPEchoP.Echo -> Echo; + + components new TcpSocketC() as TcpEcho; + TCPEchoP.TcpEcho -> TcpEcho; + + components new TcpSocketC() as TcpWeb, HttpdP; + HttpdP.Boot -> MainC; + HttpdP.Leds -> LedsC; + HttpdP.Tcp -> TcpWeb; + + TCPEchoP.Status -> Status; + + TCPEchoP.StatusTimer -> TimerMilliC; + + components UdpC; + + TCPEchoP.IPStats -> IPDispatchC.IPStats; + TCPEchoP.RouteStats -> IPDispatchC.RouteStats; + TCPEchoP.ICMPStats -> IPDispatchC.ICMPStats; + TCPEchoP.UDPStats -> UdpC; + + components RandomC; + TCPEchoP.Random -> RandomC; + + components UDPShellC; +} diff --git a/apps/TCPEcho/TCPEchoP.nc b/apps/TCPEcho/TCPEchoP.nc new file mode 100644 index 00000000..43860892 --- /dev/null +++ b/apps/TCPEcho/TCPEchoP.nc @@ -0,0 +1,161 @@ +/* + * "Copyright (c) 2008 The Regents of the University of California. + * All rights reserved." + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + */ + +#include +#include +#include +#include +#include + +#include "UDPReport.h" +#include "PrintfUART.h" + +#define REPORT_PERIOD 75L + +module TCPEchoP { + uses { + interface Boot; + interface SplitControl as RadioControl; + + interface UDP as Echo; + interface UDP as Status; + interface Tcp as TcpEcho; + + interface Leds; + + interface Timer as StatusTimer; + + interface Statistics as IPStats; + interface Statistics as RouteStats; + interface Statistics as ICMPStats; + interface Statistics as UDPStats; + + interface Random; + + } + +} implementation { + + bool timerStarted; + nx_struct udp_report stats; + struct sockaddr_in6 route_dest; + +#ifndef SIM +#define CHECK_NODE_ID +#else +#define CHECK_NODE_ID if (TOS_NODE_ID == BASESTATION_ID) return +#endif + + event void Boot.booted() { + CHECK_NODE_ID; + call RadioControl.start(); + timerStarted = FALSE; + + call IPStats.clear(); + call RouteStats.clear(); + call ICMPStats.clear(); + printfUART_init(); + + +#ifdef REPORT_DEST + route_dest.sin6_port = hton16(7000); + inet_pton6(REPORT_DEST, &route_dest.sin6_addr); + call StatusTimer.startOneShot(call Random.rand16() % (1024 * REPORT_PERIOD)); +#endif + + dbg("Boot", "booted: %i\n", TOS_NODE_ID); + call Echo.bind(7); + call TcpEcho.bind(7); + call Status.bind(7001); + } + + event void RadioControl.startDone(error_t e) { + + } + + event void RadioControl.stopDone(error_t e) { + + } + + event void Status.recvfrom(struct sockaddr_in6 *from, void *data, + uint16_t len, struct ip_metadata *meta) { + + } + + event void Echo.recvfrom(struct sockaddr_in6 *from, void *data, + uint16_t len, struct ip_metadata *meta) { + CHECK_NODE_ID; + call Echo.sendto(from, data, len); + } + + enum { + STATUS_SIZE = sizeof(ip_statistics_t) + + sizeof(route_statistics_t) + + sizeof(icmp_statistics_t) + sizeof(udp_statistics_t), + }; + + + event void StatusTimer.fired() { + + if (!timerStarted) { + call StatusTimer.startPeriodic(1024 * REPORT_PERIOD); + timerStarted = TRUE; + } + + stats.seqno++; + stats.sender = TOS_NODE_ID; + + call IPStats.get(&stats.ip); + call RouteStats.get(&stats.route); + call ICMPStats.get(&stats.icmp); + call UDPStats.get(&stats.udp); + + call Status.sendto(&route_dest, &stats, sizeof(stats)); + } + + /* + * Example code for setting up a TCP echo socket. + */ + + bool sock_connected = FALSE; + char tcp_buf[150]; + + event bool TcpEcho.accept(struct sockaddr_in6 *from, + void **tx_buf, int *tx_buf_len) { + *tx_buf = tcp_buf; + *tx_buf_len = 150; + return TRUE; + } + event void TcpEcho.connectDone(error_t e) { + + } + event void TcpEcho.recv(void *payload, uint16_t len) { + if (call TcpEcho.send(payload,len) != SUCCESS) + call Leds.led2Toggle(); + } + event void TcpEcho.closed(error_t e) { + call Leds.led0Toggle(); + call TcpEcho.bind(7); + } + event void TcpEcho.acked() {} + +} diff --git a/apps/TCPEcho/UDPReport.h b/apps/TCPEcho/UDPReport.h new file mode 100644 index 00000000..2efaaa0e --- /dev/null +++ b/apps/TCPEcho/UDPReport.h @@ -0,0 +1,36 @@ +/* + * "Copyright (c) 2008 The Regents of the University of California. + * All rights reserved." + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + */ +#ifndef _UDPREPORT_H +#define _UDPREPORT_H + +#include + +nx_struct udp_report { + nx_uint16_t seqno; + nx_uint16_t sender; + ip_statistics_t ip; + udp_statistics_t udp; + icmp_statistics_t icmp; + route_statistics_t route; +} ; + +#endif diff --git a/apps/UDPEcho/Makefile b/apps/UDPEcho/Makefile new file mode 100644 index 00000000..5db98c8e --- /dev/null +++ b/apps/UDPEcho/Makefile @@ -0,0 +1,30 @@ +COMPONENT=UDPEchoC + +# uncomment this for network programming support +# BOOTLOADER=tosboot + +CFLAGS += -DCC2420_DEF_CHANNEL=15 +CFLAGS += -DRF230_DEF_CHANNEL=15 +# CFLAGS += -DCC2420_DEF_RFPOWER=4 + +# disables support for the AM stack, which somewhat reduces code size +# and compresses packet formats. If you want to use other tinyos +# protocols which are AM-based, you should not include this. +CFLAGS += -DIEEE154FRAMES_ENABLED + + +# lib6lowpan contains inet_ntop6 and inet_pton6 to process ascii +# representations of IPv6 addresses. You can remove them to save some +# code if you don't use them +# CFLAGS += -DNO_LIB6LOWPAN_ASCII + +# if this is set, motes will send debugging information to the address +# listed. +# CFLAGS += -DREPORT_DEST=\"2001:470:1f04:56d::64\" + +# printf debugs. works only on telosb/tmote sky +# CFLAGS += -DPRINTFUART_ENABLED + + +include $(MAKERULES) + diff --git a/apps/UDPEcho/Makefile.local b/apps/UDPEcho/Makefile.local new file mode 100644 index 00000000..a911f108 --- /dev/null +++ b/apps/UDPEcho/Makefile.local @@ -0,0 +1,32 @@ +# -*- makefile -*- + +SOURCES=$(LOWPAN_ROOT)/support/sdk/c/lib6lowpan/lib6lowpan.c \ + $(LOWPAN_ROOT)/support/sdk/c/lib6lowpan/lib6lowpanIP.c \ + $(LOWPAN_ROOT)/support/sdk/c/lib6lowpan/lib6lowpanFrag.c \ + $(LOWPAN_ROOT)/support/sdk/c/lib6lowpan/in_cksum.c \ + $(LOWPAN_ROOT)/support/sdk/c/lib6lowpan/ip_malloc.c \ + $(LOWPAN_ROOT)/tos/lib/net/b6lowpan/table.c +OBJS=$(SOURCES:%.c=%.o) + +remake: $(OBJS) + make micaz sim-sf lowpan + g++ -shared -fPIC simbuild/micaz/pytossim.o simbuild/micaz/sim.o simbuild/micaz/tossim.o simbuild/micaz/c-support.o simbuild/micaz/c-sf.o simbuild/micaz/sf.o simbuild/micaz/throttle.o $(OBJS) -lstdc++ -lm -o _TOSSIMmodule.so + make -f Makefile.local cppdriver + +cppdriver: + g++ -g -c -o sim/Driver.o sim/Driver.c -I$(TOSROOT)/tos/lib/tossim/ + g++ -o sim/Driver sim/Driver.o simbuild/micaz/tossim.o simbuild/micaz/sim.o simbuild/micaz/c-support.o simbuild/micaz/c-sf.o simbuild/micaz/sf.o simbuild/micaz/throttle.o $(OBJS) +# simbuild/micaz/c-sf.o simbuild/micaz/pytossim.o simbuild/micaz/sim.o simbuild/micaz/tossim.o +# simbuild/micaz/c-support.o simbuild/micaz/sf.o simbuild/micaz/throttle.o + + + +clean: + rm $(OBJS) + +%.o: %.c + $(CC) -c -fPIC -o $@ $< + +msg: + mig -DMIG -I$(LOWPAN_ROOT)/tos/lib/net/blip -I$(TOSROOT)/tos/chips/cc2420 -I$(LOWPAN_ROOT)/support/sdk/c/blip/include python -python-classname=UdpReport UDPReport.h udp_report -o util/UdpReport.py + mig -DMIG -I$(LOWPAN_ROOT)/tos/lib/net/blip -I$(TOSROOT)/tos/chips/cc2420 -I$(LOWPAN_ROOT)/support/sdk/c/blip/include python -python-classname=TestDriverMsg TestDriver.h testdriver_msg -o util/TestDriverMsg.py diff --git a/apps/UDPEcho/NodeConnectivity/NodeConnectivity.nc b/apps/UDPEcho/NodeConnectivity/NodeConnectivity.nc new file mode 100644 index 00000000..c106615f --- /dev/null +++ b/apps/UDPEcho/NodeConnectivity/NodeConnectivity.nc @@ -0,0 +1,28 @@ +/* + * "Copyright (c) 2008 The Regents of the University of California. + * All rights reserved." + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + */ +// For conversion of topology from .nss to motelab +// See NodeConnectivityM.nc + +interface NodeConnectivity { + command int8_t mapping(uint16_t moteid); + command bool connected(uint16_t srcnode, uint16_t dstnode); +} diff --git a/apps/UDPEcho/NodeConnectivity/TestbedConnectivityM.nc b/apps/UDPEcho/NodeConnectivity/TestbedConnectivityM.nc new file mode 100644 index 00000000..643bf2e5 --- /dev/null +++ b/apps/UDPEcho/NodeConnectivity/TestbedConnectivityM.nc @@ -0,0 +1,70 @@ +/* + * "Copyright (c) 2008 The Regents of the University of California. + * All rights reserved." + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + */ +// Filename: NodeConnectivityM.nc +// Generated on Wed Jun 11 19:54:54 UTC 2008 + +// Created by createMotelabTopology.pl + +module TestbedConnectivityM { + provides { + interface NodeConnectivity; + } +} implementation { + uint8_t connectivity[8][8] = + { + { 1, 1, 0, 0, 0, 0, 0, 0 }, + { 1, 1, 1, 0, 0, 0, 0, 0 }, + { 0, 1, 1, 1, 0, 0, 0, 0 }, + { 0, 0, 1, 1, 1, 0, 0, 0 }, + { 0, 0, 0, 1, 1, 1, 0, 0 }, + { 0, 0, 0, 0, 1, 1, 1, 0 }, + { 0, 0, 0, 0, 0, 1, 1, 1 }, + { 0, 0, 0, 0, 0, 0, 1, 1 } + }; + uint16_t mapping[8] = { 100, 101, 102, 37, 35, 33, 32, 106 }; + + command int8_t NodeConnectivity.mapping(uint16_t moteid) { + uint8_t i; + for (i = 0; i < 8; i++) { + if (mapping[i] == moteid) { + return i; + } + } + return -1; + } + + command bool NodeConnectivity.connected(uint16_t srcnode, uint16_t dstnode) { + int8_t src = call NodeConnectivity.mapping(srcnode); + int8_t dst = call NodeConnectivity.mapping(dstnode); + + if ((src == -1) || + (dst == -1)) { + return FALSE; + } + + if (connectivity[src][dst] == 1) { + return TRUE; + } else { + return FALSE; + } + } +} diff --git a/apps/UDPEcho/NodeConnectivity/createNodeConnectivityM.pl b/apps/UDPEcho/NodeConnectivity/createNodeConnectivityM.pl new file mode 100644 index 00000000..fdf9e16e --- /dev/null +++ b/apps/UDPEcho/NodeConnectivity/createNodeConnectivityM.pl @@ -0,0 +1,167 @@ +#!/usr/bin/perl + +# FileName: createMotelabTopology.pl +# Date: December 31, 2004 +# +# Description: Converts a TOSSIM .nss (topology) file into Motelab format +# Usage: ./createMotelabTopology.pl .nssfile + +# Input: A TOSSIM .nss topology file +# Output: A nesc file containing a 2D array that represents +# the latency for each node and a func that returns true or false +# as to whether that node can communicate with other nodes + + +use strict; + +###################### +# # +# Parse Parameters # +# # +###################### + +if ( 2 > @ARGV ) { + die "Usage: ./createMotelabTopology <.nss file> "; +} + +####################### +# # +# Open file handles # +# # +####################### + +open(INPUT_MAP, "$ARGV[0]") + or die "Unable to open input file $ARGV[0] ($!)"; + +open(INPUT_NSS, "$ARGV[1]") + or die "Unable to open input file $ARGV[1] ($!)"; + +######################### +# # +# Parse and store file # +# outputs # +# # +######################### + +my @mappingArray; +while (my @input = split(/\s+/, )) { + $mappingArray[$input[0]] = $input[1]; +} + +my %probHash; +my $maxI = 0; +my $maxJ = 0; + +while (my @input = split(/:/, )) { + + # 09 Jan 2005 : GWA : Yikes, not sure about ordering here. Also what the + # .nss file includes is the bit error probability, + # essentially the inverse of what we want. + + $probHash{"$input[0]x$input[1]"} = (1 - $input[2]); + + if ($input[0] > $maxI) { + $maxI = $input[0]; + } + if ($input[1] > $maxJ) { + $maxJ = $input[1]; + } +} + +############################# +# # +# Write out the nesC code # +# # +############################# + +my $dateString = `date`; +print < blip ... + +For more information on setting up an IPv6 network, please see the tutorial: +http://docs.tinyos.net/index.php/BLIP_Tutorial diff --git a/apps/UDPEcho/UDPEchoC.nc b/apps/UDPEcho/UDPEchoC.nc new file mode 100644 index 00000000..8cc47ab9 --- /dev/null +++ b/apps/UDPEcho/UDPEchoC.nc @@ -0,0 +1,78 @@ +/* + * "Copyright (c) 2008 The Regents of the University of California. + * All rights reserved." + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + */ + +#include <6lowpan.h> +#ifdef DBG_TRACK_FLOWS +#include "TestDriver.h" +#endif + +configuration UDPEchoC { + +} implementation { + components MainC, LedsC; + components UDPEchoP; + + UDPEchoP.Boot -> MainC; + UDPEchoP.Leds -> LedsC; + + components new TimerMilliC(); + components IPDispatchC; + + UDPEchoP.RadioControl -> IPDispatchC; + components new UdpSocketC() as Echo, + new UdpSocketC() as Status; + UDPEchoP.Echo -> Echo; + + UDPEchoP.Status -> Status; + + UDPEchoP.StatusTimer -> TimerMilliC; + + components UdpC; + UDPEchoP.IPStats -> IPDispatchC.IPStats; + UDPEchoP.UDPStats -> UdpC; + UDPEchoP.RouteStats -> IPDispatchC.RouteStats; + UDPEchoP.ICMPStats -> IPDispatchC.ICMPStats; + + components RandomC; + UDPEchoP.Random -> RandomC; + + components UDPShellC; + +#ifdef SIM + components BaseStationC; +#endif +#ifdef DBG_TRACK_FLOWS + components TestDriverP, SerialActiveMessageC as Serial; + components ICMPResponderC, IPRoutingP; + TestDriverP.Boot -> MainC; + TestDriverP.SerialControl -> Serial; + TestDriverP.ICMPPing -> ICMPResponderC.ICMPPing[unique("PING")]; + TestDriverP.CmdReceive -> Serial.Receive[AM_TESTDRIVER_MSG]; + TestDriverP.IPRouting -> IPRoutingP; + TestDriverP.DoneSend -> Serial.AMSend[AM_TESTDRIVER_MSG]; + TestDriverP.AckSend -> Serial.AMSend[AM_TESTDRIVER_ACK]; + TestDriverP.RadioControl -> IPDispatchC; +#endif +#ifdef DBG_FLOWS_REPORT + components TrackFlowsC; +#endif +} diff --git a/apps/UDPEcho/UDPEchoP.nc b/apps/UDPEcho/UDPEchoP.nc new file mode 100644 index 00000000..eb10fc87 --- /dev/null +++ b/apps/UDPEcho/UDPEchoP.nc @@ -0,0 +1,115 @@ +/* + * "Copyright (c) 2008 The Regents of the University of California. + * All rights reserved." + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + */ + +#include +#include +#include +#include +#include + +#include "UDPReport.h" +#include "PrintfUART.h" + +#define REPORT_PERIOD 75L + +module UDPEchoP { + uses { + interface Boot; + interface SplitControl as RadioControl; + + interface UDP as Echo; + interface UDP as Status; + + interface Leds; + + interface Timer as StatusTimer; + + interface Statistics as IPStats; + interface Statistics as UDPStats; + interface Statistics as RouteStats; + interface Statistics as ICMPStats; + + interface Random; + } + +} implementation { + + bool timerStarted; + nx_struct udp_report stats; + struct sockaddr_in6 route_dest; + + event void Boot.booted() { + call RadioControl.start(); + timerStarted = FALSE; + + call IPStats.clear(); + call RouteStats.clear(); + call ICMPStats.clear(); + printfUART_init(); + +#ifdef REPORT_DEST + route_dest.sin6_port = hton16(7000); + inet_pton6(REPORT_DEST, &route_dest.sin6_addr); + call StatusTimer.startOneShot(call Random.rand16() % (1024 * REPORT_PERIOD)); +#endif + + dbg("Boot", "booted: %i\n", TOS_NODE_ID); + call Echo.bind(7); + call Status.bind(7001); + } + + event void RadioControl.startDone(error_t e) { + + } + + event void RadioControl.stopDone(error_t e) { + + } + + event void Status.recvfrom(struct sockaddr_in6 *from, void *data, + uint16_t len, struct ip_metadata *meta) { + + } + + event void Echo.recvfrom(struct sockaddr_in6 *from, void *data, + uint16_t len, struct ip_metadata *meta) { + call Echo.sendto(from, data, len); + } + + event void StatusTimer.fired() { + + if (!timerStarted) { + call StatusTimer.startPeriodic(1024 * REPORT_PERIOD); + timerStarted = TRUE; + } + + stats.seqno++; + stats.sender = TOS_NODE_ID; + + call IPStats.get(&stats.ip); + call UDPStats.get(&stats.udp); + call ICMPStats.get(&stats.icmp); + call RouteStats.get(&stats.route); + + call Status.sendto(&route_dest, &stats, sizeof(stats)); + } +} diff --git a/apps/UDPEcho/UDPReport.h b/apps/UDPEcho/UDPReport.h new file mode 100644 index 00000000..2efaaa0e --- /dev/null +++ b/apps/UDPEcho/UDPReport.h @@ -0,0 +1,36 @@ +/* + * "Copyright (c) 2008 The Regents of the University of California. + * All rights reserved." + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + */ +#ifndef _UDPREPORT_H +#define _UDPREPORT_H + +#include + +nx_struct udp_report { + nx_uint16_t seqno; + nx_uint16_t sender; + ip_statistics_t ip; + udp_statistics_t udp; + icmp_statistics_t icmp; + route_statistics_t route; +} ; + +#endif diff --git a/apps/UDPEcho/tests/echotest.pl b/apps/UDPEcho/tests/echotest.pl new file mode 100644 index 00000000..30ae0d50 --- /dev/null +++ b/apps/UDPEcho/tests/echotest.pl @@ -0,0 +1,46 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use FileHandle; +use IPC::Open2; + +if (@ARGV != 1) { + print "Usage: echotest.pl \n"; + exit(1); +} + +my $alpha = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +my $testbuf = ""; +while (length($testbuf) < 1280 - 40 - 8) { + $testbuf .= $alpha; +} + +open2(*READER, *WRITER, "nc6 -u $ARGV[0] 7"); + +my $trials = 0; +while (1) { + my $len = int(rand(1000)); + print $len . "\n"; + print WRITER substr($testbuf, 0, $len) . "\n"; + + my $rin = ''; + vec($rin,fileno(READER),1) = 1; + my $found = select($rin, undef, undef, "6"); + if ($found == 1) { + my $foo; + sysread READER, $foo, 1280; + if ($foo eq $testbuf) { + print "WARNING: payload mismatch\n"; + } + } else { + print "FAILURE: len: $len\n"; + } + + $trials++; + print "TRIAL: $trials\n"; + sleep(.05); +} +# need to kill off the nc6 process +print WRITER eof; + diff --git a/apps/UDPEcho/tests/seqtest.pl b/apps/UDPEcho/tests/seqtest.pl new file mode 100755 index 00000000..b3b170a0 --- /dev/null +++ b/apps/UDPEcho/tests/seqtest.pl @@ -0,0 +1,50 @@ +#!/usr/bin/perl + +# make sure we don't break on any length boundaries + +use strict; +use warnings; +use FileHandle; +use IPC::Open2; + +if (@ARGV != 1) { + print "Usage: seqtest.pl \n"; + exit(1); +} + +my $alpha = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +my $testbuf = ""; +while (length($testbuf) < 1280 - 40 - 8) { + $testbuf .= $alpha; +} + +open2(*READER, *WRITER, "nc6 -u $ARGV[0] 7"); + +my $trials = 0; +while (1) { + my $len; + for ($len = 1; $len < 1000; $len++) { + print $len . "\n"; + print WRITER substr($testbuf, 0, $len) . "\n"; + + my $rin = ''; + vec($rin,fileno(READER),1) = 1; + my $found = select($rin, undef, undef, "6"); + if ($found == 1) { + my $foo; + sysread READER, $foo, 1280; + if ($foo eq $testbuf) { + print "WARNING: payload mismatch\n"; + } + } else { + print "FAILURE: len: $len\n"; + } + + $trials++; + print "TRIAL: $trials\n"; + sleep(.05); + } +} +# need to kill off the nc6 process +print WRITER eof; + diff --git a/apps/UDPEcho/util/Listener.py b/apps/UDPEcho/util/Listener.py new file mode 100644 index 00000000..cfe1206d --- /dev/null +++ b/apps/UDPEcho/util/Listener.py @@ -0,0 +1,22 @@ + +import socket +import UdpReport +import re +import sys + +port = 7000 + +if __name__ == '__main__': + + s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) + s.bind(('', port)) + + while True: + data, addr = s.recvfrom(1024) + if (len(data) > 0): + + rpt = UdpReport.UdpReport(data=data, data_length=len(data)) + + print addr + print rpt + diff --git a/apps/UDPEcho/util/MySQLListener.py b/apps/UDPEcho/util/MySQLListener.py new file mode 100644 index 00000000..4a240cf4 --- /dev/null +++ b/apps/UDPEcho/util/MySQLListener.py @@ -0,0 +1,90 @@ + +import socket +import UdpReport +import re +import sys +import MySQLdb + +port = 7000 + +if __name__ == '__main__': + conn = MySQLdb.connect (host = "localhost", + user = "b6lowpan", + db = "b6lowpan") + cursor = conn.cursor() + s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) + s.bind(('', port)) + if len(sys.argv) < 2: + print "\tListener.py " + sys.exit(1) + + try: + drop = "DROP TABLE " + str(sys.argv[1]) + cursor.execute(drop) + except: + print "Drop failed... continuing" + + methods = [] + create_table = "CREATE TABLE " + str(sys.argv[1]) + " (" + create_table += "ts TIMESTAMP, origin INT(4), " + insert = "INSERT INTO " + sys.argv[1] + " (origin, " + + + re = re.compile('^get_(.*)') + for method in dir(UdpReport.UdpReport): + result = re.search(method) + if result != None: + create_table += str(result.group(1)) + " INT(4), " + insert += str(result.group(1)) + ", " + methods.append(str(result.group(1))) + + create_table = create_table[0:len(create_table) - 2] + insert = insert[0:len(insert) - 2] + create_table += ")" + insert += ") VALUES (" + print insert + print create_table + + cursor.execute(create_table) + + while True: + data, addr = s.recvfrom(1024) + if (len(data) > 0): + + + print + print str(len(data)) + ":", + for i in data: + print "0x%x" % ord(i), + + print + rpt = UdpReport.UdpReport(data=data, data_length=len(data)) + addr = addr[0] + AA = addr.split(":") + print addr + print rpt + + + thisInsert = insert + thisInsert += "0x" + AA[-1] + ", " + + + + for m in methods: + try: + getter = getattr(rpt, 'get_' + m, None) + val = getter() + except: + val = 0 + if (isinstance(val, list)): + val = val[0] + thisInsert += str(val) + ", " + thisInsert = thisInsert[0:len(thisInsert) - 2] + thisInsert += ")" + + print thisInsert + + cursor.execute(thisInsert) + + conn.close() + diff --git a/apps/UDPEcho/util/UdpReport.py b/apps/UDPEcho/util/UdpReport.py new file mode 100644 index 00000000..c42f8174 --- /dev/null +++ b/apps/UDPEcho/util/UdpReport.py @@ -0,0 +1,1452 @@ +# +# This class is automatically generated by mig. DO NOT EDIT THIS FILE. +# This class implements a Python interface to the 'UdpReport' +# message type. +# + +import tinyos.message.Message + +# The default size of this message type in bytes. +DEFAULT_MESSAGE_SIZE = 35 + +# The Active Message type associated with this message. +AM_TYPE = -1 + +class UdpReport(tinyos.message.Message.Message): + # Create a new UdpReport of size 35. + def __init__(self, data="", addr=None, gid=None, base_offset=0, data_length=35): + tinyos.message.Message.Message.__init__(self, data, addr, gid, base_offset, data_length) + self.amTypeSet(AM_TYPE) + + # Get AM_TYPE + def get_amType(cls): + return AM_TYPE + + get_amType = classmethod(get_amType) + + # + # Return a String representation of this message. Includes the + # message type name and the non-indexed field values. + # + def __str__(self): + s = "Message \n" + try: + s += " [ip.sent=0x%x]\n" % (self.get_ip_sent()) + except: + pass + try: + s += " [ip.forwarded=0x%x]\n" % (self.get_ip_forwarded()) + except: + pass + try: + s += " [ip.rx_drop=0x%x]\n" % (self.get_ip_rx_drop()) + except: + pass + try: + s += " [ip.tx_drop=0x%x]\n" % (self.get_ip_tx_drop()) + except: + pass + try: + s += " [ip.fw_drop=0x%x]\n" % (self.get_ip_fw_drop()) + except: + pass + try: + s += " [ip.rx_total=0x%x]\n" % (self.get_ip_rx_total()) + except: + pass + try: + s += " [ip.real_drop=0x%x]\n" % (self.get_ip_real_drop()) + except: + pass + try: + s += " [ip.hlim_drop=0x%x]\n" % (self.get_ip_hlim_drop()) + except: + pass + try: + s += " [ip.senddone_el=0x%x]\n" % (self.get_ip_senddone_el()) + except: + pass + try: + s += " [ip.fragpool=0x%x]\n" % (self.get_ip_fragpool()) + except: + pass + try: + s += " [ip.sendinfo=0x%x]\n" % (self.get_ip_sendinfo()) + except: + pass + try: + s += " [ip.sendentry=0x%x]\n" % (self.get_ip_sendentry()) + except: + pass + try: + s += " [ip.sndqueue=0x%x]\n" % (self.get_ip_sndqueue()) + except: + pass + try: + s += " [ip.encfail=0x%x]\n" % (self.get_ip_encfail()) + except: + pass + try: + s += " [ip.heapfree=0x%x]\n" % (self.get_ip_heapfree()) + except: + pass + try: + s += " [udp.total=0x%x]\n" % (self.get_udp_total()) + except: + pass + try: + s += " [udp.failed=0x%x]\n" % (self.get_udp_failed()) + except: + pass + try: + s += " [udp.seqno=0x%x]\n" % (self.get_udp_seqno()) + except: + pass + try: + s += " [udp.sender=0x%x]\n" % (self.get_udp_sender()) + except: + pass + try: + s += " [icmp.rx=0x%x]\n" % (self.get_icmp_rx()) + except: + pass + try: + s += " [route.hop_limit=0x%x]\n" % (self.get_route_hop_limit()) + except: + pass + try: + s += " [route.parent=0x%x]\n" % (self.get_route_parent()) + except: + pass + try: + s += " [route.parent_metric=0x%x]\n" % (self.get_route_parent_metric()) + except: + pass + try: + s += " [route.parent_etx=0x%x]\n" % (self.get_route_parent_etx()) + except: + pass + return s + + # Message-type-specific access methods appear below. + + # + # Accessor methods for field: ip.sent + # Field type: int + # Offset (bits): 0 + # Size (bits): 16 + # + + # + # Return whether the field 'ip.sent' is signed (False). + # + def isSigned_ip_sent(self): + return False + + # + # Return whether the field 'ip.sent' is an array (False). + # + def isArray_ip_sent(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.sent' + # + def offset_ip_sent(self): + return (0 / 8) + + # + # Return the offset (in bits) of the field 'ip.sent' + # + def offsetBits_ip_sent(self): + return 0 + + # + # Return the value (as a int) of the field 'ip.sent' + # + def get_ip_sent(self): + return self.getUIntElement(self.offsetBits_ip_sent(), 16, 1) + + # + # Set the value of the field 'ip.sent' + # + def set_ip_sent(self, value): + self.setUIntElement(self.offsetBits_ip_sent(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'ip.sent' + # + def size_ip_sent(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'ip.sent' + # + def sizeBits_ip_sent(self): + return 16 + + # + # Accessor methods for field: ip.forwarded + # Field type: int + # Offset (bits): 16 + # Size (bits): 16 + # + + # + # Return whether the field 'ip.forwarded' is signed (False). + # + def isSigned_ip_forwarded(self): + return False + + # + # Return whether the field 'ip.forwarded' is an array (False). + # + def isArray_ip_forwarded(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.forwarded' + # + def offset_ip_forwarded(self): + return (16 / 8) + + # + # Return the offset (in bits) of the field 'ip.forwarded' + # + def offsetBits_ip_forwarded(self): + return 16 + + # + # Return the value (as a int) of the field 'ip.forwarded' + # + def get_ip_forwarded(self): + return self.getUIntElement(self.offsetBits_ip_forwarded(), 16, 1) + + # + # Set the value of the field 'ip.forwarded' + # + def set_ip_forwarded(self, value): + self.setUIntElement(self.offsetBits_ip_forwarded(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'ip.forwarded' + # + def size_ip_forwarded(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'ip.forwarded' + # + def sizeBits_ip_forwarded(self): + return 16 + + # + # Accessor methods for field: ip.rx_drop + # Field type: short + # Offset (bits): 32 + # Size (bits): 8 + # + + # + # Return whether the field 'ip.rx_drop' is signed (False). + # + def isSigned_ip_rx_drop(self): + return False + + # + # Return whether the field 'ip.rx_drop' is an array (False). + # + def isArray_ip_rx_drop(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.rx_drop' + # + def offset_ip_rx_drop(self): + return (32 / 8) + + # + # Return the offset (in bits) of the field 'ip.rx_drop' + # + def offsetBits_ip_rx_drop(self): + return 32 + + # + # Return the value (as a short) of the field 'ip.rx_drop' + # + def get_ip_rx_drop(self): + return self.getUIntElement(self.offsetBits_ip_rx_drop(), 8, 1) + + # + # Set the value of the field 'ip.rx_drop' + # + def set_ip_rx_drop(self, value): + self.setUIntElement(self.offsetBits_ip_rx_drop(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ip.rx_drop' + # + def size_ip_rx_drop(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ip.rx_drop' + # + def sizeBits_ip_rx_drop(self): + return 8 + + # + # Accessor methods for field: ip.tx_drop + # Field type: short + # Offset (bits): 40 + # Size (bits): 8 + # + + # + # Return whether the field 'ip.tx_drop' is signed (False). + # + def isSigned_ip_tx_drop(self): + return False + + # + # Return whether the field 'ip.tx_drop' is an array (False). + # + def isArray_ip_tx_drop(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.tx_drop' + # + def offset_ip_tx_drop(self): + return (40 / 8) + + # + # Return the offset (in bits) of the field 'ip.tx_drop' + # + def offsetBits_ip_tx_drop(self): + return 40 + + # + # Return the value (as a short) of the field 'ip.tx_drop' + # + def get_ip_tx_drop(self): + return self.getUIntElement(self.offsetBits_ip_tx_drop(), 8, 1) + + # + # Set the value of the field 'ip.tx_drop' + # + def set_ip_tx_drop(self, value): + self.setUIntElement(self.offsetBits_ip_tx_drop(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ip.tx_drop' + # + def size_ip_tx_drop(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ip.tx_drop' + # + def sizeBits_ip_tx_drop(self): + return 8 + + # + # Accessor methods for field: ip.fw_drop + # Field type: short + # Offset (bits): 48 + # Size (bits): 8 + # + + # + # Return whether the field 'ip.fw_drop' is signed (False). + # + def isSigned_ip_fw_drop(self): + return False + + # + # Return whether the field 'ip.fw_drop' is an array (False). + # + def isArray_ip_fw_drop(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.fw_drop' + # + def offset_ip_fw_drop(self): + return (48 / 8) + + # + # Return the offset (in bits) of the field 'ip.fw_drop' + # + def offsetBits_ip_fw_drop(self): + return 48 + + # + # Return the value (as a short) of the field 'ip.fw_drop' + # + def get_ip_fw_drop(self): + return self.getUIntElement(self.offsetBits_ip_fw_drop(), 8, 1) + + # + # Set the value of the field 'ip.fw_drop' + # + def set_ip_fw_drop(self, value): + self.setUIntElement(self.offsetBits_ip_fw_drop(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ip.fw_drop' + # + def size_ip_fw_drop(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ip.fw_drop' + # + def sizeBits_ip_fw_drop(self): + return 8 + + # + # Accessor methods for field: ip.rx_total + # Field type: short + # Offset (bits): 56 + # Size (bits): 8 + # + + # + # Return whether the field 'ip.rx_total' is signed (False). + # + def isSigned_ip_rx_total(self): + return False + + # + # Return whether the field 'ip.rx_total' is an array (False). + # + def isArray_ip_rx_total(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.rx_total' + # + def offset_ip_rx_total(self): + return (56 / 8) + + # + # Return the offset (in bits) of the field 'ip.rx_total' + # + def offsetBits_ip_rx_total(self): + return 56 + + # + # Return the value (as a short) of the field 'ip.rx_total' + # + def get_ip_rx_total(self): + return self.getUIntElement(self.offsetBits_ip_rx_total(), 8, 1) + + # + # Set the value of the field 'ip.rx_total' + # + def set_ip_rx_total(self, value): + self.setUIntElement(self.offsetBits_ip_rx_total(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ip.rx_total' + # + def size_ip_rx_total(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ip.rx_total' + # + def sizeBits_ip_rx_total(self): + return 8 + + # + # Accessor methods for field: ip.real_drop + # Field type: short + # Offset (bits): 64 + # Size (bits): 8 + # + + # + # Return whether the field 'ip.real_drop' is signed (False). + # + def isSigned_ip_real_drop(self): + return False + + # + # Return whether the field 'ip.real_drop' is an array (False). + # + def isArray_ip_real_drop(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.real_drop' + # + def offset_ip_real_drop(self): + return (64 / 8) + + # + # Return the offset (in bits) of the field 'ip.real_drop' + # + def offsetBits_ip_real_drop(self): + return 64 + + # + # Return the value (as a short) of the field 'ip.real_drop' + # + def get_ip_real_drop(self): + return self.getUIntElement(self.offsetBits_ip_real_drop(), 8, 1) + + # + # Set the value of the field 'ip.real_drop' + # + def set_ip_real_drop(self, value): + self.setUIntElement(self.offsetBits_ip_real_drop(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ip.real_drop' + # + def size_ip_real_drop(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ip.real_drop' + # + def sizeBits_ip_real_drop(self): + return 8 + + # + # Accessor methods for field: ip.hlim_drop + # Field type: short + # Offset (bits): 72 + # Size (bits): 8 + # + + # + # Return whether the field 'ip.hlim_drop' is signed (False). + # + def isSigned_ip_hlim_drop(self): + return False + + # + # Return whether the field 'ip.hlim_drop' is an array (False). + # + def isArray_ip_hlim_drop(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.hlim_drop' + # + def offset_ip_hlim_drop(self): + return (72 / 8) + + # + # Return the offset (in bits) of the field 'ip.hlim_drop' + # + def offsetBits_ip_hlim_drop(self): + return 72 + + # + # Return the value (as a short) of the field 'ip.hlim_drop' + # + def get_ip_hlim_drop(self): + return self.getUIntElement(self.offsetBits_ip_hlim_drop(), 8, 1) + + # + # Set the value of the field 'ip.hlim_drop' + # + def set_ip_hlim_drop(self, value): + self.setUIntElement(self.offsetBits_ip_hlim_drop(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ip.hlim_drop' + # + def size_ip_hlim_drop(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ip.hlim_drop' + # + def sizeBits_ip_hlim_drop(self): + return 8 + + # + # Accessor methods for field: ip.senddone_el + # Field type: short + # Offset (bits): 80 + # Size (bits): 8 + # + + # + # Return whether the field 'ip.senddone_el' is signed (False). + # + def isSigned_ip_senddone_el(self): + return False + + # + # Return whether the field 'ip.senddone_el' is an array (False). + # + def isArray_ip_senddone_el(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.senddone_el' + # + def offset_ip_senddone_el(self): + return (80 / 8) + + # + # Return the offset (in bits) of the field 'ip.senddone_el' + # + def offsetBits_ip_senddone_el(self): + return 80 + + # + # Return the value (as a short) of the field 'ip.senddone_el' + # + def get_ip_senddone_el(self): + return self.getUIntElement(self.offsetBits_ip_senddone_el(), 8, 1) + + # + # Set the value of the field 'ip.senddone_el' + # + def set_ip_senddone_el(self, value): + self.setUIntElement(self.offsetBits_ip_senddone_el(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ip.senddone_el' + # + def size_ip_senddone_el(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ip.senddone_el' + # + def sizeBits_ip_senddone_el(self): + return 8 + + # + # Accessor methods for field: ip.fragpool + # Field type: short + # Offset (bits): 88 + # Size (bits): 8 + # + + # + # Return whether the field 'ip.fragpool' is signed (False). + # + def isSigned_ip_fragpool(self): + return False + + # + # Return whether the field 'ip.fragpool' is an array (False). + # + def isArray_ip_fragpool(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.fragpool' + # + def offset_ip_fragpool(self): + return (88 / 8) + + # + # Return the offset (in bits) of the field 'ip.fragpool' + # + def offsetBits_ip_fragpool(self): + return 88 + + # + # Return the value (as a short) of the field 'ip.fragpool' + # + def get_ip_fragpool(self): + return self.getUIntElement(self.offsetBits_ip_fragpool(), 8, 1) + + # + # Set the value of the field 'ip.fragpool' + # + def set_ip_fragpool(self, value): + self.setUIntElement(self.offsetBits_ip_fragpool(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ip.fragpool' + # + def size_ip_fragpool(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ip.fragpool' + # + def sizeBits_ip_fragpool(self): + return 8 + + # + # Accessor methods for field: ip.sendinfo + # Field type: short + # Offset (bits): 96 + # Size (bits): 8 + # + + # + # Return whether the field 'ip.sendinfo' is signed (False). + # + def isSigned_ip_sendinfo(self): + return False + + # + # Return whether the field 'ip.sendinfo' is an array (False). + # + def isArray_ip_sendinfo(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.sendinfo' + # + def offset_ip_sendinfo(self): + return (96 / 8) + + # + # Return the offset (in bits) of the field 'ip.sendinfo' + # + def offsetBits_ip_sendinfo(self): + return 96 + + # + # Return the value (as a short) of the field 'ip.sendinfo' + # + def get_ip_sendinfo(self): + return self.getUIntElement(self.offsetBits_ip_sendinfo(), 8, 1) + + # + # Set the value of the field 'ip.sendinfo' + # + def set_ip_sendinfo(self, value): + self.setUIntElement(self.offsetBits_ip_sendinfo(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ip.sendinfo' + # + def size_ip_sendinfo(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ip.sendinfo' + # + def sizeBits_ip_sendinfo(self): + return 8 + + # + # Accessor methods for field: ip.sendentry + # Field type: short + # Offset (bits): 104 + # Size (bits): 8 + # + + # + # Return whether the field 'ip.sendentry' is signed (False). + # + def isSigned_ip_sendentry(self): + return False + + # + # Return whether the field 'ip.sendentry' is an array (False). + # + def isArray_ip_sendentry(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.sendentry' + # + def offset_ip_sendentry(self): + return (104 / 8) + + # + # Return the offset (in bits) of the field 'ip.sendentry' + # + def offsetBits_ip_sendentry(self): + return 104 + + # + # Return the value (as a short) of the field 'ip.sendentry' + # + def get_ip_sendentry(self): + return self.getUIntElement(self.offsetBits_ip_sendentry(), 8, 1) + + # + # Set the value of the field 'ip.sendentry' + # + def set_ip_sendentry(self, value): + self.setUIntElement(self.offsetBits_ip_sendentry(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ip.sendentry' + # + def size_ip_sendentry(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ip.sendentry' + # + def sizeBits_ip_sendentry(self): + return 8 + + # + # Accessor methods for field: ip.sndqueue + # Field type: short + # Offset (bits): 112 + # Size (bits): 8 + # + + # + # Return whether the field 'ip.sndqueue' is signed (False). + # + def isSigned_ip_sndqueue(self): + return False + + # + # Return whether the field 'ip.sndqueue' is an array (False). + # + def isArray_ip_sndqueue(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.sndqueue' + # + def offset_ip_sndqueue(self): + return (112 / 8) + + # + # Return the offset (in bits) of the field 'ip.sndqueue' + # + def offsetBits_ip_sndqueue(self): + return 112 + + # + # Return the value (as a short) of the field 'ip.sndqueue' + # + def get_ip_sndqueue(self): + return self.getUIntElement(self.offsetBits_ip_sndqueue(), 8, 1) + + # + # Set the value of the field 'ip.sndqueue' + # + def set_ip_sndqueue(self, value): + self.setUIntElement(self.offsetBits_ip_sndqueue(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ip.sndqueue' + # + def size_ip_sndqueue(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ip.sndqueue' + # + def sizeBits_ip_sndqueue(self): + return 8 + + # + # Accessor methods for field: ip.encfail + # Field type: short + # Offset (bits): 120 + # Size (bits): 8 + # + + # + # Return whether the field 'ip.encfail' is signed (False). + # + def isSigned_ip_encfail(self): + return False + + # + # Return whether the field 'ip.encfail' is an array (False). + # + def isArray_ip_encfail(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.encfail' + # + def offset_ip_encfail(self): + return (120 / 8) + + # + # Return the offset (in bits) of the field 'ip.encfail' + # + def offsetBits_ip_encfail(self): + return 120 + + # + # Return the value (as a short) of the field 'ip.encfail' + # + def get_ip_encfail(self): + return self.getUIntElement(self.offsetBits_ip_encfail(), 8, 1) + + # + # Set the value of the field 'ip.encfail' + # + def set_ip_encfail(self, value): + self.setUIntElement(self.offsetBits_ip_encfail(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ip.encfail' + # + def size_ip_encfail(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ip.encfail' + # + def sizeBits_ip_encfail(self): + return 8 + + # + # Accessor methods for field: ip.heapfree + # Field type: int + # Offset (bits): 128 + # Size (bits): 16 + # + + # + # Return whether the field 'ip.heapfree' is signed (False). + # + def isSigned_ip_heapfree(self): + return False + + # + # Return whether the field 'ip.heapfree' is an array (False). + # + def isArray_ip_heapfree(self): + return False + + # + # Return the offset (in bytes) of the field 'ip.heapfree' + # + def offset_ip_heapfree(self): + return (128 / 8) + + # + # Return the offset (in bits) of the field 'ip.heapfree' + # + def offsetBits_ip_heapfree(self): + return 128 + + # + # Return the value (as a int) of the field 'ip.heapfree' + # + def get_ip_heapfree(self): + return self.getUIntElement(self.offsetBits_ip_heapfree(), 16, 1) + + # + # Set the value of the field 'ip.heapfree' + # + def set_ip_heapfree(self, value): + self.setUIntElement(self.offsetBits_ip_heapfree(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'ip.heapfree' + # + def size_ip_heapfree(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'ip.heapfree' + # + def sizeBits_ip_heapfree(self): + return 16 + + # + # Accessor methods for field: udp.total + # Field type: int + # Offset (bits): 144 + # Size (bits): 16 + # + + # + # Return whether the field 'udp.total' is signed (False). + # + def isSigned_udp_total(self): + return False + + # + # Return whether the field 'udp.total' is an array (False). + # + def isArray_udp_total(self): + return False + + # + # Return the offset (in bytes) of the field 'udp.total' + # + def offset_udp_total(self): + return (144 / 8) + + # + # Return the offset (in bits) of the field 'udp.total' + # + def offsetBits_udp_total(self): + return 144 + + # + # Return the value (as a int) of the field 'udp.total' + # + def get_udp_total(self): + return self.getUIntElement(self.offsetBits_udp_total(), 16, 1) + + # + # Set the value of the field 'udp.total' + # + def set_udp_total(self, value): + self.setUIntElement(self.offsetBits_udp_total(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'udp.total' + # + def size_udp_total(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'udp.total' + # + def sizeBits_udp_total(self): + return 16 + + # + # Accessor methods for field: udp.failed + # Field type: int + # Offset (bits): 160 + # Size (bits): 16 + # + + # + # Return whether the field 'udp.failed' is signed (False). + # + def isSigned_udp_failed(self): + return False + + # + # Return whether the field 'udp.failed' is an array (False). + # + def isArray_udp_failed(self): + return False + + # + # Return the offset (in bytes) of the field 'udp.failed' + # + def offset_udp_failed(self): + return (160 / 8) + + # + # Return the offset (in bits) of the field 'udp.failed' + # + def offsetBits_udp_failed(self): + return 160 + + # + # Return the value (as a int) of the field 'udp.failed' + # + def get_udp_failed(self): + return self.getUIntElement(self.offsetBits_udp_failed(), 16, 1) + + # + # Set the value of the field 'udp.failed' + # + def set_udp_failed(self, value): + self.setUIntElement(self.offsetBits_udp_failed(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'udp.failed' + # + def size_udp_failed(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'udp.failed' + # + def sizeBits_udp_failed(self): + return 16 + + # + # Accessor methods for field: udp.seqno + # Field type: int + # Offset (bits): 176 + # Size (bits): 16 + # + + # + # Return whether the field 'udp.seqno' is signed (False). + # + def isSigned_udp_seqno(self): + return False + + # + # Return whether the field 'udp.seqno' is an array (False). + # + def isArray_udp_seqno(self): + return False + + # + # Return the offset (in bytes) of the field 'udp.seqno' + # + def offset_udp_seqno(self): + return (176 / 8) + + # + # Return the offset (in bits) of the field 'udp.seqno' + # + def offsetBits_udp_seqno(self): + return 176 + + # + # Return the value (as a int) of the field 'udp.seqno' + # + def get_udp_seqno(self): + return self.getUIntElement(self.offsetBits_udp_seqno(), 16, 1) + + # + # Set the value of the field 'udp.seqno' + # + def set_udp_seqno(self, value): + self.setUIntElement(self.offsetBits_udp_seqno(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'udp.seqno' + # + def size_udp_seqno(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'udp.seqno' + # + def sizeBits_udp_seqno(self): + return 16 + + # + # Accessor methods for field: udp.sender + # Field type: int + # Offset (bits): 192 + # Size (bits): 16 + # + + # + # Return whether the field 'udp.sender' is signed (False). + # + def isSigned_udp_sender(self): + return False + + # + # Return whether the field 'udp.sender' is an array (False). + # + def isArray_udp_sender(self): + return False + + # + # Return the offset (in bytes) of the field 'udp.sender' + # + def offset_udp_sender(self): + return (192 / 8) + + # + # Return the offset (in bits) of the field 'udp.sender' + # + def offsetBits_udp_sender(self): + return 192 + + # + # Return the value (as a int) of the field 'udp.sender' + # + def get_udp_sender(self): + return self.getUIntElement(self.offsetBits_udp_sender(), 16, 1) + + # + # Set the value of the field 'udp.sender' + # + def set_udp_sender(self, value): + self.setUIntElement(self.offsetBits_udp_sender(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'udp.sender' + # + def size_udp_sender(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'udp.sender' + # + def sizeBits_udp_sender(self): + return 16 + + # + # Accessor methods for field: icmp.rx + # Field type: int + # Offset (bits): 208 + # Size (bits): 16 + # + + # + # Return whether the field 'icmp.rx' is signed (False). + # + def isSigned_icmp_rx(self): + return False + + # + # Return whether the field 'icmp.rx' is an array (False). + # + def isArray_icmp_rx(self): + return False + + # + # Return the offset (in bytes) of the field 'icmp.rx' + # + def offset_icmp_rx(self): + return (208 / 8) + + # + # Return the offset (in bits) of the field 'icmp.rx' + # + def offsetBits_icmp_rx(self): + return 208 + + # + # Return the value (as a int) of the field 'icmp.rx' + # + def get_icmp_rx(self): + return self.getUIntElement(self.offsetBits_icmp_rx(), 16, 1) + + # + # Set the value of the field 'icmp.rx' + # + def set_icmp_rx(self, value): + self.setUIntElement(self.offsetBits_icmp_rx(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'icmp.rx' + # + def size_icmp_rx(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'icmp.rx' + # + def sizeBits_icmp_rx(self): + return 16 + + # + # Accessor methods for field: route.hop_limit + # Field type: short + # Offset (bits): 224 + # Size (bits): 8 + # + + # + # Return whether the field 'route.hop_limit' is signed (False). + # + def isSigned_route_hop_limit(self): + return False + + # + # Return whether the field 'route.hop_limit' is an array (False). + # + def isArray_route_hop_limit(self): + return False + + # + # Return the offset (in bytes) of the field 'route.hop_limit' + # + def offset_route_hop_limit(self): + return (224 / 8) + + # + # Return the offset (in bits) of the field 'route.hop_limit' + # + def offsetBits_route_hop_limit(self): + return 224 + + # + # Return the value (as a short) of the field 'route.hop_limit' + # + def get_route_hop_limit(self): + return self.getUIntElement(self.offsetBits_route_hop_limit(), 8, 1) + + # + # Set the value of the field 'route.hop_limit' + # + def set_route_hop_limit(self, value): + self.setUIntElement(self.offsetBits_route_hop_limit(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'route.hop_limit' + # + def size_route_hop_limit(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'route.hop_limit' + # + def sizeBits_route_hop_limit(self): + return 8 + + # + # Accessor methods for field: route.parent + # Field type: int + # Offset (bits): 232 + # Size (bits): 16 + # + + # + # Return whether the field 'route.parent' is signed (False). + # + def isSigned_route_parent(self): + return False + + # + # Return whether the field 'route.parent' is an array (False). + # + def isArray_route_parent(self): + return False + + # + # Return the offset (in bytes) of the field 'route.parent' + # + def offset_route_parent(self): + return (232 / 8) + + # + # Return the offset (in bits) of the field 'route.parent' + # + def offsetBits_route_parent(self): + return 232 + + # + # Return the value (as a int) of the field 'route.parent' + # + def get_route_parent(self): + return self.getUIntElement(self.offsetBits_route_parent(), 16, 1) + + # + # Set the value of the field 'route.parent' + # + def set_route_parent(self, value): + self.setUIntElement(self.offsetBits_route_parent(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'route.parent' + # + def size_route_parent(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'route.parent' + # + def sizeBits_route_parent(self): + return 16 + + # + # Accessor methods for field: route.parent_metric + # Field type: int + # Offset (bits): 248 + # Size (bits): 16 + # + + # + # Return whether the field 'route.parent_metric' is signed (False). + # + def isSigned_route_parent_metric(self): + return False + + # + # Return whether the field 'route.parent_metric' is an array (False). + # + def isArray_route_parent_metric(self): + return False + + # + # Return the offset (in bytes) of the field 'route.parent_metric' + # + def offset_route_parent_metric(self): + return (248 / 8) + + # + # Return the offset (in bits) of the field 'route.parent_metric' + # + def offsetBits_route_parent_metric(self): + return 248 + + # + # Return the value (as a int) of the field 'route.parent_metric' + # + def get_route_parent_metric(self): + return self.getUIntElement(self.offsetBits_route_parent_metric(), 16, 1) + + # + # Set the value of the field 'route.parent_metric' + # + def set_route_parent_metric(self, value): + self.setUIntElement(self.offsetBits_route_parent_metric(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'route.parent_metric' + # + def size_route_parent_metric(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'route.parent_metric' + # + def sizeBits_route_parent_metric(self): + return 16 + + # + # Accessor methods for field: route.parent_etx + # Field type: int + # Offset (bits): 264 + # Size (bits): 16 + # + + # + # Return whether the field 'route.parent_etx' is signed (False). + # + def isSigned_route_parent_etx(self): + return False + + # + # Return whether the field 'route.parent_etx' is an array (False). + # + def isArray_route_parent_etx(self): + return False + + # + # Return the offset (in bytes) of the field 'route.parent_etx' + # + def offset_route_parent_etx(self): + return (264 / 8) + + # + # Return the offset (in bits) of the field 'route.parent_etx' + # + def offsetBits_route_parent_etx(self): + return 264 + + # + # Return the value (as a int) of the field 'route.parent_etx' + # + def get_route_parent_etx(self): + return self.getUIntElement(self.offsetBits_route_parent_etx(), 16, 1) + + # + # Set the value of the field 'route.parent_etx' + # + def set_route_parent_etx(self, value): + self.setUIntElement(self.offsetBits_route_parent_etx(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'route.parent_etx' + # + def size_route_parent_etx(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'route.parent_etx' + # + def sizeBits_route_parent_etx(self): + return 16 + diff --git a/apps/UDPEcho/volumes-at45db.xml b/apps/UDPEcho/volumes-at45db.xml new file mode 100644 index 00000000..8b22ebe4 --- /dev/null +++ b/apps/UDPEcho/volumes-at45db.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/apps/UDPEcho/volumes-stm25p.xml b/apps/UDPEcho/volumes-stm25p.xml new file mode 100644 index 00000000..4210f08a --- /dev/null +++ b/apps/UDPEcho/volumes-stm25p.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/apps/tests/NxFloat/.cvsignore b/apps/tests/NxFloat/.cvsignore new file mode 100644 index 00000000..5abf7886 --- /dev/null +++ b/apps/tests/NxFloat/.cvsignore @@ -0,0 +1,4 @@ +TestSerialMsg.java +TestSerialMsg.class +TestSerial.class +build diff --git a/apps/tests/NxFloat/Makefile b/apps/tests/NxFloat/Makefile new file mode 100644 index 00000000..daf594a9 --- /dev/null +++ b/apps/tests/NxFloat/Makefile @@ -0,0 +1,15 @@ +COMPONENT=TestSerialAppC +BUILD_EXTRA_DEPS += TestSerial.class +CLEAN_EXTRA = *.class TestSerialMsg.java + +CFLAGS += -I$(TOSDIR)/lib/T2Hack + +TestSerial.class: $(wildcard *.java) TestSerialMsg.java + javac -target 1.4 -source 1.4 *.java + +TestSerialMsg.java: + mig java -target=null $(CFLAGS) -java-classname=TestSerialMsg TestSerial.h test_serial_msg -o $@ + + +include $(MAKERULES) + diff --git a/apps/tests/NxFloat/README.txt b/apps/tests/NxFloat/README.txt new file mode 100644 index 00000000..1b16c979 --- /dev/null +++ b/apps/tests/NxFloat/README.txt @@ -0,0 +1,29 @@ +README for NxFloat +Author/Contact: tinyos-help@millennium.berkeley.edu + +Description: + +NxFloat is a version of the TestSerial application modified to use +floating point numbers. It tests communication over the serial port +and nx_float support. The java application sends packets to the serial +port at 1Hz: the packet contains an incrementing counter. When the +mote application receives a counter packet, it displays the bottom +three bits on its LEDs. (This application is similar to +RadioCountToLeds, except that it operates over the serial port.) +Likewise, the mote also sends packets to the serial port at 1Hz, these +packets contain a sequence number multiplied by 3.2. Upon reception of +a packet, the java application prints the counter's value to standard +out. + +Java Application Usage: + java TestSerial [-comm ] + + If not specified, the defaults to sf@localhost:9002 or + to your MOTECOM environment variable (if defined). + +Tools: + +Known bugs/limitations: + +None. + diff --git a/apps/tests/NxFloat/TestSerial.h b/apps/tests/NxFloat/TestSerial.h new file mode 100644 index 00000000..6e0af1a1 --- /dev/null +++ b/apps/tests/NxFloat/TestSerial.h @@ -0,0 +1,13 @@ + +#ifndef TEST_SERIAL_H +#define TEST_SERIAL_H + +typedef nx_struct test_serial_msg { + nx_float counter; +} test_serial_msg_t; + +enum { + AM_TEST_SERIAL_MSG = 0x89, +}; + +#endif diff --git a/apps/tests/NxFloat/TestSerial.java b/apps/tests/NxFloat/TestSerial.java new file mode 100644 index 00000000..873fdec4 --- /dev/null +++ b/apps/tests/NxFloat/TestSerial.java @@ -0,0 +1,106 @@ +/* tab:4 + * "Copyright (c) 2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose, without fee, and without written + * agreement is hereby granted, provided that the above copyright + * notice, the following two paragraphs and the author appear in all + * copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS + * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + */ + +/** + * Java-side application for testing serial port communication. + * + * + * @author Phil Levis + * @date August 12 2005 + */ + +import java.io.IOException; + +import net.tinyos.message.*; +import net.tinyos.packet.*; +import net.tinyos.util.*; + +public class TestSerial implements MessageListener { + + private MoteIF moteIF; + + public TestSerial(MoteIF moteIF) { + this.moteIF = moteIF; + this.moteIF.registerListener(new TestSerialMsg(), this); + } + + public void sendPackets() { + int counter = 0; + TestSerialMsg payload = new TestSerialMsg(); + + try { + while (true) { + System.out.println("Sending packet " + counter); + payload.set_counter(counter); + moteIF.send(0, payload); + counter++; + try {Thread.sleep(1000);} + catch (InterruptedException exception) {} + } + } + catch (IOException exception) { + System.err.println("Exception thrown when sending packets. Exiting."); + System.err.println(exception); + } + } + + public void messageReceived(int to, Message message) { + TestSerialMsg msg = (TestSerialMsg)message; + System.out.println("Received packet sequence number " + msg.get_counter()); + } + + private static void usage() { + System.err.println("usage: TestSerial [-comm ]"); + } + + public static void main(String[] args) throws Exception { + String source = null; + if (args.length == 2) { + if (!args[0].equals("-comm")) { + usage(); + System.exit(1); + } + source = args[1]; + } + else if (args.length != 0) { + usage(); + System.exit(1); + } + + PhoenixSource phoenix; + + if (source == null) { + phoenix = BuildSource.makePhoenix(PrintStreamMessenger.err); + } + else { + phoenix = BuildSource.makePhoenix(source, PrintStreamMessenger.err); + } + + MoteIF mif = new MoteIF(phoenix); + TestSerial serial = new TestSerial(mif); + serial.sendPackets(); + } + + +} diff --git a/apps/tests/NxFloat/TestSerialAppC.nc b/apps/tests/NxFloat/TestSerialAppC.nc new file mode 100644 index 00000000..4383f64a --- /dev/null +++ b/apps/tests/NxFloat/TestSerialAppC.nc @@ -0,0 +1,67 @@ +// $Id$ + +/* tab:4 + * "Copyright (c) 2000-2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2005 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +/** + * Application to test that the TinyOS java toolchain can communicate + * with motes over the serial port. The application sends packets to + * the serial port at 1Hz: the packet contains an incrementing + * counter. When the application receives a counter packet, it + * displays the bottom three bits on its LEDs. This application is + * very similar to RadioCountToLeds, except that it operates over the + * serial port. There is Java application for testing the mote + * application: run TestSerial to print out the received packets and + * send packets to the mote. + * + * @author Gilman Tolle + * @author Philip Levis + * + * @date Aug 12 2005 + * + **/ + +#include "TestSerial.h" + +configuration TestSerialAppC {} +implementation { + components TestSerialC as App, LedsC, MainC; + components SerialActiveMessageC as AM; + components new TimerMilliC(); + + App.Boot -> MainC.Boot; + App.Control -> AM; + App.Receive -> AM.Receive[AM_TEST_SERIAL_MSG]; + App.AMSend -> AM.AMSend[AM_TEST_SERIAL_MSG]; + App.Leds -> LedsC; + App.MilliTimer -> TimerMilliC; + App.Packet -> AM; +} + + diff --git a/apps/tests/NxFloat/TestSerialC.nc b/apps/tests/NxFloat/TestSerialC.nc new file mode 100644 index 00000000..3a40db6b --- /dev/null +++ b/apps/tests/NxFloat/TestSerialC.nc @@ -0,0 +1,130 @@ +// $Id$ + +/* tab:4 + * "Copyright (c) 2000-2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +/** + * Application to test that the TinyOS java toolchain can communicate + * with motes over the serial port. + * + * @author Gilman Tolle + * @author Philip Levis + * + * @date Aug 12 2005 + * + **/ + +#include "Timer.h" +#include "TestSerial.h" + +module TestSerialC { + uses { + interface SplitControl as Control; + interface Leds; + interface Boot; + interface Receive; + interface AMSend; + interface Timer as MilliTimer; + interface Packet; + } +} +implementation { + + message_t packet; + + bool locked = FALSE; + uint16_t counter = 0; + + event void Boot.booted() { + call Control.start(); + } + + event void MilliTimer.fired() { + counter++; + if (locked) { + return; + } + else { + test_serial_msg_t* rcm = (test_serial_msg_t*)call Packet.getPayload(&packet, sizeof(test_serial_msg_t)); + if (rcm == NULL) {return;} + if (call Packet.maxPayloadLength() < sizeof(test_serial_msg_t)) { + return; + } + + rcm->counter = counter * 3.2; + if (call AMSend.send(AM_BROADCAST_ADDR, &packet, sizeof(test_serial_msg_t)) == SUCCESS) { + locked = TRUE; + } + } + } + + event message_t* Receive.receive(message_t* bufPtr, + void* payload, uint8_t len) { + if (len != sizeof(test_serial_msg_t)) {return bufPtr;} + else { + test_serial_msg_t* rcm = (test_serial_msg_t*)payload; + if ((int)rcm->counter & 0x1) { + call Leds.led0On(); + } + else { + call Leds.led0Off(); + } + if ((int)rcm->counter & 0x2) { + call Leds.led1On(); + } + else { + call Leds.led1Off(); + } + if ((int)rcm->counter & 0x4) { + call Leds.led2On(); + } + else { + call Leds.led2Off(); + } + return bufPtr; + } + } + + event void AMSend.sendDone(message_t* bufPtr, error_t error) { + if (&packet == bufPtr) { + locked = FALSE; + } + } + + event void Control.startDone(error_t err) { + if (err == SUCCESS) { + call MilliTimer.startPeriodic(1000); + } + } + event void Control.stopDone(error_t err) {} +} + + + + diff --git a/apps/tests/TestDhv/DhvInject.java b/apps/tests/TestDhv/DhvInject.java new file mode 100644 index 00000000..5867b925 --- /dev/null +++ b/apps/tests/TestDhv/DhvInject.java @@ -0,0 +1,71 @@ + +import java.io.*; +import net.tinyos.message.*; +import net.tinyos.util.*; + +public class DhvInject implements MessageListener +{ + MoteIF mote; + + DhvInject(DhvMsg dhvmsg) { + mote = new MoteIF(PrintStreamMessenger.err); + mote.registerListener(dhvmsg, this); + } + + public synchronized void messageReceived(int dest_addr, Message message) + { + // do nothing for now + } + + void sendDhvDataMsg(int key, long version, short[] data) { + int totalsize = DhvMsg.DEFAULT_MESSAGE_SIZE + + DhvDataMsg.DEFAULT_MESSAGE_SIZE + + DhvData.DEFAULT_MESSAGE_SIZE; + DhvMsg dm = new DhvMsg(totalsize); + dm.set_type((short)3); + + DhvDataMsg ddm = new DhvDataMsg(dm, DhvMsg.DEFAULT_MESSAGE_SIZE); + ddm.set_key(key); + ddm.set_version(version << 16); + ddm.set_size((short)data.length); + + DhvData dd = new DhvData(ddm, DhvDataMsg.DEFAULT_MESSAGE_SIZE); + dd.set_data(data); + + try { + mote.send(MoteIF.TOS_BCAST_ADDR, dd); + } + catch(IOException e) { + System.err.println("Cannot send message"); + } + } + + public static void main(String args[]) { + int i; + + System.out.println("Usage: java DhvInject [key] [version] [hex data delimit space in quotes]"); + int k = Integer.parseInt(args[0], 16); + long v = Long.parseLong(args[1]); + String hexdata[] = args[2].split(" "); + short d[]; + + if(hexdata.length > 16) { + System.err.println("Data too long, keep it <= 16 bytes please"); + } + + d = new short[hexdata.length]; + for(i = 0; i < d.length; i++) + d[i] = Short.parseShort(hexdata[i], 16); + + System.out.println("Key: " + k); + System.out.println("Version: " + v); + System.out.print("Data: "); + for(i = 0; i < d.length; i++) { + System.out.print(d[i] + " "); + } + System.out.println(); + + DhvInject dhvinject = new DhvInject(new DhvMsg()); + dhvinject.sendDhvDataMsg(k, v, d); + } +} diff --git a/apps/tests/TestDhv/Makefile b/apps/tests/TestDhv/Makefile new file mode 100644 index 00000000..7a8241c2 --- /dev/null +++ b/apps/tests/TestDhv/Makefile @@ -0,0 +1,53 @@ +COMPONENT=TestDhvC +BUILD_EXTRA_DEPS = DhvMsg.py DhvDataMsg.py DhvMsg.class DhvDataMsg.class DhvData.class DhvInject.class DhvTestMsg.class +CFLAGS += -I$(TOSDIR)/lib/net +#CFLAGS += -DLOW_POWER_LISTENING +#CFLAGS += -DLPL_DEF_LOCAL_SLEEP=512 +#CFLAGS += -DLPL_DEF_RX_SLEEP=512 +#CFLAGS += -DDELAY_AFTER_RECEIVE=20 +CFLAGS += -I$(TOSDIR)/lib/net/dhv -I$(TOSDIR)/lib/net/dhv/interfaces +#CFLAGS += -I$(TOSDIR)/lib/net/dhv -I$(TOSDIR)/lib/net/dhv/interfaces +#CFLAGS += -I$(TOSDIR)/lib/net/drip + +CONSTANTS += -DTOSH_DATA_LENGTH=32 +CFLAGS += $(CONSTANTS) + +CLEAN_EXTRA += DhvMsg.py DhvDataMsg.py DhvData.py DhvMsg.java DhvDataMsg.java DhvData.java DhvMsg.class DhvDataMsg.class DhvData.class DhvInject.class DhvTestMsg.class DhvTestMsg.java + +DhvMsg.py: + mig python -target=$(PLATFORM) -python-classname=DhvMsg $(CFLAGS) $(TOSDIR)/lib/net/dhv/Dhv.h dhv_msg -o $@ + +DhvDataMsg.py: + mig python -target=$(PLATFORM) -python-classname=DhvDataMsg -python-extends=DhvMsg $(CFLAGS) $(TOSDIR)/lib/net/dhv/Dhv.h dhv_data_msg -o $@ + +DhvData.py: + mig python -target=$(PLATFORM) -python-classname=DhvData -python-extends=DhvDataMsg $(CFLAGS) $(TOSDIR)/lib/net/dhv/Dhv.h dhv_data -o $@ + +DhvTestMsg.class: DhvTestMsg.java + javac DhvTestMsg.java + +DhvMsg.class: DhvMsg.java + javac DhvMsg.java + +DhvDataMsg.class: DhvDataMsg.java + javac DhvDataMsg.java + +DhvData.class: DhvData.java + javac DhvData.java + +DhvTestMsg.java: + mig java -target=null -java-classname=DhvTestMsg $(CFLAGS) $(TOSDIR)/lib/net/dhv/Dhv.h dhv_test_msg -o $@ + +DhvMsg.java: + mig java -target=null -java-classname=DhvMsg $(CFLAGS) $(TOSDIR)/lib/net/dhv/Dhv.h dhv_msg -o $@ + +DhvDataMsg.java: + mig java -target=null -java-classname=DhvDataMsg -java-extends=DhvMsg $(CFLAGS) $(TOSDIR)/lib/net/dhv/Dhv.h dhv_data_msg -o $@ + +DhvData.java: + mig java -target=null -java-classname=DhvData -java-extends=DhvDataMsg $(CFLAGS) $(TOSDIR)/lib/net/dhv/Dhv.h dhv_data -o $@ + +DhvInject.class: + javac DhvInject.java + +include $(MAKERULES) diff --git a/apps/tests/TestDhv/README b/apps/tests/TestDhv/README new file mode 100644 index 00000000..a1542d8c --- /dev/null +++ b/apps/tests/TestDhv/README @@ -0,0 +1,59 @@ + +Title: TestDhv Application +Author: Thanh Dang, Sweungweon Park +adopted from TestDip + +1. SETTING UP THE TEST + +You need to first generate the code for compilation. The gentest.py +script reads in the Master files and creates TestDhvC.nc (the +configuration) and TestDhvP.nc (the module). It takes two parameters, +the total number of items and the number of new items. The items that +are random are chosen randomly. + +If you want 128 total items in the dissemination set, where 96 of +those 128 items are new, you would type: + +python gentest.py 128 96 + +After the configuration and module have been generated, you can use +the normal compilation method (e.g. make telosb). + +2, READING THE LEDS + +When an node receives a new item, it toggles LED0. When a node +completes all items, it turns all LEDs on. + +3. SERIAL MESSAGES + +typedef nx_struct dhv_test_msg_t { + nx_am_addr_t id; + nx_uint8_t count; + nx_uint8_t isOk; +} dhv_test_msg_t; + +When a node receives a new item, it sends a dhv_test_msg_t through the +serial interface. + +id is the node id +count is how many new items it has received so far +isOk will be true if the data value was as expected + +4. PACKET INJECTOR + +You can also use the injector to send data packets via a +basestation. The syntax to do that is: + +java DhvInject [key] [version] [data in quotes delimited by space] + +key is the data key in hexadecimal +version is the version number in decimal +data is the actual data in quotes delimited by space + +For example, if you want to send key 10, version 2, and data "ab cd +ef". You would type: + +java DipInject 0a 2 "ab cd ef" + +For this specific test application, your data needs to be "ef be". You +will need a SerialForwarder running for this work. diff --git a/apps/tests/TestDhv/TestDhv.h b/apps/tests/TestDhv/TestDhv.h new file mode 100644 index 00000000..05535879 --- /dev/null +++ b/apps/tests/TestDhv/TestDhv.h @@ -0,0 +1,8 @@ +#ifndef __TESTDHV_H__ +#define __TESTDHV_H__ + +/*enum { + AM_DHV_TEST_MSG = 0xAB +};*/ + +#endif diff --git a/apps/tests/TestDhv/TestDhvC-Master.nc b/apps/tests/TestDhv/TestDhvC-Master.nc new file mode 100644 index 00000000..94cf293a --- /dev/null +++ b/apps/tests/TestDhv/TestDhvC-Master.nc @@ -0,0 +1,29 @@ +#include "TestDhv.h" + +configuration TestDhvC { + +} + +implementation { + components TestDhvP; + components LedsC as LedsC; + TestDhvP.Leds -> LedsC; + + components DisseminationC; + TestDhvP.StdControl -> DisseminationC; + /* + components new DisseminatorC(uint32_t, 0x1) as Dissem1; + TestDhvP.DisseminationValue1 -> Dissem1; + TestDhvP.DisseminationUpdate1 -> Dissem1; + */ + + // ... DISSEMINATORS + + components MainC; + TestDhvP.Boot -> MainC; + + components SerialActiveMessageC; + components new SerialAMSenderC(AM_DHV_TEST_MSG); + TestDhvP.SerialSend -> SerialAMSenderC; + TestDhvP.SerialControl -> SerialActiveMessageC; +} diff --git a/apps/tests/TestDhv/TestDhvC.nc b/apps/tests/TestDhv/TestDhvC.nc new file mode 100644 index 00000000..44ee2bc3 --- /dev/null +++ b/apps/tests/TestDhv/TestDhvC.nc @@ -0,0 +1,284 @@ +#include "TestDhv.h" + +configuration TestDhvC { + +} + +implementation { + components TestDhvP; + components LedsC as LedsC; + TestDhvP.Leds -> LedsC; + + components DisseminationC; + TestDhvP.StdControl -> DisseminationC; + /* + components new DisseminatorC(uint32_t, 0x1) as Dissem1; + TestDhvP.DisseminationValue1 -> Dissem1; + TestDhvP.DisseminationUpdate1 -> Dissem1; + */ + + components new DisseminatorC(uint16_t, 1) as Dissem1; + TestDhvP.DisseminationUpdate1 -> Dissem1; + TestDhvP.DisseminationValue1 -> Dissem1; + + components new DisseminatorC(uint16_t, 2) as Dissem2; + TestDhvP.DisseminationUpdate2 -> Dissem2; + TestDhvP.DisseminationValue2 -> Dissem2; + + components new DisseminatorC(uint16_t, 3) as Dissem3; + TestDhvP.DisseminationUpdate3 -> Dissem3; + TestDhvP.DisseminationValue3 -> Dissem3; + + components new DisseminatorC(uint16_t, 4) as Dissem4; + TestDhvP.DisseminationUpdate4 -> Dissem4; + TestDhvP.DisseminationValue4 -> Dissem4; + + components new DisseminatorC(uint16_t, 5) as Dissem5; + TestDhvP.DisseminationUpdate5 -> Dissem5; + TestDhvP.DisseminationValue5 -> Dissem5; + + components new DisseminatorC(uint16_t, 6) as Dissem6; + TestDhvP.DisseminationUpdate6 -> Dissem6; + TestDhvP.DisseminationValue6 -> Dissem6; + + components new DisseminatorC(uint16_t, 7) as Dissem7; + TestDhvP.DisseminationUpdate7 -> Dissem7; + TestDhvP.DisseminationValue7 -> Dissem7; + + components new DisseminatorC(uint16_t, 8) as Dissem8; + TestDhvP.DisseminationUpdate8 -> Dissem8; + TestDhvP.DisseminationValue8 -> Dissem8; + + components new DisseminatorC(uint16_t, 9) as Dissem9; + TestDhvP.DisseminationUpdate9 -> Dissem9; + TestDhvP.DisseminationValue9 -> Dissem9; + + components new DisseminatorC(uint16_t, 10) as Dissem10; + TestDhvP.DisseminationUpdate10 -> Dissem10; + TestDhvP.DisseminationValue10 -> Dissem10; + + components new DisseminatorC(uint16_t, 11) as Dissem11; + TestDhvP.DisseminationUpdate11 -> Dissem11; + TestDhvP.DisseminationValue11 -> Dissem11; + + components new DisseminatorC(uint16_t, 12) as Dissem12; + TestDhvP.DisseminationUpdate12 -> Dissem12; + TestDhvP.DisseminationValue12 -> Dissem12; + + components new DisseminatorC(uint16_t, 13) as Dissem13; + TestDhvP.DisseminationUpdate13 -> Dissem13; + TestDhvP.DisseminationValue13 -> Dissem13; + + components new DisseminatorC(uint16_t, 14) as Dissem14; + TestDhvP.DisseminationUpdate14 -> Dissem14; + TestDhvP.DisseminationValue14 -> Dissem14; + + components new DisseminatorC(uint16_t, 15) as Dissem15; + TestDhvP.DisseminationUpdate15 -> Dissem15; + TestDhvP.DisseminationValue15 -> Dissem15; + + components new DisseminatorC(uint16_t, 16) as Dissem16; + TestDhvP.DisseminationUpdate16 -> Dissem16; + TestDhvP.DisseminationValue16 -> Dissem16; + + components new DisseminatorC(uint16_t, 17) as Dissem17; + TestDhvP.DisseminationUpdate17 -> Dissem17; + TestDhvP.DisseminationValue17 -> Dissem17; + + components new DisseminatorC(uint16_t, 18) as Dissem18; + TestDhvP.DisseminationUpdate18 -> Dissem18; + TestDhvP.DisseminationValue18 -> Dissem18; + + components new DisseminatorC(uint16_t, 19) as Dissem19; + TestDhvP.DisseminationUpdate19 -> Dissem19; + TestDhvP.DisseminationValue19 -> Dissem19; + + components new DisseminatorC(uint16_t, 20) as Dissem20; + TestDhvP.DisseminationUpdate20 -> Dissem20; + TestDhvP.DisseminationValue20 -> Dissem20; + + components new DisseminatorC(uint16_t, 21) as Dissem21; + TestDhvP.DisseminationUpdate21 -> Dissem21; + TestDhvP.DisseminationValue21 -> Dissem21; + + components new DisseminatorC(uint16_t, 22) as Dissem22; + TestDhvP.DisseminationUpdate22 -> Dissem22; + TestDhvP.DisseminationValue22 -> Dissem22; + + components new DisseminatorC(uint16_t, 23) as Dissem23; + TestDhvP.DisseminationUpdate23 -> Dissem23; + TestDhvP.DisseminationValue23 -> Dissem23; + + components new DisseminatorC(uint16_t, 24) as Dissem24; + TestDhvP.DisseminationUpdate24 -> Dissem24; + TestDhvP.DisseminationValue24 -> Dissem24; + + components new DisseminatorC(uint16_t, 25) as Dissem25; + TestDhvP.DisseminationUpdate25 -> Dissem25; + TestDhvP.DisseminationValue25 -> Dissem25; + + components new DisseminatorC(uint16_t, 26) as Dissem26; + TestDhvP.DisseminationUpdate26 -> Dissem26; + TestDhvP.DisseminationValue26 -> Dissem26; + + components new DisseminatorC(uint16_t, 27) as Dissem27; + TestDhvP.DisseminationUpdate27 -> Dissem27; + TestDhvP.DisseminationValue27 -> Dissem27; + + components new DisseminatorC(uint16_t, 28) as Dissem28; + TestDhvP.DisseminationUpdate28 -> Dissem28; + TestDhvP.DisseminationValue28 -> Dissem28; + + components new DisseminatorC(uint16_t, 29) as Dissem29; + TestDhvP.DisseminationUpdate29 -> Dissem29; + TestDhvP.DisseminationValue29 -> Dissem29; + + components new DisseminatorC(uint16_t, 30) as Dissem30; + TestDhvP.DisseminationUpdate30 -> Dissem30; + TestDhvP.DisseminationValue30 -> Dissem30; + + components new DisseminatorC(uint16_t, 31) as Dissem31; + TestDhvP.DisseminationUpdate31 -> Dissem31; + TestDhvP.DisseminationValue31 -> Dissem31; + + components new DisseminatorC(uint16_t, 32) as Dissem32; + TestDhvP.DisseminationUpdate32 -> Dissem32; + TestDhvP.DisseminationValue32 -> Dissem32; + + components new DisseminatorC(uint16_t, 33) as Dissem33; + TestDhvP.DisseminationUpdate33 -> Dissem33; + TestDhvP.DisseminationValue33 -> Dissem33; + + components new DisseminatorC(uint16_t, 34) as Dissem34; + TestDhvP.DisseminationUpdate34 -> Dissem34; + TestDhvP.DisseminationValue34 -> Dissem34; + + components new DisseminatorC(uint16_t, 35) as Dissem35; + TestDhvP.DisseminationUpdate35 -> Dissem35; + TestDhvP.DisseminationValue35 -> Dissem35; + + components new DisseminatorC(uint16_t, 36) as Dissem36; + TestDhvP.DisseminationUpdate36 -> Dissem36; + TestDhvP.DisseminationValue36 -> Dissem36; + + components new DisseminatorC(uint16_t, 37) as Dissem37; + TestDhvP.DisseminationUpdate37 -> Dissem37; + TestDhvP.DisseminationValue37 -> Dissem37; + + components new DisseminatorC(uint16_t, 38) as Dissem38; + TestDhvP.DisseminationUpdate38 -> Dissem38; + TestDhvP.DisseminationValue38 -> Dissem38; + + components new DisseminatorC(uint16_t, 39) as Dissem39; + TestDhvP.DisseminationUpdate39 -> Dissem39; + TestDhvP.DisseminationValue39 -> Dissem39; + + components new DisseminatorC(uint16_t, 40) as Dissem40; + TestDhvP.DisseminationUpdate40 -> Dissem40; + TestDhvP.DisseminationValue40 -> Dissem40; + + components new DisseminatorC(uint16_t, 41) as Dissem41; + TestDhvP.DisseminationUpdate41 -> Dissem41; + TestDhvP.DisseminationValue41 -> Dissem41; + + components new DisseminatorC(uint16_t, 42) as Dissem42; + TestDhvP.DisseminationUpdate42 -> Dissem42; + TestDhvP.DisseminationValue42 -> Dissem42; + + components new DisseminatorC(uint16_t, 43) as Dissem43; + TestDhvP.DisseminationUpdate43 -> Dissem43; + TestDhvP.DisseminationValue43 -> Dissem43; + + components new DisseminatorC(uint16_t, 44) as Dissem44; + TestDhvP.DisseminationUpdate44 -> Dissem44; + TestDhvP.DisseminationValue44 -> Dissem44; + + components new DisseminatorC(uint16_t, 45) as Dissem45; + TestDhvP.DisseminationUpdate45 -> Dissem45; + TestDhvP.DisseminationValue45 -> Dissem45; + + components new DisseminatorC(uint16_t, 46) as Dissem46; + TestDhvP.DisseminationUpdate46 -> Dissem46; + TestDhvP.DisseminationValue46 -> Dissem46; + + components new DisseminatorC(uint16_t, 47) as Dissem47; + TestDhvP.DisseminationUpdate47 -> Dissem47; + TestDhvP.DisseminationValue47 -> Dissem47; + + components new DisseminatorC(uint16_t, 48) as Dissem48; + TestDhvP.DisseminationUpdate48 -> Dissem48; + TestDhvP.DisseminationValue48 -> Dissem48; + + components new DisseminatorC(uint16_t, 49) as Dissem49; + TestDhvP.DisseminationUpdate49 -> Dissem49; + TestDhvP.DisseminationValue49 -> Dissem49; + + components new DisseminatorC(uint16_t, 50) as Dissem50; + TestDhvP.DisseminationUpdate50 -> Dissem50; + TestDhvP.DisseminationValue50 -> Dissem50; + + components new DisseminatorC(uint16_t, 51) as Dissem51; + TestDhvP.DisseminationUpdate51 -> Dissem51; + TestDhvP.DisseminationValue51 -> Dissem51; + + components new DisseminatorC(uint16_t, 52) as Dissem52; + TestDhvP.DisseminationUpdate52 -> Dissem52; + TestDhvP.DisseminationValue52 -> Dissem52; + + components new DisseminatorC(uint16_t, 53) as Dissem53; + TestDhvP.DisseminationUpdate53 -> Dissem53; + TestDhvP.DisseminationValue53 -> Dissem53; + + components new DisseminatorC(uint16_t, 54) as Dissem54; + TestDhvP.DisseminationUpdate54 -> Dissem54; + TestDhvP.DisseminationValue54 -> Dissem54; + + components new DisseminatorC(uint16_t, 55) as Dissem55; + TestDhvP.DisseminationUpdate55 -> Dissem55; + TestDhvP.DisseminationValue55 -> Dissem55; + + components new DisseminatorC(uint16_t, 56) as Dissem56; + TestDhvP.DisseminationUpdate56 -> Dissem56; + TestDhvP.DisseminationValue56 -> Dissem56; + + components new DisseminatorC(uint16_t, 57) as Dissem57; + TestDhvP.DisseminationUpdate57 -> Dissem57; + TestDhvP.DisseminationValue57 -> Dissem57; + + components new DisseminatorC(uint16_t, 58) as Dissem58; + TestDhvP.DisseminationUpdate58 -> Dissem58; + TestDhvP.DisseminationValue58 -> Dissem58; + + components new DisseminatorC(uint16_t, 59) as Dissem59; + TestDhvP.DisseminationUpdate59 -> Dissem59; + TestDhvP.DisseminationValue59 -> Dissem59; + + components new DisseminatorC(uint16_t, 60) as Dissem60; + TestDhvP.DisseminationUpdate60 -> Dissem60; + TestDhvP.DisseminationValue60 -> Dissem60; + + components new DisseminatorC(uint16_t, 61) as Dissem61; + TestDhvP.DisseminationUpdate61 -> Dissem61; + TestDhvP.DisseminationValue61 -> Dissem61; + + components new DisseminatorC(uint16_t, 62) as Dissem62; + TestDhvP.DisseminationUpdate62 -> Dissem62; + TestDhvP.DisseminationValue62 -> Dissem62; + + components new DisseminatorC(uint16_t, 63) as Dissem63; + TestDhvP.DisseminationUpdate63 -> Dissem63; + TestDhvP.DisseminationValue63 -> Dissem63; + + components new DisseminatorC(uint16_t, 64) as Dissem64; + TestDhvP.DisseminationUpdate64 -> Dissem64; + TestDhvP.DisseminationValue64 -> Dissem64; + + + components MainC; + TestDhvP.Boot -> MainC; + + components SerialActiveMessageC; + components new SerialAMSenderC(AM_DHV_TEST_MSG); + TestDhvP.SerialSend -> SerialAMSenderC; + TestDhvP.SerialControl -> SerialActiveMessageC; +} diff --git a/apps/tests/TestDhv/TestDhvP-Master.nc b/apps/tests/TestDhv/TestDhvP-Master.nc new file mode 100644 index 00000000..d4cbdb26 --- /dev/null +++ b/apps/tests/TestDhv/TestDhvP-Master.nc @@ -0,0 +1,93 @@ + +module TestDhvP { + uses interface Leds; + uses interface StdControl; + + /* + uses interface DisseminationUpdate as DisseminationUpdate1; + uses interface DisseminationValue as DisseminationValue1; + */ + + // ... INTERFACES + + uses interface Boot; + uses interface AMSend as SerialSend; + uses interface SplitControl as SerialControl; +} + +implementation { + typedef nx_struct dhv_test_msg_t { + nx_am_addr_t id; + nx_uint8_t count; + nx_uint8_t isOk; + } dhv_test_msg_t; + + message_t testMsg; + + uint8_t okBit = 1; + uint16_t data; + uint8_t count = 0; + /* + uint8_t newCount = N; + */ + // ... NEWCOUNT + + void bookkeep(); + + event void SerialControl.startDone(error_t err) { + call StdControl.start(); + if(TOS_NODE_ID == 1) { + data = 0xBEEF; + dbg("TestDhvP","Updating data items\n"); + /* + call DisseminationUpdate1.change(&data); + */ + // ... CHANGES + } + } + + event void SerialControl.stopDone(error_t err) { + + } + + event void Boot.booted() { + call SerialControl.start(); + dbg("TestDhvP", "Booted at %s\n", sim_time_string()); + } + /* + event void DisseminationValue1.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue1.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + */ + + // ... EVENTS + + void bookkeep() { + dhv_test_msg_t* dhvTestMsgPtr; + + if(count < newCount) { + count++; + } + dbg("TestDhvP", "Got an update, %u complete now at %s\n", count, sim_time_string()); + call Leds.led0Toggle(); + + dhvTestMsgPtr = (dhv_test_msg_t*) call SerialSend.getPayload(&testMsg, 0); + dhvTestMsgPtr->id = TOS_NODE_ID; + dhvTestMsgPtr->count = count; + dhvTestMsgPtr->isOk = okBit; + call SerialSend.send(0, &testMsg, sizeof(dhv_test_msg_t)); + + + if(newCount == count) { + dbg("TestDhvP","Dissemination COMPLETE!\n"); + call Leds.set(7); + } + + } + + event void SerialSend.sendDone(message_t* message, error_t err) { + + } +} diff --git a/apps/tests/TestDhv/TestDhvP.nc b/apps/tests/TestDhv/TestDhvP.nc new file mode 100644 index 00000000..5c75d2f9 --- /dev/null +++ b/apps/tests/TestDhv/TestDhvP.nc @@ -0,0 +1,674 @@ + +module TestDhvP { + uses interface Leds; + uses interface StdControl; + + /* + uses interface DisseminationUpdate as DisseminationUpdate1; + uses interface DisseminationValue as DisseminationValue1; + */ + + uses interface DisseminationUpdate as DisseminationUpdate1; + uses interface DisseminationValue as DisseminationValue1; + + uses interface DisseminationUpdate as DisseminationUpdate2; + uses interface DisseminationValue as DisseminationValue2; + + uses interface DisseminationUpdate as DisseminationUpdate3; + uses interface DisseminationValue as DisseminationValue3; + + uses interface DisseminationUpdate as DisseminationUpdate4; + uses interface DisseminationValue as DisseminationValue4; + + uses interface DisseminationUpdate as DisseminationUpdate5; + uses interface DisseminationValue as DisseminationValue5; + + uses interface DisseminationUpdate as DisseminationUpdate6; + uses interface DisseminationValue as DisseminationValue6; + + uses interface DisseminationUpdate as DisseminationUpdate7; + uses interface DisseminationValue as DisseminationValue7; + + uses interface DisseminationUpdate as DisseminationUpdate8; + uses interface DisseminationValue as DisseminationValue8; + + uses interface DisseminationUpdate as DisseminationUpdate9; + uses interface DisseminationValue as DisseminationValue9; + + uses interface DisseminationUpdate as DisseminationUpdate10; + uses interface DisseminationValue as DisseminationValue10; + + uses interface DisseminationUpdate as DisseminationUpdate11; + uses interface DisseminationValue as DisseminationValue11; + + uses interface DisseminationUpdate as DisseminationUpdate12; + uses interface DisseminationValue as DisseminationValue12; + + uses interface DisseminationUpdate as DisseminationUpdate13; + uses interface DisseminationValue as DisseminationValue13; + + uses interface DisseminationUpdate as DisseminationUpdate14; + uses interface DisseminationValue as DisseminationValue14; + + uses interface DisseminationUpdate as DisseminationUpdate15; + uses interface DisseminationValue as DisseminationValue15; + + uses interface DisseminationUpdate as DisseminationUpdate16; + uses interface DisseminationValue as DisseminationValue16; + + uses interface DisseminationUpdate as DisseminationUpdate17; + uses interface DisseminationValue as DisseminationValue17; + + uses interface DisseminationUpdate as DisseminationUpdate18; + uses interface DisseminationValue as DisseminationValue18; + + uses interface DisseminationUpdate as DisseminationUpdate19; + uses interface DisseminationValue as DisseminationValue19; + + uses interface DisseminationUpdate as DisseminationUpdate20; + uses interface DisseminationValue as DisseminationValue20; + + uses interface DisseminationUpdate as DisseminationUpdate21; + uses interface DisseminationValue as DisseminationValue21; + + uses interface DisseminationUpdate as DisseminationUpdate22; + uses interface DisseminationValue as DisseminationValue22; + + uses interface DisseminationUpdate as DisseminationUpdate23; + uses interface DisseminationValue as DisseminationValue23; + + uses interface DisseminationUpdate as DisseminationUpdate24; + uses interface DisseminationValue as DisseminationValue24; + + uses interface DisseminationUpdate as DisseminationUpdate25; + uses interface DisseminationValue as DisseminationValue25; + + uses interface DisseminationUpdate as DisseminationUpdate26; + uses interface DisseminationValue as DisseminationValue26; + + uses interface DisseminationUpdate as DisseminationUpdate27; + uses interface DisseminationValue as DisseminationValue27; + + uses interface DisseminationUpdate as DisseminationUpdate28; + uses interface DisseminationValue as DisseminationValue28; + + uses interface DisseminationUpdate as DisseminationUpdate29; + uses interface DisseminationValue as DisseminationValue29; + + uses interface DisseminationUpdate as DisseminationUpdate30; + uses interface DisseminationValue as DisseminationValue30; + + uses interface DisseminationUpdate as DisseminationUpdate31; + uses interface DisseminationValue as DisseminationValue31; + + uses interface DisseminationUpdate as DisseminationUpdate32; + uses interface DisseminationValue as DisseminationValue32; + + uses interface DisseminationUpdate as DisseminationUpdate33; + uses interface DisseminationValue as DisseminationValue33; + + uses interface DisseminationUpdate as DisseminationUpdate34; + uses interface DisseminationValue as DisseminationValue34; + + uses interface DisseminationUpdate as DisseminationUpdate35; + uses interface DisseminationValue as DisseminationValue35; + + uses interface DisseminationUpdate as DisseminationUpdate36; + uses interface DisseminationValue as DisseminationValue36; + + uses interface DisseminationUpdate as DisseminationUpdate37; + uses interface DisseminationValue as DisseminationValue37; + + uses interface DisseminationUpdate as DisseminationUpdate38; + uses interface DisseminationValue as DisseminationValue38; + + uses interface DisseminationUpdate as DisseminationUpdate39; + uses interface DisseminationValue as DisseminationValue39; + + uses interface DisseminationUpdate as DisseminationUpdate40; + uses interface DisseminationValue as DisseminationValue40; + + uses interface DisseminationUpdate as DisseminationUpdate41; + uses interface DisseminationValue as DisseminationValue41; + + uses interface DisseminationUpdate as DisseminationUpdate42; + uses interface DisseminationValue as DisseminationValue42; + + uses interface DisseminationUpdate as DisseminationUpdate43; + uses interface DisseminationValue as DisseminationValue43; + + uses interface DisseminationUpdate as DisseminationUpdate44; + uses interface DisseminationValue as DisseminationValue44; + + uses interface DisseminationUpdate as DisseminationUpdate45; + uses interface DisseminationValue as DisseminationValue45; + + uses interface DisseminationUpdate as DisseminationUpdate46; + uses interface DisseminationValue as DisseminationValue46; + + uses interface DisseminationUpdate as DisseminationUpdate47; + uses interface DisseminationValue as DisseminationValue47; + + uses interface DisseminationUpdate as DisseminationUpdate48; + uses interface DisseminationValue as DisseminationValue48; + + uses interface DisseminationUpdate as DisseminationUpdate49; + uses interface DisseminationValue as DisseminationValue49; + + uses interface DisseminationUpdate as DisseminationUpdate50; + uses interface DisseminationValue as DisseminationValue50; + + uses interface DisseminationUpdate as DisseminationUpdate51; + uses interface DisseminationValue as DisseminationValue51; + + uses interface DisseminationUpdate as DisseminationUpdate52; + uses interface DisseminationValue as DisseminationValue52; + + uses interface DisseminationUpdate as DisseminationUpdate53; + uses interface DisseminationValue as DisseminationValue53; + + uses interface DisseminationUpdate as DisseminationUpdate54; + uses interface DisseminationValue as DisseminationValue54; + + uses interface DisseminationUpdate as DisseminationUpdate55; + uses interface DisseminationValue as DisseminationValue55; + + uses interface DisseminationUpdate as DisseminationUpdate56; + uses interface DisseminationValue as DisseminationValue56; + + uses interface DisseminationUpdate as DisseminationUpdate57; + uses interface DisseminationValue as DisseminationValue57; + + uses interface DisseminationUpdate as DisseminationUpdate58; + uses interface DisseminationValue as DisseminationValue58; + + uses interface DisseminationUpdate as DisseminationUpdate59; + uses interface DisseminationValue as DisseminationValue59; + + uses interface DisseminationUpdate as DisseminationUpdate60; + uses interface DisseminationValue as DisseminationValue60; + + uses interface DisseminationUpdate as DisseminationUpdate61; + uses interface DisseminationValue as DisseminationValue61; + + uses interface DisseminationUpdate as DisseminationUpdate62; + uses interface DisseminationValue as DisseminationValue62; + + uses interface DisseminationUpdate as DisseminationUpdate63; + uses interface DisseminationValue as DisseminationValue63; + + uses interface DisseminationUpdate as DisseminationUpdate64; + uses interface DisseminationValue as DisseminationValue64; + + + uses interface Boot; + uses interface AMSend as SerialSend; + uses interface SplitControl as SerialControl; +} + +implementation { + typedef nx_struct dhv_test_msg_t { + nx_am_addr_t id; + nx_uint8_t count; + nx_uint8_t isOk; + } dhv_test_msg_t; + + message_t testMsg; + + uint8_t okBit = 1; + uint16_t data; + uint8_t count = 0; + /* + uint8_t newCount = N; + */ + uint8_t newCount = 8; + + void bookkeep(); + + event void SerialControl.startDone(error_t err) { + call StdControl.start(); + if(TOS_NODE_ID == 1) { + data = 0xBEEF; + dbg("TestDhvP","Updating data items\n"); + /* + call DisseminationUpdate1.change(&data); + */ + call DisseminationUpdate18.change(&data); + call DisseminationUpdate61.change(&data); + call DisseminationUpdate21.change(&data); + call DisseminationUpdate53.change(&data); + call DisseminationUpdate17.change(&data); + call DisseminationUpdate19.change(&data); + call DisseminationUpdate11.change(&data); + call DisseminationUpdate36.change(&data); + } + } + + event void SerialControl.stopDone(error_t err) { + + } + + event void Boot.booted() { + call SerialControl.start(); + dbg("TestDhvP", "Booted at %s\n", sim_time_string()); + } + /* + event void DisseminationValue1.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue1.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + */ + + event void DisseminationValue1.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue1.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue2.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue2.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue3.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue3.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue4.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue4.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue5.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue5.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue6.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue6.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue7.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue7.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue8.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue8.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue9.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue9.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue10.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue10.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue11.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue11.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue12.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue12.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue13.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue13.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue14.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue14.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue15.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue15.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue16.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue16.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue17.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue17.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue18.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue18.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue19.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue19.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue20.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue20.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue21.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue21.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue22.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue22.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue23.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue23.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue24.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue24.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue25.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue25.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue26.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue26.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue27.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue27.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue28.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue28.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue29.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue29.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue30.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue30.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue31.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue31.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue32.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue32.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue33.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue33.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue34.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue34.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue35.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue35.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue36.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue36.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue37.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue37.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue38.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue38.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue39.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue39.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue40.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue40.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue41.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue41.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue42.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue42.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue43.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue43.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue44.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue44.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue45.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue45.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue46.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue46.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue47.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue47.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue48.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue48.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue49.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue49.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue50.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue50.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue51.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue51.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue52.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue52.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue53.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue53.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue54.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue54.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue55.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue55.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue56.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue56.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue57.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue57.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue58.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue58.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue59.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue59.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue60.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue60.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue61.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue61.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue62.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue62.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue63.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue63.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue64.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue64.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + + void bookkeep() { + dhv_test_msg_t* dhvTestMsgPtr; + + if(count < newCount) { + count++; + } + dbg("TestDhvP", "Got an update, %u complete now at %s\n", count, sim_time_string()); + call Leds.led0Toggle(); + + dhvTestMsgPtr = (dhv_test_msg_t*) call SerialSend.getPayload(&testMsg, 0); + dhvTestMsgPtr->id = TOS_NODE_ID; + dhvTestMsgPtr->count = count; + dhvTestMsgPtr->isOk = okBit; + call SerialSend.send(0, &testMsg, sizeof(dhv_test_msg_t)); + + + if(newCount == count) { + dbg("TestDhvP","Dissemination COMPLETE!\n"); + call Leds.set(7); + } + + } + + event void SerialSend.sendDone(message_t* message, error_t err) { + + } +} diff --git a/apps/tests/TestDhv/TestDipP.nc b/apps/tests/TestDhv/TestDipP.nc new file mode 100644 index 00000000..f26d6520 --- /dev/null +++ b/apps/tests/TestDhv/TestDipP.nc @@ -0,0 +1,674 @@ + +module TestDipP { + uses interface Leds; + uses interface StdControl; + + /* + uses interface DisseminationUpdate as DisseminationUpdate1; + uses interface DisseminationValue as DisseminationValue1; + */ + + uses interface DisseminationUpdate as DisseminationUpdate1; + uses interface DisseminationValue as DisseminationValue1; + + uses interface DisseminationUpdate as DisseminationUpdate2; + uses interface DisseminationValue as DisseminationValue2; + + uses interface DisseminationUpdate as DisseminationUpdate3; + uses interface DisseminationValue as DisseminationValue3; + + uses interface DisseminationUpdate as DisseminationUpdate4; + uses interface DisseminationValue as DisseminationValue4; + + uses interface DisseminationUpdate as DisseminationUpdate5; + uses interface DisseminationValue as DisseminationValue5; + + uses interface DisseminationUpdate as DisseminationUpdate6; + uses interface DisseminationValue as DisseminationValue6; + + uses interface DisseminationUpdate as DisseminationUpdate7; + uses interface DisseminationValue as DisseminationValue7; + + uses interface DisseminationUpdate as DisseminationUpdate8; + uses interface DisseminationValue as DisseminationValue8; + + uses interface DisseminationUpdate as DisseminationUpdate9; + uses interface DisseminationValue as DisseminationValue9; + + uses interface DisseminationUpdate as DisseminationUpdate10; + uses interface DisseminationValue as DisseminationValue10; + + uses interface DisseminationUpdate as DisseminationUpdate11; + uses interface DisseminationValue as DisseminationValue11; + + uses interface DisseminationUpdate as DisseminationUpdate12; + uses interface DisseminationValue as DisseminationValue12; + + uses interface DisseminationUpdate as DisseminationUpdate13; + uses interface DisseminationValue as DisseminationValue13; + + uses interface DisseminationUpdate as DisseminationUpdate14; + uses interface DisseminationValue as DisseminationValue14; + + uses interface DisseminationUpdate as DisseminationUpdate15; + uses interface DisseminationValue as DisseminationValue15; + + uses interface DisseminationUpdate as DisseminationUpdate16; + uses interface DisseminationValue as DisseminationValue16; + + uses interface DisseminationUpdate as DisseminationUpdate17; + uses interface DisseminationValue as DisseminationValue17; + + uses interface DisseminationUpdate as DisseminationUpdate18; + uses interface DisseminationValue as DisseminationValue18; + + uses interface DisseminationUpdate as DisseminationUpdate19; + uses interface DisseminationValue as DisseminationValue19; + + uses interface DisseminationUpdate as DisseminationUpdate20; + uses interface DisseminationValue as DisseminationValue20; + + uses interface DisseminationUpdate as DisseminationUpdate21; + uses interface DisseminationValue as DisseminationValue21; + + uses interface DisseminationUpdate as DisseminationUpdate22; + uses interface DisseminationValue as DisseminationValue22; + + uses interface DisseminationUpdate as DisseminationUpdate23; + uses interface DisseminationValue as DisseminationValue23; + + uses interface DisseminationUpdate as DisseminationUpdate24; + uses interface DisseminationValue as DisseminationValue24; + + uses interface DisseminationUpdate as DisseminationUpdate25; + uses interface DisseminationValue as DisseminationValue25; + + uses interface DisseminationUpdate as DisseminationUpdate26; + uses interface DisseminationValue as DisseminationValue26; + + uses interface DisseminationUpdate as DisseminationUpdate27; + uses interface DisseminationValue as DisseminationValue27; + + uses interface DisseminationUpdate as DisseminationUpdate28; + uses interface DisseminationValue as DisseminationValue28; + + uses interface DisseminationUpdate as DisseminationUpdate29; + uses interface DisseminationValue as DisseminationValue29; + + uses interface DisseminationUpdate as DisseminationUpdate30; + uses interface DisseminationValue as DisseminationValue30; + + uses interface DisseminationUpdate as DisseminationUpdate31; + uses interface DisseminationValue as DisseminationValue31; + + uses interface DisseminationUpdate as DisseminationUpdate32; + uses interface DisseminationValue as DisseminationValue32; + + uses interface DisseminationUpdate as DisseminationUpdate33; + uses interface DisseminationValue as DisseminationValue33; + + uses interface DisseminationUpdate as DisseminationUpdate34; + uses interface DisseminationValue as DisseminationValue34; + + uses interface DisseminationUpdate as DisseminationUpdate35; + uses interface DisseminationValue as DisseminationValue35; + + uses interface DisseminationUpdate as DisseminationUpdate36; + uses interface DisseminationValue as DisseminationValue36; + + uses interface DisseminationUpdate as DisseminationUpdate37; + uses interface DisseminationValue as DisseminationValue37; + + uses interface DisseminationUpdate as DisseminationUpdate38; + uses interface DisseminationValue as DisseminationValue38; + + uses interface DisseminationUpdate as DisseminationUpdate39; + uses interface DisseminationValue as DisseminationValue39; + + uses interface DisseminationUpdate as DisseminationUpdate40; + uses interface DisseminationValue as DisseminationValue40; + + uses interface DisseminationUpdate as DisseminationUpdate41; + uses interface DisseminationValue as DisseminationValue41; + + uses interface DisseminationUpdate as DisseminationUpdate42; + uses interface DisseminationValue as DisseminationValue42; + + uses interface DisseminationUpdate as DisseminationUpdate43; + uses interface DisseminationValue as DisseminationValue43; + + uses interface DisseminationUpdate as DisseminationUpdate44; + uses interface DisseminationValue as DisseminationValue44; + + uses interface DisseminationUpdate as DisseminationUpdate45; + uses interface DisseminationValue as DisseminationValue45; + + uses interface DisseminationUpdate as DisseminationUpdate46; + uses interface DisseminationValue as DisseminationValue46; + + uses interface DisseminationUpdate as DisseminationUpdate47; + uses interface DisseminationValue as DisseminationValue47; + + uses interface DisseminationUpdate as DisseminationUpdate48; + uses interface DisseminationValue as DisseminationValue48; + + uses interface DisseminationUpdate as DisseminationUpdate49; + uses interface DisseminationValue as DisseminationValue49; + + uses interface DisseminationUpdate as DisseminationUpdate50; + uses interface DisseminationValue as DisseminationValue50; + + uses interface DisseminationUpdate as DisseminationUpdate51; + uses interface DisseminationValue as DisseminationValue51; + + uses interface DisseminationUpdate as DisseminationUpdate52; + uses interface DisseminationValue as DisseminationValue52; + + uses interface DisseminationUpdate as DisseminationUpdate53; + uses interface DisseminationValue as DisseminationValue53; + + uses interface DisseminationUpdate as DisseminationUpdate54; + uses interface DisseminationValue as DisseminationValue54; + + uses interface DisseminationUpdate as DisseminationUpdate55; + uses interface DisseminationValue as DisseminationValue55; + + uses interface DisseminationUpdate as DisseminationUpdate56; + uses interface DisseminationValue as DisseminationValue56; + + uses interface DisseminationUpdate as DisseminationUpdate57; + uses interface DisseminationValue as DisseminationValue57; + + uses interface DisseminationUpdate as DisseminationUpdate58; + uses interface DisseminationValue as DisseminationValue58; + + uses interface DisseminationUpdate as DisseminationUpdate59; + uses interface DisseminationValue as DisseminationValue59; + + uses interface DisseminationUpdate as DisseminationUpdate60; + uses interface DisseminationValue as DisseminationValue60; + + uses interface DisseminationUpdate as DisseminationUpdate61; + uses interface DisseminationValue as DisseminationValue61; + + uses interface DisseminationUpdate as DisseminationUpdate62; + uses interface DisseminationValue as DisseminationValue62; + + uses interface DisseminationUpdate as DisseminationUpdate63; + uses interface DisseminationValue as DisseminationValue63; + + uses interface DisseminationUpdate as DisseminationUpdate64; + uses interface DisseminationValue as DisseminationValue64; + + + uses interface Boot; + uses interface AMSend as SerialSend; + uses interface SplitControl as SerialControl; +} + +implementation { + typedef nx_struct dip_test_msg_t { + nx_am_addr_t id; + nx_uint8_t count; + nx_uint8_t isOk; + } dip_test_msg_t; + + message_t testMsg; + + uint8_t okBit = 1; + uint16_t data; + uint8_t count = 0; + /* + uint8_t newCount = N; + */ + uint8_t newCount = 8; + + void bookkeep(); + + event void SerialControl.startDone(error_t err) { + call StdControl.start(); + if(TOS_NODE_ID == 1) { + data = 0xBEEF; + dbg("TestDipP","Updating data items\n"); + /* + call DisseminationUpdate1.change(&data); + */ + call DisseminationUpdate50.change(&data); + call DisseminationUpdate25.change(&data); + call DisseminationUpdate47.change(&data); + call DisseminationUpdate7.change(&data); + call DisseminationUpdate43.change(&data); + call DisseminationUpdate58.change(&data); + call DisseminationUpdate48.change(&data); + call DisseminationUpdate45.change(&data); + } + } + + event void SerialControl.stopDone(error_t err) { + + } + + event void Boot.booted() { + call SerialControl.start(); + dbg("TestDipP", "Booted at %s\n", sim_time_string()); + } + /* + event void DisseminationValue1.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue1.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + */ + + event void DisseminationValue1.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue1.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue2.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue2.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue3.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue3.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue4.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue4.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue5.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue5.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue6.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue6.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue7.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue7.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue8.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue8.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue9.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue9.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue10.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue10.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue11.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue11.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue12.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue12.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue13.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue13.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue14.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue14.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue15.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue15.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue16.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue16.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue17.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue17.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue18.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue18.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue19.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue19.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue20.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue20.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue21.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue21.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue22.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue22.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue23.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue23.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue24.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue24.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue25.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue25.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue26.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue26.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue27.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue27.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue28.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue28.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue29.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue29.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue30.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue30.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue31.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue31.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue32.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue32.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue33.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue33.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue34.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue34.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue35.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue35.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue36.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue36.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue37.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue37.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue38.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue38.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue39.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue39.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue40.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue40.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue41.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue41.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue42.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue42.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue43.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue43.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue44.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue44.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue45.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue45.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue46.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue46.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue47.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue47.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue48.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue48.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue49.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue49.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue50.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue50.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue51.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue51.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue52.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue52.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue53.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue53.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue54.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue54.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue55.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue55.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue56.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue56.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue57.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue57.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue58.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue58.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue59.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue59.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue60.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue60.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue61.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue61.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue62.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue62.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue63.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue63.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + event void DisseminationValue64.changed() { + uint16_t val = *(uint16_t*) call DisseminationValue64.get(); + if(val != 0xBEEF) { return; } + bookkeep(); + } + + + void bookkeep() { + dip_test_msg_t* dipTestMsgPtr; + + if(count < newCount) { + count++; + } + dbg("TestDipP", "Got an update, %u complete now at %s\n", count, sim_time_string()); + call Leds.led0Toggle(); + + dipTestMsgPtr = (dip_test_msg_t*) call SerialSend.getPayload(&testMsg, 0); + dipTestMsgPtr->id = TOS_NODE_ID; + dipTestMsgPtr->count = count; + dipTestMsgPtr->isOk = okBit; + call SerialSend.send(0, &testMsg, sizeof(dip_test_msg_t)); + + + if(newCount == count) { + dbg("TestDipP","Dissemination COMPLETE!\n"); + call Leds.set(7); + } + + } + + event void SerialSend.sendDone(message_t* message, error_t err) { + + } +} diff --git a/apps/tests/TestDhv/gentest.py b/apps/tests/TestDhv/gentest.py new file mode 100644 index 00000000..ff3e2172 --- /dev/null +++ b/apps/tests/TestDhv/gentest.py @@ -0,0 +1,61 @@ +#!/usr/bin/python + +import sys +import re +import os +import random + +print "Usage: python gentest.py [numitems] [newitems]" + +items = sys.argv[1] +newitems = sys.argv[2] + +print "Generating Configurations" + +fin = open("TestDhvC-Master.nc", "r") +fout = open("TestDhvC.nc", "w") +lines = fin.readlines() +for line in lines: + if(line.find("... DISSEMINATORS") != -1): + for i in range(1, int(items)+1): + fout.write(" components new DisseminatorC(uint16_t, ") + fout.write(str(i)) + fout.write(") as Dissem" + str(i) + ";\n") + fout.write(" TestDhvP.DisseminationUpdate" + str(i)) + fout.write(" -> Dissem" + str(i) + ";\n") + fout.write(" TestDhvP.DisseminationValue" + str(i)) + fout.write(" -> Dissem" + str(i) + ";\n\n") + else: + fout.write(line) + +fin.close() +fout.close() + +print "Generating Modules" + +fin = open("TestDhvP-Master.nc", "r") +fout = open("TestDhvP.nc", "w") +lines = fin.readlines() +for line in lines: + if(line.find("... INTERFACES") != -1): + for i in range(1, int(items)+1): + fout.write(" uses interface DisseminationUpdate as DisseminationUpdate") + fout.write(str(i) + ";\n") + fout.write(" uses interface DisseminationValue as DisseminationValue") + fout.write(str(i) + ";\n\n") + elif(line.find("... NEWCOUNT") != -1): + fout.write(" uint8_t newCount = " + str(newitems) + ";\n") + elif(line.find("... CHANGES") != -1): + for i in random.sample(range(1, int(items)+1), int(newitems)): + fout.write(" call DisseminationUpdate" + str(i) + ".change(&data);\n") + elif(line.find("... EVENTS") != -1): + for i in range(1, int(items)+1): + fout.write(" event void DisseminationValue" + str(i)) + fout.write(".changed() {\n") + fout.write(" uint16_t val = *(uint16_t*) call DisseminationValue" + str(i) + ".get();\n") + fout.write(" if(val != 0xBEEF) { return; }\n") + fout.write(" bookkeep();\n") + fout.write(" }\n\n") + else: + fout.write(line) + diff --git a/apps/tests/TestDip/Makefile b/apps/tests/TestDip/Makefile index ed0305ab..1576ee72 100644 --- a/apps/tests/TestDip/Makefile +++ b/apps/tests/TestDip/Makefile @@ -5,8 +5,15 @@ CFLAGS += -I$(TOSDIR)/lib/net/dip -I$(TOSDIR)/lib/net/dip/interfaces #CFLAGS += -I$(TOSDIR)/lib/net/drip CONSTANTS += -DTOSH_DATA_LENGTH=32 +#CONSTANTS += -DDIP_JOINTEST CFLAGS += $(CONSTANTS) +# LPL FLAGS +#CFLAGS += -DLOW_POWER_LISTENING +#CFLAGS += -DLPL_DEF_LOCAL_WAKEUP=512 +#CFLAGS += -DLPL_DEF_REMOTE_WAKEUP=512 +#CFLAGS += -DDELAY_AFTER_RECEIVE=20 + CLEAN_EXTRA += DipMsg.py DipDataMsg.py DipData.py DipMsg.java DipDataMsg.java DipData.java DipMsg.class DipDataMsg.class DipData.class DipInject.class DipMsg.py: diff --git a/apps/tests/TestDip/README b/apps/tests/TestDip/README index b56aeaff..d01236a6 100644 --- a/apps/tests/TestDip/README +++ b/apps/tests/TestDip/README @@ -1,6 +1,6 @@ Title: TestDip Application -Author: Kaisen Lin +Author: Kaisen Lin (kaisenl@cs.ucsd.edu) 1. SETTING UP THE TEST @@ -70,3 +70,13 @@ approximately: 2 minutes for both nodes to receive 96 out of 96 items. With 128 items or more, MicaZ nodes don't receive anything. Memory limitation? + +6. BASESTATION + +If you are using the Basestation application to sniff what packets are +being sent in the air, you will need to adjust the packet size to match +the test application. You can add the following to your Makefile: + +CFLAGS += -DTOSH_DATA_LENGTH=XX + +where XX is your payload size diff --git a/apps/tests/TestDip/TestDipC-Master.nc b/apps/tests/TestDip/TestDipC-Master.nc index f2c673a2..45119ee7 100644 --- a/apps/tests/TestDip/TestDipC-Master.nc +++ b/apps/tests/TestDip/TestDipC-Master.nc @@ -1,4 +1,4 @@ -#include +#include "TestDip.h" configuration TestDipC { @@ -26,4 +26,7 @@ implementation { components new SerialAMSenderC(AM_TESTDIP); TestDipP.SerialSend -> SerialAMSenderC; TestDipP.SerialControl -> SerialActiveMessageC; + + components ActiveMessageC; + TestDipP.AMControl -> ActiveMessageC; } diff --git a/apps/tests/TestDip/TestDipP-Master.nc b/apps/tests/TestDip/TestDipP-Master.nc index e5404619..ec3d7beb 100644 --- a/apps/tests/TestDip/TestDipP-Master.nc +++ b/apps/tests/TestDip/TestDipP-Master.nc @@ -13,6 +13,7 @@ module TestDipP { uses interface Boot; uses interface AMSend as SerialSend; uses interface SplitControl as SerialControl; + uses interface SplitControl as AMControl; } implementation { @@ -35,8 +36,20 @@ implementation { void bookkeep(); event void SerialControl.startDone(error_t err) { + if(err != SUCCESS) { + call SerialControl.start(); + return; + } + call AMControl.start(); + } + + event void AMControl.startDone(error_t err) { + if(err != SUCCESS) { + call AMControl.start(); + return; + } call StdControl.start(); - if(TOS_NODE_ID == 0) { + if(TOS_NODE_ID == 1) { data = 0xBEEF; dbg("TestDipP","Updating data items\n"); /* @@ -46,14 +59,14 @@ implementation { } } - event void SerialControl.stopDone(error_t err) { - - } + event void SerialControl.stopDone(error_t err) { } + event void AMControl.stopDone(error_t err) { } event void Boot.booted() { call SerialControl.start(); dbg("TestDipP", "Booted at %s\n", sim_time_string()); } + /* event void DisseminationValue1.changed() { uint16_t val = *(uint16_t*) call DisseminationValue1.get(); @@ -70,7 +83,7 @@ implementation { if(count < newCount) { count++; } - dbg("TestDIPP", "Got an update, %u complete now at %s\n", count, sim_time_string()); + dbg("TestDipP", "Got an update, %u complete now at %s\n", count, sim_time_string()); call Leds.led0Toggle(); dipTestMsgPtr = (dip_test_msg_t*) call SerialSend.getPayload(&testMsg, 0); @@ -81,6 +94,7 @@ implementation { if(newCount == count) { + dbg("TestDipP","Dissemination COMPLETE!\n"); call Leds.set(7); } diff --git a/apps/tests/TestDissemination/Makefile b/apps/tests/TestDissemination/Makefile index dcb10529..a2d78af8 100644 --- a/apps/tests/TestDissemination/Makefile +++ b/apps/tests/TestDissemination/Makefile @@ -6,6 +6,8 @@ CFLAGS += -I$(TOSDIR)/lib/net -I%T/lib/net/drip ### For DIP: #CFLAGS += -I$(TOSDIR)/lib/net -I%T/lib/net/dip -I%T/lib/net/dip/interfaces +### For Dhv +#CFLAGS += -I$(TOSDIR)/lib/net -I%T/lib/net/dhv -I%T/lib/net/dhv/interfaces include $(MAKERULES) diff --git a/apps/tests/TestEui/Makefile b/apps/tests/TestEui/Makefile new file mode 100644 index 00000000..174baa21 --- /dev/null +++ b/apps/tests/TestEui/Makefile @@ -0,0 +1,4 @@ +COMPONENT=TestEuiAppC +CFLAGS += -I$(TOSDIR)/lib/printf +include $(MAKERULES) + diff --git a/apps/tests/TestEui/README.txt b/apps/tests/TestEui/README.txt new file mode 100644 index 00000000..d918ef05 --- /dev/null +++ b/apps/tests/TestEui/README.txt @@ -0,0 +1,23 @@ +$Id$ + +README for TestEui +Author/Contact: tinyos-help@millennium.berkeley.edu + +Description: + +The TestEui application prints out the IEEE EUI64 of the device periodically +using printf. Currently supported platforms: iris. + +Tools: + +net.tinyos.tools.PrintfClient is a Java application that displays the output on +the PC. + +Usage: + +java net.tinyos.tools.PrintfClient -comm serial@: + +Known bugs/limitations: + +None. + \ No newline at end of file diff --git a/apps/tests/TestEui/TestEuiAppC.nc b/apps/tests/TestEui/TestEuiAppC.nc new file mode 100644 index 00000000..5dba893a --- /dev/null +++ b/apps/tests/TestEui/TestEuiAppC.nc @@ -0,0 +1,43 @@ +// $Id$ +/* + * Copyright (c) 2007, Vanderbilt University + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT + * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Author: Janos Sallai + */ + +#include "printf.h" + +/** + * This application reads the 64-bit EUI of the device at initialization time + * and then periodically prints it out using printf. + * + */ +configuration TestEuiAppC{} +implementation { + components MainC, TestEuiC, LedsC, LocalIeeeEui64C, new TimerMilliC(); + + MainC.Boot <- TestEuiC; + TestEuiC.Timer -> TimerMilliC; + + TestEuiC -> LedsC.Leds; + + TestEuiC.LocalIeeeEui64 -> LocalIeeeEui64C; +} + diff --git a/apps/tests/TestEui/TestEuiC.nc b/apps/tests/TestEui/TestEuiC.nc new file mode 100644 index 00000000..79c0bed6 --- /dev/null +++ b/apps/tests/TestEui/TestEuiC.nc @@ -0,0 +1,63 @@ +// $Id$ +/* + * Copyright (c) 2007, Vanderbilt University + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT + * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Author: Janos Sallai + */ + +/** + * This application reads the 64-bit EUI of the device at initialization time + * and then periodically, and prints it out using printf. + * + */ +module TestEuiC +{ + uses interface Boot; + uses interface Timer; + uses interface Leds; + uses interface LocalIeeeEui64; +} +implementation +{ + void print() { + } + + event void Boot.booted() { + call Timer.startPeriodic(1000); + } + + event void Timer.fired() { + int i; + ieee_eui64_t id; + + call Leds.led0Toggle(); + + id = call LocalIeeeEui64.getId(); + + printf("IEEE 64-bit UID: "); + for(i=0;i<8;i++) { + printf("%d ", id.data[i]); + } + printf("\n"); + printfflush(); + + } +} + diff --git a/apps/tests/TestFtsp/FtspDataAnalyzer.m b/apps/tests/TestFtsp/Ftsp/FtspDataAnalyzer.m old mode 100644 new mode 100755 similarity index 100% rename from apps/tests/TestFtsp/FtspDataAnalyzer.m rename to apps/tests/TestFtsp/Ftsp/FtspDataAnalyzer.m diff --git a/apps/tests/TestFtsp/FtspDataLogger.java b/apps/tests/TestFtsp/Ftsp/FtspDataLogger.java old mode 100644 new mode 100755 similarity index 100% rename from apps/tests/TestFtsp/FtspDataLogger.java rename to apps/tests/TestFtsp/Ftsp/FtspDataLogger.java diff --git a/apps/tests/TestFtsp/Ftsp/FtspDataLogger.py b/apps/tests/TestFtsp/Ftsp/FtspDataLogger.py new file mode 100755 index 00000000..0c5687b4 --- /dev/null +++ b/apps/tests/TestFtsp/Ftsp/FtspDataLogger.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +import sys, time +import tos + +AM_TEST_FTSP_MSG = 137 + +class FtspMsg(tos.Packet): + def __init__(self, packet = None): + tos.Packet.__init__(self, + [('src_addr', 'int', 2), + ('counter', 'int', 2), + ('local_rx_timestamp', 'int', 4), + ('global_rx_timestamp', 'int', 4), + ('skew_times_1000000', 'int', 4), + ('is_synced', 'int', 1), + ('ftsp_root_addr', 'int', 2), + ('ftsp_seq', 'int', 1), + ('ftsp_table_entries', 'int', 2)], + packet) + +if '-h' in sys.argv: + print "Usage:", sys.argv[0], "serial@/dev/ttyUSB0:57600" + sys.exit() + +am = tos.AM() + +while True: + p = am.read() + if p and p.type == AM_TEST_FTSP_MSG: + msg = FtspMsg(p.data) + print int(time.time()), msg.src_addr, msg.counter, msg.global_rx_timestamp, msg.is_synced + #print msg diff --git a/apps/tests/TestFtsp/Makefile b/apps/tests/TestFtsp/Ftsp/Makefile old mode 100644 new mode 100755 similarity index 100% rename from apps/tests/TestFtsp/Makefile rename to apps/tests/TestFtsp/Ftsp/Makefile diff --git a/apps/tests/TestFtsp/Ftsp/README.MATLAB.txt b/apps/tests/TestFtsp/Ftsp/README.MATLAB.txt new file mode 100755 index 00000000..0535549a --- /dev/null +++ b/apps/tests/TestFtsp/Ftsp/README.MATLAB.txt @@ -0,0 +1,46 @@ +FtspDataAnalyzer.m + +------------------------------------------------------------------------------- +Author/Contact: +--------------- + Brano Kusy: branislav.kusy@gmail.com + +------------------------------------------------------------------------------- +DESCRIPTION: +------------ + +FtspDataAnalyzer.m works with data logs collected by FtspDataLogger.java and +calculates the maximum and average timesync error over time. + +------------------------------------------------------------------------------- +STEP BY STEP GUIDE TO RUN OUR TEST SCENARIO: +-------------------------------------------- +1. program and start motes as described in ./README.txt +2. start SerialForwarder and FtspDataLogger.java as described in ./README.txt +3. 'current_time.report' file (where current_time is a number) is created in ./ + this file is updated with data in the real time +4. let the experiment run for some time +5. start matlab and enter (assuming your current_time was 1206126224593) + FTSPDataAnalyzer('1206126224593.report') + this will plot the mean absolute timesync error, global time, and number of + synced motes; this can be done while experiment is running +6. Matlab also creates data.out file which contains data in the following format + #seqNum mean_abs_error global_time num_synced_motes + mean_abs_error is calculated as mean absolute deviation from the mean (mad) + +Simulating multi-hop: +1. define TIMESYNC_DEBUG in the Makefile +2. recompile and upload TestFTSP app to n motes with special NODE_IDs: + using 'make micaz reinstall.0xAB', nodes 0xAB and 0xCD can communicate + iff 2D grid coordinates (A,B) and (C,D) are neighbors in a 2D grid + +------------------------------------------------------------------------------- +EVALUATION: +-------------------------------------------- + - deployment setup: 11 nodes in a 5x3 grid using simulated multi-hop (4 points + were vacant as we only used 11 nodes). the max number of hops was 5. + - parameters: sync period 10sec, polling period 3 sec + - experiment length: 100 minutes + - results (1 jiffy is ~30.5 us) + 1.53 jiffy avg error (~50us) + 3.5 jiffy max error (~100us) \ No newline at end of file diff --git a/apps/tests/TestFtsp/README.txt b/apps/tests/TestFtsp/Ftsp/README.txt old mode 100644 new mode 100755 similarity index 100% rename from apps/tests/TestFtsp/README.txt rename to apps/tests/TestFtsp/Ftsp/README.txt diff --git a/apps/tests/TestFtsp/TestFtsp.h b/apps/tests/TestFtsp/Ftsp/TestFtsp.h old mode 100644 new mode 100755 similarity index 97% rename from apps/tests/TestFtsp/TestFtsp.h rename to apps/tests/TestFtsp/Ftsp/TestFtsp.h index c5ded365..cc241ab6 --- a/apps/tests/TestFtsp/TestFtsp.h +++ b/apps/tests/TestFtsp/Ftsp/TestFtsp.h @@ -31,7 +31,7 @@ typedef nx_struct test_ftsp_msg nx_uint16_t counter; nx_uint32_t local_rx_timestamp; nx_uint32_t global_rx_timestamp; - nx_uint32_t skew_times_1000000; + nx_int32_t skew_times_1000000; nx_uint8_t is_synced; nx_uint16_t ftsp_root_addr; nx_uint8_t ftsp_seq; diff --git a/apps/tests/TestFtsp/TestFtspAppC.nc b/apps/tests/TestFtsp/Ftsp/TestFtspAppC.nc old mode 100644 new mode 100755 similarity index 100% rename from apps/tests/TestFtsp/TestFtspAppC.nc rename to apps/tests/TestFtsp/Ftsp/TestFtspAppC.nc diff --git a/apps/tests/TestFtsp/TestFtspC.nc b/apps/tests/TestFtsp/Ftsp/TestFtspC.nc old mode 100644 new mode 100755 similarity index 100% rename from apps/tests/TestFtsp/TestFtspC.nc rename to apps/tests/TestFtsp/Ftsp/TestFtspC.nc diff --git a/apps/tests/TestFtsp/FtspLpl/FtspDataLogger.py b/apps/tests/TestFtsp/FtspLpl/FtspDataLogger.py new file mode 100755 index 00000000..0c5687b4 --- /dev/null +++ b/apps/tests/TestFtsp/FtspLpl/FtspDataLogger.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +import sys, time +import tos + +AM_TEST_FTSP_MSG = 137 + +class FtspMsg(tos.Packet): + def __init__(self, packet = None): + tos.Packet.__init__(self, + [('src_addr', 'int', 2), + ('counter', 'int', 2), + ('local_rx_timestamp', 'int', 4), + ('global_rx_timestamp', 'int', 4), + ('skew_times_1000000', 'int', 4), + ('is_synced', 'int', 1), + ('ftsp_root_addr', 'int', 2), + ('ftsp_seq', 'int', 1), + ('ftsp_table_entries', 'int', 2)], + packet) + +if '-h' in sys.argv: + print "Usage:", sys.argv[0], "serial@/dev/ttyUSB0:57600" + sys.exit() + +am = tos.AM() + +while True: + p = am.read() + if p and p.type == AM_TEST_FTSP_MSG: + msg = FtspMsg(p.data) + print int(time.time()), msg.src_addr, msg.counter, msg.global_rx_timestamp, msg.is_synced + #print msg diff --git a/apps/tests/TestFtsp/FtspLpl/Makefile b/apps/tests/TestFtsp/FtspLpl/Makefile new file mode 100755 index 00000000..99629881 --- /dev/null +++ b/apps/tests/TestFtsp/FtspLpl/Makefile @@ -0,0 +1,16 @@ +SENSORBOARD=quantoplus + +COMPONENT=TestFtspAppC + +PFLAGS += -DTIMESYNC_RATE=10 +#PFLAGS += -DTIMESYNC_DEBUG +#PFLAGS += -DCC2420_CHANNEL=26 +CFLAGS += -DTOSH_DATA_LENGTH=50 +#CFLAGS += -DCOUNT_LOG + +PFLAGS += -I$(TOSDIR)/lib/ftsp -I$(TOSDIR)/../apps/RadioCountToLeds -I$(TOSDIR)/lib/printf + +CFLAGS += -DLPL_INTERVAL=200 +CFLAGS += -DLOW_POWER_LISTENING + +include $(MAKERULES) diff --git a/apps/tests/TestFtsp/FtspLpl/README b/apps/tests/TestFtsp/FtspLpl/README new file mode 100755 index 00000000..24c080c7 --- /dev/null +++ b/apps/tests/TestFtsp/FtspLpl/README @@ -0,0 +1,31 @@ +First, program several nodes with this TestFtsp application. In addition, +you will need one TinyOS Basestation that listens for messages, and one +beacon node. Program the beacon node with the RadioCountToLed application +from the TestFtsp32kLplBeaconer directory. This is a special modification of +the RadioCountToLed code which allows to evaluate a duty-cycled ftsp +network. The regular RadioCountToLed code doesn't work, since a LPL +broadcast message gets transmitted more than just once. Thus, there is a +disambiguity in which precise broadcast message was actually timestamped by +the TestFtsp application. The modifications take care of this by using the +TimeSyncAMSend interface and setting an arbitrary event time. Thus, on +reception, the TestFtsp code can account for this delayed send. + +To evaluate the synchronization precision, use the FtspDataLogger.py +application. First, you will need a serial forwarder that connects to the +BaseStation node. Then, run the python application like this: +python FtspDataLogger.py sf@localhost:9002 + +You should now see messages coming in, one per line. The first value is the +current time as a unix timestamp. The last line is a binary value indicating +if there was some missed data, and thus the values are not good (indicated +by a 1), or if all the nodes are synchronized and we received a value for +each and every one of them (indicated by a 0). + +Note!!!!! +- the basestation should also define + CFLAGS += -DTOSH_DATA_LENGTH=50 + in the makefile. Else, the reports will not fit into 1 tinyos message, and + they will get silently dropped. +- 32k timesync only works for certain platforms (those that provide 32khz + counter), if your platform does not support the counter, LPL still works, + but you need to use TMilli timesync diff --git a/apps/tests/TestFtsp/FtspLpl/TestFtsp.h b/apps/tests/TestFtsp/FtspLpl/TestFtsp.h new file mode 100755 index 00000000..57cd25cf --- /dev/null +++ b/apps/tests/TestFtsp/FtspLpl/TestFtsp.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2002, Vanderbilt University + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT + * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * @author: Miklos Maroti, Brano Kusy (kusy@isis.vanderbilt.edu) + * Ported to T2: 3/17/08 by Brano Kusy (branislav.kusy@gmail.com) + */ + +#ifndef TEST_FTSP_H +#define TEST_FTSP_H + +typedef nx_struct test_ftsp_msg +{ + nx_uint16_t src_addr; + nx_uint16_t counter; + nx_uint32_t local_rx_timestamp; + nx_uint32_t global_rx_timestamp; + nx_int32_t skew_times_1000000; + nx_float skew; + nx_uint8_t is_synced; + nx_uint16_t ftsp_root_addr; + nx_uint8_t ftsp_seq; + nx_uint8_t ftsp_table_entries; + nx_uint32_t localAverage; + nx_int32_t offsetAverage; +} test_ftsp_msg_t; + +enum +{ + AM_TEST_FTSP_MSG = 137 +}; + +#endif diff --git a/apps/tests/TestFtsp/FtspLpl/TestFtspAppC.nc b/apps/tests/TestFtsp/FtspLpl/TestFtspAppC.nc new file mode 100755 index 00000000..1d526256 --- /dev/null +++ b/apps/tests/TestFtsp/FtspLpl/TestFtspAppC.nc @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2002, Vanderbilt University + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT + * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * @author: Miklos Maroti, Brano Kusy (kusy@isis.vanderbilt.edu) + * Ported to T2: 3/17/08 by Brano Kusy (branislav.kusy@gmail.com) + * Adapted for LPL: 6/16/09 by Thomas Schmid (thomas.schmid@ucla.edu) + */ + +#include "TestFtsp.h" +#include "RadioCountToLeds.h" + +configuration TestFtspAppC { +} + +implementation { + components MainC, TestFtspC as App; + App.Boot -> MainC; + + components ActiveMessageC; + components TimeSyncMessageC; + App.RadioControl -> ActiveMessageC; + App.Receive -> TimeSyncMessageC.Receive[AM_RADIO_COUNT_MSG]; + App.TimeSyncPacket -> TimeSyncMessageC; + App.AMSend -> ActiveMessageC.AMSend[AM_TEST_FTSP_MSG]; + App.Packet -> ActiveMessageC; + App.PacketTimeStamp -> ActiveMessageC; + App.LowPowerListening -> ActiveMessageC; + + + components RandomC; + App.Random -> RandomC; + + components new TimerMilliC() as Timer0; + App.RandomTimer -> Timer0; + + components LedsC; + +#if defined(PLATFORM_MICAZ) || defined(PLATFORM_TELOSB) + components TimeSync32kC; + MainC.SoftwareInit -> TimeSync32kC; + TimeSync32kC.Boot -> MainC; + App.GlobalTime -> TimeSync32kC; + App.TimeSyncInfo -> TimeSync32kC; +#else +#error "LPL timesync is not available for your platform" +#endif + App.Leds -> LedsC; + +} diff --git a/apps/tests/TestFtsp/FtspLpl/TestFtspC.nc b/apps/tests/TestFtsp/FtspLpl/TestFtspC.nc new file mode 100755 index 00000000..58b58ee3 --- /dev/null +++ b/apps/tests/TestFtsp/FtspLpl/TestFtspC.nc @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2002, Vanderbilt University + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT + * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * @author: Miklos Maroti, Brano Kusy (kusy@isis.vanderbilt.edu) + * Ported to T2: 3/17/08 by Brano Kusy (branislav.kusy@gmail.com) + * Ported for LPL: Thomas Schmid (thomas.schmid@ucla.edu) + */ + +#include "TestFtsp.h" +#include "RadioCountToLeds.h" + +module TestFtspC +{ + uses + { + interface GlobalTime; + interface TimeSyncInfo; + interface Receive; + interface AMSend; + interface Packet; + interface Leds; + interface PacketTimeStamp; + interface Boot; + interface SplitControl as RadioControl; + interface Timer as RandomTimer; + interface Random; + + interface TimeSyncPacket; + + interface LowPowerListening; + + } +} + +implementation +{ + enum { + ACT_TESTFTSP = 0x11, + }; + + message_t msg; + bool locked = FALSE; + test_ftsp_msg_t* report; + + event void Boot.booted() { + call RadioControl.start(); + } + + event message_t* Receive.receive(message_t* msgPtr, void* payload, uint8_t len) + { + if (!(call PacketTimeStamp.isValid(msgPtr))){ + call Leds.led1Toggle(); + } + if (!locked && call PacketTimeStamp.isValid(msgPtr)) { + radio_count_msg_t* rcm = (radio_count_msg_t*)call Packet.getPayload(msgPtr, sizeof(radio_count_msg_t)); + if(call TimeSyncPacket.isValid(msgPtr)) { + uint32_t rxTimestamp = call TimeSyncPacket.eventTime(msgPtr); + report = (test_ftsp_msg_t*)call Packet.getPayload(&msg, sizeof(test_ftsp_msg_t)); + + report->src_addr = TOS_NODE_ID; + report->counter = rcm->counter; + report->local_rx_timestamp = rxTimestamp; + report->is_synced = call GlobalTime.local2Global(&rxTimestamp); + report->global_rx_timestamp = rxTimestamp; + report->skew_times_1000000 = (uint32_t)call TimeSyncInfo.getSkew()*1000000UL; + report->skew = call TimeSyncInfo.getSkew(); + report->ftsp_root_addr = call TimeSyncInfo.getRootID(); + report->ftsp_seq = call TimeSyncInfo.getSeqNum(); + report->ftsp_table_entries = call TimeSyncInfo.getNumEntries(); + report->localAverage = call TimeSyncInfo.getSyncPoint(); + report->offsetAverage = call TimeSyncInfo.getOffset(); + + locked = TRUE; + call RandomTimer.startOneShot(call Random.rand16() % (64)); + } + } + + return msgPtr; + } + + event void RandomTimer.fired() + { +#ifdef LOW_POWER_LISTENING + call LowPowerListening.setRemoteWakeupInterval(&msg, LPL_INTERVAL); +#endif + if(locked && (call AMSend.send(4000, &msg, sizeof(test_ftsp_msg_t)) == SUCCESS)){ + call Leds.led2On(); + } else { + locked = FALSE; + } + } + + event void AMSend.sendDone(message_t* ptr, error_t success) { + locked = FALSE; + call Leds.led2Off(); + return; + } + + event void RadioControl.startDone(error_t err) { + call LowPowerListening.setLocalWakeupInterval(LPL_INTERVAL); + } + event void RadioControl.stopDone(error_t error){} +} diff --git a/apps/tests/TestFtsp/FtspLpl/TestFtspMsg.py b/apps/tests/TestFtsp/FtspLpl/TestFtspMsg.py new file mode 100755 index 00000000..0223c4d3 --- /dev/null +++ b/apps/tests/TestFtsp/FtspLpl/TestFtspMsg.py @@ -0,0 +1,744 @@ +# +# This class is automatically generated by mig. DO NOT EDIT THIS FILE. +# This class implements a Python interface to the 'TestFtspMsg' +# message type. +# + +import tinyos.message.Message + +# The default size of this message type in bytes. +DEFAULT_MESSAGE_SIZE = 33 + +# The Active Message type associated with this message. +AM_TYPE = 137 + +class TestFtspMsg(tinyos.message.Message.Message): + # Create a new TestFtspMsg of size 33. + def __init__(self, data="", addr=None, gid=None, base_offset=0, data_length=33): + tinyos.message.Message.Message.__init__(self, data, addr, gid, base_offset, data_length) + self.amTypeSet(AM_TYPE) + + # Get AM_TYPE + def get_amType(cls): + return AM_TYPE + + get_amType = classmethod(get_amType) + + # + # Return a String representation of this message. Includes the + # message type name and the non-indexed field values. + # + def __str__(self): + s = "Message \n" + try: + s += " [src_addr=0x%x]\n" % (self.get_src_addr()) + except: + pass + try: + s += " [counter=0x%x]\n" % (self.get_counter()) + except: + pass + try: + s += " [local_rx_timestamp=0x%x]\n" % (self.get_local_rx_timestamp()) + except: + pass + try: + s += " [global_rx_timestamp=0x%x]\n" % (self.get_global_rx_timestamp()) + except: + pass + try: + s += " [skew_times_1000000=0x%x]\n" % (self.get_skew_times_1000000()) + except: + pass + try: + s += " [skew=0x%x]\n" % (self.get_skew()) + except: + pass + try: + s += " [is_synced=0x%x]\n" % (self.get_is_synced()) + except: + pass + try: + s += " [ftsp_root_addr=0x%x]\n" % (self.get_ftsp_root_addr()) + except: + pass + try: + s += " [ftsp_seq=0x%x]\n" % (self.get_ftsp_seq()) + except: + pass + try: + s += " [ftsp_table_entries=0x%x]\n" % (self.get_ftsp_table_entries()) + except: + pass + try: + s += " [localAverage=0x%x]\n" % (self.get_localAverage()) + except: + pass + try: + s += " [offsetAverage=0x%x]\n" % (self.get_offsetAverage()) + except: + pass + return s + + # Message-type-specific access methods appear below. + + # + # Accessor methods for field: src_addr + # Field type: int + # Offset (bits): 0 + # Size (bits): 16 + # + + # + # Return whether the field 'src_addr' is signed (False). + # + def isSigned_src_addr(self): + return False + + # + # Return whether the field 'src_addr' is an array (False). + # + def isArray_src_addr(self): + return False + + # + # Return the offset (in bytes) of the field 'src_addr' + # + def offset_src_addr(self): + return (0 / 8) + + # + # Return the offset (in bits) of the field 'src_addr' + # + def offsetBits_src_addr(self): + return 0 + + # + # Return the value (as a int) of the field 'src_addr' + # + def get_src_addr(self): + return self.getUIntElement(self.offsetBits_src_addr(), 16, 1) + + # + # Set the value of the field 'src_addr' + # + def set_src_addr(self, value): + self.setUIntElement(self.offsetBits_src_addr(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'src_addr' + # + def size_src_addr(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'src_addr' + # + def sizeBits_src_addr(self): + return 16 + + # + # Accessor methods for field: counter + # Field type: int + # Offset (bits): 16 + # Size (bits): 16 + # + + # + # Return whether the field 'counter' is signed (False). + # + def isSigned_counter(self): + return False + + # + # Return whether the field 'counter' is an array (False). + # + def isArray_counter(self): + return False + + # + # Return the offset (in bytes) of the field 'counter' + # + def offset_counter(self): + return (16 / 8) + + # + # Return the offset (in bits) of the field 'counter' + # + def offsetBits_counter(self): + return 16 + + # + # Return the value (as a int) of the field 'counter' + # + def get_counter(self): + return self.getUIntElement(self.offsetBits_counter(), 16, 1) + + # + # Set the value of the field 'counter' + # + def set_counter(self, value): + self.setUIntElement(self.offsetBits_counter(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'counter' + # + def size_counter(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'counter' + # + def sizeBits_counter(self): + return 16 + + # + # Accessor methods for field: local_rx_timestamp + # Field type: long + # Offset (bits): 32 + # Size (bits): 32 + # + + # + # Return whether the field 'local_rx_timestamp' is signed (False). + # + def isSigned_local_rx_timestamp(self): + return False + + # + # Return whether the field 'local_rx_timestamp' is an array (False). + # + def isArray_local_rx_timestamp(self): + return False + + # + # Return the offset (in bytes) of the field 'local_rx_timestamp' + # + def offset_local_rx_timestamp(self): + return (32 / 8) + + # + # Return the offset (in bits) of the field 'local_rx_timestamp' + # + def offsetBits_local_rx_timestamp(self): + return 32 + + # + # Return the value (as a long) of the field 'local_rx_timestamp' + # + def get_local_rx_timestamp(self): + return self.getUIntElement(self.offsetBits_local_rx_timestamp(), 32, 1) + + # + # Set the value of the field 'local_rx_timestamp' + # + def set_local_rx_timestamp(self, value): + self.setUIntElement(self.offsetBits_local_rx_timestamp(), 32, value, 1) + + # + # Return the size, in bytes, of the field 'local_rx_timestamp' + # + def size_local_rx_timestamp(self): + return (32 / 8) + + # + # Return the size, in bits, of the field 'local_rx_timestamp' + # + def sizeBits_local_rx_timestamp(self): + return 32 + + # + # Accessor methods for field: global_rx_timestamp + # Field type: long + # Offset (bits): 64 + # Size (bits): 32 + # + + # + # Return whether the field 'global_rx_timestamp' is signed (False). + # + def isSigned_global_rx_timestamp(self): + return False + + # + # Return whether the field 'global_rx_timestamp' is an array (False). + # + def isArray_global_rx_timestamp(self): + return False + + # + # Return the offset (in bytes) of the field 'global_rx_timestamp' + # + def offset_global_rx_timestamp(self): + return (64 / 8) + + # + # Return the offset (in bits) of the field 'global_rx_timestamp' + # + def offsetBits_global_rx_timestamp(self): + return 64 + + # + # Return the value (as a long) of the field 'global_rx_timestamp' + # + def get_global_rx_timestamp(self): + return self.getUIntElement(self.offsetBits_global_rx_timestamp(), 32, 1) + + # + # Set the value of the field 'global_rx_timestamp' + # + def set_global_rx_timestamp(self, value): + self.setUIntElement(self.offsetBits_global_rx_timestamp(), 32, value, 1) + + # + # Return the size, in bytes, of the field 'global_rx_timestamp' + # + def size_global_rx_timestamp(self): + return (32 / 8) + + # + # Return the size, in bits, of the field 'global_rx_timestamp' + # + def sizeBits_global_rx_timestamp(self): + return 32 + + # + # Accessor methods for field: skew_times_1000000 + # Field type: int + # Offset (bits): 96 + # Size (bits): 32 + # + + # + # Return whether the field 'skew_times_1000000' is signed (False). + # + def isSigned_skew_times_1000000(self): + return False + + # + # Return whether the field 'skew_times_1000000' is an array (False). + # + def isArray_skew_times_1000000(self): + return False + + # + # Return the offset (in bytes) of the field 'skew_times_1000000' + # + def offset_skew_times_1000000(self): + return (96 / 8) + + # + # Return the offset (in bits) of the field 'skew_times_1000000' + # + def offsetBits_skew_times_1000000(self): + return 96 + + # + # Return the value (as a int) of the field 'skew_times_1000000' + # + def get_skew_times_1000000(self): + return self.getSIntElement(self.offsetBits_skew_times_1000000(), 32, 1) + + # + # Set the value of the field 'skew_times_1000000' + # + def set_skew_times_1000000(self, value): + self.setSIntElement(self.offsetBits_skew_times_1000000(), 32, value, 1) + + # + # Return the size, in bytes, of the field 'skew_times_1000000' + # + def size_skew_times_1000000(self): + return (32 / 8) + + # + # Return the size, in bits, of the field 'skew_times_1000000' + # + def sizeBits_skew_times_1000000(self): + return 32 + + # + # Accessor methods for field: skew + # Field type: int + # Offset (bits): 128 + # Size (bits): 32 + # + + # + # Return whether the field 'skew' is signed (False). + # + def isSigned_skew(self): + return False + + # + # Return whether the field 'skew' is an array (False). + # + def isArray_skew(self): + return False + + # + # Return the offset (in bytes) of the field 'skew' + # + def offset_skew(self): + return (128 / 8) + + # + # Return the offset (in bits) of the field 'skew' + # + def offsetBits_skew(self): + return 128 + + # + # Return the value (as a int) of the field 'skew' + # + def get_skew(self): + return self.getFloatElement(self.offsetBits_skew(), 32, 0) + + # + # Set the value of the field 'skew' + # + def set_skew(self, value): + self.setSIntElement(self.offsetBits_skew(), 32, value, 1) + + # + # Return the size, in bytes, of the field 'skew' + # + def size_skew(self): + return (32 / 8) + + # + # Return the size, in bits, of the field 'skew' + # + def sizeBits_skew(self): + return 32 + + # + # Accessor methods for field: is_synced + # Field type: short + # Offset (bits): 160 + # Size (bits): 8 + # + + # + # Return whether the field 'is_synced' is signed (False). + # + def isSigned_is_synced(self): + return False + + # + # Return whether the field 'is_synced' is an array (False). + # + def isArray_is_synced(self): + return False + + # + # Return the offset (in bytes) of the field 'is_synced' + # + def offset_is_synced(self): + return (160 / 8) + + # + # Return the offset (in bits) of the field 'is_synced' + # + def offsetBits_is_synced(self): + return 160 + + # + # Return the value (as a short) of the field 'is_synced' + # + def get_is_synced(self): + return self.getUIntElement(self.offsetBits_is_synced(), 8, 1) + + # + # Set the value of the field 'is_synced' + # + def set_is_synced(self, value): + self.setUIntElement(self.offsetBits_is_synced(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'is_synced' + # + def size_is_synced(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'is_synced' + # + def sizeBits_is_synced(self): + return 8 + + # + # Accessor methods for field: ftsp_root_addr + # Field type: int + # Offset (bits): 168 + # Size (bits): 16 + # + + # + # Return whether the field 'ftsp_root_addr' is signed (False). + # + def isSigned_ftsp_root_addr(self): + return False + + # + # Return whether the field 'ftsp_root_addr' is an array (False). + # + def isArray_ftsp_root_addr(self): + return False + + # + # Return the offset (in bytes) of the field 'ftsp_root_addr' + # + def offset_ftsp_root_addr(self): + return (168 / 8) + + # + # Return the offset (in bits) of the field 'ftsp_root_addr' + # + def offsetBits_ftsp_root_addr(self): + return 168 + + # + # Return the value (as a int) of the field 'ftsp_root_addr' + # + def get_ftsp_root_addr(self): + return self.getUIntElement(self.offsetBits_ftsp_root_addr(), 16, 1) + + # + # Set the value of the field 'ftsp_root_addr' + # + def set_ftsp_root_addr(self, value): + self.setUIntElement(self.offsetBits_ftsp_root_addr(), 16, value, 1) + + # + # Return the size, in bytes, of the field 'ftsp_root_addr' + # + def size_ftsp_root_addr(self): + return (16 / 8) + + # + # Return the size, in bits, of the field 'ftsp_root_addr' + # + def sizeBits_ftsp_root_addr(self): + return 16 + + # + # Accessor methods for field: ftsp_seq + # Field type: short + # Offset (bits): 184 + # Size (bits): 8 + # + + # + # Return whether the field 'ftsp_seq' is signed (False). + # + def isSigned_ftsp_seq(self): + return False + + # + # Return whether the field 'ftsp_seq' is an array (False). + # + def isArray_ftsp_seq(self): + return False + + # + # Return the offset (in bytes) of the field 'ftsp_seq' + # + def offset_ftsp_seq(self): + return (184 / 8) + + # + # Return the offset (in bits) of the field 'ftsp_seq' + # + def offsetBits_ftsp_seq(self): + return 184 + + # + # Return the value (as a short) of the field 'ftsp_seq' + # + def get_ftsp_seq(self): + return self.getUIntElement(self.offsetBits_ftsp_seq(), 8, 1) + + # + # Set the value of the field 'ftsp_seq' + # + def set_ftsp_seq(self, value): + self.setUIntElement(self.offsetBits_ftsp_seq(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ftsp_seq' + # + def size_ftsp_seq(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ftsp_seq' + # + def sizeBits_ftsp_seq(self): + return 8 + + # + # Accessor methods for field: ftsp_table_entries + # Field type: short + # Offset (bits): 192 + # Size (bits): 8 + # + + # + # Return whether the field 'ftsp_table_entries' is signed (False). + # + def isSigned_ftsp_table_entries(self): + return False + + # + # Return whether the field 'ftsp_table_entries' is an array (False). + # + def isArray_ftsp_table_entries(self): + return False + + # + # Return the offset (in bytes) of the field 'ftsp_table_entries' + # + def offset_ftsp_table_entries(self): + return (192 / 8) + + # + # Return the offset (in bits) of the field 'ftsp_table_entries' + # + def offsetBits_ftsp_table_entries(self): + return 192 + + # + # Return the value (as a short) of the field 'ftsp_table_entries' + # + def get_ftsp_table_entries(self): + return self.getUIntElement(self.offsetBits_ftsp_table_entries(), 8, 1) + + # + # Set the value of the field 'ftsp_table_entries' + # + def set_ftsp_table_entries(self, value): + self.setUIntElement(self.offsetBits_ftsp_table_entries(), 8, value, 1) + + # + # Return the size, in bytes, of the field 'ftsp_table_entries' + # + def size_ftsp_table_entries(self): + return (8 / 8) + + # + # Return the size, in bits, of the field 'ftsp_table_entries' + # + def sizeBits_ftsp_table_entries(self): + return 8 + + # + # Accessor methods for field: localAverage + # Field type: long + # Offset (bits): 200 + # Size (bits): 32 + # + + # + # Return whether the field 'localAverage' is signed (False). + # + def isSigned_localAverage(self): + return False + + # + # Return whether the field 'localAverage' is an array (False). + # + def isArray_localAverage(self): + return False + + # + # Return the offset (in bytes) of the field 'localAverage' + # + def offset_localAverage(self): + return (200 / 8) + + # + # Return the offset (in bits) of the field 'localAverage' + # + def offsetBits_localAverage(self): + return 200 + + # + # Return the value (as a long) of the field 'localAverage' + # + def get_localAverage(self): + return self.getUIntElement(self.offsetBits_localAverage(), 32, 1) + + # + # Set the value of the field 'localAverage' + # + def set_localAverage(self, value): + self.setUIntElement(self.offsetBits_localAverage(), 32, value, 1) + + # + # Return the size, in bytes, of the field 'localAverage' + # + def size_localAverage(self): + return (32 / 8) + + # + # Return the size, in bits, of the field 'localAverage' + # + def sizeBits_localAverage(self): + return 32 + + # + # Accessor methods for field: offsetAverage + # Field type: int + # Offset (bits): 232 + # Size (bits): 32 + # + + # + # Return whether the field 'offsetAverage' is signed (False). + # + def isSigned_offsetAverage(self): + return False + + # + # Return whether the field 'offsetAverage' is an array (False). + # + def isArray_offsetAverage(self): + return False + + # + # Return the offset (in bytes) of the field 'offsetAverage' + # + def offset_offsetAverage(self): + return (232 / 8) + + # + # Return the offset (in bits) of the field 'offsetAverage' + # + def offsetBits_offsetAverage(self): + return 232 + + # + # Return the value (as a int) of the field 'offsetAverage' + # + def get_offsetAverage(self): + return self.getSIntElement(self.offsetBits_offsetAverage(), 32, 1) + + # + # Set the value of the field 'offsetAverage' + # + def set_offsetAverage(self, value): + self.setSIntElement(self.offsetBits_offsetAverage(), 32, value, 1) + + # + # Return the size, in bytes, of the field 'offsetAverage' + # + def size_offsetAverage(self): + return (32 / 8) + + # + # Return the size, in bits, of the field 'offsetAverage' + # + def sizeBits_offsetAverage(self): + return 32 + diff --git a/apps/tests/TestFtsp/FtspLplBeaconer/Makefile b/apps/tests/TestFtsp/FtspLplBeaconer/Makefile new file mode 100755 index 00000000..a935c01e --- /dev/null +++ b/apps/tests/TestFtsp/FtspLplBeaconer/Makefile @@ -0,0 +1,7 @@ +COMPONENT=RadioCountToLedsAppC + +CFLAGS += -DLPL_INTERVAL=200 +CFLAGS += -DLOW_POWER_LISTENING + +include $(MAKERULES) + diff --git a/apps/tests/TestFtsp/FtspLplBeaconer/RadioCountToLeds.h b/apps/tests/TestFtsp/FtspLplBeaconer/RadioCountToLeds.h new file mode 100755 index 00000000..8d29f3fb --- /dev/null +++ b/apps/tests/TestFtsp/FtspLplBeaconer/RadioCountToLeds.h @@ -0,0 +1,41 @@ +/* + * "Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +#ifndef RADIO_COUNT_TO_LEDS_H +#define RADIO_COUNT_TO_LEDS_H + +typedef nx_struct radio_count_msg { + nx_uint16_t counter; +} radio_count_msg_t; + +enum { + AM_RADIO_COUNT_MSG = 6, +}; + +#endif diff --git a/apps/tests/TestFtsp/FtspLplBeaconer/RadioCountToLedsAppC.nc b/apps/tests/TestFtsp/FtspLplBeaconer/RadioCountToLedsAppC.nc new file mode 100755 index 00000000..13f36670 --- /dev/null +++ b/apps/tests/TestFtsp/FtspLplBeaconer/RadioCountToLedsAppC.nc @@ -0,0 +1,74 @@ +// $Id$ + +/* tab:4 + * "Copyright (c) 2000-2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +#include "RadioCountToLeds.h" +#include "Timer.h" + +/** + * Configuration for the RadioCountToLeds application. RadioCountToLeds + * maintains a 4Hz counter, broadcasting its value in an AM packet + * every time it gets updated. A RadioCountToLeds node that hears a counter + * displays the bottom three bits on its LEDs. This application is a useful + * test to show that basic AM communication and timers work. + * + * @author Philip Levis + * @date June 6 2005 + */ + +configuration RadioCountToLedsAppC {} +implementation { + components MainC, new RadioCountToLedsC(T32khz) as App, LedsC; + components new AMReceiverC(AM_RADIO_COUNT_MSG); + components new TimerMilliC(); + components TimeSyncMessageC as ActiveMessageC; + + App.Boot -> MainC.Boot; + + App.Receive -> AMReceiverC; + App.AMSend -> ActiveMessageC.TimeSyncAMSend32khz[AM_RADIO_COUNT_MSG]; + App.AMControl -> ActiveMessageC; + App.Leds -> LedsC; + App.MilliTimer -> TimerMilliC; + App.Packet -> ActiveMessageC; + + components Counter32khz32C, new CounterToLocalTimeC(T32khz) as LocalTime32khzC; + LocalTime32khzC.Counter -> Counter32khz32C; + App.LocalTime -> LocalTime32khzC; + + +#ifdef LOW_POWER_LISTENING + components CC2420ActiveMessageC; + App.LowPowerListening -> CC2420ActiveMessageC; +#endif + +} + + diff --git a/apps/tests/TestFtsp/FtspLplBeaconer/RadioCountToLedsC.nc b/apps/tests/TestFtsp/FtspLplBeaconer/RadioCountToLedsC.nc new file mode 100755 index 00000000..02b613bf --- /dev/null +++ b/apps/tests/TestFtsp/FtspLplBeaconer/RadioCountToLedsC.nc @@ -0,0 +1,148 @@ +// $Id$ + +/* tab:4 + * "Copyright (c) 2000-2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +#include "Timer.h" +#include "RadioCountToLeds.h" + +/** + * Implementation of the RadioCountToLeds application. RadioCountToLeds + * maintains a 4Hz counter, broadcasting its value in an AM packet + * every time it gets updated. A RadioCountToLeds node that hears a counter + * displays the bottom three bits on its LEDs. This application is a useful + * test to show that basic AM communication and timers work. + * + * @author Philip Levis + * @date June 6 2005 + */ + +generic module RadioCountToLedsC(typedef precision_tag) @safe() { + uses { + interface Leds; + interface Boot; + interface Receive; + interface TimeSyncAMSend as AMSend; + interface Timer as MilliTimer; + interface SplitControl as AMControl; + interface Packet; + + interface LocalTime as LocalTime; + + +#ifdef LOW_POWER_LISTENING + interface LowPowerListening; +#endif + + } +} +implementation { + + message_t packet; + + bool locked; + uint16_t counter = 0; + + event void Boot.booted() { + call AMControl.start(); + } + + event void AMControl.startDone(error_t err) { + if (err == SUCCESS) { + call MilliTimer.startPeriodic(2*1024); + } + else { + call AMControl.start(); + } + } + + event void AMControl.stopDone(error_t err) { + // do nothing + } + + event void MilliTimer.fired() { + uint32_t time = call LocalTime.get(); + counter++; + dbg("RadioCountToLedsC", "RadioCountToLedsC: timer fired, counter is %hu.\n", counter); + if (locked) { + return; + } + else { + radio_count_msg_t* rcm = (radio_count_msg_t*)call Packet.getPayload(&packet, sizeof(radio_count_msg_t)); + if (rcm == NULL) { + return; + } + + rcm->counter = counter; +#ifdef LOW_POWER_LISTENING + call LowPowerListening.setRemoteWakeupInterval(&packet, LPL_INTERVAL); +#endif + + if (call AMSend.send(AM_BROADCAST_ADDR, &packet, sizeof(radio_count_msg_t), time) == SUCCESS) { + dbg("RadioCountToLedsC", "RadioCountToLedsC: packet sent.\n", counter); + locked = TRUE; + } + } + } + + event message_t* Receive.receive(message_t* bufPtr, + void* payload, uint8_t len) { + dbg("RadioCountToLedsC", "Received packet of length %hhu.\n", len); + if (len != sizeof(radio_count_msg_t)) {return bufPtr;} + else { + radio_count_msg_t* rcm = (radio_count_msg_t*)payload; + if (rcm->counter & 0x1) { + call Leds.led0On(); + } + else { + call Leds.led0Off(); + } + if (rcm->counter & 0x2) { + call Leds.led1On(); + } + else { + call Leds.led1Off(); + } + if (rcm->counter & 0x4) { + call Leds.led2On(); + } + else { + call Leds.led2Off(); + } + return bufPtr; + } + } + + event void AMSend.sendDone(message_t* bufPtr, error_t error) { + if (&packet == bufPtr) { + locked = FALSE; + } + } + +} diff --git a/apps/tests/TestLocalTime/README.txt b/apps/tests/TestLocalTime/README.txt index 5fac5fae..825967f4 100644 --- a/apps/tests/TestLocalTime/README.txt +++ b/apps/tests/TestLocalTime/README.txt @@ -6,6 +6,9 @@ Description: TestLocalTime is a simple application that tests the LocalTimeMilliC component by sending the current time over the serial port once per second. +dump.py is a Python script that can be used to read and format the values from +the serial port. + Tools: None. diff --git a/apps/tests/TestLocalTime/dump.py b/apps/tests/TestLocalTime/dump.py new file mode 100644 index 00000000..e8dea05f --- /dev/null +++ b/apps/tests/TestLocalTime/dump.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +import sys +import tos + +class Localtime(tos.Packet): + def __init__(self, packet = None): + tos.Packet.__init__(self, + [('time', 'int', 4)], + packet) + +if '-h' in sys.argv: + print "Usage:", sys.argv[0], "serial@/dev/ttyUSB0:57600" + sys.exit() + +am = tos.AM() + +while True: + p = am.read() + if p: + msg = Localtime(p.data) + print msg diff --git a/apps/tests/TestLpl/README.txt b/apps/tests/TestLpl/README.txt index 1add1755..d0092953 100644 --- a/apps/tests/TestLpl/README.txt +++ b/apps/tests/TestLpl/README.txt @@ -4,7 +4,7 @@ Author/Contact: tinyos-help@millennium.berkeley.edu Description: A simple low-power-listening test app, which cycles through different -low-power-listening settings every ~32s, repeating every ~256s. +low-power-listening settings every ~32s, repeating every ~192s. This application currently runs on motes using the CC1000, CC2420 and RF230 radios. To compile for motes with CC2420 or RF230 radios, you @@ -36,16 +36,10 @@ Its low-power-listening settings are as follows (repeating every 256s): 160-192s: receive: low-power-listening with 2000ms interval send: every 7 seconds, to low-power-listeners with 2000ms interval -192-224s: receive: low-power-listening with 1% duty cycle - send: every 7 seconds, to low-power-listeners with 1% duty cycle - -224-256s: receive: low-power-listening with 0.1% duty cycle - send: every 7 seconds, to low-power-listeners with 0.1% duty cycle - Whether two motes running TestLPL can receive each others messages depends on their current send and receive low-power-listening settings. If you reset two such motes at the same time, they will be able to receive each other's -messages in the following intervals: 0-96s and 128-256s. +messages in the following intervals: 0-96s and 128-192s. Tools: diff --git a/apps/tests/TestLpl/TestLplAppC.nc b/apps/tests/TestLpl/TestLplAppC.nc index 46724370..af7a5975 100644 --- a/apps/tests/TestLpl/TestLplAppC.nc +++ b/apps/tests/TestLpl/TestLplAppC.nc @@ -45,9 +45,9 @@ implementation { components new TimerMilliC(); #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT) components CC1000CsmaRadioC as LplRadio; -#elif defined(PLATFORM_MICAZ) || defined(PLATFORM_TELOSB) || defined(PLATFORM_SHIMMER) || defined(PLATFORM_INTELMOTE2) +#elif defined(PLATFORM_MICAZ) || defined(PLATFORM_TELOSB) || defined(PLATFORM_SHIMMER) || defined(PLATFORM_SHIMMER2) || defined(PLATFORM_INTELMOTE2) || defined(PLATFORM_EPIC) components CC2420ActiveMessageC as LplRadio; -#elif defined(PLATFORM_IRIS) +#elif defined(PLATFORM_IRIS) || defined(PLATFORM_MULLE) components RF230ActiveMessageC as LplRadio; #elif defined(PLATFORM_EYESIFXV1) || defined(PLATFORM_EYESIFXV2) components LplC as LplRadio; diff --git a/apps/tests/TestLpl/TestLplC.nc b/apps/tests/TestLpl/TestLplC.nc index 0920f136..b186e65d 100644 --- a/apps/tests/TestLpl/TestLplC.nc +++ b/apps/tests/TestLpl/TestLplC.nc @@ -68,31 +68,25 @@ implementation case 0: sendSkip = 0; sendInterval = 0; - call LowPowerListening.setLocalSleepInterval(0); + call LowPowerListening.setLocalWakeupInterval(0); break; case 1: sendInterval = 100; /* Send to sleepy listener */ break; case 2: sendInterval = -1; /* Send to listener like us */ - call LowPowerListening.setLocalSleepInterval(250); + call LowPowerListening.setLocalWakeupInterval(250); break; case 3: sendInterval = 0; /* Send to awake listener */ break; case 4: sendInterval = -1; /* Send to listener like us */ - call LowPowerListening.setLocalSleepInterval(10); + call LowPowerListening.setLocalWakeupInterval(10); break; case 5: sendSkip = 7; /* Send every 7s */ - call LowPowerListening.setLocalSleepInterval(2000); - break; - case 6: - call LowPowerListening.setLocalDutyCycle(100); - break; - case 7: - call LowPowerListening.setLocalDutyCycle(10); + call LowPowerListening.setLocalWakeupInterval(2000); break; } } @@ -106,7 +100,7 @@ implementation if (!locked && ((counter & sendSkip) == sendSkip)) { if (sendInterval >= 0) - call LowPowerListening.setRxSleepInterval(&packet, sendInterval); + call LowPowerListening.setRemoteWakeupInterval(&packet, sendInterval); if (call AMSend.send(AM_BROADCAST_ADDR, &packet, 0) == SUCCESS) { call Leds.led0On(); diff --git a/apps/tests/TestNetwork/README.txt b/apps/tests/TestNetwork/README.txt index ed522050..b533acdc 100644 --- a/apps/tests/TestNetwork/README.txt +++ b/apps/tests/TestNetwork/README.txt @@ -14,6 +14,24 @@ Collection Tree Protocol for details. There are scripts on net2 website to parse the debug messages sent by the nodes. +To test, start with two motes with no program that transmits +packets. Example., erase the mote or install Blink. Program a mote with +node id 0. The mote will toggle led1 (green on TelosB) approximately +every 8s. Then program the second mote with id 1. Once programming is +complete, the mote with id 0 will toggle led1 twice every 8s. Each +toggle corresponds to the reception of collection message (once from +itself, and once from the mote with id 1). + +Errors indications: + +Motes 0 and 1 will set led0 (red on TelosB) if there are errors while +sending the packet. + +Mote 0 will set led2 (blue on TelosB) if the gap in sequence number on +consecutive packet reception from node 1 is greater than 1. This is +expected to be a rare event while doing experiment on a desk. + + Known bugs/limitations: None. diff --git a/apps/tests/TestNetwork/TestNetworkAppC.nc b/apps/tests/TestNetwork/TestNetworkAppC.nc index b64adf2d..337b8d2e 100644 --- a/apps/tests/TestNetwork/TestNetworkAppC.nc +++ b/apps/tests/TestNetwork/TestNetworkAppC.nc @@ -17,7 +17,7 @@ configuration TestNetworkAppC {} implementation { components TestNetworkC, MainC, LedsC, ActiveMessageC; components DisseminationC; - components new DisseminatorC(uint16_t, SAMPLE_RATE_KEY) as Object16C; + components new DisseminatorC(uint32_t, SAMPLE_RATE_KEY) as Object32C; components CollectionC as Collector; components new CollectionSenderC(CL_TEST); components new TimerMilliC(); @@ -39,7 +39,7 @@ implementation { TestNetworkC.DisseminationControl -> DisseminationC; TestNetworkC.Leds -> LedsC; TestNetworkC.Timer -> TimerMilliC; - TestNetworkC.DisseminationPeriod -> Object16C; + TestNetworkC.DisseminationPeriod -> Object32C; TestNetworkC.Send -> CollectionSenderC; TestNetworkC.ReadSensor -> DemoSensorC; TestNetworkC.RootControl -> Collector; diff --git a/apps/tests/TestNetwork/TestNetworkC.nc b/apps/tests/TestNetwork/TestNetworkC.nc index 28e248f0..05e44d2f 100644 --- a/apps/tests/TestNetwork/TestNetworkC.nc +++ b/apps/tests/TestNetwork/TestNetworkC.nc @@ -20,7 +20,7 @@ module TestNetworkC { uses interface SplitControl as SerialControl; uses interface StdControl as RoutingControl; uses interface StdControl as DisseminationControl; - uses interface DisseminationValue as DisseminationPeriod; + uses interface DisseminationValue as DisseminationPeriod; uses interface Send; uses interface Leds; uses interface Read as ReadSensor; @@ -87,7 +87,7 @@ implementation { void sendMessage() { TestNetworkMsg* msg = (TestNetworkMsg*)call Send.getPayload(&packet, sizeof(TestNetworkMsg)); uint16_t metric; - am_addr_t parent; + am_addr_t parent = 0; call CtpInfo.getParent(&parent); call CtpInfo.getEtx(&metric); @@ -113,10 +113,9 @@ implementation { event void Timer.fired() { - uint16_t nextInt; - call Leds.led0Toggle(); + uint32_t nextInt; dbg("TestNetworkC", "TestNetworkC: Timer fired.\n"); - nextInt = call Random.rand16() % SEND_INTERVAL; + nextInt = call Random.rand32() % SEND_INTERVAL; nextInt += SEND_INTERVAL >> 1; call Timer.startOneShot(nextInt); if (!sendBusy) @@ -125,25 +124,38 @@ implementation { event void Send.sendDone(message_t* m, error_t err) { if (err != SUCCESS) { - // call Leds.led0On(); + call Leds.led0On(); } sendBusy = FALSE; dbg("TestNetworkC", "Send completed.\n"); } event void DisseminationPeriod.changed() { - const uint16_t* newVal = call DisseminationPeriod.get(); + const uint32_t* newVal = call DisseminationPeriod.get(); call Timer.stop(); call Timer.startPeriodic(*newVal); } + + uint8_t prevSeq = 0; + uint8_t firstMsg = 0; + event message_t* Receive.receive(message_t* msg, void* payload, uint8_t len) { dbg("TestNetworkC", "Received packet at %s from node %hhu.\n", sim_time_string(), call CollectionPacket.getOrigin(msg)); - call Leds.led1Toggle(); - if (!call Pool.size() <= (TEST_NETWORK_QUEUE_SIZE < 4)? 1:3) { - // call CtpCongestion.setClientCongested(TRUE); + call Leds.led1Toggle(); + + if (call CollectionPacket.getOrigin(msg) == 1) { + if (firstMsg == 1) { + if (call CollectionPacket.getSequenceNumber(msg) - prevSeq > 1) { + call Leds.led2On(); + } + } else { + firstMsg = 1; + } + prevSeq = call CollectionPacket.getSequenceNumber(msg); } + if (!call Pool.empty() && call Queue.size() < call Queue.maxSize()) { message_t* tmp = call Pool.get(); call Queue.enqueue(msg); diff --git a/apps/tests/TestNetworkLpl/Makefile b/apps/tests/TestNetworkLpl/Makefile new file mode 100644 index 00000000..af118ab4 --- /dev/null +++ b/apps/tests/TestNetworkLpl/Makefile @@ -0,0 +1,73 @@ +COMPONENT=TestNetworkLplAppC + +CFLAGS += -DLOW_POWER_LISTENING +CFLAGS += -DLPL_DEF_LOCAL_WAKEUP=512 +CFLAGS += -DLPL_DEF_REMOTE_WAKEUP=512 +CFLAGS += -DDELAY_AFTER_RECEIVE=20 + +# CFLAGS += -DCC2420_DEF_CHANNEL=12 +CFLAGS += -I. +CFLAGS += -I../TestNetwork + +CFLAGS += -I$(TOSDIR)/lib/net \ + -I$(TOSDIR)/lib/net/drip \ + -I$(TOSDIR)/lib/net/4bitle \ + -I$(TOSDIR)/lib/net/ctp -DNO_DEBUG + +TFLAGS += -I$(TOSDIR)/../apps/tests/TestDissemination \ + -I$(TOSDIR)/../support/sdk/c \ + -I$(TOSDIR)/types \ + -I. + +LIBMOTE = $(TOSDIR)/../support/sdk/c/libmote.a +#BUILD_EXTRA_DEPS += tn-injector #tn-listener +LISTEN_OBJS = collection_msg.o test_network_msg.o tn-listener.o $(LIBMOTE) +INJECT_OBJS = set_rate_msg.o tn-injector.o collection_debug_msg.o $(LIBMOTE) + +# arguments: output filename stem, input filename, struct name +define mig_templ +MIGFILES += $(1).c $(1).h $(1).java $(1).o +$(1).c: + mig -o $(1).h c -target=$$(PLATFORM) $$(CFLAGS) $$(TFLAGS) $(2) $(3) +$(1).java: + mig -o $(1).java java -target=$$(PLATFORM) $$(CFLAGS) $$(TFLAGS) $(2) $(3) +endef + +$(eval $(call mig_templ,test_network_msg,TestNetwork.h,TestNetworkMsg)) +$(eval $(call mig_templ,set_rate_msg,$(TOSDIR)/lib/net/DisseminationEngine.h,dissemination_message)) +$(eval $(call mig_templ,collection_debug_msg,$(TOSDIR)/lib/net/collection/CollectionDebugMsg.h,CollectionDebugMsg)) + +%.o: %.c + gcc -v $(TFLAGS) $(CFLAGS) -c -o $@ $< + +tn-listener: $(LISTEN_OBJS) + gcc -v $(TFLAGS) $(CFLAGS) -o $@ $(LISTEN_OBJS) + +tn-injector: $(INJECT_OBJS) + gcc -v $(TFLAGS) $(CFLAGS) -o $@ $(INJECT_OBJS) + +#tn-listener.o: tn-listener.c +# gcc $(TFLAGS) $(CFLAGS) -c -o $@ $< + +tn-injector.o: tn-injector.c test_network_msg.c + gcc $(TFLAGS) $(CFLAGS) -c -o $@ $< + +#test_network_msg.c: +# mig -o test_network_msg.h c -target=$(PLATFORM) $(CFLAGS) $(TFLAGS) TestNetwork.h TestNetworkMsg + +#set_rate_msg.c: +# mig -o set_rate_msg.h c -target=$(PLATFORM) $(CFLAGS) $(TFLAGS) $(TOSDIR)/lib/net/DisseminationEngine.h dissemination_message + +#set_rate_msg.o: set_rate_msg.c +# gcc $(CFLAGS) $(TFLAGS) -c -o $@ $< + +#test_network_msg.o: test_network_msg.c +# gcc $(CFLAGS) $(TFLAGS) -c -o $@ $< + +#collection_msg.c: +# mig -o collection_msg.h c -target=$(PLATFORM) $(CFLAGS) $(TFLAGS) $(TOSDIR)/lib/net/collection/ForwardingEngine.h collection_header + +include $(MAKERULES) + +migclean: + rm -rf $(MIGFILES) diff --git a/apps/tests/TestNetworkLpl/README.txt b/apps/tests/TestNetworkLpl/README.txt new file mode 100644 index 00000000..3029a6a6 --- /dev/null +++ b/apps/tests/TestNetworkLpl/README.txt @@ -0,0 +1,19 @@ +README for TestNetworkLpl +Author/Contact: tinyos-help@millennium.berkeley.edu + +Description: + +This is a version of the TestNetworkLpl application that is using the +default LowPowerListening mechanism to reduce the power consumption. + +The settings for default lpl are controlled by the following lines +from the Makefile: + + CFLAGS += -DLOW_POWER_LISTENING + CFLAGS += -DLPL_DEF_LOCAL_WAKEUP=512 + CFLAGS += -DLPL_DEF_REMOTE_WAKEUP=512 + CFLAGS += -DDELAY_AFTER_RECEIVE=20 + +Known bugs/limitations: + +None. diff --git a/apps/tests/TestNetworkLpl/TestNetworkLplAppC.nc b/apps/tests/TestNetworkLpl/TestNetworkLplAppC.nc new file mode 100644 index 00000000..590785b5 --- /dev/null +++ b/apps/tests/TestNetworkLpl/TestNetworkLplAppC.nc @@ -0,0 +1,68 @@ +/** + * TestNetworkLplC exercises the basic networking layers, collection and + * dissemination. The application samples DemoSensorC at a basic rate + * and sends packets up a collection tree. The rate is configurable + * through dissemination. + * + * See TEP118: Dissemination, TEP 119: Collection, and TEP 123: The + * Collection Tree Protocol for details. + * + * @author Philip Levis + * @version $Revision$ $Date$ + */ +#include "TestNetwork.h" +#include "Ctp.h" + +configuration TestNetworkLplAppC {} +implementation { + components TestNetworkLplC, MainC, LedsC, ActiveMessageC; + components DisseminationC; + components new DisseminatorC(uint32_t, SAMPLE_RATE_KEY) as Object32C; + components CollectionC as Collector; + components new CollectionSenderC(CL_TEST); + components new TimerMilliC(); + components new DemoSensorC(); + components new SerialAMSenderC(CL_TEST); + components SerialActiveMessageC; +#ifndef NO_DEBUG + components new SerialAMSenderC(AM_COLLECTION_DEBUG) as UARTSender; + components UARTDebugSenderP as DebugSender; +#endif + components RandomC; + components new QueueC(message_t*, 12); + components new PoolC(message_t, 12); + + TestNetworkLplC.Boot -> MainC; + TestNetworkLplC.RadioControl -> ActiveMessageC; + TestNetworkLplC.SerialControl -> SerialActiveMessageC; + TestNetworkLplC.RoutingControl -> Collector; + TestNetworkLplC.DisseminationControl -> DisseminationC; + TestNetworkLplC.Leds -> LedsC; + TestNetworkLplC.Timer -> TimerMilliC; + TestNetworkLplC.DisseminationPeriod -> Object32C; + TestNetworkLplC.Send -> CollectionSenderC; + TestNetworkLplC.ReadSensor -> DemoSensorC; + TestNetworkLplC.RootControl -> Collector; + TestNetworkLplC.Receive -> Collector.Receive[CL_TEST]; + TestNetworkLplC.UARTSend -> SerialAMSenderC.AMSend; + TestNetworkLplC.CollectionPacket -> Collector; + TestNetworkLplC.CtpInfo -> Collector; + TestNetworkLplC.CtpCongestion -> Collector; + TestNetworkLplC.Random -> RandomC; + TestNetworkLplC.Pool -> PoolC; + TestNetworkLplC.Queue -> QueueC; + TestNetworkLplC.RadioPacket -> ActiveMessageC; + TestNetworkLplC.LowPowerListening -> ActiveMessageC; + +#ifndef NO_DEBUG + components new PoolC(message_t, 10) as DebugMessagePool; + components new QueueC(message_t*, 10) as DebugSendQueue; + DebugSender.Boot -> MainC; + DebugSender.UARTSend -> UARTSender; + DebugSender.MessagePool -> DebugMessagePool; + DebugSender.SendQueue -> DebugSendQueue; + Collector.CollectionDebug -> DebugSender; + TestNetworkLplC.CollectionDebug -> DebugSender; +#endif + TestNetworkLplC.AMPacket -> ActiveMessageC; +} diff --git a/apps/tests/TestNetworkLpl/TestNetworkLplC.nc b/apps/tests/TestNetworkLpl/TestNetworkLplC.nc new file mode 100644 index 00000000..110c9fe5 --- /dev/null +++ b/apps/tests/TestNetworkLpl/TestNetworkLplC.nc @@ -0,0 +1,214 @@ +/** + * TestNetworkC exercises the basic networking layers, collection and + * dissemination. The application samples DemoSensorC at a basic rate + * and sends packets up a collection tree. The rate is configurable + * through dissemination. The default send rate is every 10s. + * + * See TEP118: Dissemination and TEP 119: Collection for details. + * + * @author Philip Levis + * @version $Revision$ $Date$ + */ + +#include +#include "TestNetwork.h" +#include "CtpDebugMsg.h" + +module TestNetworkLplC { + uses interface Boot; + uses interface SplitControl as RadioControl; + uses interface SplitControl as SerialControl; + uses interface StdControl as RoutingControl; + uses interface StdControl as DisseminationControl; + uses interface DisseminationValue as DisseminationPeriod; + uses interface Send; + uses interface Leds; + uses interface Read as ReadSensor; + uses interface Timer; + uses interface RootControl; + uses interface Receive; + uses interface AMSend as UARTSend; + uses interface CollectionPacket; + uses interface CtpInfo; + uses interface CtpCongestion; + uses interface Random; + uses interface Queue; + uses interface Pool; + uses interface CollectionDebug; + uses interface AMPacket; + uses interface Packet as RadioPacket; + uses interface LowPowerListening; +} +implementation { + task void uartEchoTask(); + message_t packet; + message_t uartpacket; + message_t* recvPtr = &uartpacket; + uint8_t msglen; + bool sendBusy = FALSE; + bool uartbusy = FALSE; + bool firstTimer = TRUE; + uint16_t seqno; + enum { + SEND_INTERVAL = 60*1024U, + }; + + event void ReadSensor.readDone(error_t err, uint16_t val) { } + + event void Boot.booted() { + call SerialControl.start(); + } + event void SerialControl.startDone(error_t err) { + if (TOS_NODE_ID % 500 == 0) { + call LowPowerListening.setLocalWakeupInterval(0); + } + call RadioControl.start(); + } + event void RadioControl.startDone(error_t err) { + if (err != SUCCESS) { + call RadioControl.start(); + } + else { + //call DisseminationControl.start(); + call RoutingControl.start(); + if (TOS_NODE_ID % 500 == 0) { + call RootControl.setRoot(); + } + seqno = 0; + call Timer.startOneShot(call Random.rand32() % SEND_INTERVAL); + } + } + + event void RadioControl.stopDone(error_t err) {} + event void SerialControl.stopDone(error_t err) {} + + void failedSend() { + dbg("App", "%s: Send failed.\n", __FUNCTION__); + call CollectionDebug.logEvent(NET_C_DBG_1); + } + + + void sendMessage() { + TestNetworkMsg* msg = (TestNetworkMsg*)call Send.getPayload(&packet, sizeof(TestNetworkMsg)); + uint16_t metric; + am_addr_t parent = 0; + + call CtpInfo.getParent(&parent); + call CtpInfo.getEtx(&metric); + + msg->source = TOS_NODE_ID; + msg->seqno = seqno; + msg->data = 0xCAFE; + msg->parent = parent; + msg->hopcount = 0; + msg->metric = metric; + + if (call Send.send(&packet, sizeof(TestNetworkMsg)) != SUCCESS) { + failedSend(); + call Leds.led0On(); + dbg("TestNetworkC", "%s: Transmission failed.\n", __FUNCTION__); + } + else { + sendBusy = TRUE; + seqno++; + dbg("TestNetworkC", "%s: Transmission succeeded.\n", __FUNCTION__); + } + } + + + event void Timer.fired() { + uint32_t nextInt; + call Leds.led0Toggle(); + dbg("TestNetworkC", "TestNetworkC: Timer fired.\n"); + nextInt = call Random.rand32() % SEND_INTERVAL; + nextInt += SEND_INTERVAL >> 1; + call Timer.startOneShot(nextInt); + if (!sendBusy) + sendMessage(); + } + + event void Send.sendDone(message_t* m, error_t err) { + if (err != SUCCESS) { + // call Leds.led0On(); + } + sendBusy = FALSE; + dbg("TestNetworkC", "Send completed.\n"); + } + + event void DisseminationPeriod.changed() { + const uint32_t* newVal = call DisseminationPeriod.get(); + call Timer.stop(); + call Timer.startPeriodic(*newVal); + } + + event message_t* + Receive.receive(message_t* msg, void* payload, uint8_t len) { + dbg("TestNetworkC", "Received packet at %s from node %hhu.\n", sim_time_string(), call CollectionPacket.getOrigin(msg)); + call Leds.led1Toggle(); + if (!call Pool.size() <= (TEST_NETWORK_QUEUE_SIZE < 4)? 1:3) { + // call CtpCongestion.setClientCongested(TRUE); + } + if (!call Pool.empty() && call Queue.size() < call Queue.maxSize()) { + message_t* tmp = call Pool.get(); + call Queue.enqueue(msg); + if (!uartbusy) { + post uartEchoTask(); + } + return tmp; + } + return msg; + } + + task void uartEchoTask() { + dbg("Traffic", "Sending packet to UART.\n"); + if (call Queue.empty()) { + return; + } + else if (!uartbusy) { + message_t* msg = call Queue.dequeue(); + dbg("Traffic", "Sending packet to UART.\n"); + if (call UARTSend.send(0xffff, msg, call RadioPacket.payloadLength(msg)) == SUCCESS) { + uartbusy = TRUE; + } + else { + call CollectionDebug.logEventMsg(NET_C_DBG_2, + call CollectionPacket.getSequenceNumber(msg), + call CollectionPacket.getOrigin(msg), + call AMPacket.destination(msg)); + } + } + } + + event void UARTSend.sendDone(message_t *msg, error_t error) { + dbg("Traffic", "UART send done.\n"); + uartbusy = FALSE; + call Pool.put(msg); + if (!call Queue.empty()) { + post uartEchoTask(); + } + else { + // call CtpCongestion.setClientCongested(FALSE); + } + } + + /* Default implementations for CollectionDebug calls. + * These allow CollectionDebug not to be wired to anything if debugging + * is not desired. */ + + default command error_t CollectionDebug.logEvent(uint8_t type) { + return SUCCESS; + } + default command error_t CollectionDebug.logEventSimple(uint8_t type, uint16_t arg) { + return SUCCESS; + } + default command error_t CollectionDebug.logEventDbg(uint8_t type, uint16_t arg1, uint16_t arg2, uint16_t arg3) { + return SUCCESS; + } + default command error_t CollectionDebug.logEventMsg(uint8_t type, uint16_t msg, am_addr_t origin, am_addr_t node) { + return SUCCESS; + } + default command error_t CollectionDebug.logEventRoute(uint8_t type, am_addr_t parent, uint8_t hopcount, uint16_t metric) { + return SUCCESS; + } + +} diff --git a/apps/tests/TestNetworkLpl/ctp-dump.py b/apps/tests/TestNetworkLpl/ctp-dump.py new file mode 100644 index 00000000..6fdef401 --- /dev/null +++ b/apps/tests/TestNetworkLpl/ctp-dump.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +import sys, time +import tos + +class Test(tos.Packet): + def __init__(self, payload = None): + tos.Packet.__init__(self, + [('source', 'int', 2), + ('seqno', 'int', 2), + ('parent', 'int', 2), + ('metric', 'int', 2), + ('data', 'int', 2), + ('hopcount', 'int', 1), + ('sendCount','int', 2), + ('sendSuccessCount','int', 2)], + payload) + +class CtpData(tos.Packet): + def __init__(self, payload = None): + tos.Packet.__init__(self, + [('options', 'int', 1), + ('thl', 'int', 1), + ('etx', 'int', 2), + ('origin', 'int', 2), + ('originSeqNo', 'int', 1), + ('collectionId','int', 1), + ('data', 'blob', None)], + payload) + +if len(sys.argv) < 2: + print "Usage:", sys.argv[0], "serial@/dev/ttyUSB0:57600" + sys.exit() + +#s = tos.Serial(sys.argv[1], int(sys.argv[2]), debug=False) +am = tos.AM() + +while True: + p = am.read() + if p: + if p.type == 238: + ts = "%.4f" % time.time() + ctp = CtpData(p.data) + test = Test(ctp.data) + print ts, '\t', ctp + print ts, '\t', test + else: + print p + diff --git a/apps/tests/TestSerial/README.txt b/apps/tests/TestSerial/README.txt index 31cba7b2..1a8e56d5 100644 --- a/apps/tests/TestSerial/README.txt +++ b/apps/tests/TestSerial/README.txt @@ -16,9 +16,12 @@ application prints the counter's value to standard out. Java Application Usage: java TestSerial [-comm ] - If not specified, the defaults to sf@localhost:9001 or + If not specified, the defaults to sf@localhost:9002 or to your MOTECOM environment variable (if defined). +Python Usage: + tos-dump /dev/ttyUSB0 57600 + Tools: Known bugs/limitations: diff --git a/apps/tests/TestSerialBandwidth/Makefile b/apps/tests/TestSerialBandwidth/Makefile index b0aae054..c7603bf0 100644 --- a/apps/tests/TestSerialBandwidth/Makefile +++ b/apps/tests/TestSerialBandwidth/Makefile @@ -1,6 +1,7 @@ COMPONENT=TestSerialAppC BUILD_EXTRA_DEPS += TestSerialMsg.class TestSerial.class CFLAGS += -DTOSH_DATA_LENGTH=100 +CLEAN_EXTRA = *.class TestSerialMsg.java %.class: %.java javac $< diff --git a/apps/tests/TestSerialBandwidth/TestSerialMsg.java b/apps/tests/TestSerialBandwidth/TestSerialMsg.java deleted file mode 100644 index 257e8cd5..00000000 --- a/apps/tests/TestSerialBandwidth/TestSerialMsg.java +++ /dev/null @@ -1,318 +0,0 @@ -/** - * This class is automatically generated by mig. DO NOT EDIT THIS FILE. - * This class implements a Java interface to the 'TestSerialMsg' - * message type. - */ - -public class TestSerialMsg extends net.tinyos.message.Message { - - /** The default size of this message type in bytes. */ - public static final int DEFAULT_MESSAGE_SIZE = 100; - - /** The Active Message type associated with this message. */ - public static final int AM_TYPE = 9; - - /** Create a new TestSerialMsg of size 100. */ - public TestSerialMsg() { - super(DEFAULT_MESSAGE_SIZE); - amTypeSet(AM_TYPE); - } - - /** Create a new TestSerialMsg of the given data_length. */ - public TestSerialMsg(int data_length) { - super(data_length); - amTypeSet(AM_TYPE); - } - - /** - * Create a new TestSerialMsg with the given data_length - * and base offset. - */ - public TestSerialMsg(int data_length, int base_offset) { - super(data_length, base_offset); - amTypeSet(AM_TYPE); - } - - /** - * Create a new TestSerialMsg using the given byte array - * as backing store. - */ - public TestSerialMsg(byte[] data) { - super(data); - amTypeSet(AM_TYPE); - } - - /** - * Create a new TestSerialMsg using the given byte array - * as backing store, with the given base offset. - */ - public TestSerialMsg(byte[] data, int base_offset) { - super(data, base_offset); - amTypeSet(AM_TYPE); - } - - /** - * Create a new TestSerialMsg using the given byte array - * as backing store, with the given base offset and data length. - */ - public TestSerialMsg(byte[] data, int base_offset, int data_length) { - super(data, base_offset, data_length); - amTypeSet(AM_TYPE); - } - - /** - * Create a new TestSerialMsg embedded in the given message - * at the given base offset. - */ - public TestSerialMsg(net.tinyos.message.Message msg, int base_offset) { - super(msg, base_offset, DEFAULT_MESSAGE_SIZE); - amTypeSet(AM_TYPE); - } - - /** - * Create a new TestSerialMsg embedded in the given message - * at the given base offset and length. - */ - public TestSerialMsg(net.tinyos.message.Message msg, int base_offset, int data_length) { - super(msg, base_offset, data_length); - amTypeSet(AM_TYPE); - } - - /** - /* Return a String representation of this message. Includes the - * message type name and the non-indexed field values. - */ - public String toString() { - String s = "Message \n"; - try { - s += " [counter=0x"+Long.toHexString(get_counter())+"]\n"; - } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } - try { - s += " [x="; - for (int i = 0; i < 98; i++) { - s += "0x"+Long.toHexString(getElement_x(i) & 0xff)+" "; - } - s += "]\n"; - } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } - return s; - } - - // Message-type-specific access methods appear below. - - ///////////////////////////////////////////////////////// - // Accessor methods for field: counter - // Field type: int, unsigned - // Offset (bits): 0 - // Size (bits): 16 - ///////////////////////////////////////////////////////// - - /** - * Return whether the field 'counter' is signed (false). - */ - public static boolean isSigned_counter() { - return false; - } - - /** - * Return whether the field 'counter' is an array (false). - */ - public static boolean isArray_counter() { - return false; - } - - /** - * Return the offset (in bytes) of the field 'counter' - */ - public static int offset_counter() { - return (0 / 8); - } - - /** - * Return the offset (in bits) of the field 'counter' - */ - public static int offsetBits_counter() { - return 0; - } - - /** - * Return the value (as a int) of the field 'counter' - */ - public int get_counter() { - return (int)getUIntBEElement(offsetBits_counter(), 16); - } - - /** - * Set the value of the field 'counter' - */ - public void set_counter(int value) { - setUIntBEElement(offsetBits_counter(), 16, value); - } - - /** - * Return the size, in bytes, of the field 'counter' - */ - public static int size_counter() { - return (16 / 8); - } - - /** - * Return the size, in bits, of the field 'counter' - */ - public static int sizeBits_counter() { - return 16; - } - - ///////////////////////////////////////////////////////// - // Accessor methods for field: x - // Field type: short[], unsigned - // Offset (bits): 16 - // Size of each element (bits): 8 - ///////////////////////////////////////////////////////// - - /** - * Return whether the field 'x' is signed (false). - */ - public static boolean isSigned_x() { - return false; - } - - /** - * Return whether the field 'x' is an array (true). - */ - public static boolean isArray_x() { - return true; - } - - /** - * Return the offset (in bytes) of the field 'x' - */ - public static int offset_x(int index1) { - int offset = 16; - if (index1 < 0 || index1 >= 98) throw new ArrayIndexOutOfBoundsException(); - offset += 0 + index1 * 8; - return (offset / 8); - } - - /** - * Return the offset (in bits) of the field 'x' - */ - public static int offsetBits_x(int index1) { - int offset = 16; - if (index1 < 0 || index1 >= 98) throw new ArrayIndexOutOfBoundsException(); - offset += 0 + index1 * 8; - return offset; - } - - /** - * Return the entire array 'x' as a short[] - */ - public short[] get_x() { - short[] tmp = new short[98]; - for (int index0 = 0; index0 < numElements_x(0); index0++) { - tmp[index0] = getElement_x(index0); - } - return tmp; - } - - /** - * Set the contents of the array 'x' from the given short[] - */ - public void set_x(short[] value) { - for (int index0 = 0; index0 < value.length; index0++) { - setElement_x(index0, value[index0]); - } - } - - /** - * Return an element (as a short) of the array 'x' - */ - public short getElement_x(int index1) { - return (short)getUIntBEElement(offsetBits_x(index1), 8); - } - - /** - * Set an element of the array 'x' - */ - public void setElement_x(int index1, short value) { - setUIntBEElement(offsetBits_x(index1), 8, value); - } - - /** - * Return the total size, in bytes, of the array 'x' - */ - public static int totalSize_x() { - return (784 / 8); - } - - /** - * Return the total size, in bits, of the array 'x' - */ - public static int totalSizeBits_x() { - return 784; - } - - /** - * Return the size, in bytes, of each element of the array 'x' - */ - public static int elementSize_x() { - return (8 / 8); - } - - /** - * Return the size, in bits, of each element of the array 'x' - */ - public static int elementSizeBits_x() { - return 8; - } - - /** - * Return the number of dimensions in the array 'x' - */ - public static int numDimensions_x() { - return 1; - } - - /** - * Return the number of elements in the array 'x' - */ - public static int numElements_x() { - return 98; - } - - /** - * Return the number of elements in the array 'x' - * for the given dimension. - */ - public static int numElements_x(int dimension) { - int array_dims[] = { 98, }; - if (dimension < 0 || dimension >= 1) throw new ArrayIndexOutOfBoundsException(); - if (array_dims[dimension] == 0) throw new IllegalArgumentException("Array dimension "+dimension+" has unknown size"); - return array_dims[dimension]; - } - - /** - * Fill in the array 'x' with a String - */ - public void setString_x(String s) { - int len = s.length(); - int i; - for (i = 0; i < len; i++) { - setElement_x(i, (short)s.charAt(i)); - } - setElement_x(i, (short)0); //null terminate - } - - /** - * Read the array 'x' as a String - */ - public String getString_x() { - char carr[] = new char[Math.min(net.tinyos.message.Message.MAX_CONVERTED_STRING_LENGTH,98)]; - int i; - for (i = 0; i < carr.length; i++) { - if ((char)getElement_x(i) == (char)0) break; - carr[i] = (char)getElement_x(i); - } - return new String(carr,0,i); - } - -} diff --git a/apps/tests/TestSimComm/README b/apps/tests/TestSimComm/README index 5780b33c..dda666e2 100644 --- a/apps/tests/TestSimComm/README +++ b/apps/tests/TestSimComm/README @@ -30,29 +30,34 @@ quality links (-60 dBm) to node 2, but the reverse links (2 to 1 and like test-equal.py but few acknowledgements. The ./run script runs all the three tests and counts the number of -ACKed and non-ACKed send packets. The output look like this: +ACKed and non-ACKed send packets. The output will look something +like this: -test-asym.log - ACK NOACK total - 1 4930 35923 40853 - 3 4983 35870 40853 test-equal.log ACK NOACK total 1 21197 19666 40863 3 21320 19543 40863 +test-asym.log + ACK NOACK total + 1 4930 35923 40853 + 3 4983 35870 40853 test-unequal.log ACK NOACK total 1 27619 12966 40585 3 21040 19545 40585 -This output shows several this: -- the number of ACKs in the asymmetric links case is much less than in - the equal case which proves the fact that the reverse links are indeed - poor. -- in the unequal case the number on ACKs for node 1 is higher than - node 3 which is expected because node 1 has a better link to 2 than 3. -- in the equal case both nodes perform similar, each of them loosing - about half of their packets. +ACK is the number of acknowledged packets from that node to node 2; +NOACK is the number of unacknowledged packets. Total is the sum. +The output should show three things: + + 1) In test-equal, both node 1 and node 3 have very + similar delivery ratios, losing about half of their packets. + + 2) In test-asym, the number of ACKs is much less than in + test-equal because the reverse links are poor. + + 3) In test-unequal, node 1 has more acknowledged packets + than node 3, because it has a higher SNR link. Philip Levis diff --git a/apps/tests/TestSimComm/run b/apps/tests/TestSimComm/run index d1720eee..7cd6667b 100755 --- a/apps/tests/TestSimComm/run +++ b/apps/tests/TestSimComm/run @@ -2,7 +2,7 @@ make micaz sim -for t in test*.py +for t in test-equal.py test-asym.py test-unequal.py do echo Running $t... python $t > `basename $t .py`.log @@ -10,7 +10,7 @@ done make clean -for l in test*.log +for l in test-equal.log test-asym.log test-unequal.log do echo $l echo -e '\t ACK \t\t NOACK \t total' diff --git a/apps/tests/TestSimComm/test-asym.py b/apps/tests/TestSimComm/test-asym.py index a84c4544..31d87990 100644 --- a/apps/tests/TestSimComm/test-asym.py +++ b/apps/tests/TestSimComm/test-asym.py @@ -43,7 +43,7 @@ m1.createNoiseModel() m2.createNoiseModel() m3.createNoiseModel() -for i in range(0, 1000000): +for i in range(0, 200000): t.runNextEvent(); diff --git a/apps/tests/TestSimComm/test-equal.py b/apps/tests/TestSimComm/test-equal.py index a734f9b6..bd7e84c8 100644 --- a/apps/tests/TestSimComm/test-equal.py +++ b/apps/tests/TestSimComm/test-equal.py @@ -43,7 +43,7 @@ m1.createNoiseModel() m2.createNoiseModel() m3.createNoiseModel() -for i in range(0, 1000000): +for i in range(0, 200000): t.runNextEvent(); diff --git a/apps/tests/TestSimComm/test-unequal.py b/apps/tests/TestSimComm/test-unequal.py index 8b2da5fa..a5bcc1e8 100644 --- a/apps/tests/TestSimComm/test-unequal.py +++ b/apps/tests/TestSimComm/test-unequal.py @@ -42,7 +42,7 @@ m1.createNoiseModel() m2.createNoiseModel() m3.createNoiseModel() -for i in range(0, 1000000): +for i in range(0, 200000): t.runNextEvent(); diff --git a/apps/tests/TestSimTimers/README b/apps/tests/TestSimTimers/README index 3f25018c..65f8f369 100644 --- a/apps/tests/TestSimTimers/README +++ b/apps/tests/TestSimTimers/README @@ -23,10 +23,14 @@ DEBUG (0): Timer A is good @ 0:10:1.837925167. DEBUG (0): Timer A is good @ 0:10:2.837925167. DEBUG (0): Timer A is good @ 0:10:3.837925167. -If there is a timer bug, then the output will read +If a timer is off, then the output will read DEBUG (0): Timer A is off. Should have fired in X, fired in Y @ Z. +Note that if a timer is off by 1, the timer is still operating +correctly. The way the atm128 counter registers work mean that you +can't schedule very short timers, so sometimes the code needs to +make it one tick longer. Tools: diff --git a/apps/tests/TestTrickleTimer/TestTrickleTimerAppC.nc b/apps/tests/TestTrickleTimer/TestTrickleTimerAppC.nc index b2e3f776..ca39ca08 100644 --- a/apps/tests/TestTrickleTimer/TestTrickleTimerAppC.nc +++ b/apps/tests/TestTrickleTimer/TestTrickleTimerAppC.nc @@ -39,7 +39,7 @@ implementation { components new TimerMilliC(); components new BitVectorC(1) as PendingVector; components new BitVectorC(1) as ChangeVector; - + // Timer.Timer -> TimerMilliC; //Timer.Random -> RandomC; //Timer.Changed -> ChangeVector; @@ -52,7 +52,7 @@ implementation { TestTrickleTimerAppP.TimerB -> TimerB; TestTrickleTimerAppP.TimerC -> TimerC; TestTrickleTimerAppP.TimerD -> TimerD; - + TestTrickleTimerAppP.Random -> RandomC; } diff --git a/apps/tests/TestTrickleTimer/TestTrickleTimerAppP.nc b/apps/tests/TestTrickleTimer/TestTrickleTimerAppP.nc index 35d87277..0b456e97 100644 --- a/apps/tests/TestTrickleTimer/TestTrickleTimerAppP.nc +++ b/apps/tests/TestTrickleTimer/TestTrickleTimerAppP.nc @@ -36,6 +36,7 @@ module TestTrickleTimerAppP { interface TrickleTimer as TimerB; interface TrickleTimer as TimerC; interface TrickleTimer as TimerD; + interface Random; } } implementation { @@ -82,17 +83,17 @@ implementation { } } - uint8_t i = 0; + uint16_t i = 0; event void TimerD.fired() { dbg("TestTrickle", "Timer D fired at %s\n", sim_time_string()); - i++; - i = i % 3; + i = call Random.rand16(); + i = i % 4; switch (i) { case 0: - // call TimerA.reset(); + call TimerA.reset(); break; case 1: - // call TimerB.reset(); + call TimerB.reset(); break; case 2: call TimerC.reset(); diff --git a/apps/tests/TestTrickleTimer/test.py b/apps/tests/TestTrickleTimer/test.py index 9523a3fc..549f8b82 100644 --- a/apps/tests/TestTrickleTimer/test.py +++ b/apps/tests/TestTrickleTimer/test.py @@ -5,11 +5,11 @@ t = Tossim([]); t.init() t.addChannel("Trickle", sys.stdout); -for i in range(0, 10): +for i in range(0, 1): m = t.getNode(i) m.bootAtTime(i * 5023211 + 10002322) -for i in range(0, 100): +for i in range(0, 1000000): t.runNextEvent() diff --git a/apps/tests/arbiters/TestFcfsArbiter/README.txt b/apps/tests/arbiters/TestFcfsArbiter/README.txt index 0ef3d460..61658d38 100644 --- a/apps/tests/arbiters/TestFcfsArbiter/README.txt +++ b/apps/tests/arbiters/TestFcfsArbiter/README.txt @@ -1,6 +1,6 @@ README for TestFcfsArbiter Author/Contact: tinyos-help@millennium.berkeley.edu -@author Kevin Klues +@author Kevin Klues Description: diff --git a/apps/tests/arbiters/TestFcfsArbiter/TestFcfsArbiterAppC.nc b/apps/tests/arbiters/TestFcfsArbiter/TestFcfsArbiterAppC.nc index aa897643..6f949eb3 100644 --- a/apps/tests/arbiters/TestFcfsArbiter/TestFcfsArbiterAppC.nc +++ b/apps/tests/arbiters/TestFcfsArbiter/TestFcfsArbiterAppC.nc @@ -54,7 +54,7 @@ *
  • Led 2 -> Resource 2 *
    * - * @author Kevin Klues + * @author Kevin Klues * @version $Revision$ * @date $Date$ */ diff --git a/apps/tests/arbiters/TestFcfsArbiter/TestFcfsArbiterC.nc b/apps/tests/arbiters/TestFcfsArbiter/TestFcfsArbiterC.nc index 8a093088..46005bdb 100644 --- a/apps/tests/arbiters/TestFcfsArbiter/TestFcfsArbiterC.nc +++ b/apps/tests/arbiters/TestFcfsArbiter/TestFcfsArbiterC.nc @@ -56,7 +56,7 @@ *
  • Led 2 -> Resource 2 *
    * - * @author Kevin Klues + * @author Kevin Klues * @version $Revision$ * @date $Date$ */ diff --git a/apps/tests/arbiters/TestRoundRobinArbiter/README.txt b/apps/tests/arbiters/TestRoundRobinArbiter/README.txt index 3b42da3b..85a589d1 100644 --- a/apps/tests/arbiters/TestRoundRobinArbiter/README.txt +++ b/apps/tests/arbiters/TestRoundRobinArbiter/README.txt @@ -1,6 +1,6 @@ README for TestRoundRobinArbiter Author/Contact: tinyos-help@millennium.berkeley.edu -@author Kevin Klues +@author Kevin Klues Description: diff --git a/apps/tests/arbiters/TestRoundRobinArbiter/TestRoundRobinArbiterAppC.nc b/apps/tests/arbiters/TestRoundRobinArbiter/TestRoundRobinArbiterAppC.nc index 593fea7b..7d6b5618 100644 --- a/apps/tests/arbiters/TestRoundRobinArbiter/TestRoundRobinArbiterAppC.nc +++ b/apps/tests/arbiters/TestRoundRobinArbiter/TestRoundRobinArbiterAppC.nc @@ -54,7 +54,7 @@ *
  • Led 2 -> Resource 2 *
    * - * @author Kevin Klues + * @author Kevin Klues * @version $Revision$ * @date $Date$ */ diff --git a/apps/tests/arbiters/TestRoundRobinArbiter/TestRoundRobinArbiterC.nc b/apps/tests/arbiters/TestRoundRobinArbiter/TestRoundRobinArbiterC.nc index de621148..cf7cbf4a 100644 --- a/apps/tests/arbiters/TestRoundRobinArbiter/TestRoundRobinArbiterC.nc +++ b/apps/tests/arbiters/TestRoundRobinArbiter/TestRoundRobinArbiterC.nc @@ -56,7 +56,7 @@ *
  • Led 2 -> Resource 2 *
    * - * @author Kevin Klues + * @author Kevin Klues * @version $Revision$ * @date $Date$ */ diff --git a/apps/tests/cc2420/LplBroadcastCountToLeds/Makefile b/apps/tests/cc2420/LplBroadcastCountToLeds/Makefile index 6e62a379..139d6aea 100644 --- a/apps/tests/cc2420/LplBroadcastCountToLeds/Makefile +++ b/apps/tests/cc2420/LplBroadcastCountToLeds/Makefile @@ -4,6 +4,7 @@ CFLAGS += -DACK_LOW_POWER_LISTENING #CFLAGS += -DNOACK_LOW_POWER_LISTENING BUILD_EXTRA_DEPS = RadioCountMsg.py RadioCountMsg.class +CLEAN_EXTRA = *.class *.pyc RadioCountMsg.py RadioCountMsg.java RadioCountMsg.py: RadioCountToLeds.h mig python -target=$(PLATFORM) $(CFLAGS) -python-classname=RadioCountMsg RadioCountToLeds.h radio_count_msg -o $@ diff --git a/apps/tests/cc2420/LplBroadcastCountToLeds/RadioCountMsg.java b/apps/tests/cc2420/LplBroadcastCountToLeds/RadioCountMsg.java deleted file mode 100644 index 46f7c7a0..00000000 --- a/apps/tests/cc2420/LplBroadcastCountToLeds/RadioCountMsg.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * This class is automatically generated by mig. DO NOT EDIT THIS FILE. - * This class implements a Java interface to the 'RadioCountMsg' - * message type. - */ - -public class RadioCountMsg extends net.tinyos.message.Message { - - /** The default size of this message type in bytes. */ - public static final int DEFAULT_MESSAGE_SIZE = 2; - - /** The Active Message type associated with this message. */ - public static final int AM_TYPE = 134; - - /** Create a new RadioCountMsg of size 2. */ - public RadioCountMsg() { - super(DEFAULT_MESSAGE_SIZE); - amTypeSet(AM_TYPE); - } - - /** Create a new RadioCountMsg of the given data_length. */ - public RadioCountMsg(int data_length) { - super(data_length); - amTypeSet(AM_TYPE); - } - - /** - * Create a new RadioCountMsg with the given data_length - * and base offset. - */ - public RadioCountMsg(int data_length, int base_offset) { - super(data_length, base_offset); - amTypeSet(AM_TYPE); - } - - /** - * Create a new RadioCountMsg using the given byte array - * as backing store. - */ - public RadioCountMsg(byte[] data) { - super(data); - amTypeSet(AM_TYPE); - } - - /** - * Create a new RadioCountMsg using the given byte array - * as backing store, with the given base offset. - */ - public RadioCountMsg(byte[] data, int base_offset) { - super(data, base_offset); - amTypeSet(AM_TYPE); - } - - /** - * Create a new RadioCountMsg using the given byte array - * as backing store, with the given base offset and data length. - */ - public RadioCountMsg(byte[] data, int base_offset, int data_length) { - super(data, base_offset, data_length); - amTypeSet(AM_TYPE); - } - - /** - * Create a new RadioCountMsg embedded in the given message - * at the given base offset. - */ - public RadioCountMsg(net.tinyos.message.Message msg, int base_offset) { - super(msg, base_offset, DEFAULT_MESSAGE_SIZE); - amTypeSet(AM_TYPE); - } - - /** - * Create a new RadioCountMsg embedded in the given message - * at the given base offset and length. - */ - public RadioCountMsg(net.tinyos.message.Message msg, int base_offset, int data_length) { - super(msg, base_offset, data_length); - amTypeSet(AM_TYPE); - } - - /** - /* Return a String representation of this message. Includes the - * message type name and the non-indexed field values. - */ - public String toString() { - String s = "Message \n"; - try { - s += " [counter=0x"+Long.toHexString(get_counter())+"]\n"; - } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } - return s; - } - - // Message-type-specific access methods appear below. - - ///////////////////////////////////////////////////////// - // Accessor methods for field: counter - // Field type: int, unsigned - // Offset (bits): 0 - // Size (bits): 16 - ///////////////////////////////////////////////////////// - - /** - * Return whether the field 'counter' is signed (false). - */ - public static boolean isSigned_counter() { - return false; - } - - /** - * Return whether the field 'counter' is an array (false). - */ - public static boolean isArray_counter() { - return false; - } - - /** - * Return the offset (in bytes) of the field 'counter' - */ - public static int offset_counter() { - return (0 / 8); - } - - /** - * Return the offset (in bits) of the field 'counter' - */ - public static int offsetBits_counter() { - return 0; - } - - /** - * Return the value (as a int) of the field 'counter' - */ - public int get_counter() { - return (int)getUIntBEElement(offsetBits_counter(), 16); - } - - /** - * Set the value of the field 'counter' - */ - public void set_counter(int value) { - setUIntBEElement(offsetBits_counter(), 16, value); - } - - /** - * Return the size, in bytes, of the field 'counter' - */ - public static int size_counter() { - return (16 / 8); - } - - /** - * Return the size, in bits, of the field 'counter' - */ - public static int sizeBits_counter() { - return 16; - } - -} diff --git a/apps/tests/cc2420/LplBroadcastCountToLeds/RadioCountToLedsAppC.nc b/apps/tests/cc2420/LplBroadcastCountToLeds/RadioCountToLedsAppC.nc index 7e33328f..20f16ebc 100644 --- a/apps/tests/cc2420/LplBroadcastCountToLeds/RadioCountToLedsAppC.nc +++ b/apps/tests/cc2420/LplBroadcastCountToLeds/RadioCountToLedsAppC.nc @@ -49,7 +49,7 @@ implementation { #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT) components CC1000ActiveMessageC as LplC; -#elif defined(PLATFORM_MICAZ) || defined(PLATFORM_TELOSB) || defined(PLATFORM_SHIMMER) || defined(PLATFORM_INTELMOTE2) +#elif defined(PLATFORM_MICAZ) || defined(PLATFORM_TELOSB) || defined(PLATFORM_SHIMMER) || defined(PLATFORM_SHIMMER2) || defined(PLATFORM_INTELMOTE2) || defined(PLATFORM_EPIC) components CC2420ActiveMessageC as LplC; #else #error "LPL testing not supported on this platform" diff --git a/apps/tests/cc2420/LplBroadcastCountToLeds/RadioCountToLedsC.nc b/apps/tests/cc2420/LplBroadcastCountToLeds/RadioCountToLedsC.nc index 71fd0279..96205b7c 100644 --- a/apps/tests/cc2420/LplBroadcastCountToLeds/RadioCountToLedsC.nc +++ b/apps/tests/cc2420/LplBroadcastCountToLeds/RadioCountToLedsC.nc @@ -71,7 +71,7 @@ implementation { event void AMControl.startDone(error_t err) { if (err == SUCCESS) { // Note we can setup LPL before or after the radio turns on - call LowPowerListening.setLocalSleepInterval(1000); + call LowPowerListening.setLocalWakeupInterval(1000); call MilliTimer.startOneShot(1500); } else { @@ -96,7 +96,7 @@ implementation { } rcm->counter = counter; - call LowPowerListening.setRxSleepInterval(&packet, 1000); + call LowPowerListening.setRemoteWakeupInterval(&packet, 1000); if (call AMSend.send(AM_BROADCAST_ADDR, &packet, sizeof(radio_count_msg_t)) == SUCCESS) { dbg("RadioCountToLedsC", "RadioCountToLedsC: packet sent.\n", counter); locked = TRUE; diff --git a/apps/tests/cc2420/LplBroadcastPeriodicDelivery/README.txt b/apps/tests/cc2420/LplBroadcastPeriodicDelivery/README.txt index 0733e605..9dbe0ba0 100644 --- a/apps/tests/cc2420/LplBroadcastPeriodicDelivery/README.txt +++ b/apps/tests/cc2420/LplBroadcastPeriodicDelivery/README.txt @@ -7,6 +7,9 @@ Install the application to two nodes with the following ID's: Node 0 (Receiver node): id = 0 Node 1 (Transmitter node): id = 1 +Do this at compile time by adding the flag NODEID=, thus: + +make NODEID= ... This app sends a message from Transmitter node to AM_BROADCAST_ADDR and waits 1000 ms between each diff --git a/apps/tests/cc2420/LplBroadcastPeriodicDelivery/TestPeriodicAppC.nc b/apps/tests/cc2420/LplBroadcastPeriodicDelivery/TestPeriodicAppC.nc index 749d1655..fee5d28a 100644 --- a/apps/tests/cc2420/LplBroadcastPeriodicDelivery/TestPeriodicAppC.nc +++ b/apps/tests/cc2420/LplBroadcastPeriodicDelivery/TestPeriodicAppC.nc @@ -48,7 +48,7 @@ implementation { #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT) components CC1000ActiveMessageC as Lpl; -#elif defined(PLATFORM_MICAZ) || defined(PLATFORM_TELOSB) || defined(PLATFORM_SHIMMER) || defined(PLATFORM_INTELMOTE2) +#elif defined(PLATFORM_MICAZ) || defined(PLATFORM_TELOSB) || defined(PLATFORM_SHIMMER) || defined(PLATFORM_SHIMMER2) || defined(PLATFORM_INTELMOTE2) || defined(PLATFORM_EPIC) components CC2420ActiveMessageC as Lpl; #else #error "LPL testing not supported on this platform" diff --git a/apps/tests/cc2420/LplBroadcastPeriodicDelivery/TestPeriodicC.nc b/apps/tests/cc2420/LplBroadcastPeriodicDelivery/TestPeriodicC.nc index dab737a8..9e7dfff9 100644 --- a/apps/tests/cc2420/LplBroadcastPeriodicDelivery/TestPeriodicC.nc +++ b/apps/tests/cc2420/LplBroadcastPeriodicDelivery/TestPeriodicC.nc @@ -71,7 +71,7 @@ implementation { transmitter = (call AMPacket.address() == 1); count = 0; - call LowPowerListening.setLocalSleepInterval(1000); + call LowPowerListening.setLocalWakeupInterval(1000); call SplitControl.start(); } @@ -124,7 +124,7 @@ implementation { task void send() { TestPeriodicMsg *periodicMsg = (TestPeriodicMsg *) call Packet.getPayload(&fullMsg, sizeof(TestPeriodicMsg)); periodicMsg->count = count; - call LowPowerListening.setRxSleepInterval(&fullMsg, 1000); + call LowPowerListening.setRemoteWakeupInterval(&fullMsg, 1000); if(call AMSend.send(AM_BROADCAST_ADDR, &fullMsg, sizeof(TestPeriodicMsg)) != SUCCESS) { post send(); } else { diff --git a/apps/tests/cc2420/LplUnicastPeriodicDelivery/TestPeriodicAppC.nc b/apps/tests/cc2420/LplUnicastPeriodicDelivery/TestPeriodicAppC.nc index d68ac003..dd6c18f6 100644 --- a/apps/tests/cc2420/LplUnicastPeriodicDelivery/TestPeriodicAppC.nc +++ b/apps/tests/cc2420/LplUnicastPeriodicDelivery/TestPeriodicAppC.nc @@ -48,7 +48,7 @@ implementation { #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT) components CC1000ActiveMessageC as Lpl; -#elif defined(PLATFORM_MICAZ) || defined(PLATFORM_TELOSB) || defined(PLATFORM_SHIMMER) || defined(PLATFORM_INTELMOTE2) +#elif defined(PLATFORM_MICAZ) || defined(PLATFORM_TELOSB) || defined(PLATFORM_SHIMMER) || defined(PLATFORM_SHIMMER2) || defined(PLATFORM_INTELMOTE2) || defined(PLATFORM_EPIC) components CC2420ActiveMessageC as Lpl; #else #error "LPL testing not supported on this platform" diff --git a/apps/tests/cc2420/LplUnicastPeriodicDelivery/TestPeriodicC.nc b/apps/tests/cc2420/LplUnicastPeriodicDelivery/TestPeriodicC.nc index 59d3b881..4ecce836 100644 --- a/apps/tests/cc2420/LplUnicastPeriodicDelivery/TestPeriodicC.nc +++ b/apps/tests/cc2420/LplUnicastPeriodicDelivery/TestPeriodicC.nc @@ -69,7 +69,7 @@ implementation { transmitter = (call AMPacket.address() != 0); count = 0; - call LowPowerListening.setLocalSleepInterval(1000); + call LowPowerListening.setLocalWakeupInterval(1000); call SplitControl.start(); } @@ -110,7 +110,7 @@ implementation { task void send() { TestPeriodicMsg *periodicMsg = (TestPeriodicMsg *) call Packet.getPayload(&fullMsg, sizeof(TestPeriodicMsg)); periodicMsg->count = count; - call LowPowerListening.setRxSleepInterval(&fullMsg, 1000); + call LowPowerListening.setRemoteWakeupInterval(&fullMsg, 1000); if(call AMSend.send(0, &fullMsg, sizeof(TestPeriodicMsg)) != SUCCESS) { post send(); } else { diff --git a/apps/tests/cc2420/RssiToSerial/Makefile b/apps/tests/cc2420/RssiToSerial/Makefile index 887e5f9c..8e1faddf 100644 --- a/apps/tests/cc2420/RssiToSerial/Makefile +++ b/apps/tests/cc2420/RssiToSerial/Makefile @@ -1,6 +1,6 @@ COMPONENT=RssiToSerialC - BUILD_EXTRA_DEPS = RssiSerialMsg.java SpecAnalyzer.class +CLEAN_EXTRA = *.class RssiSerialMsg.java RssiSerialMsg.java: RssiToSerial.h mig java -target=$(PLATFORM) $(CFLAGS) -java-classname=RssiSerialMsg RssiToSerial.h rssi_serial_msg -o $@ diff --git a/apps/tests/cc2420/TestPacketLink/Makefile b/apps/tests/cc2420/TestPacketLink/Makefile index fdf318a1..b1ca74d0 100644 --- a/apps/tests/cc2420/TestPacketLink/Makefile +++ b/apps/tests/cc2420/TestPacketLink/Makefile @@ -1,8 +1,7 @@ COMPONENT=TestPacketLinkC - CFLAGS += -DPACKET_LINK - BUILD_EXTRA_DEPS = PacketLinkMsg.java TestPacketLink.class +CLEAN_EXTRA = *.class PacketLinkMsg.java PacketLinkMsg.java: TestPacketLink.h mig java -target=$(PLATFORM) $(CFLAGS) -java-classname=PacketLinkMsg TestPacketLink.h PacketLinkMsg -o $@ diff --git a/apps/tests/cc2420/TestPacketLink/README.txt b/apps/tests/cc2420/TestPacketLink/README.txt index 4c291ba1..2a82684a 100644 --- a/apps/tests/cc2420/TestPacketLink/README.txt +++ b/apps/tests/cc2420/TestPacketLink/README.txt @@ -29,7 +29,7 @@ Tools: java TestPacketLink [-comm ] - If not specified, the defaults to sf@localhost:9001 or + If not specified, the defaults to sf@localhost:9002 or to your MOTECOM environment variable (if defined). This application will report dropped and duplicate packets as seen on diff --git a/apps/tests/cc2420/TestSecurity/BaseStation/BaseStationC.nc b/apps/tests/cc2420/TestSecurity/BaseStation/BaseStationC.nc new file mode 100644 index 00000000..c14e7277 --- /dev/null +++ b/apps/tests/cc2420/TestSecurity/BaseStation/BaseStationC.nc @@ -0,0 +1,92 @@ +// $Id$ + +/* tab:4 + * "Copyright (c) 2000-2003 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +/** + * The TinyOS 2.x base station that forwards packets between the UART + * and radio.It replaces the GenericBase of TinyOS 1.0 and the + * TOSBase of TinyOS 1.1. + * + *

    On the serial link, BaseStation sends and receives simple active + * messages (not particular radio packets): on the radio link, it + * sends radio active messages, whose format depends on the network + * stack being used. BaseStation will copy its compiled-in group ID to + * messages moving from the serial link to the radio, and will filter + * out incoming radio messages that do not contain that group ID.

    + * + *

    BaseStation includes queues in both directions, with a guarantee + * that once a message enters a queue, it will eventually leave on the + * other interface. The queues allow the BaseStation to handle load + * spikes.

    + * + *

    BaseStation acknowledges a message arriving over the serial link + * only if that message was successfully enqueued for delivery to the + * radio link.

    + * + *

    The LEDS are programmed to toggle as follows:

    + *
      + *
    • RED Toggle:: Message bridged from serial to radio
    • + *
    • GREEN Toggle: Message bridged from radio to serial
    • + *
    • YELLOW/BLUE Toggle: Dropped message due to queue overflow in either direction
    • + *
    + * + * @author Phil Buonadonna + * @author Gilman Tolle + * @author David Gay + * @author Philip Levis + * @date August 10 2005 + */ + +configuration BaseStationC { +} +implementation { + components MainC, BaseStationP, LedsC; + components ActiveMessageC as Radio, SerialActiveMessageC as Serial; + components CC2420KeysC; + + MainC.Boot <- BaseStationP; + + BaseStationP.RadioControl -> Radio; + BaseStationP.SerialControl -> Serial; + + BaseStationP.UartSend -> Serial; + BaseStationP.UartReceive -> Serial.Receive; + BaseStationP.UartPacket -> Serial; + BaseStationP.UartAMPacket -> Serial; + + BaseStationP.RadioSend -> Radio; + BaseStationP.RadioReceive -> Radio.Receive; + BaseStationP.RadioSnoop -> Radio.Snoop; + BaseStationP.RadioPacket -> Radio; + BaseStationP.RadioAMPacket -> Radio; + + BaseStationP.Leds -> LedsC; + BaseStationP.CC2420Keys -> CC2420KeysC; +} diff --git a/apps/tests/cc2420/TestSecurity/BaseStation/BaseStationP.nc b/apps/tests/cc2420/TestSecurity/BaseStation/BaseStationP.nc new file mode 100644 index 00000000..7dfd3ebc --- /dev/null +++ b/apps/tests/cc2420/TestSecurity/BaseStation/BaseStationP.nc @@ -0,0 +1,307 @@ +// $Id$ + +/* tab:4 + * "Copyright (c) 2000-2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2005 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +/* + * @author Phil Buonadonna + * @author Gilman Tolle + * @author David Gay + * Revision: $Id$ + */ + +/* + * BaseStationP bridges packets between a serial channel and the radio. + * Messages moving from serial to radio will be tagged with the group + * ID compiled into the TOSBase, and messages moving from radio to + * serial will be filtered by that same group id. + */ + +#include "AM.h" +#include "Serial.h" + +module BaseStationP @safe() { + uses { + interface Boot; + interface SplitControl as SerialControl; + interface SplitControl as RadioControl; + + interface AMSend as UartSend[am_id_t id]; + interface Receive as UartReceive[am_id_t id]; + interface Packet as UartPacket; + interface AMPacket as UartAMPacket; + + interface AMSend as RadioSend[am_id_t id]; + interface Receive as RadioReceive[am_id_t id]; + interface Receive as RadioSnoop[am_id_t id]; + interface Packet as RadioPacket; + interface AMPacket as RadioAMPacket; + + interface CC2420Keys; + + interface Leds; + } +} + +implementation +{ + enum { + UART_QUEUE_LEN = 12, + RADIO_QUEUE_LEN = 12, + }; + + message_t uartQueueBufs[UART_QUEUE_LEN]; + message_t * ONE_NOK uartQueue[UART_QUEUE_LEN]; + uint8_t uartIn, uartOut; + bool uartBusy, uartFull; + + message_t radioQueueBufs[RADIO_QUEUE_LEN]; + message_t * ONE_NOK radioQueue[RADIO_QUEUE_LEN]; + uint8_t radioIn, radioOut; + bool radioBusy, radioFull; + + uint8_t key[16] = {0x98,0x67,0x7F,0xAF,0xD6,0xAD,0xB7,0x0C,0x59,0xE8,0xD9,0x47,0xC9,0x71,0x15,0x0F}; + + task void uartSendTask(); + task void radioSendTask(); + + void dropBlink() { + call Leds.led2Toggle(); + } + + void failBlink() { + call Leds.led2Toggle(); + } + + event void Boot.booted() { + uint8_t i; + + for (i = 0; i < UART_QUEUE_LEN; i++) + uartQueue[i] = &uartQueueBufs[i]; + uartIn = uartOut = 0; + uartBusy = FALSE; + uartFull = TRUE; + + for (i = 0; i < RADIO_QUEUE_LEN; i++) + radioQueue[i] = &radioQueueBufs[i]; + radioIn = radioOut = 0; + radioBusy = FALSE; + radioFull = TRUE; + + call RadioControl.start(); + call SerialControl.start(); + } + + event void RadioControl.startDone(error_t error) { + if (error == SUCCESS) { + radioFull = FALSE; + call CC2420Keys.setKey(1, key); + } + } + + event void SerialControl.startDone(error_t error) { + if (error == SUCCESS) { + uartFull = FALSE; + } + } + + event void SerialControl.stopDone(error_t error) {} + event void RadioControl.stopDone(error_t error) {} + + event void CC2420Keys.setKeyDone(uint8_t keyNo, uint8_t* skey) {} + + uint8_t count = 0; + + message_t* ONE receive(message_t* ONE msg, void* payload, uint8_t len); + + event message_t *RadioSnoop.receive[am_id_t id](message_t *msg, + void *payload, + uint8_t len) { + return receive(msg, payload, len); + } + + event message_t *RadioReceive.receive[am_id_t id](message_t *msg, + void *payload, + uint8_t len) { + return receive(msg, payload, len); + } + + message_t* receive(message_t *msg, void *payload, uint8_t len) { + message_t *ret = msg; + + atomic { + if (!uartFull) + { + ret = uartQueue[uartIn]; + uartQueue[uartIn] = msg; + + uartIn = (uartIn + 1) % UART_QUEUE_LEN; + + if (uartIn == uartOut) + uartFull = TRUE; + + if (!uartBusy) + { + post uartSendTask(); + uartBusy = TRUE; + } + } + else + dropBlink(); + } + + return ret; + } + + uint8_t tmpLen; + + task void uartSendTask() { + uint8_t len; + am_id_t id; + am_addr_t addr, src; + message_t* msg; + atomic + if (uartIn == uartOut && !uartFull) + { + uartBusy = FALSE; + return; + } + + msg = uartQueue[uartOut]; + tmpLen = len = call RadioPacket.payloadLength(msg); + id = call RadioAMPacket.type(msg); + addr = call RadioAMPacket.destination(msg); + src = call RadioAMPacket.source(msg); + call UartPacket.clear(msg); + call UartAMPacket.setSource(msg, src); + + if (call UartSend.send[id](addr, uartQueue[uartOut], len) == SUCCESS) + call Leds.led1Toggle(); + else + { + failBlink(); + post uartSendTask(); + } + } + + event void UartSend.sendDone[am_id_t id](message_t* msg, error_t error) { + if (error != SUCCESS) + failBlink(); + else + atomic + if (msg == uartQueue[uartOut]) + { + if (++uartOut >= UART_QUEUE_LEN) + uartOut = 0; + if (uartFull) + uartFull = FALSE; + } + post uartSendTask(); + } + + event message_t *UartReceive.receive[am_id_t id](message_t *msg, + void *payload, + uint8_t len) { + message_t *ret = msg; + bool reflectToken = FALSE; + + atomic + if (!radioFull) + { + reflectToken = TRUE; + ret = radioQueue[radioIn]; + radioQueue[radioIn] = msg; + if (++radioIn >= RADIO_QUEUE_LEN) + radioIn = 0; + if (radioIn == radioOut) + radioFull = TRUE; + + if (!radioBusy) + { + post radioSendTask(); + radioBusy = TRUE; + } + } + else + dropBlink(); + + if (reflectToken) { + //call UartTokenReceive.ReflectToken(Token); + } + + return ret; + } + + task void radioSendTask() { + uint8_t len; + am_id_t id; + am_addr_t addr,source; + message_t* msg; + + atomic + if (radioIn == radioOut && !radioFull) + { + radioBusy = FALSE; + return; + } + + msg = radioQueue[radioOut]; + len = call UartPacket.payloadLength(msg); + addr = call UartAMPacket.destination(msg); + source = call UartAMPacket.source(msg); + id = call UartAMPacket.type(msg); + + call RadioPacket.clear(msg); + call RadioAMPacket.setSource(msg, source); + + if (call RadioSend.send[id](addr, msg, len) == SUCCESS) + call Leds.led0Toggle(); + else + { + failBlink(); + post radioSendTask(); + } + } + + event void RadioSend.sendDone[am_id_t id](message_t* msg, error_t error) { + if (error != SUCCESS) + failBlink(); + else + atomic + if (msg == radioQueue[radioOut]) + { + if (++radioOut >= RADIO_QUEUE_LEN) + radioOut = 0; + if (radioFull) + radioFull = FALSE; + } + + post radioSendTask(); + } +} diff --git a/apps/tests/cc2420/TestSecurity/BaseStation/Makefile b/apps/tests/cc2420/TestSecurity/BaseStation/Makefile new file mode 100644 index 00000000..0015d833 --- /dev/null +++ b/apps/tests/cc2420/TestSecurity/BaseStation/Makefile @@ -0,0 +1,8 @@ +COMPONENT=BaseStationC +CFLAGS += -DCC2420_NO_ACKNOWLEDGEMENTS +CFLAGS += -DCC2420_NO_ADDRESS_RECOGNITION +CFLAGS += -DCC2420_HW_SECURITY +CFLAGS += -DTOSH_DATA_LENGTH=115 +CFLAGS += -DTASKLET_IS_TASK +include $(MAKERULES) + diff --git a/apps/tests/cc2420/TestSecurity/README.txt b/apps/tests/cc2420/TestSecurity/README.txt new file mode 100644 index 00000000..84fbc2cc --- /dev/null +++ b/apps/tests/cc2420/TestSecurity/README.txt @@ -0,0 +1,49 @@ +README for TestSecurity + +Author/Contact: +JeongGil Ko +Razvan Musaloiu-E. +Jong Hyun Lim + +Description: + +Test the CC2420 hardware security support + + +Applications: + +1. RadioCountToLeds1/ + +This application is a modification to the RadioCountToLeds/ +application with CC2420 security features added to outgoing +packets. The packets are decrypted at the receiver node. + +> INSTALL + +Compile one node with ID 1 as the transmitter and other nodes with any +node IDs to receive the decrypted packets + +>EXPECTATIONS + +LEDs on the receiver nodes will blink their LEDs sequentially like the +original RadioCountToLeds/ application. The LEDs on the transmitter +will stay off. + + +2. Basestation/ + +The BaseStation application with the security extensions + +> INSTALL + +Follow instructions on apps/BaseStation/README.txt + +> EXPECTATIONS + +Identical to the expectations in apps/BaseStation/README.txt + + + +Known bugs/limitations: + +None. diff --git a/apps/tests/cc2420/TestSecurity/RadioCountToLeds1/Makefile b/apps/tests/cc2420/TestSecurity/RadioCountToLeds1/Makefile new file mode 100644 index 00000000..710ea3d4 --- /dev/null +++ b/apps/tests/cc2420/TestSecurity/RadioCountToLeds1/Makefile @@ -0,0 +1,8 @@ +COMPONENT=RadioCountToLedsAppC +CFLAGS+=-DCC2420_HW_ACKNOWLEDGEMENTS +CFLAGS+=-DCC2420_HW_SECURITY +#CFLAGS+=-DCC2420_DEF_CHANNEL=25 +CFLAGS+=-DPACKET_LINK +CFLAGS+=-DTOSH_DATA_LENGTH=115 +#CFLAGS+=-I%T/lib/printf +include $(MAKERULES) diff --git a/apps/tests/cc2420/TestSecurity/RadioCountToLeds1/RadioCountToLeds.h b/apps/tests/cc2420/TestSecurity/RadioCountToLeds1/RadioCountToLeds.h new file mode 100644 index 00000000..404470df --- /dev/null +++ b/apps/tests/cc2420/TestSecurity/RadioCountToLeds1/RadioCountToLeds.h @@ -0,0 +1,42 @@ +/* + * "Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +#ifndef RADIO_COUNT_TO_LEDS_H +#define RADIO_COUNT_TO_LEDS_H + +typedef nx_struct radio_count_msg { + nx_uint16_t counter; + nx_uint16_t counter2[20]; +} radio_count_msg_t; + +enum { + AM_RADIO_COUNT_MSG = 6, +}; + +#endif diff --git a/apps/tests/cc2420/TestSecurity/RadioCountToLeds1/RadioCountToLedsAppC.nc b/apps/tests/cc2420/TestSecurity/RadioCountToLeds1/RadioCountToLedsAppC.nc new file mode 100644 index 00000000..9d7ceb8c --- /dev/null +++ b/apps/tests/cc2420/TestSecurity/RadioCountToLeds1/RadioCountToLedsAppC.nc @@ -0,0 +1,64 @@ +/* + * "Copyright (c) 2000-2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +#include "RadioCountToLeds.h" + +/** + * Configuration for the RadioCountToLeds application. RadioCountToLeds + * maintains a 4Hz counter, broadcasting its value in an AM packet + * every time it gets updated. A RadioCountToLeds node that hears a counter + * displays the bottom three bits on its LEDs. This application is a useful + * test to show that basic AM communication and timers work. + * + * @author Philip Levis + * @date June 6 2005 + */ + +configuration RadioCountToLedsAppC {} +implementation { + components MainC, RadioCountToLedsC as App, LedsC, NoLedsC; + components new SecAMSenderC(AM_RADIO_COUNT_MSG) as AMSenderC; + components new AMReceiverC(AM_RADIO_COUNT_MSG); + components new TimerMilliC(); + components CC2420KeysC; + components ActiveMessageC; + + App.Boot -> MainC.Boot; + App.Receive -> AMReceiverC; + App.AMSend -> AMSenderC; + App.AMControl -> ActiveMessageC; + App.Leds -> LedsC; + App.MilliTimer -> TimerMilliC; + App.Packet -> AMSenderC; + App.CC2420Security -> AMSenderC; + App.CC2420Keys -> CC2420KeysC; + + components CC2420ActiveMessageC as Radio; + App.PacketLink -> Radio; +} diff --git a/apps/tests/cc2420/TestSecurity/RadioCountToLeds1/RadioCountToLedsC.nc b/apps/tests/cc2420/TestSecurity/RadioCountToLeds1/RadioCountToLedsC.nc new file mode 100644 index 00000000..fb6f2911 --- /dev/null +++ b/apps/tests/cc2420/TestSecurity/RadioCountToLeds1/RadioCountToLedsC.nc @@ -0,0 +1,158 @@ +/* + * "Copyright (c) 2000-2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +#include "Timer.h" +#include "RadioCountToLeds.h" +//#include "printf.h" +/** + * Implementation of the RadioCountToLeds application. RadioCountToLeds + * maintains a 4Hz counter, broadcasting its value in an AM packet + * every time it gets updated. A RadioCountToLeds node that hears a counter + * displays the bottom three bits on its LEDs. This application is a useful + * test to show that basic AM communication and timers work. + * + * @author Philip Levis + * @date June 6 2005 + */ + +module RadioCountToLedsC { + uses { + interface Leds; + interface Boot; + interface Receive; + interface AMSend; + interface Timer as MilliTimer; + interface SplitControl as AMControl; + interface Packet; + interface CC2420SecurityMode as CC2420Security; + interface CC2420Keys; + + interface PacketLink; + } +} +implementation { + + message_t packet; + uint8_t key[16] = {0x98,0x67,0x7F,0xAF,0xD6,0xAD,0xB7,0x0C,0x59,0xE8,0xD9,0x47,0xC9,0x71,0x15,0x0F}; + uint8_t keyReady = 0; // should be set to 1 when key setting is done + + bool locked; + uint16_t counter = 0; + + event void Boot.booted() + { + call AMControl.start(); + } + + event void AMControl.startDone(error_t err) + { + if (err == SUCCESS) { + call CC2420Keys.setKey(1, key); + if(TOS_NODE_ID == 1) + call MilliTimer.startPeriodic(128); + } else { + call AMControl.start(); + } + } + + event void AMControl.stopDone(error_t err) + { + } + + event void CC2420Keys.setKeyDone(uint8_t keyNo, uint8_t* skey) + { + keyReady = 1; + } + + event void MilliTimer.fired() + { + counter++; + dbg("RadioCountToLedsC", "RadioCountToLedsC: timer fired, counter is %hu.\n", counter); + if (locked) { + return; + } + else if(keyReady == 1) { + + radio_count_msg_t* rcm = (radio_count_msg_t*)call Packet.getPayload(&packet, sizeof(radio_count_msg_t)); + + if (rcm == NULL) { + return; + } + + rcm->counter = counter; + //call CC2420Security.setCtr(&packet, 0, 0); + //call CC2420Security.setCbcMac(&packet, 0, 0, 16); + call CC2420Security.setCcm(&packet, 1, 0, 16); + call PacketLink.setRetries(&packet, 3); + if (call AMSend.send(AM_BROADCAST_ADDR, &packet, sizeof(radio_count_msg_t)) == SUCCESS) { + dbg("RadioCountToLedsC", "RadioCountToLedsC: packet sent.\n", counter); + locked = TRUE; + } + } + } + + event message_t* Receive.receive(message_t* bufPtr, + void* payload, uint8_t len) + { + dbg("RadioCountToLedsC", "Received packet of length %hhu.\n", len); + if (len != sizeof(radio_count_msg_t)) {return bufPtr;} + else { + radio_count_msg_t* rcm = (radio_count_msg_t*)payload; + //printf("counter: %d len: %d\n",rcm->counter, len); + //printfflush(); + if (rcm->counter & 0x1) { + call Leds.led0On(); + } + else { + call Leds.led0Off(); + } + if (rcm->counter & 0x2) { + call Leds.led1On(); + } + else { + call Leds.led1Off(); + } + if (rcm->counter & 0x4) { + call Leds.led2On(); + } + else { + call Leds.led2Off(); + } + return bufPtr; + } + } + + event void AMSend.sendDone(message_t* msg, error_t error) + { + if (&packet == msg) { + locked = FALSE; + } + } + +} diff --git a/apps/tests/cc2420/TxThroughput/Makefile b/apps/tests/cc2420/TxThroughput/Makefile index cf72257e..bbc8e533 100644 --- a/apps/tests/cc2420/TxThroughput/Makefile +++ b/apps/tests/cc2420/TxThroughput/Makefile @@ -1,7 +1,6 @@ COMPONENT=TxThroughputC - - BUILD_EXTRA_DEPS = ThroughputMsg.py ThroughputMsg.java ThroughputMsg.class +CLEAN_EXTRA = *.class *.pyc ThroughputMsg.py ThroughputMsg.java ThroughputMsg.py: TxThroughput.h mig python -target=$(PLATFORM) $(CFLAGS) -python-classname=ThroughputMsg TxThroughput.h ThroughputMsg -o $@ diff --git a/apps/tests/deluge/Basestation/BasestationAppC.nc b/apps/tests/deluge/Basestation/BasestationAppC.nc new file mode 100644 index 00000000..4571c4a6 --- /dev/null +++ b/apps/tests/deluge/Basestation/BasestationAppC.nc @@ -0,0 +1,33 @@ +/* Copyright (c) 2007 Johns Hopkins University. +* All rights reserved. +* +* Permission to use, copy, modify, and distribute this software and its +* documentation for any purpose, without fee, and without written +* agreement is hereby granted, provided that the above copyright +* notice, the (updated) modification history and the author appear in +* all copies of this source code. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, +* OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +* THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * @author Chieh-Jan Mike Liang + * @author Razvan Musaloiu-E. + */ + +configuration BasestationAppC {} + +implementation +{ + components DelugeC; +} + diff --git a/apps/tests/deluge/Basestation/Makefile b/apps/tests/deluge/Basestation/Makefile new file mode 100644 index 00000000..6af89227 --- /dev/null +++ b/apps/tests/deluge/Basestation/Makefile @@ -0,0 +1,6 @@ +COMPONENT=BasestationAppC +BOOTLOADER=tosboot + +CFLAGS += -DDELUGE_BASESTATION + +include $(MAKERULES) diff --git a/apps/tests/deluge/Basestation/README.txt b/apps/tests/deluge/Basestation/README.txt new file mode 100644 index 00000000..28a9f643 --- /dev/null +++ b/apps/tests/deluge/Basestation/README.txt @@ -0,0 +1,22 @@ +README for apps/tests/deluge/Basestation +Author/Contact: + +Chieh-Jan Mike Liang +Razvan Musaloiu-E. + +Description: + +This is a sample application for Deluge T2. The application is similar +with GoldenImage, but it includes the basestation behavior by using +the CFLAGS=-DDELUGE_BASESTATION flag. + +For telosb the command to install the program is like this: + make telosb install bsl,/dev/ttyUSB0 + +Prerequisites: + +Python 2.4 with pySerial + +References: + +The Deluge T2 wiki page from http://docs.tinyos.net/ diff --git a/apps/tests/deluge/Basestation/volumes-at45db.xml b/apps/tests/deluge/Basestation/volumes-at45db.xml new file mode 100644 index 00000000..8b22ebe4 --- /dev/null +++ b/apps/tests/deluge/Basestation/volumes-at45db.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/apps/tests/deluge/Basestation/volumes-stm25p.xml b/apps/tests/deluge/Basestation/volumes-stm25p.xml new file mode 100644 index 00000000..4210f08a --- /dev/null +++ b/apps/tests/deluge/Basestation/volumes-stm25p.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/apps/tests/deluge/Blink/BlinkAppC.nc b/apps/tests/deluge/Blink/BlinkAppC.nc index 2189ce46..1d873c40 100644 --- a/apps/tests/deluge/Blink/BlinkAppC.nc +++ b/apps/tests/deluge/Blink/BlinkAppC.nc @@ -28,7 +28,7 @@ */ /** - * Blink is a basic application that toggles the a mote LED periodically. + * Blink is a basic application that toggles a mote's LED periodically. * It does so by starting a Timer that fires every second. It uses the * OSKI TimerMilli service to achieve this goal. * diff --git a/apps/tests/deluge/Blink/burn b/apps/tests/deluge/Blink/burn index 1e82f5d3..fa4a3b1e 100755 --- a/apps/tests/deluge/Blink/burn +++ b/apps/tests/deluge/Blink/burn @@ -1,41 +1,37 @@ #!/bin/bash -python -c ' -import sys -try: - import serial -except ImportError, e: - sys.exit(1)' - -if [[ $? != 0 ]] -then - echo "Please install PySerial first." - exit 2 -fi - TOS_DELUGE=`type -p tos-deluge` if [[ ! -x ${TOS_DELUGE} ]] ; then TOS_DELUGE=../../../../tools/tinyos/misc/tos-deluge fi -if [[ $# -ne 2 && $# -ne 3 ]]; then - echo "Usage: $0 [] " - echo " /dev/ttyUSB0" - echo " /dev/ttyUSB1" - echo " micaz, telosb or iris" +$TOS_DELUGE > /dev/null + +if [[ $? != 0 ]] +then + echo "Unable to locate tos-deluge." exit 2 fi -PPORT=$1 -CPORT=$1 -PLATFORM=$2 - -if [ $# -eq 3 ]; then - CPORT=$2 - PLATFORM=$3 +if [[ $# -ne 3 ]]; then + echo "Usage: $0 " + echo " bsl,PORT | mib510,PORT | eprb,HOST" + echo " serial@PORT:SPEED | network@HOST:PORT" + echo " micaz | telosb | iris | epic | mulle" + exit 2 fi -if [ ${PLATFORM} != 'micaz' -a ${PLATFORM} != 'telosb' -a ${PLATFORM} != 'iris' ]; then +PPORT=$1 +CPORT=$2 +PLATFORM=$3 + +if [ ${PLATFORM} != 'micaz' -a \ + ${PLATFORM} != 'telosb' -a \ + ${PLATFORM} != 'iris' -a \ + ${PLATFORM} != 'mulle' -a \ + ${PLATFORM} != 'tinynode' -a \ + ${PLATFORM} != 'epic' ] +then echo "\"${PLATFORM}\" is not a supported platform" exit 2 fi @@ -49,16 +45,7 @@ fi make clean echo ============================ Compile and load Blink ============================ -if [ $PLATFORM == 'micaz' ] -then - CFLAGS=-DDELUGE_BASESTATION make ${PLATFORM} install mib510,${PPORT} -elif [ $PLATFORM == 'telosb' ] -then - CFLAGS=-DDELUGE_BASESTATION make ${PLATFORM} install bsl,${PPORT} -elif [ $PLATFORM == 'iris' ] -then - CFLAGS=-DDELUGE_BASESTATION make ${PLATFORM} install mib510,${PPORT} -fi +CFLAGS=-DDELUGE_BASESTATION make ${PLATFORM} install ${PPORT} echo ' +-------------------------------------------------------+' @@ -74,7 +61,7 @@ echo ============================= Compile a new Blink ======================== CFLAGS=-DBLINK_REVERSE\ -DDELUGE_BASESTATION make ${PLATFORM} echo =============================== Upload the image =============================== -${TOS_DELUGE} ${CPORT} ${PLATFORM} -i 1 build/${PLATFORM}/tos_image.xml +${TOS_DELUGE} ${CPORT} -i 1 build/${PLATFORM}/tos_image.xml echo ' +----------------------------------------------------------------+' echo ' | |' @@ -91,4 +78,4 @@ echo ' +----------------------------------------------------------------+' read echo =========================== Reboot the base station ============================ -${TOS_DELUGE} ${CPORT} ${PLATFORM} -r 1 +${TOS_DELUGE} ${CPORT} -r 1 diff --git a/apps/tests/deluge/Blink/burn-net b/apps/tests/deluge/Blink/burn-net index cc146661..36f1f4cb 100755 --- a/apps/tests/deluge/Blink/burn-net +++ b/apps/tests/deluge/Blink/burn-net @@ -5,9 +5,17 @@ if [[ ! -x ${TOS_DELUGE} ]] ; then TOS_DELUGE=../../../../tools/tinyos/misc/tos-deluge fi +$TOS_DELUGE > /dev/null + +if [[ $? != 0 ]] +then + echo "Unable to locate tos-deluge." + exit 2 +fi + if [ $# -ne 2 ]; then echo "Usage: $0 " - echo " micaz, telosb or iris" + echo " micaz, telosb, iris or mulle" echo " how many motes will be used in the test" exit 2 fi @@ -15,7 +23,13 @@ fi PLATFORM=$1 NO_MOTES=$2 -if [ ${PLATFORM} != 'micaz' -a ${PLATFORM} != 'telosb' -a ${PLATFORM} != 'iris' ]; then +if [ ${PLATFORM} != 'micaz' -a \ + ${PLATFORM} != 'telosb' -a \ + ${PLATFORM} != 'iris' \ + ${PLATFORM} != 'iris' -a \ + ${PLATFORM} != 'mulle' -a \ + ${PLATFORM} != 'epic' ] +then echo "\"${PLAFTORM}\" is not a supported platform" exit 2 fi @@ -32,19 +46,10 @@ ID=0 function burn_one() { ID=`expr $ID + 1` - echo -n ">>> Please plug mote $ID and type the programming port to continue: " + echo -n ">>> Please plug mote $ID and type the programming sorce (bsl,PORT | mib510,PORT | eprb,HOST): " read PORT - if [ ${PLATFORM} == 'micaz' ] - then - CFLAGS=$1 make ${PLATFORM} install,$ID mib510,${PORT} - elif [ ${PLATFORM} == 'telosb' ] - then - CFLAGS=$1 make ${PLATFORM} install,$ID bsl,${PORT} - elif [ ${PLATFORM} == 'iris' ] - then - CFLAGS=$1 make ${PLATFORM} install,$ID mib510,${PORT} - fi + CFLAGS=$1 make ${PLATFORM} install,$ID ${PORT} } while [[ ${NO_MOTES} > 1 ]] @@ -54,9 +59,8 @@ do done echo ">>> Note: this last mote will be the basestation! <<<" burn_one -DDELUGE_BASESTATION -echo -n ">>> Please plug mote $ID and type the communication port to continue: " -read PORT -BASESTATION_PORT=$PORT +echo -n ">>> Please plug mote $ID and type the communication sorce (serial@PORT:SPEED | network@HOST:PORT) to continue: " +read CPORT echo ' +------------------------------------------------------------------------+' echo ' | |' @@ -71,7 +75,7 @@ echo ============================= Compile a new Blink ========================= CFLAGS=-DBLINK_REVERSE\ -DDELUGE_LIGHT_BASESTATION make ${PLATFORM} echo ========= Upload the new image to the external flash of the last mote ========== -${TOS_DELUGE} ${BASESTATION_PORT} ${PLATFORM} -i 1 build/${PLATFORM}/tos_image.xml +${TOS_DELUGE} ${CPORT} -i 1 build/${PLATFORM}/tos_image.xml echo ' +-----------------------------------------------------+' echo ' | |' @@ -85,7 +89,7 @@ echo ' +-----------------------------------------------------+' read echo ============================= Start dissemination ============================== -${TOS_DELUGE} ${BASESTATION_PORT} ${PLATFORM} -dr 1 +${TOS_DELUGE} ${CPORT} -dr 1 echo ' +------------------------------------------------------------+' echo ' | |' @@ -96,8 +100,11 @@ echo ' | After a mote gets the whole image he will reboot and |' echo ' | reprogram itself. If the new image contains Deluge he will |' echo ' | continue participating in dissemination. |' echo ' | |' -echo ' | In the next step the motes will be rebooted to allow the |' -echo ' | reprogramming to take place. |' +echo ' | In the next step all the motes except the basestation will |' +echo ' | be rebooted to allow the reprogramming to take place. |' +echo ' | |' +echo ' | After reboot the motes should start blinking the 3rd led |' +echo ' | (blue/yellow). |' echo ' | |' echo ' +------------------------------------------------------------+' diff --git a/apps/tests/deluge/GoldenImage/GoldenImageAppC.nc b/apps/tests/deluge/GoldenImage/GoldenImageAppC.nc index f27635f4..5847026e 100644 --- a/apps/tests/deluge/GoldenImage/GoldenImageAppC.nc +++ b/apps/tests/deluge/GoldenImage/GoldenImageAppC.nc @@ -29,5 +29,8 @@ configuration GoldenImageAppC {} implementation { components DelugeC; + components LedsC; + + DelugeC.Leds -> LedsC; } diff --git a/apps/tests/deluge/GoldenImage/Makefile b/apps/tests/deluge/GoldenImage/Makefile index caf65c10..c560f82c 100644 --- a/apps/tests/deluge/GoldenImage/Makefile +++ b/apps/tests/deluge/GoldenImage/Makefile @@ -1,7 +1,6 @@ COMPONENT=GoldenImageAppC BOOTLOADER=tosboot -#CFLAGS += -DDELUGE_BASESTATION -#CFLAGS += -DDELUGE_LIGHT_BASESTATION +CFLAGS+=-DDELUGE_LIGHT_BASESTATION include $(MAKERULES) diff --git a/apps/tests/deluge/GoldenImage/README.txt b/apps/tests/deluge/GoldenImage/README.txt index 6b2a7f64..6160096b 100644 --- a/apps/tests/deluge/GoldenImage/README.txt +++ b/apps/tests/deluge/GoldenImage/README.txt @@ -7,12 +7,9 @@ Razvan Musaloiu-E. Description: This is a sample application for Deluge T2. The application is similar -to Null, but it includes Deluge T2. - -To program a basestation (a mote which can accept images over the -serial port) you have to add CFLAGS=-DDELUGE_BASESTATION to the make -command. For telosb this might look like this: - CFLAGS=-DDELUGE_BASESTATION make telosb install bsl,/dev/ttyUSB0 +to Null, but it includes Deluge T2. The Makefile includes the +DELUGE_LIGHT_BASESTATION flag to allow the nodes to be pinged using +tos-deluge. Prerequisites: diff --git a/apps/tests/eyesIFX/RadioCountToFlash/Makefile b/apps/tests/eyesIFX/RadioCountToFlash/Makefile index 14ef6855..e98a3bc3 100644 --- a/apps/tests/eyesIFX/RadioCountToFlash/Makefile +++ b/apps/tests/eyesIFX/RadioCountToFlash/Makefile @@ -1,5 +1,6 @@ COMPONENT=RadioCountToFlashAppC BUILD_EXTRA_DEPS = RadioCountMsg.py RadioCountMsg.class +CLEAN_EXTRA = *.class RadioCountMsg.py RadioCountMsg.java RadioCountMsg.py: RadioCountToFlash.h mig python -target=$(PLATFORM) $(CFLAGS) -python-classname=RadioCountMsg RadioCountToFlash.h RadioCountMsg -o $@ diff --git a/apps/tests/msp430/Adc12/TestAdcAppC.nc b/apps/tests/msp430/Adc12/TestAdcAppC.nc index 30e176b3..7df22fd1 100644 --- a/apps/tests/msp430/Adc12/TestAdcAppC.nc +++ b/apps/tests/msp430/Adc12/TestAdcAppC.nc @@ -94,7 +94,7 @@ implementation // Multi, none components new TestAdcMultiC(CONFIG_AVCC, - SUPPLY_VOLTAGE_HALF_CHANNEL, REFERENCE_AVcc_AVss) as TestMulti1, + TEMPERATURE_DIODE_CHANNEL, REFERENCE_AVcc_AVss) as TestMulti1, new Msp430Adc12ClientC() as Wrapper4; TestMulti1 -> MainC.Boot; @@ -104,7 +104,7 @@ implementation // Multi, RefVolt components new TestAdcMultiC(CONFIG_VREF, - SUPPLY_VOLTAGE_HALF_CHANNEL, REFERENCE_VREFplus_AVss) as TestMulti2, + TEMPERATURE_DIODE_CHANNEL, REFERENCE_VREFplus_AVss) as TestMulti2, new Msp430Adc12ClientAutoRVGC() as Wrapper5; TestMulti2 -> MainC.Boot; diff --git a/apps/tests/msp430/Adc12/TestAdcMultiC.nc b/apps/tests/msp430/Adc12/TestAdcMultiC.nc index 2115b8bf..6a249503 100644 --- a/apps/tests/msp430/Adc12/TestAdcMultiC.nc +++ b/apps/tests/msp430/Adc12/TestAdcMultiC.nc @@ -66,10 +66,12 @@ implementation { #define BUFFER_SIZE 100 +#define NUM_REPETITIONS 5 const msp430adc12_channel_config_t config = {inch, sref, ref2_5v, adc12ssel, adc12div, sht, sampcon_ssel, sampcon_id}; adc12memctl_t memCtl = {inch2, sref2}; norace uint8_t state; uint16_t buffer[BUFFER_SIZE]; + norace uint8_t count = 0; void task getData(); void task signalFailure() @@ -102,7 +104,7 @@ implementation event void Boot.booted() { - state = 0; + count = NUM_REPETITIONS; post getData(); } @@ -119,11 +121,15 @@ implementation async event void MultiChannel.dataReady(uint16_t *buf, uint16_t numSamples) { - if (assertData(buf, numSamples) && state++ == 0) - post signalSuccess(); - else + if (!assertData(buf, numSamples)){ post signalFailure(); - call Resource.release(); + } else if (count){ + count--; + call MultiChannel.getData(); + } else { + post signalSuccess(); + call Resource.release(); + } } command error_t Notify.enable(){} diff --git a/apps/tests/msp430/Adc12/TestAdcSingleC.nc b/apps/tests/msp430/Adc12/TestAdcSingleC.nc index e44d9ae4..d6ef05e8 100644 --- a/apps/tests/msp430/Adc12/TestAdcSingleC.nc +++ b/apps/tests/msp430/Adc12/TestAdcSingleC.nc @@ -62,11 +62,19 @@ generic module TestAdcSingleC( implementation { #define BUFFER_SIZE 100 +#define NUM_REPETITIONS 5 const msp430adc12_channel_config_t config = {inch, sref, ref2_5v, adc12ssel, adc12div, sht, sampcon_ssel, sampcon_id}; - uint8_t state; - norace uint8_t numDone; + norace uint8_t state; + norace uint8_t count = 0; uint16_t buffer[BUFFER_SIZE]; void task getData(); + enum { + SINGLE_DATA, + SINGLE_DATA_REPEAT, + MULTIPLE_DATA, + MULTIPLE_DATA_REPEAT, + }; + void task signalFailure() { @@ -83,7 +91,7 @@ implementation event void Boot.booted() { - state = 0; + state = SINGLE_DATA; post getData(); } @@ -99,36 +107,52 @@ implementation event void Resource.granted() { + count = NUM_REPETITIONS; switch(state) { - case 0: state++; - if (call SingleChannel.configureSingleRepeat(&config, 0) == SUCCESS) + case SINGLE_DATA: + if (call SingleChannel.configureSingle(&config) == SUCCESS) call SingleChannel.getData(); break; - case 1: state++; - if (call SingleChannel.configureSingle(&config) == SUCCESS) + case SINGLE_DATA_REPEAT: + if (call SingleChannel.configureSingleRepeat(&config, 10) == SUCCESS) call SingleChannel.getData(); break; - case 2: state++; - if (call SingleChannel.configureMultiple(&config, buffer, BUFFER_SIZE, 0) == SUCCESS) + case MULTIPLE_DATA: + if (call SingleChannel.configureMultiple(&config, buffer, BUFFER_SIZE, 10) == SUCCESS) call SingleChannel.getData(); break; - case 3: state++; - if (call SingleChannel.configureMultipleRepeat(&config, buffer, 16, 0) == SUCCESS) + case MULTIPLE_DATA_REPEAT: + if (call SingleChannel.configureMultipleRepeat(&config, buffer, 16, 10) == SUCCESS) call SingleChannel.getData(); break; default: call Resource.release(); - if (numDone == state) - signal Notify.notify(TRUE); + signal Notify.notify(TRUE); break; } } async event error_t SingleChannel.singleDataReady(uint16_t data) { - numDone++; assertData(&data, 1); + switch(state) + { + case SINGLE_DATA: + if (count){ + count--; + call SingleChannel.getData(); + return SUCCESS; + } + break; + case SINGLE_DATA_REPEAT: + if (count){ + count--; + return SUCCESS; + } + break; + } call Resource.release(); + state++; post getData(); return FAIL; } @@ -136,9 +160,24 @@ implementation async event uint16_t* SingleChannel.multipleDataReady(uint16_t *buf, uint16_t length) { - numDone++; assertData(buf, length); + switch(state) + { + case MULTIPLE_DATA: + if (count){ + count--; + call SingleChannel.getData(); + return 0; + } + break; + case MULTIPLE_DATA_REPEAT: + if (count){ + count--; + return buf; + } + } call Resource.release(); + state++; post getData(); return 0; } diff --git a/apps/tests/rf230/Ieee154CountToLeds/Makefile b/apps/tests/rf230/Ieee154CountToLeds/Makefile new file mode 100644 index 00000000..74cfe316 --- /dev/null +++ b/apps/tests/rf230/Ieee154CountToLeds/Makefile @@ -0,0 +1,3 @@ +COMPONENT=RadioCountToLedsAppC + +include $(MAKERULES) diff --git a/apps/tests/rf230/Ieee154CountToLeds/RadioCountToLeds.h b/apps/tests/rf230/Ieee154CountToLeds/RadioCountToLeds.h new file mode 100644 index 00000000..8d29f3fb --- /dev/null +++ b/apps/tests/rf230/Ieee154CountToLeds/RadioCountToLeds.h @@ -0,0 +1,41 @@ +/* + * "Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +#ifndef RADIO_COUNT_TO_LEDS_H +#define RADIO_COUNT_TO_LEDS_H + +typedef nx_struct radio_count_msg { + nx_uint16_t counter; +} radio_count_msg_t; + +enum { + AM_RADIO_COUNT_MSG = 6, +}; + +#endif diff --git a/apps/tests/rf230/Ieee154CountToLeds/RadioCountToLedsAppC.nc b/apps/tests/rf230/Ieee154CountToLeds/RadioCountToLedsAppC.nc new file mode 100644 index 00000000..5feaad74 --- /dev/null +++ b/apps/tests/rf230/Ieee154CountToLeds/RadioCountToLedsAppC.nc @@ -0,0 +1,61 @@ +// $Id$ + +/* tab:4 + * "Copyright (c) 2000-2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +#include "RadioCountToLeds.h" + +/** + * Configuration for the RadioCountToLeds application. RadioCountToLeds + * maintains a 4Hz counter, broadcasting its value in an AM packet + * every time it gets updated. A RadioCountToLeds node that hears a counter + * displays the bottom three bits on its LEDs. This application is a useful + * test to show that basic AM communication and timers work. + * + * @author Philip Levis + * @date June 6 2005 + */ + +configuration RadioCountToLedsAppC {} +implementation { + components MainC, RadioCountToLedsC as App, LedsC; + components Ieee154MessageC; + components new TimerMilliC(); + + App.Boot -> MainC.Boot; + + App.Receive -> Ieee154MessageC; + App.Send -> Ieee154MessageC; + App.SplitControl -> Ieee154MessageC; + App.Leds -> LedsC; + App.MilliTimer -> TimerMilliC; + App.Packet -> Ieee154MessageC; +} + + diff --git a/apps/tests/rf230/Ieee154CountToLeds/RadioCountToLedsC.nc b/apps/tests/rf230/Ieee154CountToLeds/RadioCountToLedsC.nc new file mode 100644 index 00000000..2be5356c --- /dev/null +++ b/apps/tests/rf230/Ieee154CountToLeds/RadioCountToLedsC.nc @@ -0,0 +1,139 @@ +// $Id$ + +/* tab:4 + * "Copyright (c) 2000-2005 The Regents of the University of California. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + * + * Copyright (c) 2002-2003 Intel Corporation + * All rights reserved. + * + * This file is distributed under the terms in the attached INTEL-LICENSE + * file. If you do not find these files, copies can be found by writing to + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * 94704. Attention: Intel License Inquiry. + */ + +#include "Timer.h" +#include "RadioCountToLeds.h" + +/** + * Implementation of the RadioCountToLeds application. RadioCountToLeds + * maintains a 4Hz counter, broadcasting its value in an AM packet + * every time it gets updated. A RadioCountToLeds node that hears a counter + * displays the bottom three bits on its LEDs. This application is a useful + * test to show that basic AM communication and timers work. + * + * @author Philip Levis + * @date June 6 2005 + */ + +module RadioCountToLedsC @safe() { + uses { + interface Leds; + interface Boot; + interface Receive; + interface Ieee154Send as Send; + interface Timer as MilliTimer; + interface SplitControl; + interface Packet; + } +} +implementation { + + message_t packet; + + bool locked; + uint16_t counter = 0; + + event void Boot.booted() { + call SplitControl.start(); + } + + event void SplitControl.startDone(error_t err) { + if (err == SUCCESS) { + call MilliTimer.startPeriodic(250); + } + else { + call SplitControl.start(); + } + } + + event void SplitControl.stopDone(error_t err) { + // do nothing + } + + event void MilliTimer.fired() { + counter++; + dbg("RadioCountToLedsC", "RadioCountToLedsC: timer fired, counter is %hu.\n", counter); + if (locked) { + return; + } + else { + radio_count_msg_t* rcm = (radio_count_msg_t*)call Packet.getPayload(&packet, sizeof(radio_count_msg_t)); + if (rcm == NULL) { + return; + } + + rcm->counter = counter; + if (call Send.send(AM_BROADCAST_ADDR, &packet, sizeof(radio_count_msg_t)) == SUCCESS) { + dbg("RadioCountToLedsC", "RadioCountToLedsC: packet sent.\n", counter); + locked = TRUE; + } + } + } + + event message_t* Receive.receive(message_t* bufPtr, + void* payload, uint8_t len) { + dbg("RadioCountToLedsC", "Received packet of length %hhu.\n", len); + if (len != sizeof(radio_count_msg_t)) {return bufPtr;} + else { + radio_count_msg_t* rcm = (radio_count_msg_t*)payload; + if (rcm->counter & 0x1) { + call Leds.led0On(); + } + else { + call Leds.led0Off(); + } + if (rcm->counter & 0x2) { + call Leds.led1On(); + } + else { + call Leds.led1Off(); + } + if (rcm->counter & 0x4) { + call Leds.led2On(); + } + else { + call Leds.led2Off(); + } + return bufPtr; + } + } + + event void Send.sendDone(message_t* bufPtr, error_t error) { + if (&packet == bufPtr) { + locked = FALSE; + } + } + +} + + + + diff --git a/apps/tests/rf230/RF230Sniffer/Makefile b/apps/tests/rf230/RF230Sniffer/Makefile index aae82975..ce38f16f 100644 --- a/apps/tests/rf230/RF230Sniffer/Makefile +++ b/apps/tests/rf230/RF230Sniffer/Makefile @@ -2,5 +2,6 @@ COMPONENT=RF230SnifferC CFLAGS += -I$(TOSDIR)/lib/diagmsg CFLAGS += -DTASKLET_IS_TASK CFLAGS += -DDIAGMSG_RECORDED_MSGS=60 -CFLAGS += -DRF230_DEBUG -DRF230_DEBUG_MESSAGES +CFLAGS += -DRADIO_DEBUG -DRADIO_DEBUG_MESSAGES +CFLAGS += -DRF230_RSSI_ENERGY include $(MAKERULES) diff --git a/apps/tests/rf230/RF230Sniffer/RF230SnifferC.nc b/apps/tests/rf230/RF230Sniffer/RF230SnifferC.nc index 48958393..34089833 100644 --- a/apps/tests/rf230/RF230Sniffer/RF230SnifferC.nc +++ b/apps/tests/rf230/RF230Sniffer/RF230SnifferC.nc @@ -27,16 +27,35 @@ configuration RF230SnifferC implementation { - components RF230SnifferP, MainC, SerialActiveMessageC, RF230LayerC, RF230ActiveMessageP, IEEE154PacketC, AssertC; + components RF230SnifferP, MainC, SerialActiveMessageC, AssertC; RF230SnifferP.Boot -> MainC; RF230SnifferP.SplitControl -> SerialActiveMessageC; - RF230SnifferP.RadioState -> RF230LayerC; - - RF230LayerC.RF230Config -> RF230ActiveMessageP; - - RF230ActiveMessageP.IEEE154Packet -> IEEE154PacketC; + RF230SnifferP.RadioState -> RF230DriverLayerC; // just to avoid a timer compilation bug components new TimerMilliC(); + +// -------- ActiveMessage + + components RF230RadioP, Ieee154PacketLayerC; + RF230RadioP.Ieee154PacketLayer -> Ieee154PacketLayerC; + +// -------- TimeStamping + + components TimeStampingLayerC; + TimeStampingLayerC.LocalTimeRadio -> RF230DriverLayerC; + TimeStampingLayerC.SubPacket -> MetadataFlagsLayerC; + +// -------- MetadataFlags + + components MetadataFlagsLayerC; + MetadataFlagsLayerC.SubPacket -> RF230DriverLayerC; + +// -------- RF230 Driver + + components RF230DriverLayerC; + RF230DriverLayerC.Config -> RF230RadioP; + RF230DriverLayerC.PacketTimeStamp -> TimeStampingLayerC; + } diff --git a/apps/tests/rf230/RF230Sniffer/RF230SnifferP.nc b/apps/tests/rf230/RF230Sniffer/RF230SnifferP.nc index 98bd7f7c..fc8562d5 100644 --- a/apps/tests/rf230/RF230Sniffer/RF230SnifferP.nc +++ b/apps/tests/rf230/RF230Sniffer/RF230SnifferP.nc @@ -21,9 +21,7 @@ * Author: Miklos Maroti */ -#include #include -#include module RF230SnifferP { diff --git a/apps/tests/rf230/RF230Test/RF230TestC.nc b/apps/tests/rf230/RF230Test/RF230TestC.nc index 27463abf..3b03b67c 100644 --- a/apps/tests/rf230/RF230Test/RF230TestC.nc +++ b/apps/tests/rf230/RF230Test/RF230TestC.nc @@ -37,8 +37,8 @@ implementation RF230TestM.SplitControl -> SerialActiveMessageC; RF230TestM.Timer -> TimerMilliC; - components RF230LayerC, RF230ActiveMessageC; + components RF230DriverLayerC, RF230ActiveMessageC; - RF230TestM.RadioState -> RF230LayerC; + RF230TestM.RadioState -> RF230DriverLayerC; RF230TestM.AMSend -> RF230ActiveMessageC; } diff --git a/apps/tests/rf230/RadioCountToDiag/RadioCountToDiagC.nc b/apps/tests/rf230/RadioCountToDiag/RadioCountToDiagC.nc index 4cb5b6e4..931e0737 100644 --- a/apps/tests/rf230/RadioCountToDiag/RadioCountToDiagC.nc +++ b/apps/tests/rf230/RadioCountToDiag/RadioCountToDiagC.nc @@ -27,7 +27,7 @@ configuration RadioCountToDiagC implementation { - components MainC, RadioCountToDiagP, DiagMsgC; + components MainC, RadioCountToDiagP, DiagMsgC, LedsC; components ActiveMessageC, SerialActiveMessageC; components new TimerMilliC() as SendTimerC; components new TimerMilliC() as ReportTimerC; @@ -50,4 +50,6 @@ implementation RadioCountToDiagP.ActiveMessageAddress -> ActiveMessageAddressC; RadioCountToDiagP.LowPowerListening -> ActiveMessageC; + + RadioCountToDiagP.Leds -> LedsC; } diff --git a/apps/tests/rf230/RadioCountToDiag/RadioCountToDiagP.nc b/apps/tests/rf230/RadioCountToDiag/RadioCountToDiagP.nc index e464cebd..0cf4d49c 100644 --- a/apps/tests/rf230/RadioCountToDiag/RadioCountToDiagP.nc +++ b/apps/tests/rf230/RadioCountToDiag/RadioCountToDiagP.nc @@ -42,11 +42,13 @@ module RadioCountToDiagP interface ActiveMessageAddress; interface LowPowerListening; + + interface Leds; } } #ifndef SEND_PERIOD -#define SEND_PERIOD 10 +#define SEND_PERIOD 20 #endif #ifndef SLEEP_INTERVAL @@ -68,7 +70,7 @@ implementation else { #ifdef LOW_POWER_LISTENING - call LowPowerListening.setLocalSleepInterval(SLEEP_INTERVAL); + call LowPowerListening.setLocalWakeupInterval(SLEEP_INTERVAL); #endif call SendTimer.startPeriodic(SEND_PERIOD); call ReportTimer.startPeriodic(1000); @@ -116,6 +118,8 @@ implementation event void ReportTimer.fired() { + call Leds.led0Toggle(); + if( call DiagMsg.record() ) { call DiagMsg.uint16(sendCount); @@ -141,10 +145,12 @@ implementation { uint16_t addr; + call Leds.led1Toggle(); + call Packet.clear(&txMsg); call PacketAcknowledgements.requestAck(&txMsg); #ifdef LOW_POWER_LISTENING - call LowPowerListening.setRxSleepInterval(&txMsg, SLEEP_INTERVAL); + call LowPowerListening.setRemoteWakeupInterval(&txMsg, SLEEP_INTERVAL); #endif addr = call ActiveMessageAddress.amAddress(); diff --git a/apps/tests/storage/Config/volumes-at45db.xml b/apps/tests/storage/Config/volumes-at45db.xml index 7cc59802..e221874e 100644 --- a/apps/tests/storage/Config/volumes-at45db.xml +++ b/apps/tests/storage/Config/volumes-at45db.xml @@ -1,4 +1,4 @@ - + diff --git a/apps/tests/storage/Log/RandRWC.nc b/apps/tests/storage/Log/RandRWC.nc index 0c7ee628..7a79e132 100644 --- a/apps/tests/storage/Log/RandRWC.nc +++ b/apps/tests/storage/Log/RandRWC.nc @@ -138,8 +138,16 @@ implementation { scheck(call LogWrite.sync()); else { + error_t result; setParameters(); - scheck(call LogWrite.append(data + offset, len)); + result = call LogWrite.append(data + offset, len); + if (result == ESIZE) { + // We have reached the end of the log, sync it + scheck(call LogWrite.sync()); + } + else { + scheck(result); + } } } diff --git a/apps/tests/tkn154/Makefile.include b/apps/tests/tkn154/Makefile.include index 06212b52..100847b1 100644 --- a/apps/tests/tkn154/Makefile.include +++ b/apps/tests/tkn154/Makefile.include @@ -1,4 +1,4 @@ -PLATFORMS = telosb +PLATFORMS = telosb micaz TKN154_PLATFORM_INCLUDE?=$(TOSDIR)/platforms/$(PLATFORM)/mac/tkn154/Makefile.include CFLAGS += -I$(TOSDIR)/lib/mac/tkn154 \ @@ -12,6 +12,12 @@ ifdef IEEE154_EXTENDED_ADDRESS PFLAGS += -DIEEE154_EXTENDED_ADDRESS=$(IEEE154_EXTENDED_ADDRESS) endif +ifdef TKN154_DEBUG +PFLAGS += -DTKN154_DEBUG +CFLAGS += -I$(TOSDIR)/lib/printf +PFLAGS += -DPRINTF_BUFFER_SIZE=1000 +endif + # parses the PLATFORM variable include $(MAKERULES) diff --git a/apps/tests/tkn154/README.txt b/apps/tests/tkn154/README.txt index eb945797..8aa63d9e 100644 --- a/apps/tests/tkn154/README.txt +++ b/apps/tests/tkn154/README.txt @@ -1,12 +1,14 @@ README for tkn154 test applications -Author/Contact: tinyos-help@millennium.berkeley.edu +Author/Contact: Jan Hauer Description: This folder contains test applications for "TKN15.4", a platform-independent -IEEE 802.15.4-2006 MAC implementation. Every test application resides in a -separate subdirectory which includes a README.txt describing what it does and -how it can be installed, respectively. +IEEE 802.15.4-2006 MAC implementation. Applications that use the beacon-enabled +mode are located in the "beacon-enabled" folder, applications that use the +nonbeacon-enabled mode are in the "nonbeacon-enabled" folder. Every test +application resides in a separate subdirectory which includes a README.txt +describing what it does and how it can be installed. The TKN15.4 implementation can be found in tinyos-2.x/tos/lib/mac/tkn154. Note: TEP3 recommends that interface names "should be mixed case, starting diff --git a/apps/tests/tkn154/TestAssociate/README.txt b/apps/tests/tkn154/TestAssociate/README.txt deleted file mode 100644 index eefdf410..00000000 --- a/apps/tests/tkn154/TestAssociate/README.txt +++ /dev/null @@ -1,48 +0,0 @@ -README for TestAssociate -Author/Contact: tinyos-help@millennium.berkeley.edu - -Description: - -In this application one node takes the role of a PAN coordinator in a -beacon-enabled 802.15.4 PAN; it transmits periodic beacons and waits for -devices to request association to its PAN. Whenever a device tries to -associate, the PAN coordinator allows association and assigns to the device a -unique short address (starting from zero, incremented for every device -requesting association). - -A second node acts as a device; it first scans the pre-defined channel for -beacons from the coordinator and once it finds a beacon it tries to associate -to the PAN and synchronize to and track all future beacons. A short time after -association the device then disassociates from the PAN. - -The third LED (Telos: blue) is toggled whenever the coordinator has transmitted -a beacon or whenever a device has received a beacon. On the coordinator the -second LED (Telos: green) is switched on whenever an association request was -successful and it is switched off, whenever a disassociation request was -received. On a device the second LED is switched on while the device is -associated to the PAN, i.e. it is switched off after disassociation. The first -LED (Telos: red) is used for debugging, it denotes an error in the protocol -stack and should never be on. - -Tools: NONE - -Usage: - -1. Install the coordinator: - - $ cd coordinator; make telosb install - -2. Install one (or more) devices: - - $ cd device; make telosb install - -You can change some of the configuration parameters in app_profile.h - -Known bugs/limitations: - -- Currently this application only works on TelosB nodes -- The MAC timing is not standard compliant, because TelosB lacks a - clock with sufficient precision/accuracy - -$Id$o - diff --git a/apps/tests/tkn154/TestData/README.txt b/apps/tests/tkn154/TestData/README.txt deleted file mode 100644 index 08d0939e..00000000 --- a/apps/tests/tkn154/TestData/README.txt +++ /dev/null @@ -1,45 +0,0 @@ -README for TestData -Author/Contact: tinyos-help@millennium.berkeley.edu - -Description: - -In this application one node takes the role of a PAN coordinator in a -beacon-enabled 802.15.4 PAN; it transmits periodic beacons and waits for -incoming DATA frames. A second node acts as a device; it first scans the -pre-defined channel for beacons from the coordinator and once it finds a beacon -it tries to synchronize to and track all future beacons. It then starts to -transmit DATA frames to the coordinator as fast as possible (direct -transmission in the contention access period, CAP). - -The third LED (Telos: blue) is toggled whenever the coordinator has transmitted -a beacon or whenever a device has received a beacon. On the coordinator the -second LED (Telos: green) is toggled for every 20 received DATA frames. On a -device the second LED is toggled for every 20 transmitted (and acknowledged) -DATA frames. The first LED (Telos: red) is used for debugging, it denotes an -error in the protocol stack and should never be on. - -Tools: NONE - -Usage: - -1. Install the coordinator: - - $ cd coordinator; make telosb install - -2. Install one or more devices - - $ cd device; make telosb install,X - - where X is a pre-assigned short address and should be different - for every device. - -You can change some of the configuration parameters in app_profile.h - -Known bugs/limitations: - -- Currently this application only works on TelosB nodes -- The MAC timing is not standard compliant, because TelosB lacks a - clock with sufficient precision/accuracy - -$Id$o - diff --git a/apps/tests/tkn154/TestData/coordinator/Makefile b/apps/tests/tkn154/TestData/coordinator/Makefile deleted file mode 100644 index 42f11300..00000000 --- a/apps/tests/tkn154/TestData/coordinator/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -COMPONENT=TestDataAppC -CFLAGS += -I$(shell pwd)/.. -include ../../Makefile.include diff --git a/apps/tests/tkn154/TestIndirect/README.txt b/apps/tests/tkn154/TestIndirect/README.txt deleted file mode 100644 index c4525203..00000000 --- a/apps/tests/tkn154/TestIndirect/README.txt +++ /dev/null @@ -1,43 +0,0 @@ -README for TestIndirect -Author/Contact: tinyos-help@millennium.berkeley.edu - -Description: - -In this application one node takes the role of a PAN coordinator in a -beacon-enabled 802.15.4 PAN; it transmits periodic beacons and additionally in -every beacon interval it tries to transmit one DATA frame to a device using -indirect tranmission. A second node that takes the role of a device first scans -the pre-defined channel for beacons from the coordinator and once it finds a -beacon it tries to synchronize to and track all future beacons. Whenever the -coordinator has data to send (indicated in the beacon), the device extracts the -DATA frame from the coordinator. - -The third LED (Telos: blue) is toggled whenever the coordinator has transmitted -a beacon, it is not used on the device. On the coordinator the second LED -(Telos: green) is toggled for every transmitted DATA frames. On a device the -second LED is toggled for every received DATA frame. The first LED (Telos: red) -is used for debugging, it denotes an error in the protocol stack and should -never be on. - -Tools: NONE - -Usage: - -1. Install the coordinator: - - $ cd coordinator; make telosb install - -2. Install one device - - $ cd device; make telosb install - -You can change some of the configuration parameters in app_profile.h - -Known bugs/limitations: - -- Currently this application only works on TelosB nodes -- The MAC timing is not standard compliant, because TelosB lacks a - clock with sufficient precision/accuracy - -$Id$ - diff --git a/apps/tests/tkn154/TestPromiscuous/Makefile b/apps/tests/tkn154/TestPromiscuous/Makefile deleted file mode 100644 index 1aabe6fb..00000000 --- a/apps/tests/tkn154/TestPromiscuous/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -COMPONENT=TestPromiscuousAppC -PFLAGS += -DIEEE154_BEACON_TX_DISABLED -DIEEE154_BEACON_SYNC_DISABLED -DIEEE154_SCAN_DISABLED -PFLAGS += -DPRINTF_BUFFER_SIZE=1000 -CFLAGS += -I$(TOSDIR)/lib/printf -include ../Makefile.include diff --git a/apps/tests/tkn154/TestStartSync/README.txt b/apps/tests/tkn154/TestStartSync/README.txt deleted file mode 100644 index e58dc331..00000000 --- a/apps/tests/tkn154/TestStartSync/README.txt +++ /dev/null @@ -1,41 +0,0 @@ -README for TestStartSync -Author/Contact: tinyos-help@millennium.berkeley.edu - -Description: - -In this application one node takes the role of a PAN coordinator in a -beacon-enabled 802.15.4 PAN; it transmits periodic beacons with a frequency -defined in the app_profile.h file. A second node acts as a device; it first -scans all available channels for beacons from the coordinator and once it finds -a beacon it tries to synchronize to and track all future beacons. - -The third LED (Telos: blue) is toggled whenever the coordinator has transmitted -a beacon or whenever a device has received a beacon. On the coordinator the -second LED (Telos: green) is switched on after it has started transmitting -beacons. On a device the second LED is switched on whenever the device is -synchronized to the coordinator's beacons. The first LED (Telos: red) is used -for debugging, it denotes an error in the protocol stack and should never be -on. - -Tools: NONE - -Usage: - -1. Install the coordinator: - - $ cd coordinator; make telosb install - -2. Install one (or more) devices: - - $ cd device; make telosb install - -You can change some of the configuration parameters in app_profile.h - -Known bugs/limitations: - -- Currently this application only works on TelosB nodes -- The beacon period is not standard-compliant, because TelosB lacks a - clock with sufficient precision/accuracy - -$Id$ - diff --git a/apps/tests/tkn154/TestStartSync/coordinator/Makefile b/apps/tests/tkn154/TestStartSync/coordinator/Makefile deleted file mode 100644 index 13db21cd..00000000 --- a/apps/tests/tkn154/TestStartSync/coordinator/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -COMPONENT=TestStartSyncAppC -CFLAGS += -I$(shell pwd)/.. -include ../../Makefile.include diff --git a/apps/tests/tkn154/beacon-enabled/TestAssociate/README.txt b/apps/tests/tkn154/beacon-enabled/TestAssociate/README.txt new file mode 100644 index 00000000..f8623dd9 --- /dev/null +++ b/apps/tests/tkn154/beacon-enabled/TestAssociate/README.txt @@ -0,0 +1,44 @@ +README for TestAssociate +Author/Contact: Jan Hauer + +Description: + +In this application one node takes the role of a PAN coordinator in a +beacon-enabled 802.15.4 PAN, it transmits periodic beacons and waits for +devices to request association to its PAN. Whenever a device tries to +associate, the PAN coordinator accepts the association and assigns to the +device a unique short address (starting from zero, incremented for every new +association request). A second node acts as a device, it first scans the +pre-defined channel for beacons from the coordinator and once it finds a beacon +it tries to associate to the PAN. A short time after association the device +then disassociates from the PAN. + +Criteria for a successful test: + +Both, coordinator and device, should toggle LED1 in unison about once every 5 +seconds. The coordinator should also toggle LED2 every second. + + +Tools: NONE + +Usage: + +1. Install the coordinator: + + $ cd coordinator; make install + +2. Install one (or more) devices: + + $ cd device; make install + +You can change some of the configuration parameters in app_profile.h + +Known bugs/limitations: + +- Many TinyOS 2 platforms do not have a clock that satisfies the + precision/accuracy requirements of the IEEE 802.15.4 standard (e.g. + 62.500 Hz, +-40 ppm in the 2.4 GHz band); in this case the MAC timing + is not standard compliant + +$Id$o + diff --git a/apps/tests/tkn154/TestAssociate/app_profile.h b/apps/tests/tkn154/beacon-enabled/TestAssociate/app_profile.h similarity index 100% rename from apps/tests/tkn154/TestAssociate/app_profile.h rename to apps/tests/tkn154/beacon-enabled/TestAssociate/app_profile.h diff --git a/apps/tests/tkn154/TestAssociate/coordinator/Makefile b/apps/tests/tkn154/beacon-enabled/TestAssociate/coordinator/Makefile similarity index 62% rename from apps/tests/tkn154/TestAssociate/coordinator/Makefile rename to apps/tests/tkn154/beacon-enabled/TestAssociate/coordinator/Makefile index 7fe71344..c4d5d67c 100644 --- a/apps/tests/tkn154/TestAssociate/coordinator/Makefile +++ b/apps/tests/tkn154/beacon-enabled/TestAssociate/coordinator/Makefile @@ -1,3 +1,3 @@ COMPONENT=TestAssociateAppC CFLAGS += -I$(shell pwd)/.. -include ../../Makefile.include +include ../../../Makefile.include diff --git a/apps/tests/tkn154/TestAssociate/coordinator/TestAssociateAppC.nc b/apps/tests/tkn154/beacon-enabled/TestAssociate/coordinator/TestAssociateAppC.nc similarity index 82% rename from apps/tests/tkn154/TestAssociate/coordinator/TestAssociateAppC.nc rename to apps/tests/tkn154/beacon-enabled/TestAssociate/coordinator/TestAssociateAppC.nc index 5945ddf5..7a4ca06e 100644 --- a/apps/tests/tkn154/TestAssociate/coordinator/TestAssociateAppC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestAssociate/coordinator/TestAssociateAppC.nc @@ -36,19 +36,19 @@ configuration TestAssociateAppC { } implementation { - components MainC, LedsC, Ieee802154MacC as Ieee802154MacC; + components MainC, LedsC, Ieee802154BeaconEnabledC as MAC; components TestCoordC as App; MainC.Boot <- App; App.Leds -> LedsC; - App.MLME_RESET -> Ieee802154MacC; - App.MLME_SET -> Ieee802154MacC; - App.MLME_GET -> Ieee802154MacC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; - App.MLME_START -> Ieee802154MacC; - App.MLME_ASSOCIATE -> Ieee802154MacC; - App.MLME_DISASSOCIATE -> Ieee802154MacC; - App.MLME_COMM_STATUS -> Ieee802154MacC; - App.Frame -> Ieee802154MacC; - App.IEEE154TxBeaconPayload -> Ieee802154MacC; + App.MLME_START -> MAC; + App.MLME_ASSOCIATE -> MAC; + App.MLME_DISASSOCIATE -> MAC; + App.MLME_COMM_STATUS -> MAC; + App.Frame -> MAC; + App.IEEE154TxBeaconPayload -> MAC; } diff --git a/apps/tests/tkn154/TestAssociate/coordinator/TestCoordC.nc b/apps/tests/tkn154/beacon-enabled/TestAssociate/coordinator/TestCoordC.nc similarity index 95% rename from apps/tests/tkn154/TestAssociate/coordinator/TestCoordC.nc rename to apps/tests/tkn154/beacon-enabled/TestAssociate/coordinator/TestCoordC.nc index ceb793c6..43c788ae 100644 --- a/apps/tests/tkn154/TestAssociate/coordinator/TestCoordC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestAssociate/coordinator/TestCoordC.nc @@ -52,11 +52,10 @@ module TestCoordC } } implementation { - ieee154_address_t m_lastDevice; - uint16_t m_shortAddress; + uint16_t m_assignedShortAddress; event void Boot.booted() { - call MLME_RESET.request(TRUE, BEACON_ENABLED_PAN); + call MLME_RESET.request(TRUE); } event void MLME_RESET.confirm(ieee154_status_t status) @@ -88,7 +87,7 @@ module TestCoordC ieee154_security_t *security ) { - call MLME_ASSOCIATE.response(DeviceAddress, m_shortAddress++, IEEE154_ASSOCIATION_SUCCESSFUL, 0); + call MLME_ASSOCIATE.response(DeviceAddress, m_assignedShortAddress++, IEEE154_ASSOCIATION_SUCCESSFUL, 0); } event void MLME_DISASSOCIATE.indication ( @@ -114,7 +113,6 @@ module TestCoordC if (status == IEEE154_SUCCESS){ // association was successful call Leds.led1On(); - m_lastDevice.extendedAddress = DstAddr.extendedAddress; } else { call Leds.led1Off(); } diff --git a/apps/tests/tkn154/beacon-enabled/TestAssociate/device/Makefile b/apps/tests/tkn154/beacon-enabled/TestAssociate/device/Makefile new file mode 100644 index 00000000..7c0acfe3 --- /dev/null +++ b/apps/tests/tkn154/beacon-enabled/TestAssociate/device/Makefile @@ -0,0 +1,4 @@ +COMPONENT=TestAssociateAppC +PFLAGS += -DIEEE154_BEACON_TX_DISABLED +CFLAGS += -I$(shell pwd)/.. +include ../../../Makefile.include diff --git a/apps/tests/tkn154/TestAssociate/device/TestAssociateAppC.nc b/apps/tests/tkn154/beacon-enabled/TestAssociate/device/TestAssociateAppC.nc similarity index 80% rename from apps/tests/tkn154/TestAssociate/device/TestAssociateAppC.nc rename to apps/tests/tkn154/beacon-enabled/TestAssociate/device/TestAssociateAppC.nc index c99e233a..992d3dcb 100644 --- a/apps/tests/tkn154/TestAssociate/device/TestAssociateAppC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestAssociate/device/TestAssociateAppC.nc @@ -36,23 +36,23 @@ configuration TestAssociateAppC { } implementation { - components MainC, LedsC, Ieee802154MacC as Ieee802154MacC, + components MainC, LedsC, Ieee802154BeaconEnabledC as MAC, new Timer62500C() as Timer; components TestDeviceC as App; MainC.Boot <- App; App.Leds -> LedsC; - App.MLME_RESET -> Ieee802154MacC; - App.MLME_SET -> Ieee802154MacC; - App.MLME_GET -> Ieee802154MacC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; App.DisassociateTimer -> Timer; - App.MLME_SCAN -> Ieee802154MacC; - App.MLME_SYNC -> Ieee802154MacC; - App.MLME_BEACON_NOTIFY -> Ieee802154MacC; - App.MLME_SYNC_LOSS -> Ieee802154MacC; - App.MLME_ASSOCIATE -> Ieee802154MacC; - App.MLME_DISASSOCIATE -> Ieee802154MacC; - App.MLME_COMM_STATUS -> Ieee802154MacC; - App.BeaconFrame -> Ieee802154MacC; + App.MLME_SCAN -> MAC; + App.MLME_SYNC -> MAC; + App.MLME_BEACON_NOTIFY -> MAC; + App.MLME_SYNC_LOSS -> MAC; + App.MLME_ASSOCIATE -> MAC; + App.MLME_DISASSOCIATE -> MAC; + App.MLME_COMM_STATUS -> MAC; + App.BeaconFrame -> MAC; } diff --git a/apps/tests/tkn154/TestAssociate/device/TestDeviceC.nc b/apps/tests/tkn154/beacon-enabled/TestAssociate/device/TestDeviceC.nc similarity index 89% rename from apps/tests/tkn154/TestAssociate/device/TestDeviceC.nc rename to apps/tests/tkn154/beacon-enabled/TestAssociate/device/TestDeviceC.nc index 1c22739f..acd74d6a 100644 --- a/apps/tests/tkn154/TestAssociate/device/TestDeviceC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestAssociate/device/TestDeviceC.nc @@ -56,7 +56,7 @@ module TestDeviceC ieee154_CapabilityInformation_t m_capabilityInformation; ieee154_PANDescriptor_t m_PANDescriptor; - bool m_isPANDescriptorValid; + bool m_wasScanSuccessful; void startApp(); event void Boot.booted() { @@ -67,7 +67,7 @@ module TestDeviceC m_capabilityInformation.Reserved = 0; m_capabilityInformation.SecurityCapability = 0; m_capabilityInformation.AllocateAddress = 1; - call MLME_RESET.request(TRUE, BEACON_ENABLED_PAN); + call MLME_RESET.request(TRUE); } event void MLME_RESET.confirm(ieee154_status_t status) @@ -81,16 +81,14 @@ module TestDeviceC ieee154_phyChannelsSupported_t channel; uint8_t scanDuration = BEACON_ORDER; - m_isPANDescriptorValid = FALSE; - - // scan only one channel + // scan only one channel (to save time) channel = ((uint32_t) 1) << RADIO_CHANNEL; // we want all received beacons to be signalled // through the MLME_BEACON_NOTIFY interface, i.e. // we set the macAutoRequest attribute to FALSE call MLME_SET.macAutoRequest(FALSE); - m_isPANDescriptorValid = FALSE; + m_wasScanSuccessful = FALSE; call MLME_SCAN.request ( PASSIVE_SCAN, // ScanType channel, // ScanChannels @@ -108,22 +106,20 @@ module TestDeviceC { // received a beacon frame ieee154_phyCurrentPage_t page = call MLME_GET.phyCurrentPage(); - ieee154_macBSN_t beaconSequenceNumber = call BeaconFrame.getBSN(frame); - - if (beaconSequenceNumber & 1) - call Leds.led2On(); - else - call Leds.led2Off(); - if (!m_isPANDescriptorValid && call BeaconFrame.parsePANDescriptor( - frame, RADIO_CHANNEL, page, &m_PANDescriptor) == SUCCESS){ - // let's see if the beacon is from the coordinator we expect... - if (m_PANDescriptor.CoordAddrMode == ADDR_MODE_SHORT_ADDRESS && - m_PANDescriptor.CoordPANId == PAN_ID && - m_PANDescriptor.CoordAddress.shortAddress == COORDINATOR_ADDRESS){ - // yes - wait until SCAN is finished, then syncronize to beacons - m_isPANDescriptorValid = TRUE; + + if (!m_wasScanSuccessful) { + if (call BeaconFrame.parsePANDescriptor( + frame, RADIO_CHANNEL, page, &m_PANDescriptor) == SUCCESS){ + // let's see if the beacon is from the coordinator we expect... + if (m_PANDescriptor.CoordAddrMode == ADDR_MODE_SHORT_ADDRESS && + m_PANDescriptor.CoordPANId == PAN_ID && + m_PANDescriptor.CoordAddress.shortAddress == COORDINATOR_ADDRESS){ + // yes - wait until SCAN is finished, then syncronize to beacons + m_wasScanSuccessful = TRUE; + } } } + return frame; } @@ -138,7 +134,7 @@ module TestDeviceC ieee154_PANDescriptor_t* PANDescriptorList ) { - if (m_isPANDescriptorValid){ + if (m_wasScanSuccessful) { call MLME_SET.macPANId(m_PANDescriptor.CoordPANId); call MLME_SET.macCoordShortAddress(m_PANDescriptor.CoordAddress.shortAddress); call MLME_SYNC.request(m_PANDescriptor.LogicalChannel, m_PANDescriptor.ChannelPage, TRUE); @@ -161,7 +157,7 @@ module TestDeviceC ieee154_security_t *security ) { - if ( status == IEEE154_SUCCESS ){ + if ( status == IEEE154_SUCCESS ) { // we are now associated - set a timer for disassociation call Leds.led1On(); call DisassociateTimer.startOneShot(312500U); diff --git a/apps/tests/tkn154/beacon-enabled/TestData/README.txt b/apps/tests/tkn154/beacon-enabled/TestData/README.txt new file mode 100644 index 00000000..c241ac5b --- /dev/null +++ b/apps/tests/tkn154/beacon-enabled/TestData/README.txt @@ -0,0 +1,47 @@ +README for TestData +Author/Contact: Jan Hauer + +Description: + +In this application one node takes the role of a PAN coordinator in a +beacon-enabled 802.15.4 PAN, it transmits periodic beacons and waits for +incoming DATA frames. A second node acts as a device, it first scans the +pre-defined channel for beacons from the coordinator and once it finds a beacon +it tries to synchronize to and track all future beacons. It then starts to +transmit DATA frames to the coordinator as fast as possible (direct +transmission in the contention access period, CAP). + +Criteria for a successful test: + +Coordinator and device should both toggle LED2 about twice per second in +unison. They should also each toggle LED1 about 5 times per second (but +not necessarily in unison). Note: the nodes should be close to each other, +because the transmission power is reduced to -20 dBm. + + +Tools: NONE + +Usage: + +1. Install the coordinator: + + $ cd coordinator; make install + +2. Install one or more devices + + $ cd device; make install,X + + where X is a pre-assigned short address and should be different + for every device. + +You can change some of the configuration parameters in app_profile.h + +Known bugs/limitations: + +- Many TinyOS 2 platforms do not have a clock that satisfies the + precision/accuracy requirements of the IEEE 802.15.4 standard (e.g. + 62.500 Hz, +-40 ppm in the 2.4 GHz band); in this case the MAC timing + is not standard compliant + +$Id$o + diff --git a/apps/tests/tkn154/TestData/app_profile.h b/apps/tests/tkn154/beacon-enabled/TestData/app_profile.h similarity index 98% rename from apps/tests/tkn154/TestData/app_profile.h rename to apps/tests/tkn154/beacon-enabled/TestData/app_profile.h index bf736a00..ef3cc433 100644 --- a/apps/tests/tkn154/TestData/app_profile.h +++ b/apps/tests/tkn154/beacon-enabled/TestData/app_profile.h @@ -42,6 +42,7 @@ enum { COORDINATOR_ADDRESS = 0x4331, BEACON_ORDER = 5, SUPERFRAME_ORDER = 5, + TX_POWER = -20, // in dBm }; #endif diff --git a/apps/tests/tkn154/TestData/device/Makefile b/apps/tests/tkn154/beacon-enabled/TestData/coordinator/Makefile similarity index 60% rename from apps/tests/tkn154/TestData/device/Makefile rename to apps/tests/tkn154/beacon-enabled/TestData/coordinator/Makefile index 42f11300..1a86b20c 100644 --- a/apps/tests/tkn154/TestData/device/Makefile +++ b/apps/tests/tkn154/beacon-enabled/TestData/coordinator/Makefile @@ -1,3 +1,3 @@ COMPONENT=TestDataAppC CFLAGS += -I$(shell pwd)/.. -include ../../Makefile.include +include ../../../Makefile.include diff --git a/apps/tests/tkn154/TestData/coordinator/TestCoordReceiverC.nc b/apps/tests/tkn154/beacon-enabled/TestData/coordinator/TestCoordReceiverC.nc similarity index 98% rename from apps/tests/tkn154/TestData/coordinator/TestCoordReceiverC.nc rename to apps/tests/tkn154/beacon-enabled/TestData/coordinator/TestCoordReceiverC.nc index db59ec06..23123d57 100644 --- a/apps/tests/tkn154/TestData/coordinator/TestCoordReceiverC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestData/coordinator/TestCoordReceiverC.nc @@ -53,13 +53,14 @@ module TestCoordReceiverC bool m_ledCount; event void Boot.booted() { - call MLME_RESET.request(TRUE, BEACON_ENABLED_PAN); + call MLME_RESET.request(TRUE); } event void MLME_RESET.confirm(ieee154_status_t status) { if (status != IEEE154_SUCCESS) return; + call MLME_SET.phyTransmitPower(TX_POWER); call MLME_SET.macShortAddress(COORDINATOR_ADDRESS); call MLME_SET.macAssociationPermit(FALSE); call MLME_START.request( diff --git a/apps/tests/tkn154/TestData/coordinator/TestDataAppC.nc b/apps/tests/tkn154/beacon-enabled/TestData/coordinator/TestDataAppC.nc similarity index 86% rename from apps/tests/tkn154/TestData/coordinator/TestDataAppC.nc rename to apps/tests/tkn154/beacon-enabled/TestData/coordinator/TestDataAppC.nc index eeb8d0db..4c485161 100644 --- a/apps/tests/tkn154/TestData/coordinator/TestDataAppC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestData/coordinator/TestDataAppC.nc @@ -32,21 +32,21 @@ * @author: Jan Hauer * ======================================================================== */ - +#include "app_profile.h" configuration TestDataAppC { } implementation { - components MainC, LedsC, Ieee802154MacC; + components MainC, LedsC, Ieee802154BeaconEnabledC as MAC; components TestCoordReceiverC as App; - App.MLME_START -> Ieee802154MacC; - App.MCPS_DATA -> Ieee802154MacC; - App.Frame -> Ieee802154MacC; + App.MLME_START -> MAC; + App.MCPS_DATA -> MAC; + App.Frame -> MAC; MainC.Boot <- App; App.Leds -> LedsC; - App.MLME_RESET -> Ieee802154MacC; - App.MLME_SET -> Ieee802154MacC; - App.MLME_GET -> Ieee802154MacC; - App.IEEE154TxBeaconPayload -> Ieee802154MacC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; + App.IEEE154TxBeaconPayload -> MAC; } diff --git a/apps/tests/tkn154/beacon-enabled/TestData/device/Makefile b/apps/tests/tkn154/beacon-enabled/TestData/device/Makefile new file mode 100644 index 00000000..ba70c9ba --- /dev/null +++ b/apps/tests/tkn154/beacon-enabled/TestData/device/Makefile @@ -0,0 +1,4 @@ +COMPONENT=TestDataAppC +PFLAGS += -DIEEE154_BEACON_TX_DISABLED +CFLAGS += -I$(shell pwd)/.. +include ../../../Makefile.include diff --git a/apps/tests/tkn154/TestData/device/TestDataAppC.nc b/apps/tests/tkn154/beacon-enabled/TestData/device/TestDataAppC.nc similarity index 81% rename from apps/tests/tkn154/TestData/device/TestDataAppC.nc rename to apps/tests/tkn154/beacon-enabled/TestData/device/TestDataAppC.nc index f59355c3..147f4834 100644 --- a/apps/tests/tkn154/TestData/device/TestDataAppC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestData/device/TestDataAppC.nc @@ -32,25 +32,25 @@ * @author: Jan Hauer * ======================================================================== */ - +#include "app_profile.h" configuration TestDataAppC { } implementation { - components MainC, LedsC, Ieee802154MacC; + components MainC, LedsC, Ieee802154BeaconEnabledC as MAC; components TestDeviceSenderC as App; - App.MLME_SCAN -> Ieee802154MacC; - App.MLME_SYNC -> Ieee802154MacC; - App.MLME_BEACON_NOTIFY -> Ieee802154MacC; - App.MLME_SYNC_LOSS -> Ieee802154MacC; - App.MCPS_DATA -> Ieee802154MacC; - App.Frame -> Ieee802154MacC; - App.BeaconFrame -> Ieee802154MacC; - App.Packet -> Ieee802154MacC; + App.MLME_SCAN -> MAC; + App.MLME_SYNC -> MAC; + App.MLME_BEACON_NOTIFY -> MAC; + App.MLME_SYNC_LOSS -> MAC; + App.MCPS_DATA -> MAC; + App.Frame -> MAC; + App.BeaconFrame -> MAC; + App.Packet -> MAC; MainC.Boot <- App; App.Leds -> LedsC; - App.MLME_RESET -> Ieee802154MacC; - App.MLME_SET -> Ieee802154MacC; - App.MLME_GET -> Ieee802154MacC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; } diff --git a/apps/tests/tkn154/TestData/device/TestDeviceSenderC.nc b/apps/tests/tkn154/beacon-enabled/TestData/device/TestDeviceSenderC.nc similarity index 82% rename from apps/tests/tkn154/TestData/device/TestDeviceSenderC.nc rename to apps/tests/tkn154/beacon-enabled/TestData/device/TestDeviceSenderC.nc index 4534df2e..e4a1ab2f 100644 --- a/apps/tests/tkn154/TestData/device/TestDeviceSenderC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestData/device/TestDeviceSenderC.nc @@ -58,8 +58,7 @@ module TestDeviceSenderC uint8_t m_payloadLen; ieee154_PANDescriptor_t m_PANDescriptor; bool m_ledCount; - bool m_isPANDescriptorValid; - bool m_sending; + bool m_wasScanSuccessful; void startApp(); task void packetSendTask(); @@ -73,7 +72,7 @@ module TestDeviceSenderC payloadRegion = call Packet.getPayload(&m_frame, m_payloadLen); if (m_payloadLen <= call Packet.maxPayloadLength()){ memcpy(payloadRegion, payload, m_payloadLen); - call MLME_RESET.request(TRUE, BEACON_ENABLED_PAN); + call MLME_RESET.request(TRUE); } } @@ -88,16 +87,17 @@ module TestDeviceSenderC ieee154_phyChannelsSupported_t channelMask; uint8_t scanDuration = BEACON_ORDER; - m_isPANDescriptorValid = FALSE; + call MLME_SET.phyTransmitPower(TX_POWER); call MLME_SET.macShortAddress(TOS_NODE_ID); - // scan only one channel + // scan only the channel where we expect the coordinator channelMask = ((uint32_t) 1) << RADIO_CHANNEL; // we want all received beacons to be signalled // through the MLME_BEACON_NOTIFY interface, i.e. // we set the macAutoRequest attribute to FALSE call MLME_SET.macAutoRequest(FALSE); + m_wasScanSuccessful = FALSE; call MLME_SCAN.request ( PASSIVE_SCAN, // ScanType channelMask, // ScanChannels @@ -117,20 +117,26 @@ module TestDeviceSenderC ieee154_phyCurrentPage_t page = call MLME_GET.phyCurrentPage(); ieee154_macBSN_t beaconSequenceNumber = call BeaconFrame.getBSN(frame); - if (beaconSequenceNumber & 1) - call Leds.led2On(); - else - call Leds.led2Off(); - if (!m_isPANDescriptorValid && call BeaconFrame.parsePANDescriptor( - frame, RADIO_CHANNEL, page, &m_PANDescriptor) == SUCCESS){ - // let's see if the beacon is from our coordinator... - if (m_PANDescriptor.CoordAddrMode == ADDR_MODE_SHORT_ADDRESS && - m_PANDescriptor.CoordPANId == PAN_ID && - m_PANDescriptor.CoordAddress.shortAddress == COORDINATOR_ADDRESS){ - // yes! wait until SCAN is finished, then syncronize to the beacons - m_isPANDescriptorValid = TRUE; + if (!m_wasScanSuccessful) { + // received a beacon during channel scanning + if (call BeaconFrame.parsePANDescriptor( + frame, RADIO_CHANNEL, page, &m_PANDescriptor) == SUCCESS) { + // let's see if the beacon is from our coordinator... + if (m_PANDescriptor.CoordAddrMode == ADDR_MODE_SHORT_ADDRESS && + m_PANDescriptor.CoordPANId == PAN_ID && + m_PANDescriptor.CoordAddress.shortAddress == COORDINATOR_ADDRESS){ + // yes! wait until SCAN is finished, then syncronize to the beacons + m_wasScanSuccessful = TRUE; + } } + } else { + // received a beacon during synchronization, toggle LED2 + if (beaconSequenceNumber & 1) + call Leds.led2On(); + else + call Leds.led2Off(); } + return frame; } @@ -145,7 +151,8 @@ module TestDeviceSenderC ieee154_PANDescriptor_t* PANDescriptorList ) { - if (m_isPANDescriptorValid){ + if (m_wasScanSuccessful) { + // we received a beacon from the coordinator before call MLME_SET.macCoordShortAddress(m_PANDescriptor.CoordAddress.shortAddress); call MLME_SET.macPANId(m_PANDescriptor.CoordPANId); call MLME_SYNC.request(m_PANDescriptor.LogicalChannel, m_PANDescriptor.ChannelPage, TRUE); @@ -164,14 +171,15 @@ module TestDeviceSenderC task void packetSendTask() { - if (!m_sending && m_isPANDescriptorValid && - call MCPS_DATA.request ( + if (!m_wasScanSuccessful) + return; + else if (call MCPS_DATA.request ( &m_frame, // frame, m_payloadLen, // payloadLength, 0, // msduHandle, - TX_OPTIONS_ACK // TxOptions, - ) == IEEE154_SUCCESS) - m_sending = TRUE; + TX_OPTIONS_ACK // TxOptions, + ) != IEEE154_SUCCESS) + call Leds.led0On(); } event void MCPS_DATA.confirm ( @@ -181,8 +189,7 @@ module TestDeviceSenderC uint32_t timestamp ) { - m_sending = FALSE; - if (status == IEEE154_SUCCESS && m_ledCount++ == 20){ + if (status == IEEE154_SUCCESS && m_ledCount++ >= 20) { m_ledCount = 0; call Leds.led1Toggle(); } @@ -196,7 +203,9 @@ module TestDeviceSenderC uint8_t ChannelPage, ieee154_security_t *security) { - startApp(); + m_wasScanSuccessful = FALSE; + call Leds.led1Off(); + call Leds.led2Off(); } event message_t* MCPS_DATA.indication (message_t* frame) diff --git a/apps/tests/tkn154/beacon-enabled/TestIndirect/README.txt b/apps/tests/tkn154/beacon-enabled/TestIndirect/README.txt new file mode 100644 index 00000000..f963b801 --- /dev/null +++ b/apps/tests/tkn154/beacon-enabled/TestIndirect/README.txt @@ -0,0 +1,43 @@ +README for TestIndirect +Author/Contact: Jan Hauer + +Description: + +In this application one node takes the role of a PAN coordinator in a +beacon-enabled 802.15.4 PAN, it transmits periodic beacons and additionally in +every beacon interval it tries to transmit one DATA frame to a device using +indirect tranmission. A second node that takes the role of a device first scans +the pre-defined channel for beacons from the coordinator and once it finds a +beacon it tries to synchronize to and track all future beacons. Whenever the +coordinator has data to send (indicated in the beacon), the device extracts the +DATA frame from the coordinator. + +Criteria for a successful test: + +Both nodes should toggle the LED1 in unison, about once every half second. +The coordinator should also toggle LED2 with the same frequency. + + +Tools: NONE + +Usage: + +1. Install the coordinator: + + $ cd coordinator; make install + +2. Install one device + + $ cd device; make install + +You can change some of the configuration parameters in app_profile.h + +Known bugs/limitations: + +- Many TinyOS 2 platforms do not have a clock that satisfies the + precision/accuracy requirements of the IEEE 802.15.4 standard (e.g. + 62.500 Hz, +-40 ppm in the 2.4 GHz band); in this case the MAC timing + is not standard compliant + +$Id$ + diff --git a/apps/tests/tkn154/TestIndirect/app_profile.h b/apps/tests/tkn154/beacon-enabled/TestIndirect/app_profile.h similarity index 100% rename from apps/tests/tkn154/TestIndirect/app_profile.h rename to apps/tests/tkn154/beacon-enabled/TestIndirect/app_profile.h diff --git a/apps/tests/tkn154/TestIndirect/coordinator/Makefile b/apps/tests/tkn154/beacon-enabled/TestIndirect/coordinator/Makefile similarity index 77% rename from apps/tests/tkn154/TestIndirect/coordinator/Makefile rename to apps/tests/tkn154/beacon-enabled/TestIndirect/coordinator/Makefile index acdecfdc..2f060808 100644 --- a/apps/tests/tkn154/TestIndirect/coordinator/Makefile +++ b/apps/tests/tkn154/beacon-enabled/TestIndirect/coordinator/Makefile @@ -1,4 +1,4 @@ COMPONENT=TestIndirectAppC PFLAGS += -DIEEE154_BEACON_SYNC_DISABLED -DIEEE154_SCAN_DISABLED CFLAGS += -I$(shell pwd)/.. -include ../../Makefile.include +include ../../../Makefile.include diff --git a/apps/tests/tkn154/TestIndirect/coordinator/TestCoordSenderC.nc b/apps/tests/tkn154/beacon-enabled/TestIndirect/coordinator/TestCoordSenderC.nc similarity index 97% rename from apps/tests/tkn154/TestIndirect/coordinator/TestCoordSenderC.nc rename to apps/tests/tkn154/beacon-enabled/TestIndirect/coordinator/TestCoordSenderC.nc index 454cbdad..e270937f 100644 --- a/apps/tests/tkn154/TestIndirect/coordinator/TestCoordSenderC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestIndirect/coordinator/TestCoordSenderC.nc @@ -55,32 +55,14 @@ module TestCoordSenderC uint8_t m_payloadLen; event void Boot.booted() { - char payload[] = "Hello Device!"; - uint8_t *payloadRegion; - ieee154_address_t deviceShortAddress; - - // construct the frame - m_payloadLen = strlen(payload); - payloadRegion = call Packet.getPayload(&m_frame, m_payloadLen); - deviceShortAddress.shortAddress = DEVICE_ADDRESS; // destination - if (m_payloadLen <= call Packet.maxPayloadLength()){ - memcpy(payloadRegion, payload, m_payloadLen); - call Frame.setAddressingFields( - &m_frame, - ADDR_MODE_SHORT_ADDRESS, // SrcAddrMode, - ADDR_MODE_SHORT_ADDRESS, // DstAddrMode, - PAN_ID, // DstPANId, - &deviceShortAddress, // DstAddr, - NULL // security - ); - call MLME_RESET.request(TRUE, BEACON_ENABLED_PAN); - } + call MLME_RESET.request(TRUE); } event void MLME_RESET.confirm(ieee154_status_t status) { if (status != IEEE154_SUCCESS) return; + call MLME_SET.macShortAddress(COORDINATOR_ADDRESS); call MLME_SET.macAssociationPermit(FALSE); call MLME_START.request( @@ -110,8 +92,26 @@ module TestCoordSenderC event void MLME_START.confirm(ieee154_status_t status) { - if (status == IEEE154_SUCCESS) + char payload[] = "Hello Device!"; + uint8_t *payloadRegion; + ieee154_address_t deviceShortAddress; + + // construct the frame + m_payloadLen = strlen(payload); + payloadRegion = call Packet.getPayload(&m_frame, m_payloadLen); + deviceShortAddress.shortAddress = DEVICE_ADDRESS; // destination + if (status == IEEE154_SUCCESS && m_payloadLen <= call Packet.maxPayloadLength()) { + memcpy(payloadRegion, payload, m_payloadLen); + call Frame.setAddressingFields( + &m_frame, + ADDR_MODE_SHORT_ADDRESS, // SrcAddrMode, + ADDR_MODE_SHORT_ADDRESS, // DstAddrMode, + PAN_ID, // DstPANId, + &deviceShortAddress, // DstAddr, + NULL // security + ); dataRequest(); + } } event void MCPS_DATA.confirm( diff --git a/apps/tests/tkn154/TestIndirect/coordinator/TestIndirectAppC.nc b/apps/tests/tkn154/beacon-enabled/TestIndirect/coordinator/TestIndirectAppC.nc similarity index 85% rename from apps/tests/tkn154/TestIndirect/coordinator/TestIndirectAppC.nc rename to apps/tests/tkn154/beacon-enabled/TestIndirect/coordinator/TestIndirectAppC.nc index c64332b9..2ba70e27 100644 --- a/apps/tests/tkn154/TestIndirect/coordinator/TestIndirectAppC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestIndirect/coordinator/TestIndirectAppC.nc @@ -35,18 +35,18 @@ configuration TestIndirectAppC { } implementation { - components MainC, LedsC, Ieee802154MacC; + components MainC, LedsC, Ieee802154BeaconEnabledC as MAC; components TestCoordSenderC as App; MainC.Boot <- App; App.Leds -> LedsC; - App.MLME_RESET -> Ieee802154MacC; - App.MLME_SET -> Ieee802154MacC; - App.MLME_GET -> Ieee802154MacC; - App.MLME_START -> Ieee802154MacC; - App.MCPS_DATA -> Ieee802154MacC; - App.Frame -> Ieee802154MacC; - App.IEEE154TxBeaconPayload -> Ieee802154MacC; - App.Packet -> Ieee802154MacC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; + App.MLME_START -> MAC; + App.MCPS_DATA -> MAC; + App.Frame -> MAC; + App.IEEE154TxBeaconPayload -> MAC; + App.Packet -> MAC; } diff --git a/apps/tests/tkn154/TestIndirect/device/Makefile b/apps/tests/tkn154/beacon-enabled/TestIndirect/device/Makefile similarity index 73% rename from apps/tests/tkn154/TestIndirect/device/Makefile rename to apps/tests/tkn154/beacon-enabled/TestIndirect/device/Makefile index 09b0d212..65d2fe20 100644 --- a/apps/tests/tkn154/TestIndirect/device/Makefile +++ b/apps/tests/tkn154/beacon-enabled/TestIndirect/device/Makefile @@ -1,4 +1,4 @@ COMPONENT=TestIndirectAppC PFLAGS += -DIEEE154_BEACON_TX_DISABLED CFLAGS += -I$(shell pwd)/.. -include ../../Makefile.include +include ../../../Makefile.include diff --git a/apps/tests/tkn154/TestIndirect/device/TestDeviceReceiverC.nc b/apps/tests/tkn154/beacon-enabled/TestIndirect/device/TestDeviceReceiverC.nc similarity index 96% rename from apps/tests/tkn154/TestIndirect/device/TestDeviceReceiverC.nc rename to apps/tests/tkn154/beacon-enabled/TestIndirect/device/TestDeviceReceiverC.nc index 45396db7..dc2482d3 100644 --- a/apps/tests/tkn154/TestIndirect/device/TestDeviceReceiverC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestIndirect/device/TestDeviceReceiverC.nc @@ -55,11 +55,11 @@ module TestDeviceReceiverC uint8_t m_coordAddressMode; ieee154_macPANId_t m_coordPANID; ieee154_PANDescriptor_t m_PANDescriptor; - bool m_isPANDescriptorValid; + bool m_wasScanSuccessful; void startApp(); event void Boot.booted() { - call MLME_RESET.request(TRUE, BEACON_ENABLED_PAN); + call MLME_RESET.request(TRUE); } event void MLME_RESET.confirm(ieee154_status_t status) @@ -82,6 +82,7 @@ module TestDeviceReceiverC // through the MLME_BEACON_NOTIFY interface, i.e. // we set the macAutoRequest attribute to FALSE call MLME_SET.macAutoRequest(FALSE); + m_wasScanSuccessful = FALSE; call MLME_SCAN.request ( PASSIVE_SCAN, // ScanType channel, // ScanChannels @@ -100,14 +101,14 @@ module TestDeviceReceiverC // received a beacon frame during SCAN ieee154_phyCurrentPage_t page = call MLME_GET.phyCurrentPage(); - if (!m_isPANDescriptorValid && call BeaconFrame.parsePANDescriptor( + if (!m_wasScanSuccessful && call BeaconFrame.parsePANDescriptor( frame, RADIO_CHANNEL, page, &m_PANDescriptor) == SUCCESS){ // let's see if the beacon is from our coordinator... if (m_PANDescriptor.CoordAddrMode == ADDR_MODE_SHORT_ADDRESS && m_PANDescriptor.CoordPANId == PAN_ID && m_PANDescriptor.CoordAddress.shortAddress == COORDINATOR_ADDRESS){ // wait until SCAN is finished, then syncronize to beacons - m_isPANDescriptorValid = TRUE; + m_wasScanSuccessful = TRUE; } } return frame; @@ -124,7 +125,7 @@ module TestDeviceReceiverC ieee154_PANDescriptor_t* PANDescriptorList ) { - if (m_isPANDescriptorValid){ + if (m_wasScanSuccessful){ // set the macAutoRequest attribute to TRUE, so indirect // transmissions are automatically carried through call MLME_SET.macAutoRequest(TRUE); @@ -152,7 +153,6 @@ module TestDeviceReceiverC ieee154_security_t *security) { call Leds.led1Off(); - startApp(); } event message_t* MCPS_DATA.indication (message_t* frame) diff --git a/apps/tests/tkn154/TestIndirect/device/TestIndirectAppC.nc b/apps/tests/tkn154/beacon-enabled/TestIndirect/device/TestIndirectAppC.nc similarity index 84% rename from apps/tests/tkn154/TestIndirect/device/TestIndirectAppC.nc rename to apps/tests/tkn154/beacon-enabled/TestIndirect/device/TestIndirectAppC.nc index 4583acb1..f077e5d0 100644 --- a/apps/tests/tkn154/TestIndirect/device/TestIndirectAppC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestIndirect/device/TestIndirectAppC.nc @@ -36,18 +36,18 @@ configuration TestIndirectAppC { } implementation { - components MainC, LedsC, Ieee802154MacC; + components MainC, LedsC, Ieee802154BeaconEnabledC as MAC; components TestDeviceReceiverC as App; MainC.Boot <- App; App.Leds -> LedsC; - App.MLME_RESET -> Ieee802154MacC; - App.MLME_SET -> Ieee802154MacC; - App.MLME_GET -> Ieee802154MacC; - App.MLME_SCAN -> Ieee802154MacC; - App.MLME_SYNC -> Ieee802154MacC; - App.MLME_BEACON_NOTIFY -> Ieee802154MacC; - App.MLME_SYNC_LOSS -> Ieee802154MacC; - App.MCPS_DATA -> Ieee802154MacC; - App.BeaconFrame -> Ieee802154MacC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; + App.MLME_SCAN -> MAC; + App.MLME_SYNC -> MAC; + App.MLME_BEACON_NOTIFY -> MAC; + App.MLME_SYNC_LOSS -> MAC; + App.MCPS_DATA -> MAC; + App.BeaconFrame -> MAC; } diff --git a/apps/tests/tkn154/beacon-enabled/TestStartSync/README.txt b/apps/tests/tkn154/beacon-enabled/TestStartSync/README.txt new file mode 100644 index 00000000..0f4b39c0 --- /dev/null +++ b/apps/tests/tkn154/beacon-enabled/TestStartSync/README.txt @@ -0,0 +1,40 @@ +README for TestStartSync +Author/Contact: Jan Hauer + +Description: + +In this application one node takes the role of a PAN coordinator in a +beacon-enabled 802.15.4 PAN, it transmits periodic beacons with a frequency +defined in the app_profile.h file. A second node acts as a device, it first +scans all available channels for beacons from the coordinator and once it finds +a beacon it tries to synchronize to and track all future beacons. + +Criteria for a successful test: + +After a few seconds all nodes should have the LED1 turned on and LED2 +toggling in unison every second. + + +Tools: NONE + +Usage: + +1. Install the coordinator: + + $ cd coordinator; make install + +2. Install one (or more) devices: + + $ cd device; make install + +You can change some of the configuration parameters in app_profile.h + +Known bugs/limitations: + +- Many TinyOS 2 platforms do not have a clock that satisfies the + precision/accuracy requirements of the IEEE 802.15.4 standard (e.g. + 62.500 Hz, +-40 ppm in the 2.4 GHz band); in this case the MAC timing + is not standard compliant + +$Id$ + diff --git a/apps/tests/tkn154/TestStartSync/app_profile.h b/apps/tests/tkn154/beacon-enabled/TestStartSync/app_profile.h similarity index 100% rename from apps/tests/tkn154/TestStartSync/app_profile.h rename to apps/tests/tkn154/beacon-enabled/TestStartSync/app_profile.h diff --git a/apps/tests/tkn154/beacon-enabled/TestStartSync/coordinator/Makefile b/apps/tests/tkn154/beacon-enabled/TestStartSync/coordinator/Makefile new file mode 100644 index 00000000..0b0bf72b --- /dev/null +++ b/apps/tests/tkn154/beacon-enabled/TestStartSync/coordinator/Makefile @@ -0,0 +1,4 @@ +COMPONENT=TestStartSyncAppC +CFLAGS += -I$(shell pwd)/.. +CFLAGS += -DIEEE154_SCAN_DISABLED -DIEEE154_BEACON_SYNC_DISABLED +include ../../../Makefile.include diff --git a/apps/tests/tkn154/TestStartSync/coordinator/TestCoordC.nc b/apps/tests/tkn154/beacon-enabled/TestStartSync/coordinator/TestCoordC.nc similarity index 98% rename from apps/tests/tkn154/TestStartSync/coordinator/TestCoordC.nc rename to apps/tests/tkn154/beacon-enabled/TestStartSync/coordinator/TestCoordC.nc index f752bdad..e401db6c 100644 --- a/apps/tests/tkn154/TestStartSync/coordinator/TestCoordC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestStartSync/coordinator/TestCoordC.nc @@ -51,7 +51,7 @@ module TestCoordC uint8_t m_beaconPayload[] = {0x01, 0x02, 0x03, 0x04, 0x05}; event void Boot.booted() { - call MLME_RESET.request(TRUE, BEACON_ENABLED_PAN); + call MLME_RESET.request(TRUE); } event void MLME_RESET.confirm(ieee154_status_t status) diff --git a/apps/tests/tkn154/TestStartSync/coordinator/TestStartSyncAppC.nc b/apps/tests/tkn154/beacon-enabled/TestStartSync/coordinator/TestStartSyncAppC.nc similarity index 88% rename from apps/tests/tkn154/TestStartSync/coordinator/TestStartSyncAppC.nc rename to apps/tests/tkn154/beacon-enabled/TestStartSync/coordinator/TestStartSyncAppC.nc index d0913c7f..6020c4b5 100644 --- a/apps/tests/tkn154/TestStartSync/coordinator/TestStartSyncAppC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestStartSync/coordinator/TestStartSyncAppC.nc @@ -37,14 +37,14 @@ configuration TestStartSyncAppC { } implementation { - components MainC, LedsC, Ieee802154MacC as Ieee802154MacC; + components MainC, LedsC, Ieee802154BeaconEnabledC as MAC; components TestCoordC as App; MainC.Boot <- App; - App.MLME_START -> Ieee802154MacC; - App.IEEE154TxBeaconPayload -> Ieee802154MacC; + App.MLME_START -> MAC; + App.IEEE154TxBeaconPayload -> MAC; App.Leds -> LedsC; - App.MLME_RESET -> Ieee802154MacC; - App.MLME_SET -> Ieee802154MacC; - App.MLME_GET -> Ieee802154MacC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; } diff --git a/apps/tests/tkn154/TestStartSync/device/Makefile b/apps/tests/tkn154/beacon-enabled/TestStartSync/device/Makefile similarity index 73% rename from apps/tests/tkn154/TestStartSync/device/Makefile rename to apps/tests/tkn154/beacon-enabled/TestStartSync/device/Makefile index 1f9448f4..3fb36983 100644 --- a/apps/tests/tkn154/TestStartSync/device/Makefile +++ b/apps/tests/tkn154/beacon-enabled/TestStartSync/device/Makefile @@ -1,4 +1,4 @@ COMPONENT=TestStartSyncAppC PFLAGS += -DIEEE154_BEACON_TX_DISABLED CFLAGS += -I$(shell pwd)/.. -include ../../Makefile.include +include ../../../Makefile.include diff --git a/apps/tests/tkn154/TestStartSync/device/TestDeviceC.nc b/apps/tests/tkn154/beacon-enabled/TestStartSync/device/TestDeviceC.nc similarity index 95% rename from apps/tests/tkn154/TestStartSync/device/TestDeviceC.nc rename to apps/tests/tkn154/beacon-enabled/TestStartSync/device/TestDeviceC.nc index 93713b8a..c11193a2 100644 --- a/apps/tests/tkn154/TestStartSync/device/TestDeviceC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestStartSync/device/TestDeviceC.nc @@ -58,7 +58,7 @@ module TestDeviceC void startApp(); event void Boot.booted() { - call MLME_RESET.request(TRUE, BEACON_ENABLED_PAN); + call MLME_RESET.request(TRUE); } event void MLME_RESET.confirm(ieee154_status_t status) @@ -69,13 +69,14 @@ module TestDeviceC void startApp() { - ieee154_phyChannelsSupported_t supportedChannels; + ieee154_phyChannelsSupported_t scanChannels; uint8_t scanDuration = BEACON_ORDER; // set the short address to whatever was passed // as a parameter to make system ("make install,X") call MLME_SET.macShortAddress(TOS_NODE_ID); - supportedChannels = call MLME_GET.phyChannelsSupported(); + scanChannels = call MLME_GET.phyChannelsSupported(); + //scanChannels = (uint32_t) 1 << RADIO_CHANNEL; // setting the macAutoRequest attribute to TRUE means // that during the scan beacons will not be signalled @@ -83,7 +84,7 @@ module TestDeviceC call MLME_SET.macAutoRequest(TRUE); call MLME_SCAN.request ( PASSIVE_SCAN, // ScanType - supportedChannels, // ScanChannels + scanChannels, // ScanChannels scanDuration, // ScanDuration 0x00, // ChannelPage 0, // EnergyDetectListNumEntries diff --git a/apps/tests/tkn154/TestStartSync/device/TestStartSyncAppC.nc b/apps/tests/tkn154/beacon-enabled/TestStartSync/device/TestStartSyncAppC.nc similarity index 85% rename from apps/tests/tkn154/TestStartSync/device/TestStartSyncAppC.nc rename to apps/tests/tkn154/beacon-enabled/TestStartSync/device/TestStartSyncAppC.nc index 9373400a..c6f1f676 100644 --- a/apps/tests/tkn154/TestStartSync/device/TestStartSyncAppC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestStartSync/device/TestStartSyncAppC.nc @@ -37,20 +37,20 @@ configuration TestStartSyncAppC { } implementation { - components MainC, LedsC, Ieee802154MacC as Ieee802154MacC; + components MainC, LedsC, Ieee802154BeaconEnabledC as MAC; components TestDeviceC as App; - App.MLME_SCAN -> Ieee802154MacC; - App.MLME_SYNC -> Ieee802154MacC; - App.MLME_BEACON_NOTIFY -> Ieee802154MacC; - App.MLME_SYNC_LOSS -> Ieee802154MacC; - App.BeaconFrame -> Ieee802154MacC; + App.MLME_SCAN -> MAC; + App.MLME_SYNC -> MAC; + App.MLME_BEACON_NOTIFY -> MAC; + App.MLME_SYNC_LOSS -> MAC; + App.BeaconFrame -> MAC; MainC.Boot <- App; App.Leds -> LedsC; - App.MLME_RESET -> Ieee802154MacC; - App.MLME_SET -> Ieee802154MacC; - App.MLME_GET -> Ieee802154MacC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; #ifdef PRINTF_ENABLED components PrintfC; diff --git a/apps/tests/tkn154/makeall.sh b/apps/tests/tkn154/makeall.sh new file mode 100755 index 00000000..a7e92614 --- /dev/null +++ b/apps/tests/tkn154/makeall.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# compile/clean all test applications +PLATFORM=$1 +OPTIONS= +STARTDIR=`pwd` +MAKEFILES=`find . -name Makefile` + +if [ $# == 0 ]; +then + echo "Usage: $0 " + exit +fi + +for m in $MAKEFILES +do + cd ${m%Makefile} + if [ "x$1" == xclean ]; + then + make clean + else + make $PLATFORM $OPTIONS; + fi + cd $STARTDIR +done +exit + diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/README.txt b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/README.txt new file mode 100644 index 00000000..4de87f23 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/README.txt @@ -0,0 +1,40 @@ +README for TestActiveScan +Author/Contact: Jan Hauer + +Description: + +In this application one node takes the role of a PAN coordinator in a +nonbeacon-enabled 802.15.4 PAN, it switches its radio to receive mode. A +second node acts as a device, it switches to the pre-defined channel and +periodically performs active-scans (i.e. sends out beacon request frames) on +the predefined channel and expects beacon frames in return. + +Criteria for a successful test: + +The coordinator should toggle LED1 once every 2 seconds. The device should +toggle LED1 and LED2 every 2 seconds (not necessarily simultaneously). + + +Tools: NONE + +Usage: + +1. Install the coordinator: + + $ cd coordinator; make install + +2. Install one (or more) devices: + + $ cd device; make install + +You can change some of the configuration parameters in app_profile.h + +Known bugs/limitations: + +- Many TinyOS 2 platforms do not have a clock that satisfies the + precision/accuracy requirements of the IEEE 802.15.4 standard (e.g. + 62.500 Hz, +-40 ppm in the 2.4 GHz band); in this case the MAC timing + is not standard compliant + +$Id$o + diff --git a/tos/lib/mac/tkn154/dummies/NoDebugP.nc b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/app_profile.h similarity index 78% rename from tos/lib/mac/tkn154/dummies/NoDebugP.nc rename to apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/app_profile.h index 229ae19f..c8e46a9b 100644 --- a/tos/lib/mac/tkn154/dummies/NoDebugP.nc +++ b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/app_profile.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Technische Universitaet Berlin + * Copyright (c) 2009, Technische Universitaet Berlin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,26 +29,20 @@ * - Revision ------------------------------------------------------------- * $Revision$ * $Date$ - * @author Jan Hauer + * @author: Jasper Buesch * ======================================================================== */ -#include "TKN154_DEBUG.h" -module NoDebugP -{ - provides - { - interface Ieee802154Debug[uint8_t client]; - } -} -implementation -{ - async command void Ieee802154Debug.log[uint8_t client]( - uint8_t priority, - uint8_t eventID, - uint32_t param1, - uint32_t param2, - uint32_t param3) - { - } - command void Ieee802154Debug.flush[uint8_t client](){} -} + +#ifndef __APP_PROFILE_H +#define __APP_PROFILE_H + +enum { + RADIO_CHANNEL = 26, + PAN_ID = 0x1234, + COORDINATOR_ADDRESS = 0x2345, + DEVICE_ADDRESS = 0x2346 +}; + +#endif + + diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/coordinator/Makefile b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/coordinator/Makefile new file mode 100644 index 00000000..8558fc7d --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/coordinator/Makefile @@ -0,0 +1,3 @@ +COMPONENT=TestActiveScanCoordAppC +CFLAGS += -I$(shell pwd)/.. +include ../../../Makefile.include diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/coordinator/TestActiveScanCoordAppC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/coordinator/TestActiveScanCoordAppC.nc new file mode 100644 index 00000000..a1c07f52 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/coordinator/TestActiveScanCoordAppC.nc @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2009, Technische Universitaet Berlin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the Technische Universitaet Berlin nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * - Revision ------------------------------------------------------------- + * $Revision$ + * $Date$ + * @author: Jasper Buesch + * ======================================================================== + */ + +configuration TestActiveScanCoordAppC +{ +} implementation { + components MainC, LedsC, Ieee802154NonBeaconEnabledC as MAC; + components new Timer62500C() as Timer1; + components TestActiveScanCoordC as App; + + MainC.Boot <- App; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; + App.MLME_START -> MAC; + App.IEEE154TxBeaconPayload -> MAC; + + App.Led1Timer -> Timer1; + App.Leds -> LedsC; +} diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/coordinator/TestActiveScanCoordC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/coordinator/TestActiveScanCoordC.nc new file mode 100644 index 00000000..515a4414 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/coordinator/TestActiveScanCoordC.nc @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2009, Technische Universitaet Berlin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the Technische Universitaet Berlin nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * - Revision ------------------------------------------------------------- + * $Revision$ + * $Date$ + * @author: Jasper Buesch + * ======================================================================== + */ + +#include "TKN154.h" +#include "app_profile.h" +module TestActiveScanCoordC +{ + uses { + interface Boot; + interface MLME_RESET; + interface MLME_START; + interface MLME_SET; + interface MLME_GET; + interface IEEE154TxBeaconPayload; + interface Leds; + interface Timer as Led1Timer; + + } +} implementation { + + event void Boot.booted() { + call MLME_RESET.request(TRUE); + } + + event void MLME_RESET.confirm(ieee154_status_t status) { + if (status != IEEE154_SUCCESS) + return; + call MLME_SET.macShortAddress(COORDINATOR_ADDRESS); + call MLME_SET.macAssociationPermit(FALSE); + call MLME_SET.macRxOnWhenIdle(TRUE); + call MLME_START.request( + PAN_ID, // PANId + RADIO_CHANNEL, // LogicalChannel + 0, // ChannelPage, + 0, // StartTime, + 15, // BeaconOrder + 15, // SuperframeOrder + TRUE, // PANCoordinator + FALSE, // BatteryLifeExtension + FALSE, // CoordRealignment + NULL, // no realignment security + NULL // no beacon security + ); + } + + event void MLME_START.confirm(ieee154_status_t status) {} + + event void IEEE154TxBeaconPayload.aboutToTransmit() { + call Leds.led1On(); + call Led1Timer.startOneShot(62500U); + } + + event void Led1Timer.fired(){ + call Leds.led1Off(); + } + + event void IEEE154TxBeaconPayload.setBeaconPayloadDone(void *beaconPayload, uint8_t length){} + event void IEEE154TxBeaconPayload.modifyBeaconPayloadDone(uint8_t offset, void *buffer, uint8_t bufferLength){} + event void IEEE154TxBeaconPayload.beaconTransmitted(){} +} diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/device/Makefile b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/device/Makefile new file mode 100644 index 00000000..1f7a2be5 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/device/Makefile @@ -0,0 +1,3 @@ +COMPONENT=TestActiveScanDeviceAppC +CFLAGS += -I$(shell pwd)/.. +include ../../../Makefile.include diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/device/TestActiveScanDeviceAppC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/device/TestActiveScanDeviceAppC.nc new file mode 100644 index 00000000..941bbc48 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/device/TestActiveScanDeviceAppC.nc @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2009, Technische Universitaet Berlin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the Technische Universitaet Berlin nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * - Revision ------------------------------------------------------------- + * $Revision$ + * $Date$ + * @author: Jasper Buesch + * ======================================================================== + */ + +configuration TestActiveScanDeviceAppC +{ +} implementation { + components MainC, LedsC, Ieee802154NonBeaconEnabledC as MAC, + new Timer62500C() as Timer1, + new Timer62500C() as Timer2, + new Timer62500C() as Timer3, + new Timer62500C() as Timer4; + components TestActiveScanDeviceC as App; + + MainC.Boot <- App; + App.Leds -> LedsC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; + App.MLME_SCAN -> MAC; + + App.ScanTimer -> Timer1; + App.Led0Timer -> Timer2; + App.Led1Timer -> Timer3; + App.Led2Timer -> Timer4; + + +} diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/device/TestActiveScanDeviceC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/device/TestActiveScanDeviceC.nc new file mode 100644 index 00000000..8bd067be --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/device/TestActiveScanDeviceC.nc @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2009, Technische Universitaet Berlin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the Technische Universitaet Berlin nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * - Revision ------------------------------------------------------------- + * $Revision$ + * $Date$ + * @author: Jasper Buesch + * ======================================================================== + */ + +#include "TKN154.h" +#include "app_profile.h" +module TestActiveScanDeviceC +{ + uses { + interface Boot; + interface MLME_RESET; + interface MLME_SET; + interface MLME_GET; + interface MLME_SCAN; + interface Leds; + interface Timer as ScanTimer; + interface Timer as Led1Timer; + interface Timer as Led0Timer; + interface Timer as Led2Timer; + } +} implementation { + + ieee154_PANDescriptor_t m_PANDescriptor[5]; + + event void Boot.booted() { + call MLME_RESET.request(TRUE); + } + + event void MLME_RESET.confirm(ieee154_status_t status) { + if (status == IEEE154_SUCCESS){ + call ScanTimer.startPeriodic(125000U); + } + } + + event void ScanTimer.fired() { + ieee154_phyChannelsSupported_t channelMask; + channelMask = ((uint32_t) 1) << RADIO_CHANNEL; + call Leds.led2On(); + call Led2Timer.startOneShot(62500U); + call MLME_SCAN.request ( + ACTIVE_SCAN, // ScanType + channelMask, // ScanChannels + 5, // ScanDuration + 0x00, // ChannelPage + 0, // EnergyDetectListNumEntries + NULL, // EnergyDetectList + 5, // PANDescriptorListNumEntries + m_PANDescriptor, // PANDescriptorList + 0 // security + ); + } + + event void MLME_SCAN.confirm ( + ieee154_status_t status, + uint8_t ScanType, + uint8_t ChannelPage, + uint32_t UnscannedChannels, + uint8_t EnergyDetectListNumEntries, + int8_t* EnergyDetectList, + uint8_t PANDescriptorListNumEntries, + ieee154_PANDescriptor_t* PANDescriptorList + ){ + uint8_t scanIndex; + uint8_t rightCoordFound = FALSE; + + for(scanIndex = 0; scanIndex < PANDescriptorListNumEntries; scanIndex++){ + if( (PANDescriptorList[scanIndex].CoordAddrMode == ADDR_MODE_SHORT_ADDRESS) && + (PANDescriptorList[scanIndex].CoordAddress.shortAddress == COORDINATOR_ADDRESS) && + (PANDescriptorList[scanIndex].CoordPANId == PAN_ID) ) { + call Leds.led1On(); + call Led1Timer.startOneShot(62500U); + rightCoordFound = TRUE; + break; + } + } + if(rightCoordFound == FALSE) { + // call Leds.led0On(); + // call Led0Timer.startOneShot(62500U); + } + } + + event void Led0Timer.fired(){ + call Leds.led0Off(); + } + + event void Led1Timer.fired(){ + call Leds.led1Off(); + } + + event void Led2Timer.fired(){ + call Leds.led2Off(); + } + +} diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/README.txt b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/README.txt new file mode 100644 index 00000000..194911fb --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/README.txt @@ -0,0 +1,44 @@ +README for TestAssociate +Author/Contact: Jan Hauer + +Description: + +In this application one node takes the role of a PAN coordinator in a +nonbeacon-enabled 802.15.4 PAN, it switches its radio to receive mode and waits +for devices to request association to its PAN. Whenever a device tries to +associate, the PAN coordinator allows association and assigns to the device a +unique short address (starting from zero, incremented for every device +requesting association). A second node acts as a device, it switches to the +pre-defined channel and tries to associate to the PAN. A short time after +association the device then disassociates from the PAN. + +Criteria for a successful test: + +Assuming one coordinator and one device has been installed, both should +simultaneously switch on LED1. About 5 seconds later both should switch LED1 +off. That's all. + + +Tools: NONE + +Usage: + +1. Install the coordinator: + + $ cd coordinator; make install + +2. Install one (or more) devices: + + $ cd device; make install + +You can change some of the configuration parameters in app_profile.h + +Known bugs/limitations: + +- Many TinyOS 2 platforms do not have a clock that satisfies the + precision/accuracy requirements of the IEEE 802.15.4 standard (e.g. + 62.500 Hz, +-40 ppm in the 2.4 GHz band); in this case the MAC timing + is not standard compliant + +$Id$o + diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/app_profile.h b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/app_profile.h new file mode 100644 index 00000000..bf986b55 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/app_profile.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2008, Technische Universitaet Berlin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the Technische Universitaet Berlin nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * - Revision ------------------------------------------------------------- + * $Revision$ + * $Date$ + * @author: Jan Hauer + * ======================================================================== + */ + +#ifndef __APP_PROFILE_H +#define __APP_PROFILE_H + +enum { + RADIO_CHANNEL = 26, + PAN_ID = 0x9678, + COORDINATOR_ADDRESS = 0x7722, +}; + +#endif diff --git a/apps/tests/tkn154/TestAssociate/device/Makefile b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/coordinator/Makefile similarity index 62% rename from apps/tests/tkn154/TestAssociate/device/Makefile rename to apps/tests/tkn154/nonbeacon-enabled/TestAssociate/coordinator/Makefile index 7fe71344..c4d5d67c 100644 --- a/apps/tests/tkn154/TestAssociate/device/Makefile +++ b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/coordinator/Makefile @@ -1,3 +1,3 @@ COMPONENT=TestAssociateAppC CFLAGS += -I$(shell pwd)/.. -include ../../Makefile.include +include ../../../Makefile.include diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/coordinator/TestAssociateAppC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/coordinator/TestAssociateAppC.nc new file mode 100644 index 00000000..19052340 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/coordinator/TestAssociateAppC.nc @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2008, Technische Universitaet Berlin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the Technische Universitaet Berlin nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * - Revision ------------------------------------------------------------- + * $Revision$ + * $Date$ + * @author: Jan Hauer + * ======================================================================== + */ + +configuration TestAssociateAppC +{ +} implementation { + components MainC, LedsC, Ieee802154NonBeaconEnabledC as MAC; + components TestCoordC as App; + + MainC.Boot <- App; + App.Leds -> LedsC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; + + App.MLME_START -> MAC; + App.MLME_ASSOCIATE -> MAC; + App.MLME_DISASSOCIATE -> MAC; + App.MLME_COMM_STATUS -> MAC; +} diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/coordinator/TestCoordC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/coordinator/TestCoordC.nc new file mode 100644 index 00000000..31930dc6 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/coordinator/TestCoordC.nc @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2008, Technische Universitaet Berlin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the Technische Universitaet Berlin nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * - Revision ------------------------------------------------------------- + * $Revision$ + * $Date$ + * @author: Jan Hauer + * ======================================================================== + */ + +#include "TKN154.h" +#include "app_profile.h" +module TestCoordC +{ + uses { + interface Boot; + interface MLME_RESET; + interface MLME_START; + interface MLME_ASSOCIATE; + interface MLME_DISASSOCIATE; + interface MLME_COMM_STATUS; + interface MLME_SET; + interface MLME_GET; + interface Leds; + } +} implementation { + + ieee154_address_t m_lastDevice; + uint16_t m_shortAddress; + + event void Boot.booted() { + call MLME_RESET.request(TRUE); + } + + event void MLME_RESET.confirm(ieee154_status_t status) + { + if (status != IEEE154_SUCCESS) + return; + call MLME_SET.macShortAddress(COORDINATOR_ADDRESS); + call MLME_SET.macAssociationPermit(TRUE); + call MLME_SET.macRxOnWhenIdle(TRUE); + call MLME_START.request( + PAN_ID, // PANId + RADIO_CHANNEL, // LogicalChannel + 0, // ChannelPage, + 0, // StartTime, + 15, // BeaconOrder + 15, // SuperframeOrder + TRUE, // PANCoordinator + FALSE, // BatteryLifeExtension + FALSE, // CoordRealignment + NULL, // no realignment security + NULL // no beacon security + ); + } + + event void MLME_START.confirm(ieee154_status_t status) { + // good, let's wait for association requests ... + } + + event void MLME_ASSOCIATE.indication ( + uint64_t DeviceAddress, + ieee154_CapabilityInformation_t CapabilityInformation, + ieee154_security_t *security + ) + { + call MLME_ASSOCIATE.response(DeviceAddress, m_shortAddress++, IEEE154_ASSOCIATION_SUCCESSFUL, 0); + } + + event void MLME_DISASSOCIATE.indication ( + uint64_t DeviceAddress, + ieee154_disassociation_reason_t DisassociateReason, + ieee154_security_t *security + ) + { + call Leds.led1Off(); + } + + + event void MLME_COMM_STATUS.indication ( + uint16_t PANId, + uint8_t SrcAddrMode, + ieee154_address_t SrcAddr, + uint8_t DstAddrMode, + ieee154_address_t DstAddr, + ieee154_status_t status, + ieee154_security_t *security + ) + { + if (status == IEEE154_SUCCESS){ + // association was successful + call Leds.led1On(); + m_lastDevice.extendedAddress = DstAddr.extendedAddress; + } else { + call Leds.led1Off(); + } + } + + event void MLME_DISASSOCIATE.confirm ( + ieee154_status_t status, + uint8_t DeviceAddrMode, + uint16_t DevicePANID, + ieee154_address_t DeviceAddress + ){} + + event void MLME_ASSOCIATE.confirm ( + uint16_t AssocShortAddress, + uint8_t status, + ieee154_security_t *security + ){} +} diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/device/Makefile b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/device/Makefile new file mode 100644 index 00000000..c4d5d67c --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/device/Makefile @@ -0,0 +1,3 @@ +COMPONENT=TestAssociateAppC +CFLAGS += -I$(shell pwd)/.. +include ../../../Makefile.include diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/device/TestAssociateAppC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/device/TestAssociateAppC.nc new file mode 100644 index 00000000..0ead6a30 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/device/TestAssociateAppC.nc @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2008, Technische Universitaet Berlin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the Technische Universitaet Berlin nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * - Revision ------------------------------------------------------------- + * $Revision$ + * $Date$ + * @author: Jan Hauer + * ======================================================================== + */ + +configuration TestAssociateAppC +{ +} implementation { + components MainC, LedsC, Ieee802154NonBeaconEnabledC as MAC, + new Timer62500C() as Timer; + components TestDeviceC as App; + + MainC.Boot <- App; + App.Leds -> LedsC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; + App.DisassociateTimer -> Timer; + App.MLME_ASSOCIATE -> MAC; + App.MLME_DISASSOCIATE -> MAC; + App.MLME_COMM_STATUS -> MAC; + +} diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/device/TestDeviceC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/device/TestDeviceC.nc new file mode 100644 index 00000000..955b60c3 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestAssociate/device/TestDeviceC.nc @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2008, Technische Universitaet Berlin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the Technische Universitaet Berlin nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * - Revision ------------------------------------------------------------- + * $Revision$ + * $Date$ + * @author: Jan Hauer + * ======================================================================== + */ +#include "TKN154.h" +#include "app_profile.h" +module TestDeviceC +{ + uses { + interface Boot; + interface MLME_RESET; + interface MLME_SET; + interface MLME_GET; + interface MLME_ASSOCIATE; + interface MLME_DISASSOCIATE; + interface MLME_COMM_STATUS; + interface Leds; + interface Timer as DisassociateTimer; + } +} implementation { + + ieee154_CapabilityInformation_t m_capabilityInformation; + void startApp(); + + event void Boot.booted() { + m_capabilityInformation.AlternatePANCoordinator = 0; + m_capabilityInformation.DeviceType = 0; + m_capabilityInformation.PowerSource = 0; + m_capabilityInformation.ReceiverOnWhenIdle = 0; + m_capabilityInformation.Reserved = 0; + m_capabilityInformation.SecurityCapability = 0; + m_capabilityInformation.AllocateAddress = 1; + call MLME_RESET.request(TRUE); + } + + event void MLME_RESET.confirm(ieee154_status_t status) + { + if (status == IEEE154_SUCCESS) + startApp(); + } + + void startApp() + { + ieee154_address_t coordAdr; + + coordAdr.shortAddress = COORDINATOR_ADDRESS; + call MLME_SET.phyCurrentChannel(RADIO_CHANNEL); + call MLME_SET.macAutoRequest(FALSE); + call MLME_SET.macPANId(PAN_ID); + call MLME_SET.macCoordShortAddress(COORDINATOR_ADDRESS); + call MLME_ASSOCIATE.request( + RADIO_CHANNEL, + call MLME_GET.phyCurrentPage(), + ADDR_MODE_SHORT_ADDRESS, + PAN_ID, + coordAdr, + m_capabilityInformation, + NULL // security + ); + } + + event void MLME_ASSOCIATE.confirm ( + uint16_t AssocShortAddress, + uint8_t status, + ieee154_security_t *security + ) + { + if ( status == IEEE154_SUCCESS ){ + // we are now associated - set a timer for disassociation + call Leds.led1On(); + call DisassociateTimer.startOneShot(312500U); + } else { + startApp(); // retry + } + } + + event void DisassociateTimer.fired() + { + ieee154_address_t coordAdr; + coordAdr.shortAddress = COORDINATOR_ADDRESS; + if (call MLME_DISASSOCIATE.request ( + ADDR_MODE_SHORT_ADDRESS, + PAN_ID, + coordAdr, + IEEE154_DEVICE_WISHES_TO_LEAVE, + FALSE, + NULL + ) != IEEE154_SUCCESS) + call DisassociateTimer.startOneShot(312500U); + } + + event void MLME_DISASSOCIATE.confirm ( + ieee154_status_t status, + uint8_t DeviceAddrMode, + uint16_t DevicePANID, + ieee154_address_t DeviceAddress + ) + { + if (status == IEEE154_SUCCESS){ + call Leds.led1Off(); + } else { + call DisassociateTimer.startOneShot(312500U); + } + } + + event void MLME_ASSOCIATE.indication ( + uint64_t DeviceAddress, + ieee154_CapabilityInformation_t CapabilityInformation, + ieee154_security_t *security + ){} + + event void MLME_DISASSOCIATE.indication ( + uint64_t DeviceAddress, + ieee154_disassociation_reason_t DisassociateReason, + ieee154_security_t *security + ){} + + + event void MLME_COMM_STATUS.indication ( + uint16_t PANId, + uint8_t SrcAddrMode, + ieee154_address_t SrcAddr, + uint8_t DstAddrMode, + ieee154_address_t DstAddr, + ieee154_status_t status, + ieee154_security_t *security + ) {} +} diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/README.txt b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/README.txt new file mode 100644 index 00000000..7334f3da --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/README.txt @@ -0,0 +1,42 @@ +README for TestIndirectData +Author/Contact: Jan Hauer + +Description: + +In this application one node takes the role of a PAN coordinator in a +nonbeacon-enabled 802.15.4 PAN, every 3 seconds it sends a packet to a device +using indirect transmission (i.e. the packet is buffered until it is polled by +the device). A second node acts as the device, it switches to the pre-defined +channel and polls the coordinator every 1 second for outstanding indirect +transmissions. + +Criteria for a successful test: + +Assuming one coordinator and one device has been installed, the coordinator +should briefly flash LED1 every 3 seconds. The device should briefly flash +LED2 every 1 second. + + +Tools: NONE + +Usage: + +1. Install the coordinator: + + $ cd coordinator; make install + +2. Install one (or more) devices: + + $ cd device; make install + +You can change some of the configuration parameters in app_profile.h + +Known bugs/limitations: + +- Many TinyOS 2 platforms do not have a clock that satisfies the + precision/accuracy requirements of the IEEE 802.15.4 standard (e.g. + 62.500 Hz, +-40 ppm in the 2.4 GHz band); in this case the MAC timing + is not standard compliant + +$Id$o + diff --git a/tos/lib/mac/tkn154/interfaces/private/Ieee802154Debug.nc b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/app_profile.h similarity index 86% rename from tos/lib/mac/tkn154/interfaces/private/Ieee802154Debug.nc rename to apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/app_profile.h index c25e8cfc..a3083327 100644 --- a/tos/lib/mac/tkn154/interfaces/private/Ieee802154Debug.nc +++ b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/app_profile.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Technische Universitaet Berlin + * Copyright (c) 2009, Technische Universitaet Berlin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,11 +29,18 @@ * - Revision ------------------------------------------------------------- * $Revision$ * $Date$ - * @author Jan Hauer + * @author: Jasper Buesch * ======================================================================== */ -interface Ieee802154Debug -{ - async command void log(uint8_t priority, uint8_t eventID, uint32_t param1, uint32_t param2, uint32_t param3); - command void flush(); -} + +#ifndef __APP_PROFILE_H +#define __APP_PROFILE_H + +enum { + RADIO_CHANNEL = 26, + PAN_ID = 0x4927, + COORDINATOR_ADDRESS = 0x6287, + DEVICE_ADDRESS = 0x6288 +}; + +#endif diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/coordinator/Makefile b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/coordinator/Makefile new file mode 100644 index 00000000..ebe71b30 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/coordinator/Makefile @@ -0,0 +1,3 @@ +COMPONENT=TestIndirectDataCoordAppC +CFLAGS += -I$(shell pwd)/.. +include ../../../Makefile.include diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/coordinator/TestIndirectDataCoordAppC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/coordinator/TestIndirectDataCoordAppC.nc new file mode 100644 index 00000000..d5fac24b --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/coordinator/TestIndirectDataCoordAppC.nc @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009, Technische Universitaet Berlin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the Technische Universitaet Berlin nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * - Revision ------------------------------------------------------------- + * $Revision$ + * $Date$ + * @author: Jasper Buesch + * ======================================================================== + */ + +configuration TestIndirectDataCoordAppC +{ +} implementation { + components MainC, LedsC, Ieee802154NonBeaconEnabledC as MAC; + components TestIndirectDataCoordC as App; + components new Timer62500C() as Timer1; + components new Timer62500C() as Timer2; + components new Timer62500C() as Timer3; + + MainC.Boot <- App; + App.MCPS_DATA -> MAC; + App.Frame -> MAC; + App.Packet -> MAC; + App.DataTimer -> Timer1; + App.Led1Timer -> Timer2; + App.Led0Timer -> Timer3; + + App.Leds -> LedsC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; + App.MLME_START -> MAC; +} diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/coordinator/TestIndirectDataCoordC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/coordinator/TestIndirectDataCoordC.nc new file mode 100644 index 00000000..1997631d --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/coordinator/TestIndirectDataCoordC.nc @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2009, Technische Universitaet Berlin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the Technische Universitaet Berlin nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * - Revision ------------------------------------------------------------- + * $Revision$ + * $Date$ + * @author: Jasper Buesch + * ======================================================================== + */ + +#include "TKN154.h" +#include "app_profile.h" +module TestIndirectDataCoordC +{ + uses { + interface Boot; + interface MLME_RESET; + interface MLME_START; + interface MLME_SET; + interface MLME_GET; + interface MCPS_DATA; + interface IEEE154Frame as Frame; + interface Leds; + interface Packet; + interface Timer as DataTimer; + interface Timer as Led1Timer; + interface Timer as Led0Timer; + } +} implementation { + + message_t frame; + uint8_t *payloadRegion; + uint8_t m_payloadLen; + + char payload[] = "TestIndirect, Coordinator talking now!"; + + void sendIndirectData(); + + event void Boot.booted() { + m_payloadLen = strlen(payload); + payloadRegion = call Packet.getPayload(&frame, m_payloadLen); + if (m_payloadLen <= call Packet.maxPayloadLength()){ + memcpy(payloadRegion, payload, m_payloadLen); + call MLME_RESET.request(TRUE); + } + } + + event void MLME_RESET.confirm(ieee154_status_t status) + { + if (status != IEEE154_SUCCESS) + return; + call MLME_SET.macShortAddress(COORDINATOR_ADDRESS); + call MLME_SET.macAssociationPermit(FALSE); + call MLME_SET.macRxOnWhenIdle(TRUE); + call MLME_START.request( + PAN_ID, // PANId + RADIO_CHANNEL, // LogicalChannel + 0, // ChannelPage, + 0, // StartTime, + 15, // BeaconOrder + 15, // SuperframeOrder + TRUE, // PANCoordinator + FALSE, // BatteryLifeExtension + FALSE, // CoordRealignment + NULL, // no realignment security + NULL // no beacon security + ); + } + + void sendIndirectData(){ + ieee154_address_t deviceAddress; + deviceAddress.shortAddress = DEVICE_ADDRESS; + call Frame.setAddressingFields( + &frame, + ADDR_MODE_SHORT_ADDRESS, // SrcAddrMode, + ADDR_MODE_SHORT_ADDRESS, // DstAddrMode, + PAN_ID, // DstPANId, + &deviceAddress, // DstAddr, + NULL // security + ); + call MCPS_DATA.request( + &frame, // frame, + strlen(payload), // payloadLength, + 0, // msduHandle, + TX_OPTIONS_INDIRECT | TX_OPTIONS_ACK // TxOptions, + ); + call Leds.led1On(); + call Led1Timer.startOneShot(12500U); + } + + event void MLME_START.confirm(ieee154_status_t status) { + sendIndirectData(); + } + + event void DataTimer.fired(){ + sendIndirectData(); + } + + event void Led1Timer.fired(){ + call Leds.led1Off(); + } + + event void MCPS_DATA.confirm( + message_t *msg, + uint8_t msduHandle, + ieee154_status_t status, + uint32_t Timestamp + ) + { + if(status == IEEE154_TRANSACTION_EXPIRED){ + call Leds.led0On(); + call Led0Timer.startOneShot(125000U); + sendIndirectData(); + }else if(status == SUCCESS){ + call DataTimer.startOneShot(125000U); + } + } + + event void Led0Timer.fired(){ + call Leds.led0Off(); + } + + event message_t* MCPS_DATA.indication ( message_t* frame__ ){ + return frame__; + } +} diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/device/Makefile b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/device/Makefile new file mode 100644 index 00000000..7ca4abd3 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/device/Makefile @@ -0,0 +1,3 @@ +COMPONENT=TestIndirectDataDeviceAppC +CFLAGS += -I$(shell pwd)/.. +include ../../../Makefile.include diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/device/TestIndirectDataDeviceAppC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/device/TestIndirectDataDeviceAppC.nc new file mode 100644 index 00000000..ce3e780a --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/device/TestIndirectDataDeviceAppC.nc @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2009, Technische Universitaet Berlin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the Technische Universitaet Berlin nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * - Revision ------------------------------------------------------------- + * $Revision$ + * $Date$ + * @author: Jasper Buesch + * ======================================================================== + */ + +configuration TestIndirectDataDeviceAppC +{ +} implementation { + components MainC, LedsC, Ieee802154NonBeaconEnabledC as MAC, + new Timer62500C() as Timer1, + new Timer62500C() as Timer2; + components TestIndirectDataDeviceC as App; + + MainC.Boot <- App; + App.MCPS_DATA -> MAC; + App.Leds -> LedsC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; + App.PollTimer -> Timer1; + App.Led2Timer -> Timer2; + App.MLME_POLL -> MAC; + +} diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/device/TestIndirectDataDeviceC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/device/TestIndirectDataDeviceC.nc new file mode 100644 index 00000000..71108b04 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestIndirectData/device/TestIndirectDataDeviceC.nc @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2009, Technische Universitaet Berlin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the Technische Universitaet Berlin nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * - Revision ------------------------------------------------------------- + * $Revision$ + * $Date$ + * @author: Jasper Buesch + * ======================================================================== + */ + +#include "TKN154.h" +#include "app_profile.h" +module TestIndirectDataDeviceC +{ + uses { + interface Boot; + interface MCPS_DATA; + interface MLME_RESET; + interface MLME_SET; + interface MLME_GET; + interface MLME_POLL; + interface Leds; + interface Timer as PollTimer; + interface Timer as Led2Timer; + } +} implementation { + + void startApp(); + + event void Boot.booted() { + call MLME_RESET.request(TRUE); + } + + event void MLME_RESET.confirm(ieee154_status_t status) + { + if (status == IEEE154_SUCCESS) + startApp(); + } + + void startApp() + { + call MLME_SET.phyCurrentChannel(RADIO_CHANNEL); + call MLME_SET.macAutoRequest(FALSE); + call MLME_SET.macPANId(PAN_ID); + call MLME_SET.macCoordShortAddress(COORDINATOR_ADDRESS); + call MLME_SET.macShortAddress(DEVICE_ADDRESS); + call PollTimer.startPeriodic(62500U); + } + + event void PollTimer.fired(){ + // check the coordinator for outstanding transmissions + ieee154_address_t coordAdr; + coordAdr.shortAddress = COORDINATOR_ADDRESS; + call MLME_POLL.request ( + ADDR_MODE_SHORT_ADDRESS, + PAN_ID, + coordAdr, + NULL + ); + } + + event void MLME_POLL.confirm ( + ieee154_status_t status + ){} + + event void MCPS_DATA.confirm( + message_t *msg, + uint8_t msduHandle, + ieee154_status_t status, + uint32_t Timestamp + ){} + + event message_t* MCPS_DATA.indication ( message_t* frame__ ){ + call Leds.led2On(); + call Led2Timer.startOneShot(12500U); + return frame__; + } + + event void Led2Timer.fired(){ + call Leds.led2Off(); + } + +} diff --git a/apps/tests/tkn154/nonbeacon-enabled/TestPromiscuous/Makefile b/apps/tests/tkn154/nonbeacon-enabled/TestPromiscuous/Makefile new file mode 100644 index 00000000..4feced10 --- /dev/null +++ b/apps/tests/tkn154/nonbeacon-enabled/TestPromiscuous/Makefile @@ -0,0 +1,5 @@ +COMPONENT=TestPromiscuousAppC +PFLAGS += -DPRINTF_BUFFER_SIZE=1000 +CFLAGS += -I$(TOSDIR)/lib/printf +CFLAGS += -DIEEE154_SCAN_DISABLED -DIEEE154_BEACON_SYNC_DISABLED -DIEEE154_BEACON_TX_DISABLED -DIEEE154_RXENABLE_DISABLED -DIEEE154_ASSOCIATION_DISABLED -DIEEE154_DISASSOCIATION_DISABLED -DIEEE154_COORD_REALIGNMENT_DISABLED -DIEEE154_COORD_BROADCAST_DISABLED +include ../../Makefile.include diff --git a/apps/tests/tkn154/TestPromiscuous/README.txt b/apps/tests/tkn154/nonbeacon-enabled/TestPromiscuous/README.txt similarity index 58% rename from apps/tests/tkn154/TestPromiscuous/README.txt rename to apps/tests/tkn154/nonbeacon-enabled/TestPromiscuous/README.txt index 8f1b1f5b..743fa3a0 100644 --- a/apps/tests/tkn154/TestPromiscuous/README.txt +++ b/apps/tests/tkn154/nonbeacon-enabled/TestPromiscuous/README.txt @@ -1,5 +1,5 @@ README for TestPromiscuous -Author/Contact: tinyos-help@millennium.berkeley.edu +Author/Contact: Jan Hauer Description: @@ -10,23 +10,32 @@ signalled to the upper layer. The application uses the TinyOS printf library every received frame over the serial port. The second (TelosB: green) LED is toggled whenever a frame is received. +Criteria for a successful test: + +A successful test means that for every received frame LED1 is toggled +and the java application outputs some text. To see this effect you need a +second node sending a packet, for example, use the +../../beacon-enabled/TestStartSync/coordinator application to send periodic +beacon packets. In this case LED1 should toggle every half second and +printf java client should output some text on the frame content. + + Tools: The printf java client in $TOSDIR/../apps/tests/TestPrintf Usage: Install the application on a node - $ make telosb install + $ make install -Start the printf client on +Start the printf client, e.g. - $ java net.tinyos.tools.PrintfClient -comm serial@/dev/ttyUSBXXX:telosb + $ java net.tinyos.tools.PrintfClient -comm serial@/dev/ttyUSBXXX: (http://docs.tinyos.net/ has a section on how to use the TinyOS printf library) Known bugs/limitations: -- Currently this application only works on TelosB nodes - The timestamps for ACKs are incorrect $Id$ diff --git a/apps/tests/tkn154/TestPromiscuous/TestPromiscuousAppC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestPromiscuous/TestPromiscuousAppC.nc similarity index 87% rename from apps/tests/tkn154/TestPromiscuous/TestPromiscuousAppC.nc rename to apps/tests/tkn154/nonbeacon-enabled/TestPromiscuous/TestPromiscuousAppC.nc index e48ac507..fd752f0d 100644 --- a/apps/tests/tkn154/TestPromiscuous/TestPromiscuousAppC.nc +++ b/apps/tests/tkn154/nonbeacon-enabled/TestPromiscuous/TestPromiscuousAppC.nc @@ -37,16 +37,16 @@ configuration TestPromiscuousAppC { } implementation { components MainC, TestPromiscuousC as App, LedsC, - Ieee802154MacC as Ieee802154MacC; + Ieee802154NonBeaconEnabledC as MAC; MainC.Boot <- App; App.Leds -> LedsC; - App.MLME_RESET -> Ieee802154MacC; - App.MLME_SET -> Ieee802154MacC; - App.MLME_GET -> Ieee802154MacC; - App.MCPS_DATA -> Ieee802154MacC; - App.Frame -> Ieee802154MacC; - App.BeaconFrame -> Ieee802154MacC; - App.PromiscuousMode -> Ieee802154MacC; + App.MLME_RESET -> MAC; + App.MLME_SET -> MAC; + App.MLME_GET -> MAC; + App.MCPS_DATA -> MAC; + App.Frame -> MAC; + App.BeaconFrame -> MAC; + App.PromiscuousMode -> MAC; } diff --git a/apps/tests/tkn154/TestPromiscuous/TestPromiscuousC.nc b/apps/tests/tkn154/nonbeacon-enabled/TestPromiscuous/TestPromiscuousC.nc similarity index 90% rename from apps/tests/tkn154/TestPromiscuous/TestPromiscuousC.nc rename to apps/tests/tkn154/nonbeacon-enabled/TestPromiscuous/TestPromiscuousC.nc index bc3699f7..8ffaa751 100644 --- a/apps/tests/tkn154/TestPromiscuous/TestPromiscuousC.nc +++ b/apps/tests/tkn154/nonbeacon-enabled/TestPromiscuous/TestPromiscuousC.nc @@ -58,7 +58,7 @@ module TestPromiscuousC }; event void Boot.booted() { - call MLME_RESET.request(TRUE, BEACON_ENABLED_PAN); + call MLME_RESET.request(TRUE); } event void MLME_RESET.confirm(ieee154_status_t status) @@ -102,37 +102,37 @@ module TestPromiscuousC printf("SrcAddrMode: %d\n", SrcAddrMode); printf("SrcAddr: "); if (SrcAddrMode == ADDR_MODE_SHORT_ADDRESS){ - printf("0x%hx\n", SrcAddress.shortAddress); - printf("SrcPANId: 0x%x\n", SrcPANId); + printf("0x%02X\n", SrcAddress.shortAddress); + printf("SrcPANId: 0x%02X\n", SrcPANId); } else if (SrcAddrMode == ADDR_MODE_EXTENDED_ADDRESS){ for (i=0; i<8; i++) - printf("0x%hx ", ((uint8_t*) &(SrcAddress.extendedAddress))[i]); + printf("0x%02X ", ((uint8_t*) &(SrcAddress.extendedAddress))[i]); printf("\n"); - printf("SrcPANId: 0x%x\n", SrcPANId); + printf("SrcPANId: 0x%02X\n", SrcPANId); } else printf("\n"); printf("DstAddrMode: %d\n", DstAddrMode); printf("DstAddr: "); if ( DstAddrMode == ADDR_MODE_SHORT_ADDRESS){ - printf("0x%hx\n", DstAddress.shortAddress); - printf("DestPANId: 0x%x\n", DstPANId); + printf("0x%02X\n", DstAddress.shortAddress); + printf("DestPANId: 0x%02X\n", DstPANId); } else if ( DstAddrMode == ADDR_MODE_EXTENDED_ADDRESS) { for (i=0; i<8; i++) - printf("0x%hx ", ((uint8_t*) &(DstAddress.extendedAddress))[i]); + printf("0x%02X ", ((uint8_t*) &(DstAddress.extendedAddress))[i]); printf("\n"); - printf("DestPANId: 0x%x\n", DstPANId); + printf("DestPANId: 0x%02X\n", DstPANId); } else printf("\n"); printf("DSN: %d\n", call Frame.getDSN(frame)); printf("MHRLen: %d\n", headerLen); printf("MHR: "); for (i=0; iOn the serial link, BaseStation sends and receives simple active + * messages (not particular radio packets): on the radio link, it + * sends radio active messages, whose format depends on the network + * stack being used. BaseStation will copy its compiled-in group ID to + * messages moving from the serial link to the radio, and will filter + * out incoming radio messages that do not contain that group ID.

    + * + *

    BaseStation includes queues in both directions, with a guarantee + * that once a message enters a queue, it will eventually leave on the + * other interface. The queues allow the BaseStation to handle load + * spikes.

    + * + *

    BaseStation acknowledges a message arriving over the serial link + * only if that message was successfully enqueued for delivery to the + * radio link.

    + * + *

    The LEDS are programmed to toggle as follows:

    + *
      + *
    • LED0: Message bridged from serial to radio
    • + *
    • LED1: Message bridged from radio to serial
    • + *
    • LED2: Dropped message due to queue overflow in either direction
    • + *
    + * * @author Kevin Klues * @author Chieh-Jan Mike Liang */ diff --git a/apps/tosthreads/apps/BaseStation/BaseStationAppC.nc b/apps/tosthreads/apps/BaseStation/BaseStationAppC.nc index 46f26a53..09ca717e 100644 --- a/apps/tosthreads/apps/BaseStation/BaseStationAppC.nc +++ b/apps/tosthreads/apps/BaseStation/BaseStationAppC.nc @@ -30,6 +30,33 @@ */ /** + * BaseStation is a reimplementation of the standard BaseStation application using + * the TOSThreads thread library. It transparently forwards any AM messages it + * receives from its radio interface to its serial interface and vice versa. + * + *

    On the serial link, BaseStation sends and receives simple active + * messages (not particular radio packets): on the radio link, it + * sends radio active messages, whose format depends on the network + * stack being used. BaseStation will copy its compiled-in group ID to + * messages moving from the serial link to the radio, and will filter + * out incoming radio messages that do not contain that group ID.

    + * + *

    BaseStation includes queues in both directions, with a guarantee + * that once a message enters a queue, it will eventually leave on the + * other interface. The queues allow the BaseStation to handle load + * spikes.

    + * + *

    BaseStation acknowledges a message arriving over the serial link + * only if that message was successfully enqueued for delivery to the + * radio link.

    + * + *

    The LEDS are programmed to toggle as follows:

    + *
      + *
    • LED0: Message bridged from serial to radio
    • + *
    • LED1: Message bridged from radio to serial
    • + *
    • LED2: Dropped message due to queue overflow in either direction
    • + *
    + * * @author Kevin Klues * @author Chieh-Jan Mike Liang */ @@ -105,12 +132,4 @@ implementation SerialReceiveRadioSendP.SendAMPacket -> BlockingRadioActiveMessageC; SerialReceiveRadioSendP.BlockingReceiveAny -> BlockingSerialActiveMessageC.BlockingReceiveAny; SerialReceiveRadioSendP.BlockingAMSend -> BlockingRadioActiveMessageC; - - components ActiveMessageC, SerialActiveMessageC; - BlockingRadioActiveMessageC.Receive -> ActiveMessageC.Receive; - BlockingRadioActiveMessageC.Snoop -> ActiveMessageC.Snoop; - BlockingRadioActiveMessageC.AMSend -> ActiveMessageC.AMSend; - - BlockingSerialActiveMessageC.Receive -> SerialActiveMessageC.Receive; - BlockingSerialActiveMessageC.AMSend -> SerialActiveMessageC.AMSend; } diff --git a/apps/tosthreads/apps/BaseStation/BaseStationC.nc b/apps/tosthreads/apps/BaseStation/BaseStationC.nc index 268978d6..987aa6bc 100644 --- a/apps/tosthreads/apps/BaseStation/BaseStationC.nc +++ b/apps/tosthreads/apps/BaseStation/BaseStationC.nc @@ -30,6 +30,33 @@ */ /** + * BaseStation is a reimplementation of the standard BaseStation application using + * the TOSThreads thread library. It transparently forwards any AM messages it + * receives from its radio interface to its serial interface and vice versa. + * + *

    On the serial link, BaseStation sends and receives simple active + * messages (not particular radio packets): on the radio link, it + * sends radio active messages, whose format depends on the network + * stack being used. BaseStation will copy its compiled-in group ID to + * messages moving from the serial link to the radio, and will filter + * out incoming radio messages that do not contain that group ID.

    + * + *

    BaseStation includes queues in both directions, with a guarantee + * that once a message enters a queue, it will eventually leave on the + * other interface. The queues allow the BaseStation to handle load + * spikes.

    + * + *

    BaseStation acknowledges a message arriving over the serial link + * only if that message was successfully enqueued for delivery to the + * radio link.

    + * + *

    The LEDS are programmed to toggle as follows:

    + *
      + *
    • LED0: Message bridged from serial to radio
    • + *
    • LED1: Message bridged from radio to serial
    • + *
    • LED2: Dropped message due to queue overflow in either direction
    • + *
    + * * @author Kevin Klues */ diff --git a/apps/tosthreads/apps/BaseStation/README b/apps/tosthreads/apps/BaseStation/README index 9c3c246d..11c1a622 100644 --- a/apps/tosthreads/apps/BaseStation/README +++ b/apps/tosthreads/apps/BaseStation/README @@ -13,7 +13,7 @@ forwarding, LED1 is toggled. If there are any errors, LED2 is toggled. To run this application install it on a mote via the command: make threads install.45 -Valid platforms are currently: tmote, telosb, iris, mica2, and micaz +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic Installing with NODE_ID 45 (i.e. AM_ADDRESS 45) is just to verify that the application forwards packets with an arbitrarily chosen id, which it should. diff --git a/apps/tosthreads/apps/Blink/BlinkAppC.nc b/apps/tosthreads/apps/Blink/BlinkAppC.nc index d95f7192..85058312 100644 --- a/apps/tosthreads/apps/Blink/BlinkAppC.nc +++ b/apps/tosthreads/apps/Blink/BlinkAppC.nc @@ -30,6 +30,12 @@ */ /** + * Blink is a simple application used to test the basic functionality of + * TOSThreads. + * + * Upon a successful burn, you should see LED0 flashing with a period of every + * 200ms, and LED1 and LED2 flashing in unison with a period of 1000ms. + * * @author Kevin Klues (klueska@cs.stanford.edu) */ diff --git a/apps/tosthreads/apps/Blink/BlinkC.nc b/apps/tosthreads/apps/Blink/BlinkC.nc index e4027006..ed6fcb7d 100644 --- a/apps/tosthreads/apps/Blink/BlinkC.nc +++ b/apps/tosthreads/apps/Blink/BlinkC.nc @@ -30,6 +30,12 @@ */ /** + * Blink is a simple application used to test the basic functionality of + * TOSThreads. + * + * Upon a successful burn, you should see LED0 flashing with a period of every + * 200ms, and LED1 and LED2 flashing in unison with a period of 1000ms. + * * @author Kevin Klues (klueska@cs.stanford.edu) */ diff --git a/apps/tosthreads/apps/Blink/README b/apps/tosthreads/apps/Blink/README index b8f240d9..31ed5dcb 100644 --- a/apps/tosthreads/apps/Blink/README +++ b/apps/tosthreads/apps/Blink/README @@ -10,7 +10,7 @@ TOSThreads. You can install Blink on a mote via the following command: make threads install -Valid platforms are currently: tmote, telosb, iris, mica2, and micaz +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic Upon a successful burn, you should see LED0 flashing with a period of every 200ms, and LED1 and LED2 flashing in unison with a period of 1000ms. diff --git a/apps/tosthreads/apps/Blink_DynamicThreads/BlinkAppC.nc b/apps/tosthreads/apps/Blink_DynamicThreads/BlinkAppC.nc new file mode 100644 index 00000000..7b2dc313 --- /dev/null +++ b/apps/tosthreads/apps/Blink_DynamicThreads/BlinkAppC.nc @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2008 Johns Hopkins University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written + * agreement is hereby granted, provided that the above copyright + * notice, the (updated) modification history and the author appear in + * all copies of this source code. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, + * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * Blink is a simple application used to test the basic functionality of + * TOSThreads using dynamic threads rather than static threads. + * + * Upon a successful burn, you should see LED0 flashing with a period of every + * 200ms, and LED1 and LED2 flashing in unison with a period of 1000ms. + * + * @author Chieh-Jan Mike Liang + */ + +configuration BlinkAppC {} + +implementation { + components MainC, + BlinkC, + LedsC, + DynamicThreadC; + + BlinkC.Boot -> MainC; + + BlinkC.Leds -> LedsC; + BlinkC.DynamicThread -> DynamicThreadC; +} diff --git a/apps/tosthreads/apps/Blink_DynamicThreads/BlinkC.nc b/apps/tosthreads/apps/Blink_DynamicThreads/BlinkC.nc new file mode 100644 index 00000000..49b274ec --- /dev/null +++ b/apps/tosthreads/apps/Blink_DynamicThreads/BlinkC.nc @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2008 Johns Hopkins University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written + * agreement is hereby granted, provided that the above copyright + * notice, the (updated) modification history and the author appear in + * all copies of this source code. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, + * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * Blink is a simple application used to test the basic functionality of + * TOSThreads using dynamic threads rather than static threads. + * + * Upon a successful burn, you should see LED0 flashing with a period of every + * 200ms, and LED1 and LED2 flashing in unison with a period of 1000ms. + * + * @author Chieh-Jan Mike Liang + */ + +module BlinkC { + uses { + interface Boot; + interface Leds; + interface DynamicThread; + } +} + +implementation { + tosthread_t blink1; + tosthread_t blink2; + tosthread_t blink3; + uint16_t a1 = 1; + uint16_t a2 = 2; + uint16_t a3 = 3; + + void blink_thread(void* arg) + { + uint16_t *a = (uint16_t *)arg; + + for (;;) { + if (*a == 1) { + call Leds.led0Toggle(); + call DynamicThread.sleep(200); + } else if (*a == 2) { + call Leds.led1Toggle(); + call DynamicThread.sleep(1000); + } else if (*a == 3) { + call Leds.led2Toggle(); + call DynamicThread.sleep(1000); + } + } + } + + event void Boot.booted() + { + call DynamicThread.create(&blink1, blink_thread, &a1, 500); + call DynamicThread.create(&blink2, blink_thread, &a2, 500); + call DynamicThread.create(&blink3, blink_thread, &a3, 500); + } +} diff --git a/apps/tosthreads/apps/Blink_DynamicThreads/Makefile b/apps/tosthreads/apps/Blink_DynamicThreads/Makefile new file mode 100644 index 00000000..7f9fb6b1 --- /dev/null +++ b/apps/tosthreads/apps/Blink_DynamicThreads/Makefile @@ -0,0 +1,3 @@ +COMPONENT=BlinkAppC + +include $(MAKERULES) diff --git a/apps/tosthreads/apps/Blink_DynamicThreads/README b/apps/tosthreads/apps/Blink_DynamicThreads/README new file mode 100644 index 00000000..d5cd5c96 --- /dev/null +++ b/apps/tosthreads/apps/Blink_DynamicThreads/README @@ -0,0 +1,21 @@ +README for TOSThreads Blink_DynamicThreads +Author/Contact: tinyos-help@millennium.berkeley.edu +Author: Chieh-Jan Mike Liang + +Description: + +Blink_DynamicThreads is the dynamic-thread version of Blink. + +You can install Blink_DynamicThread on a mote via the following command: + make threads install + +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic + +Upon a successful burn, you should see LED0 flashing with a period of every +200ms, and LED1 and LED2 flashing in unison with a period of 1000ms. + +Tools: + None. + +Known bugs/limitations: + None. diff --git a/apps/tosthreads/apps/Bounce/README b/apps/tosthreads/apps/Bounce/README index 0cd7d74e..d8ff0f9f 100644 --- a/apps/tosthreads/apps/Bounce/README +++ b/apps/tosthreads/apps/Bounce/README @@ -15,7 +15,7 @@ You can install Bounce on a mote via the following command: make threads install.0 make threads install.1 -Valid platforms are currently: tmote, telosb, iris, mica2, and micaz +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic Three different threads run, and each contains an infinite loop that first sends a message and then waits to receive a message before returning to the top of the diff --git a/apps/tosthreads/apps/RadioStress/README b/apps/tosthreads/apps/RadioStress/README index ddfe8e36..e0eb9677 100644 --- a/apps/tosthreads/apps/RadioStress/README +++ b/apps/tosthreads/apps/RadioStress/README @@ -12,7 +12,7 @@ You can install RadioStress on a mote via the following command: make threads install.0 make threads install.1 -Valid platforms are currently: tmote, telosb, iris, mica2, and micaz +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic The application burned with NODE_ID 0 will be programmed as a receiver and will wait for messages from the sender programmed with NODE_ID 1. In the case of the diff --git a/apps/tosthreads/apps/TestBasicsbSensors/Makefile b/apps/tosthreads/apps/TestBasicsbSensors/Makefile index 4d9ca1d0..ba7d7d3d 100644 --- a/apps/tosthreads/apps/TestBasicsbSensors/Makefile +++ b/apps/tosthreads/apps/TestBasicsbSensors/Makefile @@ -2,7 +2,7 @@ COMPONENT=TestBasicsbSensorsAppC CFLAGS += -I$(TOSDIR)/sensorboards/basicsb CFLAGS += -I$(TOSDIR)/lib/tosthreads/sensorboards/basicsb -ifneq ($(filter mica2 micaz iris clean,$(MAKECMDGOALS)),) +ifneq ($(filter mica2 mica2dot micaz iris clean,$(MAKECMDGOALS)),) include $(MAKERULES) else %: diff --git a/apps/tosthreads/apps/TestBasicsbSensors/TestBasicsbSensorsAppC.nc b/apps/tosthreads/apps/TestBasicsbSensors/TestBasicsbSensorsAppC.nc index d1e3aca7..0bc9f115 100644 --- a/apps/tosthreads/apps/TestBasicsbSensors/TestBasicsbSensorsAppC.nc +++ b/apps/tosthreads/apps/TestBasicsbSensors/TestBasicsbSensorsAppC.nc @@ -30,6 +30,22 @@ */ /** + * This application is used to test the threaded version of the API for accessing + * sensors on the basicsb sensor board. + * + * This application simply takes sensor readings in an infinite loop from the + * Photo and Temperature sensors on the basicsb sensor board and forwards them + * over the serial interface. Upon successful transmission, LED0 is toggled. + * + * A successful test will result in the TestBasicsbSensors mote constantly + * flickering LED0. Additionally, messages containing the sensor readings should + * be forwarded over the serial interface as verified by running the following + * for the platform of interest: + * java net.tinyos.tools.Listen -comm serial@/dev/ttyUSBXXX: + * + * Once this java application is running, you should see output containing the + * sensor readings being streamed to your terminal. + * * @author Kevin Klues (klueska@cs.stanford.edu) */ @@ -37,7 +53,7 @@ configuration TestBasicsbSensorsAppC { } implementation { components MainC, TestBasicsbSensorsC; - components new ThreadC(100) as MainThread; + components new ThreadC(125) as MainThread; components new BlockingPhotoC(); components new BlockingTempC(); diff --git a/apps/tosthreads/apps/TestBasicsbSensors/TestBasicsbSensorsC.nc b/apps/tosthreads/apps/TestBasicsbSensors/TestBasicsbSensorsC.nc index f43e8868..d9e63373 100644 --- a/apps/tosthreads/apps/TestBasicsbSensors/TestBasicsbSensorsC.nc +++ b/apps/tosthreads/apps/TestBasicsbSensors/TestBasicsbSensorsC.nc @@ -67,6 +67,7 @@ implementation { while( call Temp.read(&(readings->temp)) != SUCCESS ); while( call BlockingAMSend.send(AM_BROADCAST_ADDR, &msg, sizeof(sensor_readings_t)) != SUCCESS ); call Leds.led0Toggle(); + call MainThread.sleep(512); } } } diff --git a/apps/tosthreads/apps/TestBlockStorage/TestBlockStorageAppC.nc b/apps/tosthreads/apps/TestBlockStorage/TestBlockStorageAppC.nc index b2933857..3d43d2a2 100644 --- a/apps/tosthreads/apps/TestBlockStorage/TestBlockStorageAppC.nc +++ b/apps/tosthreads/apps/TestBlockStorage/TestBlockStorageAppC.nc @@ -21,6 +21,18 @@ */ /** + * This application is used to test the threaded version of the API for performing + * block storage. + * + * This application first checks the size of the block storage volume, and + * erases it. Then, it randomly writes records, followed by a verification + * with read. + * + * Successful running of this application results in LED0 being ON + * throughout the duration of the erase, write, and read sequence. Finally, + * if all tests pass, LED1 is turned ON. Otherwise, all three LEDs are + * turned ON to indicate problems. + * * @author Chieh-Jan Mike Liang */ diff --git a/apps/tosthreads/apps/TestBlockStorage/TestBlockStorageP.nc b/apps/tosthreads/apps/TestBlockStorage/TestBlockStorageP.nc index 316cbece..81b191b0 100644 --- a/apps/tosthreads/apps/TestBlockStorage/TestBlockStorageP.nc +++ b/apps/tosthreads/apps/TestBlockStorage/TestBlockStorageP.nc @@ -21,6 +21,18 @@ */ /** + * This application is used to test the threaded version of the API for performing + * block storage. + * + * This application first checks the size of the block storage volume, and + * erases it. Then, it randomly writes records, followed by a verification + * with read. + * + * Successful running of this application results in LED0 being ON + * throughout the duration of the erase, write, and read sequence. Finally, + * if all tests pass, LED1 is turned ON. Otherwise, all three LEDs are + * turned ON to indicate problems. + * * @author Chieh-Jan Mike Liang */ diff --git a/apps/tosthreads/apps/TestCollection/README b/apps/tosthreads/apps/TestCollection/README index 32c26f54..509e4d6c 100644 --- a/apps/tosthreads/apps/TestCollection/README +++ b/apps/tosthreads/apps/TestCollection/README @@ -14,7 +14,7 @@ application. You can install TestCollection on a mote via the following command: make threads install -Valid platforms are currently: tmote, telosb, mica2, micaz and iris +Valid platforms are currently: tmote, telosb, mica2, micaz, iris, and epic At least two motes must be used by this application, with one of them installed as a base station. Base station motes can be created by installing them with @@ -27,7 +27,7 @@ All other nodes can be installed with arbitrary NODE_IDs. make threads install.123 Successful running of this application is verified by all NON-base station motes -periodically flashing LED0 upon sending a message, and the base station mote, +periodically flashing LED1 upon sending a message, and the base station mote, flashing LED2 upon successful reception of a message. Additionally, correct operation should be verified by running the java tool described in the following section. @@ -40,12 +40,12 @@ TestCollection/java subdirectory and type: make java net.tinyos.sf.SerialForwarder -comm serial@: - # e.g., java net.tinyps.sf.SerialForwarder -comm serial@/dev/ttyUSB0:mica2 - # or java net.tinyps.sf.SerialForwarder -comm serial@COM2:telosb + # e.g., java net.tinyos.sf.SerialForwarder -comm serial@/dev/ttyUSB0:mica2 + # or java net.tinyos.sf.SerialForwarder -comm serial@COM2:telosb ./run NOTE:: The baud rate 57600 must be used telos based motes, as its configuration -has been changed to work with this baud rate when compiled for tosthreads. I.e. +has been changed to work with this baud rate when compiled for TOSThreads. I.e. DO NOT just substitute 'telosb' or 'tmote' for above. Explicitly set it to 57600. diff --git a/apps/tosthreads/apps/TestCollection/TestCollectionAppC.nc b/apps/tosthreads/apps/TestCollection/TestCollectionAppC.nc index 4db9f298..f248d970 100644 --- a/apps/tosthreads/apps/TestCollection/TestCollectionAppC.nc +++ b/apps/tosthreads/apps/TestCollection/TestCollectionAppC.nc @@ -20,7 +20,30 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/** + * TestCollection is a reimplementation of the Multihop Oscilloscope application + * using TOSThreads. It periodically samples a universal software-based SineSensor + * and broadcasts a message every few readings. These readings can be displayed by + * the Java "Oscilloscope" application found in the the TestCollection/java + * subdirectory. The sampling rate starts at 4Hz, but can be changed from the Java + * application. + * + * At least two motes must be used by this application, with one of them installed + * as a base station. Base station motes can be created by installing them with + * NODE_ID % 500 == 0. + * i.e. make threads install.0 + * make threads install.500 + * make threads install.1000 + * + * All other nodes can be installed with arbitrary NODE_IDs. + * make threads install.123 + * + * Successful running of this application is verified by all NON-base station motes + * periodically flashing LED1 upon sending a message, and the base station mote, + * flashing LED2 upon successful reception of a message. Additionally, correct + * operation should be verified by running the java tool described in the following + * section. + * * @author Chieh-Jan Mike Liang */ diff --git a/apps/tosthreads/apps/TestCollection/TestCollectionC.nc b/apps/tosthreads/apps/TestCollection/TestCollectionC.nc index 46ed34e6..51c9bdb0 100644 --- a/apps/tosthreads/apps/TestCollection/TestCollectionC.nc +++ b/apps/tosthreads/apps/TestCollection/TestCollectionC.nc @@ -20,7 +20,30 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/** + * TestCollection is a reimplementation of the Multihop Oscilloscope application + * using TOSThreads. It periodically samples a universal software-based SineSensor + * and broadcasts a message every few readings. These readings can be displayed by + * the Java "Oscilloscope" application found in the the TestCollection/java + * subdirectory. The sampling rate starts at 4Hz, but can be changed from the Java + * application. + * + * At least two motes must be used by this application, with one of them installed + * as a base station. Base station motes can be created by installing them with + * NODE_ID % 500 == 0. + * i.e. make threads install.0 + * make threads install.500 + * make threads install.1000 + * + * All other nodes can be installed with arbitrary NODE_IDs. + * make threads install.123 + * + * Successful running of this application is verified by all NON-base station motes + * periodically flashing LED1 upon sending a message, and the base station mote, + * flashing LED2 upon successful reception of a message. Additionally, correct + * operation should be verified by running the java tool described in the following + * section. + * * @author Chieh-Jan Mike Liang */ diff --git a/apps/tosthreads/apps/TestJoin/Makefile b/apps/tosthreads/apps/TestJoin/Makefile new file mode 100644 index 00000000..3cb12126 --- /dev/null +++ b/apps/tosthreads/apps/TestJoin/Makefile @@ -0,0 +1,3 @@ +COMPONENT=TestJoinAppC + +include $(MAKERULES) diff --git a/apps/tosthreads/apps/TestJoin/README b/apps/tosthreads/apps/TestJoin/README new file mode 100644 index 00000000..2f45af0d --- /dev/null +++ b/apps/tosthreads/apps/TestJoin/README @@ -0,0 +1,32 @@ +README for TOSThreads TestJoin +Author/Contact: tinyos-help@millennium.berkeley.edu +Author: Kevin Klues + +Description: + +TestJoin is a simple application used to test the basic functionality of +the join() system call for waiting on a set of threads in a TOSThreads +based application. + +You can install TestJoin on a mote via the following command: + make threads install + +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic + +Upon a successful burn, you should see all LEDs toggle in the following pattern, +repeating every 8 seconds: + +0s: (110) LED0 ON, LED1 ON, LED2 OFF +1s: (000) LED0 OFF, LED1 OFF, LED2 OFF +2s: (010) LED0 OFF, LED1 ON, LED2 OFF +3s: (000) LED0 OFF, LED1 OFF, LED2 OFF +4s: (111) LED0 ON, LED1 ON, LED2 ON +5s: (001) LED0 OFF, LED1 OFF, LED2 ON +6s: (011) LED0 OFF, LED1 ON, LED2 ON +7s: (001) LED0 OFF, LED1 OFF, LED2 ON + +Tools: + None. + +Known bugs/limitations: + None. diff --git a/apps/tosthreads/apps/TestJoin/TestJoinAppC.nc b/apps/tosthreads/apps/TestJoin/TestJoinAppC.nc new file mode 100644 index 00000000..9b875e64 --- /dev/null +++ b/apps/tosthreads/apps/TestJoin/TestJoinAppC.nc @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2008 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * TestJoin is a simple application used to test the basic functionality of + * the join() system call for waiting on a set of threads in a TOSThreads + * based application. + * + * Upon a successful burn, you should see all LEDs toggle in the following pattern, + * repeating every 8 seconds: + * + * 0s: (110) LED0 ON, LED1 ON, LED2 OFF
    + * 1s: (000) LED0 OFF, LED1 OFF, LED2 OFF
    + * 2s: (010) LED0 OFF, LED1 ON, LED2 OFF
    + * 3s: (000) LED0 OFF, LED1 OFF, LED2 OFF
    + * 4s: (111) LED0 ON, LED1 ON, LED2 ON
    + * 5s: (001) LED0 OFF, LED1 OFF, LED2 ON
    + * 6s: (011) LED0 OFF, LED1 ON, LED2 ON
    + * 7s: (001) LED0 OFF, LED1 OFF, LED2 ON
    + * + * @author Kevin Klues (klueska@cs.stanford.edu) + */ + +configuration TestJoinAppC { +} +implementation { + components MainC, TestJoinC, LedsC; + components new ThreadC(100) as NullThread; + components new ThreadC(100) as TinyThread0; + components new ThreadC(100) as TinyThread1; + + MainC.Boot <- TestJoinC; + TestJoinC.NullThread -> NullThread; + TestJoinC.TinyThread0 -> TinyThread0; + TestJoinC.TinyThread1 -> TinyThread1; + + TestJoinC.Leds -> LedsC; +} + diff --git a/apps/tosthreads/apps/TestJoin/TestJoinC.nc b/apps/tosthreads/apps/TestJoin/TestJoinC.nc new file mode 100644 index 00000000..ada03332 --- /dev/null +++ b/apps/tosthreads/apps/TestJoin/TestJoinC.nc @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2008 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * TestJoin is a simple application used to test the basic functionality of + * the join() system call for waiting on a set of threads in a TOSThreads + * based application. + * + * Upon a successful burn, you should see all LEDs toggle in the following pattern, + * repeating every 8 seconds: + * + * 0s: (110) LED0 ON, LED1 ON, LED2 OFF
    + * 1s: (000) LED0 OFF, LED1 OFF, LED2 OFF
    + * 2s: (010) LED0 OFF, LED1 ON, LED2 OFF
    + * 3s: (000) LED0 OFF, LED1 OFF, LED2 OFF
    + * 4s: (111) LED0 ON, LED1 ON, LED2 ON
    + * 5s: (001) LED0 OFF, LED1 OFF, LED2 ON
    + * 6s: (011) LED0 OFF, LED1 ON, LED2 ON
    + * 7s: (001) LED0 OFF, LED1 OFF, LED2 ON
    + * + * @author Kevin Klues (klueska@cs.stanford.edu) + */ + +module TestJoinC { + uses { + interface Boot; + interface Thread as NullThread; + interface Thread as TinyThread0; + interface Thread as TinyThread1; + interface Leds; + } +} + +implementation { + event void Boot.booted() { + call NullThread.start(NULL); + } + + event void NullThread.run(void* arg) { + for(;;){ + call TinyThread0.start(NULL); + call TinyThread1.start(NULL); + call TinyThread0.join(); + call TinyThread1.join(); + call Leds.led2Toggle(); + } + } + event void TinyThread0.run(void* arg) { + int i; + for(i=0; i<2; i++){ + call Leds.led0Toggle(); + call TinyThread0.sleep(1000); + } + } + event void TinyThread1.run(void* arg) { + int i; + for(i=0; i<4; i++){ + call Leds.led1Toggle(); + call TinyThread1.sleep(1000); + } + } +} diff --git a/apps/tosthreads/apps/TestPrintf/README b/apps/tosthreads/apps/TestPrintf/README index 60370341..fa2ddb33 100644 --- a/apps/tosthreads/apps/TestPrintf/README +++ b/apps/tosthreads/apps/TestPrintf/README @@ -11,10 +11,11 @@ prints. You can install TestPrintf on a mote via the following command: make threads install -Valid platforms are currently: tmote, telosb, iris, mica2, and micaz +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic Once burned on a mote, the java based PrintfClient must be ran to verify -proper operation of the application. +proper operation of the application. For example, to connect PrintfClient +to a mote over a USB serial port: java net.tinyos.tools.PrintfClient -comm serial@/dev/ttyUSBXXX: NOTE:: The baud rate 57600 must be used telos based motes, as its configuration diff --git a/apps/tosthreads/apps/TestPrintf/TestPrintfAppC.nc b/apps/tosthreads/apps/TestPrintf/TestPrintfAppC.nc index e9d8d1ac..eeb6d7d7 100644 --- a/apps/tosthreads/apps/TestPrintf/TestPrintfAppC.nc +++ b/apps/tosthreads/apps/TestPrintf/TestPrintfAppC.nc @@ -30,6 +30,10 @@ */ /** + * This application tests the operation of the Printf client in TOSThreads. It + * continuously prints the value of a counter starting at 0, increasing as it + * prints. + * * @author Kevin Klues (klueska@cs.stanford.edu) */ diff --git a/apps/tosthreads/apps/TestPrintf/TestPrintfC.nc b/apps/tosthreads/apps/TestPrintf/TestPrintfC.nc index 904a3919..3f308a66 100644 --- a/apps/tosthreads/apps/TestPrintf/TestPrintfC.nc +++ b/apps/tosthreads/apps/TestPrintf/TestPrintfC.nc @@ -30,6 +30,10 @@ */ /** + * This application tests the operation of the Printf client in TOSThreads. It + * continuously prints the value of a counter starting at 0, increasing as it + * prints. + * * @author Kevin Klues (klueska@cs.stanford.edu) */ diff --git a/apps/tosthreads/apps/TestSineSensor/README b/apps/tosthreads/apps/TestSineSensor/README index d70629e1..50e6386c 100644 --- a/apps/tosthreads/apps/TestSineSensor/README +++ b/apps/tosthreads/apps/TestSineSensor/README @@ -10,7 +10,7 @@ the software based SineSensor usable by any platform for demonstration purposes. You can install TestSineSensor on a mote via the following command: make threads install -Valid platforms are currently: tmote, telosb, iris, mica2, and micaz +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic This application simply takes sensor readings in an infinite loop from the SineSensor and forwards them over the serial interface. Upon successful diff --git a/apps/tosthreads/apps/TestSineSensor/TestSineSensorAppC.nc b/apps/tosthreads/apps/TestSineSensor/TestSineSensorAppC.nc index d601e09e..926a6809 100644 --- a/apps/tosthreads/apps/TestSineSensor/TestSineSensorAppC.nc +++ b/apps/tosthreads/apps/TestSineSensor/TestSineSensorAppC.nc @@ -30,6 +30,13 @@ */ /** + * This application is used to test the threaded version of the API for accessing + * the software based SineSensor usable by any platform for demonstration purposes. + * + * This application simply takes sensor readings in an infinite loop from the + * SineSensor and forwards them over the serial interface. Upon successful + * transmission, LED0 is toggled. + * * @author Kevin Klues (klueska@cs.stanford.edu) */ diff --git a/apps/tosthreads/apps/TestSineSensor/TestSineSensorC.nc b/apps/tosthreads/apps/TestSineSensor/TestSineSensorC.nc index f3a27773..cb97ecf8 100644 --- a/apps/tosthreads/apps/TestSineSensor/TestSineSensorC.nc +++ b/apps/tosthreads/apps/TestSineSensor/TestSineSensorC.nc @@ -30,6 +30,13 @@ */ /** + * This application is used to test the threaded version of the API for accessing + * the software based SineSensor usable by any platform for demonstration purposes. + * + * This application simply takes sensor readings in an infinite loop from the + * SineSensor and forwards them over the serial interface. Upon successful + * transmission, LED0 is toggled. + * * @author Kevin Klues (klueska@cs.stanford.edu) */ diff --git a/apps/tosthreads/capps/BaseStation/BaseStation.c b/apps/tosthreads/capps/BaseStation/BaseStation.c index 6aa49538..5d421a3f 100644 --- a/apps/tosthreads/capps/BaseStation/BaseStation.c +++ b/apps/tosthreads/capps/BaseStation/BaseStation.c @@ -30,7 +30,32 @@ */ /** - * Base station implementation using tosthreads + * BaseStation is a reimplementation of the standard BaseStation application using + * the TOSThreads thread library. It transparently forwards any AM messages it + * receives from its radio interface to its serial interface and vice versa. + * + *

    On the serial link, BaseStation sends and receives simple active + * messages (not particular radio packets): on the radio link, it + * sends radio active messages, whose format depends on the network + * stack being used. BaseStation will copy its compiled-in group ID to + * messages moving from the serial link to the radio, and will filter + * out incoming radio messages that do not contain that group ID.

    + * + *

    BaseStation includes queues in both directions, with a guarantee + * that once a message enters a queue, it will eventually leave on the + * other interface. The queues allow the BaseStation to handle load + * spikes.

    + * + *

    BaseStation acknowledges a message arriving over the serial link + * only if that message was successfully enqueued for delivery to the + * radio link.

    + * + *

    The LEDS are programmed to toggle as follows:

    + *
      + *
    • LED0: Message bridged from serial to radio
    • + *
    • LED1: Message bridged from radio to serial
    • + *
    • LED2: Dropped message due to queue overflow in either direction
    • + *
    * * @author Kevin Klues */ diff --git a/apps/tosthreads/capps/BaseStation/README b/apps/tosthreads/capps/BaseStation/README index 66ef052f..f0a5492e 100644 --- a/apps/tosthreads/capps/BaseStation/README +++ b/apps/tosthreads/capps/BaseStation/README @@ -36,7 +36,7 @@ leds rapidly. Additionally, messages should be forwarded over the serial interf as verified by running the following for the platform of interest: java net.tinyos.tools.Listen -comm serial@/dev/ttyUSBXXX: -NOTE:: The baud rate 57600 must be used telos based motes, as its configuration +NOTE: The baud rate 57600 must be used telos based motes, as its configuration has been changed to work with this baud rate when compiled for tosthreads. I.e. DO NOT just substitute 'telosb' or 'tmote' for above. Explicitly set it to 57600. diff --git a/apps/tosthreads/capps/Blink/Blink.c b/apps/tosthreads/capps/Blink/Blink.c index bcbeee06..c9e733be 100644 --- a/apps/tosthreads/capps/Blink/Blink.c +++ b/apps/tosthreads/capps/Blink/Blink.c @@ -30,6 +30,12 @@ */ /** + * Blink is a simple application used to test the basic functionality of + * TOSThreads. + * + * Upon a successful burn, you should see LED0 flashing with a period of every + * 200ms, and LED1 and LED2 flashing in unison with a period of 1000ms. + * * @author Kevin Klues (klueska@cs.stanford.edu) */ diff --git a/apps/tosthreads/capps/Blink/README b/apps/tosthreads/capps/Blink/README index 853f0ce1..2321f41c 100644 --- a/apps/tosthreads/capps/Blink/README +++ b/apps/tosthreads/capps/Blink/README @@ -10,7 +10,7 @@ TOSThreads. You can install Blink on a mote via the following command: make cthreads install -Valid platforms are currently: tmote, telosb, iris, mica2, and micaz +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic Upon a successful burn, you should see LED0 flashing with a period of every 200ms, and LED1 and LED2 flashing in unison with a period of 1000ms. diff --git a/apps/tosthreads/capps/Bounce/Bounce.c b/apps/tosthreads/capps/Bounce/Bounce.c index 2d2b34eb..f0484035 100644 --- a/apps/tosthreads/capps/Bounce/Bounce.c +++ b/apps/tosthreads/capps/Bounce/Bounce.c @@ -21,6 +21,31 @@ */ /** + * This application is derived from a similar application in the TinyThread + * implementation by William P. McCartney from Cleveland State University (2006) + * + * This application stresses the operation of the thread based AM commands for + * packet transmission and reception. To run this application you will need to + * burn it on one mote with NODE_ID 0, and a second mote with NODE_ID 1. + * + * Three different threads run that each contain an infinite loop that first sends + * a message and then waits to receive a message before returning to the top of the + * loop. After each message reception, one of the onboard LEDs is toggled to + * indicate that it was received. Thread 0 blinks LED0, thread 1 blinks LED1, and + * thread 2 blinks LED2. The three threads run independently, and three different + * messages are bounced back and forth between the two motes in an unsynchronized + * fashion. In contrast to the more complicated Bounce application found in the + * normal nesC threads version of this application, once a thread receives a + * message it will immediately flip on its LED instead of waiting on a Barrier and + * synchronizing the LEDs to come on only once messages have been received from all + * threads. In this way, messages are bounced back and forth between the two motes + * in an asynchronous fashion, and LEDS are toggled immediately upon message + * reception.. + * + * Successful running of this application results in each LED bouncing back and + * forth between each mote independent of one another. This will continue in an + * finite loop forever. + * * @author Chieh-Jan Mike Liang */ diff --git a/apps/tosthreads/capps/Bounce/README b/apps/tosthreads/capps/Bounce/README index 7bedfdec..2a5c0100 100644 --- a/apps/tosthreads/capps/Bounce/README +++ b/apps/tosthreads/capps/Bounce/README @@ -15,7 +15,7 @@ You can install Bounce on a mote via the following command: make cthreads install.0 make cthreads install.1 -Valid platforms are currently: tmote, telosb, iris, mica2, and micaz +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic Three different threads run that each contain an infinite loop that first sends a message and then waits to receive a message before returning to the top of the diff --git a/apps/tosthreads/capps/Null/Null.c b/apps/tosthreads/capps/Null/Null.c index 889ffabe..87bbde51 100644 --- a/apps/tosthreads/capps/Null/Null.c +++ b/apps/tosthreads/capps/Null/Null.c @@ -21,6 +21,12 @@ */ /** + * Null is an empty skeleton application for testing the basic compilation and + * runtime of a c-based tosthreads application. It is useful to test that the build + * environment is functional in its most minimal sense, i.e., you can correctly + * compile an application. It is also useful to test the minimum power consumption + * of a node when it has absolutely no interrupts or resources active. + * * @author Chieh-Jan Mike Liang */ diff --git a/apps/tosthreads/capps/Null/README b/apps/tosthreads/capps/Null/README index c568d2dc..ec074096 100644 --- a/apps/tosthreads/capps/Null/README +++ b/apps/tosthreads/capps/Null/README @@ -1,15 +1,16 @@ README for TOSTHREADS Null Author/Contact: tinyos-help@millennium.berkeley.edu -Author: Kevin Klues +Author: Kevin Klues Description: Null is an empty skeleton application for testing the basic compilation and -runtime of a c-based tosthreads application. It is useful to test that the build -environment is functional in its most minimal sense, i.e., you can correctly +runtime of a c-based tosthreads application. It is useful to test that the build environment is functional in its most minimal sense, i.e., you can correctly compile an application. It is also useful to test the minimum power consumption of a node when it has absolutely no interrupts or resources active. +Successful running of this application is that it simply compiles and installs. No LEDs should be flashed. + Tools: None. diff --git a/apps/tosthreads/capps/RadioStress/README b/apps/tosthreads/capps/RadioStress/README index a6263dff..fae9f9f7 100644 --- a/apps/tosthreads/capps/RadioStress/README +++ b/apps/tosthreads/capps/RadioStress/README @@ -12,7 +12,7 @@ You can install RadioStress on a mote via the following command: make cthreads install.0 make cthreads install.1 -Valid platforms are currently: tmote, telosb, iris, mica2, and micaz +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic The application burned with NODE_ID 0 will be programmed as a Receiver and will wait for messages from the sender programmed with NODE_ID 1. In the case of the diff --git a/apps/tosthreads/capps/SenseAndSend/Makefile b/apps/tosthreads/capps/SenseAndSend/Makefile index 911a0420..edf90505 100644 --- a/apps/tosthreads/capps/SenseAndSend/Makefile +++ b/apps/tosthreads/capps/SenseAndSend/Makefile @@ -1,7 +1,7 @@ TOSTHREAD_MAIN=SenseAndSend.c CFLAGS += -I$(TOSDIR)/lib/tosthreads/sensorboards/tmote_onboard -ifneq ($(filter telosb tmote clean,$(MAKECMDGOALS)),) +ifneq ($(filter telosb tmote epic clean,$(MAKECMDGOALS)),) include $(MAKERULES) else %: diff --git a/apps/tosthreads/capps/SenseAndSend/SenseAndSend.c b/apps/tosthreads/capps/SenseAndSend/SenseAndSend.c index 242d6503..c49a761e 100644 --- a/apps/tosthreads/capps/SenseAndSend/SenseAndSend.c +++ b/apps/tosthreads/capps/SenseAndSend/SenseAndSend.c @@ -30,6 +30,23 @@ */ /** + * SenseAndSend is a threaded implementation of an application that takes various + * sensor readings in parallel (by dedicating one thread to each reading), and + * assembling them into a packet to be sent out over the radio. It is written + * specifically for use with the tmote onboard sensor package, and will not compile + * for any other platforms. + * + * Readings are taken from each of the 4 oboard sensors and sent out over the radio + * interface in an infinite loop. Upon successful transmission, LED0 is toggled, + * and the process starts over again. + * + * A successful test will result in LED0 toggling periodically at a rate of + * approximately 220ms (the time it takes to take a humidity + temperature sensor + * reading since they share the same hardware and cannot be taken in parallel). + * + * Additionally, a base station application should be run to verify the reception + * of packets sent from a SenseAndSend mote, with reasonable looking sensor data. + * * @author Kevin Klues */ diff --git a/apps/tosthreads/capps/SenseStoreAndForward/SenseStoreAndForward.c b/apps/tosthreads/capps/SenseStoreAndForward/SenseStoreAndForward.c index 5b9e5bb2..93a75a40 100644 --- a/apps/tosthreads/capps/SenseStoreAndForward/SenseStoreAndForward.c +++ b/apps/tosthreads/capps/SenseStoreAndForward/SenseStoreAndForward.c @@ -30,6 +30,34 @@ */ /** + * SenseStoreAndForward is a threaded implementation of an application that takes + * various sensor readings in parallel (by dedicating one thread to each reading), + * logs them to flash, and then sends them out over the radio at some later time. + * In the current implementation, sensor readings are taken as quickly as possible, + * and records containing a set of readings from each iteration are batched out + * over the radio every 10000ms. This application is written specifically for use + * with the tmote onboard sensor package, and will not compile for any other + * platforms. + * + * Readings are taken from each of the 4 oboard sensors and logged to flash as one + * record in an infinite loop. Records are then read out of flash and and sent out + * over the radio interface in separate infinite loop. Before the application + * starts running, the entire contents of the flash drive are erased. + * + * A successful test will result in LED0 remaining solid for approximately 6s while + * the flash is being erased. After that LED0 will toggle with each successful set + * of sensor readings logged to flash, at a rate of approximately 220ms (the time + * it takes to take a humidity + temperature sensor reading since they share the + * same hardware and cannot be taken in parallel). Also, LED1 will begin toggling + * in rapid succession once every 10000ms as records are successfully read from + * flash and sent out over the radio. Once all of the records currently recorded + * to flash since the last batch of sends have been sent out, LED2 Toggles to + * indicate completion. This process continues in an infinite loop forever. + * + * Additionally, a base station application should be run to verify the reception + * of packets sent from a SenseStoreAndForward mote, with reasonable looking sensor + * data. + * * @author Kevin Klues */ diff --git a/apps/tosthreads/capps/TestCollection/Makefile b/apps/tosthreads/capps/TestCollection/Makefile index aeac9db9..7e378bf0 100644 --- a/apps/tosthreads/capps/TestCollection/Makefile +++ b/apps/tosthreads/capps/TestCollection/Makefile @@ -8,11 +8,11 @@ CFLAGS += -I$(TOSDIR)/lib/net/ CFLAGS += -I$(TOSDIR)/lib/tosthreads/lib/net/ctp CFLAGS += -I$(TOSDIR)/lib/net/ctp -I$(TOSDIR)/lib/net/4bitle -ifneq ($(filter telosb tmote tinynode shimmer iris clean,$(MAKECMDGOALS)),) +ifneq ($(filter telosb tmote tinynode shimmer iris epic clean,$(MAKECMDGOALS)),) include $(MAKERULES) else %: - @echo " Sorry, this application only works on platforms with >8kB of RAM (telos, iris)" + @echo " Sorry, this application only works on platforms with >8kB of RAM (telos, iris, etc.)" cthreads: @: dynthreads: diff --git a/apps/tosthreads/capps/TestCollection/README b/apps/tosthreads/capps/TestCollection/README index 63cd279d..1eb94411 100644 --- a/apps/tosthreads/capps/TestCollection/README +++ b/apps/tosthreads/capps/TestCollection/README @@ -14,7 +14,7 @@ application. You can install TestCollection on a mote via the following command: make cthreads install -Valid platforms are currently: tmote, telosb, mica2, micaz and iris +Valid platforms are currently: tmote, telosb, mica2, micaz, iris, and epic At least two motes must be used by this application, with one of them installed as a base station. Base station motes can be created by installing them with @@ -24,7 +24,7 @@ NODE_ID % 500 == 0. make cthreads install.1000 All other nodes can be installed with arbitrary NODE_IDs. - make threads install.123 + make cthreads install.123 Successful running of this application is verified by all NON-base station motes periodically flashing LED0 upon sending a message, and the base station mote, @@ -34,14 +34,13 @@ section. Tools: -The Java application displays readings it receives from motes running the -MultihopOscilloscope demo via a serial forwarder. To run it, change to the -TestCollection/java subdirectory and type: +The Java application displays readings it receives from motes via a +serial forwarder. To run it, change to the java subdirectory and type: make java net.tinyos.sf.SerialForwarder -comm serial@: - # e.g., java net.tinyps.sf.SerialForwarder -comm serial@/dev/ttyUSB0:mica2 - # or java net.tinyps.sf.SerialForwarder -comm serial@COM2:telosb + # e.g., java net.tinyos.sf.SerialForwarder -comm serial@/dev/ttyUSB0:mica2 + # or java net.tinyos.sf.SerialForwarder -comm serial@COM2:57600 ./run NOTE:: The baud rate 57600 must be used telos based motes, as its configuration @@ -59,10 +58,10 @@ Notes: underlying collection protocol. The makefile can be modified to work with MultihopLQI by changing the appropriate include directories. + The baud rate 57600 must be used telos based motes, as its configuration + has been changed to work with this baud rate when compiled for tosthreads. I.e. + DO NOT just substitute 'telosb' or 'tmote' for above. Explicitly + set it to 57600. + Known bugs/limitations: - Warnings are issued about fan out on the 'Snoop.receive' and 'Receive.receive' - events. These warnings are harmless and are the result of providing a C based - API in which all events for receiving and snooping must be handled even if not - used by a particular application. The warnings occur because the underlying - CTP or MultihopLQI stacks wire up to particular AM ids, which are also wired - into the C API for handling message reception. + None diff --git a/apps/tosthreads/capps/TestCollection/TestCollection.c b/apps/tosthreads/capps/TestCollection/TestCollection.c index 21aca5a0..bc2ddceb 100644 --- a/apps/tosthreads/capps/TestCollection/TestCollection.c +++ b/apps/tosthreads/capps/TestCollection/TestCollection.c @@ -30,7 +30,31 @@ */ /** + * TestCollection is a reimplementation of the Multihop Oscilloscope application + * using TOSThreads. It periodically samples a universal software-based SineSensor + * and broadcasts a message every few readings. These readings can be displayed by + * the Java "Oscilloscope" application found in the the TestCollection/java + * subdirectory. The sampling rate starts at 4Hz, but can be changed from the Java + * application. + * + * At least two motes must be used by this application, with one of them installed + * as a base station. Base station motes can be created by installing them with + * NODE_ID % 500 == 0. + * i.e. make cthreads install.0 + * make cthreads install.500 + * make cthreads install.1000 + * + * All other nodes can be installed with arbitrary NODE_IDs. + * make cthreads install.123 + * + * Successful running of this application is verified by all NON-base station motes + * periodically flashing LED1 upon sending a message, and the base station mote, + * flashing LED2 upon successful reception of a message. Additionally, correct + * operation should be verified by running the java tool described in the following + * section. + * * @author Kevin Klues + * @author Chieh-Jan Mike Liang */ #include "tosthread.h" @@ -51,19 +75,28 @@ uint8_t reading = 0; /* 0 to NREADINGS */ message_t sendbuf; message_t recvbuf; -void tosthread_main(void* arg) { +enum { + MY_COLLECTION_ID = NEW_COLLECTION_CLIENT_ID(), // Gets a collection sender instance +}; + +void tosthread_main(void* arg) +{ local.interval = DEFAULT_INTERVAL; local.id = TOS_NODE_ID; local.version = 0; while ( amRadioStart() != SUCCESS ); while ( collectionRoutingStart() != SUCCESS ); - + + collectionSetCollectionId(MY_COLLECTION_ID, AM_OSCILLOSCOPE); // Associates the collection sender + // with AM_OSCILLOSCOPE collection ID + if (local.id % 500 == 0) { - while ( amSerialStart() != SUCCESS); + while ( amSerialStart() != SUCCESS ); collectionSetRoot(); for (;;) { - if ( collectionReceive(&recvbuf, 0, AM_OSCILLOSCOPE) == SUCCESS) { + // Waits for incoming packets with AM_OSCILLOSCOPE collection ID + if (collectionReceive(&recvbuf, 0, AM_OSCILLOSCOPE) == SUCCESS) { oscilloscope_t *recv_o = (oscilloscope_t *) collectionGetPayload(&recvbuf, sizeof(oscilloscope_t)); oscilloscope_t *send_o = (oscilloscope_t *) serialGetPayload(&sendbuf, sizeof(oscilloscope_t)); memcpy(send_o, recv_o, sizeof(oscilloscope_t)); @@ -73,7 +106,7 @@ void tosthread_main(void* arg) { } } else { uint16_t var; - + for (;;) { if (reading == NREADINGS) { oscilloscope_t *o = (oscilloscope_t *) collectionGetPayload(&sendbuf, sizeof(oscilloscope_t)); @@ -82,7 +115,7 @@ void tosthread_main(void* arg) { return; } memcpy(o, &local, sizeof(local)); - if (collectionSend(&sendbuf, sizeof(local), AM_OSCILLOSCOPE) == SUCCESS) { + if (collectionSend(&sendbuf, sizeof(local), MY_COLLECTION_ID) == SUCCESS) { local.count++; report_sent(); } else { @@ -91,18 +124,19 @@ void tosthread_main(void* arg) { reading = 0; } - + if (sinesensor_read(&var) == SUCCESS) { local.readings[reading++] = var; } - + tosthread_sleep(local.interval); } } } // Use LEDs to report various status issues. -void fatal_problem() { +void fatal_problem() +{ led0On(); led1On(); led2On(); diff --git a/apps/tosthreads/capps/TestJoin/Makefile b/apps/tosthreads/capps/TestJoin/Makefile new file mode 100644 index 00000000..37ac73cf --- /dev/null +++ b/apps/tosthreads/capps/TestJoin/Makefile @@ -0,0 +1,3 @@ +TOSTHREAD_MAIN=TestJoin.c + +include $(MAKERULES) diff --git a/apps/tosthreads/capps/TestJoin/README b/apps/tosthreads/capps/TestJoin/README new file mode 100644 index 00000000..35eba606 --- /dev/null +++ b/apps/tosthreads/capps/TestJoin/README @@ -0,0 +1,32 @@ +README for TOSThreads TestJoin +Author/Contact: tinyos-help@millennium.berkeley.edu +Author: Kevin Klues + +Description: + +TestJoin is a simple application used to test the basic functionality of +the join() system call for waiting on a set of threads in a TOSThreads +based application. + +You can install TestJoin on a mote via the following command: + make threads install + +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic + +Upon a successful burn, you should see all LEDs toggle in the following pattern, +repeating every 8 seconds: + +0s: (110) LED0 ON, LED1 ON, LED2 OFF +1s: (000) LED0 OFF, LED1 OFF, LED2 OFF +2s: (010) LED0 OFF, LED1 ON, LED2 OFF +3s: (000) LED0 OFF, LED1 OFF, LED2 OFF +4s: (111) LED0 ON, LED1 ON, LED2 ON +5s: (001) LED0 OFF, LED1 OFF, LED2 ON +6s: (011) LED0 OFF, LED1 ON, LED2 ON +7s: (001) LED0 OFF, LED1 OFF, LED2 ON + +Tools: + None. + +Known bugs/limitations: + None. diff --git a/apps/tosthreads/capps/TestJoin/TestJoin.c b/apps/tosthreads/capps/TestJoin/TestJoin.c new file mode 100644 index 00000000..3ff35b57 --- /dev/null +++ b/apps/tosthreads/capps/TestJoin/TestJoin.c @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2008 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * TestJoin is a simple application used to test the basic functionality of + * the join() system call for waiting on a set of threads in a TOSThreads + * based application. + * + * Upon a successful burn, you should see all LEDs toggle in the following pattern, + * repeating every 8 seconds: + * + * 0s: (110) LED0 ON, LED1 ON, LED2 OFF
    + * 1s: (000) LED0 OFF, LED1 OFF, LED2 OFF
    + * 2s: (010) LED0 OFF, LED1 ON, LED2 OFF
    + * 3s: (000) LED0 OFF, LED1 OFF, LED2 OFF
    + * 4s: (111) LED0 ON, LED1 ON, LED2 ON
    + * 5s: (001) LED0 OFF, LED1 OFF, LED2 ON
    + * 6s: (011) LED0 OFF, LED1 ON, LED2 ON
    + * 7s: (001) LED0 OFF, LED1 OFF, LED2 ON
    + * + * @author Kevin Klues (klueska@cs.stanford.edu) + */ + +#include "stack.h" +#include "tosthread.h" +#include "tosthread_leds.h" + +//Initialize variables associated with each thread +tosthread_t init; +tosthread_t blink0; +tosthread_t blink1; + +void init_thread(void* arg); +void blink0_thread(void* arg); +void blink1_thread(void* arg); + +void tosthread_main(void* arg) { + //Use stack estimator to calculate maximum stack size + // on a thread by thread basis + tosthread_create(&init, init_thread, NULL, INIT_STACK_SIZE); +} + +void init_thread(void* arg) { + for(;;) { + tosthread_create(&blink0, blink0_thread, NULL, BLINK0_STACK_SIZE); + tosthread_create(&blink1, blink1_thread, NULL, BLINK1_STACK_SIZE); + tosthread_join(&blink0); + tosthread_join(&blink1); + led2Toggle(); + } +} + +void blink0_thread(void* arg) { + int i; + for(i=0; i<2; i++) { + led0Toggle(); + tosthread_sleep(1000); + } +} + +void blink1_thread(void* arg) { + int i; + for(i=0; i<4; i++) { + led1Toggle(); + tosthread_sleep(1000); + } +} + diff --git a/apps/tosthreads/capps/TestJoin/stack.h b/apps/tosthreads/capps/TestJoin/stack.h new file mode 100644 index 00000000..392794ad --- /dev/null +++ b/apps/tosthreads/capps/TestJoin/stack.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2008 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @author Kevin Klues + */ + +enum { + INIT_STACK_SIZE = 50, + BLINK0_STACK_SIZE = 200, + BLINK1_STACK_SIZE = 200, + BLINK2_STACK_SIZE = 200, +}; diff --git a/apps/tosthreads/capps/TestLogStorage/Makefile b/apps/tosthreads/capps/TestLogStorage/Makefile index 5a4a3997..cf587f24 100644 --- a/apps/tosthreads/capps/TestLogStorage/Makefile +++ b/apps/tosthreads/capps/TestLogStorage/Makefile @@ -1,11 +1,11 @@ TOSTHREAD_MAIN=TestLogStorage.c -THIS_SUPPORTED_PLATFORMS=tmote telos telosb eyesIFXv1 eyesIFXv2 mica2 mica2dot telosa eyesIFX micaz iris tinynode +THIS_SUPPORTED_PLATFORMS=tmote telos telosb eyesIFXv1 eyesIFXv2 mica2 mica2dot telosa eyesIFX micaz iris tinynode epic ifneq ($(filter $(THIS_SUPPORTED_PLATFORMS) clean,$(MAKECMDGOALS)),) ifneq ($(filter tmote telos telosb eyesIFXv1,$(MAKECMDGOALS)),) CFLAGS+=-DUSE_STM25P endif - ifneq ($(filter mica2 telosa mica2dot eyesIFX eyesIFXv2 micaz iris tinynode,$(MAKECMDGOALS)),) + ifneq ($(filter mica2 telosa mica2dot eyesIFX eyesIFXv2 micaz iris tinynode epic,$(MAKECMDGOALS)),) CFLAGS+=-DUSE_AT45DB endif diff --git a/apps/tosthreads/capps/TestLogStorage/README b/apps/tosthreads/capps/TestLogStorage/README index 7016add8..3c83d84f 100644 --- a/apps/tosthreads/capps/TestLogStorage/README +++ b/apps/tosthreads/capps/TestLogStorage/README @@ -4,21 +4,20 @@ Author: Kevin Klues Description: -TestLogStorage is a threaded implementation of an application that takes a dummy -sensor readings of a counter, logs it flash, and then sends it out over the -serial port at some later time. In the current implementation, each sensor reading is -taken once every 3000ms, and records containing a set of readings from each -iteration are batched out over the radio every 10000ms. This application is -very similar to the SenseStoreAndForward application contained in this same -directory, except that it is written using a dummy sensor value instead of -sensors specific to the tmote onboard suite. In this way, the LogStorage -functionality can be tested in conjunction with the sending facility in a -platform independent way. +TestLogStorage is a threaded application that takes dummy sensor readings of a +counter, logs them to flash, and then sends out over the serial port at some +later time. In the current implementation, each sensor reading is taken once +every 3000ms, and records containing a set of readings from each iteration are +batched out over the radio every 10000ms. This application is very similar to +the SenseStoreAndForward application contained in this same directory, except +that it uses a dummy sensor instead of sensors specific to the tmote onboard +suite. In this way, the LogStorage functionality can be tested in conjunction +with the sending facility in a platform independent way. To run this application install it on a mote via the command: make cthreads install -Valid platforms are currently: tmote, telosb, iris, mica2, and micaz +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic Readings are taken from the dummy sensor and logged to flash as one record in an infinite loop. Records are then read out of flash and and sent out over the @@ -35,14 +34,24 @@ to indicate completion. This process continues in an infinite loop forever. Since the TestLogStorage mote writes its records out to the serial port, you can test that the application is working properly by reading these -packets (e.g., through seriallisten) and checking that they have reasonable -values, counting up from 0. E.g.: - -00 ff ff 00 00 06 00 25 00 00 00 9f 00 9f -00 ff ff 00 00 06 00 25 00 00 00 a0 00 a0 -00 ff ff 00 00 06 00 25 00 00 00 a1 00 a1 -00 ff ff 00 00 06 00 25 00 00 00 a2 00 a2 -00 ff ff 00 00 06 00 25 00 00 00 a3 00 a3 +packets (e.g., through seriallisten): + + java net.tinyos.tools.Listen -comm serial@/dev/ttyUSBXXX: + +Once this java application is running, you should see output containing +the sensor readings being streamed to your terminal. Check that the +output has reasonable values, counting up from 0. E.g.: + + 00 ff ff 00 00 06 00 25 00 00 00 9f 00 9f + 00 ff ff 00 00 06 00 25 00 00 00 a0 00 a0 + 00 ff ff 00 00 06 00 25 00 00 00 a1 00 a1 + 00 ff ff 00 00 06 00 25 00 00 00 a2 00 a2 + 00 ff ff 00 00 06 00 25 00 00 00 a3 00 a3 + +NOTE: The baud rate 57600 must be used telos based motes, as its configuration +has been changed to work with this baud rate when compiled for tosthreads. I.e. +DO NOT just substitute 'telosb' or 'tmote' for above. Explicitly +set it to 57600. Tools: None. diff --git a/apps/tosthreads/capps/TestLogStorage/TestLogStorage.c b/apps/tosthreads/capps/TestLogStorage/TestLogStorage.c index b157228a..6e48a217 100644 --- a/apps/tosthreads/capps/TestLogStorage/TestLogStorage.c +++ b/apps/tosthreads/capps/TestLogStorage/TestLogStorage.c @@ -30,6 +30,30 @@ */ /** + * TestLogStorage is a threaded implementation of an application that takes a dummy + * sensor readings of a counter, logs it flash, and then sends it out over the + * serial port at some later time. In the current implementation, each sensor reading is + * taken once every 3000ms, and records containing a set of readings from each + * iteration are batched out over the radio every 10000ms. This application is + * very similar to the SenseStoreAndForward application contained in this same + * directory, except that it is written using a dummy sensor value instead of + * sensors specific to the tmote onboard suite. In this way, the LogStorage + * functionality can be tested in conjunction with the sending facility in a + * platform independent way. + * + * Readings are taken from the dummy sensor and logged to flash as one record in an + * infinite loop. Records are then read out of flash and and sent out over the + * serial interface in separate infinite loop. Before the application starts + * running, the entire contents of the flash drive are erased. + * + * A successful test will result in LED0 remaining solid for approximately 6s while + * the flash is being erased. After that LED0 will toggle with each successful + * sensor readings logged to flash, at a rate of 3000ms. Also, LED1 will begin + * toggling in rapid succession once every 10000ms as records are successfully read + * from flash and sent out over the serial port. Once all of the records currently + * recorded to flash since the last batch of sends have been sent out, LED2 Toggles + * to indicate completion. This process continues in an infinite loop forever. + * * @author Kevin Klues */ diff --git a/apps/tosthreads/capps/TestPrintf/README b/apps/tosthreads/capps/TestPrintf/README index 46106b08..17294b55 100644 --- a/apps/tosthreads/capps/TestPrintf/README +++ b/apps/tosthreads/capps/TestPrintf/README @@ -11,13 +11,13 @@ prints. You can install TestPrintf on a mote via the following command: make cthreads install -Valid platforms are currently: tmote, telosb, iris, mica2, and micaz +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic Once burned on a mote, the java based PrintfClient must be ran to verify proper operation of the application. java net.tinyos.tools.PrintfClient -comm serial@/dev/ttyUSBXXX: -NOTE:: The baud rate 57600 must be used telos based motes, as its configuration +NOTE: The baud rate 57600 must be used telos based motes, as its configuration has been changed to work with this baud rate when compiled for tosthreads. I.e. DO NOT just substitute 'telosb' or 'tmote' for above. Explicitly set it to 57600. diff --git a/apps/tosthreads/capps/TestPrintf/TestPrintf.c b/apps/tosthreads/capps/TestPrintf/TestPrintf.c index 28badaf7..e06c3308 100644 --- a/apps/tosthreads/capps/TestPrintf/TestPrintf.c +++ b/apps/tosthreads/capps/TestPrintf/TestPrintf.c @@ -30,6 +30,10 @@ */ /** + * This application tests the operation of the Printf client in TOSThreads. It + * continuously prints the value of a counter starting at 0, increasing as it + * prints. + * * @author Kevin Klues (klueska@cs.stanford.edu) */ diff --git a/apps/tosthreads/capps/TestSineSensor/README b/apps/tosthreads/capps/TestSineSensor/README index b95b8fdf..852411ad 100644 --- a/apps/tosthreads/capps/TestSineSensor/README +++ b/apps/tosthreads/capps/TestSineSensor/README @@ -10,7 +10,7 @@ the software based SineSensor usable by any platform for demonstration purposes. You can install TestSineSensor on a mote via the following comand: make cthreads install -Valid platforms are currently: tmote, telosb, iris, mica2, and micaz +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic This application simply takes sensor readings in an infinite loop from the SineSensor and forwards them over the serial interface. Upon successful @@ -22,7 +22,7 @@ over the serial interface as verified by running the following for the platform of interest: java net.tinyos.tools.Listen -comm serial@/dev/ttyUSBXXX: -NOTE:: The baud rate 57600 must be used telos based motes, as its configuration +NOTE: The baud rate 57600 must be used telos based motes, as its configuration has been changed to work with this baud rate when compiled for tosthreads. I.e. DO NOT just substitute 'telosb' or 'tmote' for above. Explicitly set it to 57600. diff --git a/apps/tosthreads/capps/TestSineSensor/TestSineSensor.c b/apps/tosthreads/capps/TestSineSensor/TestSineSensor.c index bf2f7d61..c6483ea6 100644 --- a/apps/tosthreads/capps/TestSineSensor/TestSineSensor.c +++ b/apps/tosthreads/capps/TestSineSensor/TestSineSensor.c @@ -30,6 +30,13 @@ */ /** + * This application is used to test the threaded version of the API for accessing + * the software based SineSensor usable by any platform for demonstration purposes. + * + * This application simply takes sensor readings in an infinite loop from the + * SineSensor and forwards them over the serial interface. Upon successful + * transmission, LED0 is toggled. + * * @author Kevin Klues */ diff --git a/apps/tosthreads/capps/ThreadStress/README b/apps/tosthreads/capps/ThreadStress/README index ce519719..34c59e6f 100644 --- a/apps/tosthreads/capps/ThreadStress/README +++ b/apps/tosthreads/capps/ThreadStress/README @@ -13,7 +13,7 @@ toggled is offset so that the three LEDS do not come on in unison. You can install ThreadStress on a mote via the following command: make cthreads install -Valid platforms are currently: tmote, telosb, iris, mica2, and micaz +Valid platforms are currently: tmote, telosb, iris, mica2, micaz, and epic Successful running of this application will result in all three leds flashing at a rate determined by how long it takes to spawn a thread on a given platform. diff --git a/apps/tosthreads/capps/ThreadStress/ThreadStress.c b/apps/tosthreads/capps/ThreadStress/ThreadStress.c index 89497382..8d26bbe3 100644 --- a/apps/tosthreads/capps/ThreadStress/ThreadStress.c +++ b/apps/tosthreads/capps/ThreadStress/ThreadStress.c @@ -30,6 +30,18 @@ */ /** + * This application stresses the creation and destruction of dynamic threads by + * spawning lots and lots of threads over and over again and letting them run to + * completion. Three different thread start functions are used, each toggling one + * of LED0, LED1, and LED2 every 256 spawnings. The time at which each LED is + * toggled is offset so that the three LEDS do not come on in unison. + * + * Successful running of this application will result in all three leds flashing at + * a rate determined by how long it takes to spawn a thread on a given platform. + * All three LEDs should flash at this rate in an infinite loop forever. Given the + * dynamics on the mote the rate may vary over time, but the important thing is + * that all three LEDs continue to toggle at a reasonably visible rate. + * * @author Kevin Klues (klueska@cs.stanford.edu) */ diff --git a/apps/tosthreads/tinyld/LoadFromRAM/LoadFromRAMAppC.nc b/apps/tosthreads/tinyld/LoadFromRAM/LoadFromRAMAppC.nc new file mode 100644 index 00000000..804dd46a --- /dev/null +++ b/apps/tosthreads/tinyld/LoadFromRAM/LoadFromRAMAppC.nc @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2008 Johns Hopkins University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written + * agreement is hereby granted, provided that the above copyright + * notice, the (updated) modification history and the author appear in + * all copies of this source code. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, + * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * LoadFromRAM is a simple program that dynamically loads two loadable + * programs hardcoded in the byte arrays; One program is Blink, and the + * other one is Basestation. + * + * @author Chieh-Jan Mike Liang + */ + +configuration LoadFromRAMAppC {} + +implementation { + components MainC, + LoadFromRAMP, + DynamicLoaderC, + LedsC; + + LoadFromRAMP.Boot -> MainC; + LoadFromRAMP.DynamicLoader -> DynamicLoaderC; + LoadFromRAMP.Leds -> LedsC; +} diff --git a/apps/tosthreads/tinyld/LoadFromRAM/LoadFromRAMP.nc b/apps/tosthreads/tinyld/LoadFromRAM/LoadFromRAMP.nc new file mode 100644 index 00000000..7b7e96e6 --- /dev/null +++ b/apps/tosthreads/tinyld/LoadFromRAM/LoadFromRAMP.nc @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2008 Johns Hopkins University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written + * agreement is hereby granted, provided that the above copyright + * notice, the (updated) modification history and the author appear in + * all copies of this source code. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, + * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * LoadFromRAM is a simple program that dynamically loads two loadable + * programs hardcoded in the byte arrays; One program is Blink, and the + * other one is Basestation. + * + * @author Chieh-Jan Mike Liang + */ + +module LoadFromRAMP +{ + uses { + interface Boot; + interface DynamicLoader; + interface Leds; + } +} + +implementation +{ + // The following blinks led 2 + uint8_t code1[] = { + 0x1c, 0x00, 0x01, 0x00, 0x03, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x01, 0x00, 0x2c, 0x00, 0x08, 0x00, 0x44, 0x00, 0x09, 0x00, + 0x56, 0x00, 0x0a, 0x00, 0x32, 0x00, 0x30, 0x00, 0x24, 0x00, 0x0f, 0x42, 0x12, 0xc3, 0x0f, 0x10, + 0x0f, 0x11, 0x0f, 0x11, 0x5f, 0xf3, 0x32, 0xc2, 0x03, 0x43, 0x7f, 0xf3, 0x30, 0x41, 0x4f, 0x93, + 0x01, 0x24, 0x32, 0xd2, 0x30, 0x41, 0x3c, 0x40, 0xf4, 0x01, 0x0d, 0x43, 0x3e, 0x40, 0x00, 0x00, + 0x3f, 0x40, 0x00, 0x00, 0xb0, 0x12, 0x00, 0x00, 0x30, 0x41, 0xb0, 0x12, 0x00, 0x00, 0x3e, 0x40, + 0xe8, 0x03, 0x0f, 0x43, 0xb0, 0x12, 0x4e, 0x00, 0xf8, 0x3f, 0x30, 0x41, 0xb0, 0x12, 0x00, 0x00, + 0x3e, 0x40, 0xe8, 0x03, 0x0f, 0x43, 0xb0, 0x12, 0x60, 0x00, 0xf8, 0x3f, 0x30, 0x41, 0xb0, 0x12, + 0x00, 0x00, 0x3e, 0x40, 0xe8, 0x03, 0x0f, 0x43, 0xb0, 0x12, 0x00, 0x00, 0xf8, 0x3f, 0x30, 0x41 + }; + + // The following is BaseStationForC + uint8_t code2[] = { + 0x1c, 0x00, 0x05, 0x00, 0x58, 0x01, 0x1e, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x26, 0x03, 0xac, 0x00, + 0x26, 0x00, 0xae, 0x00, 0x88, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x01, 0x00, 0x52, 0x00, 0x02, 0x00, + 0x64, 0x00, 0x01, 0x00, 0x44, 0x00, 0x08, 0x00, 0xe2, 0x00, 0x09, 0x00, 0x00, 0x02, 0x0a, 0x00, + 0xdc, 0x00, 0x0b, 0x00, 0x32, 0x00, 0x0d, 0x00, 0x10, 0x03, 0x0e, 0x00, 0x98, 0x01, 0x11, 0x00, + 0xd6, 0x02, 0x12, 0x00, 0xce, 0x02, 0x14, 0x00, 0x9c, 0x02, 0x16, 0x00, 0xc6, 0x02, 0x1a, 0x00, + 0x94, 0x02, 0x1b, 0x00, 0xde, 0x02, 0x22, 0x00, 0x2e, 0x00, 0x24, 0x00, 0xb6, 0x00, 0x25, 0x00, + 0xfa, 0x02, 0x28, 0x00, 0x84, 0x02, 0x29, 0x00, 0x7c, 0x02, 0x2b, 0x00, 0xee, 0x02, 0x2d, 0x00, + 0x74, 0x02, 0x31, 0x00, 0xe6, 0x02, 0x32, 0x00, 0x8c, 0x02, 0x3f, 0x00, 0xa2, 0x00, 0x40, 0x00, + 0x04, 0x01, 0x42, 0x00, 0x18, 0x01, 0x44, 0x00, 0x98, 0x00, 0x45, 0x00, 0xec, 0x00, 0x46, 0x00, + 0x0e, 0x01, 0x51, 0x00, 0x8a, 0x01, 0x6d, 0x00, 0x6c, 0x01, 0x90, 0x00, 0x22, 0x00, 0xb0, 0x00, + 0x3c, 0x00, 0x84, 0x01, 0x4e, 0x00, 0x92, 0x01, 0x60, 0x00, 0x0a, 0x03, 0x72, 0x00, 0x18, 0x03, + 0x84, 0x00, 0xbe, 0x00, 0xba, 0x00, 0x28, 0x01, 0xf4, 0x00, 0x00, 0x00, 0x46, 0x01, 0xa0, 0x01, + 0x9c, 0x01, 0x18, 0x02, 0xbc, 0x01, 0xb8, 0x02, 0xfc, 0x01, 0x66, 0x02, 0x08, 0x02, 0x0f, 0x42, + 0x12, 0xc3, 0x0f, 0x10, 0x0f, 0x11, 0x0f, 0x11, 0x5f, 0xf3, 0x32, 0xc2, 0x03, 0x43, 0x7f, 0xf3, + 0x30, 0x41, 0x4f, 0x93, 0x01, 0x24, 0x32, 0xd2, 0x30, 0x41, 0x3f, 0x40, 0x40, 0x00, 0xb0, 0x12, + 0x2a, 0x00, 0x3f, 0x40, 0x76, 0x00, 0xb0, 0x12, 0x00, 0x00, 0xb0, 0x12, 0x00, 0x00, 0xb0, 0x12, + 0x00, 0x00, 0x3c, 0x40, 0xc8, 0x00, 0x0d, 0x43, 0x3e, 0x40, 0x00, 0x00, 0x3f, 0x40, 0xb2, 0x00, + 0xb0, 0x12, 0x56, 0x00, 0x3c, 0x40, 0xc8, 0x00, 0x0d, 0x43, 0x3e, 0x40, 0x00, 0x00, 0x3f, 0x40, + 0x00, 0x00, 0xb0, 0x12, 0x68, 0x00, 0x3c, 0x40, 0xc8, 0x00, 0x0d, 0x43, 0x3e, 0x40, 0x00, 0x00, + 0x3f, 0x40, 0x00, 0x00, 0xb0, 0x12, 0x7a, 0x00, 0x3c, 0x40, 0xc8, 0x00, 0x0d, 0x43, 0x3e, 0x40, + 0x00, 0x00, 0x3f, 0x40, 0x0c, 0x03, 0xb0, 0x12, 0x8c, 0x00, 0x3c, 0x40, 0xc8, 0x00, 0x0d, 0x43, + 0x3e, 0x40, 0x00, 0x00, 0x3f, 0x40, 0x00, 0x00, 0xb0, 0x12, 0x00, 0x00, 0x30, 0x41, 0x0b, 0x12, + 0x0b, 0x4f, 0x2f, 0x52, 0xb0, 0x12, 0x00, 0x00, 0x0f, 0x4b, 0x3f, 0x50, 0x0a, 0x00, 0xb0, 0x12, + 0x00, 0x00, 0xcb, 0x43, 0xaa, 0x00, 0xcb, 0x43, 0xab, 0x00, 0x3b, 0x41, 0x30, 0x41, 0x3e, 0x40, + 0x86, 0x01, 0x3f, 0x40, 0x00, 0x00, 0xb0, 0x12, 0x8e, 0x01, 0x30, 0x41, 0x0b, 0x12, 0x0a, 0x12, + 0x09, 0x12, 0x31, 0x80, 0x34, 0x00, 0x09, 0x4f, 0x0b, 0x4e, 0x7c, 0x43, 0x0d, 0x43, 0x0e, 0x43, + 0x0f, 0x41, 0x89, 0x12, 0x4f, 0x93, 0x03, 0x24, 0xb0, 0x12, 0x00, 0x00, 0xf6, 0x3f, 0xb0, 0x12, + 0x00, 0x00, 0x0a, 0x4b, 0x2a, 0x52, 0x0f, 0x4a, 0xb0, 0x12, 0xb6, 0x01, 0x0e, 0x41, 0x0f, 0x4b, + 0xb0, 0x12, 0x00, 0x00, 0x5f, 0x93, 0x07, 0x20, 0x0e, 0x4a, 0x0f, 0x4b, 0x3f, 0x50, 0x0a, 0x00, + 0xb0, 0x12, 0xcc, 0x01, 0xf3, 0x3f, 0x0f, 0x4b, 0x2f, 0x52, 0xb0, 0x12, 0xe6, 0x01, 0x0f, 0x4b, + 0x3f, 0x50, 0x0a, 0x00, 0xb0, 0x12, 0xf0, 0x01, 0xd8, 0x3f, 0x31, 0x50, 0x34, 0x00, 0x39, 0x41, + 0x3a, 0x41, 0x3b, 0x41, 0x30, 0x41, 0x0b, 0x12, 0x0a, 0x12, 0x09, 0x12, 0x09, 0x4f, 0x0d, 0x4e, + 0xff, 0x90, 0x03, 0x00, 0xaa, 0x00, 0x20, 0x2c, 0x5f, 0x4f, 0xab, 0x00, 0x0a, 0x4f, 0x3c, 0x40, + 0x34, 0x00, 0xb0, 0x12, 0x48, 0x02, 0x0e, 0x59, 0x3e, 0x50, 0x0e, 0x00, 0x0f, 0x4d, 0x3d, 0x40, + 0x34, 0x00, 0xfe, 0x4f, 0x00, 0x00, 0x1e, 0x53, 0x1d, 0x83, 0xfb, 0x23, 0x5f, 0x49, 0xab, 0x00, + 0x1f, 0x53, 0x0c, 0x4f, 0x3a, 0x40, 0x03, 0x00, 0xb0, 0x12, 0x3e, 0x02, 0xc9, 0x4e, 0xab, 0x00, + 0xd9, 0x53, 0xaa, 0x00, 0x0f, 0x43, 0x01, 0x3c, 0x1f, 0x43, 0x39, 0x41, 0x3a, 0x41, 0x3b, 0x41, + 0x30, 0x41, 0x3e, 0x40, 0x94, 0x01, 0x3f, 0x40, 0x00, 0x00, 0xb0, 0x12, 0x14, 0x03, 0x30, 0x41, + 0x3e, 0x40, 0x00, 0x00, 0x3f, 0x40, 0xf4, 0x01, 0xb0, 0x12, 0x22, 0x03, 0x30, 0x41, 0x0b, 0x12, + 0x0a, 0x12, 0x09, 0x12, 0x31, 0x80, 0x34, 0x00, 0x09, 0x4f, 0x0b, 0x4e, 0x0a, 0x4b, 0x2a, 0x52, + 0x0f, 0x4a, 0xb0, 0x12, 0x00, 0x00, 0x0f, 0x4b, 0xb0, 0x12, 0x00, 0x00, 0x0f, 0x93, 0x07, 0x20, + 0x0e, 0x4a, 0x0f, 0x4b, 0x3f, 0x50, 0x0a, 0x00, 0xb0, 0x12, 0x00, 0x00, 0xf4, 0x3f, 0x0d, 0x41, + 0x3e, 0x40, 0x34, 0x00, 0xfd, 0x4f, 0x00, 0x00, 0x1d, 0x53, 0x1e, 0x83, 0xfb, 0x23, 0x0f, 0x4b, + 0x2f, 0x52, 0xb0, 0x12, 0x00, 0x00, 0x0f, 0x4b, 0x3f, 0x50, 0x0a, 0x00, 0xb0, 0x12, 0x00, 0x00, + 0x39, 0x90, 0xa8, 0x02, 0x06, 0x24, 0x0f, 0x41, 0xb0, 0x12, 0x00, 0x00, 0xb0, 0x12, 0x00, 0x00, + 0xd5, 0x3f, 0x0f, 0x41, 0xb0, 0x12, 0x00, 0x00, 0xf9, 0x3f, 0x31, 0x50, 0x34, 0x00, 0x39, 0x41, + 0x3a, 0x41, 0x3b, 0x41, 0x30, 0x41, 0x0b, 0x12, 0x0a, 0x12, 0x09, 0x12, 0x08, 0x12, 0x09, 0x4f, + 0x58, 0x4f, 0xaa, 0x00, 0x48, 0x93, 0x18, 0x24, 0x5f, 0x4f, 0xab, 0x00, 0x4e, 0x48, 0x0f, 0x8e, + 0x3f, 0x50, 0x03, 0x00, 0x0c, 0x4f, 0x3a, 0x40, 0x03, 0x00, 0xb0, 0x12, 0x00, 0x00, 0x0a, 0x4e, + 0x3c, 0x40, 0x34, 0x00, 0xb0, 0x12, 0x00, 0x00, 0x0f, 0x4e, 0x0f, 0x59, 0x78, 0x53, 0xc9, 0x48, + 0xaa, 0x00, 0x3f, 0x50, 0x0e, 0x00, 0x01, 0x3c, 0x0f, 0x43, 0x38, 0x41, 0x39, 0x41, 0x3a, 0x41, + 0x3b, 0x41, 0x30, 0x41, 0x0b, 0x12, 0x0a, 0x12, 0x09, 0x12, 0x08, 0x12, 0x07, 0x12, 0x0b, 0x4f, + 0xb0, 0x12, 0x00, 0x00, 0x47, 0x4f, 0x0f, 0x4b, 0xb0, 0x12, 0x00, 0x00, 0x09, 0x4f, 0x0f, 0x4b, + 0xb0, 0x12, 0x00, 0x00, 0x08, 0x4f, 0x0f, 0x4b, 0xb0, 0x12, 0x00, 0x00, 0x4a, 0x4f, 0x0f, 0x4b, + 0xb0, 0x12, 0x00, 0x00, 0x0e, 0x49, 0x0f, 0x4b, 0xb0, 0x12, 0x00, 0x00, 0x4c, 0x47, 0x4d, 0x4a, + 0x0e, 0x4b, 0x0f, 0x48, 0xb0, 0x12, 0x00, 0x00, 0x7f, 0xf3, 0x37, 0x41, 0x38, 0x41, 0x39, 0x41, + 0x3a, 0x41, 0x3b, 0x41, 0x30, 0x41, 0x0b, 0x12, 0x0a, 0x12, 0x09, 0x12, 0x08, 0x12, 0x07, 0x12, + 0x0b, 0x4f, 0xb0, 0x12, 0x00, 0x00, 0x47, 0x4f, 0x0f, 0x4b, 0xb0, 0x12, 0x00, 0x00, 0x09, 0x4f, + 0x0f, 0x4b, 0xb0, 0x12, 0x00, 0x00, 0x08, 0x4f, 0x0f, 0x4b, 0xb0, 0x12, 0x00, 0x00, 0x4a, 0x4f, + 0x0f, 0x4b, 0xb0, 0x12, 0x00, 0x00, 0x0e, 0x49, 0x0f, 0x4b, 0xb0, 0x12, 0x00, 0x00, 0x4c, 0x47, + 0x4d, 0x4a, 0x0e, 0x4b, 0x0f, 0x48, 0xb0, 0x12, 0x1e, 0x03, 0x7f, 0xf3, 0x37, 0x41, 0x38, 0x41, + 0x39, 0x41, 0x3a, 0x41, 0x3b, 0x41, 0x30, 0x41, 0x3e, 0x40, 0x1a, 0x03, 0x3f, 0x40, 0x00, 0x00, + 0xb0, 0x12, 0x00, 0x00, 0x30, 0x41, 0x3e, 0x40, 0x00, 0x00, 0x3f, 0x40, 0x00, 0x00, 0xb0, 0x12, + 0x00, 0x00, 0x30, 0x41 + }; + + task void loadCode1() { + call DynamicLoader.loadFromMemory(code1); + } + + task void loadCode2() { + call DynamicLoader.loadFromMemory(code2); + } + + event void DynamicLoader.loadFromMemoryDone(void *addr, tosthread_t id, error_t error) + { + if (addr == code1) { + post loadCode2(); + } + } + + event void Boot.booted() { + post loadCode1(); + } + + event void DynamicLoader.loadFromFlashDone(uint8_t volumeId, tosthread_t id, error_t error) {} +} diff --git a/apps/tosthreads/tinyld/LoadFromRAM/Makefile b/apps/tosthreads/tinyld/LoadFromRAM/Makefile new file mode 100644 index 00000000..97b77fa3 --- /dev/null +++ b/apps/tosthreads/tinyld/LoadFromRAM/Makefile @@ -0,0 +1,17 @@ +COMPONENT=LoadFromRAMAppC + +GOALS += threads + +THREADS_DIR ?= $(TOSDIR)/lib/tosthreads +CFLAGS += -I$(THREADS_DIR)/lib/tinyld +CFLAGS += -I$(THREADS_DIR)/csystem +CFLAGS += -I$(THREADS_DIR)/sensorboards/tmote_onboard +CFLAGS += -I$(THREADS_DIR)/sensorboards/universal +CFLAGS += -I$(THREADS_DIR)/lib/net/ctp +CFLAGS += -I$(THREADS_DIR)/lib/net +CFLAGS += -I$(TOSDIR)/lib/net +CFLAGS += -I$(TOSDIR)/lib/net/ctp +CFLAGS += -I$(TOSDIR)/lib/net/4bitle +CFLAGS += -I$(THREADS_DIR)/lib/printf + +include $(MAKERULES) diff --git a/apps/tosthreads/tinyld/LoadFromRAM/README b/apps/tosthreads/tinyld/LoadFromRAM/README new file mode 100644 index 00000000..95a32cc5 --- /dev/null +++ b/apps/tosthreads/tinyld/LoadFromRAM/README @@ -0,0 +1,22 @@ +README for LoadFromRAM +Author/Contact: Chieh-Jan Mike Liang + +Description: + +LoadFromRAM is a simple program that dynamically loads two loadable +programs hardcoded in the byte arrays; One program is Blink, and the +other one is Basestation. + +You can install LoadFromRAM on a mote via the following command: + make install + +If you would like to generate your own loadable program run, for example: + cd ../../capps/Blink + make telosb dynthreads + (the output file needed is ../../capps/Blink/build/telosb/dynthreads/main.tos) + +Tools: + None. + +Known bugs/limitations: + None. diff --git a/apps/tosthreads/tinyld/LoadFromRAM/volumes-at45db.xml b/apps/tosthreads/tinyld/LoadFromRAM/volumes-at45db.xml new file mode 100644 index 00000000..26c8665f --- /dev/null +++ b/apps/tosthreads/tinyld/LoadFromRAM/volumes-at45db.xml @@ -0,0 +1,3 @@ + + + diff --git a/apps/tosthreads/tinyld/LoadFromRAM/volumes-stm25p.xml b/apps/tosthreads/tinyld/LoadFromRAM/volumes-stm25p.xml new file mode 100755 index 00000000..dfc0bd4c --- /dev/null +++ b/apps/tosthreads/tinyld/LoadFromRAM/volumes-stm25p.xml @@ -0,0 +1,3 @@ + + + diff --git a/apps/tosthreads/tinyld/Makefile b/apps/tosthreads/tinyld/Makefile new file mode 100644 index 00000000..90989c70 --- /dev/null +++ b/apps/tosthreads/tinyld/Makefile @@ -0,0 +1,57 @@ +#-*-makefile-*- +###################################################################### +# +# Makes the entire suite of TinyOS applications for a given platform. +# +# Author: Martin Turon +# Date: August 18, 2005 +# +###################################################################### +# $Id$ + +# MAKECMDGOALS is the way to get the arguments passed into a Makefile ... +TARGET=$(MAKECMDGOALS) +NESDOC_TARGET=$(filter-out nesdoc,$(TARGET)) + +# Here is a way to get the list of subdirectories in a Makefile ... +ROOT=. +SUBDIRS := $(shell find * -type d) + +# Okay, match any target, and recurse the subdirectories +%: + @for i in $(SUBDIRS); do \ + HERE=$$PWD; \ + if [ -f $$i/Makefile ]; then \ + echo Building ... $(PWD)/$$i; \ + echo make $(TARGET); \ + cd $$i; \ + $(MAKE) $(TARGET); \ + cd $$HERE; \ + fi; \ + done + +threads: + @: +cthreads: + @: +dynthreads: + @: + +BASEDIR = $(shell pwd | sed 's@\(.*\)/apps.*$$@\1@' ) +# The output directory for generated documentation +DOCDIR = $(BASEDIR)/doc/nesdoc + +nesdoc: + @echo This target rebuilds documentation for all known platforms. + @echo It DOES NOT overwrite any existing documentation, thus, it + @echo is best run after deleting all old documentation. + @echo + @echo To delete all old documentation, delete the contents of the + @echo $(DOCDIR) directory. + @echo + @echo Press Enter to continue, or ^C to abort. + @read + for platform in `ncc -print-platforms`; do \ + $(MAKE) $$platform docs.nohtml.preserve; \ + nesdoc -o $(DOCDIR) -html -target=$$platform; \ + done diff --git a/apps/tosthreads/tinyld/SerialLoader/Makefile b/apps/tosthreads/tinyld/SerialLoader/Makefile new file mode 100755 index 00000000..92bfa550 --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoader/Makefile @@ -0,0 +1,25 @@ +COMPONENT=SerialLoaderAppC + +GOALS += threads + +THREADS_DIR ?= $(TOSDIR)/lib/tosthreads +CFLAGS += -I$(THREADS_DIR)/lib/tinyld +CFLAGS += -I$(THREADS_DIR)/csystem +CFLAGS += -I$(THREADS_DIR)/sensorboards/tmote_onboard +CFLAGS += -I$(THREADS_DIR)/sensorboards/universal +CFLAGS += -I$(THREADS_DIR)/lib/net/ctp +CFLAGS += -I$(THREADS_DIR)/lib/net +CFLAGS += -I$(TOSDIR)/lib/net +CFLAGS += -I$(TOSDIR)/lib/net/ctp +CFLAGS += -I$(TOSDIR)/lib/net/4bitle +CFLAGS += -I$(THREADS_DIR)/lib/printf + +ifdef TENET + CFLAGS += -DTOSTHREAD_TENET=1 +endif +CFLAGS += -DDISABLE_LOADER_FLASH=1 +CFLAGS += -DDISABLE_LOADER_USERBUTTON=1 + +CLEAN_EXTRA += *.pyc + +include $(MAKERULES) diff --git a/apps/tosthreads/tinyld/SerialLoader/README b/apps/tosthreads/tinyld/SerialLoader/README new file mode 100644 index 00000000..7cd3c047 --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoader/README @@ -0,0 +1,33 @@ +README for SerialLoader +Author/Contact: Chieh-Jan Mike Liang + +Description: + +SerialLoader receives loadable programs from the serial port and stores +it in a byte array. Then, when it receives the command to load the code, +it makes the call to the dynamic loader. + +Here are the steps: +1.) Load SerialLoader: + make telosb install bsl, + +2.) Create the loadable code, main.tos: + cd ../../capps/Blink + make telosb dynthreads + (the output file needed is ../../capps/Blink/build/telosb/dynthreads/main.tos) + +3.) Clear the byte array in the mote RAM buffer: + ./serialloader.py 0 + +4.) Upload the binary: + ./serialloader.py 1 main.tos + +5.) Run the binary: + ./serialloader.py 7 + +Tools: + None. + +Known bugs/limitations: + None. + diff --git a/apps/tosthreads/tinyld/SerialLoader/SerialLoader.h b/apps/tosthreads/tinyld/SerialLoader/SerialLoader.h new file mode 100755 index 00000000..d3ff65a4 --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoader/SerialLoader.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2008 Johns Hopkins University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written + * agreement is hereby granted, provided that the above copyright + * notice, the (updated) modification history and the author appear in + * all copies of this source code. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, + * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * @author Chieh-Jan Mike Liang + */ + +#ifndef SERIALLOADER_H +#define SERIALLOADER_H + +#define MAX_BIN_SIZE 2000 + +#define SERIALMSG_ERASE 0 +#define SERIALMSG_WRITE 1 +#define SERIALMSG_READ 2 +#define SERIALMSG_CRC 3 +#define SERIALMSG_LEDS 5 +#define SERIALMSG_RUN 7 + +typedef nx_struct SerialReqPacket { + nx_uint8_t msg_type; + nx_uint8_t pad; + nx_uint16_t offset; + nx_uint16_t len; + nx_uint8_t data[0]; +} SerialReqPacket; + +#define SERIALMSG_SUCCESS 0 +#define SERIALMSG_FAIL 1 + +typedef nx_struct SerialReplyPacket { + nx_uint8_t error; + nx_uint8_t pad; + nx_uint8_t data[0]; +} SerialReplyPacket; + +#endif diff --git a/apps/tosthreads/tinyld/SerialLoader/SerialLoaderAppC.nc b/apps/tosthreads/tinyld/SerialLoader/SerialLoaderAppC.nc new file mode 100755 index 00000000..d9e49465 --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoader/SerialLoaderAppC.nc @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2008 Johns Hopkins University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written + * agreement is hereby granted, provided that the above copyright + * notice, the (updated) modification history and the author appear in + * all copies of this source code. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, + * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * SerialLoader receives loadable programs from the serial port and stores + * it in a byte array. Then, when it receives the command to load the code, + * it makes the call to the dynamic loader. + * + * @author Chieh-Jan Mike Liang + * @author Jeongyeup Paek + */ + +#include "AM.h" +#include "SerialLoader.h" + +configuration SerialLoaderAppC {} +implementation +{ + components MainC, + SerialActiveMessageC, + new SerialAMSenderC(0xAB), + new SerialAMReceiverC(0xAB), + SerialLoaderP, + BigCrcC, + LedsC; + + SerialLoaderP.Boot -> MainC; + SerialLoaderP.SerialSplitControl -> SerialActiveMessageC; + SerialLoaderP.SerialAMSender -> SerialAMSenderC; + SerialLoaderP.SerialAMReceiver -> SerialAMReceiverC; + SerialLoaderP.Leds -> LedsC; + SerialLoaderP.BigCrc -> BigCrcC; + + components DynamicLoaderC; + SerialLoaderP.DynamicLoader -> DynamicLoaderC; +} + diff --git a/apps/tosthreads/tinyld/SerialLoader/SerialLoaderP.nc b/apps/tosthreads/tinyld/SerialLoader/SerialLoaderP.nc new file mode 100755 index 00000000..b66e2ef0 --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoader/SerialLoaderP.nc @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2008 Johns Hopkins University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written + * agreement is hereby granted, provided that the above copyright + * notice, the (updated) modification history and the author appear in + * all copies of this source code. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, + * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * SerialLoader receives loadable programs from the serial port and stores + * it in a byte array. Then, when it receives the command to load the code, + * it makes the call to the dynamic loader. + * + * @author Chieh-Jan Mike Liang + * @author Jeongyeup Paek + **/ + +#include "SerialLoader.h" + +module SerialLoaderP +{ + uses { + interface Boot; + interface SplitControl as SerialSplitControl; + interface AMSend as SerialAMSender; + interface Receive as SerialAMReceiver; + interface Leds; + interface DynamicLoader; + interface BigCrc; + } +} +implementation +{ + message_t serialMsg; + uint32_t dumpAddr = 0; + + uint8_t image[MAX_BIN_SIZE]; + + event void Boot.booted() + { + call SerialSplitControl.start(); + } + + event void SerialSplitControl.startDone(error_t error) + { + if (error != SUCCESS) { + call SerialSplitControl.start(); + } + } + + event void SerialSplitControl.stopDone(error_t error) {} + + void sendReply(error_t error, uint8_t len) + { + SerialReplyPacket *srpkt = (SerialReplyPacket *)call SerialAMSender.getPayload(&serialMsg, sizeof(SerialReplyPacket)); + if (error == SUCCESS) { + srpkt->error = SERIALMSG_SUCCESS; + } else { + srpkt->error = SERIALMSG_FAIL; + } + call SerialAMSender.send(AM_BROADCAST_ADDR, &serialMsg, len); + } + + + event void SerialAMSender.sendDone(message_t* msg, error_t error) {} + + error_t write_image(uint16_t offset, void *data, uint16_t len) { + if ((offset + len > MAX_BIN_SIZE) || (data == NULL)) + return FAIL; + memcpy(&image[offset], data, len); + return SUCCESS; + } + + error_t read_image(uint16_t offset, void *readbuf, uint16_t len) { + if ((offset + len > MAX_BIN_SIZE) || (readbuf == NULL)) + return FAIL; + memcpy(readbuf, &image[offset], len); + return SUCCESS; + } + + event void DynamicLoader.loadFromFlashDone(uint8_t volumeId, tosthread_t id, error_t error) {} + event void DynamicLoader.loadFromMemoryDone(void *addr, tosthread_t id, error_t error) { + sendReply(error, sizeof(SerialReplyPacket)); + } + + event void BigCrc.computeCrcDone(void* buf, uint16_t len, uint16_t crc, error_t error) + { + SerialReplyPacket *srpkt = (SerialReplyPacket *)call SerialAMSender.getPayload(&serialMsg, sizeof(SerialReplyPacket)); + + srpkt->data[1] = crc & 0xFF; + srpkt->data[0] = (crc >> 8) & 0xFF; + sendReply(SUCCESS, 2 + sizeof(SerialReplyPacket)); + } + + void sendCrcReply(uint16_t offset, uint16_t len) + { + call BigCrc.computeCrc(&(image[offset]), len); + } + + + event message_t* SerialAMReceiver.receive(message_t* msg, void* payload, uint8_t len) + { + uint16_t i; + error_t error = FAIL; + SerialReqPacket *srpkt = (SerialReqPacket *)payload; + SerialReplyPacket *serialMsg_payload = (SerialReplyPacket *)call SerialAMSender.getPayload(&serialMsg, sizeof(SerialReplyPacket)); + + switch (srpkt->msg_type) { + case SERIALMSG_ERASE : + for (i = 0; i < MAX_BIN_SIZE; i++) { image[i] = 0; } + call Leds.set(7); + for (i = 0; i < 2000; i++) {} + call Leds.set(0); + sendReply(SUCCESS, sizeof(SerialReplyPacket)); + break; + case SERIALMSG_RUN : + error = call DynamicLoader.loadFromMemory(image); + if (error != SUCCESS) + sendReply(error, sizeof(SerialReplyPacket)); + break; + case SERIALMSG_WRITE : + error = write_image(srpkt->offset, srpkt->data, srpkt->len); + if (error != SUCCESS) + call Leds.led0On(); + sendReply(error, sizeof(SerialReplyPacket)); + break; + case SERIALMSG_READ : + error = read_image(srpkt->offset, serialMsg_payload->data, srpkt->len); + if (error != SUCCESS) + sendReply(error, sizeof(SerialReplyPacket)); + else + sendReply(error, len + sizeof(SerialReplyPacket)); + break; + case SERIALMSG_LEDS: + call Leds.set(7); + for (i = 0; i < 2000; i++) {} + call Leds.set(0); + break; + case SERIALMSG_CRC : + sendCrcReply(srpkt->offset, srpkt->len); + break; + } + + return msg; + } +} + diff --git a/apps/tosthreads/tinyld/SerialLoader/serialloader.py b/apps/tosthreads/tinyld/SerialLoader/serialloader.py new file mode 100755 index 00000000..f7964dd7 --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoader/serialloader.py @@ -0,0 +1,232 @@ +#!/usr/bin/env python + +# Copyright (c) 2008 Johns Hopkins University. +# All rights reserved. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose, without fee, and without written +# agreement is hereby granted, provided that the above copyright +# notice, the (updated) modification history and the author appear in +# all copies of this source code. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, +# OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +# @author Chieh-Jan Mike Liang + +import sys, os, stat, struct +import tinyos + +SERIAL_BAUDRATE = 57600 +SERIALMSG_AMGROUP = 0 +SERIALMSG_AMID = 0xAB + +SERIALMSG_ERASE = 0 +SERIALMSG_WRITE = 1 +SERIALMSG_READ = 2 +SERIALMSG_CRC = 3 +SERIALMSG_LEDS = 5 +SERIALMSG_RUN = 7 + +SERIALMSG_SUCCESS = 0 +SERIALMSG_FAIL = 1 + +SERIALMSG_DATA_PAYLOAD_SIZE = 20 +MAX_BIN_SIZE = 2000 + +HEX_OUTPUT_LINE_SIZE = 16 + +class SerialReqPacket(tinyos.GenericPacket): + def __init__(self, packet = None): + tinyos.GenericPacket.__init__(self, + [('msg_type', 'int', 1), + ('pad', 'int', 1), + ('offset', 'int', 2), + ('len', 'int', 2), + ('data', 'blob', None)], + packet) + +class SerialReplyPacket(tinyos.GenericPacket): + def __init__(self, packet = None): + tinyos.GenericPacket.__init__(self, + [('error', 'int', 1), + ('pad', 'int', 1), + ('data', 'blob', None)], + packet) + +# Display an integer representation of byte stream to hex representation +def print_hex(start_addr, byte_stream): + byte_stream = ["%02x" % one_byte for one_byte in byte_stream] # Converts to each byte to hex + + num_iterations = int( (len(byte_stream) - 1) / HEX_OUTPUT_LINE_SIZE ) + num_iterations += 1 + + for i in range(num_iterations): + line = "%07x" % start_addr + " " # Prints memory address + for j in range(HEX_OUTPUT_LINE_SIZE): + if (i * HEX_OUTPUT_LINE_SIZE + j) < len(byte_stream): + line += byte_stream[i * HEX_OUTPUT_LINE_SIZE + j] + " " + print line + + start_addr += HEX_OUTPUT_LINE_SIZE + +def op_run(s, sreqpkt): + success = s.write_packet(SERIALMSG_AMGROUP, SERIALMSG_AMID, sreqpkt.payload()) + if success == True: + packet = s.read_packet() + sreplypkt = SerialReplyPacket(packet[1]) + return (sreplypkt.error == SERIALMSG_SUCCESS) + +def op_erase(s, sreqpkt): + success = s.write_packet(SERIALMSG_AMGROUP, SERIALMSG_AMID, sreqpkt.payload()) + if success == True: + packet = s.read_packet() + sreplypkt = SerialReplyPacket(packet[1]) + return (sreplypkt.error == SERIALMSG_SUCCESS) + +def op_print(s, sreqpkt, offset, length): + if (offset + length) <= DELUGE_VOLUME_SIZE: + while length > 0: + sreqpkt.offset = offset + # Calculates the payload size for the reply packet + if length >= HEX_OUTPUT_LINE_SIZE: + sreqpkt.len = HEX_OUTPUT_LINE_SIZE + else: + sreqpkt.len = length + + success = s.write_packet(SERIALMSG_AMGROUP, SERIALMSG_AMID, sreqpkt.payload()) + if success == True: + packet = s.read_packet() + sreplypkt = SerialReplyPacket(packet[1]) + if sreplypkt.error != SERIALMSG_SUCCESS: + return False + + print_hex(offset, sreplypkt.data) + length -= sreqpkt.len + offset += sreqpkt.len + else: + print "ERROR: Specified offset and length are too large for the flash volume" + return False + + return True + +def op_write(s, sreqpkt, input_file, length): + local_crc = 0 + input_file_size = length + + sreqpkt.offset = 0 + while length > 0: + # Calculates the payload size for the current packet + if length >= SERIALMSG_DATA_PAYLOAD_SIZE: + sreqpkt.len = SERIALMSG_DATA_PAYLOAD_SIZE + else: + sreqpkt.len = length + sreqpkt.data = [] + + # Reads in the file we want to transmit + for i in range(sreqpkt.len): + sreqpkt.data.append(struct.unpack("B", input_file.read(1))[0]) + + # Sends over serial to the mote + if s.write_packet(SERIALMSG_AMGROUP, SERIALMSG_AMID, sreqpkt.payload()) == True: + # Waiting for confirmation + packet = s.read_packet() + sreplypkt = SerialReplyPacket(packet[1]) + if sreplypkt.error != SERIALMSG_SUCCESS: + print "ERROR: !SUCCESS" + return False + local_crc = s.crc16(local_crc, sreqpkt.data) # Computes running CRC + else: + print "ERROR: Unable to write to flash" + return False + + length -= sreqpkt.len + sreqpkt.offset += sreqpkt.len + + # Check local and remote CRC + sreqpkt.msg_type = SERIALMSG_CRC + remote_crc = op_crc(s, sreqpkt, 0, input_file_size) + if remote_crc != None: + local_crc = [(local_crc >> 8) & 0xFF, local_crc & 0xFF] + print "Local CRC: " + ("%02x" % local_crc[0]) + " " + ("%02x" % local_crc[1]) + print "Remote CRC: " + ("%02x" % remote_crc[0]) + " " + ("%02x" % remote_crc[1]) + if remote_crc != local_crc: + print "ERROR: Remote CRC doesn't match local CRC" + return False + else: + print "ERROR: Unable to verify CRC" + return False + + return True + +def op_crc(s, sreqpkt, offset, length): + sreqpkt.offset = offset + sreqpkt.len = length + success = s.write_packet(SERIALMSG_AMGROUP, SERIALMSG_AMID, sreqpkt.payload()) + if success == True: + packet = s.read_packet() + sreplypkt = SerialReplyPacket(packet[1]) + if sreplypkt.error == SERIALMSG_SUCCESS: + return sreplypkt.data + else: + return None + +def op_leds(s, sreqpkt): + success = s.write_packet(SERIALMSG_AMGROUP, SERIALMSG_AMID, sreqpkt.payload()) + +# ======== MAIN ======== # +if len(sys.argv) >= 3: + sys.argv[2] = int(sys.argv[2]) + + s = tinyos.Serial(sys.argv[1], SERIAL_BAUDRATE) + s.set_debug(False) # Disables debug msg + sreqpkt = SerialReqPacket((sys.argv[2], 0, 0, 0, [])) # msg_type, pad, offset, length, data + + if sys.argv[2] == SERIALMSG_RUN: + if op_run(s, sreqpkt) == True: + print "Loaded image should be running now!" + else: + print "ERROR: Unable to run loaded image" + + elif sys.argv[2] == SERIALMSG_ERASE: + if op_erase(s, sreqpkt) == True: + print "Flash volume has been erased" + else: + print "ERROR: Unable to erase flash volume" + + elif sys.argv[2] == SERIALMSG_WRITE: + input_file = file(sys.argv[3], 'rb') + fileStats = os.stat(sys.argv[3]) + + if fileStats[stat.ST_SIZE] <= MAX_BIN_SIZE: + #sreqpkt = SerialReqPacket((SERIALMSG_LEDS, 0, 0, 0, [])) + #op_leds(s, sreqpkt) + sreqpkt = SerialReqPacket((sys.argv[2], 0, 0, 0, [])) + if op_write(s, sreqpkt, input_file, fileStats[stat.ST_SIZE]) == True: + print "File has been successfully transmitted (" + str(fileStats[stat.ST_SIZE]) + " bytes)" + else: + print "ERROR: Unable to transmit file" + sreqpkt = SerialReqPacket((SERIALMSG_LEDS, 0, 0, 0, [])) + op_leds(s, sreqpkt) + else: + print "ERROR: File is larger than max buffer size (" + str(MAX_BIN_SIZE) + ")" + + elif sys.argv[2] == SERIALMSG_READ: + data = op_print(s, sreqpkt, int(sys.argv[3]), int(sys.argv[4])) + if data != True: + print "ERROR: Unable to read the specified range" + + elif sys.argv[2] == SERIALMSG_CRC: + remote_crc = op_crc(s, sreqpkt, int(sys.argv[3]), int(sys.argv[4])) + if remote_crc != None: + print_hex(0, remote_crc) + else: + print "ERROR: Unable to compute remote CRC" diff --git a/apps/tosthreads/tinyld/SerialLoader/tinyos.py b/apps/tosthreads/tinyld/SerialLoader/tinyos.py new file mode 100755 index 00000000..e922f58c --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoader/tinyos.py @@ -0,0 +1,223 @@ +import struct, time, serial + +class Serial: + HDLC_FLAG_BYTE = 0x7e + HDLC_CTLESC_BYTE = 0x7d + + TOS_SERIAL_ACTIVE_MESSAGE_ID = 0 + TOS_SERIAL_CC1000_ID = 1 + TOS_SERIAL_802_15_4_ID = 2 + TOS_SERIAL_UNKNOWN_ID = 255 + + SERIAL_PROTO_ACK = 67 + SERIAL_PROTO_PACKET_ACK = 68 + SERIAL_PROTO_PACKET_NOACK = 69 + SERIAL_PROTO_PACKET_UNKNOWN = 255 + + __s = None; # An instance of serial.Serial object + __debug = True # Debug mode + + def __init__(self, port, baudrate): + self.__s = serial.Serial(port, baudrate, rtscts=0) + + def __format_packet(self, packet): + return " ".join(["%02x" % p for p in packet]) + " | " + \ + " ".join(["%d" % p for p in packet]) + + def crc16(self, base_crc, frame_data): + crc = base_crc + for b in frame_data: + crc = crc ^ (b << 8) + for i in range(0, 8): + if crc & 0x8000 == 0x8000: + crc = (crc << 1) ^ 0x1021 + else: + crc = crc << 1 + crc = crc & 0xffff + return crc + + def __encode(self, val, dim): + output = [] + for i in range(dim): + output.append(val & 0xFF) + val = val >> 8 + return output + + def __decode(self, v): + r = long(0) + for i in v[::-1]: + r = (r << 8) + i + return r + + def __get_byte(self): + r = struct.unpack("B", self.__s.read())[0] + return r + + def __put_bytes(self, data): + for b in data: + self.__s.write(struct.pack('B', b)) + + def __unescape(self, packet): + r = [] + esc = False + for b in packet: + if esc: + r.append(b ^ 0x20) + esc = False + elif b == self.HDLC_CTLESC_BYTE: + esc = True + else: + r.append(b) + return r + + def __escape(self, packet): + r = [] + for b in packet: + if b == self.HDLC_FLAG_BYTE or b == self.HDLC_CTLESC_BYTE: + r.append(self.HDLC_CTLESC_BYTE) + r.append(b ^ 0x20) + else: + r.append(b) + return r + + def read_packet(self): + d = self.__get_byte() + ts = time.time() + while d != self.HDLC_FLAG_BYTE: + d = self.__get_byte() + ts = time.time() + packet = [d] + d = self.__get_byte() + if d == self.HDLC_FLAG_BYTE: + d = self.__get_byte() + ts = time.time() + else: + packet.append(d) + while d != self.HDLC_FLAG_BYTE: + d = self.__get_byte() + packet.append(d) + un_packet = self.__unescape(packet) + crc = self.crc16(0, un_packet[1:-3]) + packet_crc = self.__decode(un_packet[-3:-1]) + if crc != packet_crc: + print "Warning: wrong CRC!" + if self.__debug == True: + print "Recv:", self.__format_packet(un_packet) + return (ts, un_packet) + + def write_packet(self, am_group, am_id, data): + # The first byte after SERIAL_PROTO_PACKET_ACK is a sequence + # number that will be send back by the mote to ack the receive of + # the data. + packet = [self.SERIAL_PROTO_PACKET_ACK, 0, self.TOS_SERIAL_ACTIVE_MESSAGE_ID, + 0xff, 0xff, + 0, 0, + len(data), am_group, am_id] + data; + crc = self.crc16(0, packet) + packet.append(crc & 0xff) + packet.append((crc >> 8) & 0xff) + packet = [self.HDLC_FLAG_BYTE] + self.__escape(packet) + [self.HDLC_FLAG_BYTE] + if self.__debug == True: + print "Send:", self.__format_packet(packet) + self.__put_bytes(packet) + + # Waiting for ACK + packet = self.read_packet() + if len(packet) > 1 and len(packet[1]) > 1: + return ((packet[1])[1] == self.SERIAL_PROTO_ACK) + return False + + def set_debug(self, debug): + self.__debug = debug + +class GenericPacket: + """ GenericPacket """ + + def __decode(self, v): + r = long(0) + for i in v: + r = (r << 8) + i + return r + + def __encode(self, val, dim): + output = [] + for i in range(dim): + output.append(int(val & 0xFF)) + val = val >> 8 + output.reverse() + return output + + def __init__(self, desc, packet = None): + self.__dict__['_schema'] = [(t, s) for (n, t, s) in desc] + self.__dict__['_names'] = [n for (n, t, s) in desc] + self.__dict__['_values'] = [] + offset = 10 + if type(packet) == type([]): + for (t, s) in self._schema: + if t == 'int': + self._values.append(self.__decode(packet[offset:offset + s])) + offset += s + elif t == 'blob': + if s: + self._values.append(packet[offset:offset + s]) + offset += s + else: + self._values.append(packet[offset:-3]) + elif type(packet) == type(()): + for i in packet: + self._values.append(i) + else: + for v in self._schema: + self._values.append(None) + + def __repr__(self): + return self._values.__repr__() + + def __str__(self): + return self._values.__str__() + + # Implement the map behavior + def __getitem__(self, key): + return self.__getattr__(key) + + def __setitem__(self, key, value): + self.__setattr__(key, value) + + def __len__(self): + return len(self._values) + + def keys(self): + return self._names + + def values(self): + return self._names + + # Implement the struct behavior + def __getattr__(self, name): + if type(name) == type(0): + return self._names[name] + else: + return self._values[self._names.index(name)] + + def __setattr__(self, name, value): + if type(name) == type(0): + self._values[name] = value + else: + self._values[self._names.index(name)] = value + + # Custom + def names(self): + return self._names + + def sizes(self): + return self._schema + + def payload(self): + r = [] + for i in range(len(self._schema)): + (t, s) = self._schema[i] + if t == 'int': + r += self.__encode(self._values[i], s) + else: + r += self._values[i] + return r diff --git a/apps/tosthreads/tinyld/SerialLoaderFlash/FlashVolumeManager.h b/apps/tosthreads/tinyld/SerialLoaderFlash/FlashVolumeManager.h new file mode 100755 index 00000000..8b2b5e3b --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoaderFlash/FlashVolumeManager.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2008 Johns Hopkins University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written + * agreement is hereby granted, provided that the above copyright + * notice, the (updated) modification history and the author appear in + * all copies of this source code. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, + * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * @author Chieh-Jan Mike Liang + */ + +#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_LEDS 5 +#define SERIALMSG_RUN 7 + +typedef nx_struct SerialReqPacket { + nx_uint8_t msg_type; + nx_uint8_t pad; + nx_uint16_t offset; + nx_uint16_t len; + nx_uint8_t data[0]; +} SerialReqPacket; + +#define SERIALMSG_SUCCESS 0 +#define SERIALMSG_FAIL 1 + +typedef nx_struct SerialReplyPacket { + nx_uint8_t error; + nx_uint8_t pad; + nx_uint8_t data[0]; +} SerialReplyPacket; + +#endif diff --git a/apps/tosthreads/tinyld/SerialLoaderFlash/FlashVolumeManagerC.nc b/apps/tosthreads/tinyld/SerialLoaderFlash/FlashVolumeManagerC.nc new file mode 100755 index 00000000..bb9440f8 --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoaderFlash/FlashVolumeManagerC.nc @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2008 Johns Hopkins University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written + * agreement is hereby granted, provided that the above copyright + * notice, the (updated) modification history and the author appear in + * all copies of this source code. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, + * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * SerialLoaderFlash is similar to SerialLoader in that it receives + * loadable programs from the serial port. However, SerialLoaderFlash + * stores them on the external flash. Then, when it receives the command to + * load the code, it makes the call to the dynamic loader. + * + * @author Chieh-Jan Mike Liang + */ + +#include "AM.h" + +generic configuration FlashVolumeManagerC(am_id_t AMId) +{ + uses { + interface BlockRead; + interface BlockWrite; + interface DynamicLoader; + } +} + +implementation +{ + components MainC, + SerialActiveMessageC, + new SerialAMSenderC(AMId), + new SerialAMReceiverC(AMId), + new FlashVolumeManagerP(), + NoLedsC, LedsC; + + DynamicLoader = FlashVolumeManagerP; + BlockRead = FlashVolumeManagerP; + BlockWrite = FlashVolumeManagerP; + + FlashVolumeManagerP.Boot -> MainC; + FlashVolumeManagerP.SerialSplitControl -> SerialActiveMessageC; + + FlashVolumeManagerP.SerialAMSender -> SerialAMSenderC; + FlashVolumeManagerP.SerialAMReceiver -> SerialAMReceiverC; + FlashVolumeManagerP.Leds -> LedsC; +} diff --git a/apps/tosthreads/tinyld/SerialLoaderFlash/FlashVolumeManagerP.nc b/apps/tosthreads/tinyld/SerialLoaderFlash/FlashVolumeManagerP.nc new file mode 100755 index 00000000..b28855da --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoaderFlash/FlashVolumeManagerP.nc @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2008 Johns Hopkins University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written + * agreement is hereby granted, provided that the above copyright + * notice, the (updated) modification history and the author appear in + * all copies of this source code. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, + * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * SerialLoaderFlash is similar to SerialLoader in that it receives + * loadable programs from the serial port. However, SerialLoaderFlash + * stores them on the external flash. Then, when it receives the command to + * load the code, it makes the call to the dynamic loader. + * + * @author Chieh-Jan Mike Liang + */ + +#include "FlashVolumeManager.h" +#include "StorageVolumes.h" + +generic module FlashVolumeManagerP() +{ + uses { + interface Boot; + interface SplitControl as SerialSplitControl; + interface BlockRead; + interface BlockWrite; + interface AMSend as SerialAMSender; + interface Receive as SerialAMReceiver; + interface Leds; + interface DynamicLoader; + } +} + +implementation +{ + message_t serialMsg; + storage_addr_t dumpAddr = 0; + + event void Boot.booted() { + while (call SerialSplitControl.start() != SUCCESS); + } + + event void SerialSplitControl.startDone(error_t error) + { + if (error != SUCCESS) { + while (call SerialSplitControl.start() != SUCCESS); + } + } + + void sendReply(error_t error, storage_len_t len) + { + SerialReplyPacket *srpkt = (SerialReplyPacket *)call SerialAMSender.getPayload(&serialMsg, sizeof(SerialReplyPacket)); + if (error == SUCCESS) { + srpkt->error = SERIALMSG_SUCCESS; + } else { + srpkt->error = SERIALMSG_FAIL; + } + call SerialAMSender.send(AM_BROADCAST_ADDR, &serialMsg, len); + } + + event void BlockRead.readDone(storage_addr_t addr, void* buf, storage_len_t len, error_t error) { + sendReply(error, len + sizeof(SerialReplyPacket)); + } + + event void BlockRead.computeCrcDone(storage_addr_t addr, storage_len_t len, uint16_t crc, error_t error) + { + if (error == SUCCESS) { + SerialReplyPacket *srpkt = (SerialReplyPacket *)call SerialAMSender.getPayload(&serialMsg, sizeof(SerialReplyPacket)); + srpkt->data[1] = crc & 0xFF; + srpkt->data[0] = (crc >> 8) & 0xFF; + } + sendReply(error, 2 + sizeof(SerialReplyPacket)); + } + + event void BlockWrite.writeDone(storage_addr_t addr, void* buf, storage_len_t len, error_t error) + { + if (error != SUCCESS) { + call Leds.led1On(); + } + sendReply(error, sizeof(SerialReplyPacket)); + } + + event void BlockWrite.eraseDone(error_t error) { + sendReply(error, sizeof(SerialReplyPacket)); + } + + event message_t* SerialAMReceiver.receive(message_t* msg, void* payload, uint8_t len) + { + uint16_t i; + error_t error = SUCCESS; + SerialReqPacket *srpkt = (SerialReqPacket *)payload; + SerialReplyPacket *serialMsg_payload = (SerialReplyPacket *)call SerialAMSender.getPayload(&serialMsg, sizeof(SerialReplyPacket)); + + switch (srpkt->msg_type) { + case SERIALMSG_ERASE : + error = call BlockWrite.erase(); + if (error != SUCCESS) { + sendReply(error, sizeof(SerialReplyPacket)); + } + break; + case SERIALMSG_WRITE : + call Leds.led2On(); + error = call BlockWrite.write(srpkt->offset, srpkt->data, srpkt->len); + if (error != SUCCESS) { + sendReply(error, sizeof(SerialReplyPacket)); + call Leds.led0On(); + } + break; + case SERIALMSG_READ : + error = call BlockRead.read(srpkt->offset, serialMsg_payload->data, srpkt->len); + if (error != SUCCESS) { + sendReply(error, sizeof(SerialReplyPacket)); + } + break; + case SERIALMSG_CRC : + error = call BlockRead.computeCrc(srpkt->offset, srpkt->len, 0); + if (error != SUCCESS) { + sendReply(error, sizeof(SerialReplyPacket)); + } + break; + case SERIALMSG_LEDS: + call Leds.set(7); + for (i = 0; i < 2000; i++) {} + call Leds.set(0); + break; + case SERIALMSG_RUN : + error = call DynamicLoader.loadFromFlash(VOLUME_MICROEXEIMAGE); + if (error != SUCCESS) + sendReply(error, sizeof(SerialReplyPacket)); + break; + } + + return msg; + } + + event void DynamicLoader.loadFromFlashDone(uint8_t volumeId, tosthread_t id, error_t error) { + sendReply(error, sizeof(SerialReplyPacket)); + } + + event void DynamicLoader.loadFromMemoryDone(void *addr, tosthread_t id, error_t error) {} + event void BlockWrite.syncDone(error_t error) {} + event void SerialAMSender.sendDone(message_t* msg, error_t error) {} + event void SerialSplitControl.stopDone(error_t error) {} +} diff --git a/apps/tosthreads/tinyld/SerialLoaderFlash/Makefile b/apps/tosthreads/tinyld/SerialLoaderFlash/Makefile new file mode 100755 index 00000000..83d3dbeb --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoaderFlash/Makefile @@ -0,0 +1,22 @@ +COMPONENT=SerialLoaderFlashAppC + +GOALS += threads + +THREADS_DIR ?= $(TOSDIR)/lib/tosthreads +CFLAGS += -I$(THREADS_DIR)/lib/tinyld +CFLAGS += -I$(THREADS_DIR)/csystem +CFLAGS += -I$(THREADS_DIR)/sensorboards/tmote_onboard +CFLAGS += -I$(THREADS_DIR)/sensorboards/universal +CFLAGS += -I$(THREADS_DIR)/lib/net/ctp +CFLAGS += -I$(THREADS_DIR)/lib/net +CFLAGS += -I$(TOSDIR)/lib/net +CFLAGS += -I$(TOSDIR)/lib/net/ctp +CFLAGS += -I$(TOSDIR)/lib/net/4bitle +CFLAGS += -I$(THREADS_DIR)/lib/printf + +# Creates VolumeMapC.nc +VOLUME_ALLOCATOR_FLAGS += -t + +CLEAN_EXTRA += *.pyc + +include $(MAKERULES) diff --git a/apps/tosthreads/tinyld/SerialLoaderFlash/README b/apps/tosthreads/tinyld/SerialLoaderFlash/README new file mode 100755 index 00000000..cbeaf477 --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoaderFlash/README @@ -0,0 +1,34 @@ +README for SerialLoaderFlash +Author/Contact: Chieh-Jan Mike Liang + +Description: + +SerialLoaderFlash is similar to SerialLoader in that it receives +loadable programs from the serial port. However, SerialLoaderFlash +stores them on the external flash. Then, when it receives the command to +load the code, it makes the call to the dynamic loader. + +Here are the steps: +1.) Load SerialLoader: + make telosb install bsl, + +2.) Create the loadable code, main.tos: + cd ../../capps/Blink + make telosb dynthreads + (the output file needed is ../../capps/Blink/build/telosb/dynthreads/main.tos) + +3.) Erase the external flash: + ./serialloader.py 0 + +4.) Upload the binary: + ./serialloader.py 1 main.tos + +5.) Run the binary: + ./serialloader.py 7 + +Tools: + None. + +Known bugs/limitations: + None. + diff --git a/apps/tosthreads/tinyld/SerialLoaderFlash/SerialLoaderFlashAppC.nc b/apps/tosthreads/tinyld/SerialLoaderFlash/SerialLoaderFlashAppC.nc new file mode 100755 index 00000000..e650d1f0 --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoaderFlash/SerialLoaderFlashAppC.nc @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2008 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * SerialLoaderFlash is similar to SerialLoader in that it receives + * loadable programs from the serial port. However, SerialLoaderFlash + * stores them on the external flash. Then, when it receives the command to + * load the code, it makes the call to the dynamic loader. + * + * @author Kevin Klues (klueska@cs.stanford.edu) + * @author Chieh-Jan Mike Liang + */ + +#include "StorageVolumes.h" + +configuration SerialLoaderFlashAppC {} + +implementation { + components DynamicLoaderC, + new FlashVolumeManagerC(0xAB), + new BlockStorageC(VOLUME_MICROEXEIMAGE) as ImageVolume; + + FlashVolumeManagerC.BlockRead -> ImageVolume; + FlashVolumeManagerC.BlockWrite -> ImageVolume; + FlashVolumeManagerC.DynamicLoader -> DynamicLoaderC; +} diff --git a/apps/tosthreads/tinyld/SerialLoaderFlash/serialloader.py b/apps/tosthreads/tinyld/SerialLoaderFlash/serialloader.py new file mode 100755 index 00000000..686bf95b --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoaderFlash/serialloader.py @@ -0,0 +1,229 @@ +#!/usr/bin/env python + +# Copyright (c) 2008 Johns Hopkins University. +# All rights reserved. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose, without fee, and without written +# agreement is hereby granted, provided that the above copyright +# notice, the (updated) modification history and the author appear in +# all copies of this source code. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, +# OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +# @author Chieh-Jan Mike Liang + +import sys, os, stat, struct +import tinyos + +SERIALMSG_AMGROUP = 0 +SERIALMSG_AMID = 0xAB + +SERIALMSG_ERASE = 0 +SERIALMSG_WRITE = 1 +SERIALMSG_READ = 2 +SERIALMSG_CRC = 3 +SERIALMSG_LEDS = 5 +SERIALMSG_RUN = 7 + +SERIALMSG_SUCCESS = 0 +SERIALMSG_FAIL = 1 + +SERIALMSG_DATA_PAYLOAD_SIZE = 20 +DELUGE_VOLUME_SIZE = 262144 + +HEX_OUTPUT_LINE_SIZE = 16 + +class SerialReqPacket(tinyos.GenericPacket): + def __init__(self, packet = None): + tinyos.GenericPacket.__init__(self, + [('msg_type', 'int', 1), + ('pad', 'int', 1), + ('offset', 'int', 2), + ('len', 'int', 2), + ('data', 'blob', None)], + packet) + +class SerialReplyPacket(tinyos.GenericPacket): + def __init__(self, packet = None): + tinyos.GenericPacket.__init__(self, + [('error', 'int', 1), + ('pad', 'int', 1), + ('data', 'blob', None)], + packet) + +# Display an integer representation of byte stream to hex representation +def print_hex(start_addr, byte_stream): + byte_stream = ["%02x" % one_byte for one_byte in byte_stream] # Converts to each byte to hex + + num_iterations = int( (len(byte_stream) - 1) / HEX_OUTPUT_LINE_SIZE ) + num_iterations += 1 + + for i in range(num_iterations): + line = "%07x" % start_addr + " " # Prints memory address + for j in range(HEX_OUTPUT_LINE_SIZE): + if (i * HEX_OUTPUT_LINE_SIZE + j) < len(byte_stream): + line += byte_stream[i * HEX_OUTPUT_LINE_SIZE + j] + " " + print line + + start_addr += HEX_OUTPUT_LINE_SIZE + +def op_run(s, sreqpkt): + success = s.write_packet(SERIALMSG_AMGROUP, SERIALMSG_AMID, sreqpkt.payload()) + if success == True: + packet = s.read_packet() + sreplypkt = SerialReplyPacket(packet[1]) + return (sreplypkt.error == SERIALMSG_SUCCESS) + +def op_erase(s, sreqpkt): + success = s.write_packet(SERIALMSG_AMGROUP, SERIALMSG_AMID, sreqpkt.payload()) + if success == True: + packet = s.read_packet() + sreplypkt = SerialReplyPacket(packet[1]) + return (sreplypkt.error == SERIALMSG_SUCCESS) + +def op_print(s, sreqpkt, offset, length): + if (offset + length) <= DELUGE_VOLUME_SIZE: + while length > 0: + sreqpkt.offset = offset + # Calculates the payload size for the reply packet + if length >= HEX_OUTPUT_LINE_SIZE: + sreqpkt.len = HEX_OUTPUT_LINE_SIZE + else: + sreqpkt.len = length + + success = s.write_packet(SERIALMSG_AMGROUP, SERIALMSG_AMID, sreqpkt.payload()) + if success == True: + packet = s.read_packet() + sreplypkt = SerialReplyPacket(packet[1]) + if sreplypkt.error != SERIALMSG_SUCCESS: + return False + + print_hex(offset, sreplypkt.data) + length -= sreqpkt.len + offset += sreqpkt.len + else: + print "ERROR: Specified offset and length are too large for the flash volume" + return False + + return True + +def op_write(s, sreqpkt, input_file, length): + local_crc = 0 + input_file_size = length + + sreqpkt.offset = 0 + while length > 0: + # Calculates the payload size for the current packet + if length >= SERIALMSG_DATA_PAYLOAD_SIZE: + sreqpkt.len = SERIALMSG_DATA_PAYLOAD_SIZE + else: + sreqpkt.len = length + sreqpkt.data = [] + + # Reads in the file we want to transmit + for i in range(sreqpkt.len): + sreqpkt.data.append(struct.unpack("B", input_file.read(1))[0]) + + # Sends over serial to the mote + if s.write_packet(SERIALMSG_AMGROUP, SERIALMSG_AMID, sreqpkt.payload()) == True: + # Waiting for confirmation + packet = s.read_packet() + sreplypkt = SerialReplyPacket(packet[1]) + if sreplypkt.error != SERIALMSG_SUCCESS: + return False + local_crc = s.crc16(local_crc, sreqpkt.data) # Computes running CRC + else: + print "ERROR: Unable to write to flash" + return False + + length -= sreqpkt.len + sreqpkt.offset += sreqpkt.len + + # Check local and remote CRC + sreqpkt.msg_type = SERIALMSG_CRC + remote_crc = op_crc(s, sreqpkt, 0, input_file_size) + if remote_crc != None: + local_crc = [(local_crc >> 8) & 0xFF, local_crc & 0xFF] + print "Local CRC: " + ("%02x" % local_crc[0]) + " " + ("%02x" % local_crc[1]) + print "Remote CRC: " + ("%02x" % remote_crc[0]) + " " + ("%02x" % remote_crc[1]) + if remote_crc != local_crc: + print "ERROR: Remote CRC doesn't match local CRC" + return False + else: + print "ERROR: Unable to verify CRC" + return False + + return True + +def op_crc(s, sreqpkt, offset, length): + sreqpkt.offset = offset + sreqpkt.len = length + success = s.write_packet(SERIALMSG_AMGROUP, SERIALMSG_AMID, sreqpkt.payload()) + if success == True: + packet = s.read_packet() + sreplypkt = SerialReplyPacket(packet[1]) + if sreplypkt.error == SERIALMSG_SUCCESS: + return sreplypkt.data + else: + return None + +def op_leds(s, sreqpkt): + success = s.write_packet(SERIALMSG_AMGROUP, SERIALMSG_AMID, sreqpkt.payload()) + +# ======== MAIN ======== # +if len(sys.argv) >= 3: + sys.argv[2] = int(sys.argv[2]) + + s = tinyos.Serial(sys.argv[1], 57600) + s.set_debug(False) # Disables debug msg + sreqpkt = SerialReqPacket((sys.argv[2], 0, 0, 0, [])) # msg_type, pad, offset, length, data + + if sys.argv[2] == SERIALMSG_RUN: + if op_run(s, sreqpkt) == True: + print "Loaded image should be running now!" + else: + print "ERROR: Unable to run loaded image" + elif sys.argv[2] == SERIALMSG_ERASE: + if op_erase(s, sreqpkt) == True: + print "Flash volume has been erased" + else: + print "ERROR: Unable to erase flash volume" + + elif sys.argv[2] == SERIALMSG_WRITE: + input_file = file(sys.argv[3], 'rb') + fileStats = os.stat(sys.argv[3]) + + if fileStats[stat.ST_SIZE] <= DELUGE_VOLUME_SIZE: + #sreqpkt = SerialReqPacket((SERIALMSG_LEDS, 0, 0, 0, [])) + #op_leds(s, sreqpkt) + sreqpkt = SerialReqPacket((sys.argv[2], 0, 0, 0, [])) + if op_write(s, sreqpkt, input_file, fileStats[stat.ST_SIZE]) == True: + print "File has been successfully transmitted (" + str(fileStats[stat.ST_SIZE]) + " bytes)" + else: + print "ERROR: Unable to transmit file" + sreqpkt = SerialReqPacket((SERIALMSG_LEDS, 0, 0, 0, [])) + op_leds(s, sreqpkt) + else: + print "ERROR: File is larger than flash volume (" + DELUGE_VOLUME_SIZE + ")" + + elif sys.argv[2] == SERIALMSG_READ: + data = op_print(s, sreqpkt, int(sys.argv[3]), int(sys.argv[4])) + if data != True: + print "ERROR: Unable to read the specified range" + + elif sys.argv[2] == SERIALMSG_CRC: + remote_crc = op_crc(s, sreqpkt, int(sys.argv[3]), int(sys.argv[4])) + if remote_crc != None: + print_hex(0, remote_crc) + else: + print "ERROR: Unable to compute remote CRC" diff --git a/apps/tosthreads/tinyld/SerialLoaderFlash/tinyos.py b/apps/tosthreads/tinyld/SerialLoaderFlash/tinyos.py new file mode 100755 index 00000000..e922f58c --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoaderFlash/tinyos.py @@ -0,0 +1,223 @@ +import struct, time, serial + +class Serial: + HDLC_FLAG_BYTE = 0x7e + HDLC_CTLESC_BYTE = 0x7d + + TOS_SERIAL_ACTIVE_MESSAGE_ID = 0 + TOS_SERIAL_CC1000_ID = 1 + TOS_SERIAL_802_15_4_ID = 2 + TOS_SERIAL_UNKNOWN_ID = 255 + + SERIAL_PROTO_ACK = 67 + SERIAL_PROTO_PACKET_ACK = 68 + SERIAL_PROTO_PACKET_NOACK = 69 + SERIAL_PROTO_PACKET_UNKNOWN = 255 + + __s = None; # An instance of serial.Serial object + __debug = True # Debug mode + + def __init__(self, port, baudrate): + self.__s = serial.Serial(port, baudrate, rtscts=0) + + def __format_packet(self, packet): + return " ".join(["%02x" % p for p in packet]) + " | " + \ + " ".join(["%d" % p for p in packet]) + + def crc16(self, base_crc, frame_data): + crc = base_crc + for b in frame_data: + crc = crc ^ (b << 8) + for i in range(0, 8): + if crc & 0x8000 == 0x8000: + crc = (crc << 1) ^ 0x1021 + else: + crc = crc << 1 + crc = crc & 0xffff + return crc + + def __encode(self, val, dim): + output = [] + for i in range(dim): + output.append(val & 0xFF) + val = val >> 8 + return output + + def __decode(self, v): + r = long(0) + for i in v[::-1]: + r = (r << 8) + i + return r + + def __get_byte(self): + r = struct.unpack("B", self.__s.read())[0] + return r + + def __put_bytes(self, data): + for b in data: + self.__s.write(struct.pack('B', b)) + + def __unescape(self, packet): + r = [] + esc = False + for b in packet: + if esc: + r.append(b ^ 0x20) + esc = False + elif b == self.HDLC_CTLESC_BYTE: + esc = True + else: + r.append(b) + return r + + def __escape(self, packet): + r = [] + for b in packet: + if b == self.HDLC_FLAG_BYTE or b == self.HDLC_CTLESC_BYTE: + r.append(self.HDLC_CTLESC_BYTE) + r.append(b ^ 0x20) + else: + r.append(b) + return r + + def read_packet(self): + d = self.__get_byte() + ts = time.time() + while d != self.HDLC_FLAG_BYTE: + d = self.__get_byte() + ts = time.time() + packet = [d] + d = self.__get_byte() + if d == self.HDLC_FLAG_BYTE: + d = self.__get_byte() + ts = time.time() + else: + packet.append(d) + while d != self.HDLC_FLAG_BYTE: + d = self.__get_byte() + packet.append(d) + un_packet = self.__unescape(packet) + crc = self.crc16(0, un_packet[1:-3]) + packet_crc = self.__decode(un_packet[-3:-1]) + if crc != packet_crc: + print "Warning: wrong CRC!" + if self.__debug == True: + print "Recv:", self.__format_packet(un_packet) + return (ts, un_packet) + + def write_packet(self, am_group, am_id, data): + # The first byte after SERIAL_PROTO_PACKET_ACK is a sequence + # number that will be send back by the mote to ack the receive of + # the data. + packet = [self.SERIAL_PROTO_PACKET_ACK, 0, self.TOS_SERIAL_ACTIVE_MESSAGE_ID, + 0xff, 0xff, + 0, 0, + len(data), am_group, am_id] + data; + crc = self.crc16(0, packet) + packet.append(crc & 0xff) + packet.append((crc >> 8) & 0xff) + packet = [self.HDLC_FLAG_BYTE] + self.__escape(packet) + [self.HDLC_FLAG_BYTE] + if self.__debug == True: + print "Send:", self.__format_packet(packet) + self.__put_bytes(packet) + + # Waiting for ACK + packet = self.read_packet() + if len(packet) > 1 and len(packet[1]) > 1: + return ((packet[1])[1] == self.SERIAL_PROTO_ACK) + return False + + def set_debug(self, debug): + self.__debug = debug + +class GenericPacket: + """ GenericPacket """ + + def __decode(self, v): + r = long(0) + for i in v: + r = (r << 8) + i + return r + + def __encode(self, val, dim): + output = [] + for i in range(dim): + output.append(int(val & 0xFF)) + val = val >> 8 + output.reverse() + return output + + def __init__(self, desc, packet = None): + self.__dict__['_schema'] = [(t, s) for (n, t, s) in desc] + self.__dict__['_names'] = [n for (n, t, s) in desc] + self.__dict__['_values'] = [] + offset = 10 + if type(packet) == type([]): + for (t, s) in self._schema: + if t == 'int': + self._values.append(self.__decode(packet[offset:offset + s])) + offset += s + elif t == 'blob': + if s: + self._values.append(packet[offset:offset + s]) + offset += s + else: + self._values.append(packet[offset:-3]) + elif type(packet) == type(()): + for i in packet: + self._values.append(i) + else: + for v in self._schema: + self._values.append(None) + + def __repr__(self): + return self._values.__repr__() + + def __str__(self): + return self._values.__str__() + + # Implement the map behavior + def __getitem__(self, key): + return self.__getattr__(key) + + def __setitem__(self, key, value): + self.__setattr__(key, value) + + def __len__(self): + return len(self._values) + + def keys(self): + return self._names + + def values(self): + return self._names + + # Implement the struct behavior + def __getattr__(self, name): + if type(name) == type(0): + return self._names[name] + else: + return self._values[self._names.index(name)] + + def __setattr__(self, name, value): + if type(name) == type(0): + self._values[name] = value + else: + self._values[self._names.index(name)] = value + + # Custom + def names(self): + return self._names + + def sizes(self): + return self._schema + + def payload(self): + r = [] + for i in range(len(self._schema)): + (t, s) = self._schema[i] + if t == 'int': + r += self.__encode(self._values[i], s) + else: + r += self._values[i] + return r diff --git a/apps/tosthreads/tinyld/SerialLoaderFlash/volumes-at45db.xml b/apps/tosthreads/tinyld/SerialLoaderFlash/volumes-at45db.xml new file mode 100644 index 00000000..26c8665f --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoaderFlash/volumes-at45db.xml @@ -0,0 +1,3 @@ + + + diff --git a/apps/tosthreads/tinyld/SerialLoaderFlash/volumes-stm25p.xml b/apps/tosthreads/tinyld/SerialLoaderFlash/volumes-stm25p.xml new file mode 100755 index 00000000..801def91 --- /dev/null +++ b/apps/tosthreads/tinyld/SerialLoaderFlash/volumes-stm25p.xml @@ -0,0 +1,3 @@ + + + diff --git a/apps/tutorials/LowPowerSensing/Base/LowPowerSensingBaseAppC.nc b/apps/tutorials/LowPowerSensing/Base/LowPowerSensingBaseAppC.nc index 7b8aa066..3a0b7c16 100644 --- a/apps/tutorials/LowPowerSensing/Base/LowPowerSensingBaseAppC.nc +++ b/apps/tutorials/LowPowerSensing/Base/LowPowerSensingBaseAppC.nc @@ -76,7 +76,7 @@ implementation { #endif #if defined(PLATFORM_IRIS) - components RF230ActiveMessageC as LPLProvider; + components ActiveMessageC as LPLProvider; App.LPL -> LPLProvider; #endif } diff --git a/apps/tutorials/LowPowerSensing/Base/LowPowerSensingBaseC.nc b/apps/tutorials/LowPowerSensing/Base/LowPowerSensingBaseC.nc index 48e2dc02..7e7454c2 100644 --- a/apps/tutorials/LowPowerSensing/Base/LowPowerSensingBaseC.nc +++ b/apps/tutorials/LowPowerSensing/Base/LowPowerSensingBaseC.nc @@ -85,7 +85,7 @@ implementation { event message_t* SerialRequestSampleMsgsReceive.receive(message_t* msg, void* payload, uint8_t len) { serial_request_samples_msg_t* request_msg = payload; call Leds.led0On(); - call LPL.setRxSleepInterval(&request_samples_msg, LPL_INTERVAL+100); + call LPL.setRemoteWakeupInterval(&request_samples_msg, LPL_INTERVAL+100); call RadioRequestSampleMsgsSend.send(request_msg->addr, &request_samples_msg, sizeof(request_samples_msg_t)); return msg; } diff --git a/apps/tutorials/LowPowerSensing/Sampler/LowPowerSensingPeriodicSamplerAppC.nc b/apps/tutorials/LowPowerSensing/Sampler/LowPowerSensingPeriodicSamplerAppC.nc index 9a07855a..e2827239 100644 --- a/apps/tutorials/LowPowerSensing/Sampler/LowPowerSensingPeriodicSamplerAppC.nc +++ b/apps/tutorials/LowPowerSensing/Sampler/LowPowerSensingPeriodicSamplerAppC.nc @@ -71,7 +71,7 @@ implementation { #endif #if defined(PLATFORM_IRIS) - components RF230ActiveMessageC as LPLProvider; + components ActiveMessageC as LPLProvider; App.LPL -> LPLProvider; #endif diff --git a/apps/tutorials/LowPowerSensing/Sampler/LowPowerSensingPeriodicSamplerC.nc b/apps/tutorials/LowPowerSensing/Sampler/LowPowerSensingPeriodicSamplerC.nc index 2fd455b3..2ebdd544 100644 --- a/apps/tutorials/LowPowerSensing/Sampler/LowPowerSensingPeriodicSamplerC.nc +++ b/apps/tutorials/LowPowerSensing/Sampler/LowPowerSensingPeriodicSamplerC.nc @@ -68,7 +68,7 @@ implementation { } void sendSampleMsg() { - call LPL.setRxSleepInterval(&sample_msg, 0); + call LPL.setRemoteWakeupInterval(&sample_msg, 0); if(call SampleSend.send(BASE_STATION_ADDR, &sample_msg, sizeof(nx_sensor_sample_t)) != SUCCESS) post sendSampleMsgTask(); else call Leds.led2On(); @@ -78,7 +78,7 @@ implementation { task void sendSampleMsgTask() { sendSampleMsg(); } event void Boot.booted() { - call LPL.setLocalSleepInterval(LPL_INTERVAL); + call LPL.setLocalWakeupInterval(LPL_INTERVAL); call AMControl.start(); } diff --git a/apps/tutorials/RssiDemo/RssiBase/RssiBaseAppC.nc b/apps/tutorials/RssiDemo/RssiBase/RssiBaseAppC.nc index 5fba6f1a..d9b8bd32 100644 --- a/apps/tutorials/RssiDemo/RssiBase/RssiBaseAppC.nc +++ b/apps/tutorials/RssiDemo/RssiBase/RssiBaseAppC.nc @@ -45,8 +45,8 @@ configuration RssiBaseAppC { components CC2420ActiveMessageC; App -> CC2420ActiveMessageC.CC2420Packet; #elif defined(PLATFORM_IRIS) - components RF230ActiveMessageC; - App -> RF230ActiveMessageC.PacketRSSI; + components RF2xxActiveMessageC; + App -> RF2xxActiveMessageC.PacketRSSI; #elif defined(TDA5250_MESSAGE_H) components Tda5250ActiveMessageC; App -> Tda5250ActiveMessageC.Tda5250Packet; diff --git a/doc/html/deluge-t2-manual.html b/doc/html/deluge-t2-manual.html deleted file mode 100644 index 80783047..00000000 --- a/doc/html/deluge-t2-manual.html +++ /dev/null @@ -1,312 +0,0 @@ - - - - - -Deluge T2 - Programming Manual - - - - - -
    -

    -

    - -

    -

    -

    -

    - - - -

    -

    Deluge T2 - Programming Manual

    -

    -
    -Chieh-Jan Mike Liang
    -Razvan Musaloiu-E.

    January 14, 2008

    -
    -

    -

    -

    - -

    1  Introduction

    -

    -

    -Deluge is a reliable data dissemination protocol for large objects, such -as program binaries. Together with a bootloader, Deluge provides a way -to reprogram sensor motes in a network. Deluge is maintained by Jonathan -Hui, and Deluge 2.0 is the most recent version. Documentations on Deluge -2.0 are available at -http://www.cs.berkeley.edu/~jwhui/research/deluge/.

    -

    -Deluge T2 is an effort to port Deluge 2.0 from TinyOS 1 to TinyOS 2. -Although the code from Deluge 2.0 is reused as much as possible, the -behavior and the usage of Deluge T2 are not entirely identical to Deluge -2.0. Having said that, it would still be helpful to read the Deluge 2.0 -manual and related documentations.

    -

    -Deluge T2 is still in experimental phase. One current limitation is -platform support. Deluge T2 has been developed on Tmote Sky (telosb) -and MicaZ only. In addition, Deluge T2 comes with 2 flash volumes by -default. However, more volumes can be added, if necessary. There are -also some minor details that will be improved in future releases.

    -

    -

    - -

    2  Tools Installation

    -

    Deluge T2 requires a few Python scripts that not yet included in the -official tinyos-tools RPM package. On the CVS, the scripts are -located in tinyos-2.x/tools/tinyos/misc. The steps to install -them are the following:

    -

    -

    -
      % cd $TOSROOT/tools
    -  % ./Bootstrap
    -      ...
    -  % ./configure
    -      ...
    -  % cd tinyos/misc
    -  % make ; make install
    -      ...
    -

    -

    -By default, the files will be installed in /usr/local/bin. If -desired, the --prefix parameter from configure can be -used to indicate a different path.

    -

    -

    - -

    3  Quick Start

    -

    -

    -This section introduces the basics of reprogramming with an example. In -addition, it provides a quick test for software prerequisite. The latest -TinyOS 2 CVS tree and Python 2.4 with pySerial support are recommended -for running Deluge T2.

    -

    -To start the example, we first compile tosboot provided in tinyos-2.x/tos/lib/tosboot. -For example, -

    -
       % make telosb
    -

    -Then, we run the burn script provided in tinyos-2.x/apps/tests/deluge/Blink. -For example, -

    -
       % ./burn /dev/ttyUSB0 telosb
    -

    -This burn script programs the directly-connected mote with one -version of Blink. Then, it injects and reprograms the mote with another -version of Blink. At this point, you can try to retrieve program image -versioning information. The script to interface with the mote is -provided in tinyos-2.x/tools/tinyos/misc. For example, -

    -
       % tos-deluge /dev/ttyUSB0 telosb -p 0
    -

    -You should see something similar to the output below. -

    -
       Pinging node ...
    -   --------------------------------------------------
    -   Currently Executing:
    -     Prog Name:   BlinkAppC
    -     UID:         0xA274CBBE
    -     Compiled On: Mon Jan 14 13:09:38 2008
    -     Node ID:     1
    -   
    -   Stored image 0
    -     Prog Name:   BlinkAppC
    -     UID:         0xD7EEFACE
    -     Compiled On: Mon Jan 14 12:40:06 2008
    -     Platform:    telosb
    -     User ID:     tinyos2
    -     Host Name:   bluephase
    -     User Hash:   0x587C9C16
    -     Size:        33504
    -     Num Pages:   30
    -   --------------------------------------------------
    -

    -

    -The usage of tos-deluge is available by running the script without -any arguments, and it will be discussed in section 5.

    -

    -

    - -

    4  Reprogramming a Network

    -

    -

    -This section illustrates the procedure to reprogram a network. -Specifically, we will see how program images are injected and how -versioning information is retrieved.

    -

    -

    - -

    4.1  Setting Up the Motes

    -

    We first install both tosboot and a program that runs Deluge T2. For -simplicity, we use the golden image as the program. The golden image is -provided in tinyos-2.x/apps/tests/deluge/GoldenImage, and it does -nothing except initializing Deluge T2. This step can be done by -compiling and programming the mote normally. For example, -

    -
       % CFLAGS=-DDELUGE_BASESTATION make telosb install,0 bsl,/dev/ttyUSB0
    -

    -CFLAGS=-DDELUGE_BASESTATION indicates that the current mote will -act as a base station, which requires an additional component to accept -user commands from the serial port. Normally, only one mote in the -network needs to be the base station, and other motes are reprogrammed -over-the-air. If error occurs when running the command above, you might -need to compile tosboot as shown in section 3. -Deluge T2 makes sure the mote ID remain persistent over image -reprogramming. You can test the installation by interacting with the -mote through tos-deluge.

    -

    -

    - -

    4.2  Preparing Your Application

    -

    In most cases, the only two files you need to modify are the top-level -wiring file and the Makefile. You need to make sure DelugeC -component is included. In addition, the Makefile should have the -following line: -

    -
       TINYOS_NP=BNP
    -

    -Finally, compile your application without installing it on the mote. For -example, -

    -
       % make telosb
    -

    -

    -

    - -

    4.3  Injecting Your Application

    -

    Before a program image is disseminated in the network, we need to first -inject it to the base station. For example, -

    -
       % tos-deluge /dev/ttyUSB0 telosb -i 1 apps/Blink/build/telosb/tos_image.xml
    -

    -You should see something similar to the output below.

    -

    -

    -
       Pinging node ...
    -   Connected to Deluge nodes.
    -   No valid image was detected.
    -   --------------------------------------------------
    -   Create image: /home/tinyos2/local/bin/tos-build-deluge-image -i 1 build/telosb/tos_image.xml
    -   Ihex read complete:
    -     35916 bytes starting at 0x4A00
    -        32 bytes starting at 0xFFE0
    -     35948 bytes in 2 sections
    -   CRCs:
    -     0xCC0E 0xE57B 0xC224 0xE4FA 0x63EB 0xEBA5 0xE50B 
    -     0x8073 0x345E 0x3BBF 0xF415 0xA7DB 0xA67C 0x6953 
    -     0x6638 0x3D76 0x7218 0x0E8F 0x9C93 0xD679 0x7A50 
    -     0xBFCD 0x8B57 0x7A47 0x323E 0x29FF 0x5EFF 0xB0AE 
    -     0x1392 0x4A82 0xACFB 0x69D7 0x8C07 
    -   --------------------------------------------------
    -   36816 bytes in 28.23 seconds (1303.9932 bytes/s)     
    -   --------------------------------------------------
    -   Replace image with:
    -     Prog Name:   BlinkAppC
    -     UID:         0x76D2FB1B
    -     Compiled On: Sun Jan 13 21:47:54 2008
    -     Platform:    telosb
    -     User ID:     tinyos2
    -     Host Name:   bluephase
    -     User Hash:   0x587C9C16
    -     Size:        36816
    -     Num Pages:   33
    -   --------------------------------------------------
    -

    -

    -

    - -

    4.4  Reprogramming with New Image

    -

    After you decide which program image you want to reprogram, you can -first test on the base station by issuing the reboot command. For -example, -

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

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

    -

    -Now, you can have the base station disseminate a program image to the rest of -the network. For example, -

    -
       % tos-deluge /dev/ttyUSB0 telosb -d 1
    -

    -This command instructs the base station to notify the whole network of -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. After all motes receive the image -over-the-air, you can instruct the base station to disseminate the -command to reprogram in the network. For example, -

    -
       % tos-deluge /dev/ttyUSB0 telosb -dr 1
    -

    -

    -

    - -

    5  Deluge T2 Python Toolchain

    -

    -

    -Different from Deluge 2.0, Deluge T2 toolchain is written in Python. -However, as demonstrated in the previous section, the usage is similar.

    -

    -

    - -

    5.1  -p -ping

    -

    This command is useful for checking the status of program images on a -mote. It provides information such as program name, compile time, size -of the image, and so on.

    -

    -

    - -

    5.2  -i -inject

    -

    This command creates a program image from the supplied -tos_image.xml file, and it injects the image into specified -volume on the mote.

    -

    -

    - -

    5.3  -r -reprogram

    -

    This command sets up the directly-connected mote to reprogram itself -after reboot, and then it reboots the mote.

    -

    -

    - -

    5.4  -d -disseminate

    -

    This command instructs the base station mote to disseminate an image to -the network. This image is specified by the volume ID.

    -

    -

    - -

    5.5  -dr -disseminate-and-reprogram

    -

    This command asks the motes in the network not only to disseminate an -image but also to start running it. This is accomplish using a reboot.

    -

    -

    - -

    5.6  -e -erase

    -

    This command erases a flash volume on the base station mote.

    -

    -

    - -

    5.7  -s -stop

    -

    The effect of -d and -dr is continuous which means a new -mote will become ``infected'' if he is nearby. This command stops the -``infection''.

    -

    -

    - -

    5.8  -ls -local-stop

    -

    When -d or -dr are in effect, the volume used by them is -locked. This command can be used to unlock the volume in order to -erase or inject a new image.

    -

    -

    -

    -
    Last modified: Monday, January 14th, 2008 2:11:03pm
    -
    - - diff --git a/doc/html/tep102.html b/doc/html/tep102.html index 0125cf17..3e7e8dc2 100644 --- a/doc/html/tep102.html +++ b/doc/html/tep102.html @@ -3,7 +3,7 @@ - + Timers +

    Timers

    @@ -297,7 +298,6 @@ ul.auto-toc {
    Cory Sharp, Martin Turon, David Gay
    -

    Note

    This memo documents a part of TinyOS for the TinyOS Community, and @@ -305,15 +305,15 @@ requests discussion and suggestions for improvements. Distribution of this memo is unlimited. This memo is in full compliance with TEP 1.

    -
    -

    Abstract

    +
    +

    Abstract

    This TEP proposes a Timer design that supports common timing requirements both in precision and width across common hardware configurations. This TEP focuses on aligning the Timer abstraction with the three-layer Hardware Abstraction Architecture (HAA).

    -
    -

    1. Introduction

    +
    +

    1. Introduction

    Most microcontrollers offer a rich timer system, with features like:

    • several counters, possibly of different widths, with multiple clocking options
    • @@ -327,7 +327,7 @@ the timer hardware on some current TinyOS platforms.

      platform-independent fashion. Instead, following the principles of the HAA[_tep2], each microcontroller should expose all this functionality via components and interfaces at the HPL and, where appropriate, HAL levels. -However, two aspects of timers are sufficiently common and important +However, two aspects of timers are sufficiently common and important that they should be made available in a well-defined way: measuring time, and triggering (possibly repeating) events at specific times. The rest of this TEP specifies:

      @@ -336,7 +336,7 @@ of this TEP specifies:

      events (2. Interfaces)
    • guidelines on how each microcontroller's HAL SHOULD expose its timer hardware in terms of the above interfaces (3. HAL guidelines)
    • -
    • what components a microcontroller's timer HIL MUST implement +
    • what components a microcontroller's timer HIL MUST implement (4. HIL requirements)
    • a set of utility components whose use simplifies building the components specified by the HAL guidelines and HIL requirements (5. Utility components)
    • @@ -344,13 +344,13 @@ specified by the HAL guidelines and HIL requirements (This TEP ends with appendices documenting, as an example, the mica2 timer subsystem implementation.

    -
    -

    2. Interfaces

    +
    +

    2. Interfaces

    Before presenting the interfaces (2.2), we start with a general discussion of the issues of precision, width and accuracy in timer interfaces (2.1).

    -
    -

    2.1 Precision, Width and Accuracy

    +
    +

    2.1 Precision, Width and Accuracy

    Three fundamental properties of timers are precision, width and accuracy.

    Examples of precision are millisecond, a cycle of a 32kHz clock, and @@ -359,7 +359,7 @@ units with respect to one second. That is, one second contains 1024 binary milliseconds, 32768 32kHz ticks, or 1048576 microseconds. This TEP emphasizes millisecond and 32kHz tick precisions while reasonably accommodating other precisions. The use of "binary" units -is motivated by the common availability of hardware clocks driven +is motivated by the common availability of hardware clocks driven by a 32768Hz crystal.

    Examples of widths are 8-bit, 16-bit, 32-bit, and 64-bit. The width for timer interfaces and components SHOULD be 32-bits. This TEP @@ -392,8 +392,8 @@ typedef struct { int notUsed; } TMicro; // 1048576 ticks per second

    Note that the precision names are expressed as either frequency or period, whichever is convenient.

    -
    -

    2.2 Timer interfaces

    +
    +

    2.2 Timer interfaces

    This TEP proposes these timer interfaces:

     interface Counter< precision_tag, size_type >
    @@ -407,8 +407,8 @@ applications and use a fixed width of 32-bits.  The Alarm, BusyWait,
     and Counter interfaces are used by the TinyOS timer system and
     advanced user components.

    -
    -

    Counter

    +
    +

    Counter

    The Counter interface returns the current time and provides commands and an event for managing overflow conditions. These overflow commands and events are necessary for properly deriving larger width @@ -423,22 +423,22 @@ interface Counter<precision_tag,size_type> }

    -
    get()
    +
    get()
    return the current time.
    -
    isOverflowPending()
    +
    isOverflowPending()
    return TRUE if the overflow flag is set for this counter, i.e., if and only if an overflow event will occur after the outermost atomic block exits. Return FALSE otherwise. This command only returns the state of the overflow flag and causes no side effect.
    -
    clearOverflow()
    +
    clearOverflow()
    cancel the pending overflow event clearing the overflow flag.
    -
    overflow()
    +
    overflow()
    signals that an overflow in the current time. That is, the current time has wrapped around from its maximum value to zero.
    -
    -

    Alarm

    +
    +

    Alarm

    Alarm components are extensions of Counters that signal an event when their compare register detects the alarm time has been hit. All commands and events of the Alarm interface are asynchronous (or @@ -461,15 +461,15 @@ interface Alarm<precision_tag,size_type> }

    -
    start(dt)
    +
    start(dt)
    cancel any previously running alarm and set to fire in dt time units from the time of invocation. The alarm will only fire once then stop.
    -
    stop()
    +
    stop()
    cancel any previously running alarm.
    -
    fired()
    +
    fired()
    signals that the alarm has expired.
    -
    isRunning()
    +
    isRunning()
    return TRUE if the alarm has been started and has not been cancelled or has not yet fired. FALSE is returned otherwise.
    @@ -485,9 +485,9 @@ numerically greater than the current time (returned by -
    getNow()
    +
    getNow()
    return the current time in the precision and width of the alarm.
    -
    getAlarm()
    +
    getAlarm()
    return the time the currently running alarm will fire or the time that the previously running alarm was set to fire. getAlarm can be used with startAt to set an alarm from the previous alarm time, @@ -495,8 +495,8 @@ as in startAt(getAlarm(),dt). This pattern is used within the fired() event to construct periodic alarms.
    -
    -

    BusyWait

    +
    +

    BusyWait

    The BusyWait interface allows for very short synchronous delays. BusyWait should be used sparingly and when an Alarm would not be reasonably efficient or accurate. The BusyWait interface replaces @@ -516,8 +516,8 @@ interface BusyWait<precision_tag,size_type>

    block until at least dt time units have elapsed
    -
    -

    LocalTime

    +
    +

    LocalTime

    The LocalTime interface exposes a 32-bit counter without overflow utilities. This is primarily for application code that does not care about overflow conditions.

    @@ -528,12 +528,12 @@ interface LocalTime<precision_tag> }
    -
    get()
    +
    get()
    return the current time.
    -
    -

    Timer

    +
    +

    Timer

    All commands and events of the Timer interface are synchronous (or in "task context"). The Timer interface provides a set of "basic" commands for common usage and provides a set of "extended" commands @@ -558,26 +558,26 @@ interface Timer<precision_tag> }

    -
    startPeriodic(dt)
    +
    startPeriodic(dt)
    cancel any previously running timer and set to fire in dt time units from the time of invocation. The timer will fire periodically every dt time units until stopped.
    -
    startOneShot(dt)
    +
    startOneShot(dt)
    cancel any previously running timer and set to fire in dt time units from the time of invocation. The timer will only fire once then stop.
    -
    stop()
    +
    stop()
    cancel any previously running timer.
    fired()
    signals that the timer has expired (one-shot) or repeated (periodic).
    -
    isRunning()
    +
    isRunning()
    return TRUE if the timer has been started and has not been cancelled and has not fired for the case of one-shot timers. Once a periodic timer is started, isRunning will return TRUE until it is cancelled.
    -
    isOneShot()
    +
    isOneShot()
    return TRUE if the timer is a one-shot timer. Return FALSE otherwise if the timer is a periodic timer.
    -
    startPeriodicAt(t0,dt)
    +
    startPeriodicAt(t0,dt)

    cancel any previously running timer and set to fire at time t1 = t0+dt. The timer will fire periodically every dt time units until stopped.

    @@ -585,23 +585,23 @@ stopped.

    value of t0 numerically greater than the current time (returned by getNow()) represents a time from before the last wraparound.

    -
    startOneShotAt(t0,dt)
    +
    startOneShotAt(t0,dt)

    cancel any previously running timer and set to fire at time t1 = t0+dt. The timer will fire once then stop.

    t0 is as in startPeriodicAt.

    -
    getNow()
    +
    getNow()
    return the current time in the precision and width of the timer.
    -
    gett0()
    +
    gett0()
    return the time anchor for the previously started timer or the time of the previous event for periodic timers.
    -
    getdt()
    +
    getdt()
    return the delay or period for the previously started timer.
    -
    -

    3. HAL guidelines

    +
    +

    3. HAL guidelines

    Platforms SHOULD expose their relevant timing capabilities using standard Alarm and Counter interfaces. The design pattern presented here defines a component naming convention to allow platform @@ -646,8 +646,8 @@ are mutually incompatible in a single application. Incompatible components SHOULD produce compile-time errors when compiled together.

    -
    -

    4. HIL requirements

    +
    +

    4. HIL requirements

    The following component MUST be provided on all platforms

     HilTimerMilliC
    @@ -657,8 +657,8 @@ BusyWaitMicroC
     HilTimerMilliC and 1/1048576s for BusyWaitMicroC. Components using
     other precisions (e.g., regular, non-binary milliseconds) MAY also be
     provided.

    -
    -

    HilTimerMilliC

    +
    +

    HilTimerMilliC

     configuration HilTimerMilliC
     {
    @@ -673,8 +673,8 @@ TimerMilli parameterised interface.  UQ_TIMER_MILLI is defined in
     Timer.h.  HilTimerMilliC is used by the LocalTimeMilliC component and the
     TimerMilliC generic component, both found in tos/system/

    -
    -

    BusyWaitMicroC

    +
    +

    BusyWaitMicroC

     configuration BusyWaitMicroC
     {
    @@ -687,8 +687,8 @@ delay is small and setting a timer or alarm would be impractical,
     inefficient or insufficiently precise.

    -
    -

    5. Utility components

    +
    +

    5. Utility components

    A number of platform independent generic components are provided to help implementers and advanced users of the TinyOS timer system:

      @@ -701,8 +701,8 @@ help implementers and advanced users of the TinyOS timer system:

    Appendices B and C show how these can be used to help implement the timer HAL and HIL.

    -
    -

    AlarmToTimerC

    +
    +

    AlarmToTimerC

    AlarmToTimerC converts a 32-bit Alarm to a Timer.

     generic component AlarmToTimerC( typedef precision_tag )
    @@ -712,8 +712,8 @@ generic component AlarmToTimerC( typedef precision_tag )
     }
     
    -
    -

    BusyWaitCounterC

    +
    +

    BusyWaitCounterC

    BusyWaitCounterC uses a Counter to block until a specified amount of time elapses.

    @@ -725,8 +725,8 @@ generic component BusyWaitC( typedef precision_tag,
     }
     
    -
    -

    CounterToLocalTimeC

    +
    +

    CounterToLocalTimeC

    CounterToLocalTimeC converts from a 32-bit Counter to LocalTime.

     generic component CounterToLocalTimeC( precision_tag )
    @@ -736,12 +736,12 @@ generic component CounterToLocalTimeC( precision_tag )
     }
     
    -
    -

    TransformAlarmC

    +
    +

    TransformAlarmC

    TransformAlarmC decreases precision and/or widens an Alarm. An already widened Counter component is used to help.

    -generic component TransformAlarmC( 
    +generic component TransformAlarmC(
       typedef to_precision_tag,
       typedef to_size_type @integer(),
       typedef from_precision_tag,
    @@ -769,8 +769,8 @@ TransformAlarmC to ensure that all five of its arguments are self
     consistent.  No compile errors are generated if the parameters
     passed to TransformAlarmC are inconsistent.

    -
    -

    TransformCounterC

    +
    +

    TransformCounterC

    TransformCounterC decreases precision and/or widens a Counter.

     generic component TransformCounterC(
    @@ -801,8 +801,8 @@ created:

    new TransformCounterC( TMilli, uint32_t, T32khz, uint16_t, 5, uint32_t )
    -
    -

    VirtualizeTimerC

    +
    +

    VirtualizeTimerC

    VirtualizeTimerC uses a single Timer to create up to 255 virtual timers.

    @@ -815,8 +815,8 @@ generic component VirtualizeTimerC( typedef precision_tag, int max_timers )
     
    -
    -

    6. Implementation

    +
    +

    6. Implementation

    The definition of the HIL interfaces are found in tinyos-2.x/tos/lib/timer:

      @@ -856,7 +856,7 @@ generic component VirtualizeTimerC( typedef precision_tag, int max_timers )
    • CounterMilli16C.nc provides Counter<TMilli,uint16_t>
    • CounterMilli32C.nc provides Counter<TMilli,uint32_t>
    • GpioCaptureC.nc
    • -
    • HilTimerMilliC.nc provides LocalTime<TMilli> and +
    • HilTimerMilliC.nc provides LocalTime<TMilli> and Timer<TMilli> as TimerMilli[uint8_t num]
    • Msp430AlarmC.nc is generic and converts an MSP430 timer to a 16-bit Alarm
    • Msp430Capture.nc HPL interface definition for MSP430 timer captures
    • @@ -889,8 +889,8 @@ special function registers tinyos-2.x/tos/chips/atm128/timer and tinyos-2.x/tos/chips/pxa27x/timer respectively.

    -
    -

    7. Author's Address

    +
    +

    7. Author's Address

    Cory Sharp
    Moteiv Corporation
    @@ -918,8 +918,8 @@ special function registers
  • -
    -

    Appendix A: Timer hardware on various microcontrollers

    +
    +

    Appendix A: Timer hardware on various microcontrollers

    1. Atmega128
    2. @@ -995,8 +995,8 @@ output pin, clear counter, generate interrupt, etc)
    -
    -

    Appendix B: a microcontroller: Atmega 128 timer subsystem

    +
    +

    Appendix B: a microcontroller: Atmega 128 timer subsystem

    The Atmega128 exposes its four timers through a common set of interfaces:

      @@ -1026,7 +1026,7 @@ interface HplAtm128Timer<timer_size> async command bool isOn(); //<! Is overflow interrupt on? /// Clock initialization interface - async command void off(); //<! Turn off the clock + async command void off(); //<! Turn off the clock async command void setScale( uint8_t scale); //<! Turn on the clock async command uint8_t getScale(); //<! Get prescaler setting } @@ -1057,7 +1057,7 @@ interface HplAtm128Capture<size_type> /// Interrupt signals async event void captured(size_type t); //<! Signalled on capture int - /// Interrupt flag utilites: Bit level set/clr + /// Interrupt flag utilites: Bit level set/clr async command void reset(); //<! Clear the capture interrupt flag async command void start(); //<! Enable the capture interrupt async command void stop(); //<! Turn off capture interrupts @@ -1089,7 +1089,7 @@ interface is only connected for i another value cause a compile-time error. This is achieved as follows (code from the implementation of HplAtm128Timer1C)

      -Compare[0] = HplAtm128Timer1P.CompareA; 
      +Compare[0] = HplAtm128Timer1P.CompareA;
       Compare[1] = HplAtm128Timer1P.CompareB;
       Compare[2] = HplAtm128Timer1P.CompareC;
       
      @@ -1133,8 +1133,8 @@ generic configuration Atm128AlarmAsyncC(typedef precision, int divider) {

      which builds a 32-bit alarm and timer over timer 0. divider is used to initialise the timer0 scaling factor.

    -
    -

    Appendix C: a mote: Mica family timer subsystem

    +
    +

    Appendix C: a mote: Mica family timer subsystem

    Members of the mica family (mica2, mica2dot, micaz) use the Atmega128 microprocessor and have external crystals at 4 or 7.37MHz. Additionally, they can be run from an internal oscillator at 1, 2, 4, or 8 MHz. The @@ -1157,13 +1157,13 @@ VirtualizeTimerC and CounterToLocalTimeC utility components.

  • Timer 1: the 16-bit hardware timer 1 is set to run at 1MHz if possible. However, the set of dividers for timer 1 is limited to 1, 8, 64, 256 and 1024. So, when clocked at 2 or 4MHz, a divider of 1 is -selected and timer 1 runs at 2 or 4MHz. To reflect this fact, the +selected and timer 1 runs at 2 or 4MHz. To reflect this fact, the HAL components exposing timer 1 are named CounterOne16C and AlarmOne16C (rather than the CounterMicro16C AlarmMicro16C as suggested in Section 3).

    32-bit microsecond Counters and Alarms, named CounterMicro32C and AlarmMicro32C, are created from CounterOne16C and -AlarmOne16C using the TransformAlarmC and TransformCounterC +AlarmOne16C using the TransformAlarmC and TransformCounterC utility components.

    Three compare registers are available on timer1, so up to three instances of AlarmOne16C and/or AlarmMicro32C can be created. The timing @@ -1179,7 +1179,7 @@ accuracy depends on how the mote is clocked:

  • Timer 3: the 16-bit hardware timer 3 is set to run at a rate close to 32768Hz, if possible. As with timer 1, the limited set of dividers makes this impossible at some clock frequencies, so the 16-bit timer 3 HAL -components are named CounterThree16C and AlarmThree16C. As +components are named CounterThree16C and AlarmThree16C. As with timer 1, the rate of timer 3 is adjusted in software to build 32-bit counter and 32-bit alarms, giving components Counter32khz32C and Alarm32khz32C. As with timer 1, three compare diff --git a/doc/html/tep109.html b/doc/html/tep109.html index 0088c4a3..56b758c1 100644 --- a/doc/html/tep109.html +++ b/doc/html/tep109.html @@ -291,15 +291,11 @@ ul.auto-toc { Type:Documentary Status: -Draft +Final TinyOS-Version:2.x Author: David Gay, Philip Levis, Wei Hong, Joe Polastre, and Gilman Tolle -Draft-Created:10-Jun-2006 - -Draft-Discuss:TinyOS Developer List <tinyos-devel at mail.millennium.berkeley.edu> -

    diff --git a/doc/html/tep112.html b/doc/html/tep112.html index f8ffa3ce..7376cad4 100644 --- a/doc/html/tep112.html +++ b/doc/html/tep112.html @@ -3,7 +3,7 @@ - + Microcontroller Power Management + + +
    +

    Roadmap to an IP Stack in TinyOS

    + +++ + + + + + + + + + + + + + +
    TEP:136
    Group:Network Protocol Working Group
    Type:Informational
    Status:Draft
    TinyOS-Version:> 2.1
    Author:Stephen Dawson-Haggerty, Matus Harvan, and Omprakash Gnawali
    +
    +

    Abstract

    +

    Recently, there has been renewed interest in the applicability of Internet +Protocol-based networking for low power, embedded devices. This interest is +being driven by several sources. One, emerging standards from the IETF are +beginning to make it possible to design efficient, compatible +implementations of IP for this class of resource-constrained device. Two, +there has been an emergence of a significant number of both open and closed IP +embedded IP stacks which demonstrate the applicability of this model of +networking. Third, a set of recent academic papers have made the case that +this network architecture is a significant research enabler and shown in more +detail the structure of a full stack.

    +

    In this TEP, we briefly explain how IP mechanisms map onto the well-studied +problems of the sensor network community like collection routing and local +aggregation. Next, we discuss the current "state of the standards." Finally, +we propose a path for the adoption of IP within TinyOS.

    +
    +
    +

    1. IP Requirements and Mechanisms

    +

    There are two versions of IP: IPv4 (RFCXXX) and IPv6 (RFCXXX). Previous +studies have indicated that IPv6 is more applicable to the low-power, embedded +space then IPv4 for various reasons; most standardization efforts have focused +on adapting IPv6 to these devices. Therefore, we consider only IPv6.

    +
    +

    1.1 IPv6 Routing

    +

    A central question for implementing IPv6 in sensor networks is what has become +know as "route over" vs. "mesh under" in the IETF. In mesh under networking, +routing is done on layer two addresses, and every host is one hop from every +other. Although this is the most compatible with existing assumptions about +subnet design, it leads to significant redundancies and inefficiencies in this +space. The alternative, so called route-over exposes the radio topology at +the IP layer. While not strictly compatible with some IPv6 mechanisms, this +is becomming the favored approach since a single set of tools can be used to +debug. For the rest of this TEP we assume that route over is the model.

    +

    There are a number of existing routing protocols for IPv6, some targeted at +wireless links. However, IPv6 itself does not require any particular routing +protocol to be used with a domain; common choices in wired networks are OSPF +and IS-IS. Recent study in the IETF has indicated that existing protocols are +probably not appropriate for this space [draft-ietf-roll-protocols-02], and so +further work is needed on this point. Existing protocols with TinyOS +implementations such as DYMO or S4 may be appropriate for this task; +collection and dissemination protocols like CTP or Drip are probably not +directly applicable since they are address-free, although the insight gained +from their implementations may be transferable.

    +
    +
    +

    1.2 Addressing

    +

    The most well-known property of IPv6 is probably it's address length. An IPv6 +address is 128 bits long. Within this space, IPv6 defines unicast, anycast, +and multicast address ranges; each of these ranges further have properties of +their own. For a full explaination of IPv6 addressing we refer the reader to, +for example, [OReilly, RFC], we cover briefly some of the important details.

    +
    +

    1.2.1 Unicast Addressing

    +

    Unicast addresses in IPv6 consist of two parts: the network identifier (the +first 64 bits), and the interface identifier (the second). The interface +identifier is a flat space, and may be derived from the interface's MAC +address, a random number, or other mechanism. IPv6 contains mechanisms to +ensure that the interface ID is unique within the subnet. The network +may be assigned using many different mechanisms, but some network identifiers +are special.

    +

    Unlike IPv4, each interface in IPv6 is multihomed: it is expected to have +multiple IPv6 addresses. When an interface is brought up, IPv6 contains +mechanisms to configure the interface with a locally unique, non-routable +address known as the link-local address. This address has the network +identifier fe80::, and can be used for communication between hosts in the same +subnet.

    +

    In a TinyOS IPv6 stack, this address range might be used to allow TinyOS nodes +to communicate locally without routing, for instance to enable local +aggregation. If the TinyOS hosts can assign themselves link-local addresses +derived from their IEEE802.15.4 16-bit short id, or full 64-bit EUID. For +instance, a node with short ID 16 might assign the address fe80::10 to its +802.15.4 interface. These addresses would not be routed; an IP stack would +send directly to the short id 0x10 contained in the address.

    +

    IPv6 also contains several mechanisms to allow a host to obtain a +publicly-routable network identifier. TinyOS hosts communicating with these +addresses could contact nodes in other sensor networks or on the internet; the +fact that they are multihomed allows them to use both public and link-local +addresses simultaneously.

    +
    +
    +

    1.2.2 Multicast Addressing

    +

    IPv6 contains a multicast address range; addresses beginning with the byte +containing all ones (0xff) are multicast addresses. Following this byte are +four bits of flags and four bits of "scope". For instance, scope 1 is +node-local, and scope 2 is link local. IPv6 defines many well-known multicast +groups [http://www.iana.org/assignments/ipv6-multicast-addresses]; of most interest here are the "link-local all nodes" and "link +local all-routers" addresses: ff02::1 and ff02::2, respectively. Depending on +weather TinyOS IP hosts are also IP routers, these addresses are effecitvely +link-local broadcast addresses which might be mapped into the layer 2 +broadcast address (0xffff). Thus IPv6 contains mechanisms for local +broadcast.

    +

    There is also a site-local scope defined in IPv6 (5) with a similar ff05::2 +address. "Site local" is an administratively defined scope in IPv6, and might +naturally consist of an entire sensor network. Thus, sending to this address +would correspond to disseminating a value to each node in the network and +could be implemented with a trickle-based algorithm.

    +

    Futhermore, the TinyOS community could develop additional conventions to +provide and address for scoped flooding or delivery to nodes with particular +capabilities. A full IP multicast implementation within the sensor network +could be used for many things including control applications or +publish-subscribe network layers which have previously been special purpose.

    +
    +
    +

    1.2.3 Anycast Addressing

    +

    Anycast addresses indicate that the packet should be delivered to at least one +host with the anycast address. This seems initially similar to the model for +collection routing such as MultiHopLQI or CTP, in that a collection report is +delivered to a single root. However, it is more likeley that those +"collection roots" in an IP-based infrastructure are not actually the final +destination for the data; they are likely to only be intermediate routers who +send the data on to a final destination. Therefore, while there may be +applications for anycast addressing, we do not believe this addressing mode to +be appropriate in the common case.

    +
    +
    +
    +

    1.3 IPv6 Configuration Mechanisms

    +

    As alluded to earlier, IPv6 contains two mechanisms to allow internet hosts to +become associated with a public network identifier. These methods are +stateless autoconfiguration and DHCPv6. Stateless autoconfiguration defines +Router Solicitations and Router Advertisements. A host joining a network +sends router solicitations to the link-local all-routers address (ff02::2) +using his link-local address as the source address. Routers respond with a +Router Advertisement containing, among other things, a public network +identifier which the host may use.

    +

    In a TinyOS IP implementation, router solicitations and advertisements might +be used for default route selection on the hosts, as well as neighbor +discovery.

    +
    +
    +

    1.4 Extension Mechanisms

    +

    A common idiom in TinyOS is to provide "stacked" headers by implementing a +series of components, all of which implement the Packet interface. IPv6 +supports this a more flexible way with options headers. These headers fall +into one of two categories: hop-by-hop options headers and destination option +headers. These headers are chained together with small, two-octet common +header fields which identifiy the header type of the next header, and the +length of that options header. This allows hosts to process a header chain +even if they do not know how to interpret all of the options headers.

    +

    These headers are commonly used for protocol options, or to piggyback data on +outgoing packets. For instance, a link estimator component could add an extra +"link options" header to occasional outgoing packets as an options header, +while avoiding the overhead when it is not necessary to do so. This header +architecture is significantly more flexible then the existing TinyOS packet +architecture, although it does come at the slight cost of complexity.

    +
    +
    +
    +

    2. The State of the Standards

    +

    All of the previously defined mechanisms are well defined for IPv6 in various +RFCs. However, most nodes running TinyOS are significantly more +resource-constrained then typical IPv6 hosts. Thus, there is ongoing work on +adapting these mechanisms to the characteristics of embedded devices.

    +
    +

    2.1 Header Compression

    +

    The first issue which must be addressed is the sheer size of the IPv6 header: +40 octets. Of this, 32 octets are the source and destination addresses of the +packet. The IETF has published RFC4944 which describes a header compression +technique known as HC1. However, this scheme has significant problems, most +importantly the inability to take advantage of 16-bit short identifiers when +available. There have been a sequence of internet drafts proposing improved +techinques such as HC1g, and HC. The most recent version of these drafts is +draft-hui-6lowpan-hc-02, and there are strong indications that the working +group will depreciate HC1 from RFC4944 in the future.

    +
    +
    +

    2.2 MTU

    +

    IPv6 requires a minimum link MTU of 1280 octets in RFCXXX. Clearly, this is +much larger then the IEEE802.15.4 link MTU of 127 octets. RFC4944 defines +"layer 2.5" fragmentation which allow packets up to this MTU to be transfered +over small MTU links. While there are some issues have been raised with this +scheme, it seems likely to remain relatively unaltered.

    +
    +
    +

    2.3 Autoconfiguration

    +

    IPv6 stateless autoconfiguration as originally defined has some problems, +expecially once a "route over" network topology is established; for instance, +Duplicate Address Detection is likely to require some changes. A subcomittee +of the 6lowpan working group is currently investigating these issues is is +likely to propose adaptation mechanisms but they are currently in flux.

    +
    +
    +

    2.4 Routing

    +

    It is currently not possible to develop a standards-compliant routing layer, +as the relevant standards do not exist. Work in this direction is occuring in +the Roll working group, but a full specification is likely some way off.

    +
    +
    +
    +

    3. The TinyOS Way

    +

    As the previous sections have shown, many sensor network abstractions map well +into IPv6 mechanisms, with a significant gain in clarity of abstraction. +However, standards are currently unavailable to specifiy exactly how this +should be accomplished. Therefor, our position is that TinyOS should move +quickly to incorporate existing techinques and standards into an IPv6 stack +where possible, while taking liberties with the standards when doing so +improves performance or simplifies implementation. Given that the standards +themselves are in a state of flux, having an open implementation which +demonstrates challenges and feasible mechaninisms is likely to be of +significant value.

    +

    The most important places where it may be necessary to move ahead of the +standards are the routing; an IPv6 stack with no routing will not be as useful +as one with it. One open question is weather we choose a routing algorithm +which functions in a completly decentralized fashion like AODV, OLSR, DYMO, +S4, or many existing protocols or choose one which imposes more hierarchy on +deployments. We do note that existing standards like Zigbee and WirelessHART +both contain multi-tier architectures with devices of differing capabilities. +This has also been a common deployment model in many applications, but it +limits the utility to places where this is possible. The correct long-term +answer is probably to support both types of routing.

    +
    +
    +

    4. Conclusion

    +

    This document is meant to introduce readers to the ways in which IPv6 +mechanisms can be used in a TinyOS-based sensor network deployment, and how +they relate to previous work. It does not address any implementation issues, +which will be presented in a later TEP.

    +
    +
    +

    5. Authors

    +
    +
    Stephen Dawson-Haggerty
    +
    Computer Science Division
    +
    University of California, Berkeley
    +
    410 Soda Hall
    +
    Berkeley, CA 94701
    +

    + +

    +

    +
    Matus Harvan
    +
    Information Security
    +
    IFW C 48.1
    +
    ETH Zentrum
    +
    Haldeneggsteig 4
    +
    8092 Zurich
    +
    Switzerland
    +

    +
    phone - +41 44 63 26876
    + +

    +

    +
    Omprakash Gnawali
    +
    Ronald Tutor Hall (RTH) 418
    +
    3710 S. McClintock Avenue
    +
    Los Angeles, CA 90089
    +

    +
    phone - +1 213 821-5627
    + +
    +
    +
    +

    6. References

    +
    +
    + + diff --git a/doc/html/tep137.html b/doc/html/tep137.html new file mode 100644 index 00000000..fd53e012 --- /dev/null +++ b/doc/html/tep137.html @@ -0,0 +1,563 @@ + + + + + + +Traffic Control + + + + +
    +

    Traffic Control

    + +++ + + + + + + + + + + + + + + + + + + + + + +
    TEP:137
    Group:Core Working Group
    Type:Documentary
    Status:Draft
    TinyOS-Version:2.x
    Author:David Moss, Mark Hays, and Mark Siner
    Draft-Created:3-Sept-2009
    Draft-Version:1.0
    Draft-Modified:2009-09-30
    Draft-Discuss:TinyOS Developer List <tinyos-devel at mail.millennium.berkeley.edu>
    +
    +

    Note

    +

    This memo documents a part of TinyOS for the TinyOS Community, and +requests discussion and suggestions for improvements. Distribution +of this memo is unlimited. This memo is in full compliance with +TEP 1.

    +
    +
    +

    Abstract

    +

    This memo proposes traffic control interfaces to be provided by an optional +traffic control layer integrated at the highest levels of communication +stacks. These traffic control mechanisms are targeted to help improve acknowledgment +success rate, energy efficiency, fairness, and routing reliability on +any wireless platform. The available reference implementation is a platform +independent radio stack layer designed to consume a very small memory footprint.

    +
    +
    +

    1. Introduction

    +

    As the traffic rate of a wireless sensor network increases, the probability +of collision, dropped packets, and missed acknowledgments also increases, +even with sophisticated CSMA/CA implementations.

    +

    It is important, especially in the case mesh networks, for packets to be +delivered reliably and acknowledgments to be returned successfully on a hop-by- +hop basis. One method to improve reliability is to reduce the rate of +transmissions from each node within the network.

    +

    Traffic Control has been in use for years in many different wired and wireless +applications[1]_,[2]_,[3]_. TinyOS already has traffic control +mechanisms integrated directly into some networking libraries, such as CTP[4]_ +and Dissemination[5]_. The use of Trickle[6]_ algorithms, also used +within CTP and Dissemination, further reduces the rate of traffic throughout a +network to improve delivery performance and prevent livelock. There has +yet to be a centralized method of traffic control that throttles traffic +generated from any component of a user's application.

    +

    The traffic control interfaces proposed in this TEP are very basic, and are +intended to support many different traffic control implementations. +Two interfaces assist the application layer in controlling behavior: +TrafficControl and TrafficPriority.

    +

    The reference implementation presented here is integrated as a optional and +generic radio stack layer (providing a Send and using a SubSend interface) and +uses acknowledgments to dynamically adjust the transmit throttle. Other traffic +control implementations could employ more sophisticated techniques to control +throughput, but likely at the cost of a larger memory footprint.

    +

    The ultimate goal is to allow developers to use mesh networking protocols and/or +their own protocols without having to worry about implementing any kind of +traffic control timer mechanism for each separate component.

    +
    +
    +

    2. Desired Behavior

    +

    Ideally, a traffic control layer SHOULD attempt to balance the rate of +transmissions from a single node with the channel throughput capacity. +This implies an adaptive control mechanism. If the channel is +busy, nodes should add delay between packets to let other nodes transmit. +Similarly, if the channel is not busy, a node should be allowed access to +the channel more often to prevent inefficient channel downtime. Traffic +control SHOULD NOT listen to the channel for long periods of time to determine +the appropriate access rates, because that defeats the purpose of low power +communications layers used elsewhere.

    +

    The traffic control implementation SHOULD have the option to be activated or +deactivated on a system-wide level as well as a packet level. This allows for +individual high or low priority packets. Traffic control SHOULD be deactivated +by default, until the application or networking layers explicitly enable it.

    +

    Finally, the traffic control mechanism SHOULD be small in code size to fit +on the limited program memory available on most wireless platforms. There +SHOULD NOT be additions or modifications to a packet's metadata structure +that enables or disables traffic control on a per-packet basis; +instead, per-packet priorities SHOULD be performed with a request/call back +procedure. This keeps RAM requirements low and can be optimized out at compile +time if those functions are not used.

    +

    We also recommend any traffic control layer be implemented as an optional +compile time add-on to a core radio stack or within the ActiveMessageC platform +communication stack definition. This allows applications that do not require +traffic control to remove its memory footprint from the system.

    +
    +
    +

    3. TrafficControlC Component Signature

    +

    The signature of TrafficControlC is RECOMMENDED as follows:

    +
    +configuration TrafficControlC {
    +  provides {
    +    interface Send;
    +    interface TrafficControl;
    +    interface TrafficPriority[am_id_t amId];
    +  }
    +
    +  uses {
    +    interface Send as SubSend;
    +  }
    +}
    +
    +

    The Send interface provided on top and SubSend interface used underneath +allow the TrafficControlC component to be integrated as a generic layer +within any radio stack.

    +
    +
    +

    4. TrafficControl Interface

    +

    The TrafficControl interface allows the application layer to enable or +disable traffic control from a system-wide level. It also +allows an application to set and get the current delay between packets. +For most systems, we expect that the setDelay() and getDelay() commands may not be +used often and will most likely get optimized out at compile time; however, some +systems may care to explicitly increase or decrease the delay between packets or +collect statistics on how the traffic control layer is performing.

    +

    The TEP proposes the following TrafficControl interface:

    +
    +interface TrafficControl {
    +
    +  command void enable(bool active);
    +
    +  command void setDelay(uint16_t delay);
    +
    +  command uint16_t getDelay();
    +
    +}
    +
    +
    +
    +

    5. TrafficPriority Interface

    +

    The TrafficPriority interface is parameterized by active message ID. It is a +simple request / call back interface that allows components in the application layer to +configure individual packets for priorities on a scale from 0 (lowest priority, default) to +5 (highest priority, get the packet out immediately). There are several advantages +to this call back method. Metadata does not need to be added +to the end of every message_t. Additionally, a component that captures a requestPriority(...) +event is not required to adjust the priority as it would if the event returned +a value.

    +

    When a packet enters the traffic control layer, and traffic control is +enabled, the TrafficPriority interface MUST signal out the event +requestPriority(...). This event, with all the extra information it provides, +allows the application layer to decide whether the packet is a high priority +packet or not. Calling the setPriority(uint8_t priority) command within the +requestPriority(...) event MAY adjust the traffic control mechanisms applied +to the current packet. To aid in the definition of priority, two definitions +are available in TrafficControl.h:

    +
    +enum {
    +  TRAFFICPRIORITY_LOWEST = 0,
    +  TRAFFICPRIORITY_HIGHEST = 5,
    +};
    +
    +

    It is up to the traffic control implementation to define the meaning of each priority +level. In the reference implementation, a priority of 0 +is the default low priority level that employs the full traffic control delays. +Anything above 0 in the reference implementation is considered to be at the +highest priority.

    +

    If no areas of the application layer care to change the +packet's priority, a default event handler will capture the requestPriority(...) +event and do nothing. This would result in all packets being sent at a low +priority with full traffic control mechanisms enforced.

    +

    The TEP proposes the following TrafficPriority interface, to be provided as an +interface parameterized by AM type:

    +
    +interface TrafficPriority {
    +
    +  event void requestPriority(am_addr_t destination, message_t \*msg);
    +
    +  command void setPriority(uint8_t priority);
    +
    +}
    +
    +
    +
    +

    6. Reference Implementation

    +

    An implementation of the proposed traffic control layer can be found in the +CCxx00 radio stack in +tinyos-2.x-contrib/blaze/tos/chips/ccxx00_addons/trafficcontrol, with +interfaces located in +tinyos-2.x-contrib/blaze/tos/chips/ccxx00_single/interfaces and a dummy +implementation located in +tinyos-2.x-contrib/blaze/tos/chips/ccxx00_single/traffic.

    +

    In this implementation, the default core radio stack (ccxx00_single) includes +an empty stub for traffic control. Users that wish to include the +traffic control implementation in their systems simply override the default +stub component with the ccxx00_addons/trafficcontrol directory.

    +

    The reference implementation works as follows. All nodes start with a default +of 4 seconds between each packet. Changes are made to the time between outbound +packets only when a unicast packet is sent with the request for acknowledgment +flag set. The reception of an acknowledgment is used as a basic indicator of +channel activity. For each acknowledgment received, the amount of time between +packets is decreased so the next packet will get sent faster. For each dropped +acknowledgment, the amount of time between packets increases, causing the +next packet to be sent later.

    +

    When the transmission rate reaches a boundary (1 second per packet per node +fastest, 10 seconds per packet per node slowest), it is reset to the default +rate of 4 seconds per packet per node. This prevents nodes from unfairly +capturing the channel.

    +

    Testing this traffic control layer in a congested test bed setting of 16 nodes +with multiple hidden terminals resulted in the acknowledgment success rate +moving from 27-50% without traffic control to 90-100% with traffic control. +The memory footprint increased by 260 bytes ROM / 16 bytes RAM with the +inclusion of the traffic control layer.

    +
    +
    +

    5. Author Addresses

    +
    +
    David Moss
    +
    Rincon Research Corporation
    +
    101 N. Wilmot Suite 101
    +
    Tucson AZ 85750
    +
    email: mossmoss at gmail dot com
    +

    +
    Mark Hays
    +
    Rincon Research Corporation
    +
    101 N. Wilmot Suite 101
    +
    Tucson AZ 85750
    +
    email: mhh at rincon dot com
    +

    +
    Mark Siner
    +
    Rincon Research Corporation
    +
    101 N. Wilmot, Suite 101
    +
    Tucson, AZ 85750
    +
    email: mks at rincon dot com
    +
    +
    +
    +

    6. Citations

    + + + + + +
    [1]Bret Hull, Kyle Jamieson, Hari Balakrishnan. "Mitigating Congestion in Wireless Sensor Networks." In the Proceedings of the ACM Sensys Conference 2004
    + + + + + +
    [2]Wan, C.-Y., Eisenman, S., and Campbell, A. "CODA: Congestion Detection and Avoidance in Sensor Networks." In the Proceedings of the ACM Sensys Conference 2003
    + + + + + +
    [3]Woo, A., and Culler, D. "A Transmission Control Scheme for Media Access in Sensor Networks." In ACM MOBICOM 2001
    + + + + + +
    [4]Rodrigo Fonseca, Omprakash Gnawali, Kyle Jamieson, Sukun Kim, Philip Levis, and Alec Woo.. "TEP123: Collection Tree Protocol"
    + + + + + +
    [5]Philip Levis and Gilman Tolle. "TEP118: Dissemination of Small Values."
    + + + + + +
    [6]Philip Levis, Neil Patel, David Culler, and Scott Shenker. "Trickle: A Self-Regulating Algorithm for Code Maintenance and Propagation in Wireless Sensor Networks." In Proceedings of the First USENIX/ACM Symposium on Networked Systems Design and Implementation (NSDI 2004).
    +
    +
    + + diff --git a/doc/html/tep2.html b/doc/html/tep2.html index 4c876ac7..dcfa7ff3 100644 --- a/doc/html/tep2.html +++ b/doc/html/tep2.html @@ -3,7 +3,7 @@ - + Hardware Abstraction Architecture