From: mmaroti Date: Wed, 8 Apr 2009 22:16:16 +0000 (+0000) Subject: add the SendNotifier interface X-Git-Tag: rc_6_tinyos_2_1_1~427 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=9d7e3ad7a39e567bb854afe46e24f544618e34fa add the SendNotifier interface --- diff --git a/tos/chips/rf2xx/layers/ActiveMessageLayerC.nc b/tos/chips/rf2xx/layers/ActiveMessageLayerC.nc index 5cc4afe6..29c6d944 100755 --- a/tos/chips/rf2xx/layers/ActiveMessageLayerC.nc +++ b/tos/chips/rf2xx/layers/ActiveMessageLayerC.nc @@ -31,6 +31,7 @@ configuration ActiveMessageLayerC 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]; } uses @@ -53,6 +54,7 @@ implementation AMSend = ActiveMessageLayerP; Receive = ActiveMessageLayerP.Receive; Snoop = ActiveMessageLayerP.Snoop; + SendNotifier = ActiveMessageLayerP; SubPacket = ActiveMessageLayerP; SubSend = ActiveMessageLayerP; diff --git a/tos/chips/rf2xx/layers/ActiveMessageLayerP.nc b/tos/chips/rf2xx/layers/ActiveMessageLayerP.nc index c37c2bb8..e8035717 100644 --- a/tos/chips/rf2xx/layers/ActiveMessageLayerP.nc +++ b/tos/chips/rf2xx/layers/ActiveMessageLayerP.nc @@ -33,6 +33,7 @@ module ActiveMessageLayerP 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]; } uses @@ -68,6 +69,8 @@ implementation call AMPacket.setType(msg, id); call AMPacket.setDestination(msg, addr); + signal SendNotifier.aboutToSend[id](addr, msg); + return call SubSend.send(msg, len); } @@ -95,6 +98,10 @@ implementation return call SubSend.getPayload(msg, len); } + default event void SendNotifier.aboutToSend[am_id_t id](am_addr_t addr, message_t* msg) + { + } + /*----------------- Receive -----------------*/ event message_t* SubReceive.receive(message_t* msg, void* payload, uint8_t len) diff --git a/tos/chips/rf2xx/layers/IEEE154MessageLayerC.nc b/tos/chips/rf2xx/layers/IEEE154MessageLayerC.nc index 6ac1aa02..ff23c69c 100644 --- a/tos/chips/rf2xx/layers/IEEE154MessageLayerC.nc +++ b/tos/chips/rf2xx/layers/IEEE154MessageLayerC.nc @@ -30,6 +30,7 @@ configuration IEEE154MessageLayerC interface Ieee154Packet; interface Packet; interface Ieee154Send; + interface SendNotifier; } uses @@ -51,4 +52,5 @@ implementation Packet = IEEE154MessageLayerP; Ieee154Send = IEEE154MessageLayerP; SubSend = IEEE154MessageLayerP; + SendNotifier = IEEE154MessageLayerP; } diff --git a/tos/chips/rf2xx/layers/IEEE154MessageLayerP.nc b/tos/chips/rf2xx/layers/IEEE154MessageLayerP.nc index b806b96c..5d4f566c 100644 --- a/tos/chips/rf2xx/layers/IEEE154MessageLayerP.nc +++ b/tos/chips/rf2xx/layers/IEEE154MessageLayerP.nc @@ -32,6 +32,7 @@ module IEEE154MessageLayerP interface Ieee154Packet; interface Packet; interface Ieee154Send; + interface SendNotifier; } uses @@ -336,8 +337,7 @@ implementation header->destpan = call Ieee154Packet.localPan(); header->src = call Ieee154Packet.address(); - // Notifier (in original ActiveMessage) --> Not used in CC2420 - // signal SendNotifier.aboutToSend(addr, msg); + signal SendNotifier.aboutToSend(addr, msg); return call SubSend.send(msg, len); } @@ -350,4 +350,8 @@ implementation default event void Ieee154Send.sendDone(message_t* msg, error_t error) { } + + default event void SendNotifier.aboutToSend(am_addr_t addr, message_t* msg) + { + } } diff --git a/tos/chips/rf2xx/rf212/README b/tos/chips/rf2xx/rf212/README new file mode 100644 index 00000000..99719cdc --- /dev/null +++ b/tos/chips/rf2xx/rf212/README @@ -0,0 +1,38 @@ + +The RF212 radio driver has the following configuration options. Some of +these are set in the platforms/xxx/chips/rf212/RadioConfig.h header file, +see the meshbean900 platform for example, others can be set in your Makefile. + +RF212_TRX_CTRL_0_VALUE: + +This is the value of the TRX_CTRL_0 register which configures the output +pin currents and the CLKM clock: + +RF212_CCA_MODE_VALUE: + +This is the default value of the CCA_MODE field in the PHY_CC_CCA register +which is used to configure the default mode of the clear channel assesment + +RF212_CCA_THRES_VALUE: + +This is the value of the CCA_THRES register that controls the energy levels +used for clear channel assesment. + +RF212_DEF_RFPOWER: + +This is the default value of the TX_PWR field of the PHY_TX_PWR register. +This can be cahanged via the PacketTransmitPower interface provided by the +RF212ActiveMessageC. + +RF212_DEF_CHANNEL: + +This is the default value of the CHANNEL field of the PHY_CC_CCA register. +This can be cahanged via the RadioChannel interface provided by the +RF212ActiveMessageC. + +RF212_RSSI_ENERGY: + +If you define this, then the content of the RF212_PHY_ED_LEVEL is queried +instead of the RSSI value for eahc incoming message. This value can be +obtained with the PacketRSSI interface. + diff --git a/tos/chips/rf2xx/rf212/RF212ActiveMessageC.nc b/tos/chips/rf2xx/rf212/RF212ActiveMessageC.nc index f390303a..e75824e5 100644 --- a/tos/chips/rf2xx/rf212/RF212ActiveMessageC.nc +++ b/tos/chips/rf2xx/rf212/RF212ActiveMessageC.nc @@ -32,6 +32,7 @@ configuration RF212ActiveMessageC 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 Packet; interface AMPacket; @@ -80,6 +81,7 @@ implementation Receive = ActiveMessageLayerC.Receive; Snoop = ActiveMessageLayerC.Snoop; AMPacket = ActiveMessageLayerC; + SendNotifier = ActiveMessageLayerC; // -------- Lowpan Network diff --git a/tos/chips/rf2xx/rf212/RF212DriverLayerP.nc b/tos/chips/rf2xx/rf212/RF212DriverLayerP.nc index 1df169a2..616292df 100644 --- a/tos/chips/rf2xx/rf212/RF212DriverLayerP.nc +++ b/tos/chips/rf2xx/rf212/RF212DriverLayerP.nc @@ -959,6 +959,10 @@ implementation async command uint8_t PacketLinkQuality.get(message_t* msg) { + // we have some bug in BLIP, so fix it here + if( getMeta(msg)->lqi > 120 ) + return 120; + return getMeta(msg)->lqi; } diff --git a/tos/chips/rf2xx/rf212/RF212Ieee154MessageC.nc b/tos/chips/rf2xx/rf212/RF212Ieee154MessageC.nc index 21eca29b..2bfdc092 100644 --- a/tos/chips/rf2xx/rf212/RF212Ieee154MessageC.nc +++ b/tos/chips/rf2xx/rf212/RF212Ieee154MessageC.nc @@ -36,6 +36,7 @@ configuration RF212Ieee154MessageC interface PacketAcknowledgements; interface LowPowerListening; interface PacketLink; + interface SendNotifier; interface RadioChannel; @@ -71,6 +72,7 @@ implementation Packet = IEEE154MessageLayerC; Ieee154Receive = LowPowerListeningLayerC; Ieee154Packet = IEEE154MessageLayerC; + SendNotifier = IEEE154MessageLayerC; // -------- UniqueLayer Send part (wired twice) diff --git a/tos/chips/rf2xx/rf230/RF230ActiveMessageC.nc b/tos/chips/rf2xx/rf230/RF230ActiveMessageC.nc index a9c4b0f6..4c9ab95d 100644 --- a/tos/chips/rf2xx/rf230/RF230ActiveMessageC.nc +++ b/tos/chips/rf2xx/rf230/RF230ActiveMessageC.nc @@ -32,6 +32,7 @@ configuration RF230ActiveMessageC 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 Packet; interface AMPacket; @@ -80,6 +81,7 @@ implementation Receive = ActiveMessageLayerC.Receive; Snoop = ActiveMessageLayerC.Snoop; AMPacket = ActiveMessageLayerC; + SendNotifier = ActiveMessageLayerC; // -------- Lowpan Network diff --git a/tos/chips/rf2xx/rf230/RF230Ieee154MessageC.nc b/tos/chips/rf2xx/rf230/RF230Ieee154MessageC.nc new file mode 100644 index 00000000..59b23960 --- /dev/null +++ b/tos/chips/rf2xx/rf230/RF230Ieee154MessageC.nc @@ -0,0 +1,176 @@ +/* + * 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 RF230Ieee154MessageC +{ + provides + { + interface SplitControl; + + interface Ieee154Send; + interface Receive as Ieee154Receive; + interface Ieee154Packet; + interface Packet; + interface PacketAcknowledgements; + interface LowPowerListening; + interface PacketLink; + interface SendNotifier; + + 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 RF230ActiveMessageP, RadioAlarmC; + +#ifdef RADIO_DEBUG + components AssertC; +#endif + + RF230ActiveMessageP.IEEE154MessageLayer -> IEEE154MessageLayerC; + RF230ActiveMessageP.RadioAlarm -> RadioAlarmC.RadioAlarm[unique("RadioAlarm")]; + RF230ActiveMessageP.PacketTimeStamp -> TimeStampingLayerC; + RF230ActiveMessageP.RF230Packet -> RF230DriverLayerC; + +// -------- IEEE154 Message + + components IEEE154MessageLayerC; + IEEE154MessageLayerC.SubPacket -> LowPowerListeningLayerC; + IEEE154MessageLayerC.SubSend -> UniqueLayerC; + Ieee154Send = IEEE154MessageLayerC; + Packet = IEEE154MessageLayerC; + Ieee154Receive = LowPowerListeningLayerC; + Ieee154Packet = IEEE154MessageLayerC; + SendNotifier = IEEE154MessageLayerC; + +// -------- UniqueLayer Send part (wired twice) + + components UniqueLayerC; + UniqueLayerC.Config -> RF230ActiveMessageP; + UniqueLayerC.SubSend -> LowPowerListeningLayerC; + +// -------- Low Power Listening + +#ifdef LOW_POWER_LISTENING + components LowPowerListeningLayerC; + LowPowerListeningLayerC.Config -> RF230ActiveMessageP; + 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.Packet -> IEEE154MessageLayerC; // to get the payload for the Ieee154Receive.receive + MessageBufferLayerC.RadioSend -> TrafficMonitorLayerC; + MessageBufferLayerC.RadioReceive -> UniqueLayerC; + MessageBufferLayerC.RadioState -> TrafficMonitorLayerC; + RadioChannel = MessageBufferLayerC; + +// -------- UniqueLayer receive part (wired twice) + + UniqueLayerC.SubReceive -> TrafficMonitorLayerC; + +// -------- Traffic Monitor + + components TrafficMonitorLayerC; + TrafficMonitorLayerC.Config -> RF230ActiveMessageP; + TrafficMonitorLayerC.SubSend -> CollisionAvoidanceLayerC; + TrafficMonitorLayerC.SubReceive -> CollisionAvoidanceLayerC; + TrafficMonitorLayerC.SubState -> RF230DriverLayerC; + +// -------- CollisionAvoidance + +#ifdef SLOTTED_MAC + components SlottedCollisionLayerC as CollisionAvoidanceLayerC; +#else + components RandomCollisionLayerC as CollisionAvoidanceLayerC; +#endif + CollisionAvoidanceLayerC.Config -> RF230ActiveMessageP; + CollisionAvoidanceLayerC.SubSend -> SoftwareAckLayerC; + CollisionAvoidanceLayerC.SubReceive -> SoftwareAckLayerC; + +// -------- SoftwareAcknowledgement + + components SoftwareAckLayerC; + SoftwareAckLayerC.Config -> RF230ActiveMessageP; + SoftwareAckLayerC.SubSend -> CsmaLayerC; + SoftwareAckLayerC.SubReceive -> RF230DriverLayerC; + PacketAcknowledgements = SoftwareAckLayerC; + +// -------- Carrier Sense + + components new DummyLayerC() as CsmaLayerC; + CsmaLayerC.Config -> RF230ActiveMessageP; + CsmaLayerC -> RF230DriverLayerC.RadioSend; + CsmaLayerC -> RF230DriverLayerC.RadioCCA; + +// -------- TimeStamping + + components TimeStampingLayerC; + TimeStampingLayerC.LocalTimeRadio -> RF230DriverLayerC; + TimeStampingLayerC.SubPacket -> MetadataFlagsLayerC; + PacketTimeStampRadio = TimeStampingLayerC; + PacketTimeStampMilli = TimeStampingLayerC; + +// -------- MetadataFlags + + components MetadataFlagsLayerC; + MetadataFlagsLayerC.SubPacket -> RF230DriverLayerC; + +// -------- RF230 Driver + + components RF230DriverLayerC; + RF230DriverLayerC.Config -> RF230ActiveMessageP; + RF230DriverLayerC.PacketTimeStamp -> TimeStampingLayerC; + PacketTransmitPower = RF230DriverLayerC.PacketTransmitPower; + PacketLinkQuality = RF230DriverLayerC.PacketLinkQuality; + PacketRSSI = RF230DriverLayerC.PacketRSSI; + LocalTimeRadio = RF230DriverLayerC; +}