You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(21) |
Nov
(12) |
Dec
(41) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(25) |
Feb
(54) |
Mar
(63) |
Apr
(52) |
May
(17) |
Jun
(3) |
Jul
(3) |
Aug
(5) |
Sep
(49) |
Oct
(50) |
Nov
(34) |
Dec
(14) |
2009 |
Jan
(9) |
Feb
(15) |
Mar
(38) |
Apr
(12) |
May
(35) |
Jun
(20) |
Jul
(2) |
Aug
(7) |
Sep
(36) |
Oct
(24) |
Nov
(2) |
Dec
(2) |
2010 |
Jan
(14) |
Feb
(1) |
Mar
(36) |
Apr
(2) |
May
(4) |
Jun
(6) |
Jul
(35) |
Aug
(11) |
Sep
(8) |
Oct
(3) |
Nov
|
Dec
(1) |
2011 |
Jan
(11) |
Feb
(12) |
Mar
(3) |
Apr
(7) |
May
(12) |
Jun
(8) |
Jul
|
Aug
(3) |
Sep
(4) |
Oct
|
Nov
(2) |
Dec
(4) |
2012 |
Jan
(2) |
Feb
(1) |
Mar
(14) |
Apr
(5) |
May
(28) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(21) |
Nov
(4) |
Dec
(1) |
2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jo...@us...> - 2009-03-13 15:53:32
|
Revision: 487 http://mspsim.svn.sourceforge.net/mspsim/?rev=487&view=rev Author: joxe Date: 2009-03-13 15:53:07 +0000 (Fri, 13 Mar 2009) Log Message: ----------- added warning on too large packets in CC2420 Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java mspsim/se/sics/mspsim/core/EmulationException.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2009-03-12 13:50:42 UTC (rev 486) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2009-03-13 15:53:07 UTC (rev 487) @@ -631,7 +631,14 @@ } if (DEBUG) log("Writing data: " + data + " to tx: " + txCursor); - memory[RAM_TXFIFO + txCursor++] = data & 0xff; + if(txCursor == 0 && (data & 0xff) > 127) { + logger.warning(this, "CC2420: Warning - packet size too large"); + } + memory[RAM_TXFIFO + txCursor] = data & 0xff; + txCursor = (txCursor + 1) & 127; + if (txCursor == 0) { + logger.warning(this, "CC2420: Warning - TX Cursor wrapped"); + } if (sendEvents) { sendEvent("WRITE_TXFIFO", null); } Modified: mspsim/se/sics/mspsim/core/EmulationException.java =================================================================== --- mspsim/se/sics/mspsim/core/EmulationException.java 2009-03-12 13:50:42 UTC (rev 486) +++ mspsim/se/sics/mspsim/core/EmulationException.java 2009-03-13 15:53:07 UTC (rev 487) @@ -1,6 +1,6 @@ package se.sics.mspsim.core; -public class EmulationException extends Exception { +public class EmulationException extends RuntimeException { private static final long serialVersionUID = -3837451031129913060L; public EmulationException(String msg) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-03-12 13:50:45
|
Revision: 486 http://mspsim.svn.sourceforge.net/mspsim/?rev=486&view=rev Author: joxe Date: 2009-03-12 13:50:42 +0000 (Thu, 12 Mar 2009) Log Message: ----------- fixed stacktrace on watchdog trigger Modified Paths: -------------- mspsim/se/sics/mspsim/core/Watchdog.java Modified: mspsim/se/sics/mspsim/core/Watchdog.java =================================================================== --- mspsim/se/sics/mspsim/core/Watchdog.java 2009-03-12 13:28:52 UTC (rev 485) +++ mspsim/se/sics/mspsim/core/Watchdog.java 2009-03-12 13:50:42 UTC (rev 486) @@ -97,7 +97,8 @@ private void triggerWDT(long time) { // Here the WDT triggered!!! - System.out.println("WDT trigger - should reset?!?!"); + System.out.println("WDT trigger - will reset node!"); + cpu.generateTrace(System.out); cpu.flagInterrupt(RESET_VECTOR, this, true); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-03-12 13:29:04
|
Revision: 485 http://mspsim.svn.sourceforge.net/mspsim/?rev=485&view=rev Author: nifi Date: 2009-03-12 13:28:52 +0000 (Thu, 12 Mar 2009) Log Message: ----------- fixed bug in profiler logcalls output Modified Paths: -------------- mspsim/se/sics/mspsim/util/SimpleProfiler.java Modified: mspsim/se/sics/mspsim/util/SimpleProfiler.java =================================================================== --- mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-03-12 12:32:55 UTC (rev 484) +++ mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-03-12 13:28:52 UTC (rev 485) @@ -168,8 +168,8 @@ if (logger != null && !hideIRQ) { logger.println("----- Interrupt vector " + servicedInterrupt + " returned - elapsed: " + (cycles - lastInterruptTime[servicedInterrupt])); - interruptLevel = 0; } + interruptLevel = 0; /* what if interrupt from interrupt ? */ servicedInterrupt = -1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-03-12 12:33:00
|
Revision: 484 http://mspsim.svn.sourceforge.net/mspsim/?rev=484&view=rev Author: nifi Date: 2009-03-12 12:32:55 +0000 (Thu, 12 Mar 2009) Log Message: ----------- added setEmulationLogger() to Loggable and change cpu to set EmulationLogger to chips Modified Paths: -------------- mspsim/se/sics/mspsim/core/Chip.java mspsim/se/sics/mspsim/core/Loggable.java mspsim/se/sics/mspsim/core/MSP430Core.java mspsim/se/sics/mspsim/platform/GenericNode.java Modified: mspsim/se/sics/mspsim/core/Chip.java =================================================================== --- mspsim/se/sics/mspsim/core/Chip.java 2009-03-12 12:04:07 UTC (rev 483) +++ mspsim/se/sics/mspsim/core/Chip.java 2009-03-12 12:32:55 UTC (rev 484) @@ -54,6 +54,7 @@ protected boolean sendEvents = false; private String[] modeNames = null; private int mode; + protected EmulationLogger logger; private PrintStream log; protected boolean DEBUG = false; @@ -154,4 +155,8 @@ } } + public void setEmulationLogger(EmulationLogger logger) { + this.logger = logger; + } + } Modified: mspsim/se/sics/mspsim/core/Loggable.java =================================================================== --- mspsim/se/sics/mspsim/core/Loggable.java 2009-03-12 12:04:07 UTC (rev 483) +++ mspsim/se/sics/mspsim/core/Loggable.java 2009-03-12 12:32:55 UTC (rev 484) @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * This file is part of MSPSim. - * + * */ package se.sics.mspsim.core; import java.io.PrintStream; @@ -37,7 +37,8 @@ */ public interface Loggable { + public void setEmulationLogger(EmulationLogger log); public void setLogStream(PrintStream out); public void clearLogStream(); - -} \ No newline at end of file + +} Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-12 12:04:07 UTC (rev 483) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-12 12:32:55 UTC (rev 484) @@ -42,7 +42,6 @@ package se.sics.mspsim.core; import java.io.PrintStream; import java.util.ArrayList; - import se.sics.mspsim.util.Utils; /** @@ -119,10 +118,7 @@ private BasicClockModule bcs; private ArrayList<Chip> chips = new ArrayList<Chip>(); - private EmulationLogger logger; - Profiler profiler; - public MSP430Core(int type) { // Ignore type for now... @@ -259,6 +255,7 @@ public void addChip(Chip chip) { chips.add(chip); + chip.setEmulationLogger(logger); } public Chip getChip(String name) { @@ -280,7 +277,7 @@ } public Chip[] getChips() { - return (Chip[]) chips.toArray(new Chip[chips.size()]); + return chips.toArray(new Chip[chips.size()]); } public void setBreakPoint(int address, CPUMonitor mon) { @@ -534,13 +531,11 @@ resetIOUnits(); } - - public void setLogger(EmulationLogger logger) { - this.logger = logger; - } - + public void setWarningMode(EmulationLogger.WarningMode mode) { - logger.setWarningMode(mode); + if (logger != null) { + logger.setWarningMode(mode); + } } public void reset() { @@ -650,22 +645,24 @@ } void printWarning(int type, int address) throws EmulationException { - String message = ""; + String message = null; switch(type) { case MISALIGNED_READ: - message = "**** Illegal read - misaligned word from: " + + message = "**** Illegal read - misaligned word from $" + Utils.hex16(address) + " at $" + Utils.hex16(reg[PC]); break; case MISALIGNED_WRITE: - message = "**** Illegal write - misaligned word to: " + + message = "**** Illegal write - misaligned word to $" + Utils.hex16(address) + " at $" + Utils.hex16(reg[PC]); break; } - logger.warning(this, message); + if (logger != null && message != null) { + logger.warning(this, message); + } } public void generateTrace(PrintStream out) { - /* overide if a stack trace or other additional warning info should + /* Override if a stack trace or other additional warning info should * be printed */ } @@ -1265,4 +1262,5 @@ public int getModeMax() { return MODE_MAX; } + } Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2009-03-12 12:04:07 UTC (rev 483) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2009-03-12 12:32:55 UTC (rev 484) @@ -187,7 +187,7 @@ registry.registerComponent("cpu", cpu); registry.registerComponent("node", this); registry.registerComponent("config", config); - cpu.setLogger(logger); + cpu.setEmulationLogger(logger); CommandHandler ch = (CommandHandler) registry.getComponent("commandHandler"); if (ch == null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-03-12 12:04:14
|
Revision: 483 http://mspsim.svn.sourceforge.net/mspsim/?rev=483&view=rev Author: nifi Date: 2009-03-12 12:04:07 +0000 (Thu, 12 Mar 2009) Log Message: ----------- fixed compiler warning Modified Paths: -------------- mspsim/se/sics/mspsim/util/ComponentRegistry.java Modified: mspsim/se/sics/mspsim/util/ComponentRegistry.java =================================================================== --- mspsim/se/sics/mspsim/util/ComponentRegistry.java 2009-03-12 12:01:17 UTC (rev 482) +++ mspsim/se/sics/mspsim/util/ComponentRegistry.java 2009-03-12 12:04:07 UTC (rev 483) @@ -23,7 +23,6 @@ return null; } - @SuppressWarnings("unchecked") public synchronized Object[] getAllComponents(String name) { ArrayList<Object> list = new ArrayList<Object>(); for (int i = 0, n = components.size(); i < n; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-03-12 12:01:24
|
Revision: 482 http://mspsim.svn.sourceforge.net/mspsim/?rev=482&view=rev Author: nifi Date: 2009-03-12 12:01:17 +0000 (Thu, 12 Mar 2009) Log Message: ----------- made log calls output somewhat shorter Modified Paths: -------------- mspsim/se/sics/mspsim/util/SimpleProfiler.java Modified: mspsim/se/sics/mspsim/util/SimpleProfiler.java =================================================================== --- mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-03-11 23:23:30 UTC (rev 481) +++ mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-03-12 12:01:17 UTC (rev 482) @@ -107,7 +107,8 @@ if ((!hideIRQ || servicedInterrupt == -1) && hide == 0) { if (servicedInterrupt >= 0) logger.printf("[%2d] ", servicedInterrupt); printSpace(logger, cSP * 2 - interruptLevel); - logger.println("Call to: " + entry); + logger.println("Call to $" + Utils.hex16(entry.getAddress()) + + ": " + entry.getInfo()); if (ignoreFunctions.get(entry.getName()) != null) { hide = 1; } @@ -122,7 +123,6 @@ newIRQ = false; } - public void profileReturn(long cycles) { CallEntry cspEntry = callStack[--cSP]; MapEntry fkn = cspEntry.function; @@ -132,8 +132,8 @@ if (cspEntry.calls >= 0) { CallEntry ce = profileData.get(fkn); if (ce == null) { - profileData.put(fkn, ce = new CallEntry()); - ce.function = fkn; + profileData.put(fkn, ce = new CallEntry()); + ce.function = fkn; } ce.cycles += elapsed; ce.calls++; @@ -142,7 +142,7 @@ if ((cspEntry.hide <= 1) && (!hideIRQ || servicedInterrupt == -1)) { if (servicedInterrupt >= 0) logger.printf("[%2d] ",servicedInterrupt); printSpace(logger, cSP * 2 - interruptLevel); - logger.println("return from: " + ce.function + " elapsed time: " + elapsed); + logger.println("return from " + ce.function.getInfo() + " elapsed: " + elapsed); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-03-11 23:23:51
|
Revision: 481 http://mspsim.svn.sourceforge.net/mspsim/?rev=481&view=rev Author: joxe Date: 2009-03-11 23:23:30 +0000 (Wed, 11 Mar 2009) Log Message: ----------- fixed call logger to enable hiding specified function calls Modified Paths: -------------- mspsim/se/sics/mspsim/util/SimpleProfiler.java Modified: mspsim/se/sics/mspsim/util/SimpleProfiler.java =================================================================== --- mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-03-11 22:49:37 UTC (rev 480) +++ mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-03-11 23:23:30 UTC (rev 481) @@ -70,6 +70,7 @@ private long[] interruptCount = new long[16]; private int servicedInterrupt; private int interruptLevel; + private boolean newIRQ; public SimpleProfiler() { profileData = new HashMap<MapEntry, CallEntry>(); @@ -97,27 +98,38 @@ if (callStack[cSP] == null) { callStack[cSP] = new CallEntry(); } - + int hide = 0; if (logger != null) { - if (!hideIRQ || servicedInterrupt == -1) { + /* hide this if last call was to be hidden */ + hide = (cSP == 0 || newIRQ) ? 0 : callStack[cSP - 1].hide; + /* increase level of "hide" if last was hidden */ + if (hide > 0) hide++; + if ((!hideIRQ || servicedInterrupt == -1) && hide == 0) { if (servicedInterrupt >= 0) logger.printf("[%2d] ", servicedInterrupt); printSpace(logger, cSP * 2 - interruptLevel); logger.println("Call to: " + entry); + if (ignoreFunctions.get(entry.getName()) != null) { + hide = 1; + } } } - - callStack[cSP].function = entry; - callStack[cSP].calls = 0; - callStack[cSP++].cycles = cycles; + + CallEntry ce = callStack[cSP++]; + ce.function = entry; + ce.calls = 0; + ce.cycles = cycles; + ce.hide = hide; + newIRQ = false; } public void profileReturn(long cycles) { - MapEntry fkn = callStack[--cSP].function; + CallEntry cspEntry = callStack[--cSP]; + MapEntry fkn = cspEntry.function; // System.out.println("Profiler: return / call stack: " + cSP + ", " + fkn); - long elapsed = cycles - callStack[cSP].cycles; - if (callStack[cSP].calls >= 0) { + long elapsed = cycles - cspEntry.cycles; + if (cspEntry.calls >= 0) { CallEntry ce = profileData.get(fkn); if (ce == null) { profileData.put(fkn, ce = new CallEntry()); @@ -127,19 +139,21 @@ ce.calls++; if (logger != null) { - if (!hideIRQ || servicedInterrupt == -1) { + if ((cspEntry.hide <= 1) && (!hideIRQ || servicedInterrupt == -1)) { if (servicedInterrupt >= 0) logger.printf("[%2d] ",servicedInterrupt); printSpace(logger, cSP * 2 - interruptLevel); logger.println("return from: " + ce.function + " elapsed time: " + elapsed); } } } + newIRQ = false; } public void profileInterrupt(int vector, long cycles) { servicedInterrupt = vector; lastInterruptTime[servicedInterrupt] = cycles; interruptLevel = cSP * 2; + newIRQ = true; if (logger != null && !hideIRQ) { logger.println("----- Interrupt vector " + vector + " start execution -----"); } @@ -150,7 +164,7 @@ interruptTime[servicedInterrupt] += cycles - lastInterruptTime[servicedInterrupt]; interruptCount[servicedInterrupt]++; } - + newIRQ = false; if (logger != null && !hideIRQ) { logger.println("----- Interrupt vector " + servicedInterrupt + " returned - elapsed: " + (cycles - lastInterruptTime[servicedInterrupt])); @@ -239,6 +253,7 @@ MapEntry function; long cycles; int calls; + int hide; public int compareTo(CallEntry o) { long diff = o.cycles - cycles; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-03-11 22:49:55
|
Revision: 480 http://mspsim.svn.sourceforge.net/mspsim/?rev=480&view=rev Author: nifi Date: 2009-03-11 22:49:37 +0000 (Wed, 11 Mar 2009) Log Message: ----------- added getArgumentAsBoolean() to CommandContext Modified Paths: -------------- mspsim/se/sics/mspsim/cli/CommandContext.java mspsim/se/sics/mspsim/cli/ProfilerCommands.java Modified: mspsim/se/sics/mspsim/cli/CommandContext.java =================================================================== --- mspsim/se/sics/mspsim/cli/CommandContext.java 2009-03-11 22:28:15 UTC (rev 479) +++ mspsim/se/sics/mspsim/cli/CommandContext.java 2009-03-11 22:49:37 UTC (rev 480) @@ -174,6 +174,11 @@ } } + public boolean getArgumentAsBoolean(int index) { + String v = getArgument(index); + return "true".equalsIgnoreCase(v) || "1".equals(v); + } + public int executeCommand(String command) { return commandHandler.executeCommand(command, this); } Modified: mspsim/se/sics/mspsim/cli/ProfilerCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/ProfilerCommands.java 2009-03-11 22:28:15 UTC (rev 479) +++ mspsim/se/sics/mspsim/cli/ProfilerCommands.java 2009-03-11 22:49:37 UTC (rev 480) @@ -194,7 +194,7 @@ profiler.addIgnoreFunction(context.getArgument(j)); } } else if ("hideirq".equals(cmd)) { - profiler.setHideIRQ(context.getArgument(1).equals("1")); + profiler.setHideIRQ(context.getArgumentAsBoolean(1)); } return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-03-11 22:28:35
|
Revision: 479 http://mspsim.svn.sourceforge.net/mspsim/?rev=479&view=rev Author: joxe Date: 2009-03-11 22:28:15 +0000 (Wed, 11 Mar 2009) Log Message: ----------- minor bugfix of ADC12 Modified Paths: -------------- mspsim/se/sics/mspsim/core/ADC12.java Modified: mspsim/se/sics/mspsim/core/ADC12.java =================================================================== --- mspsim/se/sics/mspsim/core/ADC12.java 2009-03-11 22:22:40 UTC (rev 478) +++ mspsim/se/sics/mspsim/core/ADC12.java 2009-03-11 22:28:15 UTC (rev 479) @@ -203,11 +203,11 @@ if (address >= ADC12MCTL0 && address <= ADC12MCTL15) { return adc12mctl[address - ADC12MCTL0]; } else if (address >= ADC12MEM0) { - int reg = address - ADC12MEM0; + int reg = (address - ADC12MEM0) / 2; // Clear ifg! adc12ifg &= ~(1 << reg); // System.out.println("Read ADCMEM" + (reg / 2)); - if (adc12iv == reg + 6) { + if (adc12iv == reg * 2 + 6) { core.flagInterrupt(adc12Vector, this, false); adc12iv = 0; // System.out.println("** de-Trigger ADC12 IRQ for ADCMEM" + adc12Pos); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-03-11 22:23:11
|
Revision: 478 http://mspsim.svn.sourceforge.net/mspsim/?rev=478&view=rev Author: joxe Date: 2009-03-11 22:22:40 +0000 (Wed, 11 Mar 2009) Log Message: ----------- added command for configuring profiler and added ignore for IRQ during logcalls Modified Paths: -------------- mspsim/se/sics/mspsim/cli/ProfilerCommands.java mspsim/se/sics/mspsim/util/SimpleProfiler.java Modified: mspsim/se/sics/mspsim/cli/ProfilerCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/ProfilerCommands.java 2009-03-11 21:13:25 UTC (rev 477) +++ mspsim/se/sics/mspsim/cli/ProfilerCommands.java 2009-03-11 22:22:40 UTC (rev 478) @@ -162,7 +162,6 @@ ch.registerCommand("logcalls", new BasicAsyncCommand("log function calls", "") { - @Override public int executeCommand(CommandContext context) { Profiler profiler = cpu.getProfiler(); if (profiler == null) { @@ -179,6 +178,27 @@ } } }); + + ch.registerCommand("profiler", new BasicCommand("configure profiler", + "<command> <arguments>") { + public int executeCommand(CommandContext context) { + // TODO: add more API's to the Profiler??? + SimpleProfiler profiler = (SimpleProfiler) cpu.getProfiler(); + if (profiler == null) { + context.err.println("No profiler found."); + return 1; + } + String cmd = context.getArgument(0); + if ("hide".equals(cmd)) { + for (int j = 1, n = context.getArgumentCount(); j < n; j++) { + profiler.addIgnoreFunction(context.getArgument(j)); + } + } else if ("hideirq".equals(cmd)) { + profiler.setHideIRQ(context.getArgument(1).equals("1")); + } + return 0; + } + }); } } Modified: mspsim/se/sics/mspsim/util/SimpleProfiler.java =================================================================== --- mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-03-11 21:13:25 UTC (rev 477) +++ mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-03-11 22:22:40 UTC (rev 478) @@ -47,21 +47,23 @@ import se.sics.mspsim.core.Profiler; import java.io.PrintStream; import java.util.Arrays; -import java.util.Hashtable; +import java.util.HashMap; import java.util.regex.Pattern; public class SimpleProfiler implements Profiler, EventListener { - private Hashtable<MapEntry,CallEntry> profileData; - private Hashtable<String, TagEntry> tagProfiles; - private Hashtable<String, TagEntry> startTags; - private Hashtable<String, TagEntry> endTags; + private HashMap<MapEntry,CallEntry> profileData; + private HashMap<String, TagEntry> tagProfiles; + private HashMap<String, TagEntry> startTags; + private HashMap<String, TagEntry> endTags; + private HashMap<String, String> ignoreFunctions; private CallEntry[] callStack; private int cSP = 0; private MSP430Core cpu; private PrintStream logger; - + private boolean hideIRQ = false; + /* statistics for interrupts */ private long[] lastInterruptTime = new long[16]; private long[] interruptTime = new long[16]; @@ -70,10 +72,11 @@ private int interruptLevel; public SimpleProfiler() { - profileData = new Hashtable<MapEntry, CallEntry>(); - tagProfiles = new Hashtable<String, TagEntry>(); - startTags = new Hashtable<String, TagEntry>(); - endTags = new Hashtable<String, TagEntry>(); + profileData = new HashMap<MapEntry, CallEntry>(); + tagProfiles = new HashMap<String, TagEntry>(); + startTags = new HashMap<String, TagEntry>(); + endTags = new HashMap<String, TagEntry>(); + ignoreFunctions = new HashMap<String, String>(); callStack = new CallEntry[2048]; servicedInterrupt = -1; } @@ -82,15 +85,25 @@ this.cpu = cpu; } + public void setHideIRQ(boolean hide) { + hideIRQ = hide; + } + + public void addIgnoreFunction(String function) { + ignoreFunctions.put(function, function); + } + public void profileCall(MapEntry entry, long cycles) { if (callStack[cSP] == null) { callStack[cSP] = new CallEntry(); } if (logger != null) { - if (servicedInterrupt >= 0) logger.printf("[%2d] ",servicedInterrupt); - printSpace(logger, cSP * 2); - logger.println("Call to: " + entry); + if (!hideIRQ || servicedInterrupt == -1) { + if (servicedInterrupt >= 0) logger.printf("[%2d] ", servicedInterrupt); + printSpace(logger, cSP * 2 - interruptLevel); + logger.println("Call to: " + entry); + } } callStack[cSP].function = entry; @@ -114,10 +127,12 @@ ce.calls++; if (logger != null) { - if (servicedInterrupt >= 0) logger.printf("[%2d] ",servicedInterrupt); - printSpace(logger, cSP * 2 - interruptLevel); - logger.println("return from: " + ce.function + " elapsed time: " + elapsed); - } + if (!hideIRQ || servicedInterrupt == -1) { + if (servicedInterrupt >= 0) logger.printf("[%2d] ",servicedInterrupt); + printSpace(logger, cSP * 2 - interruptLevel); + logger.println("return from: " + ce.function + " elapsed time: " + elapsed); + } + } } } @@ -125,7 +140,7 @@ servicedInterrupt = vector; lastInterruptTime[servicedInterrupt] = cycles; interruptLevel = cSP * 2; - if (logger != null) { + if (logger != null && !hideIRQ) { logger.println("----- Interrupt vector " + vector + " start execution -----"); } } @@ -136,7 +151,7 @@ interruptCount[servicedInterrupt]++; } - if (logger != null) { + if (logger != null && !hideIRQ) { logger.println("----- Interrupt vector " + servicedInterrupt + " returned - elapsed: " + (cycles - lastInterruptTime[servicedInterrupt])); interruptLevel = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-03-11 21:13:42
|
Revision: 477 http://mspsim.svn.sourceforge.net/mspsim/?rev=477&view=rev Author: joxe Date: 2009-03-11 21:13:25 +0000 (Wed, 11 Mar 2009) Log Message: ----------- added profiling of interrupts into profiler and removed from core Modified Paths: -------------- mspsim/se/sics/mspsim/cli/ProfilerCommands.java mspsim/se/sics/mspsim/core/MSP430.java mspsim/se/sics/mspsim/core/MSP430Core.java mspsim/se/sics/mspsim/core/Profiler.java mspsim/se/sics/mspsim/core/Watchdog.java mspsim/se/sics/mspsim/util/SimpleProfiler.java Modified: mspsim/se/sics/mspsim/cli/ProfilerCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/ProfilerCommands.java 2009-03-10 18:16:06 UTC (rev 476) +++ mspsim/se/sics/mspsim/cli/ProfilerCommands.java 2009-03-11 21:13:25 UTC (rev 477) @@ -94,21 +94,21 @@ }); - ch.registerCommand("irqprofile", new BasicCommand("show interrupt profile", "") { - public int executeCommand(CommandContext context) { - long[] time = cpu.getInterruptTime(); - long[] ctr = cpu.getInterruptCount(); - context.out.println("Interrupt statistics"); - context.out.println("Vector\tAvg\tCount"); - - for (int i = 0; i < ctr.length; i++) { - long avg = ctr[i] != 0 ? (time[i] / ctr[i]) : 0; - context.out.println(i + "\t" + avg + "\t" + ctr[i]); - } - return 0; - } - - }); +// ch.registerCommand("irqprofile", new BasicCommand("show interrupt profile", "") { +// public int executeCommand(CommandContext context) { +// long[] time = cpu.getInterruptTime(); +// long[] ctr = cpu.getInterruptCount(); +// context.out.println("Interrupt statistics"); +// context.out.println("Vector\tAvg\tCount"); +// +// for (int i = 0; i < ctr.length; i++) { +// long avg = ctr[i] != 0 ? (time[i] / ctr[i]) : 0; +// context.out.println(i + "\t" + avg + "\t" + ctr[i]); +// } +// return 0; +// } +// +// }); ch.registerCommand("logevents", new BasicAsyncCommand("log events", "") { Chip chip; Modified: mspsim/se/sics/mspsim/core/MSP430.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430.java 2009-03-10 18:16:06 UTC (rev 476) +++ mspsim/se/sics/mspsim/core/MSP430.java 2009-03-11 21:13:25 UTC (rev 477) @@ -66,7 +66,6 @@ private long instCtr = 0; private DisAsm disAsm; private MapTable map; - private Profiler profiler; private SimEventListener[] simEventListeners; @@ -329,16 +328,12 @@ debug = db; } - public Profiler getProfiler() { - return profiler; - } - public void setMap(MapTable map) { this.map = map; /* When we got the map table we can also profile! */ if (profiler == null) { - this.profiler = new SimpleProfiler(); - this.profiler.setCPU(this); + setProfiler(new SimpleProfiler()); + profiler.setCPU(this); } } Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-10 18:16:06 UTC (rev 476) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-11 21:13:25 UTC (rev 477) @@ -63,7 +63,7 @@ public CPUMonitor[] regWriteMonitors = new CPUMonitor[16]; public CPUMonitor[] regReadMonitors = new CPUMonitor[16]; - + // For breakpoints, etc... how should memory monitors be implemented? // Maybe monitors should have a "next" pointer...? or just have a [][]? public CPUMonitor[] breakPoints = new CPUMonitor[MAX_MEM]; @@ -121,11 +121,9 @@ private EmulationLogger logger; - /* statistics for interrupts */ - private long[] lastInterruptTime = new long[16]; - private long[] interruptTime = new long[16]; - private long[] interruptCount = new long[16]; + Profiler profiler; + public MSP430Core(int type) { // Ignore type for now... setModeNames(MODE_NAMES); @@ -239,6 +237,14 @@ if (DEBUG) System.out.println("Number of passive: " + passIO); } + public Profiler getProfiler() { + return profiler; + } + + public void setProfiler(Profiler prof) { + profiler = prof; + } + /* returns port 1 ... 6 */ public IOPort getIOPort(int portID) { if (portID > 0 && portID < 7) { @@ -514,8 +520,6 @@ private void internalReset() { for (int i = 0, n = 16; i < n; i++) { interruptSource[i] = null; - interruptTime[i] = 0; - interruptCount[i] = 0; } servicedInterruptUnit = null; servicedInterrupt = -1; @@ -528,6 +532,7 @@ bcs.reset(); // Needs to be last since these can add events... resetIOUnits(); + } public void setLogger(EmulationLogger logger) { @@ -537,15 +542,7 @@ public void setWarningMode(EmulationLogger.WarningMode mode) { logger.setWarningMode(mode); } - - public long[] getInterruptCount() { - return interruptCount; - } - public long[] getInterruptTime() { - return interruptTime; - } - public void reset() { flagInterrupt(15, null, true); } @@ -601,10 +598,6 @@ // In the main-CPU loop public void handlePendingInterrupts() { // By default no int. left to process... - if (servicedInterrupt > -1) { - interruptTime[servicedInterrupt] += cycles - lastInterruptTime[servicedInterrupt]; - interruptCount[servicedInterrupt]++; - } reevaluateInterrupts(); @@ -682,6 +675,10 @@ int sp = spBefore; int sr = readRegister(SR); + if (profiler != null) { + profiler.profileInterrupt(interruptMax, cycles); + } + // Only store stuff on irq except reset... - not sure if this is correct... // TODO: Check what to do if reset is called! if (interruptMax < 15) { @@ -708,8 +705,6 @@ servicedInterrupt = interruptMax; servicedInterruptUnit = interruptSource[servicedInterrupt]; - lastInterruptTime[servicedInterrupt] = cycles; - // Flag off this interrupt - for now - as soon as RETI is // executed things might change! reevaluateInterrupts(); @@ -959,7 +954,10 @@ System.out.println("### RETI at " + pc + " => " + reg[PC] + " SP after: " + reg[SP]); } - + if (profiler != null) { + profiler.profileRETI(cycles); + } + // This assumes that all interrupts will get back using RETI! handlePendingInterrupts(); Modified: mspsim/se/sics/mspsim/core/Profiler.java =================================================================== --- mspsim/se/sics/mspsim/core/Profiler.java 2009-03-10 18:16:06 UTC (rev 476) +++ mspsim/se/sics/mspsim/core/Profiler.java 2009-03-11 21:13:25 UTC (rev 477) @@ -49,7 +49,9 @@ public void profileCall(MapEntry entry, long cycles); public void profileReturn(long cycles); - + public void profileInterrupt(int vector, long cycles); + public void profileRETI(long cycles); + public void clearProfile(); public void printProfile(PrintStream out); Modified: mspsim/se/sics/mspsim/core/Watchdog.java =================================================================== --- mspsim/se/sics/mspsim/core/Watchdog.java 2009-03-10 18:16:06 UTC (rev 476) +++ mspsim/se/sics/mspsim/core/Watchdog.java 2009-03-11 21:13:25 UTC (rev 477) @@ -106,7 +106,6 @@ return 0; } - @Override public void write(int address, int value, boolean word, long cycles) { if (address == WDTCTL) { if ((value >> 8) == 0x5a) { Modified: mspsim/se/sics/mspsim/util/SimpleProfiler.java =================================================================== --- mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-03-10 18:16:06 UTC (rev 476) +++ mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-03-11 21:13:25 UTC (rev 477) @@ -62,12 +62,20 @@ private MSP430Core cpu; private PrintStream logger; + /* statistics for interrupts */ + private long[] lastInterruptTime = new long[16]; + private long[] interruptTime = new long[16]; + private long[] interruptCount = new long[16]; + private int servicedInterrupt; + private int interruptLevel; + public SimpleProfiler() { profileData = new Hashtable<MapEntry, CallEntry>(); tagProfiles = new Hashtable<String, TagEntry>(); startTags = new Hashtable<String, TagEntry>(); endTags = new Hashtable<String, TagEntry>(); callStack = new CallEntry[2048]; + servicedInterrupt = -1; } public void setCPU(MSP430Core cpu) { @@ -80,6 +88,7 @@ } if (logger != null) { + if (servicedInterrupt >= 0) logger.printf("[%2d] ",servicedInterrupt); printSpace(logger, cSP * 2); logger.println("Call to: " + entry); } @@ -105,13 +114,38 @@ ce.calls++; if (logger != null) { - printSpace(logger, cSP * 2); + if (servicedInterrupt >= 0) logger.printf("[%2d] ",servicedInterrupt); + printSpace(logger, cSP * 2 - interruptLevel); logger.println("return from: " + ce.function + " elapsed time: " + elapsed); - } - + } } } + public void profileInterrupt(int vector, long cycles) { + servicedInterrupt = vector; + lastInterruptTime[servicedInterrupt] = cycles; + interruptLevel = cSP * 2; + if (logger != null) { + logger.println("----- Interrupt vector " + vector + " start execution -----"); + } + } + + public void profileRETI(long cycles) { + if (servicedInterrupt > -1) { + interruptTime[servicedInterrupt] += cycles - lastInterruptTime[servicedInterrupt]; + interruptCount[servicedInterrupt]++; + } + + if (logger != null) { + logger.println("----- Interrupt vector " + servicedInterrupt + " returned - elapsed: " + + (cycles - lastInterruptTime[servicedInterrupt])); + interruptLevel = 0; + } + + /* what if interrupt from interrupt ? */ + servicedInterrupt = -1; + } + public void clearProfile() { if (profileData != null) { CallEntry[] entries = @@ -127,8 +161,7 @@ } } } - } - + } public void printProfile(PrintStream out) { printProfile(out, null); } @@ -164,6 +197,14 @@ } } } + out.println("********** Profile IRQ **************************"); + out.println("Vector Average Calls Tot.Cycles"); + for (int i = 0; i < 16; i++) { + out.print((i < 10 ? "0" : "") + i + " "); + out.printf("%4d ",(interruptCount[i] > 0 ? (interruptTime[i] / interruptCount[i]):0)); + out.printf("%8d %8d",interruptCount[i],interruptTime[i]); + out.println(); + } } private void printSpace(PrintStream out, int len) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-03-10 18:16:21
|
Revision: 476 http://mspsim.svn.sourceforge.net/mspsim/?rev=476&view=rev Author: joxe Date: 2009-03-10 18:16:06 +0000 (Tue, 10 Mar 2009) Log Message: ----------- Added Paths: ----------- mspsim/se/sics/mspsim/util/DefaultEmulationLogger.java Added: mspsim/se/sics/mspsim/util/DefaultEmulationLogger.java =================================================================== --- mspsim/se/sics/mspsim/util/DefaultEmulationLogger.java (rev 0) +++ mspsim/se/sics/mspsim/util/DefaultEmulationLogger.java 2009-03-10 18:16:06 UTC (rev 476) @@ -0,0 +1,38 @@ +package se.sics.mspsim.util; + +import java.io.PrintStream; + +import se.sics.mspsim.core.EmulationException; +import se.sics.mspsim.core.EmulationLogger; +import se.sics.mspsim.core.MSP430; + +public class DefaultEmulationLogger implements EmulationLogger { + + private WarningMode warningMode = WarningMode.PRINT; + private PrintStream out; + private MSP430 cpu; + + public DefaultEmulationLogger(MSP430 cpu, PrintStream out) { + this.cpu = cpu; + this.out = out; + } + + public void warning(Object source, String message) throws EmulationException { + if (warningMode == WarningMode.EXCEPTION) { + throw new EmulationException(message); + } else { + if (warningMode == WarningMode.PRINT) { + out.println(message); + cpu.generateTrace(out); + } + } + } + + public void setWarningMode(WarningMode mode) { + warningMode = mode; + } + + public void log(Object source, String message) { + out.println(message); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-03-09 22:03:58
|
Revision: 475 http://mspsim.svn.sourceforge.net/mspsim/?rev=475&view=rev Author: joxe Date: 2009-03-09 22:03:51 +0000 (Mon, 09 Mar 2009) Log Message: ----------- removed debug printout Modified Paths: -------------- mspsim/se/sics/mspsim/core/MSP430Core.java Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-09 21:57:45 UTC (rev 474) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-09 22:03:51 UTC (rev 475) @@ -926,8 +926,6 @@ cycles += (ad == AM_REG || ad == AM_IND_AUTOINC) ? 2 : 1; write = false; updateStatus = false; - System.out.println("Cycles on PUSH: " + (cycles - startCycles)); - break; case CALL: // store current PC on stack... (current PC points to next instr.) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-03-09 21:57:48
|
Revision: 474 http://mspsim.svn.sourceforge.net/mspsim/?rev=474&view=rev Author: joxe Date: 2009-03-09 21:57:45 +0000 (Mon, 09 Mar 2009) Log Message: ----------- fixed bug on PUSH + RETI + CALL timing Modified Paths: -------------- mspsim/CHANGE_LOG.txt mspsim/se/sics/mspsim/chip/CC2420.java mspsim/se/sics/mspsim/core/MSP430Core.java Modified: mspsim/CHANGE_LOG.txt =================================================================== --- mspsim/CHANGE_LOG.txt 2009-03-07 20:53:26 UTC (rev 473) +++ mspsim/CHANGE_LOG.txt 2009-03-09 21:57:45 UTC (rev 474) @@ -1,4 +1,5 @@ 0.97 +- fixed some cycle timing bugs of instruction set execution - added stack trace for misalignment warnings if MSP430 Core is in log mode - added MSP430 Core as a loggable - added emulation of DS2411 for generating MAC addresses Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2009-03-07 20:53:26 UTC (rev 473) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2009-03-09 21:57:45 UTC (rev 474) @@ -1083,8 +1083,6 @@ } public void stateChanged(int state) { - // TODO Auto-generated method stub - } } // CC2420 Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-07 20:53:26 UTC (rev 473) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-09 21:57:45 UTC (rev 474) @@ -857,12 +857,11 @@ dstAddress = readRegister(PC); pc += 2; writeRegister(PC, pc); - cycles += 5; } else { dstAddress = readRegister(dstRegister); writeRegister(dstRegister, dstAddress + (word ? 2 : 1)); - cycles += 3; } + cycles += 3; break; } } @@ -927,6 +926,8 @@ cycles += (ad == AM_REG || ad == AM_IND_AUTOINC) ? 2 : 1; write = false; updateStatus = false; + System.out.println("Cycles on PUSH: " + (cycles - startCycles)); + break; case CALL: // store current PC on stack... (current PC points to next instr.) @@ -954,10 +955,12 @@ write = false; updateStatus = false; + cycles += 4; + if (debugInterrupts) { System.out.println("### RETI at " + pc + " => " + reg[PC] + " SP after: " + reg[SP]); - } + } // This assumes that all interrupts will get back using RETI! handlePendingInterrupts(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-03-07 20:53:32
|
Revision: 473 http://mspsim.svn.sourceforge.net/mspsim/?rev=473&view=rev Author: joxe Date: 2009-03-07 20:53:26 +0000 (Sat, 07 Mar 2009) Log Message: ----------- added EmulationException Modified Paths: -------------- mspsim/se/sics/mspsim/cli/DebugCommands.java mspsim/se/sics/mspsim/core/EmulationLogger.java mspsim/se/sics/mspsim/core/MSP430.java mspsim/se/sics/mspsim/core/MSP430Core.java mspsim/se/sics/mspsim/platform/GenericNode.java mspsim/se/sics/mspsim/platform/esb/ESBGui.java mspsim/se/sics/mspsim/ui/ControlUI.java mspsim/se/sics/mspsim/util/GDBStubs.java mspsim/se/sics/mspsim/util/Test.java Added Paths: ----------- mspsim/se/sics/mspsim/core/EmulationException.java Modified: mspsim/se/sics/mspsim/cli/DebugCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/DebugCommands.java 2009-03-07 18:34:52 UTC (rev 472) +++ mspsim/se/sics/mspsim/cli/DebugCommands.java 2009-03-07 20:53:26 UTC (rev 473) @@ -41,6 +41,7 @@ package se.sics.mspsim.cli; import se.sics.mspsim.core.CPUMonitor; import se.sics.mspsim.core.Chip; +import se.sics.mspsim.core.EmulationException; import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.MSP430Constants; import se.sics.mspsim.core.Memory; @@ -243,7 +244,11 @@ public int executeCommand(CommandContext context) { int nr = context.getArgumentCount() > 0 ? context.getArgumentAsInt(0) : 1; long cyc = cpu.cycles; - node.step(nr); + try { + node.step(nr); + } catch (Exception e) { + e.printStackTrace(context.out); + } context.out.println("CPU stepped to: $" + Utils.hex16(cpu.readRegister(0)) + " in " + (cpu.cycles - cyc) + " cycles (" + cpu.cycles + ")"); return 0; @@ -261,8 +266,12 @@ ch.registerCommand("print", new BasicCommand("print value of an address or symbol", "<address or symbol>") { public int executeCommand(CommandContext context) { int adr = context.getArgumentAsAddress(0); - if (adr != -1) { - context.out.println("" + context.getArgument(0) + " = " + Utils.hex16(cpu.read(adr, adr >= 0x100))); + if (adr != -1) { + try { + context.out.println("" + context.getArgument(0) + " = " + Utils.hex16(cpu.read(adr, adr >= 0x100))); + } catch (Exception e) { + e.printStackTrace(context.out); + } return 0; } else { context.err.println("unknown symbol: " + context.getArgument(0)); @@ -334,7 +343,11 @@ int adr = context.getArgumentAsAddress(0); int val = context.getArgumentAsInt(1); boolean word = val > 0xff; - cpu.write(adr, val, word); + try { + cpu.write(adr, val, word); + } catch (EmulationException e) { + e.printStackTrace(context.out); + } return 0; }}); Added: mspsim/se/sics/mspsim/core/EmulationException.java =================================================================== --- mspsim/se/sics/mspsim/core/EmulationException.java (rev 0) +++ mspsim/se/sics/mspsim/core/EmulationException.java 2009-03-07 20:53:26 UTC (rev 473) @@ -0,0 +1,9 @@ +package se.sics.mspsim.core; + +public class EmulationException extends Exception { + private static final long serialVersionUID = -3837451031129913060L; + + public EmulationException(String msg) { + super(msg); + } +} Modified: mspsim/se/sics/mspsim/core/EmulationLogger.java =================================================================== --- mspsim/se/sics/mspsim/core/EmulationLogger.java 2009-03-07 18:34:52 UTC (rev 472) +++ mspsim/se/sics/mspsim/core/EmulationLogger.java 2009-03-07 20:53:26 UTC (rev 473) @@ -6,7 +6,7 @@ public enum WarningMode {SILENT, PRINT, EXCEPTION}; public void log(Object source, String message); - public void warning(Object source, String message); + public void warning(Object source, String message) throws EmulationException; public void setWarningMode(WarningMode mode); } Modified: mspsim/se/sics/mspsim/core/MSP430.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430.java 2009-03-07 18:34:52 UTC (rev 472) +++ mspsim/se/sics/mspsim/core/MSP430.java 2009-03-07 20:53:26 UTC (rev 473) @@ -88,7 +88,7 @@ return disAsm; } - public void cpuloop() { + public void cpuloop() throws EmulationException { if (isRunning()) { throw new IllegalStateException("already running"); } @@ -98,7 +98,7 @@ run(); } - private void run() { + private void run() throws EmulationException { while (isRunning()) { // ------------------------------------------------------------------- // Debug information @@ -154,11 +154,11 @@ } } - public long step() { + public long step() throws EmulationException { return step(0); } - public long stepInstructions(int count) { + public long stepInstructions(int count) throws EmulationException { if (isRunning()) { throw new IllegalStateException("step not possible when CPU is running"); } @@ -204,7 +204,7 @@ /* * Perform a single step (even if in LPM) but no longer than to maxCycles + 1 instr */ - public long step(long maxCycles) { + public long step(long maxCycles) throws EmulationException { if (isRunning()) { throw new IllegalStateException("step not possible when CPU is running"); } Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-07 18:34:52 UTC (rev 472) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-07 20:53:26 UTC (rev 473) @@ -613,7 +613,7 @@ } // Read method that handles read from IO units! - public int read(int address, boolean word) { + public int read(int address, boolean word) throws EmulationException { int val = 0; // Only word reads at 0x1fe which is highest address... if (address < 0x1ff && memIn[address] != null) { @@ -634,7 +634,7 @@ return val; } - public void write(int dstAddress, int dst, boolean word) { + public void write(int dstAddress, int dst, boolean word) throws EmulationException { // TODO: optimize memory usage by tagging memory's higher bits. if (breakPoints[dstAddress] != null) { breakPoints[dstAddress].cpuAction(CPUMonitor.MEMORY_WRITE, dstAddress, dst); @@ -656,7 +656,7 @@ } } - void printWarning(int type, int address) { + void printWarning(int type, int address) throws EmulationException { String message = ""; switch(type) { case MISALIGNED_READ: @@ -742,7 +742,7 @@ } /* returns true if any instruction was emulated - false if CpuOff */ - public boolean emulateOP(long maxCycles) { + public boolean emulateOP(long maxCycles) throws EmulationException { //System.out.println("CYCLES BEFORE: " + cycles); int pc = readRegister(PC); long startCycles = cycles; Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2009-03-07 18:34:52 UTC (rev 472) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2009-03-07 20:53:26 UTC (rev 473) @@ -50,6 +50,8 @@ import se.sics.mspsim.cli.StreamCommandHandler; import se.sics.mspsim.cli.WindowCommands; import se.sics.mspsim.core.Chip; +import se.sics.mspsim.core.EmulationException; +import se.sics.mspsim.core.EmulationLogger; import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.MSP430Constants; import se.sics.mspsim.extutil.highlight.HighlightSourceViewer; @@ -57,6 +59,7 @@ import se.sics.mspsim.util.ArgumentManager; import se.sics.mspsim.util.ComponentRegistry; import se.sics.mspsim.util.ConfigManager; +import se.sics.mspsim.util.DefaultEmulationLogger; import se.sics.mspsim.util.ELF; import se.sics.mspsim.util.IHexReader; import se.sics.mspsim.util.MapTable; @@ -176,10 +179,16 @@ public void setup(ConfigManager config) throws IOException { this.config = config; + EmulationLogger logger = (EmulationLogger) registry.getComponent("logger"); + if (logger == null) { + logger= new DefaultEmulationLogger(cpu, System.out); + registry.registerComponent("logger", logger); + } registry.registerComponent("cpu", cpu); registry.registerComponent("node", this); registry.registerComponent("config", config); - + cpu.setLogger(logger); + CommandHandler ch = (CommandHandler) registry.getComponent("commandHandler"); if (ch == null) { ch = new StreamCommandHandler(System.in, System.out, System.err, PROMPT); @@ -205,9 +214,15 @@ public void run() { if (!cpu.isRunning()) { - cpu.cpuloop(); + try { + cpu.cpuloop(); + } catch (Exception e) { + /* what should we do here */ + e.printStackTrace(); + } } } + public void start() { if (!cpu.isRunning()) { new Thread(this).start(); @@ -218,7 +233,7 @@ cpu.setRunning(false); } - public void step() { + public void step() throws EmulationException { if (!cpu.isRunning()) { cpu.step(); } @@ -255,7 +270,7 @@ } // A step that will break out of breakpoints! - public void step(int nr) { + public void step(int nr) throws EmulationException { if (!cpu.isRunning()) { cpu.stepInstructions(nr); } Modified: mspsim/se/sics/mspsim/platform/esb/ESBGui.java =================================================================== --- mspsim/se/sics/mspsim/platform/esb/ESBGui.java 2009-03-07 18:34:52 UTC (rev 472) +++ mspsim/se/sics/mspsim/platform/esb/ESBGui.java 2009-03-07 20:53:26 UTC (rev 473) @@ -192,7 +192,6 @@ } beeper = new Beeper(); - cpu.addIOUnit(-1,0,-1,0,beeper); // Just a test... TODO: remove!!! AudioFormat af = new AudioFormat(SAMPLE_RATE, 16, 1, true, false); Modified: mspsim/se/sics/mspsim/ui/ControlUI.java =================================================================== --- mspsim/se/sics/mspsim/ui/ControlUI.java 2009-03-07 18:34:52 UTC (rev 472) +++ mspsim/se/sics/mspsim/ui/ControlUI.java 2009-03-07 20:53:26 UTC (rev 473) @@ -113,7 +113,11 @@ private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent e) { - ControlUI.this.node.step(); + try { + ControlUI.this.node.step(); + } catch (Exception e2) { + e2.printStackTrace(); + } dui.updateRegs(); dui.repaint(); if (elfData != null && sourceViewer != null Modified: mspsim/se/sics/mspsim/util/GDBStubs.java =================================================================== --- mspsim/se/sics/mspsim/util/GDBStubs.java 2009-03-07 18:34:52 UTC (rev 472) +++ mspsim/se/sics/mspsim/util/GDBStubs.java 2009-03-07 20:53:26 UTC (rev 473) @@ -45,6 +45,7 @@ import java.net.ServerSocket; import java.net.Socket; +import se.sics.mspsim.core.EmulationException; import se.sics.mspsim.core.MSP430Core; public class GDBStubs implements Runnable { @@ -99,11 +100,14 @@ } } catch (IOException e) { e.printStackTrace(); + } catch (EmulationException e) { + e.printStackTrace(); } } } - private void handleCmd(String cmd, int[] cmdBytes, int cmdLen) throws IOException { + private void handleCmd(String cmd, int[] cmdBytes, int cmdLen) throws IOException, + EmulationException { System.out.println("cmd: " + cmd); char c = cmd.charAt(0); switch(c) { Modified: mspsim/se/sics/mspsim/util/Test.java =================================================================== --- mspsim/se/sics/mspsim/util/Test.java 2009-03-07 18:34:52 UTC (rev 472) +++ mspsim/se/sics/mspsim/util/Test.java 2009-03-07 20:53:26 UTC (rev 473) @@ -107,7 +107,11 @@ // Create the "tester" new Test(cpu); - cpu.cpuloop(); + try { + cpu.cpuloop(); + } catch (Exception e) { + e.printStackTrace(); + } } catch (IOException ioe) { ioe.printStackTrace(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-03-07 18:35:03
|
Revision: 472 http://mspsim.svn.sourceforge.net/mspsim/?rev=472&view=rev Author: joxe Date: 2009-03-07 18:34:52 +0000 (Sat, 07 Mar 2009) Log Message: ----------- added emulation logger Modified Paths: -------------- mspsim/se/sics/mspsim/core/MSP430.java mspsim/se/sics/mspsim/core/MSP430Constants.java mspsim/se/sics/mspsim/core/MSP430Core.java Added Paths: ----------- mspsim/se/sics/mspsim/core/EmulationLogger.java Added: mspsim/se/sics/mspsim/core/EmulationLogger.java =================================================================== --- mspsim/se/sics/mspsim/core/EmulationLogger.java (rev 0) +++ mspsim/se/sics/mspsim/core/EmulationLogger.java 2009-03-07 18:34:52 UTC (rev 472) @@ -0,0 +1,12 @@ +package se.sics.mspsim.core; + +public interface EmulationLogger { + + /* warning mode for CPU errors such as unaligned word access */ + public enum WarningMode {SILENT, PRINT, EXCEPTION}; + + public void log(Object source, String message); + public void warning(Object source, String message); + public void setWarningMode(WarningMode mode); + +} Modified: mspsim/se/sics/mspsim/core/MSP430.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430.java 2009-03-06 23:35:21 UTC (rev 471) +++ mspsim/se/sics/mspsim/core/MSP430.java 2009-03-07 18:34:52 UTC (rev 472) @@ -315,8 +315,7 @@ } } - void generateTrace() { - PrintStream out = getLogStream(); + public void generateTrace(PrintStream out) { if (profiler != null && out != null) { profiler.printStackTrace(out); } Modified: mspsim/se/sics/mspsim/core/MSP430Constants.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Constants.java 2009-03-06 23:35:21 UTC (rev 471) +++ mspsim/se/sics/mspsim/core/MSP430Constants.java 2009-03-07 18:34:52 UTC (rev 472) @@ -43,14 +43,11 @@ public interface MSP430Constants { - public static final String VERSION = "0.96"; + public static final String VERSION = "0.97"; - /* warning mode for CPU errors such as unaligned word access */ - public enum WarningMode {SILENT, PRINT, EXCEPTION}; - public static final int MISALIGNED_READ = 0; public static final int MISALIGNED_WRITE = 1; - + /* memory tags - not used yet*/ public static final int READ_MONITOR = 0x1000; public static final int WRITE_MONITOR = 0x2000; Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-06 23:35:21 UTC (rev 471) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-07 18:34:52 UTC (rev 472) @@ -1,5 +1,5 @@ /** - * Copyright (c) 2007, Swedish Institute of Computer Science. + * Copyright (c) 2007, 2008, 2009, Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,6 +40,7 @@ */ package se.sics.mspsim.core; +import java.io.PrintStream; import java.util.ArrayList; import se.sics.mspsim.util.Utils; @@ -117,8 +118,9 @@ private BasicClockModule bcs; private ArrayList<Chip> chips = new ArrayList<Chip>(); - private WarningMode warningMode = WarningMode.PRINT; + private EmulationLogger logger; + /* statistics for interrupts */ private long[] lastInterruptTime = new long[16]; private long[] interruptTime = new long[16]; @@ -249,16 +251,6 @@ return sfr; } - public void addIOUnit(int loReadMem, int hiReadMem, - int loWriteMem, int hiWriteMem, - IOUnit unit) { - // Not implemented yet... IS it needed? -// if (loReadMem != -1) { -// for (int i = lo, n = hiMem; i < n; i++) { -// } -// } - } - public void addChip(Chip chip) { chips.add(chip); } @@ -538,9 +530,13 @@ resetIOUnits(); } - public void setWarningMode(WarningMode mode) { - warningMode = mode; + public void setLogger(EmulationLogger logger) { + this.logger = logger; } + + public void setWarningMode(EmulationLogger.WarningMode mode) { + logger.setWarningMode(mode); + } public long[] getInterruptCount() { return interruptCount; @@ -671,18 +667,11 @@ message = "**** Illegal write - misaligned word to: " + Utils.hex16(address) + " at $" + Utils.hex16(reg[PC]); break; - } - if (warningMode == WarningMode.EXCEPTION) { - throw new IllegalStateException(message); - } else { - if (warningMode == WarningMode.PRINT) { - System.out.println(message); - generateTrace(); - } } + logger.warning(this, message); } - void generateTrace() { + public void generateTrace(PrintStream out) { /* overide if a stack trace or other additional warning info should * be printed */ } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-03-06 23:35:28
|
Revision: 471 http://mspsim.svn.sourceforge.net/mspsim/?rev=471&view=rev Author: joxe Date: 2009-03-06 23:35:21 +0000 (Fri, 06 Mar 2009) Log Message: ----------- improved timing of some instructions Modified Paths: -------------- mspsim/se/sics/mspsim/core/MSP430Core.java Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-03 12:11:57 UTC (rev 470) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2009-03-06 23:35:21 UTC (rev 471) @@ -934,6 +934,8 @@ memory[sp] = dst & 0xff; memory[sp + 1] = 0; } + /* if REG or INDIRECT AUTOINC then add 2 cycles, otherwise 1 */ + cycles += (ad == AM_REG || ad == AM_IND_AUTOINC) ? 2 : 1; write = false; updateStatus = false; break; @@ -947,6 +949,9 @@ memory[sp + 1] = pc >> 8; writeRegister(PC, dst); + /* Additional cycles: REG => 3, AM_IND_AUTO => 2, other => 1 */ + cycles += (ad == AM_REG) ? 3 : (ad == AM_IND_AUTOINC) ? 2 : 1; + write = false; updateStatus = false; break; @@ -1052,6 +1057,8 @@ src &= 0xff; } cycles += dstRegMode ? 1 : 4; + /* add cycle if destination register = PC */ + if (dstRegister == PC) cycles++; break; case AM_INDEX: // Indexed if reg != PC & CG1/CG2 - will PC be incremented? @@ -1068,15 +1075,20 @@ break; case AM_IND_AUTOINC: if (srcRegister == PC) { + /* PC is always handled as word */ srcAddress = readRegister(PC); pc += 2; incRegister(PC, 2); - cycles += 3; + cycles += dstRegMode ? 2 : 5; } else { srcAddress = readRegister(srcRegister); incRegister(srcRegister, word ? 2 : 1); cycles += dstRegMode ? 2 : 5; } + /* If destination register is PC another cycle is consumed */ + if (dstRegister == PC) { + cycles++; + } break; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-03-03 12:11:59
|
Revision: 470 http://mspsim.svn.sourceforge.net/mspsim/?rev=470&view=rev Author: nifi Date: 2009-03-03 12:11:57 +0000 (Tue, 03 Mar 2009) Log Message: ----------- only decrease event count when an event was removed Modified Paths: -------------- mspsim/se/sics/mspsim/core/EventQueue.java Modified: mspsim/se/sics/mspsim/core/EventQueue.java =================================================================== --- mspsim/se/sics/mspsim/core/EventQueue.java 2009-03-03 11:54:31 UTC (rev 469) +++ mspsim/se/sics/mspsim/core/EventQueue.java 2009-03-03 12:11:57 UTC (rev 470) @@ -131,6 +131,8 @@ // No longer scheduled! tmp.scheduledIn = null; + + eventCount--; } if (first != null) { @@ -138,7 +140,6 @@ } else { nextTime = 0; } - eventCount--; return tmp; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-03-03 11:54:35
|
Revision: 469 http://mspsim.svn.sourceforge.net/mspsim/?rev=469&view=rev Author: nifi Date: 2009-03-03 11:54:31 +0000 (Tue, 03 Mar 2009) Log Message: ----------- bug fix: only clear event when event exists Modified Paths: -------------- mspsim/se/sics/mspsim/core/EventQueue.java Modified: mspsim/se/sics/mspsim/core/EventQueue.java =================================================================== --- mspsim/se/sics/mspsim/core/EventQueue.java 2009-02-25 18:21:09 UTC (rev 468) +++ mspsim/se/sics/mspsim/core/EventQueue.java 2009-03-03 11:54:31 UTC (rev 469) @@ -128,6 +128,9 @@ first = tmp.nextEvent; // Unlink. tmp.nextEvent = null; + + // No longer scheduled! + tmp.scheduledIn = null; } if (first != null) { @@ -135,8 +138,6 @@ } else { nextTime = 0; } - // No longer scheduled! - tmp.scheduledIn = null; eventCount--; return tmp; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-02-25 18:21:14
|
Revision: 468 http://mspsim.svn.sourceforge.net/mspsim/?rev=468&view=rev Author: nifi Date: 2009-02-25 18:21:09 +0000 (Wed, 25 Feb 2009) Log Message: ----------- changed hexconv() to return null for non-hexa-decimal data instead of throwing IllegalArgumentException Modified Paths: -------------- mspsim/se/sics/mspsim/util/Utils.java Modified: mspsim/se/sics/mspsim/util/Utils.java =================================================================== --- mspsim/se/sics/mspsim/util/Utils.java 2009-02-25 15:52:38 UTC (rev 467) +++ mspsim/se/sics/mspsim/util/Utils.java 2009-02-25 18:21:09 UTC (rev 468) @@ -182,35 +182,36 @@ /* converts hexa-decimal data in a string to an array of bytes */ public static byte[] hexconv(String line) { - if (line != null) { - byte[] data = new byte[line.length() / 2]; - int hpos = 0; - int totVal = 0; - int dataPos = 0; - for (int i = 0, n = line.length(); i < n; i++) { - int val = line.charAt(i); - if (val >= '0' && val <= '9') { - val = val - '0'; - } else if (val >= 'a' && val <= 'f') { - val = val + 10 - 'a'; - } else if (val >= 'A' && val <= 'F'){ - val = val + 10 - 'A'; - } else { - throw new IllegalArgumentException("Illegal format of string to convert: " + line); - } - - if (hpos == 0) { - totVal = val << 4; - hpos++; - } else { - totVal = totVal + val; - hpos = 0; - data[dataPos++] = (byte) (totVal & 0xff); - } + if (line == null) { + return null; + } + byte[] data = new byte[line.length() / 2]; + int hpos = 0; + int totVal = 0; + int dataPos = 0; + for (int i = 0, n = line.length(); i < n; i++) { + int val = line.charAt(i); + if (val >= '0' && val <= '9') { + val = val - '0'; + } else if (val >= 'a' && val <= 'f') { + val = val + 10 - 'a'; + } else if (val >= 'A' && val <= 'F'){ + val = val + 10 - 'A'; + } else { + // Not a hexa-decimal format + return null; } - return data; + + if (hpos == 0) { + totVal = val << 4; + hpos++; + } else { + totVal = totVal + val; + hpos = 0; + data[dataPos++] = (byte) (totVal & 0xff); + } } - return null; + return data; } // public static void main(String[] args) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-02-25 15:52:42
|
Revision: 467 http://mspsim.svn.sourceforge.net/mspsim/?rev=467&view=rev Author: joxe Date: 2009-02-25 15:52:38 +0000 (Wed, 25 Feb 2009) Log Message: ----------- made output from rflistener hexadecimal Modified Paths: -------------- mspsim/se/sics/mspsim/cli/MiscCommands.java Modified: mspsim/se/sics/mspsim/cli/MiscCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-02-25 14:58:39 UTC (rev 466) +++ mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-02-25 15:52:38 UTC (rev 467) @@ -321,7 +321,7 @@ if (chip instanceof RFSource) { ((RFSource)chip).setRFListener(new RFListener(){ public void receivedByte(byte data) { - context.out.println("" + data); + context.out.println("" + Utils.hex8(data)); } }); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fro...@us...> - 2009-02-25 14:58:44
|
Revision: 466 http://mspsim.svn.sourceforge.net/mspsim/?rev=466&view=rev Author: fros4943 Date: 2009-02-25 14:58:39 +0000 (Wed, 25 Feb 2009) Log Message: ----------- generating deterministic mac address not ending with zeroes Modified Paths: -------------- mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java Modified: mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java 2009-02-25 13:06:22 UTC (rev 465) +++ mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java 2009-02-25 14:58:39 UTC (rev 466) @@ -89,7 +89,7 @@ } public void setNodeID(int id) { - ds2411.setMACID(0, 0, 0, (id >> 8) & 0xff, id & 0xff, id & 0xff); + ds2411.setMACID(id & 0xff, id & 0xff, id & 0xff, (id >> 8) & 0xff, id & 0xff, id & 0xff); } public void setupNodePorts() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-02-25 13:06:27
|
Revision: 465 http://mspsim.svn.sourceforge.net/mspsim/?rev=465&view=rev Author: joxe Date: 2009-02-25 13:06:22 +0000 (Wed, 25 Feb 2009) Log Message: ----------- added hexcoded radio input in rflistener command Modified Paths: -------------- mspsim/se/sics/mspsim/cli/MiscCommands.java mspsim/se/sics/mspsim/util/Utils.java Modified: mspsim/se/sics/mspsim/cli/MiscCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-02-25 09:42:44 UTC (rev 464) +++ mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-02-25 13:06:22 UTC (rev 465) @@ -55,6 +55,7 @@ import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.TimeEvent; import se.sics.mspsim.util.ComponentRegistry; +import se.sics.mspsim.util.Utils; /** * @author joakim @@ -333,7 +334,12 @@ } public void lineRead(String line) { if (listener != null) { + byte[] data = Utils.hexconv(line); context.out.println("Should send bytes to radio: " + line); + for (int i = 0; i < data.length; i++) { + //context.out.println("Byte " + i + " = " + ((int) data[i] & 0xff)); + listener.receivedByte(data[i]); + } } } }); Modified: mspsim/se/sics/mspsim/util/Utils.java =================================================================== --- mspsim/se/sics/mspsim/util/Utils.java 2009-02-25 09:42:44 UTC (rev 464) +++ mspsim/se/sics/mspsim/util/Utils.java 2009-02-25 13:06:22 UTC (rev 465) @@ -180,6 +180,39 @@ return Long.parseLong(longValue, radix); } + /* converts hexa-decimal data in a string to an array of bytes */ + public static byte[] hexconv(String line) { + if (line != null) { + byte[] data = new byte[line.length() / 2]; + int hpos = 0; + int totVal = 0; + int dataPos = 0; + for (int i = 0, n = line.length(); i < n; i++) { + int val = line.charAt(i); + if (val >= '0' && val <= '9') { + val = val - '0'; + } else if (val >= 'a' && val <= 'f') { + val = val + 10 - 'a'; + } else if (val >= 'A' && val <= 'F'){ + val = val + 10 - 'A'; + } else { + throw new IllegalArgumentException("Illegal format of string to convert: " + line); + } + + if (hpos == 0) { + totVal = val << 4; + hpos++; + } else { + totVal = totVal + val; + hpos = 0; + data[dataPos++] = (byte) (totVal & 0xff); + } + } + return data; + } + return null; + } + // public static void main(String[] args) { // System.out.println("Hex 47 = " + hex8(47)); // } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-02-25 09:42:46
|
Revision: 464 http://mspsim.svn.sourceforge.net/mspsim/?rev=464&view=rev Author: joxe Date: 2009-02-25 09:42:44 +0000 (Wed, 25 Feb 2009) Log Message: ----------- made CC2420 to implement RFSource Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2009-02-25 08:35:48 UTC (rev 463) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2009-02-25 09:42:44 UTC (rev 464) @@ -1,5 +1,5 @@ /** - * Copyright (c) 2007, Swedish Institute of Computer Science. + * Copyright (c) 2007, 2008, 2009 Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ import se.sics.mspsim.core.*; import se.sics.mspsim.util.Utils; -public class CC2420 extends Chip implements USARTListener, RFListener { +public class CC2420 extends Chip implements USARTListener, RFListener, RFSource { public enum Reg { SNOP, SXOSCON, STXCAL, SRXON, /* 0x00 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-02-25 08:35:53
|
Revision: 463 http://mspsim.svn.sourceforge.net/mspsim/?rev=463&view=rev Author: joxe Date: 2009-02-25 08:35:48 +0000 (Wed, 25 Feb 2009) Log Message: ----------- added command for registering rflisteners Modified Paths: -------------- mspsim/se/sics/mspsim/cli/MiscCommands.java Modified: mspsim/se/sics/mspsim/cli/MiscCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-02-25 08:28:36 UTC (rev 462) +++ mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-02-25 08:35:48 UTC (rev 463) @@ -48,6 +48,10 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.regex.Pattern; + +import se.sics.mspsim.chip.RFListener; +import se.sics.mspsim.chip.RFSource; +import se.sics.mspsim.core.Chip; import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.TimeEvent; import se.sics.mspsim.util.ComponentRegistry; @@ -188,6 +192,8 @@ return 0; } }); + + handler.registerCommand("source", new BasicCommand("run script", "<filename>") { public int executeCommand(CommandContext context) { @@ -301,6 +307,39 @@ } }); + handler.registerCommand("rflistener", new BasicLineCommand("an rflisteer", "[input|output] <rf-chip>") { + String command = null; + CommandContext context; + RFListener listener; + final MSP430 cpu = (MSP430) registry.getComponent(MSP430.class); + public int executeCommand(CommandContext ctx) { + this.context = ctx; + String inout = context.getArgument(0); + Chip chip = cpu.getChip(context.getArgument(1)); + if ("output".equals(inout)) { + if (chip instanceof RFSource) { + ((RFSource)chip).setRFListener(new RFListener(){ + public void receivedByte(byte data) { + context.out.println("" + data); + } + }); + } + } else if ("input".equals(inout)){ + listener = (RFListener) chip; + } else { + context.err.println("Error: illegal type: " + inout); + } + return 0; + } + public void lineRead(String line) { + if (listener != null) { + context.out.println("Should send bytes to radio: " + line); + } + } + }); + + + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |