]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Maintain source addresses on radio->UART.
authorscipio <scipio>
Tue, 19 Dec 2006 17:55:22 +0000 (17:55 +0000)
committerscipio <scipio>
Tue, 19 Dec 2006 17:55:22 +0000 (17:55 +0000)
Need to discuss with Jonathan how to handle UART->radio. Perhaps the AM
layer should take care of filling in source address, then the BaseStation
can just circumvent this and directly call into CC2420 stack?

apps/BaseStationCC2420/BaseStationP.nc

index dd4255a899478dc824c01d2c6371e0c70c2549cc..7fad5ea43e86d8b1562899a68b3cb8c8e86c9b7c 100644 (file)
@@ -163,7 +163,8 @@ implementation
   task void uartSendTask() {
     uint8_t len;
     am_id_t id;
-    am_addr_t addr;
+    am_addr_t dest;
+    am_addr_t src;
     message_t* msg;
     atomic
       if (uartIn == uartOut && !uartFull)
@@ -175,9 +176,11 @@ implementation
     msg = uartQueue[uartOut];
     tmpLen = len = call RadioPacket.payloadLength(msg);
     id = call RadioAMPacket.type(msg);
-    addr = call RadioAMPacket.destination(msg);
-
-    if (call UartSend.send[id](addr, uartQueue[uartOut], len) == SUCCESS)
+    dest = call RadioAMPacket.destination(msg);
+    src = call RadioAMPacket.source(msg);
+    call UartAMPacket.setSource(msg, src);
+    
+    if (call UartSend.send[id](dest, uartQueue[uartOut], len) == SUCCESS)
       call Leds.led1Toggle();
     else
       {
@@ -237,7 +240,8 @@ implementation
   task void radioSendTask() {
     uint8_t len;
     am_id_t id;
-    am_addr_t addr;
+    am_addr_t dest;
+    am_addr_t src;
     message_t* msg;
     
     atomic
@@ -249,9 +253,11 @@ implementation
 
     msg = radioQueue[radioOut];
     len = call UartPacket.payloadLength(msg);
-    addr = call UartAMPacket.destination(msg);
+    dest = call UartAMPacket.destination(msg);
     id = call UartAMPacket.type(msg);
-    if (call RadioSend.send[id](addr, msg, len) == SUCCESS)
+    src = call UartAMPacket.source(msg);
+    call RadioAMPacket.setSource(msg, src);
+    if (call RadioSend.send[id](dest, msg, len) == SUCCESS)
       call Leds.led0Toggle();
     else
       {