From d8d94d0cd8398bec8d250f460eab738a65c61be6 Mon Sep 17 00:00:00 2001 From: Fredrik Osterlind Date: Mon, 21 Mar 2011 14:14:16 +0100 Subject: [PATCH] bugfix in writing tinyos addresses --- .../cooja/mspmote/interfaces/MspMoteID.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/MspMoteID.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/MspMoteID.java index 66e767511..0c8f61ce3 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/MspMoteID.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/MspMoteID.java @@ -109,6 +109,34 @@ public class MspMoteID extends MoteID { } }); } + if (moteMem.variableExists("ActiveMessageAddressC__addr")) { + this.mote.getCPU().setBreakPoint(moteMem.getVariableAddress("ActiveMessageAddressC__addr"), new CPUMonitor() { + public void cpuAction(int type, int adr, int data) { + if (type != MEMORY_WRITE) { + return; + } + if (data == moteID) { + return; + } + Simulation s = mote.getSimulation(); + s.scheduleEvent(writeIDEvent, s.getSimulationTime()); + } + }); + } + if (moteMem.variableExists("ActiveMessageAddressC$addr")) { + this.mote.getCPU().setBreakPoint(moteMem.getVariableAddress("ActiveMessageAddressC$addr"), new CPUMonitor() { + public void cpuAction(int type, int adr, int data) { + if (type != MEMORY_WRITE) { + return; + } + if (data == moteID) { + return; + } + Simulation s = mote.getSimulation(); + s.scheduleEvent(writeIDEvent, s.getSimulationTime()); + } + }); + } } public int getMoteID() {