]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/cc2420/lpl/DefaultLplP.nc
Upstream commits to tos/chips/cc2420, Aug 7 2008 thru Jul 16 2009, except one.
[tinyos-2.x.git] / tos / chips / cc2420 / lpl / DefaultLplP.nc
index 95c77ed56fb0785b413f99b873037e268599a02f..3ada9db65353e9e75ee182fecf2c558124f87ac0 100644 (file)
@@ -54,7 +54,7 @@ module DefaultLplP {
   uses {
     interface Send as SubSend;
     interface CC2420Transmit as Resend;
-    interface RadioBackoff[am_id_t amId];
+    interface RadioBackoff;
     interface Receive as SubReceive;
     interface AMPacket;
     interface SplitControl as SubControl;
@@ -230,7 +230,7 @@ implementation {
       return 0;
     }
     
-    return (DUTY_ON_TIME * (10000 - dutyCycle)) / dutyCycle;
+    return ((uint32_t)DUTY_ON_TIME * (10000 - dutyCycle)) / dutyCycle;
   }
   
   /**
@@ -245,7 +245,7 @@ implementation {
       return 10000;
     }
     
-    return getActualDutyCycle((DUTY_ON_TIME * 10000) 
+    return getActualDutyCycle(((uint32_t)DUTY_ON_TIME * 10000) 
         / (sleepInterval + DUTY_ON_TIME));
   }
 
@@ -283,7 +283,7 @@ implementation {
       return SUCCESS;
     }
     
-    return FAIL;
+    return EBUSY;
   }
 
   command error_t Send.cancel(message_t *msg) {
@@ -302,40 +302,31 @@ implementation {
     return call SubSend.maxPayloadLength();
   }
 
-  command void *Send.getPayload(message_t* msg) {
-    return call SubSend.getPayload(msg);
+  command void *Send.getPayload(message_t* msg, uint8_t len) {
+    return call SubSend.getPayload(msg, len);
   }
   
   
   /***************** RadioBackoff Events ****************/
-  async event void RadioBackoff.requestInitialBackoff[am_id_t amId](message_t *msg) {
+  async event void RadioBackoff.requestInitialBackoff(message_t *msg) {
     if((call CC2420PacketBody.getMetadata(msg))->rxInterval 
         > ONE_MESSAGE) {
-      call RadioBackoff.setInitialBackoff[amId]( call Random.rand16() 
+      call RadioBackoff.setInitialBackoff( call Random.rand16() 
           % (0x4 * CC2420_BACKOFF_PERIOD) + CC2420_MIN_BACKOFF);
     }
   }
   
-  async event void RadioBackoff.requestCongestionBackoff[am_id_t amId](message_t *msg) {
+  async event void RadioBackoff.requestCongestionBackoff(message_t *msg) {
     if((call CC2420PacketBody.getMetadata(msg))->rxInterval 
         > ONE_MESSAGE) {
-      call RadioBackoff.setCongestionBackoff[amId]( call Random.rand16() 
+      call RadioBackoff.setCongestionBackoff( call Random.rand16() 
           % (0x3 * CC2420_BACKOFF_PERIOD) + CC2420_MIN_BACKOFF);
     }
   }
   
-  async event void RadioBackoff.requestCca[am_id_t amId](message_t *msg) {
+  async event void RadioBackoff.requestCca(message_t *msg) {
   }
   
-  /***************** Receive Commands ***************/
-  command void *Receive.getPayload(message_t* msg, uint8_t* len) {
-    return call SubReceive.getPayload(msg, len);
-  }
-
-  command uint8_t Receive.payloadLength(message_t* msg) {
-    return call SubReceive.payloadLength(msg);
-  }
-
 
   /***************** DutyCycle Events ***************/
   /**