[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/imote2/test/TestTimeSync
Makefile, NONE, 1.1 TestTimeSync.txt, NONE,
1.1 TestTimeSyncC.nc, NONE, 1.1 TestTimeSyncPollerC.nc, NONE,
1.1 TestTimeSyncPollerM.nc, NONE, 1.1 TestTimeSyncPollerMsg.h,
NONE, 1.1 TimeReportMsg.h, NONE, 1.1 TimeSyncDebuggerC.nc,
NONE, 1.1 TimeSyncDebuggerM.nc, NONE, 1.1
Lama Nachman
lnachman at users.sourceforge.net
Mon Oct 23 19:57:54 PDT 2006
Update of /cvsroot/tinyos/tinyos-1.x/contrib/imote2/test/TestTimeSync
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv5204
Added Files:
Makefile TestTimeSync.txt TestTimeSyncC.nc
TestTimeSyncPollerC.nc TestTimeSyncPollerM.nc
TestTimeSyncPollerMsg.h TimeReportMsg.h TimeSyncDebuggerC.nc
TimeSyncDebuggerM.nc
Log Message:
Added TimeSync support
--- NEW FILE: Makefile ---
################################################################################
# supported platforms: mica2,
# mica2dot,
# micaZ (only TIMESYNC_SYSTIME),
# telos
#
# the following directives are recognized by TimeSync component
#
# -DTIMESYNC_DEBUG: enforces multiple hops in software
# -DTIMESYNC_SYSTIME: choice of clock source(1MHz internal, or 32kHz external)
#
################################################################################
#period of timesync msg broadcast and the period of reference broadcast
PFLAGS += -DTIMESYNC_RATE=30 -DTIMESYNC_POLLER_RATE=10 -DTIMESYNC_SYSTIME
PFLAGS += -DPLATFORM_IMOTE2
# -DTIMESYNC_DIAG_POLLER: response to poller is diag msg, otherwise regular msg
# warning! DiagMsgC does not work corretctly for telos platform!
ifdef TIMESYNC_DIAG_POLLER
PFLAGS += -I%T/lib/DiagMsg -DTIMESYNC_DIAG_POLLER
endif
#path to the vanderbilt TimeSync component
#PFLAGS += -I%T/lib/TimeSync
PFLAGS += -I../../tos/lib/TimeSync -I../../tos/interfaces
############################ SPECIFY COMPONENT FILE ###########################
ifndef COMPONENT
COMPONENT=TestTimeSyncC
# COMPONENT=TestTimeSyncPollerC
endif
include ../Makerules
--- NEW FILE: TestTimeSync.txt ---
-------------------------------------------------------------------------------
Author/Contact:
---------------
Brano Kusy: kusy at isis.vanderbilt.edu
Miklos Maroti
-------------------------------------------------------------------------------
Conventions:
------------
TINYOS - the directory where you store the tinyos-1.x release
ISIS - the directory of vu tinyos structure i.e. TINYOS/contrib/vu
-------------------------------------------------------------------------------
DESCRIPTION:
------------
TestTimeSync component verifies the precision of our timesync (ISIS/tos/lib/
TimeSync). TestTimeSyncPoller is a beacon (reference broadcaster). Each client
(TestTimeSync app) responds to the beacon's radio msgs by sending data to base
station (TOSBase). The base station forwards data to the PC in DiagMSG format
or as a regular radio msg (TIMESYNC_DIAG_POLLER flag). More information about
the DiagMSGs and how to display them can be found in TINYOS/tos/lib/DiagMsg.
We propose the following test scenario:
- one base station (TOSBase) connected to a PC. On the PC side you should:
a) run an application that can decode DiagMSGs, if DIAG_POLLER is defined,
b) parse radio msg 0xb0 that contains struct data_t in the msg body, if
DIAG_POLLER is not defined.
- one dedicated beacon (TestTimeSyncPollerC) broadcasts TimeSyncPoll msgs
- several clients (TestTimeSyncC) use 1) TimeSyncC component that provides
timesync, and 2) TimeSyncDebuggerC component that handles sending data to a
base station. The format of this data is DiagMSG (see TINYOS/tos/lib/DiagMsg),
or TOS_Msg (AM_HNDLR=0xb0).
For testing purposes, probably the he most important part of the reported data
is the global time of arrival of the beacon's message. The beacon radio msg
arrives to all clients at the same time instant, therefore the reported global
times of different clients should be the same, if time sync works properly.
-------------------------------------------------------------------------------
REPORTED DATA:
--------------
Each message that is sent back to the base station contains:
- the node ID of the mote that is sending this report (uint16_t)
- the sequence number of the polling message that is increased by the poller
for each new polling msg (uint16_t)
- the global time when the polling message is arrived (uint32_t)
- the local time of the mote when the polling message is arrived (uint32_t)
- the skew (the speed ratio between the clocks of the root of the network and
the receiving node). Note, this value is normalized to 0, so 0 means that
the two clocks run with the same speed. (float)
- the boolean value saying whether the node is synchronized or not. If a node
is not synchronized, the global time is not to be considered valid (uint8_t)
- the id of the root of the time sync multi-hop algorithm. (uint16_t)
- the sequence number of the last time synchronizataion msg received from the
current root (uint8_t)
- the number of entries currently stored in the linear regression table
(uint8_t)
-------------------------------------------------------------------------------
TUNABLE PARAMETERS:
-------------------
(also see ISIS/tos/lib/TimeSync/TimeSync.txt)
TIMESYNC_RATE (seconds) - how often will each node transmit the time sync msg
TIMESYNC_SYSTIME - if defined, the faster CPU (7MHz) clock is used,
otherwise 32k external crystal is used
TIMESYNC_DEBUG - if defined, the multi-hop network is enforced by software
TIMESYNC_POLLER_RATE - how often will the poller send the beacon message
TIMESYNC_DIAG_POLLER - if defined, base station receives reported data in diag
msg format; if not defined, data reported as TOS_Msg
-------------------------------------------------------------------------------
STEP BY STEP GUIDE TO RUN OUR TEST SCENARIO:
--------------------------------------------
1. upload 1 node with TINYOS/apps/TOSBase application(node id is not important)
2. upload 1 node with ISIS/apps/TestTimeSync/TestTimeSyncPollerC application
2a) set TIMESYNC_POLLER_RATE
2b) modify Makefile to contain COMPONENT=TestTimeSyncPollerC;
2c) make mica2 install; node id is again not important
3. upload n (we used n=64) nodes with ISIS/apps/TestTimeSync/TestTimeSyncC app:
3a) set TIMESYNC_RATE, TIMESYNC_SYSTIME, TIMESYNC_DEBUG, or TIMESYNC_DIAG_POLLER
3b) modify Makefile to contain COMPONENT=TestTimeSyncC
3c) make mica2 install.addr where addr is unique address, be careful if using
TIMESYNC_DEBUG option, to keep your network connected(in our 64 mote scenario
we programmed motes with these addrs: 0x5ij; i,j={0,1,...,7} and using 0x444
instead of 0x544; this forms 8x8 grid with the maximum hop distance of 4 - the
root 0x444 is in the middle, see our SenSys paper for similar scenario)
4. place all 64 nodes within the radio range of TOSBase and TestTimeSyncPoller
and switch on the nodes, the base station should start receiving time sync
messages from each of 64 nodes with TIMESYNC_RATE period after initial delay of
ROOT_TIMEOUT*TIMESYNC_RATE, time sync poller messages with POLLER_INTERRUPT_RATE
period and DiagMSGs(AM=0xb1)/TOS_Msg(AM=0xb0) which are responds to the poller msg.
5. run some of the java applications to decode incoming DiagMSGs (TINYOS/tos/
lib/DiagMsg), or mcenter/MessageCenter to parse 0xb0 TOS_Msg
e.g.: java net.tinyos.tools.PrintDiagMsgs
for evaluation info, see our technical report at
https://www.isis.vanderbilt.edu/projects/nest/documentation/Vanderbilt_NEST_TimeSynch.pdf
or our SenSys'04 paper
--- NEW FILE: TestTimeSyncC.nc ---
/*
* 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
* Date last modified: 3/17/03
*/
configuration TestTimeSyncC {
}
implementation {
components Main, TimeSyncC, TimerC, GenericComm, TimeSyncDebuggerC;
Main.StdControl -> TimerC;
Main.StdControl -> GenericComm;
Main.StdControl -> TimeSyncC;
Main.StdControl -> TimeSyncDebuggerC;
}
--- NEW FILE: TestTimeSyncPollerC.nc ---
/*
* 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
* Date last modified: 3/17/03
*/
includes TestTimeSyncPollerMsg;
configuration TestTimeSyncPollerC
{
}
implementation
{
components TestTimeSyncPollerM, Main, GenericComm, TimerC, LedsC;
Main.StdControl -> TestTimeSyncPollerM;
Main.StdControl -> GenericComm;
Main.StdControl -> TimerC;
TestTimeSyncPollerM.SendMsg -> GenericComm.SendMsg[AM_TIMESYNCPOLL];
TestTimeSyncPollerM.ReceiveMsg -> GenericComm.ReceiveMsg[AM_DIAGMSG-1];
TestTimeSyncPollerM.Timer -> TimerC.Timer[unique("Timer")];
TestTimeSyncPollerM.Leds -> LedsC;
}
--- NEW FILE: TestTimeSyncPollerM.nc ---
/*
* Copyright (c) 2002, Vanderbilt University
* All rights reserved.
* Author: Brano Kusy (branislav.kusy at vanderbilt.edu)
* Date last modified: July04
*/
includes Timer;
includes TestTimeSyncPollerMsg;
includes trace;
includes TimeReportMsg;
module TestTimeSyncPollerM
{
provides
{
interface StdControl;
}
uses
{
interface SendMsg;
interface ReceiveMsg;
interface Timer;
interface Leds;
}
}
implementation
{
TOS_Msg msg;
uint8_t last_id;
uint32_t min,max;
#define TimeSyncPollMsg ((TimeSyncPoll *)(msg.data))
#ifndef TIMESYNC_POLLER_RATE
#define TIMESYNC_POLLER_RATE 100
#endif
#define TIMESYNC_POLLER_RATE 11
command result_t StdControl.init(){
call Leds.init();
TimeSyncPollMsg->senderAddr = TOS_LOCAL_ADDRESS;
TimeSyncPollMsg->msgID = 0;
return SUCCESS;
}
command result_t StdControl.start(){
call Timer.start(TIMER_REPEAT, (uint32_t)1000 * TIMESYNC_POLLER_RATE);
return SUCCESS;
}
command result_t StdControl.stop(){
return SUCCESS;
}
event result_t SendMsg.sendDone(TOS_MsgPtr p, result_t success){
call Leds.redToggle();
return SUCCESS;
}
event result_t Timer.fired(){
call SendMsg.send(TOS_BCAST_ADDR, TIMESYNCPOLL_LEN, &msg);
++(TimeSyncPollMsg->msgID);
return SUCCESS;
}
event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr p){
TimeReportMsg* ptr;
ptr = (TimeReportMsg*) (&p->data[0]);
trace(DBG_USR1, "\r\n%x %u %u %u %u %u %u %e %x %d %d %d",
ptr->nodeID, ptr->msgID, ptr->localClock, ptr->localClockHigh,
ptr->globalClock, ptr->globalClockHigh, ptr->is_synced,
ptr->skew, ptr->rootID, ptr->seqNum, ptr->numEntries, ptr->syncPeriod);
/*uint16_t *p_diagID = (uint16_t*) &(p->data[1]);
uint16_t *p_id = (uint16_t*) &(p->data[6]);
uint32_t *p_glob = (uint32_t*) &(p->data[8]);
if (*p_diagID != 1978)
return p;
if (*p_id == last_id){
if (*p_glob<min || min == 0)
min = *p_glob;
if (*p_glob>max || max == 0)
max = *p_glob;
}
else{
if ( (max-min) > 7 )
call Leds.set(7);
else
call Leds.set(max-min);
max=0;
min=0;
last_id=TimeSyncPollMsg->msgID;
}*/
return p;
}
}
--- NEW FILE: TestTimeSyncPollerMsg.h ---
/*
* 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: Brano Kusy, Miklos Maroti
* Date last modified: 03/12/03
*/
typedef struct TimeSyncPoll
{
uint16_t senderAddr;
uint16_t msgID;
}__attribute((packed)) TimeSyncPoll;
enum
{
AM_TIMESYNCPOLL = 0xBA,
AM_DIAGMSG = 0xB1,
TIMESYNCPOLL_LEN = sizeof(TimeSyncPoll),
};
--- NEW FILE: TimeReportMsg.h ---
#ifndef TIMEREPORTMSG_H
#define TIMEREPORTMSG_H
typedef struct TimeReportMsg{
uint16_t rootID;
uint16_t nodeID;
uint16_t msgID;
uint32_t globalClock;
uint32_t localClock;
float skew;
uint8_t is_synced;
uint8_t seqNum;
uint8_t numEntries;
uint8_t dummy;
uint16_t syncPeriod;
uint8_t globalClockHigh;
uint8_t localClockHigh;
} __attribute((packed)) TimeReportMsg;
#endif
--- NEW FILE: TimeSyncDebuggerC.nc ---
/*
* 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
* Date last modified: 3/17/03
*/
includes TestTimeSyncPollerMsg;
configuration TimeSyncDebuggerC
{
provides interface StdControl;
}
implementation
{
components TimeSyncDebuggerM, TimeSyncC, GenericComm,
#ifdef TIMESYNC_DIAG_POLLER
DiagMsgC,
#endif
TimerC, NoLeds as LedsC,
#ifdef PLATFORM_TELOS
TimeStampingC;
#elif TIMESYNC_SYSTIME
SysTimeStampingC as TimeStampingC;
#else
l ClockTimeStampingC as TimeStampingC;
#endif
StdControl = TimeSyncDebuggerM;
TimeSyncDebuggerM.ReceiveMsg -> GenericComm.ReceiveMsg[AM_TIMESYNCPOLL];
#ifdef TIMESYNC_DIAG_POLLER
TimeSyncDebuggerM.DiagMsg -> DiagMsgC;
#else
TimeSyncDebuggerM.SendMsg -> GenericComm.SendMsg[AM_DIAGMSG-1];
#endif
TimeSyncDebuggerM.Timer -> TimerC.Timer[unique("Timer")];
TimeSyncDebuggerM.GlobalTime -> TimeSyncC;
TimeSyncDebuggerM.TimeSyncInfo -> TimeSyncC;
TimeSyncDebuggerM.Leds -> LedsC;
TimeSyncDebuggerM.TimeStamping -> TimeStampingC;
}
--- NEW FILE: TimeSyncDebuggerM.nc ---
/*
* 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
* Date last modified: 03/17/03
*/
includes Timer;
includes TestTimeSyncPollerMsg;
includes trace;
includes TimeReportMsg;
module TimeSyncDebuggerM
{
provides
interface StdControl;
uses
{
interface GlobalTime;
interface TimeSyncInfo;
interface ReceiveMsg;
#ifdef TIMESYNC_DIAG_POLLER
interface DiagMsg;
#else
interface SendMsg;
#endif
interface Timer;
interface Leds;
interface TimeStamping;
}
}
implementation
{
TOS_Msg msg;
/*struct data_t{
uint16_t nodeID;
uint16_t msgID;
uint32_t globalClock;
uint32_t localClock;
float skew;
uint8_t is_synced;
uint8_t dumb_padding;
uint16_t rootID;
uint8_t seqNum;
uint8_t numEntries;
} data_t;
struct data_t d;*/
bool reporting;
command result_t StdControl.init() {
call Leds.init();
reporting = FALSE;
return SUCCESS;
}
command result_t StdControl.start() {
call Timer.start(TIMER_REPEAT, 11000);
return call Timer.start(TIMER_REPEAT, 11000); // every three seconds
}
command result_t StdControl.stop() {
return call Timer.stop();
}
task void report() {
if( reporting )
{
#ifdef TIMESYNC_DIAG_POLLER
if( call DiagMsg.record() == SUCCESS ){
call DiagMsg.uint16(d.nodeID);
call DiagMsg.uint16(d.msgID);
call DiagMsg.uint32(d.globalClock);
call DiagMsg.uint32(d.localClock);
call DiagMsg.real(d.skew);
call DiagMsg.uint8(d.is_synced);
call DiagMsg.uint16(d.rootID);
call DiagMsg.uint8(d.seqNum);
call DiagMsg.uint8(d.numEntries);
call DiagMsg.send();
}
reporting = FALSE;
#else
//trace(DBG_USR1,"Trying to report\r\n");
//memcpy( msg.data,&d,sizeof(data_t));
if (!call SendMsg.send(TOS_BCAST_ADDR, sizeof(TimeReportMsg), &msg)){
if(!post report())
reporting = FALSE;
}
#endif
}
}
#ifndef TIMESYNC_DIAG_POLLER
event result_t SendMsg.sendDone(TOS_MsgPtr ptr, result_t success){
//trace(DBG_USR1,"Reporting done\r\n");
reporting = FALSE;
return SUCCESS;
}
#endif
event result_t Timer.fired() {
if( reporting )
post report();
return SUCCESS;
}
event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr p)
{
TimeReportMsg* ptr;
uint32_t tLow, tHigh;
ptr = (TimeReportMsg*) (&msg.data[0]);
call TimeStamping.getStamp(&tLow, &tHigh);
ptr->localClock = tLow;
ptr->localClockHigh = (uint8_t) (tHigh & 0xff);
//call Leds.redToggle();
if( !reporting )
{
ptr->nodeID = TOS_LOCAL_ADDRESS;
ptr->msgID = ((TimeSyncPoll*)(p->data))->msgID;
ptr->is_synced = call GlobalTime.local2Global(&tLow, &tHigh);
ptr->globalClock = tLow;
ptr->globalClockHigh = (uint8_t) (tHigh & 0xff);
ptr->skew = call TimeSyncInfo.getSkew();
ptr->rootID = call TimeSyncInfo.getRootID();
ptr->seqNum = call TimeSyncInfo.getSeqNum();
ptr->numEntries = call TimeSyncInfo.getNumEntries();
ptr->syncPeriod = call TimeSyncInfo.getSyncPeriod();
//trace(DBG_USR1, "LC=%x GC=%u MID=%d\r\n", ptr->localClock,
// ptr->globalClock, ptr->msgID);
/* d.nodeID = TOS_LOCAL_ADDRESS;
d.msgID = ((TimeSyncPoll*)(p->data))->msgID;
d.localClock = call TimeStamping.getStamp();
d.globalClock = d.localClock;
d.is_synced = call GlobalTime.local2Global(&d.globalClock);
d.skew = call TimeSyncInfo.getSkew();
d.rootID = call TimeSyncInfo.getRootID();
d.seqNum = call TimeSyncInfo.getSeqNum();
d.numEntries = call TimeSyncInfo.getNumEntries();*/
reporting = TRUE;
}
return p;
}
}
More information about the Tinyos-contrib-commits
mailing list