From: scipio Date: Tue, 19 Dec 2006 17:55:22 +0000 (+0000) Subject: Maintain source addresses on radio->UART. X-Git-Tag: tinyos/2.0.1~247 X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=commitdiff_plain;h=cd0e5f9392936dfaa357848b3f3b119d94960d70;p=tinyos-2.x.git Maintain source addresses on radio->UART. 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? --- diff --git a/apps/BaseStationCC2420/BaseStationP.nc b/apps/BaseStationCC2420/BaseStationP.nc index dd4255a8..7fad5ea4 100644 --- a/apps/BaseStationCC2420/BaseStationP.nc +++ b/apps/BaseStationCC2420/BaseStationP.nc @@ -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 {