From 1203cdd1382f55541be927d74b57d44e2b47724a Mon Sep 17 00:00:00 2001 From: mmaroti Date: Fri, 18 Sep 2009 22:23:25 +0000 Subject: [PATCH] support ActiveMessageC and Ieee154MessageC simultaneously --- tos/chips/rf2xx/rf212/RF212ActiveMessageC.nc | 166 ++--------- tos/chips/rf2xx/rf212/RF212Ieee154MessageC.nc | 133 ++------- .../{RF212ActiveMessage.h => RF212Radio.h} | 14 +- tos/chips/rf2xx/rf212/RF212RadioC.nc | 260 ++++++++++++++++++ ...{RF212ActiveMessageP.nc => RF212RadioP.nc} | 49 ++-- 5 files changed, 341 insertions(+), 281 deletions(-) rename tos/chips/rf2xx/rf212/{RF212ActiveMessage.h => RF212Radio.h} (90%) create mode 100644 tos/chips/rf2xx/rf212/RF212RadioC.nc rename tos/chips/rf2xx/rf212/{RF212ActiveMessageP.nc => RF212RadioP.nc} (85%) diff --git a/tos/chips/rf2xx/rf212/RF212ActiveMessageC.nc b/tos/chips/rf2xx/rf212/RF212ActiveMessageC.nc index d6076abb..10f7c5fa 100644 --- a/tos/chips/rf2xx/rf212/RF212ActiveMessageC.nc +++ b/tos/chips/rf2xx/rf212/RF212ActiveMessageC.nc @@ -23,6 +23,10 @@ #include +#ifdef IEEE154FRAMES_ENABLED +#error "You cannot use ActiveMessageC with IEEE154FRAMES_ENABLED defined" +#endif + configuration RF212ActiveMessageC { provides @@ -36,9 +40,9 @@ configuration RF212ActiveMessageC interface Packet; interface AMPacket; + interface PacketAcknowledgements; interface LowPowerListening; - #ifdef PACKET_LINK interface PacketLink; #endif @@ -57,155 +61,31 @@ configuration RF212ActiveMessageC implementation { - components RF212ActiveMessageP, RadioAlarmC; - -#ifdef RADIO_DEBUG - components AssertC; -#endif - - RF212ActiveMessageP.IEEE154MessageLayer -> IEEE154MessageLayerC; - RF212ActiveMessageP.RadioAlarm -> RadioAlarmC.RadioAlarm[unique("RadioAlarm")]; - RF212ActiveMessageP.PacketTimeStamp -> TimeStampingLayerC; - RF212ActiveMessageP.ActiveMessagePacket -> ActiveMessageLayerC; - RF212ActiveMessageP.RF212Packet -> RF212DriverLayerC; - -// -------- Active Message - - components ActiveMessageLayerC; - ActiveMessageLayerC.Config -> RF212ActiveMessageP; - ActiveMessageLayerC.SubSend -> LowpanNetworkLayerC; - ActiveMessageLayerC.SubReceive -> LowpanNetworkLayerC; - ActiveMessageLayerC.SubPacket ->LowpanNetworkLayerC; - AMSend = ActiveMessageLayerC; - Packet = ActiveMessageLayerC; - Receive = ActiveMessageLayerC.Receive; - Snoop = ActiveMessageLayerC.Snoop; - AMPacket = ActiveMessageLayerC; - SendNotifier = ActiveMessageLayerC; - -// -------- Lowpan Network - -#ifdef TFRAMES_ENABLED - components new DummyLayerC() as LowpanNetworkLayerC; -#else - components LowpanNetworkLayerC; -#endif - LowpanNetworkLayerC.SubSend -> IEEE154MessageLayerC; - LowpanNetworkLayerC.SubReceive -> LowPowerListeningLayerC; - LowpanNetworkLayerC.SubPacket -> IEEE154MessageLayerC; + components RF212RadioC; -// -------- IEEE154 Message + SplitControl = RF212RadioC; - components IEEE154MessageLayerC; - IEEE154MessageLayerC.SubPacket -> LowPowerListeningLayerC; - IEEE154MessageLayerC.SubSend -> UniqueLayerC; + AMSend = RF212RadioC; + Receive = RF212RadioC.Receive; + Snoop = RF212RadioC.Snoop; + SendNotifier = RF212RadioC; -// -------- UniqueLayer Send part (wired twice) - - components UniqueLayerC; - UniqueLayerC.Config -> RF212ActiveMessageP; - UniqueLayerC.SubSend -> LowPowerListeningLayerC; - -// -------- Low Power Listening - -#ifdef LOW_POWER_LISTENING - #warning "*** USING LOW POWER LISTENING LAYER" - components LowPowerListeningLayerC; - LowPowerListeningLayerC.Config -> RF212ActiveMessageP; - LowPowerListeningLayerC.PacketAcknowledgements -> SoftwareAckLayerC; -#else - components LowPowerListeningDummyC as LowPowerListeningLayerC; -#endif - LowPowerListeningLayerC.SubControl -> MessageBufferLayerC; - LowPowerListeningLayerC.SubSend -> PacketLinkLayerC; - LowPowerListeningLayerC.SubReceive -> MessageBufferLayerC; - LowPowerListeningLayerC.SubPacket -> PacketLinkLayerC; - SplitControl = LowPowerListeningLayerC; - LowPowerListening = LowPowerListeningLayerC; - -// -------- Packet Link + Packet = RF212RadioC.PacketForActiveMessage; + AMPacket = RF212RadioC; + PacketAcknowledgements = RF212RadioC; + LowPowerListening = RF212RadioC; #ifdef PACKET_LINK - #warning "*** USING PACKET LINK LAYER" - components PacketLinkLayerC; - PacketLink = PacketLinkLayerC; - PacketLinkLayerC.PacketAcknowledgements -> SoftwareAckLayerC; -#else - components new DummyLayerC() as PacketLinkLayerC; -#endif - PacketLinkLayerC.SubSend -> MessageBufferLayerC; - PacketLinkLayerC.SubPacket -> TimeStampingLayerC; - -// -------- MessageBuffer - - components MessageBufferLayerC; - MessageBufferLayerC.RadioSend -> TrafficMonitorLayerC; - MessageBufferLayerC.RadioReceive -> UniqueLayerC; - MessageBufferLayerC.RadioState -> TrafficMonitorLayerC; - RadioChannel = MessageBufferLayerC; - -// -------- UniqueLayer receive part (wired twice) - - UniqueLayerC.SubReceive -> TrafficMonitorLayerC; - -// -------- Traffic Monitor - -#ifdef TRAFFIC_MONITOR - components TrafficMonitorLayerC; -#else - components new DummyLayerC() as TrafficMonitorLayerC; -#endif - TrafficMonitorLayerC.Config -> RF212ActiveMessageP; - TrafficMonitorLayerC -> CollisionAvoidanceLayerC.RadioSend; - TrafficMonitorLayerC -> CollisionAvoidanceLayerC.RadioReceive; - TrafficMonitorLayerC -> RF212DriverLayerC.RadioState; - -// -------- CollisionAvoidance - -#ifdef SLOTTED_MAC - components SlottedCollisionLayerC as CollisionAvoidanceLayerC; -#else - components RandomCollisionLayerC as CollisionAvoidanceLayerC; + PacketLink = RF212RadioC; #endif - CollisionAvoidanceLayerC.Config -> RF212ActiveMessageP; - CollisionAvoidanceLayerC.SubSend -> SoftwareAckLayerC; - CollisionAvoidanceLayerC.SubReceive -> SoftwareAckLayerC; - -// -------- SoftwareAcknowledgement - - components SoftwareAckLayerC; - SoftwareAckLayerC.Config -> RF212ActiveMessageP; - SoftwareAckLayerC.SubSend -> CsmaLayerC; - SoftwareAckLayerC.SubReceive -> RF212DriverLayerC; - PacketAcknowledgements = SoftwareAckLayerC; - -// -------- Carrier Sense - - components new DummyLayerC() as CsmaLayerC; - CsmaLayerC.Config -> RF212ActiveMessageP; - CsmaLayerC -> RF212DriverLayerC.RadioSend; - CsmaLayerC -> RF212DriverLayerC.RadioCCA; - -// -------- TimeStamping - - components TimeStampingLayerC; - TimeStampingLayerC.LocalTimeRadio -> RF212DriverLayerC; - TimeStampingLayerC.SubPacket -> MetadataFlagsLayerC; - PacketTimeStampRadio = TimeStampingLayerC; - PacketTimeStampMilli = TimeStampingLayerC; - -// -------- MetadataFlags - components MetadataFlagsLayerC; - MetadataFlagsLayerC.SubPacket -> RF212DriverLayerC; + RadioChannel = RF212RadioC; -// -------- RF212 Driver + PacketLinkQuality = RF212RadioC.PacketLinkQuality; + PacketTransmitPower = RF212RadioC.PacketTransmitPower; + PacketRSSI = RF212RadioC.PacketRSSI; - components RF212DriverLayerC; - RF212DriverLayerC.Config -> RF212ActiveMessageP; - RF212DriverLayerC.PacketTimeStamp -> TimeStampingLayerC; - PacketTransmitPower = RF212DriverLayerC.PacketTransmitPower; - PacketLinkQuality = RF212DriverLayerC.PacketLinkQuality; - PacketRSSI = RF212DriverLayerC.PacketRSSI; - LocalTimeRadio = RF212DriverLayerC; + LocalTimeRadio = RF212RadioC; + PacketTimeStampMilli = RF212RadioC; + PacketTimeStampRadio = RF212RadioC; } diff --git a/tos/chips/rf2xx/rf212/RF212Ieee154MessageC.nc b/tos/chips/rf2xx/rf212/RF212Ieee154MessageC.nc index bfeda975..6c40049b 100644 --- a/tos/chips/rf2xx/rf212/RF212Ieee154MessageC.nc +++ b/tos/chips/rf2xx/rf212/RF212Ieee154MessageC.nc @@ -23,6 +23,10 @@ #include +#ifdef TFRAMES_ENABLED +#error "You cannot use Ieee154MessageC with TFRAMES_ENABLED defined" +#endif + configuration RF212Ieee154MessageC { provides @@ -31,12 +35,15 @@ configuration RF212Ieee154MessageC interface Ieee154Send; interface Receive as Ieee154Receive; + interface SendNotifier; + interface Ieee154Packet; interface Packet; + interface Resource as RadioSendResource[uint8_t clint]; + interface PacketAcknowledgements; interface LowPowerListening; interface PacketLink; - interface SendNotifier; interface RadioChannel; @@ -52,117 +59,29 @@ configuration RF212Ieee154MessageC implementation { - components RF212ActiveMessageP, RadioAlarmC; - -#ifdef RADIO_DEBUG - components AssertC; -#endif - - RF212ActiveMessageP.IEEE154MessageLayer -> IEEE154MessageLayerC; - RF212ActiveMessageP.RadioAlarm -> RadioAlarmC.RadioAlarm[unique("RadioAlarm")]; - RF212ActiveMessageP.PacketTimeStamp -> TimeStampingLayerC; - RF212ActiveMessageP.RF212Packet -> RF212DriverLayerC; - -// -------- IEEE154 Message - - components IEEE154MessageLayerC; - IEEE154MessageLayerC.SubPacket -> LowPowerListeningLayerC; - IEEE154MessageLayerC.SubSend -> UniqueLayerC; - IEEE154MessageLayerC.SubReceive -> LowPowerListeningLayerC; - Ieee154Send = IEEE154MessageLayerC; - Packet = IEEE154MessageLayerC; - Ieee154Receive = IEEE154MessageLayerC; - Ieee154Packet = IEEE154MessageLayerC; - SendNotifier = IEEE154MessageLayerC; - -// -------- UniqueLayer Send part (wired twice) - - components UniqueLayerC; - UniqueLayerC.Config -> RF212ActiveMessageP; - UniqueLayerC.SubSend -> LowPowerListeningLayerC; - -// -------- Low Power Listening - -#ifdef LOW_POWER_LISTENING - components LowPowerListeningLayerC; - LowPowerListeningLayerC.Config -> RF212ActiveMessageP; - LowPowerListeningLayerC.PacketAcknowledgements -> SoftwareAckLayerC; -#else - components LowPowerListeningDummyC as LowPowerListeningLayerC; -#endif - LowPowerListeningLayerC.SubControl -> MessageBufferLayerC; - LowPowerListeningLayerC.SubSend -> PacketLinkLayerC; - LowPowerListeningLayerC.SubReceive -> MessageBufferLayerC; - LowPowerListeningLayerC.SubPacket -> PacketLinkLayerC; - SplitControl = LowPowerListeningLayerC; - LowPowerListening = LowPowerListeningLayerC; - -// -------- Packet Link - - components PacketLinkLayerC; - PacketLink = PacketLinkLayerC; - PacketLinkLayerC.PacketAcknowledgements -> SoftwareAckLayerC; - PacketLinkLayerC.SubSend -> MessageBufferLayerC; - PacketLinkLayerC.SubPacket -> TimeStampingLayerC; - -// -------- MessageBuffer - - components MessageBufferLayerC; - MessageBufferLayerC.RadioSend -> CollisionAvoidanceLayerC; - MessageBufferLayerC.RadioReceive -> UniqueLayerC; - MessageBufferLayerC.RadioState -> RF212DriverLayerC; - RadioChannel = MessageBufferLayerC; - -// -------- UniqueLayer receive part (wired twice) - - UniqueLayerC.SubReceive -> CollisionAvoidanceLayerC; - -// -------- CollisionAvoidance - -#ifdef SLOTTED_MAC - components SlottedCollisionLayerC as CollisionAvoidanceLayerC; -#else - components RandomCollisionLayerC as CollisionAvoidanceLayerC; -#endif - CollisionAvoidanceLayerC.Config -> RF212ActiveMessageP; - CollisionAvoidanceLayerC.SubSend -> SoftwareAckLayerC; - CollisionAvoidanceLayerC.SubReceive -> SoftwareAckLayerC; - -// -------- SoftwareAcknowledgement - - components SoftwareAckLayerC; - SoftwareAckLayerC.Config -> RF212ActiveMessageP; - SoftwareAckLayerC.SubSend -> CsmaLayerC; - SoftwareAckLayerC.SubReceive -> RF212DriverLayerC; - PacketAcknowledgements = SoftwareAckLayerC; - -// -------- Carrier Sense + components RF212RadioC; - components new DummyLayerC() as CsmaLayerC; - CsmaLayerC.Config -> RF212ActiveMessageP; - CsmaLayerC -> RF212DriverLayerC.RadioSend; - CsmaLayerC -> RF212DriverLayerC.RadioCCA; + SplitControl = RF212RadioC; -// -------- TimeStamping + Ieee154Send = RF212RadioC.Ieee154Send; + Ieee154Receive = RF212RadioC.Ieee154Receive; + SendNotifier = RF212RadioC.Ieee154Notifier; - components TimeStampingLayerC; - TimeStampingLayerC.LocalTimeRadio -> RF212DriverLayerC; - TimeStampingLayerC.SubPacket -> MetadataFlagsLayerC; - PacketTimeStampRadio = TimeStampingLayerC; - PacketTimeStampMilli = TimeStampingLayerC; + Packet = RF212RadioC.PacketForIeee154Message; + Ieee154Packet = RF212RadioC; + RadioSendResource = RF212RadioC; -// -------- MetadataFlags + PacketAcknowledgements = RF212RadioC; + LowPowerListening = RF212RadioC; + PacketLink = RF212RadioC; - components MetadataFlagsLayerC; - MetadataFlagsLayerC.SubPacket -> RF212DriverLayerC; + RadioChannel = RF212RadioC; -// -------- RF212 Driver + PacketLinkQuality = RF212RadioC.PacketLinkQuality; + PacketTransmitPower = RF212RadioC.PacketTransmitPower; + PacketRSSI = RF212RadioC.PacketRSSI; - components RF212DriverLayerC; - RF212DriverLayerC.Config -> RF212ActiveMessageP; - RF212DriverLayerC.PacketTimeStamp -> TimeStampingLayerC; - PacketTransmitPower = RF212DriverLayerC.PacketTransmitPower; - PacketLinkQuality = RF212DriverLayerC.PacketLinkQuality; - PacketRSSI = RF212DriverLayerC.PacketRSSI; - LocalTimeRadio = RF212DriverLayerC; + LocalTimeRadio = RF212RadioC; + PacketTimeStampMilli = RF212RadioC; + PacketTimeStampRadio = RF212RadioC; } diff --git a/tos/chips/rf2xx/rf212/RF212ActiveMessage.h b/tos/chips/rf2xx/rf212/RF212Radio.h similarity index 90% rename from tos/chips/rf2xx/rf212/RF212ActiveMessage.h rename to tos/chips/rf2xx/rf212/RF212Radio.h index 618d0489..b67f5560 100644 --- a/tos/chips/rf2xx/rf212/RF212ActiveMessage.h +++ b/tos/chips/rf2xx/rf212/RF212Radio.h @@ -21,11 +21,11 @@ * Author: Miklos Maroti */ -#ifndef __RF212ACTIVEMESSAGE_H__ -#define __RF212ACTIVEMESSAGE_H__ +#ifndef __RF212RADIO_H__ +#define __RF212RADIO_H__ -#include -#include +#include +#include #include #include #include @@ -38,9 +38,11 @@ typedef nx_struct rf212packet_header_t rf212_header_t rf212; ieee154_header_t ieee154; #ifndef TFRAMES_ENABLED - lowpan_header_t lowpan; + network_header_t network; #endif +#ifndef IEEE154FRAMES_ENABLED activemessage_header_t am; +#endif } rf212packet_header_t; typedef nx_struct rf212packet_footer_t @@ -61,4 +63,4 @@ typedef struct rf212packet_metadata_t rf212_metadata_t rf212; } rf212packet_metadata_t; -#endif//__RF212ACTIVEMESSAGE_H__ +#endif//__RF212RADIO_H__ diff --git a/tos/chips/rf2xx/rf212/RF212RadioC.nc b/tos/chips/rf2xx/rf212/RF212RadioC.nc new file mode 100644 index 00000000..db8e5f90 --- /dev/null +++ b/tos/chips/rf2xx/rf212/RF212RadioC.nc @@ -0,0 +1,260 @@ +/* + * 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 + +#ifndef TFRAMES_ENABLED +#define PACKET_LINK +#endif + +configuration RF212RadioC +{ + provides + { + interface SplitControl; + +#ifndef IEEE154FRAMES_ENABLED + interface AMSend[am_id_t id]; + interface Receive[am_id_t id]; + interface Receive as Snoop[am_id_t id]; + interface SendNotifier[am_id_t id]; + + interface AMPacket; + interface Packet as PacketForActiveMessage; +#endif + +#ifndef TFRAMES_ENABLED + interface Ieee154Send; + interface Receive as Ieee154Receive; + interface SendNotifier as Ieee154Notifier; + + interface Resource as RadioSendResource[uint8_t clint]; + + interface Ieee154Packet; + interface Packet as PacketForIeee154Message; +#endif + + interface PacketAcknowledgements; + interface LowPowerListening; + +#ifdef PACKET_LINK + interface PacketLink; +#endif + + interface RadioChannel; + + interface PacketField as PacketLinkQuality; + interface PacketField as PacketTransmitPower; + interface PacketField as PacketRSSI; + + interface LocalTime as LocalTimeRadio; + interface PacketTimeStamp as PacketTimeStampRadio; + interface PacketTimeStamp as PacketTimeStampMilli; + } +} + +implementation +{ + components RF212RadioP, RadioAlarmC; + +#ifdef RADIO_DEBUG + components AssertC; +#endif + + RF212RadioP.Ieee154PacketLayer -> Ieee154PacketLayerC; + RF212RadioP.RadioAlarm -> RadioAlarmC.RadioAlarm[unique("RadioAlarm")]; + RF212RadioP.PacketTimeStamp -> TimeStampingLayerC; + RF212RadioP.RF212Packet -> RF212DriverLayerC; + +// -------- Active Message + +#ifndef IEEE154FRAMES_ENABLED + components ActiveMessageLayerC; + ActiveMessageLayerC.Config -> RF212RadioP; + ActiveMessageLayerC.SubSend -> AutoResourceAcquireLayerC; + ActiveMessageLayerC.SubReceive -> TinyosNetworkLayerC.TinyosReceive; + ActiveMessageLayerC.SubPacket -> TinyosNetworkLayerC.TinyosPacket; + + AMSend = ActiveMessageLayerC; + Receive = ActiveMessageLayerC.Receive; + Snoop = ActiveMessageLayerC.Snoop; + SendNotifier = ActiveMessageLayerC; + AMPacket = ActiveMessageLayerC; + PacketForActiveMessage = ActiveMessageLayerC; +#endif + +// -------- Automatic RadioSend Resource + +#ifndef IEEE154FRAMES_ENABLED +#ifndef TFRAMES_ENABLED + components new AutoResourceAcquireLayerC(); + AutoResourceAcquireLayerC.Resource -> RadioSendResourceC.Resource[unique("RADIO_SEND_RESOURCE")]; +#else + components new DummyLayerC() as AutoResourceAcquireLayerC; +#endif + AutoResourceAcquireLayerC.SubSend -> TinyosNetworkLayerC.TinyosSend; +#endif + +// -------- RadioSend Resource + +#ifndef TFRAMES_ENABLED + components new SimpleFcfsArbiterC("RADIO_SEND_RESOURCE") as RadioSendResourceC; + RadioSendResource = RadioSendResourceC; + +// -------- Ieee154 Message + + components Ieee154MessageLayerC; + Ieee154MessageLayerC.Ieee154PacketLayer -> Ieee154PacketLayerC; + Ieee154MessageLayerC.Ieee154Packet -> Ieee154PacketLayerC; + Ieee154MessageLayerC.SubSend -> TinyosNetworkLayerC.Ieee154Send; + Ieee154MessageLayerC.SubReceive -> TinyosNetworkLayerC.Ieee154Receive; + Ieee154MessageLayerC.RadioPacket -> TinyosNetworkLayerC.Ieee154Packet; + + Ieee154Send = Ieee154MessageLayerC; + Ieee154Receive = Ieee154MessageLayerC; + Ieee154Notifier = Ieee154MessageLayerC; + Ieee154Packet = Ieee154PacketLayerC; + PacketForIeee154Message = Ieee154MessageLayerC; +#endif + +// -------- Tinyos Network + + components TinyosNetworkLayerC; + + TinyosNetworkLayerC.SubSend -> UniqueLayerC; + TinyosNetworkLayerC.SubReceive -> LowPowerListeningLayerC; + TinyosNetworkLayerC.SubPacket -> Ieee154PacketLayerC; + +// -------- IEEE 802.15.4 Packet + + components Ieee154PacketLayerC; + Ieee154PacketLayerC.SubPacket -> LowPowerListeningLayerC; + +// -------- UniqueLayer Send part (wired twice) + + components UniqueLayerC; + UniqueLayerC.Config -> RF212RadioP; + UniqueLayerC.SubSend -> LowPowerListeningLayerC; + +// -------- Low Power Listening + +#ifdef LOW_POWER_LISTENING + #warning "*** USING LOW POWER LISTENING LAYER" + components LowPowerListeningLayerC; + LowPowerListeningLayerC.Config -> RF212RadioP; + LowPowerListeningLayerC.PacketAcknowledgements -> SoftwareAckLayerC; +#else + components LowPowerListeningDummyC as LowPowerListeningLayerC; +#endif + LowPowerListeningLayerC.SubControl -> MessageBufferLayerC; + LowPowerListeningLayerC.SubSend -> PacketLinkLayerC; + LowPowerListeningLayerC.SubReceive -> MessageBufferLayerC; + LowPowerListeningLayerC.SubPacket -> PacketLinkLayerC; + SplitControl = LowPowerListeningLayerC; + LowPowerListening = LowPowerListeningLayerC; + +// -------- Packet Link + +#ifdef PACKET_LINK + components PacketLinkLayerC; + PacketLink = PacketLinkLayerC; + PacketLinkLayerC.PacketAcknowledgements -> SoftwareAckLayerC; +#else + components new DummyLayerC() as PacketLinkLayerC; +#endif + PacketLinkLayerC.SubSend -> MessageBufferLayerC; + PacketLinkLayerC.SubPacket -> TimeStampingLayerC; + +// -------- MessageBuffer + + components MessageBufferLayerC; + MessageBufferLayerC.RadioSend -> TrafficMonitorLayerC; + MessageBufferLayerC.RadioReceive -> UniqueLayerC; + MessageBufferLayerC.RadioState -> TrafficMonitorLayerC; + RadioChannel = MessageBufferLayerC; + +// -------- UniqueLayer receive part (wired twice) + + UniqueLayerC.SubReceive -> TrafficMonitorLayerC; + +// -------- Traffic Monitor + +#ifdef TRAFFIC_MONITOR + components TrafficMonitorLayerC; +#else + components new DummyLayerC() as TrafficMonitorLayerC; +#endif + TrafficMonitorLayerC.Config -> RF212RadioP; + TrafficMonitorLayerC -> CollisionAvoidanceLayerC.RadioSend; + TrafficMonitorLayerC -> CollisionAvoidanceLayerC.RadioReceive; + TrafficMonitorLayerC -> RF212DriverLayerC.RadioState; + +// -------- CollisionAvoidance + +#ifdef SLOTTED_MAC + components SlottedCollisionLayerC as CollisionAvoidanceLayerC; +#else + components RandomCollisionLayerC as CollisionAvoidanceLayerC; +#endif + CollisionAvoidanceLayerC.Config -> RF212RadioP; + CollisionAvoidanceLayerC.SubSend -> SoftwareAckLayerC; + CollisionAvoidanceLayerC.SubReceive -> SoftwareAckLayerC; + +// -------- SoftwareAcknowledgement + + components SoftwareAckLayerC; + SoftwareAckLayerC.Config -> RF212RadioP; + SoftwareAckLayerC.SubSend -> CsmaLayerC; + SoftwareAckLayerC.SubReceive -> RF212DriverLayerC; + PacketAcknowledgements = SoftwareAckLayerC; + +// -------- Carrier Sense + + components new DummyLayerC() as CsmaLayerC; + CsmaLayerC.Config -> RF212RadioP; + CsmaLayerC -> RF212DriverLayerC.RadioSend; + CsmaLayerC -> RF212DriverLayerC.RadioCCA; + +// -------- TimeStamping + + components TimeStampingLayerC; + TimeStampingLayerC.LocalTimeRadio -> RF212DriverLayerC; + TimeStampingLayerC.SubPacket -> MetadataFlagsLayerC; + PacketTimeStampRadio = TimeStampingLayerC; + PacketTimeStampMilli = TimeStampingLayerC; + +// -------- MetadataFlags + + components MetadataFlagsLayerC; + MetadataFlagsLayerC.SubPacket -> RF212DriverLayerC; + +// -------- RF212 Driver + + components RF212DriverLayerC; + RF212DriverLayerC.Config -> RF212RadioP; + RF212DriverLayerC.PacketTimeStamp -> TimeStampingLayerC; + PacketTransmitPower = RF212DriverLayerC.PacketTransmitPower; + PacketLinkQuality = RF212DriverLayerC.PacketLinkQuality; + PacketRSSI = RF212DriverLayerC.PacketRSSI; + LocalTimeRadio = RF212DriverLayerC; +} diff --git a/tos/chips/rf2xx/rf212/RF212ActiveMessageP.nc b/tos/chips/rf2xx/rf212/RF212RadioP.nc similarity index 85% rename from tos/chips/rf2xx/rf212/RF212ActiveMessageP.nc rename to tos/chips/rf2xx/rf212/RF212RadioP.nc index f5a47923..699aeb56 100644 --- a/tos/chips/rf2xx/rf212/RF212ActiveMessageP.nc +++ b/tos/chips/rf2xx/rf212/RF212RadioP.nc @@ -21,11 +21,11 @@ * Author: Miklos Maroti */ -#include +#include #include #include -module RF212ActiveMessageP +module RF212RadioP { provides { @@ -46,9 +46,8 @@ module RF212ActiveMessageP uses { - interface IEEE154MessageLayer; + interface Ieee154PacketLayer; interface RadioAlarm; - interface RadioPacket as ActiveMessagePacket; interface RadioPacket as RF212Packet; interface PacketTimeStamp; @@ -83,39 +82,39 @@ implementation async command bool RF212DriverConfig.requiresRssiCca(message_t* msg) { - return call IEEE154MessageLayer.isDataFrame(msg); + return call Ieee154PacketLayer.isDataFrame(msg); } /*----------------- SoftwareAckConfig -----------------*/ async command bool SoftwareAckConfig.requiresAckWait(message_t* msg) { - return call IEEE154MessageLayer.requiresAckWait(msg); + return call Ieee154PacketLayer.requiresAckWait(msg); } async command bool SoftwareAckConfig.isAckPacket(message_t* msg) { - return call IEEE154MessageLayer.isAckFrame(msg); + return call Ieee154PacketLayer.isAckFrame(msg); } async command bool SoftwareAckConfig.verifyAckPacket(message_t* data, message_t* ack) { - return call IEEE154MessageLayer.verifyAckReply(data, ack); + return call Ieee154PacketLayer.verifyAckReply(data, ack); } async command void SoftwareAckConfig.setAckRequired(message_t* msg, bool ack) { - call IEEE154MessageLayer.setAckRequired(msg, ack); + call Ieee154PacketLayer.setAckRequired(msg, ack); } async command bool SoftwareAckConfig.requiresAckReply(message_t* msg) { - return call IEEE154MessageLayer.requiresAckReply(msg); + return call Ieee154PacketLayer.requiresAckReply(msg); } async command void SoftwareAckConfig.createAckPacket(message_t* data, message_t* ack) { - call IEEE154MessageLayer.createAckReply(data, ack); + call Ieee154PacketLayer.createAckReply(data, ack); } #ifndef SOFTWAREACK_TIMEOUT @@ -138,17 +137,17 @@ implementation async command uint8_t UniqueConfig.getSequenceNumber(message_t* msg) { - return call IEEE154MessageLayer.getDSN(msg); + return call Ieee154PacketLayer.getDSN(msg); } async command void UniqueConfig.setSequenceNumber(message_t* msg, uint8_t dsn) { - call IEEE154MessageLayer.setDSN(msg, dsn); + call Ieee154PacketLayer.setDSN(msg, dsn); } async command am_addr_t UniqueConfig.getSender(message_t* msg) { - return call IEEE154MessageLayer.getSrcAddr(msg); + return call Ieee154PacketLayer.getSrcAddr(msg); } tasklet_async command void UniqueConfig.reportChannelError() @@ -162,39 +161,39 @@ implementation command am_addr_t ActiveMessageConfig.destination(message_t* msg) { - return call IEEE154MessageLayer.getDestAddr(msg); + return call Ieee154PacketLayer.getDestAddr(msg); } command void ActiveMessageConfig.setDestination(message_t* msg, am_addr_t addr) { - call IEEE154MessageLayer.setDestAddr(msg, addr); + call Ieee154PacketLayer.setDestAddr(msg, addr); } command am_addr_t ActiveMessageConfig.source(message_t* msg) { - return call IEEE154MessageLayer.getSrcAddr(msg); + return call Ieee154PacketLayer.getSrcAddr(msg); } command void ActiveMessageConfig.setSource(message_t* msg, am_addr_t addr) { - call IEEE154MessageLayer.setSrcAddr(msg, addr); + call Ieee154PacketLayer.setSrcAddr(msg, addr); } command am_group_t ActiveMessageConfig.group(message_t* msg) { - return call IEEE154MessageLayer.getDestPan(msg); + return call Ieee154PacketLayer.getDestPan(msg); } command void ActiveMessageConfig.setGroup(message_t* msg, am_group_t grp) { - call IEEE154MessageLayer.setDestPan(msg, grp); + call Ieee154PacketLayer.setDestPan(msg, grp); } /*----------------- CsmaConfig -----------------*/ async command bool CsmaConfig.requiresSoftwareCCA(message_t* msg) { - return call IEEE154MessageLayer.isDataFrame(msg); + return call Ieee154PacketLayer.isDataFrame(msg); } /*----------------- TrafficMonitorConfig -----------------*/ @@ -220,12 +219,12 @@ implementation */ uint8_t len = call RF212Packet.payloadLength(msg); - return call IEEE154MessageLayer.getAckRequired(msg) ? len + 6 + 16 + 11 + 10 : len + 6 + 10; + return call Ieee154PacketLayer.getAckRequired(msg) ? len + 6 + 16 + 11 + 10 : len + 6 + 10; } async command am_addr_t TrafficMonitorConfig.getSender(message_t* msg) { - return call IEEE154MessageLayer.getSrcAddr(msg); + return call Ieee154PacketLayer.getSrcAddr(msg); } /*----------------- RandomCollisionConfig -----------------*/ @@ -262,7 +261,7 @@ implementation time = call RadioAlarm.getNow(); // estimated response time (download the message, etc) is 5-8 bytes - if( call IEEE154MessageLayer.requiresAckReply(msg) ) + if( call Ieee154PacketLayer.requiresAckReply(msg) ) time += (uint16_t)(32 * (-5 + 16 + 11 + 5) * RADIO_ALARM_MICROSEC); else time += (uint16_t)(32 * (-5 + 5) * RADIO_ALARM_MICROSEC); @@ -315,7 +314,7 @@ implementation async command bool LowPowerListeningConfig.getAckRequired(message_t* msg) { - return call IEEE154MessageLayer.getAckRequired(msg); + return call Ieee154PacketLayer.getAckRequired(msg); } #endif -- 2.39.2