[Tinyos-2-commits] CVS: tinyos-2.x/tos/platforms/eyesIFX
WideLocalTime.nc, NONE, 1.1 RadioDataLinkC.nc, 1.5,
1.6 LocalTimeP.nc, 1.1, 1.2 LocalTimeC.nc, 1.1, 1.2
akoepke
andreaskoepke at users.sourceforge.net
Wed Dec 5 02:14:57 PST 2007
Update of /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv6324
Modified Files:
RadioDataLinkC.nc LocalTimeP.nc LocalTimeC.nc
Added Files:
WideLocalTime.nc
Log Message:
add a 64 bit interface
--- NEW FILE: WideLocalTime.nc ---
/* -*- mode:c++; indent-tabs-mode:nil -*-
* Copyright (c) 2007, 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.
*/
/**
* A wide version of the localtime interface, 32 bit are too narrow
*/
#include "Timer.h"
interface WideLocalTime<precision_tag>
{
/**
* Return current time. Time starts counting at boot - some time sources
* may stop counting while the processor is in low-power mode.
*
* @return Current time.
*/
async command uint64_t get();
}
Index: RadioDataLinkC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/RadioDataLinkC.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RadioDataLinkC.nc 5 Apr 2007 06:38:45 -0000 1.5
--- RadioDataLinkC.nc 5 Dec 2007 10:14:55 -0000 1.6
***************
*** 52,59 ****
Uart4b6bPhyC as UartPhy, //The UartPhy turns Bits into Bytes
PacketSerializerP as PacketSerializer, //The PacketSerializer turns Bytes into Packets
! // RedMacC as Mac, //The MAC protocol to use
! CsmaMacC as Mac, //The MAC protocol to use
!
! LinkLayerC as Llc; //The Link Layer Control module to use
//Don't change wirings below this point, just change which components
--- 52,59 ----
Uart4b6bPhyC as UartPhy, //The UartPhy turns Bits into Bytes
PacketSerializerP as PacketSerializer, //The PacketSerializer turns Bytes into Packets
! RedMacC as Mac, //The MAC protocol to use
! // SpeckMacDC as Mac, //The MAC protocol to use
! // CsmaMacC as Mac, //The MAC protocol to use
! LinkLayerC as Llc; //The Link Layer Control module to use
//Don't change wirings below this point, just change which components
Index: LocalTimeP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/LocalTimeP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** LocalTimeP.nc 1 Oct 2007 15:48:58 -0000 1.1
--- LocalTimeP.nc 5 Dec 2007 10:14:55 -0000 1.2
***************
*** 31,34 ****
--- 31,35 ----
provides {
interface LocalTime<T32khz> as LocalTime32kHz;
+ interface WideLocalTime<T32khz> as WideLocalTime;
}
uses {
***************
*** 46,51 ****
} ui32parts_t;
! uint16_t counter2sec = 127;
async command uint32_t LocalTime32kHz.get() {
ui32parts_t time;
--- 47,62 ----
} ui32parts_t;
! typedef union
! {
! uint64_t op;
! struct {
! uint32_t lo;
! uint32_t hi;
! };
! } ui64parts_t;
+ uint16_t counter2sec = 127;
+ uint32_t dayCounter = 0;
+
async command uint32_t LocalTime32kHz.get() {
ui32parts_t time;
***************
*** 53,63 ****
time.lo = call Counter32khz16.get();
time.hi = counter2sec;
! if(call Counter32khz16.isOverflowPending()) ++time.hi;
}
return time.op;
}
async event void Counter32khz16.overflow() {
++counter2sec;
}
}
--- 64,86 ----
time.lo = call Counter32khz16.get();
time.hi = counter2sec;
! if(call Counter32khz16.isOverflowPending()) {
! time.hi++;
! }
}
return time.op;
}
+ async command uint64_t WideLocalTime.get() {
+ ui64parts_t time;
+ atomic {
+ time.lo = call LocalTime32kHz.get();
+ time.hi = dayCounter;
+ }
+ return time.op;
+ }
+
async event void Counter32khz16.overflow() {
++counter2sec;
+ if(counter2sec == 0) ++dayCounter;
}
}
Index: LocalTimeC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/LocalTimeC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** LocalTimeC.nc 1 Oct 2007 15:48:59 -0000 1.1
--- LocalTimeC.nc 5 Dec 2007 10:14:55 -0000 1.2
***************
*** 31,34 ****
--- 31,35 ----
provides {
interface LocalTime<T32khz> as LocalTime;
+ interface WideLocalTime<T32khz> as WideLocalTime;
}
}
***************
*** 36,39 ****
--- 37,41 ----
components LocalTimeP, Counter32khz16C as Counter;
LocalTime = LocalTimeP;
+ WideLocalTime = LocalTimeP;
LocalTimeP.Counter32khz16 -> Counter;
}
More information about the Tinyos-2-commits
mailing list