From cd0e5f9392936dfaa357848b3f3b119d94960d70 Mon Sep 17 00:00:00 2001 From: scipio Date: Tue, 19 Dec 2006 17:55:22 +0000 Subject: [PATCH] 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? --- apps/BaseStationCC2420/BaseStationP.nc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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 { -- 2.39.2