[cooja] memory: AvrMoteMemory and MspMoteMemory dummy implementation of MemoryInterface

This commit is contained in:
Enrico Joerns 2014-07-31 16:30:05 +02:00
parent 128ef57289
commit d1c05300a9
2 changed files with 100 additions and 12 deletions

View file

@ -40,10 +40,13 @@ import avrora.core.SourceMapping;
import avrora.core.SourceMapping.Location; import avrora.core.SourceMapping.Location;
import avrora.sim.AtmelInterpreter; import avrora.sim.AtmelInterpreter;
import avrora.sim.Simulator.Watch; import avrora.sim.Simulator.Watch;
import java.util.Map;
import org.contikios.cooja.mote.memory.MemoryInterface;
import org.contikios.cooja.mote.memory.MemoryLayout;
/** /**
* @author Joakim Eriksson * @author Joakim Eriksson
*/ */
public class AvrMoteMemory implements MoteMemory, AddressMemory { public class AvrMoteMemory implements MemoryInterface, MoteMemory, AddressMemory {
private static Logger logger = Logger.getLogger(AvrMoteMemory.class); private static Logger logger = Logger.getLogger(AvrMoteMemory.class);
private SourceMapping memoryMap; private SourceMapping memoryMap;
@ -59,11 +62,6 @@ public class AvrMoteMemory implements MoteMemory, AddressMemory {
public void insertWatch(Watch w, int address) { public void insertWatch(Watch w, int address) {
interpreter.getSimulator().insertWatch(w, address); interpreter.getSimulator().insertWatch(w, address);
} }
@Override
public void clearMemory() {
logger.fatal("not implemented");
}
@Override @Override
public byte[] getMemorySegment(int address, int size) { public byte[] getMemorySegment(int address, int size) {
@ -199,4 +197,50 @@ public class AvrMoteMemory implements MoteMemory, AddressMemory {
logger.warn("Not implemented"); logger.warn("Not implemented");
return 0; return 0;
} }
@Override
public byte[] getMemory() throws MoteMemoryException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public byte[] getMemorySegment(long addr, int size) throws MoteMemoryException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setMemorySegment(long addr, byte[] data) throws MoteMemoryException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void clearMemory() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getStartAddr() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Map<String, Symbol> getSymbolMap() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public MemoryLayout getLayout() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean addSegmentMonitor(SegmentMonitor.EventType flag, long address, int size, SegmentMonitor monitor) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean removeSegmentMonitor(long address, int size, SegmentMonitor monitor) {
throw new UnsupportedOperationException("Not supported yet.");
}
} }

View file

@ -29,18 +29,21 @@
package org.contikios.cooja.mspmote; package org.contikios.cooja.mspmote;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Map;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.contikios.cooja.AddressMemory; import org.contikios.cooja.AddressMemory;
import org.contikios.cooja.Mote; import org.contikios.cooja.Mote;
import org.contikios.cooja.MoteMemory; import org.contikios.cooja.MoteMemory;
import org.contikios.cooja.mote.memory.MemoryInterface;
import org.contikios.cooja.mote.memory.MemoryLayout;
import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.MSP430;
import se.sics.mspsim.core.Memory.AccessMode; import se.sics.mspsim.core.Memory.AccessMode;
import se.sics.mspsim.core.Memory.AccessType; import se.sics.mspsim.core.Memory.AccessType;
import se.sics.mspsim.util.MapEntry; import se.sics.mspsim.util.MapEntry;
public class MspMoteMemory implements MoteMemory, AddressMemory { public class MspMoteMemory implements MemoryInterface, MoteMemory, AddressMemory {
private static Logger logger = Logger.getLogger(MspMoteMemory.class); private static Logger logger = Logger.getLogger(MspMoteMemory.class);
private final ArrayList<MapEntry> mapEntries; private final ArrayList<MapEntry> mapEntries;
@ -87,11 +90,6 @@ public class MspMoteMemory implements MoteMemory, AddressMemory {
return 2; return 2;
} }
@Override
public void clearMemory() {
logger.fatal("clearMemory() not implemented");
}
@Override @Override
public byte[] getMemorySegment(int address, int size) { public byte[] getMemorySegment(int address, int size) {
int[] memInts = new int[size]; int[] memInts = new int[size];
@ -201,6 +199,52 @@ public class MspMoteMemory implements MoteMemory, AddressMemory {
} }
private ArrayList<MemoryCPUMonitor> cpuMonitorArray = new ArrayList<MemoryCPUMonitor>(); private ArrayList<MemoryCPUMonitor> cpuMonitorArray = new ArrayList<MemoryCPUMonitor>();
@Override
public byte[] getMemory() throws MoteMemoryException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public byte[] getMemorySegment(long addr, int size) throws MoteMemoryException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setMemorySegment(long addr, byte[] data) throws MoteMemoryException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void clearMemory() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getStartAddr() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Map<String, Symbol> getSymbolMap() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public MemoryLayout getLayout() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean addSegmentMonitor(SegmentMonitor.EventType flag, long address, int size, SegmentMonitor monitor) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean removeSegmentMonitor(long address, int size, SegmentMonitor monitor) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
class MemoryCPUMonitor extends se.sics.mspsim.core.MemoryMonitor.Adapter { class MemoryCPUMonitor extends se.sics.mspsim.core.MemoryMonitor.Adapter {
public final MemoryMonitor mm; public final MemoryMonitor mm;
public final int address; public final int address;