[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/tda5250/mac
TimeDiffC.nc, NONE, 1.1 TimeDiff32.nc, NONE, 1.1 TimeDiff16.nc,
NONE, 1.1 TimeDiff.nc, NONE, 1.1 SpeckMacDP.nc, 1.1,
1.2 SpeckMacDC.nc, 1.1, 1.2 RedMacP.nc, 1.13, 1.14 RedMacC.nc,
1.7, 1.8 CsmaMacP.nc, 1.13, 1.14 CsmaMacC.nc, 1.6, 1.7
akoepke
andreaskoepke at users.sourceforge.net
Mon Oct 1 10:58:12 PDT 2007
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/tda5250/mac
SpeckMacDP.nc, NONE, 1.1 SpeckMacDC.nc, NONE,
1.1 DuplicateP.nc, NONE, 1.1 DuplicateC.nc, NONE,
1.1 Duplicate.nc, NONE, 1.1 Duplicate.h, NONE, 1.1 RedMacP.nc,
1.12, 1.13 RedMacC.nc, 1.6, 1.7 CsmaMacP.nc, 1.12,
1.13 CsmaMacC.nc, 1.5, 1.6
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/atm128/i2c
Atm128I2CMasterPacketP.nc, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv22339
Modified Files:
SpeckMacDP.nc SpeckMacDC.nc RedMacP.nc RedMacC.nc CsmaMacP.nc
CsmaMacC.nc
Added Files:
TimeDiffC.nc TimeDiff32.nc TimeDiff16.nc TimeDiff.nc
Log Message:
refactor MAC protocols:
- separate time difference computation (need to pin point a bug)
--- NEW FILE: TimeDiffC.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.
*/
/**
* Implementation of timediff interface
* @author: Andreas Koepke (koepke at tkn.tu-berlin.de)
*/
module TimeDiffC {
provides {
interface TimeDiff32;
interface TimeDiff16;
}
}
implementation {
async command uint32_t TimeDiff32.computeDelta(uint32_t time_now, uint32_t time_past) {
uint32_t rval;
if(time_now >= time_past) {
rval = time_now - time_past;
}
else {
rval = (uint32_t)(-1) - time_past + time_now;
}
return rval;
}
async command uint16_t TimeDiff16.computeDelta(uint16_t time_now, uint16_t time_past) {
uint16_t rval;
if(time_now >= time_past) {
rval = time_now - time_past;
}
else {
rval = (uint16_t)(-1) - time_past + time_now;
}
return rval;
}
}
--- NEW FILE: TimeDiff32.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.
*/
/**
* Manipulate time differences, with overflow checking
* @author: Andreas Koepke (koepke at tkn.tu-berlin.de
*/
interface TimeDiff32 {
/** compute delta of two times (now - past),
checks for overflow assuming that now is always > past */
async command uint32_t computeDelta(uint32_t time_now, uint32_t time_past);
}
--- NEW FILE: TimeDiff16.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.
*/
/**
* Manipulate time differences, with overflow checking
* @author: Andreas Koepke (koepke at tkn.tu-berlin.de
*/
interface TimeDiff16 {
/** compute delta of two times (now - past),
checks for overflow assuming that now is always > past */
async command uint16_t computeDelta(uint16_t time_now, uint16_t time_past);
}
--- NEW FILE: TimeDiff.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.
*/
/**
* Manipulate time differences, with overflow checking
* @author: Andreas Koepke (koepke at tkn.tu-berlin.de
*/
interface TimeDiff {
/** compute delta of two times (now - past),
checks for overflow assuming that now is always > past */
async command uint32_t computeDelta(uint32_t time_now, uint32_t time_past);
}
Index: SpeckMacDP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/SpeckMacDP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SpeckMacDP.nc 1 Oct 2007 15:48:59 -0000 1.1
--- SpeckMacDP.nc 1 Oct 2007 17:58:07 -0000 1.2
***************
*** 74,77 ****
--- 74,79 ----
interface Duplicate;
+ interface TimeDiff16;
+ interface TimeDiff32;
async command am_addr_t amAddress();
***************
*** 475,489 ****
void interruptBackoffTimer() {
- uint16_t now;
if(call Timer.isRunning()) {
! restLaufzeit = call Timer.getAlarm();
! call Timer.stop();
! now = call Timer.getNow();
! if(restLaufzeit >= now) {
! restLaufzeit = restLaufzeit - now;
! }
! else {
! restLaufzeit = (uint16_t)(-1) - restLaufzeit + now;
! }
if(restLaufzeit > MIN_BACKOFF_MASK << MAX_LONG_RETRY) {
restLaufzeit = call Random.rand16() & ZERO_BACKOFF_MASK;
--- 477,483 ----
void interruptBackoffTimer() {
if(call Timer.isRunning()) {
! restLaufzeit = call TimeDiff16.computeDelta(call Timer.getAlarm(), call Timer.getNow());
! call Timer.stop();
if(restLaufzeit > MIN_BACKOFF_MASK << MAX_LONG_RETRY) {
restLaufzeit = call Random.rand16() & ZERO_BACKOFF_MASK;
***************
*** 1007,1023 ****
}
! async event void RadioTimeStamping.transmittedSFD( uint16_t time, message_t* p_msg ) {
! uint32_t now;
! uint32_t mTime;
if((macState == TX) && (p_msg == txBufPtr)) {
! now = call LocalTime32kHz.get();
! mTime = getMetadata(p_msg)->time;
! if(now >= mTime) {
! txMacHdr->time = now - mTime;
! }
! else {
! // assume a clock wrap here
! txMacHdr->time = (uint32_t)(-1) - mTime + now;
! }
}
}
--- 1001,1008 ----
}
! async event void RadioTimeStamping.transmittedSFD(uint16_t time, message_t* p_msg ) {
if((macState == TX) && (p_msg == txBufPtr)) {
! txMacHdr->time =
! call TimeDiff32.computeDelta(call LocalTime32kHz.get(), getMetadata(p_msg)->time);
}
}
Index: SpeckMacDC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/SpeckMacDC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SpeckMacDC.nc 1 Oct 2007 15:48:59 -0000 1.1
--- SpeckMacDC.nc 1 Oct 2007 17:58:07 -0000 1.2
***************
*** 65,69 ****
new Alarm32khz16C() as SampleTimer,
RandomLfsrC,
! LocalTimeC, DuplicateC;
components ActiveMessageAddressC;
--- 65,71 ----
new Alarm32khz16C() as SampleTimer,
RandomLfsrC,
! LocalTimeC,
! DuplicateC,
! TimeDiffC;
components ActiveMessageAddressC;
***************
*** 101,104 ****
--- 103,108 ----
SpeckMacDP.Duplicate -> DuplicateC;
+ SpeckMacDP.TimeDiff16 -> TimeDiffC;
+ SpeckMacDP.TimeDiff32 -> TimeDiffC;
/* components PlatformLedsC;
Index: RedMacP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/RedMacP.nc,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** RedMacP.nc 1 Oct 2007 15:48:59 -0000 1.13
--- RedMacP.nc 1 Oct 2007 17:58:07 -0000 1.14
***************
*** 75,78 ****
--- 75,80 ----
interface Duplicate;
+ interface TimeDiff16;
+ interface TimeDiff32;
async command am_addr_t amAddress();
***************
*** 486,500 ****
void interruptBackoffTimer() {
- uint16_t now;
if(call Timer.isRunning()) {
! restLaufzeit = call Timer.getAlarm();
! call Timer.stop();
! now = call Timer.getNow();
! if(restLaufzeit >= now) {
! restLaufzeit = restLaufzeit - now;
! }
! else {
! restLaufzeit = (uint16_t)(-1) - restLaufzeit + now;
! }
if(restLaufzeit > MIN_BACKOFF_MASK << MAX_LONG_RETRY) {
restLaufzeit = call Random.rand16() & ZERO_BACKOFF_MASK;
--- 488,494 ----
void interruptBackoffTimer() {
if(call Timer.isRunning()) {
! restLaufzeit = call TimeDiff16.computeDelta(call Timer.getAlarm(), call Timer.getNow());
! call Timer.stop();
if(restLaufzeit > MIN_BACKOFF_MASK << MAX_LONG_RETRY) {
restLaufzeit = call Random.rand16() & ZERO_BACKOFF_MASK;
***************
*** 1024,1039 ****
async event void RadioTimeStamping.transmittedSFD( uint16_t time, message_t* p_msg ) {
- uint32_t now;
- uint32_t mTime;
if((macState == TX) && (p_msg == txBufPtr)) {
! now = call LocalTime32kHz.get();
! mTime = getMetadata(p_msg)->time;
! if(now >= mTime) {
! txMacHdr->time = now - mTime;
! }
! else {
! // assume a clock wrap here
! txMacHdr->time = (uint32_t)(-1) - mTime + now;
! }
}
}
--- 1018,1024 ----
async event void RadioTimeStamping.transmittedSFD( uint16_t time, message_t* p_msg ) {
if((macState == TX) && (p_msg == txBufPtr)) {
! txMacHdr->time =
! call TimeDiff32.computeDelta(call LocalTime32kHz.get(), getMetadata(p_msg)->time);
}
}
Index: RedMacC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/RedMacC.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** RedMacC.nc 1 Oct 2007 15:48:59 -0000 1.7
--- RedMacC.nc 1 Oct 2007 17:58:07 -0000 1.8
***************
*** 64,68 ****
new Alarm32khz16C() as Timer,
new Alarm32khz16C() as SampleTimer,
! RandomLfsrC, LocalTimeC, DuplicateC;
components ActiveMessageAddressC;
--- 64,68 ----
new Alarm32khz16C() as Timer,
new Alarm32khz16C() as SampleTimer,
! RandomLfsrC, LocalTimeC, DuplicateC, TimeDiffC;
components ActiveMessageAddressC;
***************
*** 99,102 ****
--- 99,104 ----
RedMacP.Duplicate -> DuplicateC;
+ RedMacP.TimeDiff16 -> TimeDiffC;
+ RedMacP.TimeDiff32 -> TimeDiffC;
/* components PlatformLedsC;
Index: CsmaMacP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/CsmaMacP.nc,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** CsmaMacP.nc 1 Oct 2007 15:48:59 -0000 1.13
--- CsmaMacP.nc 1 Oct 2007 17:58:07 -0000 1.14
***************
*** 73,76 ****
--- 73,77 ----
interface Timer<TMilli> as ReRxTimer;
interface Duplicate;
+ interface TimeDiff16;
interface Alarm<T32khz, uint16_t> as Timer;
***************
*** 304,318 ****
void interruptBackoffTimer() {
- uint16_t now;
if(call Timer.isRunning()) {
! restLaufzeit = call Timer.getAlarm();
call Timer.stop();
- now = call Timer.getNow();
- if(restLaufzeit >= now) {
- restLaufzeit = restLaufzeit - now;
- }
- else {
- restLaufzeit = (uint16_t)(-1) - restLaufzeit + now;
- }
if(restLaufzeit > BACKOFF_MASK) {
restLaufzeit = call Random.rand16() & 0xFF;
--- 305,311 ----
void interruptBackoffTimer() {
if(call Timer.isRunning()) {
! restLaufzeit = call TimeDiff16.computeDelta(call Timer.getAlarm(), call Timer.getNow());
call Timer.stop();
if(restLaufzeit > BACKOFF_MASK) {
restLaufzeit = call Random.rand16() & 0xFF;
Index: CsmaMacC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/CsmaMacC.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** CsmaMacC.nc 1 Oct 2007 15:48:59 -0000 1.6
--- CsmaMacC.nc 1 Oct 2007 17:58:07 -0000 1.7
***************
*** 61,64 ****
--- 61,65 ----
new TimerMilliC() as ReRxTimer,
DuplicateC,
+ TimeDiffC,
RandomLfsrC
#ifdef MAC_DEBUG
***************
*** 100,103 ****
--- 101,105 ----
CsmaMacP.Duplicate -> DuplicateC;
+ CsmaMacP.TimeDiff16 -> TimeDiffC;
#ifdef MAC_DEBUG
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/tda5250/mac
SpeckMacDP.nc, NONE, 1.1 SpeckMacDC.nc, NONE,
1.1 DuplicateP.nc, NONE, 1.1 DuplicateC.nc, NONE,
1.1 Duplicate.nc, NONE, 1.1 Duplicate.h, NONE, 1.1 RedMacP.nc,
1.12, 1.13 RedMacC.nc, 1.6, 1.7 CsmaMacP.nc, 1.12,
1.13 CsmaMacC.nc, 1.5, 1.6
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/atm128/i2c
Atm128I2CMasterPacketP.nc, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list