From 129a854b54d0d78fdd05caeb748a060514a7d5c5 Mon Sep 17 00:00:00 2001 From: Fredrik Osterlind Date: Fri, 9 Mar 2012 14:56:09 +0100 Subject: [PATCH] all mote memories now support symbol addresses added memory monitor methods (was previously only supported by emulated motes) --- .../cooja/java/se/sics/cooja/MoteMemory.java | 13 ++++++++++- .../cooja/motes/AbstractEmulatedMote.java | 23 ------------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/MoteMemory.java b/tools/cooja/java/se/sics/cooja/MoteMemory.java index 08184a0d9..00d0460e3 100644 --- a/tools/cooja/java/se/sics/cooja/MoteMemory.java +++ b/tools/cooja/java/se/sics/cooja/MoteMemory.java @@ -31,6 +31,7 @@ package se.sics.cooja; + /** * This interface represents a mote memory. * @@ -44,7 +45,7 @@ package se.sics.cooja; * @see se.sics.cooja.SectionMoteMemory * @author Fredrik Osterlind */ -public interface MoteMemory { +public interface MoteMemory extends AddressMemory { /** * Clears the entire memory. @@ -77,4 +78,14 @@ public interface MoteMemory { */ public int getTotalSize(); + public abstract int parseInt(byte[] memorySegment); + + public enum MemoryEventType { READ, WRITE }; + + public interface MemoryMonitor { + public void memoryChanged(MoteMemory memory, MemoryEventType type, int address); + } + + public boolean addMemoryMonitor(int address, int size, MemoryMonitor mm); + public void removeMemoryMonitor(int address, int size, MemoryMonitor mm); } diff --git a/tools/cooja/java/se/sics/cooja/motes/AbstractEmulatedMote.java b/tools/cooja/java/se/sics/cooja/motes/AbstractEmulatedMote.java index 1d9dae44e..c008d017c 100644 --- a/tools/cooja/java/se/sics/cooja/motes/AbstractEmulatedMote.java +++ b/tools/cooja/java/se/sics/cooja/motes/AbstractEmulatedMote.java @@ -64,27 +64,4 @@ public abstract class AbstractEmulatedMote extends AbstractWakeupMote implements public String getStackTrace() { return null; } - - public interface MemoryMonitor { - public boolean start(int address, int size); - public void stop(); - public Mote getMote(); - public int getAddress(); - public int getSize(); - - public void setLastBufferAccess(BufferAccess ba); - public BufferAccess getLastBufferAccess(); - - public boolean isPointer(); - public void setPointer(boolean isPointer, MemoryMonitor pointedMemory); - public MemoryMonitor getPointedMemory(); - } - - public enum MemoryEventType { READ, WRITE, UNKNOWN }; - public interface MemoryEventHandler { - public void event(MemoryMonitor mm, MemoryEventType type, int adr, int data); - } - - public abstract MemoryMonitor createMemoryMonitor(MemoryEventHandler meh); - }