]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/cc2420/csma/CC2420CsmaP.nc
* Removed hardware address recognition to monitor its affect on unit tests, low power...
[tinyos-2.x.git] / tos / chips / cc2420 / csma / CC2420CsmaP.nc
index 9dada4cae5bacfa9ae302ffb80791bad03da1e61..64a9852433ae71fd685d0359665dd2437d0ef8d8 100644 (file)
@@ -38,7 +38,7 @@ module CC2420CsmaP {
 
   provides interface SplitControl;
   provides interface Send;
-  provides interface RadioBackoff[am_id_t amId];
+  provides interface RadioBackoff;
 
   uses interface Resource;
   uses interface CC2420Power;
@@ -46,7 +46,6 @@ module CC2420CsmaP {
   uses interface CC2420Transmit;
   uses interface RadioBackoff as SubBackoff;
   uses interface Random;
-  uses interface AMPacket;
   uses interface Leds;
   uses interface CC2420Packet;
   uses interface CC2420PacketBody;
@@ -141,15 +140,15 @@ implementation {
                     ( 1 << IEEE154_FCF_INTRAPAN ) |
                     ( IEEE154_ADDR_SHORT << IEEE154_FCF_DEST_ADDR_MODE ) |
                     ( IEEE154_ADDR_SHORT << IEEE154_FCF_SRC_ADDR_MODE ) );
-    header->src = call AMPacket.address();
+
     metadata->ack = FALSE;
     metadata->rssi = 0;
     metadata->lqi = 0;
     metadata->time = 0;
     
     ccaOn = TRUE;
-    signal RadioBackoff.requestCca[((cc2420_header_t*)(m_msg->data - 
-        sizeof(cc2420_header_t)))->type](m_msg);
+    signal RadioBackoff.requestCca(m_msg);
+
     call CC2420Transmit.send( m_msg, ccaOn );
     return SUCCESS;
 
@@ -173,7 +172,7 @@ implementation {
    * Must be called within a requestInitialBackoff event
    * @param backoffTime the amount of time in some unspecified units to backoff
    */
-  async command void RadioBackoff.setInitialBackoff[am_id_t amId](uint16_t backoffTime) {
+  async command void RadioBackoff.setInitialBackoff(uint16_t backoffTime) {
     call SubBackoff.setInitialBackoff(backoffTime);
   }
   
@@ -181,7 +180,7 @@ implementation {
    * Must be called within a requestCongestionBackoff event
    * @param backoffTime the amount of time in some unspecified units to backoff
    */
-  async command void RadioBackoff.setCongestionBackoff[am_id_t amId](uint16_t backoffTime) {
+  async command void RadioBackoff.setCongestionBackoff(uint16_t backoffTime) {
     call SubBackoff.setCongestionBackoff(backoffTime);
   }
       
@@ -190,7 +189,7 @@ implementation {
    * event
    * @param ccaOn TRUE to enable CCA, which is the default.
    */
-  async command void RadioBackoff.setCca[am_id_t amId](bool useCca) {
+  async command void RadioBackoff.setCca(bool useCca) {
     ccaOn = useCca;
   }
   
@@ -218,20 +217,19 @@ implementation {
     call SubBackoff.setInitialBackoff ( call Random.rand16() 
         % (0x1F * CC2420_BACKOFF_PERIOD) + CC2420_MIN_BACKOFF);
         
-    signal RadioBackoff.requestInitialBackoff[((cc2420_header_t*)(msg->data - 
-        sizeof(cc2420_header_t)))->type](msg);
+    signal RadioBackoff.requestInitialBackoff(msg);
   }
 
   async event void SubBackoff.requestCongestionBackoff(message_t *msg) {
     call SubBackoff.setCongestionBackoff( call Random.rand16() 
         % (0x7 * CC2420_BACKOFF_PERIOD) + CC2420_MIN_BACKOFF);
 
-    signal RadioBackoff.requestCongestionBackoff[((cc2420_header_t*)(msg->data - 
-        sizeof(cc2420_header_t)))->type](msg);
+    signal RadioBackoff.requestCongestionBackoff(msg);
   }
   
   async event void SubBackoff.requestCca(message_t *msg) {
     // Lower layers than this do not configure the CCA settings
+    signal RadioBackoff.requestCca(msg);
   }
   
   
@@ -280,17 +278,15 @@ implementation {
   default event void SplitControl.stopDone(error_t error) {
   }
   
-  
-  default async event void RadioBackoff.requestInitialBackoff[am_id_t amId](
-      message_t *msg) {
+  default async event void RadioBackoff.requestInitialBackoff(message_t *msg) {
   }
 
-  default async event void RadioBackoff.requestCongestionBackoff[am_id_t amId](
-      message_t *msg) {
+  default async event void RadioBackoff.requestCongestionBackoff(message_t *msg) {
   }
   
-  default async event void RadioBackoff.requestCca[am_id_t amId](
-      message_t *msg) {
+  default async event void RadioBackoff.requestCca(message_t *msg) {
   }
+  
+  
 }