[Tinyos-2-commits] CVS: tinyos-2.x/tos/platforms/eyesIFX
WideLocalTime.nc, 1.1, 1.2 RadioDataLinkC.nc, 1.6,
1.7 LocalTimeP.nc, 1.2, 1.3
akoepke
andreaskoepke at users.sourceforge.net
Thu Dec 6 10:32:13 PST 2007
Update of /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv15736
Modified Files:
WideLocalTime.nc RadioDataLinkC.nc LocalTimeP.nc
Log Message:
uff -- resolved hardware race conditions (hopefully)
Index: WideLocalTime.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/WideLocalTime.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** WideLocalTime.nc 5 Dec 2007 10:14:55 -0000 1.1
--- WideLocalTime.nc 6 Dec 2007 18:32:11 -0000 1.2
***************
*** 40,44 ****
* @return Current time.
*/
! async command uint64_t get();
}
--- 40,44 ----
* @return Current time.
*/
! async command int64_t get();
}
Index: RadioDataLinkC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/RadioDataLinkC.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** RadioDataLinkC.nc 5 Dec 2007 10:14:55 -0000 1.6
--- RadioDataLinkC.nc 6 Dec 2007 18:32:11 -0000 1.7
***************
*** 52,58 ****
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
--- 52,58 ----
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
Index: LocalTimeP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/LocalTimeP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** LocalTimeP.nc 5 Dec 2007 10:14:55 -0000 1.2
--- LocalTimeP.nc 6 Dec 2007 18:32:11 -0000 1.3
***************
*** 38,81 ****
}
implementation {
! typedef union
! {
! uint32_t op;
! struct {
! uint16_t lo;
! uint16_t hi;
! };
! } 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;
atomic {
! 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;
}
--- 38,80 ----
}
implementation {
! uint16_t counter2sec = 40000U;
! int32_t dayCounter = 0;
! bool increaseDay = FALSE;
async command uint32_t LocalTime32kHz.get() {
! int64_t time;
! unsigned t;
! bool dirty1;
! bool dirty2;
atomic {
! increaseDay = FALSE;
! do {
! dirty1 = call Counter32khz16.isOverflowPending();
! t = call Counter32khz16.get();
! dirty2 = call Counter32khz16.isOverflowPending();
! } while (dirty1 != dirty2);
! time = counter2sec;
! if(dirty1) {
! ++time;
! if(time == 0) {
! increaseDay = TRUE;
! }
}
+ time = (time << 16) + t;
}
! return time;
}
! async command int64_t WideLocalTime.get() {
! int64_t time;
! uint32_t t;
atomic {
! t = call LocalTime32kHz.get();
! time = dayCounter;
! if(increaseDay) time++;
! if(time < 0) time = 0;
! time <<= 32;
! time += t;
}
! return time;
}
***************
*** 83,86 ****
--- 82,86 ----
++counter2sec;
if(counter2sec == 0) ++dayCounter;
+ if(dayCounter < 0) dayCounter = 0;
}
}
More information about the Tinyos-2-commits
mailing list