]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
add the SendNotifier interface
authormmaroti <mmaroti>
Wed, 8 Apr 2009 22:16:16 +0000 (22:16 +0000)
committermmaroti <mmaroti>
Wed, 8 Apr 2009 22:16:16 +0000 (22:16 +0000)
tos/chips/rf2xx/layers/ActiveMessageLayerC.nc
tos/chips/rf2xx/layers/ActiveMessageLayerP.nc
tos/chips/rf2xx/layers/IEEE154MessageLayerC.nc
tos/chips/rf2xx/layers/IEEE154MessageLayerP.nc
tos/chips/rf2xx/rf212/README [new file with mode: 0644]
tos/chips/rf2xx/rf212/RF212ActiveMessageC.nc
tos/chips/rf2xx/rf212/RF212DriverLayerP.nc
tos/chips/rf2xx/rf212/RF212Ieee154MessageC.nc
tos/chips/rf2xx/rf230/RF230ActiveMessageC.nc
tos/chips/rf2xx/rf230/RF230Ieee154MessageC.nc [new file with mode: 0644]

index 5cc4afe66c08cecf6018e72ea36be145919f3768..29c6d944da4b70beba60246e3a478e60add7b5bf 100755 (executable)
@@ -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;
index c37c2bb8b9f1f8a77a15b68dd1823eedb6e345a6..e80357173b43a29b8c986db6b04aa2a56b529553 100644 (file)
@@ -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)
index 6ac1aa02d95d62eedce32ee2e1b8b10a4b828818..ff23c69cc7685dbf99e70017d95461125823a388 100644 (file)
@@ -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;
 }
index b806b96ca1eefc5f4619a8b41febf75065abed47..5d4f566cc784834edceec417ab170de9d5abc10a 100644 (file)
@@ -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 (file)
index 0000000..99719cd
--- /dev/null
@@ -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.
+
index f390303a8d0dda8aa024bf3f472da4fefbdef8ef..e75824e5c3981fb237a65f7603f9c024c8d9daf4 100644 (file)
@@ -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
 
index 1df169a2b5207cf1f7d5e242d8aad351018ad607..616292dfd2920433839be253df1d9d23bb812298 100644 (file)
@@ -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;
        }
 
index 21eca29b0c8d064cf51f73a8a93b31942683bb8c..2bfdc092ae5599121f7028b5af65e399fab9e8fc 100644 (file)
@@ -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)
 
index a9c4b0f672cae3e4a5c0e8c9f832fc0a8c8c0a5d..4c9ab95d1ae200bc4ee9870487691c5bf16d36d4 100644 (file)
@@ -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 (file)
index 0000000..59b2396
--- /dev/null
@@ -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 <RadioConfig.h>
+
+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<uint8_t> as PacketLinkQuality;
+               interface PacketField<uint8_t> as PacketTransmitPower;
+               interface PacketField<uint8_t> as PacketRSSI;
+
+               interface LocalTime<TRadio> as LocalTimeRadio;
+               interface PacketTimeStamp<TRadio, uint32_t> as PacketTimeStampRadio;
+               interface PacketTimeStamp<TMilli, uint32_t> 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;
+}