]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/cc2420/CC2420ActiveMessageC.nc
wiring the wrong resource
[tinyos-2.x.git] / tos / chips / cc2420 / CC2420ActiveMessageC.nc
index ef78e86e83e59a3a75a9eb82d7af3967e8b79ac3..752d20a4643c589599b814021fede954a96116ca 100644 (file)
@@ -1,4 +1,4 @@
-/*                                                                     tab:4
+/*
  * "Copyright (c) 2005 Stanford University. All rights reserved.
  *
  * Permission to use, copy, modify, and distribute this software and
 /**
  * The Active Message layer for the CC2420 radio. This configuration
  * just layers the AM dispatch (CC2420ActiveMessageM) on top of the
- * underlying CC2420 radio packet (CC2420CsmaRadioC), which is
+ * underlying CC2420 radio packet (CC2420CsmaCsmaCC), which is
  * inherently an AM packet (acknowledgements based on AM destination
  * addr and group). Note that snooping may not work, due to CC2420
  * early packet rejection if acknowledgements are enabled.
  *
  * @author Philip Levis
+ * @author David Moss
  * @version $Revision$ $Date$
  */
 
 #include "CC2420.h"
+#include "AM.h"
+#include "Ieee154.h"
+
+#ifdef IEEE154FRAMES_ENABLED
+#error "CC2420 AM layer cannot work when IEEE 802.15.4 frames only are used"
+#endif
 
 configuration CC2420ActiveMessageC {
   provides {
@@ -45,30 +52,51 @@ configuration CC2420ActiveMessageC {
     interface Packet;
     interface CC2420Packet;
     interface PacketAcknowledgements;
+    interface LinkPacketMetadata;
+    interface RadioBackoff[am_id_t amId];
+    interface LowPowerListening;
+    interface PacketLink;
+    interface SendNotifier[am_id_t amId];
   }
 }
 implementation {
+  enum {
+    CC2420_AM_SEND_ID     = unique(RADIO_SEND_RESOURCE),
+  };
 
+  components CC2420RadioC as Radio;
   components CC2420ActiveMessageP as AM;
-  components CC2420CsmaC as Radio;
-  components ActiveMessageAddressC as Address;
+  components ActiveMessageAddressC;
+  components CC2420CsmaC as CsmaC;
+  components CC2420ControlC;
+  components CC2420PacketC;
   
   SplitControl = Radio;
-  Packet       = AM;
-
-  AMSend   = AM;
-  Receive  = AM.Receive;
-  Snoop    = AM.Snoop;
+  RadioBackoff = AM;
+  Packet = AM;
+  AMSend = AM;
+  SendNotifier = AM;
+  Receive = AM.Receive;
+  Snoop = AM.Snoop;
   AMPacket = AM;
+  PacketLink = Radio;
+  LowPowerListening = Radio;
+  CC2420Packet = Radio;
+  PacketAcknowledgements = Radio;
+  LinkPacketMetadata = Radio;
   
-  AM.SubSend    -> Radio.Send;
-  AM.SubReceive -> Radio.Receive;
-  AM.amAddress -> Address;
-  Radio.AMPacket -> AM;
-
-  components CC2420PacketC;
-  CC2420Packet = CC2420PacketC;
-  PacketAcknowledgements = CC2420PacketC;
+  // Radio resource for the AM layer
+  AM.RadioResource -> Radio.Resource[CC2420_AM_SEND_ID];
+  AM.SubSend -> Radio.ActiveSend;
+  AM.SubReceive -> Radio.ActiveReceive;
 
+  AM.ActiveMessageAddress -> ActiveMessageAddressC;
+  AM.CC2420Packet -> CC2420PacketC;
+  AM.CC2420PacketBody -> CC2420PacketC;
+  AM.CC2420Config -> CC2420ControlC;
+  
+  AM.SubBackoff -> CsmaC;
 
+  components LedsC;
+  AM.Leds -> LedsC;
 }