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: <ni...@us...> - 2008-11-06 17:05:47
|
Revision: 412 http://mspsim.svn.sourceforge.net/mspsim/?rev=412&view=rev Author: nifi Date: 2008-11-06 17:05:43 +0000 (Thu, 06 Nov 2008) Log Message: ----------- moved setup to generic Main Modified Paths: -------------- mspsim/Makefile mspsim/se/sics/mspsim/platform/GenericNode.java mspsim/se/sics/mspsim/platform/esb/ESBNode.java mspsim/se/sics/mspsim/platform/sky/SkyNode.java mspsim/se/sics/mspsim/platform/sky/TelosNode.java Added Paths: ----------- mspsim/se/sics/mspsim/Main.java Removed Paths: ------------- mspsim/se/sics/mspsim/platform/esb/Main.java mspsim/se/sics/mspsim/platform/sky/Main.java Modified: mspsim/Makefile =================================================================== --- mspsim/Makefile 2008-11-06 09:35:26 UTC (rev 411) +++ mspsim/Makefile 2008-11-06 17:05:43 UTC (rev 412) @@ -68,7 +68,7 @@ BINARY := README.txt license.txt CHANGE_LOG.txt images/*.jpg firmware/*/*.firmware -PACKAGES := ${addprefix se/sics/mspsim/,core platform platform/esb platform/sky cli ui util chip extutil/highlight extutil/jfreechart} +PACKAGES := ${addprefix se/sics/mspsim/,core platform platform/esb platform/sky . cli ui util chip extutil/highlight extutil/jfreechart} SOURCES := ${wildcard *.java $(addsuffix /*.java,$(PACKAGES))} @@ -93,7 +93,7 @@ JarManifest.txt: @echo >>$@ "Manifest-Version: 1.0" @echo >>$@ "Sealed: true" - @echo >>$@ "Main-Class: se.sics.mspsim.platform.sky.Main" + @echo >>$@ "Main-Class: se.sics.mspsim.Main" @echo >>$@ "Class-path: lib/jfreechart-1.0.9.jar lib/jcommon-1.0.12.jar" help: @@ -103,13 +103,13 @@ $(JAVA) $(JAVAARGS) se.sics.mspsim.util.IHexReader $(ARGS) $(FIRMWAREFILE) $(MAPFILE) runesb: compile - $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.esb.Main $(ARGS) $(ESBFIRMWARE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.esb.ESBNode $(ARGS) $(ESBFIRMWARE) $(MAPFILE) runsky: compile - $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.sky.Main $(ARGS) $(SKYFIRMWARE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.sky.SkyNode $(ARGS) $(SKYFIRMWARE) $(MAPFILE) runskyprof: compile - $(JAVA) -agentlib:yjpagent $(JAVAARGS) se.sics.mspsim.platform.sky.Main $(ARGS) $(SKYFIRMWARE) $(MAPFILE) + $(JAVA) -agentlib:yjpagent $(JAVAARGS) se.sics.mspsim.platform.sky.SkyNode $(ARGS) $(SKYFIRMWARE) $(MAPFILE) runtelos: compile $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.sky.TelosNode $(ARGS) $(SKYFIRMWARE) $(MAPFILE) Added: mspsim/se/sics/mspsim/Main.java =================================================================== --- mspsim/se/sics/mspsim/Main.java (rev 0) +++ mspsim/se/sics/mspsim/Main.java 2008-11-06 17:05:43 UTC (rev 412) @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2008, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of MSPSim. + * + * $Id$ + * + * ----------------------------------------------------------------- + * + * Main + * + * Authors : Joakim Eriksson, Niclas Finne + * Created : 6 nov 2008 + * Updated : $Date$ + * $Revision$ + */ + +package se.sics.mspsim; +import java.io.IOException; +import se.sics.mspsim.platform.GenericNode; +import se.sics.mspsim.util.ArgumentManager; + +/** + * + */ +public class Main { + + public static GenericNode createNode(String className) { + try { + Class<? extends GenericNode> nodeClass = Class.forName(className).asSubclass(GenericNode.class); + return nodeClass.newInstance(); + } catch (ClassNotFoundException e) { + // Can not find specified class + } catch (ClassCastException e) { + // Wrong class type + } catch (InstantiationException e) { + // Failed to instantiate + } catch (IllegalAccessException e) { + // Failed to access constructor + } + return null; + } + + public static void main(String[] args) throws IOException { + ArgumentManager config = new ArgumentManager(); + config.handleArguments(args); + + String nodeType = config.getProperty("nodeType"); + String platform = nodeType; + GenericNode node; + if (nodeType != null) { + node = createNode(nodeType); + } else { + platform = config.getProperty("platform", "sky"); + nodeType = "se.sics.mspsim.platform." + platform + '.' + + Character.toUpperCase(platform.charAt(0)) + platform.substring(1).toLowerCase() + "Node"; + node = createNode(nodeType); + if (node == null) { + nodeType = "se.sics.mspsim.platform." + platform + '.' + platform.toUpperCase() + "Node"; + node = createNode(nodeType); + } + } + if (node == null) { + System.err.println("MSPSim does not yet support the platform '" + platform + '\''); + System.exit(1); + } + node.setupArgs(config); + } + +} Property changes on: mspsim/se/sics/mspsim/Main.java ___________________________________________________________________ Added: svn:keywords + Rev Date Id Added: svn:eol-style + LF Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2008-11-06 09:35:26 UTC (rev 411) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2008-11-06 17:05:43 UTC (rev 412) @@ -42,7 +42,6 @@ import java.io.File; import java.io.IOException; import java.net.URL; - import se.sics.mspsim.cli.CommandHandler; import se.sics.mspsim.cli.DebugCommands; import se.sics.mspsim.cli.MiscCommands; @@ -95,6 +94,14 @@ } firmwareFile = args[0]; + if (config.getProperty("nogui") == null) { + config.setProperty("nogui", "false"); + } + /* Ensure auto-run of a start script */ + if (config.getProperty("autorun") == null) { + config.setProperty("autorun", "scripts/autorun.sc"); + } + int[] memory = cpu.getMemory(); if (args[0].endsWith("ihex")) { // IHEX Reading Modified: mspsim/se/sics/mspsim/platform/esb/ESBNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/esb/ESBNode.java 2008-11-06 09:35:26 UTC (rev 411) +++ mspsim/se/sics/mspsim/platform/esb/ESBNode.java 2008-11-06 17:05:43 UTC (rev 412) @@ -50,6 +50,7 @@ import se.sics.mspsim.extutil.jfreechart.DataChart; import se.sics.mspsim.extutil.jfreechart.DataSourceSampler; import se.sics.mspsim.platform.GenericNode; +import se.sics.mspsim.util.ArgumentManager; public class ESBNode extends GenericNode implements PortListener { @@ -184,11 +185,11 @@ return "ESB"; } - /** - * @deprecated Use se.sics.mspsim.platform.sky.Main instead. - */ public static void main(String[] args) throws IOException { - Main.main(args); + ESBNode node = new ESBNode(); + ArgumentManager config = new ArgumentManager(); + config.handleArguments(args); + node.setupArgs(config); } } Deleted: mspsim/se/sics/mspsim/platform/esb/Main.java =================================================================== --- mspsim/se/sics/mspsim/platform/esb/Main.java 2008-11-06 09:35:26 UTC (rev 411) +++ mspsim/se/sics/mspsim/platform/esb/Main.java 2008-11-06 17:05:43 UTC (rev 412) @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of MSPSim - * - * $Id$ - * - * ----------------------------------------------------------------- - * - * Main - * - * Authors : Joakim Eriksson, Niclas Finne - * Created : 6 nov 2008 - * Updated : $Date$ - * $Revision$ - */ - -package se.sics.mspsim.platform.esb; -import java.io.IOException; -import se.sics.mspsim.util.ArgumentManager; - -/** - * - */ -public class Main { - - public static void main(String[] args) throws IOException { - ESBNode node = new ESBNode(); - ArgumentManager config = new ArgumentManager(); - config.handleArguments(args); - if (config.getProperty("nogui") == null) { - config.setProperty("nogui", "false"); - } - /* Ensure auto-run of a start script */ - if (config.getProperty("autorun") == null) { - config.setProperty("autorun", "scripts/autorun.sc"); - } - node.setupArgs(config); - } - -} Deleted: mspsim/se/sics/mspsim/platform/sky/Main.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/Main.java 2008-11-06 09:35:26 UTC (rev 411) +++ mspsim/se/sics/mspsim/platform/sky/Main.java 2008-11-06 17:05:43 UTC (rev 412) @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id$ - * - * ----------------------------------------------------------------- - * - * Main - * - * Authors : Joakim Eriksson, Niclas Finne - * Created : 6 nov 2008 - * Updated : $Date$ - * $Revision$ - */ - -package se.sics.mspsim.platform.sky; -import java.io.IOException; -import se.sics.mspsim.util.ArgumentManager; - -/** - * - */ -public class Main { - - public static void main(String[] args) throws IOException { - SkyNode node = new SkyNode(); - ArgumentManager config = new ArgumentManager(); - config.handleArguments(args); - if (config.getProperty("nogui") == null) { - config.setProperty("nogui", "false"); - } - /* Ensure auto-run of a start script */ - if (config.getProperty("autorun") == null) { - config.setProperty("autorun", "scripts/autorun.sc"); - } - - node.setupArgs(config); - } - -} Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-11-06 09:35:26 UTC (rev 411) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-11-06 17:05:43 UTC (rev 412) @@ -45,6 +45,7 @@ import se.sics.mspsim.chip.M25P80; import se.sics.mspsim.core.IOPort; import se.sics.mspsim.core.USART; +import se.sics.mspsim.util.ArgumentManager; /** * Emulation of Sky Mote @@ -98,11 +99,11 @@ } } - /** - * @deprecated Use se.sics.mspsim.platform.sky.Main instead. - */ public static void main(String[] args) throws IOException { - Main.main(args); + SkyNode node = new SkyNode(); + ArgumentManager config = new ArgumentManager(); + config.handleArguments(args); + node.setupArgs(config); } } Modified: mspsim/se/sics/mspsim/platform/sky/TelosNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/TelosNode.java 2008-11-06 09:35:26 UTC (rev 411) +++ mspsim/se/sics/mspsim/platform/sky/TelosNode.java 2008-11-06 17:05:43 UTC (rev 412) @@ -104,13 +104,6 @@ TelosNode node = new TelosNode(); ArgumentManager config = new ArgumentManager(); config.handleArguments(args); - if (config.getProperty("nogui") == null) { - config.setProperty("nogui", "false"); - } - /* Ensure auto-run of a start script */ - if (config.getProperty("autorun") == null) { - config.setProperty("autorun", "scripts/autorun.sc"); - } node.setupArgs(config); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-06 09:35:30
|
Revision: 411 http://mspsim.svn.sourceforge.net/mspsim/?rev=411&view=rev Author: nifi Date: 2008-11-06 09:35:26 +0000 (Thu, 06 Nov 2008) Log Message: ----------- delay creation of flash file until needed Modified Paths: -------------- mspsim/se/sics/mspsim/chip/FileM25P80.java Modified: mspsim/se/sics/mspsim/chip/FileM25P80.java =================================================================== --- mspsim/se/sics/mspsim/chip/FileM25P80.java 2008-11-06 08:11:16 UTC (rev 410) +++ mspsim/se/sics/mspsim/chip/FileM25P80.java 2008-11-06 09:35:26 UTC (rev 411) @@ -40,10 +40,12 @@ */ package se.sics.mspsim.chip; +import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; +import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; import se.sics.mspsim.core.MSP430Core; @@ -52,16 +54,32 @@ private static final boolean DEBUG = true; + private String filename; private RandomAccessFile file; private FileChannel fileChannel; private FileLock fileLock; + private long pos = 0; public FileM25P80(MSP430Core cpu, String filename) { super(cpu); if (filename == null) { filename = "flash.bin"; } + this.filename = filename; + } + private boolean ensureOpen(boolean write) { + if (fileChannel != null) { + return true; + } + if (!write) { + File fp = new File(filename); + if (!fp.exists()) { + // File does not exist and only trying to read. Delay file creation until first write + return false; + } + } + // Open flash file for R/W if (!openFile(filename)) { // Failed to open/lock the specified file. Add a counter and try with next filename. @@ -79,13 +97,21 @@ } if (fileLock == null) { // Failed to open flash file - throw new IllegalStateException("failed to open flash file '" + filename + '\''); + if (write) { + System.err.println(getName() + ": failed to open flash file '" + filename + '\''); + } + return false; } // Set size of flash try { file.setLength(MEMORY_SIZE); + if (pos > 0) { + file.seek(pos); + } + return true; } catch (IOException e) { e.printStackTrace(); + return false; } } @@ -112,6 +138,7 @@ private void closeFile() { try { + file = null; if (fileLock != null) { fileLock.release(); fileLock = null; @@ -126,15 +153,27 @@ } public void seek(long pos) throws IOException { - file.seek(pos); + if (file != null) { + file.seek(pos); + } + this.pos = pos; } public int readFully(byte[] b) throws IOException { - return file.read(b); + if (file != null || ensureOpen(false)) { + pos += b.length; + return file.read(b); + } + Arrays.fill(b, (byte) 0); + pos += b.length; + return b.length; } public void write(byte[] b) throws IOException { - file.write(b); + if (file != null || ensureOpen(true)) { + file.write(b); + } + pos += b.length; } } // FileM25P80 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-06 08:12:02
|
Revision: 410 http://mspsim.svn.sourceforge.net/mspsim/?rev=410&view=rev Author: nifi Date: 2008-11-06 08:11:16 +0000 (Thu, 06 Nov 2008) Log Message: ----------- added flush after each written line Modified Paths: -------------- mspsim/se/sics/mspsim/cli/FileTarget.java Modified: mspsim/se/sics/mspsim/cli/FileTarget.java =================================================================== --- mspsim/se/sics/mspsim/cli/FileTarget.java 2008-11-06 01:12:25 UTC (rev 409) +++ mspsim/se/sics/mspsim/cli/FileTarget.java 2008-11-06 08:11:16 UTC (rev 410) @@ -49,30 +49,29 @@ */ public class FileTarget implements LineListener { - FileWriter out; - String name; - + private final FileWriter out; + private final String name; + public FileTarget(String name) throws IOException { - out = new FileWriter(name); + this.out = new FileWriter(name); this.name = name; } - + public String getName() { return name; } + /* (non-Javadoc) * @see se.sics.mspsim.cli.LineListener#lineRead(java.lang.String) */ public void lineRead(String line) { if (line == null) { - try { - out.close(); - } catch (IOException e) { - e.printStackTrace(); - } + close(); } else { try { - out.write(line + "\n"); + out.write(line); + out.write('\n'); + out.flush(); } catch (IOException e) { e.printStackTrace(); }; @@ -83,9 +82,8 @@ try { out.close(); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } - + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-06 01:12:56
|
Revision: 409 http://mspsim.svn.sourceforge.net/mspsim/?rev=409&view=rev Author: nifi Date: 2008-11-06 01:12:25 +0000 (Thu, 06 Nov 2008) Log Message: ----------- add the firmware location to the source code search path Modified Paths: -------------- mspsim/se/sics/mspsim/platform/GenericNode.java Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2008-11-06 00:52:24 UTC (rev 408) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2008-11-06 01:12:25 UTC (rev 409) @@ -116,7 +116,19 @@ // Setup control and other UI components ControlUI control = new ControlUI(registry); HighlightSourceViewer sourceViewer = new HighlightSourceViewer(); -// sourceViewer.addSearchPath(new File("../../contiki-2.x/examples/energest-demo/")); + if (firmwareFile != null) { + // Add the firmware location to the search path + File fp = new File(firmwareFile).getParentFile(); + if (fp != null) { + try { + // Get absolute path + fp = fp.getCanonicalFile(); + } catch (Exception e) { + // Ignore + } + sourceViewer.addSearchPath(fp); + } + } control.setSourceViewer(sourceViewer); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-06 00:52:28
|
Revision: 408 http://mspsim.svn.sourceforge.net/mspsim/?rev=408&view=rev Author: nifi Date: 2008-11-06 00:52:24 +0000 (Thu, 06 Nov 2008) Log Message: ----------- added SimEvent for notification about simulation start/stop Modified Paths: -------------- mspsim/se/sics/mspsim/core/MSP430.java mspsim/se/sics/mspsim/ui/ControlUI.java Added Paths: ----------- mspsim/se/sics/mspsim/core/SimEvent.java mspsim/se/sics/mspsim/core/SimEventListener.java Modified: mspsim/se/sics/mspsim/core/MSP430.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430.java 2008-11-05 23:51:18 UTC (rev 407) +++ mspsim/se/sics/mspsim/core/MSP430.java 2008-11-06 00:52:24 UTC (rev 408) @@ -66,6 +66,8 @@ private MapTable map; private Profiler profiler; + private SimEventListener[] simEventListeners; + /** * Creates a new <code>MSP430</code> instance. * @@ -329,8 +331,18 @@ } } - public boolean setRunning(boolean running) { - return this.running = running; + public void setRunning(boolean running) { + if (this.running != running) { + this.running = running; + SimEventListener[] listeners = this.simEventListeners; + if (listeners != null) { + SimEvent.Type type = running ? SimEvent.Type.START : SimEvent.Type.STOP; + SimEvent event = new SimEvent(type); + for(SimEventListener l : listeners) { + l.simChanged(event); + } + } + } } public boolean isRunning() { @@ -345,4 +357,12 @@ sleepRate = rate; } + public synchronized void addSimEventListener(SimEventListener l) { + simEventListeners = (SimEventListener[]) Utils.add(SimEventListener.class, simEventListeners, l); + } + + public synchronized void removeSimEventListener(SimEventListener l) { + simEventListeners = (SimEventListener[]) Utils.remove(simEventListeners, l); + } + } Added: mspsim/se/sics/mspsim/core/SimEvent.java =================================================================== --- mspsim/se/sics/mspsim/core/SimEvent.java (rev 0) +++ mspsim/se/sics/mspsim/core/SimEvent.java 2008-11-06 00:52:24 UTC (rev 408) @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2008, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of MSPSim. + * + * $Id$ + * + * ----------------------------------------------------------------- + * + * SimEvent + * + * Authors : Joakim Eriksson, Niclas Finne + * Created : 6 nov 2008 + * Updated : $Date$ + * $Revision$ + */ + +package se.sics.mspsim.core; + +/** + * + */ +public class SimEvent { + + public enum Type { + START, + STOP + }; + + private Type type; + + public SimEvent(Type type) { + this.type = type; + } + + public Type getType() { + return type; + } + +} Property changes on: mspsim/se/sics/mspsim/core/SimEvent.java ___________________________________________________________________ Added: svn:keywords + Rev Date Id Added: svn:eol-style + LF Added: mspsim/se/sics/mspsim/core/SimEventListener.java =================================================================== --- mspsim/se/sics/mspsim/core/SimEventListener.java (rev 0) +++ mspsim/se/sics/mspsim/core/SimEventListener.java 2008-11-06 00:52:24 UTC (rev 408) @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2008, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of MSPSim. + * + * $Id$ + * + * ----------------------------------------------------------------- + * + * SimEventListener + * + * Authors : Joakim Eriksson, Niclas Finne + * Created : 6 nov 2008 + * Updated : $Date$ + * $Revision$ + */ + +package se.sics.mspsim.core; + +/** + * + */ +public interface SimEventListener { + + public void simChanged(SimEvent event); + +} Property changes on: mspsim/se/sics/mspsim/core/SimEventListener.java ___________________________________________________________________ Added: svn:keywords + Rev Date Id Added: svn:eol-style + LF Modified: mspsim/se/sics/mspsim/ui/ControlUI.java =================================================================== --- mspsim/se/sics/mspsim/ui/ControlUI.java 2008-11-05 23:51:18 UTC (rev 407) +++ mspsim/se/sics/mspsim/ui/ControlUI.java 2008-11-06 00:52:24 UTC (rev 408) @@ -52,20 +52,25 @@ import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.KeyStroke; - -import se.sics.mspsim.core.*; +import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.core.MSP430Constants; +import se.sics.mspsim.core.SimEvent; +import se.sics.mspsim.core.SimEventListener; import se.sics.mspsim.extutil.jfreechart.DataChart; import se.sics.mspsim.platform.GenericNode; import se.sics.mspsim.util.ComponentRegistry; import se.sics.mspsim.util.DebugInfo; import se.sics.mspsim.util.ELF; -public class ControlUI extends JPanel implements ActionListener { +public class ControlUI extends JPanel implements ActionListener, SimEventListener { + private static final long serialVersionUID = -2431892192775232653L; + private static final String TITLE = "MSPSim monitor"; private static final boolean USE_STACKUI = false; private JFrame window; + private JButton controlButton; private MSP430 cpu; private GenericNode node; private DebugUI dui; @@ -103,9 +108,11 @@ window.add(dui = new DebugUI(cpu), BorderLayout.CENTER); createButton("Debug On"); - createButton("Stop"); + controlButton = createButton(cpu.isRunning() ? "Stop" : "Run"); stepAction = new AbstractAction("Single Step") { - public void actionPerformed(ActionEvent e) { + private static final long serialVersionUID = 1L; + + public void actionPerformed(ActionEvent e) { ControlUI.this.node.step(); dui.updateRegs(); dui.repaint(); @@ -127,7 +134,7 @@ }; stepAction.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_S)); - stepAction.setEnabled(false); + stepAction.setEnabled(!cpu.isRunning()); JButton stepButton = new JButton(stepAction); add(stepButton); @@ -144,6 +151,8 @@ "cpuStep"); stepButton.getActionMap().put("cpuStep", stepAction); + cpu.addSimEventListener(this); + WindowUtils.restoreWindowBounds("ControlUI", window); WindowUtils.addSaveOnShutdown("ControlUI", window); window.setVisible(true); @@ -153,7 +162,6 @@ sourceViewer = viewer; } - private JButton createButton(String text) { JButton jb = new JButton(text); jb.addActionListener(this); @@ -178,13 +186,9 @@ } else if ("Run".equals(cmd)) { node.start(); - ((JButton) ae.getSource()).setText("Stop"); - stepAction.setEnabled(false); } else if ("Stop".equals(cmd)) { node.stop(); - ((JButton) ae.getSource()).setText("Run"); - stepAction.setEnabled(true); } else if ("Profile Dump".equals(cmd)) { if (cpu.getProfiler() != null) { @@ -196,7 +200,7 @@ // cpu.step(); // dui.repaint(); } else if ("Show Source".equals(cmd)) { - int pc = cpu.readRegister(cpu.PC); + int pc = cpu.readRegister(MSP430Constants.PC); if (elfData != null) { DebugInfo dbg = elfData.getDebugInfo(pc); if (dbg != null) { @@ -218,4 +222,25 @@ } dui.updateRegs(); } -} \ No newline at end of file + + public void simChanged(SimEvent event) { + switch (event.getType()) { + case START: + case STOP: + java.awt.EventQueue.invokeLater(new Runnable() { + + public void run() { + if (cpu.isRunning()) { + controlButton.setText("Stop"); + stepAction.setEnabled(false); + } else { + controlButton.setText("Run"); + stepAction.setEnabled(true); + } + } + + }); + break; + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-05 23:51:21
|
Revision: 407 http://mspsim.svn.sourceforge.net/mspsim/?rev=407&view=rev Author: nifi Date: 2008-11-05 23:51:18 +0000 (Wed, 05 Nov 2008) Log Message: ----------- load images from jar archive if possible + minor cleanup Modified Paths: -------------- mspsim/se/sics/mspsim/platform/esb/ESBGui.java mspsim/se/sics/mspsim/platform/sky/SkyGui.java Modified: mspsim/se/sics/mspsim/platform/esb/ESBGui.java =================================================================== --- mspsim/se/sics/mspsim/platform/esb/ESBGui.java 2008-11-05 23:50:25 UTC (rev 406) +++ mspsim/se/sics/mspsim/platform/esb/ESBGui.java 2008-11-05 23:51:18 UTC (rev 407) @@ -43,12 +43,11 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; +import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; +import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.awt.event.MouseMotionListener; -import java.awt.event.MouseListener; - +import java.net.URL; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; @@ -56,15 +55,16 @@ import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JFrame; - import se.sics.mspsim.chip.Beeper; -import se.sics.mspsim.core.*; +import se.sics.mspsim.core.ADC12; +import se.sics.mspsim.core.ADCInput; +import se.sics.mspsim.core.IOUnit; +import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.core.USART; import se.sics.mspsim.ui.SerialMon; import se.sics.mspsim.ui.WindowUtils; -public class ESBGui extends JComponent implements KeyListener, - MouseMotionListener, - MouseListener, ADCInput { +public class ESBGui extends JComponent implements ADCInput { private static final long serialVersionUID = -139331418649524704L; @@ -95,13 +95,21 @@ private TargetDataLine inDataLine; - public ESBGui(ESBNode node) { - this.node = node; + public ESBGui(ESBNode esbNode) { + this.node = esbNode; setBackground(Color.black); setOpaque(true); - esbImage = new ImageIcon("images/esb.jpg"); + URL imageURL = ESBGui.class.getResource("images/esb.jpg"); + if (imageURL == null) { + imageURL = ESBGui.class.getResource("/images/esb.jpg"); + } + if (imageURL != null) { + esbImage = new ImageIcon(imageURL); + } else { + esbImage = new ImageIcon("images/esb.jpg"); + } if (esbImage.getIconWidth() == 0 || esbImage.getIconHeight() == 0) { // Image not found throw new IllegalStateException("image not found"); @@ -116,10 +124,62 @@ WindowUtils.addSaveOnShutdown("ESBGui", window); window.setVisible(true); - window.addKeyListener(this); - addMouseMotionListener(this); - addMouseListener(this); + window.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent key) { + if (key.getKeyChar() == 'd') { + node.setDebug(!node.getDebug()); + } + } + + }); + + MouseAdapter mouseListener = new MouseAdapter() { + + public void mouseMoved(MouseEvent e) { + // System.out.println("Mouse moved: " + e.getX() + "," + e.getY()); + int x = e.getX(); + int y = e.getY(); + node.setPIR(x > 18 && x < 80 && y > 35 && y < 100); + node.setVIB(x > 62 && x < 95 && y > 160 && y < 178); + } + + // For the button sensor on the ESB nodes. + public void mousePressed(MouseEvent e) { + int x = e.getX(); + int y = e.getY(); + if (y > 152 && y < 168) { + if (x > 0 && x < 19) { + node.setButton(buttonDown = true); + } else { + int w = esbImage.getIconWidth(); + if (x > w - 20 && x < w) { + resetDown = true; + } + } + } + } + + public void mouseReleased(MouseEvent e) { + if (buttonDown) { + node.setButton(buttonDown = false); + } else if (resetDown) { + int x = e.getX(); + int y = e.getY(); + if (y > 152 && y < 168) { + int w = esbImage.getIconWidth(); + if (x > w - 20 && x < w) { + node.getCPU().reset(); + } + } + resetDown = false; + } + } + + }; + addMouseMotionListener(mouseListener); + addMouseListener(mouseListener); + // Add some windows for listening to serial output MSP430 cpu = node.getCPU(); IOUnit usart = cpu.getIOUnit("USART 1"); @@ -136,7 +196,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); DataLine.Info dlin = @@ -167,53 +226,7 @@ return (((data[1] & 0xff) << 8) | data[0] & 0xff) >> 4; } - public void mouseMoved(MouseEvent e) { - // System.out.println("Mouse moved: " + e.getX() + "," + e.getY()); - int x = e.getX(); - int y = e.getY(); - node.setPIR(x > 18 && x < 80 && y > 35 && y < 100); - node.setVIB(x > 62 && x < 95 && y > 160 && y < 178); - } - - public void mouseDragged(MouseEvent e) {} - public void mouseClicked(MouseEvent e) {} - public void mouseEntered(MouseEvent e) {} - public void mouseExited(MouseEvent e) {} - - // For the button sensor on the ESB nodes. - public void mousePressed(MouseEvent e) { - int x = e.getX(); - int y = e.getY(); - if (y > 152 && y < 168) { - if (x > 0 && x < 19) { - node.setButton(buttonDown = true); - } else { - int w = esbImage.getIconWidth(); - if (x > w - 20 && x < w) { - resetDown = true; - } - } - } - } - public void mouseReleased(MouseEvent e) { - if (buttonDown) { - node.setButton(buttonDown = false); - } else if (resetDown) { - int x = e.getX(); - int y = e.getY(); - if (y > 152 && y < 168) { - int w = esbImage.getIconWidth(); - if (x > w - 20 && x < w) { - node.getCPU().reset(); - } - } - resetDown = false; - } - } - - - - public void paintComponent(Graphics g) { + protected void paintComponent(Graphics g) { Color old = g.getColor(); int w = getWidth(), h = getHeight(); int iw = esbImage.getIconWidth(), ih = esbImage.getIconHeight(); @@ -249,16 +262,4 @@ g.setColor(old); } - public void keyPressed(KeyEvent key) { - if (key.getKeyChar() == 'd') { - node.setDebug(!node.getDebug()); - } - } - - public void keyReleased(KeyEvent key) { - } - - public void keyTyped(KeyEvent key) { - } - } Modified: mspsim/se/sics/mspsim/platform/sky/SkyGui.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyGui.java 2008-11-05 23:50:25 UTC (rev 406) +++ mspsim/se/sics/mspsim/platform/sky/SkyGui.java 2008-11-05 23:51:18 UTC (rev 407) @@ -43,19 +43,21 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; +import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.net.URL; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JFrame; - -import se.sics.mspsim.core.*; +import se.sics.mspsim.core.IOUnit; +import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.core.USART; import se.sics.mspsim.ui.SerialMon; import se.sics.mspsim.ui.WindowUtils; -public class SkyGui extends JComponent implements KeyListener { +public class SkyGui extends JComponent { /** * @@ -87,7 +89,15 @@ setBackground(Color.black); setOpaque(true); - skyImage = new ImageIcon("images/sky.jpg"); + URL imageURL = SkyGui.class.getResource("images/sky.jpg"); + if (imageURL == null) { + imageURL = SkyGui.class.getResource("/images/sky.jpg"); + } + if (imageURL != null) { + skyImage = new ImageIcon(imageURL); + } else { + skyImage = new ImageIcon("images/sky.jpg"); + } if (skyImage.getIconWidth() == 0 || skyImage.getIconHeight() == 0) { // Image not found throw new IllegalStateException("image not found"); @@ -102,8 +112,17 @@ WindowUtils.addSaveOnShutdown("SkyGui", window); window.setVisible(true); - window.addKeyListener(this); + window.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent key) { +// System.out.println("Key Pressed: " + key.getKeyChar()); + if (key.getKeyChar() == 'd') { + SkyGui.this.node.setDebug(!SkyGui.this.node.getDebug()); + } + } + + }); + MouseAdapter mouseHandler = new MouseAdapter() { private boolean buttonDown = false; @@ -184,17 +203,4 @@ g.setColor(old); } - public void keyPressed(KeyEvent key) { -// System.out.println("Key Pressed: " + key.getKeyChar()); - if (key.getKeyChar() == 'd') { - node.setDebug(!node.getDebug()); - } - } - - public void keyReleased(KeyEvent key) { - } - - public void keyTyped(KeyEvent key) { - } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-05 23:50:31
|
Revision: 406 http://mspsim.svn.sourceforge.net/mspsim/?rev=406&view=rev Author: nifi Date: 2008-11-05 23:50:25 +0000 (Wed, 05 Nov 2008) Log Message: ----------- only run autostart script if found Modified Paths: -------------- mspsim/se/sics/mspsim/platform/GenericNode.java Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2008-11-05 23:13:13 UTC (rev 405) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2008-11-05 23:50:25 UTC (rev 406) @@ -39,6 +39,7 @@ package se.sics.mspsim.platform; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; +import java.io.File; import java.io.IOException; import java.net.URL; @@ -125,10 +126,13 @@ String script = config.getProperty("autorun"); if (script != null) { - CommandHandler ch = (CommandHandler) registry.getComponent("commandHandler"); - System.out.println("Autoloading script: " + script); - if (ch != null) { - ch.lineRead("source " + script); + File fp = new File(script); + if (fp.canRead()) { + CommandHandler ch = (CommandHandler) registry.getComponent("commandHandler"); + System.out.println("Autoloading script: " + script); + if (ch != null) { + ch.lineRead("source " + script); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-05 23:13:16
|
Revision: 405 http://mspsim.svn.sourceforge.net/mspsim/?rev=405&view=rev Author: nifi Date: 2008-11-05 23:13:13 +0000 (Wed, 05 Nov 2008) Log Message: ----------- extracted main method to class Main Modified Paths: -------------- mspsim/Makefile mspsim/se/sics/mspsim/platform/esb/ESBNode.java Added Paths: ----------- mspsim/se/sics/mspsim/platform/esb/Main.java Modified: mspsim/Makefile =================================================================== --- mspsim/Makefile 2008-11-05 23:05:45 UTC (rev 404) +++ mspsim/Makefile 2008-11-05 23:13:13 UTC (rev 405) @@ -93,7 +93,7 @@ JarManifest.txt: @echo >>$@ "Manifest-Version: 1.0" @echo >>$@ "Sealed: true" - @echo >>$@ "Main-Class: se.sics.mspsim.platform.sky.SkyNode" + @echo >>$@ "Main-Class: se.sics.mspsim.platform.sky.Main" @echo >>$@ "Class-path: lib/jfreechart-1.0.9.jar lib/jcommon-1.0.12.jar" help: @@ -103,13 +103,13 @@ $(JAVA) $(JAVAARGS) se.sics.mspsim.util.IHexReader $(ARGS) $(FIRMWAREFILE) $(MAPFILE) runesb: compile - $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.esb.ESBNode $(ARGS) $(ESBFIRMWARE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.esb.Main $(ARGS) $(ESBFIRMWARE) $(MAPFILE) runsky: compile - $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.sky.SkyNode $(ARGS) $(SKYFIRMWARE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.sky.Main $(ARGS) $(SKYFIRMWARE) $(MAPFILE) runskyprof: compile - $(JAVA) -agentlib:yjpagent $(JAVAARGS) se.sics.mspsim.platform.sky.SkyNode $(ARGS) $(SKYFIRMWARE) $(MAPFILE) + $(JAVA) -agentlib:yjpagent $(JAVAARGS) se.sics.mspsim.platform.sky.Main $(ARGS) $(SKYFIRMWARE) $(MAPFILE) runtelos: compile $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.sky.TelosNode $(ARGS) $(SKYFIRMWARE) $(MAPFILE) Modified: mspsim/se/sics/mspsim/platform/esb/ESBNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/esb/ESBNode.java 2008-11-05 23:05:45 UTC (rev 404) +++ mspsim/se/sics/mspsim/platform/esb/ESBNode.java 2008-11-05 23:13:13 UTC (rev 405) @@ -50,7 +50,6 @@ import se.sics.mspsim.extutil.jfreechart.DataChart; import se.sics.mspsim.extutil.jfreechart.DataSourceSampler; import se.sics.mspsim.platform.GenericNode; -import se.sics.mspsim.util.ArgumentManager; public class ESBNode extends GenericNode implements PortListener { @@ -182,21 +181,14 @@ } public String getName() { - return "ESB Node"; + return "ESB"; } + /** + * @deprecated Use se.sics.mspsim.platform.sky.Main instead. + */ public static void main(String[] args) throws IOException { - ESBNode node = new ESBNode(); - ArgumentManager config = new ArgumentManager(); - config.handleArguments(args); - if (config.getProperty("nogui") == null) { - config.setProperty("nogui", "false"); - } - /* Ensure auto-run of a start script */ - if (config.getProperty("autorun") == null) { - config.setProperty("autorun", "scripts/autorun.sc"); - } - node.setupArgs(config); + Main.main(args); } } Added: mspsim/se/sics/mspsim/platform/esb/Main.java =================================================================== --- mspsim/se/sics/mspsim/platform/esb/Main.java (rev 0) +++ mspsim/se/sics/mspsim/platform/esb/Main.java 2008-11-05 23:13:13 UTC (rev 405) @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2008, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of MSPSim + * + * $Id$ + * + * ----------------------------------------------------------------- + * + * Main + * + * Authors : Joakim Eriksson, Niclas Finne + * Created : 6 nov 2008 + * Updated : $Date$ + * $Revision$ + */ + +package se.sics.mspsim.platform.esb; +import java.io.IOException; +import se.sics.mspsim.util.ArgumentManager; + +/** + * + */ +public class Main { + + public static void main(String[] args) throws IOException { + ESBNode node = new ESBNode(); + ArgumentManager config = new ArgumentManager(); + config.handleArguments(args); + if (config.getProperty("nogui") == null) { + config.setProperty("nogui", "false"); + } + /* Ensure auto-run of a start script */ + if (config.getProperty("autorun") == null) { + config.setProperty("autorun", "scripts/autorun.sc"); + } + node.setupArgs(config); + } + +} Property changes on: mspsim/se/sics/mspsim/platform/esb/Main.java ___________________________________________________________________ Added: svn:keywords + Rev Date Id Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-05 23:05:48
|
Revision: 404 http://mspsim.svn.sourceforge.net/mspsim/?rev=404&view=rev Author: nifi Date: 2008-11-05 23:05:45 +0000 (Wed, 05 Nov 2008) Log Message: ----------- extracted main method to class Main + cleanup Modified Paths: -------------- mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java mspsim/se/sics/mspsim/platform/sky/RadioWrapper.java mspsim/se/sics/mspsim/platform/sky/SkyNode.java mspsim/se/sics/mspsim/platform/sky/TelosNode.java Added Paths: ----------- mspsim/se/sics/mspsim/platform/sky/Main.java Added: mspsim/se/sics/mspsim/platform/sky/Main.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/Main.java (rev 0) +++ mspsim/se/sics/mspsim/platform/sky/Main.java 2008-11-05 23:05:45 UTC (rev 404) @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2008, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + * + * ----------------------------------------------------------------- + * + * Main + * + * Authors : Joakim Eriksson, Niclas Finne + * Created : 6 nov 2008 + * Updated : $Date$ + * $Revision$ + */ + +package se.sics.mspsim.platform.sky; +import java.io.IOException; +import se.sics.mspsim.util.ArgumentManager; + +/** + * + */ +public class Main { + + public static void main(String[] args) throws IOException { + SkyNode node = new SkyNode(); + ArgumentManager config = new ArgumentManager(); + config.handleArguments(args); + if (config.getProperty("nogui") == null) { + config.setProperty("nogui", "false"); + } + /* Ensure auto-run of a start script */ + if (config.getProperty("autorun") == null) { + config.setProperty("autorun", "scripts/autorun.sc"); + } + + node.setupArgs(config); + } + +} Property changes on: mspsim/se/sics/mspsim/platform/sky/Main.java ___________________________________________________________________ Added: svn:keywords + Rev Date Id Added: svn:eol-style + LF Modified: mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java 2008-11-05 22:51:04 UTC (rev 403) +++ mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java 2008-11-05 23:05:45 UTC (rev 404) @@ -1,14 +1,20 @@ package se.sics.mspsim.platform.sky; import se.sics.mspsim.chip.CC2420; +import se.sics.mspsim.chip.PacketListener; import se.sics.mspsim.chip.SHT11; import se.sics.mspsim.core.IOPort; import se.sics.mspsim.core.IOUnit; +import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.PortListener; import se.sics.mspsim.core.USART; import se.sics.mspsim.core.USARTListener; +import se.sics.mspsim.extutil.jfreechart.DataChart; +import se.sics.mspsim.extutil.jfreechart.DataSourceSampler; import se.sics.mspsim.platform.GenericNode; import se.sics.mspsim.util.ELF; +import se.sics.mspsim.util.NetworkConnection; +import se.sics.mspsim.util.OperatingModeStatistics; public abstract class MoteIVNode extends GenericNode implements PortListener, USARTListener { @@ -58,7 +64,10 @@ public SHT11 sht11; public SkyGui gui; + public NetworkConnection network; + protected String flashFile; + public void setDebug(boolean debug) { cpu.setDebug(debug); } @@ -112,7 +121,76 @@ } } - + public void setupNode() { + // create a filename for the flash file + // This should be possible to take from a config file later! + String fileName = config.getProperty("flashfile"); + if (fileName == null) { + fileName = firmwareFile; + if (fileName != null) { + int ix = fileName.lastIndexOf('.'); + if (ix > 0) { + fileName = fileName.substring(0, ix); + } + fileName = fileName + ".flash"; + } + } + if (DEBUG) System.out.println("Using flash file: " + (fileName == null ? "no file" : fileName)); + + this.flashFile = fileName; + + setupNodePorts(); + + stats.addMonitor(this); + stats.addMonitor(radio); + stats.addMonitor(cpu); + + if (config.getPropertyAsBoolean("enableNetwork", false)) { + network = new NetworkConnection(); + final RadioWrapper radioWrapper = new RadioWrapper(radio); + radioWrapper.setPacketListener(new PacketListener() { + public void transmissionStarted() { + } + public void transmissionEnded(byte[] receivedData) { + // System.out.println("**** Sending data len = " + receivedData.length); + // for (int i = 0; i < receivedData.length; i++) { + // System.out.println("Byte: " + Utils.hex8(receivedData[i])); + // } + network.dataSent(receivedData); + } + }); + + network.addPacketListener(new PacketListener() { + public void transmissionStarted() { + } + public void transmissionEnded(byte[] receivedData) { + // System.out.println("**** Receiving data = " + receivedData.length); + radioWrapper.packetReceived(receivedData); + } + }); + } + + // UART0 TXreg = 0x77? +// cpu.setBreakPoint(0x77, new CPUMonitor() { +// public void cpuAction(int type, int adr, int data) { +// System.out.println("Write to USART0 TX: " + data + " at " + +// SkyNode.this.elf.getDebugInfo(SkyNode.this.cpu.readRegister(0))); +// } +// }); + + if (!config.getPropertyAsBoolean("nogui", true)) { + gui = new SkyGui(this); + + // A HACK for some "graphs"!!! + DataChart dataChart = new DataChart("Duty Cycle", "Duty Cycle"); + DataSourceSampler dss = dataChart.setupChipFrame(cpu); + dataChart.addDataSource(dss, "LEDS", stats.getDataSource(getName(), 0, OperatingModeStatistics.OP_INVERT)); + dataChart.addDataSource(dss, "Listen", stats.getDataSource("CC2420", CC2420.MODE_RX_ON)); + dataChart.addDataSource(dss, "Transmit", stats.getDataSource("CC2420", CC2420.MODE_TXRX_ON)); + dataChart.addDataSource(dss, "CPU", stats.getDataSource("MSP430 Core", MSP430.MODE_ACTIVE)); + } + } + public void portWrite(IOPort source, int data) { if (source == port5) { redLed = (data & RED_LED) == 0; @@ -139,7 +217,7 @@ public int getModeMax() { return MODE_MAX; } - - abstract void flashWrite(IOPort source, int data); - + + protected abstract void flashWrite(IOPort source, int data); + } Modified: mspsim/se/sics/mspsim/platform/sky/RadioWrapper.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/RadioWrapper.java 2008-11-05 22:51:04 UTC (rev 403) +++ mspsim/se/sics/mspsim/platform/sky/RadioWrapper.java 2008-11-05 23:05:45 UTC (rev 404) @@ -1,11 +1,8 @@ package se.sics.mspsim.platform.sky; - import se.sics.mspsim.chip.CC2420; import se.sics.mspsim.chip.PacketListener; import se.sics.mspsim.chip.RFListener; -import se.sics.mspsim.util.Utils; - public class RadioWrapper implements RFListener { private CC2420 radio; @@ -41,13 +38,11 @@ } } - // NOTE: len is not in the packet for now... public void receivedByte(byte data) { // System.out.println("*** RF Data :" + data + " = $" + Utils.hex8(data) + " => " + // (char) data); if (pos == 5) { - // System.out.println("**** Setting length to:" + data); len = data; } if (pos == 0) { Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-11-05 22:51:04 UTC (rev 403) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-11-05 23:05:45 UTC (rev 404) @@ -41,19 +41,10 @@ package se.sics.mspsim.platform.sky; import java.io.IOException; -import se.sics.mspsim.chip.CC2420; import se.sics.mspsim.chip.FileM25P80; import se.sics.mspsim.chip.M25P80; -import se.sics.mspsim.chip.PacketListener; import se.sics.mspsim.core.IOPort; -import se.sics.mspsim.core.IOUnit; -import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.USART; -import se.sics.mspsim.extutil.jfreechart.DataChart; -import se.sics.mspsim.extutil.jfreechart.DataSourceSampler; -import se.sics.mspsim.util.ArgumentManager; -import se.sics.mspsim.util.NetworkConnection; -import se.sics.mspsim.util.OperatingModeStatistics; /** * Emulation of Sky Mote @@ -62,10 +53,7 @@ public static final boolean DEBUG = false; - public NetworkConnection network; - private M25P80 flash; - private String flashFile; /** * Creates a new <code>SkyNode</code> instance. @@ -95,7 +83,7 @@ } @Override - void flashWrite(IOPort source, int data) { + protected void flashWrite(IOPort source, int data) { flash.portWrite(source, data); } @@ -110,89 +98,11 @@ } } - public void setupNode() { - // create a filename for the flash file - // This should be possible to take from a config file later! - String fileName = config.getProperty("flashfile"); - if (fileName == null) { - fileName = firmwareFile; - if (fileName != null) { - int ix = fileName.lastIndexOf('.'); - if (ix > 0) { - fileName = fileName.substring(0, ix); - } - fileName = fileName + ".flash"; - } - } - if (DEBUG) System.out.println("Using flash file: " + (fileName == null ? "no file" : fileName)); - - this.flashFile = fileName; - - setupNodePorts(); - - stats.addMonitor(this); - stats.addMonitor(radio); - stats.addMonitor(cpu); - - if (config.getPropertyAsBoolean("enableNetwork", false)) { - network = new NetworkConnection(); - final RadioWrapper radioWrapper = new RadioWrapper(radio); - radioWrapper.setPacketListener(new PacketListener() { - public void transmissionStarted() { - } - public void transmissionEnded(byte[] receivedData) { - // System.out.println("**** Sending data len = " + receivedData.length); - // for (int i = 0; i < receivedData.length; i++) { - // System.out.println("Byte: " + Utils.hex8(receivedData[i])); - // } - network.dataSent(receivedData); - } - }); - - network.addPacketListener(new PacketListener() { - public void transmissionStarted() { - } - public void transmissionEnded(byte[] receivedData) { - // System.out.println("**** Receiving data = " + receivedData.length); - radioWrapper.packetReceived(receivedData); - } - }); - } - - // UART0 TXreg = 0x77? -// cpu.setBreakPoint(0x77, new CPUMonitor() { -// public void cpuAction(int type, int adr, int data) { -// System.out.println("Write to USART0 TX: " + data + " at " + -// SkyNode.this.elf.getDebugInfo(SkyNode.this.cpu.readRegister(0))); -// } -// }); - - if (!config.getPropertyAsBoolean("nogui", true)) { - gui = new SkyGui(this); - - // A HACK for some "graphs"!!! - DataChart dataChart = new DataChart("Duty Cycle", "Duty Cycle"); - DataSourceSampler dss = dataChart.setupChipFrame(cpu); - dataChart.addDataSource(dss, "LEDS", stats.getDataSource("Tmote Sky", 0, OperatingModeStatistics.OP_INVERT)); - dataChart.addDataSource(dss, "Listen", stats.getDataSource("CC2420", CC2420.MODE_RX_ON)); - dataChart.addDataSource(dss, "Transmit", stats.getDataSource("CC2420", CC2420.MODE_TXRX_ON)); - dataChart.addDataSource(dss, "CPU", stats.getDataSource("MSP430 Core", MSP430.MODE_ACTIVE)); - } - } - + /** + * @deprecated Use se.sics.mspsim.platform.sky.Main instead. + */ public static void main(String[] args) throws IOException { - SkyNode node = new SkyNode(); - ArgumentManager config = new ArgumentManager(); - config.handleArguments(args); - if (config.getProperty("nogui") == null) { - config.setProperty("nogui", "false"); - } - /* Ensure auto-run of a start script */ - if (config.getProperty("autorun") == null) { - config.setProperty("autorun", "scripts/autorun.sc"); - } - - node.setupArgs(config); + Main.main(args); } } Modified: mspsim/se/sics/mspsim/platform/sky/TelosNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/TelosNode.java 2008-11-05 22:51:04 UTC (rev 403) +++ mspsim/se/sics/mspsim/platform/sky/TelosNode.java 2008-11-05 23:05:45 UTC (rev 404) @@ -27,11 +27,11 @@ * * This file is part of MSPSim. * - * $Id: SkyNode.java 304 2008-09-06 20:04:45Z joxe $ + * $Id: TelosNode.java 304 2008-09-06 20:04:45Z joxe $ * * ----------------------------------------------------------------- * - * SkyNode + * TelosNode * * Author : Joakim Eriksson * Created : Sun Oct 21 22:00:00 2007 @@ -41,21 +41,11 @@ package se.sics.mspsim.platform.sky; import java.io.IOException; - import se.sics.mspsim.chip.AT45DB; -import se.sics.mspsim.chip.CC2420; import se.sics.mspsim.chip.FileAT45DB; -import se.sics.mspsim.chip.PacketListener; -import se.sics.mspsim.chip.RFListener; import se.sics.mspsim.core.IOPort; -import se.sics.mspsim.core.IOUnit; -import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.USART; -import se.sics.mspsim.extutil.jfreechart.DataChart; -import se.sics.mspsim.extutil.jfreechart.DataSourceSampler; import se.sics.mspsim.util.ArgumentManager; -import se.sics.mspsim.util.NetworkConnection; -import se.sics.mspsim.util.OperatingModeStatistics; /** * Emulation of Telos Mote (old version of Sky Node) @@ -69,14 +59,10 @@ public static final int FLASH_RESET = (1<<3); public static final int FLASH_CS = (1<<4); - public NetworkConnection network; - - private AT45DB flash; - private String flashFile; /** - * Creates a new <code>SkyNode</code> instance. + * Creates a new <code>TelosNode</code> instance. * */ public TelosNode() { @@ -92,7 +78,7 @@ } @Override - void flashWrite(IOPort source, int data) { + protected void flashWrite(IOPort source, int data) { flash.setReset((data & FLASH_RESET) == 0); flash.setChipSelect((data & FLASH_CS) == 0); } @@ -107,83 +93,25 @@ return "Telos"; } - public void setupNodePorts(boolean loadFlash) { + public void setupNodePorts() { super.setupNodePorts(); - if (loadFlash) { + if (flashFile != null) { flash = new FileAT45DB(cpu, flashFile); } } - public void setupNode() { - // create a filename for the flash file - // This should be possible to take from a config file later! - String fileName = config.getProperty("flashfile"); - if (fileName == null) { - fileName = firmwareFile; - int ix = fileName.lastIndexOf('.'); - if (ix > 0) { - fileName = fileName.substring(0, ix); - } - fileName = fileName + ".flash"; - } - System.out.println("Using flash file: " + fileName); - - this.flashFile = fileName; - - setupNodePorts(true); - - stats.addMonitor(this); - stats.addMonitor(radio); - stats.addMonitor(cpu); - - network = new NetworkConnection(); - final RadioWrapper radioWrapper = new RadioWrapper(radio); - radioWrapper.setPacketListener(new PacketListener() { - public void transmissionStarted() { - } - public void transmissionEnded(byte[] receivedData) { - network.dataSent(receivedData); - } - }); - - network.addPacketListener(new PacketListener() { - public void transmissionStarted() { - } - public void transmissionEnded(byte[] receivedData) { - radioWrapper.packetReceived(receivedData); - } - }); - - // UART0 TXreg = 0x77? -// cpu.setBreakPoint(0x77, new CPUMonitor() { -// public void cpuAction(int type, int adr, int data) { -// System.out.println("Write to USART0 TX: " + data + " at " + -// SkyNode.this.elf.getDebugInfo(SkyNode.this.cpu.readRegister(0))); -// } -// }); - - if (!config.getPropertyAsBoolean("nogui", false)) { - gui = new SkyGui(this); - - // A HACK for some "graphs"!!! - DataChart dataChart = new DataChart("Duty Cycle", "Duty Cycle"); - DataSourceSampler dss = dataChart.setupChipFrame(cpu); - dataChart.addDataSource(dss, "LEDS", stats.getDataSource("Telos", 0, OperatingModeStatistics.OP_INVERT)); - dataChart.addDataSource(dss, "Listen", stats.getDataSource("CC2420", CC2420.MODE_RX_ON)); - dataChart.addDataSource(dss, "Transmit", stats.getDataSource("CC2420", CC2420.MODE_TXRX_ON)); - dataChart.addDataSource(dss, "CPU", stats.getDataSource("MSP430 Core", MSP430.MODE_ACTIVE)); - } - } - - public static void main(String[] args) throws IOException { TelosNode node = new TelosNode(); ArgumentManager config = new ArgumentManager(); config.handleArguments(args); - node.setup(config); + if (config.getProperty("nogui") == null) { + config.setProperty("nogui", "false"); + } /* Ensure auto-run of a start script */ if (config.getProperty("autorun") == null) { config.setProperty("autorun", "scripts/autorun.sc"); } + node.setupArgs(config); } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-05 22:51:27
|
Revision: 403 http://mspsim.svn.sourceforge.net/mspsim/?rev=403&view=rev Author: nifi Date: 2008-11-05 22:51:04 +0000 (Wed, 05 Nov 2008) Log Message: ----------- fixed compiler warnings Modified Paths: -------------- mspsim/se/sics/mspsim/util/NetworkPacket.java Modified: mspsim/se/sics/mspsim/util/NetworkPacket.java =================================================================== --- mspsim/se/sics/mspsim/util/NetworkPacket.java 2008-11-05 00:54:24 UTC (rev 402) +++ mspsim/se/sics/mspsim/util/NetworkPacket.java 2008-11-05 22:51:04 UTC (rev 403) @@ -37,10 +37,10 @@ * Created : 31 mar 2008 * Updated : $Date:$ * $Revision:$ - */package se.sics.mspsim.util; + */ -import java.util.ArrayList; -import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable; +package se.sics.mspsim.util; +import java.util.Hashtable; public class NetworkPacket { byte[] data; @@ -48,28 +48,29 @@ "|payloadLength:16|nextHeader:8|hopLimit:8" + "|sourceAddress:128|destinationAddress:128"; - Hashtable fields = new Hashtable(); - - private class Field { + Hashtable<String,Field> fields = new Hashtable<String,Field>(); + + private static class Field { String name; int pos; int size; + Field(String name, int pos, int size) { this.name = name; this.pos = pos; this.size = size; } - + public String toString() { return name + ":" + pos + "-" + (pos + size - 1); } } - + public NetworkPacket(byte[] data) { this.data = data; parseData(); } - + private void parseData() { String[] parts = description.split("\\|"); int pos = 0; @@ -82,11 +83,11 @@ fields.put(f.name, f); } } - + public int getLength() { return data.length; } - + public int getIntBits(int startBit, int endBit) { int startByte = startBit >> 8; int endByte = endBit >> 8; @@ -108,12 +109,12 @@ } return result; } - + public int getInt(String field) { - Field f = (Field) fields.get(field); + Field f = fields.get(field); return getIntBits(f.pos, f.pos + f.size - 1); } - + public static void main(String[] args) { byte data[] = new byte[] { 0x61, 0x04, 0x00, 0x00, @@ -133,5 +134,3 @@ } } - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-11-05 00:54:30
|
Revision: 402 http://mspsim.svn.sourceforge.net/mspsim/?rev=402&view=rev Author: joxe Date: 2008-11-05 00:54:24 +0000 (Wed, 05 Nov 2008) Log Message: ----------- added initial network packet for parsing network packets Added Paths: ----------- mspsim/se/sics/mspsim/util/NetworkPacket.java Added: mspsim/se/sics/mspsim/util/NetworkPacket.java =================================================================== --- mspsim/se/sics/mspsim/util/NetworkPacket.java (rev 0) +++ mspsim/se/sics/mspsim/util/NetworkPacket.java 2008-11-05 00:54:24 UTC (rev 402) @@ -0,0 +1,137 @@ +/** + * Copyright (c) 2008, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of MSPSim. + * + * $Id: $ + * + * ----------------------------------------------------------------- + * + * NetworkPacket + * + * Author : Joakim Eriksson + * Created : 31 mar 2008 + * Updated : $Date:$ + * $Revision:$ + */package se.sics.mspsim.util; + +import java.util.ArrayList; +import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable; + +public class NetworkPacket { + byte[] data; + String description = "version:4|trafficClass:8|flowLabel:20" + + "|payloadLength:16|nextHeader:8|hopLimit:8" + + "|sourceAddress:128|destinationAddress:128"; + + Hashtable fields = new Hashtable(); + + private class Field { + String name; + int pos; + int size; + Field(String name, int pos, int size) { + this.name = name; + this.pos = pos; + this.size = size; + } + + public String toString() { + return name + ":" + pos + "-" + (pos + size - 1); + } + } + + public NetworkPacket(byte[] data) { + this.data = data; + parseData(); + } + + private void parseData() { + String[] parts = description.split("\\|"); + int pos = 0; + for (int i = 0; i < parts.length; i++) { + String field[] = parts[i].split(":"); + int size = Integer.parseInt(field[1]); + Field f = new Field(field[0], pos, size); + pos += size; + System.out.println("Adding field: " + f); + fields.put(f.name, f); + } + } + + public int getLength() { + return data.length; + } + + public int getIntBits(int startBit, int endBit) { + int startByte = startBit >> 8; + int endByte = endBit >> 8; + startBit = startBit & 7; + endBit = endBit & 7; + + int result = 0; + for (int i = startByte; i < endByte + 1; i++) { + int bt = data[i] & 0xff; + + if (i == startByte) { + bt = bt >> startBit; + } + if (i == endByte) { + // Rotate with 0 -- 7 + bt = bt >> (7 - endBit); + } + result = (result << 8) | bt; + } + return result; + } + + public int getInt(String field) { + Field f = (Field) fields.get(field); + return getIntBits(f.pos, f.pos + f.size - 1); + } + + public static void main(String[] args) { + byte data[] = new byte[] { + 0x61, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + }; + NetworkPacket np = new NetworkPacket(data); + System.out.println("Version: " + np.getIntBits(0, 3)); + System.out.println("Version: " + np.getInt("version")); + } + +} + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-04 09:44:56
|
Revision: 401 http://mspsim.svn.sourceforge.net/mspsim/?rev=401&view=rev Author: nifi Date: 2008-11-04 09:43:21 +0000 (Tue, 04 Nov 2008) Log Message: ----------- minor cleanup Modified Paths: -------------- mspsim/se/sics/mspsim/util/StatCommands.java Modified: mspsim/se/sics/mspsim/util/StatCommands.java =================================================================== --- mspsim/se/sics/mspsim/util/StatCommands.java 2008-11-04 09:41:25 UTC (rev 400) +++ mspsim/se/sics/mspsim/util/StatCommands.java 2008-11-04 09:43:21 UTC (rev 401) @@ -139,13 +139,13 @@ String[] parts = sName.split("\\."); sources[i] = statistics.getDataSource(parts[0], parts[1]); if (sources[i] == null) { - context.err.println("could not find chip / mode combination " + context.getArgument(i + 1)); + context.err.println("could not find chip / mode combination " + sName); return 1; } } else { - sources[i] = statistics.getMultiDataSource(context.getArgument(i + 1)); + sources[i] = statistics.getMultiDataSource(sName); if (sources[i] == null) { - context.err.println("could not find chip " + context.getArgument(i + 1)); + context.err.println("could not find chip " + sName); return 1; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-04 09:41:31
|
Revision: 400 http://mspsim.svn.sourceforge.net/mspsim/?rev=400&view=rev Author: nifi Date: 2008-11-04 09:41:25 +0000 (Tue, 04 Nov 2008) Log Message: ----------- verify that mode is valid Modified Paths: -------------- mspsim/se/sics/mspsim/core/Chip.java Modified: mspsim/se/sics/mspsim/core/Chip.java =================================================================== --- mspsim/se/sics/mspsim/core/Chip.java 2008-11-02 18:23:36 UTC (rev 399) +++ mspsim/se/sics/mspsim/core/Chip.java 2008-11-04 09:41:25 UTC (rev 400) @@ -97,9 +97,11 @@ } } try { - // If it is just an int it can be parsed! + // If it is just an integer it can be parsed! int modei = Integer.parseInt(mode); - return modei; + if (modei >= 0 && modei <= getModeMax()) { + return modei; + } } catch (Exception e) { } return -1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-02 18:23:46
|
Revision: 399 http://mspsim.svn.sourceforge.net/mspsim/?rev=399&view=rev Author: nifi Date: 2008-11-02 18:23:36 +0000 (Sun, 02 Nov 2008) Log Message: ----------- minor cleanup Modified Paths: -------------- mspsim/se/sics/mspsim/util/OperatingModeStatistics.java Modified: mspsim/se/sics/mspsim/util/OperatingModeStatistics.java =================================================================== --- mspsim/se/sics/mspsim/util/OperatingModeStatistics.java 2008-11-02 18:22:08 UTC (rev 398) +++ mspsim/se/sics/mspsim/util/OperatingModeStatistics.java 2008-11-02 18:23:36 UTC (rev 399) @@ -41,9 +41,7 @@ package se.sics.mspsim.util; import java.io.PrintStream; -import java.util.Arrays; import java.util.HashMap; - import se.sics.mspsim.core.Chip; import se.sics.mspsim.core.MSP430Core; import se.sics.mspsim.core.OperatingModeListener; @@ -169,8 +167,8 @@ long cycles = cpu.cycles; for (int i = 0, n = this.lastValue.length; i < n; i++) { this.lastValue[i] = entry.getValue(i, cycles); + this.lastCycles[i] = cycles; } - Arrays.fill(this.lastCycles, cycles); } public int getModeMax() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-02 18:22:22
|
Revision: 398 http://mspsim.svn.sourceforge.net/mspsim/?rev=398&view=rev Author: nifi Date: 2008-11-02 18:22:08 +0000 (Sun, 02 Nov 2008) Log Message: ----------- setup StatMultiDataSource and StatDataSource from start Modified Paths: -------------- mspsim/se/sics/mspsim/util/OperatingModeStatistics.java Modified: mspsim/se/sics/mspsim/util/OperatingModeStatistics.java =================================================================== --- mspsim/se/sics/mspsim/util/OperatingModeStatistics.java 2008-11-02 17:16:41 UTC (rev 397) +++ mspsim/se/sics/mspsim/util/OperatingModeStatistics.java 2008-11-02 18:22:08 UTC (rev 398) @@ -123,19 +123,20 @@ private class StatDataSource implements DataSource { - private StatEntry entry; - private int mode; + private final StatEntry entry; + private final int mode; + private final int operation; private long lastCycles; private long lastValue; - private final int operation; public StatDataSource(StatEntry entry, int mode, int operation) { this.entry = entry; this.mode = mode; this.operation = operation; - lastCycles = cpu.cycles; + this.lastCycles = cpu.cycles; + this.lastValue = entry.getValue(mode, this.lastCycles); } - + // returns percentage since last call... public double getDoubleValue() { long diff = cpu.cycles - lastCycles; @@ -149,7 +150,7 @@ } return (100.0 * valDiff) / diff; } - + public int getValue() { return (int) getDoubleValue(); } @@ -157,7 +158,7 @@ private class StatMultiDataSource implements MultiDataSource { - private StatEntry entry; + private final StatEntry entry; private long[] lastValue; private long[] lastCycles; @@ -165,7 +166,11 @@ this.entry = entry; this.lastValue = new long[entry.elapsed.length]; this.lastCycles = new long[entry.elapsed.length]; - Arrays.fill(this.lastCycles, cpu.cycles); + long cycles = cpu.cycles; + for (int i = 0, n = this.lastValue.length; i < n; i++) { + this.lastValue[i] = entry.getValue(i, cycles); + } + Arrays.fill(this.lastCycles, cycles); } public int getModeMax() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-11-02 17:16:46
|
Revision: 397 http://mspsim.svn.sourceforge.net/mspsim/?rev=397&view=rev Author: nifi Date: 2008-11-02 17:16:41 +0000 (Sun, 02 Nov 2008) Log Message: ----------- Changed StatEntry to start immediately instead of waiting for first mode change Modified Paths: -------------- mspsim/se/sics/mspsim/util/OperatingModeStatistics.java Modified: mspsim/se/sics/mspsim/util/OperatingModeStatistics.java =================================================================== --- mspsim/se/sics/mspsim/util/OperatingModeStatistics.java 2008-10-30 15:59:26 UTC (rev 396) +++ mspsim/se/sics/mspsim/util/OperatingModeStatistics.java 2008-11-02 17:16:41 UTC (rev 397) @@ -194,13 +194,14 @@ private class StatEntry implements OperatingModeListener { final Chip chip; long startTime; - int mode = -1; + int mode; long[] elapsed; - + StatEntry(Chip chip) { this.chip = chip; - int max = chip.getModeMax(); - elapsed = new long[max + 1]; + this.elapsed = new long[chip.getModeMax() + 1]; + this.mode = chip.getMode(); + this.startTime = cpu.cycles; chip.addOperatingModeListener(this); } @@ -210,15 +211,13 @@ } return elapsed[mode]; } - + public void modeChanged(Chip source, int mode) { - if (this.mode != -1) { - elapsed[this.mode] += cpu.cycles - startTime; - } + this.elapsed[this.mode] += cpu.cycles - startTime; this.mode = mode; this.startTime = cpu.cycles; } - + void printStat(PrintStream out) { out.println("Stat for: " + chip.getName()); for (int i = 0; i < elapsed.length; i++) { @@ -226,5 +225,5 @@ } } } - + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-10-30 15:59:30
|
Revision: 396 http://mspsim.svn.sourceforge.net/mspsim/?rev=396&view=rev Author: joxe Date: 2008-10-30 15:59:26 +0000 (Thu, 30 Oct 2008) Log Message: ----------- fixed some minor duty printout bugs Modified Paths: -------------- mspsim/scripts/autorun.sc mspsim/se/sics/mspsim/chip/CC2420.java mspsim/se/sics/mspsim/util/OperatingModeStatistics.java mspsim/se/sics/mspsim/util/StatCommands.java Modified: mspsim/scripts/autorun.sc =================================================================== --- mspsim/scripts/autorun.sc 2008-10-29 18:41:39 UTC (rev 395) +++ mspsim/scripts/autorun.sc 2008-10-30 15:59:26 UTC (rev 396) @@ -1,6 +1,6 @@ # autorun script for MSPSim # - all commands will run after loaded firmware into MSPSim -exec rm log.txt -log CC2420 >log.txt -printcalls >log.txt +#exec rm log.txt +#log CC2420 >log.txt +#printcalls >log.txt start Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-10-29 18:41:39 UTC (rev 395) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-10-30 15:59:26 UTC (rev 396) @@ -403,6 +403,7 @@ // RSSI valid here? status |= STATUS_RSSI_VALID; updateCCA(); + setMode(MODE_RX_ON); break; case TX_CALIBRATE: @@ -430,6 +431,7 @@ case RX_WAIT: setSymbolEvent(8); + setMode(MODE_RX_ON); break; case IDLE: @@ -784,6 +786,8 @@ } else { setState(RadioState.RX_CALIBRATE); } + /* Back to RX ON */ + setMode(MODE_RX_ON); txfifoFlush = true; } } Modified: mspsim/se/sics/mspsim/util/OperatingModeStatistics.java =================================================================== --- mspsim/se/sics/mspsim/util/OperatingModeStatistics.java 2008-10-29 18:41:39 UTC (rev 395) +++ mspsim/se/sics/mspsim/util/OperatingModeStatistics.java 2008-10-30 15:59:26 UTC (rev 396) @@ -145,9 +145,9 @@ lastValue = val; lastCycles = cpu.cycles; if (operation == OP_INVERT) { - return (int) (100 - 100 * valDiff / diff); + return (100.0 - (100.0 * valDiff) / diff); } - return (100.0 * valDiff / diff); + return (100.0 * valDiff) / diff; } public int getValue() { @@ -185,7 +185,7 @@ long valDiff = (val - lastValue[mode]); lastValue[mode] = val; lastCycles[mode] = cpu.cycles; - return (100.0 * valDiff / diff); + return (100.0 * valDiff) / diff; } } Modified: mspsim/se/sics/mspsim/util/StatCommands.java =================================================================== --- mspsim/se/sics/mspsim/util/StatCommands.java 2008-10-29 18:41:39 UTC (rev 395) +++ mspsim/se/sics/mspsim/util/StatCommands.java 2008-10-30 15:59:26 UTC (rev 396) @@ -165,10 +165,10 @@ MultiDataSource ds = (MultiDataSource) s; for (int k = 0, m = ds.getModeMax(); k <= m; k++) { if (k > 0) out.print(' '); - out.print(((int) (ds.getDoubleValue(k) * 100)) / 100.0); + out.print(((int) (ds.getDoubleValue(k) * 100.0 + 0.5)) / 100.0); } } else { - out.print(((int)((DataSource)s).getDoubleValue() * 100) / 100.0); + out.print( ((int) (((DataSource)s).getDoubleValue() * 100.0 + 0.5)) / 100.0); } } out.println(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fro...@us...> - 2008-10-29 18:41:42
|
Revision: 395 http://mspsim.svn.sourceforge.net/mspsim/?rev=395&view=rev Author: fros4943 Date: 2008-10-29 18:41:39 +0000 (Wed, 29 Oct 2008) Log Message: ----------- added cc2420 state listener Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-10-29 16:45:58 UTC (rev 394) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-10-29 18:41:39 UTC (rev 395) @@ -342,6 +342,20 @@ private boolean currentFIFO; private boolean overflow = false; + public interface StateListener { + public void newState(RadioState state); + } + + private StateListener stateListener = null; + + public void setStateListener(StateListener listener) { + stateListener = listener; + } + + public RadioState getState() { + return stateMachine; + } + // TODO: super(cpu) and chip autoregister chips into the CPU. public CC2420(MSP430Core cpu) { registers[REG_SNOP] = 0; @@ -424,6 +438,12 @@ updateCCA(); break; } + + /* Notify state listener */ + if (stateListener != null) { + stateListener.newState(stateMachine); + } + return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fro...@us...> - 2008-10-29 16:46:01
|
Revision: 394 http://mspsim.svn.sourceforge.net/mspsim/?rev=394&view=rev Author: fros4943 Date: 2008-10-29 16:45:58 +0000 (Wed, 29 Oct 2008) Log Message: ----------- removed debugging output Modified Paths: -------------- mspsim/se/sics/mspsim/platform/sky/SkyNode.java Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-10-29 16:45:26 UTC (rev 393) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-10-29 16:45:58 UTC (rev 394) @@ -124,7 +124,7 @@ fileName = fileName + ".flash"; } } - System.out.println("Using flash file: " + (fileName == null ? "no file" : fileName)); + if (DEBUG) System.out.println("Using flash file: " + (fileName == null ? "no file" : fileName)); this.flashFile = fileName; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fro...@us...> - 2008-10-29 16:45:28
|
Revision: 393 http://mspsim.svn.sourceforge.net/mspsim/?rev=393&view=rev Author: fros4943 Date: 2008-10-29 16:45:26 +0000 (Wed, 29 Oct 2008) Log Message: ----------- removed debugging output Modified Paths: -------------- mspsim/se/sics/mspsim/core/MSP430Core.java Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2008-10-29 16:05:49 UTC (rev 392) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2008-10-29 16:45:26 UTC (rev 393) @@ -226,7 +226,7 @@ memOut[0x1A0 + i] = adc12; memIn[0x1A0 + i] = adc12; } - System.out.println("Number of passive: " + passIO); + if (DEBUG) System.out.println("Number of passive: " + passIO); } /* returns port 1 ... 6 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-10-29 16:07:25
|
Revision: 392 http://mspsim.svn.sourceforge.net/mspsim/?rev=392&view=rev Author: nifi Date: 2008-10-29 16:05:49 +0000 (Wed, 29 Oct 2008) Log Message: ----------- bug fix in read/write of SR Modified Paths: -------------- mspsim/se/sics/mspsim/core/MSP430Core.java Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2008-10-29 14:56:26 UTC (rev 391) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2008-10-29 16:05:49 UTC (rev 392) @@ -774,7 +774,7 @@ writeRegister(SP, sp); } - if ((dstRegister == CG1 && ad != AM_INDEX) || dstRegister == CG2) { + if ((dstRegister == CG1 && ad > AM_INDEX) || dstRegister == CG2) { dstRegMode = true; cycles++; } else { @@ -978,7 +978,7 @@ int src = 0; // Some CGs should be handled as registry reads only... - if ((srcRegister == CG1 && as != AM_INDEX) || srcRegister == CG2) { + if ((srcRegister == CG1 && as > AM_INDEX) || srcRegister == CG2) { src = CREG_VALUES[srcRegister - 2][as]; if (!word) { src &= 0xff; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-10-29 14:56:29
|
Revision: 391 http://mspsim.svn.sourceforge.net/mspsim/?rev=391&view=rev Author: nifi Date: 2008-10-29 14:56:26 +0000 (Wed, 29 Oct 2008) Log Message: ----------- show watch address in hex Modified Paths: -------------- mspsim/se/sics/mspsim/cli/DebugCommands.java Modified: mspsim/se/sics/mspsim/cli/DebugCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/DebugCommands.java 2008-10-29 14:48:41 UTC (rev 390) +++ mspsim/se/sics/mspsim/cli/DebugCommands.java 2008-10-29 14:56:26 UTC (rev 391) @@ -126,10 +126,10 @@ } } }); - context.out.println("Watch set at: " + baddr); + context.out.println("Watch set at $" + Utils.hex16(baddr)); return 0; } - + public void stopCommand(CommandContext context) { cpu.clearBreakPoint(address); context.exit(0); @@ -192,8 +192,6 @@ } }); - - ch.registerCommand("symbol", new BasicCommand("list matching symbols", "<regexp>") { public int executeCommand(final CommandContext context) { String regExp = context.getArgument(0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-10-29 14:48:47
|
Revision: 390 http://mspsim.svn.sourceforge.net/mspsim/?rev=390&view=rev Author: nifi Date: 2008-10-29 14:48:41 +0000 (Wed, 29 Oct 2008) Log Message: ----------- added warning for unknown symbol Modified Paths: -------------- mspsim/se/sics/mspsim/cli/DebugCommands.java Modified: mspsim/se/sics/mspsim/cli/DebugCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/DebugCommands.java 2008-10-29 14:24:22 UTC (rev 389) +++ mspsim/se/sics/mspsim/cli/DebugCommands.java 2008-10-29 14:48:41 UTC (rev 390) @@ -67,13 +67,17 @@ int address = 0; public int executeCommand(final CommandContext context) { int baddr = context.getArgumentAsAddress(0); + if (baddr < 0) { + context.err.println("unknown symbol: " + context.getArgument(0)); + return 1; + } cpu.setBreakPoint(address = baddr, new CPUMonitor() { public void cpuAction(int type, int adr, int data) { - context.out.println("*** Break at " + adr); + context.out.println("*** Break at $" + Utils.hex16(adr)); } }); - context.out.println("Breakpoint set at: " + baddr); + context.out.println("Breakpoint set at $" + Utils.hex16(baddr)); return 0; } public void stopCommand(CommandContext context) { @@ -88,7 +92,7 @@ public int executeCommand(final CommandContext context) { int baddr = context.getArgumentAsAddress(0); if (baddr == -1) { - context.out.println("Error: unkown symbol:" + context.getArgument(0)); + context.err.println("unknown symbol: " + context.getArgument(0)); return -1; } if (context.getArgumentCount() > 1) { @@ -243,10 +247,11 @@ int adr = context.getArgumentAsAddress(0); if (adr != -1) { context.out.println("" + context.getArgument(0) + " = " + Utils.hex16(cpu.read(adr, adr >= 0x100))); + return 0; } else { - context.out.println("unkown symbol"); + context.err.println("unknown symbol: " + context.getArgument(0)); + return 1; } - return 0; } }); ch.registerCommand("printreg", new BasicCommand("print value of an register", "<register>") { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-10-29 14:26:06
|
Revision: 389 http://mspsim.svn.sourceforge.net/mspsim/?rev=389&view=rev Author: joxe Date: 2008-10-29 14:24:22 +0000 (Wed, 29 Oct 2008) Log Message: ----------- fixed Overflow handling Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-10-29 12:07:24 UTC (rev 388) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-10-29 14:24:22 UTC (rev 389) @@ -432,26 +432,16 @@ */ public void receivedByte(byte data) { // Received a byte from the "air" - /* CCA not clear if normal mode */ -// if(cca) { -// setCCA(false); -// } - // Above RX_WAIT => RX_SFD_SEARCH after 8 symbols should make this work without this??? -// if (stateMachine == RX_WAIT) { -// setState(RX_SFD_SEARCH); -// } log("RF Byte received: " + Utils.hex8(data) + " state: " + stateMachine + " noZeroes: " + zeroSymbols + ((stateMachine == RadioState.RX_SFD_SEARCH || stateMachine == RadioState.RX_FRAME) ? "" : " *** Ignored")); - - + if(stateMachine == RadioState.RX_SFD_SEARCH) { // Look for the preamble (4 zero bytes) followed by the SFD byte 0x7A if(data == 0) { // Count zero bytes - if (zeroSymbols < 4) zeroSymbols++; - return; - } else if(zeroSymbols == 4 && data == 0x7A) { + zeroSymbols++; + } else if(zeroSymbols >= 4 && data == 0x7A) { // If the received byte is !zero, we have counted 4 zero bytes prior to this one, // and the current received byte == 0x7A (SFD), we're in sync. // In RX mode, SFD goes high when the SFD is received @@ -460,7 +450,7 @@ rxread = 0; setState(RadioState.RX_FRAME); } else { - /* if not four zeros and 0x7A then no zeroes... */ + /* if not four zeros and 0x7A then no zeroes... */ zeroSymbols = 0; } @@ -468,14 +458,10 @@ if(rxfifoLen == 128) { setRxOverflow(); } else { - memory[RAM_RXFIFO + rxfifoWritePos++] = data & 0xFF; + memory[RAM_RXFIFO + rxfifoWritePos] = data & 0xFF; + rxfifoWritePos = (rxfifoWritePos + 1) & 127; rxfifoLen++; - if(rxfifoWritePos == 128) { - if (DEBUG) log("Wrapped RXFIFO write pos"); - rxfifoWritePos = 0; - } - if(rxread == 0) { rxlen = data & 0xff; if (DEBUG) log("RX: Start frame length " + rxlen); @@ -509,7 +495,7 @@ " CS: " + chipSelect + " SPI state: " + state + " StateMachine: " + stateMachine); } - if ( (stateMachine != RadioState.VREG_OFF) && chipSelect) { + if ((stateMachine != RadioState.VREG_OFF) && chipSelect) { switch(state) { case WAITING: @@ -591,31 +577,26 @@ return; //break; case READ_RXFIFO: - if(rxfifoLen == 0) { - /* nothing to read, just return a zero */ - source.byteReceived(0); - return; - } if(DEBUG) log("RXFIFO READ " + rxfifoReadPos + " => " + (memory[RAM_RXFIFO + rxfifoReadPos] & 0xFF) + " size: " + rxfifoLen); source.byteReceived( (memory[RAM_RXFIFO + rxfifoReadPos] & 0xFF) ); - rxfifoReadPos++; + rxfifoReadPos = (rxfifoReadPos + 1) & 127; + + if (rxfifoLen > 0) { + rxfifoLen--; + } // Set the FIFO pin low if there are no more bytes available in the RXFIFO. - if(--rxfifoLen == 0) { + if(rxfifoLen == 0) { if (DEBUG) log("Setting FIFO to low (buffer empty)"); setFIFO(false); } - - // What if wrap cursor??? - if (rxfifoReadPos >= 128) { - rxfifoReadPos = 0; - } + // TODO: // -MT FIFOP is lowered when there are less than IOCFG0:FIFOP_THR bytes in the RXFIFO // If FIFO_THR is greater than the frame length, FIFOP goes low when the first byte is read out. // As long as we are in "OVERFLOW" the fifoP is not cleared. - if (fifoP) { + if (fifoP && !overflow) { if (DEBUG) log("*** FIFOP cleared at: " + rxfifoReadPos + " lastPacketStartPos: " + lastPacketStart); setFIFOP(false); @@ -632,7 +613,7 @@ break; case RAM_ACCESS: if (pos == 0) { - address = address | (data << 1) & 0x180; + address |= (data << 1) & 0x180; ramRead = (data & 0x20) != 0; if (DEBUG) { log("Address: " + Utils.hex16(address) + @@ -647,7 +628,7 @@ Utils.hex8(memory[RAM_PANID]) + Utils.hex8(memory[RAM_PANID + 1])); } - }else{ + } else { //log("Read RAM Addr: " + address + " Data: " + memory[address]); source.byteReceived(memory[address++]); return; @@ -892,6 +873,7 @@ if (DEBUG) log("RXFIFO Overflow! Read Pos: " + rxfifoReadPos + " Write Pos: " + rxfifoWritePos); setFIFOP(true); setFIFO(false); + setSFD(false); overflow = true; setState(RadioState.RX_OVERFLOW); } @@ -1049,7 +1031,7 @@ } public String chipinfo() { - return " VREG_ON: " + on + + return " VREG_ON: " + on + " ChipSel: " + chipSelect + "\n OSC_Stable: " + ((status & STATUS_XOSC16M_STABLE) > 0) + "\n RSSI_Valid: " + ((status & STATUS_RSSI_VALID) > 0) + " CCA: " + cca + "\n FIFOP Polarity: " + ((registers[REG_IOCFG0] & FIFOP_POLARITY) == FIFOP_POLARITY) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-10-29 12:22:09
|
Revision: 387 http://mspsim.svn.sourceforge.net/mspsim/?rev=387&view=rev Author: nifi Date: 2008-10-29 11:34:26 +0000 (Wed, 29 Oct 2008) Log Message: ----------- removed CVS files Removed Paths: ------------- mspsim/se/sics/mspsim/platform/esb/CVS/ mspsim/se/sics/mspsim/platform/sky/CVS/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |