From 531a29c40625e51f0788a96c5fc9a001020f6789 Mon Sep 17 00:00:00 2001 From: mmaroti Date: Thu, 9 Apr 2009 21:26:39 +0000 Subject: [PATCH] move/create RF2xxTimeSyncMessageC to avoid future changes in platforms --- ...meSyncMessage.h => TimeSyncMessageLayer.h} | 6 +- ...ncMessageC.nc => TimeSyncMessageLayerC.nc} | 47 ++++++------- ...ncMessageP.nc => TimeSyncMessageLayerP.nc} | 5 +- tos/chips/rf2xx/rf212/RF212DriverLayerP.nc | 2 +- .../rf2xx/rf212/RF212TimeSyncMessageC.nc | 68 +++++++++++++++++++ tos/chips/rf2xx/rf230/RF230DriverLayerP.nc | 2 +- .../rf2xx/rf230/RF230TimeSyncMessageC.nc | 68 +++++++++++++++++++ tos/platforms/iris/ActiveMessageC.nc | 18 +++-- tos/platforms/iris/TimeSyncMessageC.nc | 5 +- 9 files changed, 178 insertions(+), 43 deletions(-) rename tos/chips/rf2xx/layers/{GenericTimeSyncMessage.h => TimeSyncMessageLayer.h} (91%) rename tos/chips/rf2xx/layers/{GenericTimeSyncMessageC.nc => TimeSyncMessageLayerC.nc} (61%) rename tos/chips/rf2xx/layers/{GenericTimeSyncMessageP.nc => TimeSyncMessageLayerP.nc} (98%) create mode 100644 tos/chips/rf2xx/rf212/RF212TimeSyncMessageC.nc create mode 100644 tos/chips/rf2xx/rf230/RF230TimeSyncMessageC.nc diff --git a/tos/chips/rf2xx/layers/GenericTimeSyncMessage.h b/tos/chips/rf2xx/layers/TimeSyncMessageLayer.h similarity index 91% rename from tos/chips/rf2xx/layers/GenericTimeSyncMessage.h rename to tos/chips/rf2xx/layers/TimeSyncMessageLayer.h index 6f2247ff..51e3842c 100644 --- a/tos/chips/rf2xx/layers/GenericTimeSyncMessage.h +++ b/tos/chips/rf2xx/layers/TimeSyncMessageLayer.h @@ -21,8 +21,8 @@ * Author: Miklos Maroti */ -#ifndef __GENERICTIMESYNCMESSAGE_H__ -#define __GENERICTIMESYNCMESSAGE_H__ +#ifndef __TIMESYNCMESSAGELAYER_H__ +#define __TIMESYNCMESSAGELAYER_H__ // this value is sent in the air typedef nx_int32_t timesync_relative_t; @@ -30,4 +30,4 @@ typedef nx_int32_t timesync_relative_t; // this value is stored in memory typedef uint32_t timesync_absolute_t; -#endif//__GENERICTIMESYNCMESSAGE_H__ +#endif//__TIMESYNCMESSAGELAYER_H__ diff --git a/tos/chips/rf2xx/layers/GenericTimeSyncMessageC.nc b/tos/chips/rf2xx/layers/TimeSyncMessageLayerC.nc similarity index 61% rename from tos/chips/rf2xx/layers/GenericTimeSyncMessageC.nc rename to tos/chips/rf2xx/layers/TimeSyncMessageLayerC.nc index d684a83e..808e0ab9 100644 --- a/tos/chips/rf2xx/layers/GenericTimeSyncMessageC.nc +++ b/tos/chips/rf2xx/layers/TimeSyncMessageLayerC.nc @@ -25,16 +25,11 @@ #include #include -configuration GenericTimeSyncMessageC +configuration TimeSyncMessageLayerC { provides { - interface SplitControl; - - interface Receive[uint8_t id]; - interface Receive as Snoop[am_id_t id]; interface Packet; - interface AMPacket; interface TimeSyncAMSend as TimeSyncAMSendRadio[am_id_t id]; interface TimeSyncPacket as TimeSyncPacketRadio; @@ -45,34 +40,36 @@ configuration GenericTimeSyncMessageC uses { - interface PacketField as PacketTimeSyncOffset; + interface PacketTimeStamp as PacketTimeStampRadio; + interface PacketTimeStamp as PacketTimeStampMilli; + interface LocalTime as LocalTimeRadio; + interface PacketField as PacketTimeSyncOffset; + + interface AMSend as SubSend[am_id_t id]; + interface Packet as SubPacket; } } implementation { - components GenericTimeSyncMessageP, ActiveMessageC, LocalTimeMilliC; - - TimeSyncAMSendRadio = GenericTimeSyncMessageP; - TimeSyncPacketRadio = GenericTimeSyncMessageP; + components TimeSyncMessageLayerP, LocalTimeMilliC; - TimeSyncAMSendMilli = GenericTimeSyncMessageP; - TimeSyncPacketMilli = GenericTimeSyncMessageP; + Packet = TimeSyncMessageLayerP; - Packet = GenericTimeSyncMessageP; - GenericTimeSyncMessageP.SubSend -> ActiveMessageC.AMSend; - GenericTimeSyncMessageP.SubPacket -> ActiveMessageC.Packet; + TimeSyncAMSendRadio = TimeSyncMessageLayerP; + TimeSyncPacketRadio = TimeSyncMessageLayerP; - GenericTimeSyncMessageP.PacketTimeStampRadio -> ActiveMessageC; - GenericTimeSyncMessageP.PacketTimeStampMilli -> ActiveMessageC; - GenericTimeSyncMessageP.LocalTimeRadio = LocalTimeRadio; - GenericTimeSyncMessageP.LocalTimeMilli -> LocalTimeMilliC; + TimeSyncAMSendMilli = TimeSyncMessageLayerP; + TimeSyncPacketMilli = TimeSyncMessageLayerP; - GenericTimeSyncMessageP.PacketTimeSyncOffset = PacketTimeSyncOffset; + SubSend = TimeSyncMessageLayerP; + SubPacket = TimeSyncMessageLayerP; - SplitControl = ActiveMessageC; - Receive = ActiveMessageC.Receive; - Snoop = ActiveMessageC.Snoop; - AMPacket = ActiveMessageC; + PacketTimeStampRadio = TimeSyncMessageLayerP; + PacketTimeStampMilli = TimeSyncMessageLayerP; + + TimeSyncMessageLayerP.LocalTimeMilli -> LocalTimeMilliC; + LocalTimeRadio = TimeSyncMessageLayerP; + PacketTimeSyncOffset = TimeSyncMessageLayerP; } diff --git a/tos/chips/rf2xx/layers/GenericTimeSyncMessageP.nc b/tos/chips/rf2xx/layers/TimeSyncMessageLayerP.nc similarity index 98% rename from tos/chips/rf2xx/layers/GenericTimeSyncMessageP.nc rename to tos/chips/rf2xx/layers/TimeSyncMessageLayerP.nc index 3ebd71d5..e6153319 100644 --- a/tos/chips/rf2xx/layers/GenericTimeSyncMessageP.nc +++ b/tos/chips/rf2xx/layers/TimeSyncMessageLayerP.nc @@ -21,10 +21,9 @@ * Author: Miklos Maroti */ -#include -#include +#include -module GenericTimeSyncMessageP +module TimeSyncMessageLayerP { provides { diff --git a/tos/chips/rf2xx/rf212/RF212DriverLayerP.nc b/tos/chips/rf2xx/rf212/RF212DriverLayerP.nc index 616292df..d76e1628 100644 --- a/tos/chips/rf2xx/rf212/RF212DriverLayerP.nc +++ b/tos/chips/rf2xx/rf212/RF212DriverLayerP.nc @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include module RF212DriverLayerP diff --git a/tos/chips/rf2xx/rf212/RF212TimeSyncMessageC.nc b/tos/chips/rf2xx/rf212/RF212TimeSyncMessageC.nc new file mode 100644 index 00000000..c066441b --- /dev/null +++ b/tos/chips/rf2xx/rf212/RF212TimeSyncMessageC.nc @@ -0,0 +1,68 @@ +/* + * 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: Miklos Maroti + */ + +#include + +configuration RF212TimeSyncMessageC +{ + provides + { + interface SplitControl; + interface Receive[uint8_t id]; + interface Receive as Snoop[am_id_t id]; + interface AMPacket; + + interface Packet; + + interface TimeSyncAMSend as TimeSyncAMSendRadio[am_id_t id]; + interface TimeSyncPacket as TimeSyncPacketRadio; + + interface TimeSyncAMSend as TimeSyncAMSendMilli[am_id_t id]; + interface TimeSyncPacket as TimeSyncPacketMilli; + } +} + +implementation +{ + components RF212DriverLayerC, RF212ActiveMessageC, TimeSyncMessageLayerC; + + SplitControl = RF212ActiveMessageC; + Receive = RF212ActiveMessageC.Receive; + Snoop = RF212ActiveMessageC.Snoop; + AMPacket = RF212ActiveMessageC; + Packet = TimeSyncMessageLayerC; + + TimeSyncAMSendRadio = TimeSyncMessageLayerC; + TimeSyncPacketRadio = TimeSyncMessageLayerC; + TimeSyncAMSendMilli = TimeSyncMessageLayerC; + TimeSyncPacketMilli = TimeSyncMessageLayerC; + + TimeSyncMessageLayerC.SubSend -> RF212ActiveMessageC; + TimeSyncMessageLayerC.SubPacket -> RF212ActiveMessageC; + + TimeSyncMessageLayerC.PacketTimeStampRadio -> RF212ActiveMessageC; + TimeSyncMessageLayerC.PacketTimeStampMilli -> RF212ActiveMessageC; + + TimeSyncMessageLayerC.LocalTimeRadio -> RF212DriverLayerC; + TimeSyncMessageLayerC.PacketTimeSyncOffset -> RF212DriverLayerC.PacketTimeSyncOffset; +} diff --git a/tos/chips/rf2xx/rf230/RF230DriverLayerP.nc b/tos/chips/rf2xx/rf230/RF230DriverLayerP.nc index 6f74fb16..662b5a41 100644 --- a/tos/chips/rf2xx/rf230/RF230DriverLayerP.nc +++ b/tos/chips/rf2xx/rf230/RF230DriverLayerP.nc @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include module RF230DriverLayerP diff --git a/tos/chips/rf2xx/rf230/RF230TimeSyncMessageC.nc b/tos/chips/rf2xx/rf230/RF230TimeSyncMessageC.nc new file mode 100644 index 00000000..2d7f495c --- /dev/null +++ b/tos/chips/rf2xx/rf230/RF230TimeSyncMessageC.nc @@ -0,0 +1,68 @@ +/* + * 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: Miklos Maroti + */ + +#include + +configuration RF230TimeSyncMessageC +{ + provides + { + interface SplitControl; + interface Receive[uint8_t id]; + interface Receive as Snoop[am_id_t id]; + interface AMPacket; + + interface Packet; + + interface TimeSyncAMSend as TimeSyncAMSendRadio[am_id_t id]; + interface TimeSyncPacket as TimeSyncPacketRadio; + + interface TimeSyncAMSend as TimeSyncAMSendMilli[am_id_t id]; + interface TimeSyncPacket as TimeSyncPacketMilli; + } +} + +implementation +{ + components RF230DriverLayerC, RF230ActiveMessageC, TimeSyncMessageLayerC; + + SplitControl = RF230ActiveMessageC; + Receive = RF230ActiveMessageC.Receive; + Snoop = RF230ActiveMessageC.Snoop; + AMPacket = RF230ActiveMessageC; + Packet = TimeSyncMessageLayerC; + + TimeSyncAMSendRadio = TimeSyncMessageLayerC; + TimeSyncPacketRadio = TimeSyncMessageLayerC; + TimeSyncAMSendMilli = TimeSyncMessageLayerC; + TimeSyncPacketMilli = TimeSyncMessageLayerC; + + TimeSyncMessageLayerC.SubSend -> RF230ActiveMessageC; + TimeSyncMessageLayerC.SubPacket -> RF230ActiveMessageC; + + TimeSyncMessageLayerC.PacketTimeStampRadio -> RF230ActiveMessageC; + TimeSyncMessageLayerC.PacketTimeStampMilli -> RF230ActiveMessageC; + + TimeSyncMessageLayerC.LocalTimeRadio -> RF230DriverLayerC; + TimeSyncMessageLayerC.PacketTimeSyncOffset -> RF230DriverLayerC.PacketTimeSyncOffset; +} diff --git a/tos/platforms/iris/ActiveMessageC.nc b/tos/platforms/iris/ActiveMessageC.nc index 649ae6f3..39f07fa2 100644 --- a/tos/platforms/iris/ActiveMessageC.nc +++ b/tos/platforms/iris/ActiveMessageC.nc @@ -35,6 +35,9 @@ configuration ActiveMessageC interface PacketAcknowledgements; interface LowPowerListening; +#ifdef PACKET_LINK + interface PacketLink; +#endif interface PacketTimeStamp as PacketTimeStampMicro; interface PacketTimeStamp as PacketTimeStampMilli; @@ -45,12 +48,15 @@ implementation { components RF230ActiveMessageC as MAC; - SplitControl = MAC; - AMSend = MAC; - Receive = MAC.Receive; - Snoop = MAC.Snoop; - Packet = MAC; - AMPacket = MAC; + SplitControl = MAC; + AMSend = MAC; + Receive = MAC.Receive; + Snoop = MAC.Snoop; + Packet = MAC; + AMPacket = MAC; +#ifdef PACKET_LINK + PacketLink = MAC; +#endif PacketAcknowledgements = MAC; LowPowerListening = MAC; diff --git a/tos/platforms/iris/TimeSyncMessageC.nc b/tos/platforms/iris/TimeSyncMessageC.nc index 04a764e8..e39b4929 100644 --- a/tos/platforms/iris/TimeSyncMessageC.nc +++ b/tos/platforms/iris/TimeSyncMessageC.nc @@ -44,7 +44,7 @@ configuration TimeSyncMessageC implementation { - components GenericTimeSyncMessageC as MAC, LocalTimeMicroC, RF230DriverLayerC; + components RF230TimeSyncMessageC as MAC; SplitControl = MAC; Receive = MAC.Receive; @@ -56,7 +56,4 @@ implementation TimeSyncPacketRadio = MAC; TimeSyncAMSendMilli = MAC; TimeSyncPacketMilli = MAC; - - MAC.PacketTimeSyncOffset -> RF230DriverLayerC.PacketTimeSyncOffset; - MAC.LocalTimeRadio -> LocalTimeMicroC; } -- 2.39.2