You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(21) |
Nov
(12) |
Dec
(41) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(25) |
Feb
(54) |
Mar
(63) |
Apr
(52) |
May
(17) |
Jun
(3) |
Jul
(3) |
Aug
(5) |
Sep
(49) |
Oct
(50) |
Nov
(34) |
Dec
(14) |
2009 |
Jan
(9) |
Feb
(15) |
Mar
(38) |
Apr
(12) |
May
(35) |
Jun
(20) |
Jul
(2) |
Aug
(7) |
Sep
(36) |
Oct
(24) |
Nov
(2) |
Dec
(2) |
2010 |
Jan
(14) |
Feb
(1) |
Mar
(36) |
Apr
(2) |
May
(4) |
Jun
(6) |
Jul
(35) |
Aug
(11) |
Sep
(8) |
Oct
(3) |
Nov
|
Dec
(1) |
2011 |
Jan
(11) |
Feb
(12) |
Mar
(3) |
Apr
(7) |
May
(12) |
Jun
(8) |
Jul
|
Aug
(3) |
Sep
(4) |
Oct
|
Nov
(2) |
Dec
(4) |
2012 |
Jan
(2) |
Feb
(1) |
Mar
(14) |
Apr
(5) |
May
(28) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(21) |
Nov
(4) |
Dec
(1) |
2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jo...@us...> - 2011-02-08 18:03:34
|
Revision: 787 http://mspsim.svn.sourceforge.net/mspsim/?rev=787&view=rev Author: joxe Date: 2011-02-08 18:03:28 +0000 (Tue, 08 Feb 2011) Log Message: ----------- minor fix to see LEDS as printout on Z1 + fix for watch command Modified Paths: -------------- mspsim/se/sics/mspsim/cli/DebugCommands.java mspsim/se/sics/mspsim/core/MSP430Core.java mspsim/se/sics/mspsim/platform/z1/Z1Node.java mspsim/se/sics/mspsim/util/Utils.java Modified: mspsim/se/sics/mspsim/cli/DebugCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/DebugCommands.java 2011-02-07 10:53:43 UTC (rev 786) +++ mspsim/se/sics/mspsim/cli/DebugCommands.java 2011-02-08 18:03:28 UTC (rev 787) @@ -110,17 +110,17 @@ if (Character.isDigit(modeStr.charAt(0))) { length = Integer.parseInt(modeStr); } else if ("char".equals(modeStr)) { - mode = 1; + mode = Utils.ASCII_UNMODIFIED; // 4 } else if ("break".equals(modeStr)) { - mode = 2; + mode = 10; } else if ("hex".equals(modeStr)) { - mode = 3; + mode = Utils.HEX; // 2 } } } CPUMonitor monitor = new CPUMonitor() { public void cpuAction(int type, int adr, int data) { - if (mode == 0 || mode == 2) { + if (mode == 0 || mode == 10) { int pc = cpu.readRegister(0); String adrStr = getSymOrAddr(context, adr); String pcStr = getSymOrAddrELF(getELF(), pc); @@ -132,17 +132,17 @@ } context.out.println("*** " + op + " from " + pcStr + ": " + adrStr + " = " + data); - if (mode == 2) { + if (mode == 10) { cpu.stop(); } } else { if (length > 1) { for (int i = address; i < address + length; i++) { - context.out.print(Utils.toString(cpu.memory[i], Utils.BYTE, mode == 1 ? Utils.ASCII : Utils.HEX)); + context.out.print(Utils.toString(cpu.memory[i], Utils.BYTE, mode)); } context.out.println(); } else { - context.out.print(Utils.toString(data, Utils.BYTE, mode == 1 ? Utils.ASCII : Utils.HEX)); + context.out.print(Utils.toString(data, Utils.BYTE, mode)); } } } Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2011-02-07 10:53:43 UTC (rev 786) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2011-02-08 18:03:28 UTC (rev 787) @@ -55,7 +55,7 @@ public static final int RETURN = 0x4130; public static final boolean DEBUG = false; - public static final boolean debugInterrupts = true;//false; + public static final boolean debugInterrupts = false; public static final boolean EXCEPTION_ON_BAD_OPERATION = true; Modified: mspsim/se/sics/mspsim/platform/z1/Z1Node.java =================================================================== --- mspsim/se/sics/mspsim/platform/z1/Z1Node.java 2011-02-07 10:53:43 UTC (rev 786) +++ mspsim/se/sics/mspsim/platform/z1/Z1Node.java 2011-02-08 18:03:28 UTC (rev 787) @@ -7,19 +7,29 @@ import se.sics.mspsim.core.IOUnit; import se.sics.mspsim.core.PortListener; import se.sics.mspsim.platform.GenericNode; -import se.sics.mspsim.platform.esb.ESBNode; import se.sics.mspsim.util.ArgumentManager; public class Z1Node extends GenericNode implements PortListener { IOPort port1; + IOPort port5; + + public static final int LEDS_CONF_RED = 0x10; + public static final int LEDS_CONF_GREEN = 0x40; + public static final int LEDS_CONF_YELLOW = 0x20; + public Z1Node() { super("Z1", new MSP430f2617Config()); } public void portWrite(IOPort source, int data) { System.out.println("Write to port: " + source + " => " + data); + if (source == port5) { + System.out.println("LEDS GREEN = " + ((data & LEDS_CONF_GREEN) > 0)); + System.out.println("LEDS RED = " + ((data & LEDS_CONF_RED) > 0)); + System.out.println("LEDS YELLOW = " + ((data & LEDS_CONF_YELLOW) > 0)); + } } private void setupNodePorts() { @@ -28,6 +38,11 @@ port1 = (IOPort) unit; port1.setPortListener(this); } + unit = cpu.getIOUnit("P5"); + if (unit instanceof IOPort) { + port5 = (IOPort) unit; + port5.setPortListener(this); + } } public void setupNode() { Modified: mspsim/se/sics/mspsim/util/Utils.java =================================================================== --- mspsim/se/sics/mspsim/util/Utils.java 2011-02-07 10:53:43 UTC (rev 786) +++ mspsim/se/sics/mspsim/util/Utils.java 2011-02-08 18:03:28 UTC (rev 787) @@ -51,6 +51,7 @@ public static final int ASCII = 1; public static final int HEX = 2; public static final int DEC = 3; + public static final int ASCII_UNMODIFIED = 4; public static int size(int type) { return 1 + (type / 2); @@ -65,6 +66,8 @@ } else { return "."; } + case ASCII_UNMODIFIED: + return "" + ((char) data); case HEX: return (size == 2 ? Utils.hex16(data):Utils.hex8(data)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2011-02-07 10:53:49
|
Revision: 786 http://mspsim.svn.sourceforge.net/mspsim/?rev=786&view=rev Author: joxe Date: 2011-02-07 10:53:43 +0000 (Mon, 07 Feb 2011) Log Message: ----------- added missing file Added Paths: ----------- mspsim/se/sics/mspsim/core/MSP430Config.java Added: mspsim/se/sics/mspsim/core/MSP430Config.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Config.java (rev 0) +++ mspsim/se/sics/mspsim/core/MSP430Config.java 2011-02-07 10:53:43 UTC (rev 786) @@ -0,0 +1,34 @@ +package se.sics.mspsim.core; + +public class MSP430Config { + + public class TimerConfig { + int ccr0Vector; + int ccrXVector; + int ccrCount; + int offset; + String name; + public int[] srcMap; + + public TimerConfig(int ccr0Vec, int ccrXVec, int ccrCount, int offset, + int[] srcMap, String name) { + ccr0Vector = ccr0Vec; + ccrXVector = ccrXVec; + this.ccrCount = ccrCount; + this.name = name; + this.offset = offset; + this.srcMap = srcMap; + } + } + + /* default for the 149/1611 */ + public TimerConfig[] timerConfig = { + new TimerConfig(6, 5, 3, 0x160, Timer.TIMER_Ax149, "TimerA"), + new TimerConfig(13, 12, 7, 0x180, Timer.TIMER_Bx149, "TimerB") + }; + public int maxInterruptVector = 15; + public boolean MSP430XArch = false; + + public void setup() { + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2011-02-07 10:52:36
|
Revision: 785 http://mspsim.svn.sourceforge.net/mspsim/?rev=785&view=rev Author: joxe Date: 2011-02-07 10:52:30 +0000 (Mon, 07 Feb 2011) Log Message: ----------- removed class Removed Paths: ------------- mspsim/se/sics/mspsim/config/MSP430f2617Config.class Deleted: mspsim/se/sics/mspsim/config/MSP430f2617Config.class =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2011-02-07 10:52:00
|
Revision: 784 http://mspsim.svn.sourceforge.net/mspsim/?rev=784&view=rev Author: joxe Date: 2011-02-07 10:51:53 +0000 (Mon, 07 Feb 2011) Log Message: ----------- added some configuration support for MSP430 core Modified Paths: -------------- mspsim/Makefile mspsim/scripts/autorun.sc mspsim/se/sics/mspsim/core/MSP430.java mspsim/se/sics/mspsim/core/MSP430Constants.java mspsim/se/sics/mspsim/core/MSP430Core.java mspsim/se/sics/mspsim/core/Timer.java mspsim/se/sics/mspsim/platform/GenericNode.java mspsim/se/sics/mspsim/platform/esb/ESBNode.java mspsim/se/sics/mspsim/platform/sky/CC2420Node.java mspsim/se/sics/mspsim/util/IHexReader.java mspsim/se/sics/mspsim/util/SimpleProfiler.java mspsim/se/sics/mspsim/util/Test.java Added Paths: ----------- mspsim/se/sics/mspsim/config/ mspsim/se/sics/mspsim/config/MSP430f1611Config.java mspsim/se/sics/mspsim/config/MSP430f2617Config.class mspsim/se/sics/mspsim/config/MSP430f2617Config.java mspsim/se/sics/mspsim/platform/z1/ mspsim/se/sics/mspsim/platform/z1/Z1Node.java Modified: mspsim/Makefile =================================================================== --- mspsim/Makefile 2011-02-04 17:55:45 UTC (rev 783) +++ mspsim/Makefile 2011-02-07 10:51:53 UTC (rev 784) @@ -60,9 +60,11 @@ ifndef FIRMWAREFILE ESBFIRMWARE = firmware/esb/sensor-demo.firmware SKYFIRMWARE = firmware/sky/blink.firmware +Z1FIRMWARE = firmware/z1/blink.firmware else ESBFIRMWARE = ${FIRMWAREFILE} SKYFIRMWARE = ${FIRMWAREFILE} +Z1FIRMWARE = ${FIRMWAREFILE} endif CPUTEST := tests/cputest.firmware @@ -71,7 +73,7 @@ SCRIPTS := ${addprefix scripts/,autorun.sc duty.sc} BINARY := README.txt license.txt CHANGE_LOG.txt images/*.jpg firmware/*/*.firmware ${SCRIPTS} -PACKAGES := se/sics/mspsim ${addprefix se/sics/mspsim/,core chip cli debug platform ${addprefix platform/,esb sky jcreate sentillausb} plugin profiler net ui util extutil/highlight extutil/jfreechart} +PACKAGES := se/sics/mspsim ${addprefix se/sics/mspsim/,core chip cli debug platform ${addprefix platform/,esb sky jcreate sentillausb, z1} plugin profiler net ui util extutil/highlight extutil/jfreechart} SOURCES := ${wildcard *.java $(addsuffix /*.java,$(PACKAGES))} @@ -116,6 +118,8 @@ runtelos: compile $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.sky.TelosNode $(ARGS) $(SKYFIRMWARE) $(MAPFILE) +runz1: compile + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.z1.Z1Node $(ARGS) $(Z1FIRMWARE) $(MAPFILE) test: cputest Modified: mspsim/scripts/autorun.sc =================================================================== --- mspsim/scripts/autorun.sc 2011-02-04 17:55:45 UTC (rev 783) +++ mspsim/scripts/autorun.sc 2011-02-07 10:51:53 UTC (rev 784) @@ -12,4 +12,5 @@ service nodegui start #service stackchart start #rflistener output CC2420 >> rfdata.txt -start +stop +#start Added: mspsim/se/sics/mspsim/config/MSP430f1611Config.java =================================================================== --- mspsim/se/sics/mspsim/config/MSP430f1611Config.java (rev 0) +++ mspsim/se/sics/mspsim/config/MSP430f1611Config.java 2011-02-07 10:51:53 UTC (rev 784) @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2011, 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. + * + * + * ----------------------------------------------------------------- + * + * Author : Joakim Eriksson + */ + +package se.sics.mspsim.config; + +import se.sics.mspsim.core.MSP430Config; +import se.sics.mspsim.core.Timer; + +public class MSP430f1611Config extends MSP430Config { + + + public MSP430f1611Config() { + maxInterruptVector = 15; + + /* configuration for the timers */ + TimerConfig timerA = new TimerConfig(6, 5, 3, 0x160, Timer.TIMER_Ax149, "TimerA"); + TimerConfig timerB = new TimerConfig(13, 12, 7, 0x180, Timer.TIMER_Bx149, "TimerB"); + timerConfig = new TimerConfig[] {timerA, timerB}; + } +} Property changes on: mspsim/se/sics/mspsim/config/MSP430f1611Config.java ___________________________________________________________________ Added: svn:executable + * Added: mspsim/se/sics/mspsim/config/MSP430f2617Config.class =================================================================== (Binary files differ) Property changes on: mspsim/se/sics/mspsim/config/MSP430f2617Config.class ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Added: mspsim/se/sics/mspsim/config/MSP430f2617Config.java =================================================================== --- mspsim/se/sics/mspsim/config/MSP430f2617Config.java (rev 0) +++ mspsim/se/sics/mspsim/config/MSP430f2617Config.java 2011-02-07 10:51:53 UTC (rev 784) @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2011, 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. + * + * + * ----------------------------------------------------------------- + * + * Author : Joakim Eriksson + */ + +package se.sics.mspsim.config; + +import se.sics.mspsim.core.MSP430Config; +import se.sics.mspsim.core.Timer; + +public class MSP430f2617Config extends MSP430Config { + + + public MSP430f2617Config() { + /* 32 vectors for the MSP430X series */ + maxInterruptVector = 31; + MSP430XArch = true; + + /* configuration for the timers */ + TimerConfig timerA = new TimerConfig(25, 24, 3, 0x160, Timer.TIMER_Ax149, "TimerA"); + TimerConfig timerB = new TimerConfig(29, 28, 7, 0x180, Timer.TIMER_Bx149, "TimerB"); + timerConfig = new TimerConfig[] {timerA, timerB}; + } +} \ No newline at end of file Property changes on: mspsim/se/sics/mspsim/config/MSP430f2617Config.java ___________________________________________________________________ Added: svn:executable + * Modified: mspsim/se/sics/mspsim/core/MSP430.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430.java 2011-02-04 17:55:45 UTC (rev 783) +++ mspsim/se/sics/mspsim/core/MSP430.java 2011-02-07 10:51:53 UTC (rev 784) @@ -77,8 +77,8 @@ * Creates a new <code>MSP430</code> instance. * */ - public MSP430(int type, ComponentRegistry registry) { - super(type, registry); + public MSP430(int type, ComponentRegistry registry, MSP430Config config) { + super(type, registry, config); disAsm = new DisAsm(); } Modified: mspsim/se/sics/mspsim/core/MSP430Constants.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Constants.java 2011-02-04 17:55:45 UTC (rev 783) +++ mspsim/se/sics/mspsim/core/MSP430Constants.java 2011-02-07 10:51:53 UTC (rev 784) @@ -109,6 +109,25 @@ public static final int XOR = 0xe; public static final int AND = 0xf; + + // MSP430X instructions + public static final int MOVA_IND0 = 0x0000; + public static final int MOVA_IND1 = 0x0010; + public static final int MOVA_ABS2REG = 0x0020; + public static final int MOVA_INDX2REG = 0x0030; + public static final int MOVA_REG2ABS = 0x0060; + public static final int MOVA_REG2INDX = 0x0070; + public static final int MOVA_IMM2REG = 0x0080; + public static final int CMPA_IMM = 0x0090; + public static final int ADDA_IMM = 0x00a0; + public static final int SUBA_IMM = 0x00b0; + public static final int MOVA_REG = 0x00c0; + public static final int CMPA_REG = 0x00d0; + public static final int ADDA_REG = 0x00e0; + public static final int SUBA_REG = 0x00f0; + + + public static final String[] TWO_OPS = { "-","-","-","-","MOV", "ADD", "ADDC", "SUBC", "SUB", "CMP", "DADD", "BIT", "BIC", "BIS", "XOR", "AND" Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2011-02-04 17:55:45 UTC (rev 783) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2011-02-07 10:51:53 UTC (rev 784) @@ -55,7 +55,7 @@ public static final int RETURN = 0x4130; public static final boolean DEBUG = false; - public static final boolean debugInterrupts = false; + public static final boolean debugInterrupts = true;//false; public static final boolean EXCEPTION_ON_BAD_OPERATION = true; @@ -82,6 +82,7 @@ public long cycles = 0; public long cpuCycles = 0; MapTable map; + public MSP430Config config; // Most HW needs only notify write and clocking, others need also read... // For notify write... @@ -93,9 +94,11 @@ private SFR sfr; private Watchdog watchdog; - // From the possible interrupt sources - to be able to indicate is serviced. - private InterruptHandler interruptSource[] = new InterruptHandler[16]; - + // From the possible interrupt sources - to be able to indicate is serviced. + // NOTE: 64 since more modern MSP430's have more than 16 vectors (5xxx has 64). + private InterruptHandler interruptSource[] = new InterruptHandler[64]; + private final int MAX_INTERRUPT; + protected int interruptMax = -1; // Op/instruction represents the last executed OP / instruction private int op; @@ -136,10 +139,11 @@ boolean isFlashBusy; - public MSP430Core(int type, ComponentRegistry registry) { + public MSP430Core(int type, ComponentRegistry registry, MSP430Config config) { super("MSP430", "MSP430 Core", null); + MAX_INTERRUPT = config.maxInterruptVector; this.registry = registry; - + this.config = config; // The CPU need to register itself as chip addChip(this); @@ -150,15 +154,16 @@ // Maybe for debugging purposes... ioUnits = new IOUnit[PORTS + 9]; - Timer ta = new Timer(this, "A", Timer.TIMER_Ax149, memory, 0x160); - Timer tb = new Timer(this, "B", Timer.TIMER_Bx149, memory, 0x180); + // first step towards making core configurable + Timer ta = new Timer(this, memory, config.timerConfig[0]); + Timer tb = new Timer(this, memory, config.timerConfig[1]); for (int i = 0, n = 0x20; i < n; i++) { - memOut[0x160 + i] = ta; - memOut[0x180 + i] = tb; - memIn[0x160 + i] = ta; - memIn[0x180 + i] = tb; + memOut[config.timerConfig[0].offset + i] = ta; + memIn[config.timerConfig[0].offset + i] = ta; + memOut[config.timerConfig[1].offset + i] = tb; + memIn[config.timerConfig[1].offset + i] = tb; } - + /* TODO: this range is only valid for the F1611 series (Sky, etc) */ flash = new Flash(this, memory, new FlashRange(0x4000, 0x10000, 512, 64), @@ -238,7 +243,6 @@ // Usarts ioUnits[passIO++] = usart0; ioUnits[passIO++] = usart1; - // Add the timers ioUnits[passIO++] = ta; @@ -653,7 +657,7 @@ } public void reset() { - flagInterrupt(15, null, true); + flagInterrupt(MAX_INTERRUPT, null, true); } // Indicate that we have an interrupt now! @@ -665,16 +669,16 @@ if (debugInterrupts) { if (source != null) { - System.out.println("### Interrupt flagged ON by " + source.getName() + " prio: " + interrupt); + System.out.println("### Interrupt " + interrupt + " flagged ON by " + source.getName() + " prio: " + interrupt); } else { - System.out.println("### Interrupt flagged ON by <null>"); + System.out.println("### Interrupt " + interrupt + " flagged ON by <null>"); } } // MAX priority is executed first - update max if this is higher! if (interrupt > interruptMax) { interruptMax = interrupt; - if (interruptMax == 15) { + if (interruptMax == MAX_INTERRUPT) { // This can not be masked at all! interruptsEnabled = true; } @@ -825,7 +829,7 @@ // Only store stuff on irq except reset... - not sure if this is correct... // TODO: Check what to do if reset is called! - if (interruptMax < 15) { + if (interruptMax < MAX_INTERRUPT) { // Push PC and SR to stack // store on stack - always move 2 steps (W) even if B. writeRegister(SP, sp = spBefore - 2); @@ -838,7 +842,7 @@ writeRegister(SR, 0); // sr & ~CPUOFF & ~SCG1 & ~OSCOFF); // Jump to the address specified in the interrupt vector - writeRegister(PC, pc = read(0xffe0 + interruptMax * 2, true)); + writeRegister(PC, pc = read(0xfffe - (MAX_INTERRUPT - interruptMax) * 2, true)); servicedInterrupt = interruptMax; servicedInterruptUnit = interruptSource[servicedInterrupt]; @@ -847,9 +851,9 @@ // executed things might change! reevaluateInterrupts(); - if (servicedInterrupt == 15) { -// System.out.println("**** Servicing RESET! => " + Utils.hex16(pc)); - internalReset(); + if (servicedInterrupt == MAX_INTERRUPT) { + if (debugInterrupts) System.out.println("**** Servicing RESET! => " + Utils.hex16(pc)); + internalReset(); } @@ -860,7 +864,8 @@ System.out.println("### Executing interrupt: " + servicedInterrupt + " at " + pcBefore + " to " + pc + - " SP before: " + spBefore); + " SP before: " + spBefore + + " Vector: " + Utils.hex16(0xfffe - (MAX_INTERRUPT - servicedInterrupt) * 2)); } // And call the serviced routine (which can cause another interrupt) @@ -952,6 +957,29 @@ writeRegister(PC, pc); switch (op) { + case 0: + // MSP430X - additional instructions + op = instruction & 0xf0f0; + System.out.println("Executing MSP430X instruction op:" + Utils.hex16(op) + + " ins:" + Utils.hex16(instruction) + " PC = " + Utils.hex16(pc - 2)); + int src = 0; + /* data is either bit 19-16 or src register */ + int srcData = (instruction & 0x0f00) >> 8; + int dstData = (instruction & 0x000f); + switch(op) { + // 20 bit register write + case MOVA_IMM2REG: + src = read(pc, true); + writeRegister(PC, pc += 2); + dst = src + (srcData << 16); + System.out.println("*** Writing $" + Utils.hex16(dst) + " to reg: " + dstData); + writeRegister(dstData, dst); + break; + default: + System.out.println("MSP430X instructions not yet supported..."); + } + + break; case 1: // ------------------------------------------------------------------- // Single operand instructions @@ -1197,7 +1225,7 @@ dstRegMode = ((instruction >> 7) & 1) == 0; dstAddress = -1; int srcAddress = -1; - int src = 0; + src = 0; // Some CGs should be handled as registry reads only... if ((srcRegister == CG1 && as > AM_INDEX) || srcRegister == CG2) { @@ -1415,7 +1443,7 @@ writeRegister(SR, sr); break; default: - System.out.println("DoubleOperand not implemented: " + op + " at " + pc); + System.out.println("DoubleOperand not implemented: op = " + op + " at " + pc); if (EXCEPTION_ON_BAD_OPERATION) { EmulationException ex = new EmulationException("Bad operation: " + op + " at " + pc); ex.initCause(new Throwable("" + pc)); @@ -1479,4 +1507,13 @@ public int getConfiguration(int parameter) { return 0; } + + public String info() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 16; i++) { + buf.append("Vector: at $" + Utils.hex16(0xfffe - i * 2) + " -> $" + + Utils.hex16(read(0xfffe - i * 2, true)) + "\n"); + } + return buf.toString(); + } } Modified: mspsim/se/sics/mspsim/core/Timer.java =================================================================== --- mspsim/se/sics/mspsim/core/Timer.java 2011-02-04 17:55:45 UTC (rev 783) +++ mspsim/se/sics/mspsim/core/Timer.java 2011-02-07 10:51:53 UTC (rev 784) @@ -76,14 +76,14 @@ public static final int TBIV = 0x011e; public static final int TAIV = 0x012e; - public static final int TACCR0_VECTOR = 6; - // Other is on 5 - public static final int TACCR1_VECTOR = 5; +// public static final int TACCR0_VECTOR = 6; +// // Other is on 5 +// public static final int TACCR1_VECTOR = 5; +// +// public static final int TBCCR0_VECTOR = 13; +// // Other is on 12 +// public static final int TBCCR1_VECTOR = 12; - public static final int TBCCR0_VECTOR = 13; - // Other is on 12 - public static final int TBCCR1_VECTOR = 12; - public static final int TCTL = 0; public static final int TCCTL0 = 2; public static final int TCCTL1 = 4; @@ -409,9 +409,9 @@ * */ - public Timer(MSP430Core core, String type, int[] srcMap, int[] memory, int offset) { - super("Timer" + type, "Timer " + type, memory, offset); - this.srcMap = srcMap; + public Timer(MSP430Core core, int[] memory, MSP430Config.TimerConfig config) { + super(config.name, config.name, memory, config.offset); + this.srcMap = config.srcMap; this.core = core; noCompare = (srcMap.length / 4) - 1; if (DEBUG) { @@ -420,18 +420,17 @@ if (srcMap == TIMER_Ax149) { tiv = TAIV; timerOverflow = 0x0a; - ccr0Vector = TACCR0_VECTOR; - ccr1Vector = TACCR1_VECTOR; } else { tiv = TBIV; timerOverflow = 0x0e; - ccr0Vector = TBCCR0_VECTOR; - ccr1Vector = TBCCR1_VECTOR; } - counterTrigger.name += ' ' + type; + ccr0Vector = config.ccr0Vector; + ccr1Vector = config.ccrXVector; + counterTrigger.name += ' ' + config.name; + for (int i = 0; i < noCompare; i++) { - ccr[i] = new CCR(0, "CCR" + i + " " + type, i == 0 ? ccr0Vector : ccr1Vector, i); + ccr[i] = new CCR(0, "CCR" + i + " " + config.name, i == 0 ? ccr0Vector : ccr1Vector, i); } reset(0); Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2011-02-04 17:55:45 UTC (rev 783) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2011-02-07 10:51:53 UTC (rev 784) @@ -55,6 +55,7 @@ import se.sics.mspsim.core.EmulationException; import se.sics.mspsim.core.EmulationLogger; import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.core.MSP430Config; import se.sics.mspsim.core.MSP430Constants; import se.sics.mspsim.extutil.highlight.HighlightSourceViewer; import se.sics.mspsim.ui.ControlUI; @@ -84,8 +85,8 @@ protected OperatingModeStatistics stats; - public GenericNode(String id) { - super(id, new MSP430(0, new ComponentRegistry())); + public GenericNode(String id, MSP430Config config) { + super(id, new MSP430(0, new ComponentRegistry(), config)); this.cpu = (MSP430)super.cpu; this.registry = cpu.getRegistry(); } Modified: mspsim/se/sics/mspsim/platform/esb/ESBNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/esb/ESBNode.java 2011-02-04 17:55:45 UTC (rev 783) +++ mspsim/se/sics/mspsim/platform/esb/ESBNode.java 2011-02-07 10:51:53 UTC (rev 784) @@ -48,6 +48,7 @@ import se.sics.mspsim.core.IOPort; import se.sics.mspsim.core.IOUnit; import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.core.MSP430Config; import se.sics.mspsim.core.PortListener; import se.sics.mspsim.core.USART; import se.sics.mspsim.extutil.jfreechart.DataChart; @@ -90,7 +91,8 @@ * */ public ESBNode() { - super("ESB"); + /* this should be a config for the MSP430f149 */ + super("ESB", new MSP430Config()); } public Leds getLeds() { Modified: mspsim/se/sics/mspsim/platform/sky/CC2420Node.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/CC2420Node.java 2011-02-04 17:55:45 UTC (rev 783) +++ mspsim/se/sics/mspsim/platform/sky/CC2420Node.java 2011-02-07 10:51:53 UTC (rev 784) @@ -5,6 +5,7 @@ import se.sics.mspsim.core.IOPort; import se.sics.mspsim.core.IOUnit; import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.core.MSP430Config; import se.sics.mspsim.core.PortListener; import se.sics.mspsim.core.USART; import se.sics.mspsim.core.USARTListener; @@ -47,7 +48,8 @@ protected String flashFile; public CC2420Node(String id) { - super(id); + /* this should be a config for the MSP430x1611 */ + super(id, new MSP430Config()); } public void setDebug(boolean debug) { Added: mspsim/se/sics/mspsim/platform/z1/Z1Node.java =================================================================== --- mspsim/se/sics/mspsim/platform/z1/Z1Node.java (rev 0) +++ mspsim/se/sics/mspsim/platform/z1/Z1Node.java 2011-02-07 10:51:53 UTC (rev 784) @@ -0,0 +1,47 @@ +package se.sics.mspsim.platform.z1; + +import java.io.IOException; + +import se.sics.mspsim.config.MSP430f2617Config; +import se.sics.mspsim.core.IOPort; +import se.sics.mspsim.core.IOUnit; +import se.sics.mspsim.core.PortListener; +import se.sics.mspsim.platform.GenericNode; +import se.sics.mspsim.platform.esb.ESBNode; +import se.sics.mspsim.util.ArgumentManager; + +public class Z1Node extends GenericNode implements PortListener { + + IOPort port1; + + public Z1Node() { + super("Z1", new MSP430f2617Config()); + } + + public void portWrite(IOPort source, int data) { + System.out.println("Write to port: " + source + " => " + data); + } + + private void setupNodePorts() { + IOUnit unit = cpu.getIOUnit("P1"); + if (unit instanceof IOPort) { + port1 = (IOPort) unit; + port1.setPortListener(this); + } + } + + public void setupNode() { + setupNodePorts(); + } + + public int getModeMax() { + return 0; + } + + public static void main(String[] args) throws IOException { + Z1Node node = new Z1Node(); + ArgumentManager config = new ArgumentManager(); + config.handleArguments(args); + node.setupArgs(config); + } +} Modified: mspsim/se/sics/mspsim/util/IHexReader.java =================================================================== --- mspsim/se/sics/mspsim/util/IHexReader.java 2011-02-04 17:55:45 UTC (rev 783) +++ mspsim/se/sics/mspsim/util/IHexReader.java 2011-02-07 10:51:53 UTC (rev 784) @@ -42,6 +42,7 @@ package se.sics.mspsim.util; import java.io.*; import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.core.MSP430Config; public class IHexReader { @@ -138,7 +139,7 @@ // System.out.println("T ^ T => " + (true ^ true) + // " T ^ F => " + (false ^ true)); - MSP430 cpu = new MSP430(0, new ComponentRegistry()); + MSP430 cpu = new MSP430(0, new ComponentRegistry(), new MSP430Config()); int[] memory = cpu.getMemory(); reader.readFile(memory, args[0]); cpu.reset(); Modified: mspsim/se/sics/mspsim/util/SimpleProfiler.java =================================================================== --- mspsim/se/sics/mspsim/util/SimpleProfiler.java 2011-02-04 17:55:45 UTC (rev 783) +++ mspsim/se/sics/mspsim/util/SimpleProfiler.java 2011-02-07 10:51:53 UTC (rev 784) @@ -74,9 +74,9 @@ private CallListener[] callListeners; /* statistics for interrupts */ - private long[] lastInterruptTime = new long[16]; - private long[] interruptTime = new long[16]; - private long[] interruptCount = new long[16]; + private long[] lastInterruptTime = new long[64]; + private long[] interruptTime = new long[64]; + private long[] interruptCount = new long[64]; private int servicedInterrupt; private int interruptLevel; private int interruptFrom; @@ -310,7 +310,7 @@ } out.println("********** Profile IRQ **************************"); out.println("Vector Average Calls Tot.Cycles"); - for (int i = 0; i < 16; i++) { + for (int i = 0; i < cpu.config.maxInterruptVector + 1; i++) { out.print((i < 10 ? "0" : "") + i + " "); out.printf("%4d ",(interruptCount[i] > 0 ? (interruptTime[i] / interruptCount[i]):0)); out.printf("%8d %8d",interruptCount[i],interruptTime[i]); Modified: mspsim/se/sics/mspsim/util/Test.java =================================================================== --- mspsim/se/sics/mspsim/util/Test.java 2011-02-04 17:55:45 UTC (rev 783) +++ mspsim/se/sics/mspsim/util/Test.java 2011-02-07 10:51:53 UTC (rev 784) @@ -83,7 +83,7 @@ } public static void main(String[] args) { - MSP430 cpu = new MSP430(0, new ComponentRegistry()); + MSP430 cpu = new MSP430(0, new ComponentRegistry(), new MSP430Config()); int index = 0; if (args[index].startsWith("-")) { // Flag This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2011-02-04 17:55:51
|
Revision: 783 http://mspsim.svn.sourceforge.net/mspsim/?rev=783&view=rev Author: joxe Date: 2011-02-04 17:55:45 +0000 (Fri, 04 Feb 2011) Log Message: ----------- added an interrupt multiplexer for DMA and later DAC Modified Paths: -------------- mspsim/se/sics/mspsim/core/DMA.java mspsim/se/sics/mspsim/core/MSP430Core.java Added Paths: ----------- mspsim/se/sics/mspsim/core/InterruptMultiplexer.java Modified: mspsim/se/sics/mspsim/core/DMA.java =================================================================== --- mspsim/se/sics/mspsim/core/DMA.java 2011-02-04 16:08:18 UTC (rev 782) +++ mspsim/se/sics/mspsim/core/DMA.java 2011-02-04 17:55:45 UTC (rev 783) @@ -29,9 +29,13 @@ public static final int UTXIFG1 = 10; /* UART 1 */ public static final int MULTIPLIER = 11; + public static final int IFG_MASK = 0x08; + private static final int[] INCR = {0,0,-1,1}; - class Channel { + private InterruptMultiplexer interruptMultiplexer; + + class Channel implements InterruptHandler { int channelNo; /* public registers */ @@ -52,8 +56,12 @@ DMATrigger trigger; int triggerIndex; - + int transferMode = 0; + boolean enable = false; + boolean dmaLevel = false; /* edge or level sensitive trigger */ + boolean dmaIE = false; + boolean dmaIFG = false; public Channel(int i) { channelNo = i; @@ -69,15 +77,22 @@ switch(address) { case 0: ctl = data; + transferMode = (data >> 12) & 7; dstIncr = INCR[(data >> 10) & 3]; srcIncr = INCR[(data >> 8) & 3]; dstByteMode = (data & 0x80) > 0; /* bit 7 */ srcByteMode = (data & 0x40) > 0; /* bit 6 */ + dmaLevel = (data & 0x20) > 0; /* bit 5 */ boolean enabling = !enable && (data & 0x10) > 0; enable = (data & 0x10) > 0; /* bit 4 */ + dmaIFG = (data & IFG_MASK) > 0; /* bit 3 */ + dmaIE = (data & 0x04) > 0; /* bit 2 */ System.out.println("DMA Ch." + channelNo + ": config srcIncr: " + srcIncr + " dstIncr:" + dstIncr - + " en: " + enable + " srcB:" + srcByteMode + " dstB:" + dstByteMode); + + " en: " + enable + " srcB:" + srcByteMode + " dstB:" + dstByteMode + " level: " + dmaLevel + + " transferMode: " + transferMode + " ie:" + dmaIE); + /* this might be wrong ? */ if (enabling) trigger(trigger, triggerIndex); + interruptMultiplexer.updateInterrupt(dmaIFG & dmaIE, channelNo); break; case 2: sourceAddress = data; @@ -97,13 +112,15 @@ public int read(int address) { switch(address) { case 0: - return ctl; + /* set the IFG */ + ctl = (ctl & ~IFG_MASK) | (dmaIFG ? IFG_MASK : 0); + return ctl; case 2: - return sourceAddress; + return sourceAddress; case 4: - return destinationAddress; + return destinationAddress; case 6: - return size; + return size; } System.out.println("Illegal read of DMA Channel register"); return 0; @@ -127,10 +144,22 @@ currentSourceAddress = sourceAddress; currentDestinationAddress = destinationAddress; size = storedSize; - /* flag interrupt!!!! */ + if ((transferMode & 0x04) == 0) { + enable = false; + } + /* flag interrupt and update interrupt vector */ + dmaIFG = true; + interruptMultiplexer.updateInterrupt(dmaIFG & dmaIE, channelNo); } } } + + public void interruptServiced(int vector) { + } + + public String getName() { + return "DMA Channel " + channelNo; + } } private Channel channels[] = new Channel[3]; @@ -151,6 +180,10 @@ this.cpu = msp430Core; } + public void setInterruptMultiplexer(InterruptMultiplexer interruptMultiplexer) { + this.interruptMultiplexer = interruptMultiplexer; + } + public void setDMATrigger(int totindex, DMATrigger trigger, int tIndex) { dmaTrigger[totindex] = trigger; dmaTriggerIndex[totindex] = tIndex; Added: mspsim/se/sics/mspsim/core/InterruptMultiplexer.java =================================================================== --- mspsim/se/sics/mspsim/core/InterruptMultiplexer.java (rev 0) +++ mspsim/se/sics/mspsim/core/InterruptMultiplexer.java 2011-02-04 17:55:45 UTC (rev 783) @@ -0,0 +1,30 @@ +package se.sics.mspsim.core; + +public class InterruptMultiplexer implements InterruptHandler { + + int interruptBits; + + MSP430Core cpu; + int vector; + + public InterruptMultiplexer(MSP430Core cpu, int vector) { + this.cpu = cpu; + this.vector = vector; + } + + public void updateInterrupt(boolean value, int bit) { + if (value) interruptBits |= 1 << bit; + else interruptBits &= ~(1 << bit); + cpu.flagInterrupt(vector, this, interruptBits > 0); + } + + + public void interruptServiced(int vector) { + /* do nothing??? */ + } + + public String getName() { + return "InterruptMultiplexer vector " + vector + " bits: " + interruptBits; + } + +} Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2011-02-04 16:08:18 UTC (rev 782) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2011-02-04 17:55:45 UTC (rev 783) @@ -94,7 +94,7 @@ private Watchdog watchdog; // From the possible interrupt sources - to be able to indicate is serviced. - private InterruptHandler interruptSource[] = new IOUnit[16]; + private InterruptHandler interruptSource[] = new InterruptHandler[16]; protected int interruptMax = -1; // Op/instruction represents the last executed OP / instruction @@ -277,6 +277,8 @@ dma.setDMATrigger(DMA.UTXIFG0, usart0, 1); dma.setDMATrigger(DMA.URXIFG1, usart1, 0); dma.setDMATrigger(DMA.UTXIFG1, usart1, 1); + + dma.setInterruptMultiplexer(new InterruptMultiplexer(this, 0)); ioUnits[passIO++] = dma; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2011-02-04 16:08:26
|
Revision: 782 http://mspsim.svn.sourceforge.net/mspsim/?rev=782&view=rev Author: joxe Date: 2011-02-04 16:08:18 +0000 (Fri, 04 Feb 2011) Log Message: ----------- minor fix of DMA subsystem Modified Paths: -------------- mspsim/se/sics/mspsim/core/DMA.java mspsim/se/sics/mspsim/core/DMATrigger.java mspsim/se/sics/mspsim/core/MSP430Core.java mspsim/se/sics/mspsim/core/USART.java Modified: mspsim/se/sics/mspsim/core/DMA.java =================================================================== --- mspsim/se/sics/mspsim/core/DMA.java 2011-02-04 07:11:02 UTC (rev 781) +++ mspsim/se/sics/mspsim/core/DMA.java 2011-02-04 16:08:18 UTC (rev 782) @@ -32,7 +32,9 @@ private static final int[] INCR = {0,0,-1,1}; class Channel { + int channelNo; /* public registers */ + int ctl; int sourceAddress; int destinationAddress; @@ -47,13 +49,20 @@ int dstIncr = 0; boolean dstByteMode = false; boolean srcByteMode = false; - int trigger; + DMATrigger trigger; + int triggerIndex; + boolean enable = false; - public void setTrigger(int t) { + public Channel(int i) { + channelNo = i; + } + + public void setTrigger(DMATrigger t, int index) { System.out.println("Setting trigger to " + t); trigger = t; + triggerIndex = index; } public void write(int address, int data) { @@ -64,8 +73,11 @@ srcIncr = INCR[(data >> 8) & 3]; dstByteMode = (data & 0x80) > 0; /* bit 7 */ srcByteMode = (data & 0x40) > 0; /* bit 6 */ + boolean enabling = !enable && (data & 0x10) > 0; enable = (data & 0x10) > 0; /* bit 4 */ - System.out.println("DMA: config srcIncr: " + srcIncr + " dstIncr:" + dstIncr); + System.out.println("DMA Ch." + channelNo + ": config srcIncr: " + srcIncr + " dstIncr:" + dstIncr + + " en: " + enable + " srcB:" + srcByteMode + " dstB:" + dstByteMode); + if (enabling) trigger(trigger, triggerIndex); break; case 2: sourceAddress = data; @@ -117,7 +129,6 @@ size = storedSize; /* flag interrupt!!!! */ } - } } } @@ -128,23 +139,33 @@ MSP430Core cpu; + /* MAX 16 triggers ? */ + private DMATrigger[] dmaTrigger = new DMATrigger[16]; + private int[] dmaTriggerIndex = new int[16]; + public DMA(String id, int[] memory, int offset, MSP430Core msp430Core) { super(id, memory, offset); - channels[0] = new Channel(); - channels[1] = new Channel(); - channels[2] = new Channel(); + channels[0] = new Channel(0); + channels[1] = new Channel(1); + channels[2] = new Channel(2); this.cpu = msp430Core; } - public void trigger(DMATrigger trigger, int startIndex, int index) { + public void setDMATrigger(int totindex, DMATrigger trigger, int tIndex) { + dmaTrigger[totindex] = trigger; + dmaTriggerIndex[totindex] = tIndex; + trigger.setDMA(this); + } + + public void trigger(DMATrigger trigger, int index) { /* could make this a bit and have a bit-pattern if more dma channels but * with 3 channels it does not make sense. Optimize later - maybe with * flag in DMA triggers so that they now if a channel listens at all. */ - int totIndex = startIndex + index; for (int i = 0; i < channels.length; i++) { - System.out.println("DMA Channel:" + channels[i].trigger + " index " + totIndex); - if (channels[i].trigger == totIndex) channels[i].trigger(trigger, index); +// System.out.println("DMA Channel:" + i + " " + channels[i].trigger + " = " + trigger); + if (channels[i].trigger == trigger && + channels[i].triggerIndex == index) channels[i].trigger(trigger, index); } } @@ -157,9 +178,9 @@ case DMACTL0: /* DMA Control 0 */ dmactl0 = value; - channels[0].setTrigger(value & 0xf); - channels[1].setTrigger((value >> 4) & 0xf); - channels[2].setTrigger((value >> 8) & 0xf); + channels[0].setTrigger(dmaTrigger[value & 0xf], dmaTriggerIndex[value & 0xf]); + channels[1].setTrigger(dmaTrigger[(value >> 4) & 0xf], dmaTriggerIndex[(value >> 4) & 0xf]); + channels[2].setTrigger(dmaTrigger[(value >> 8) & 0xf], dmaTriggerIndex[(value >> 8) & 0xf]); break; case DMACTL1: /* DMA Control 1 */ Modified: mspsim/se/sics/mspsim/core/DMATrigger.java =================================================================== --- mspsim/se/sics/mspsim/core/DMATrigger.java 2011-02-04 07:11:02 UTC (rev 781) +++ mspsim/se/sics/mspsim/core/DMATrigger.java 2011-02-04 16:08:18 UTC (rev 782) @@ -1,6 +1,7 @@ package se.sics.mspsim.core; public interface DMATrigger { - public void setDMA(DMA dma, int startIndex); + public void setDMA(DMA dma); + public boolean getDMATriggerState(int index); public void clearDMATrigger(int index); } Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2011-02-04 07:11:02 UTC (rev 781) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2011-02-04 16:08:18 UTC (rev 782) @@ -273,8 +273,10 @@ memIn[0x124] = dma; /* configure the DMA */ - usart0.setDMA(dma, DMA.URXIFG0); - usart1.setDMA(dma, DMA.URXIFG1); + dma.setDMATrigger(DMA.URXIFG0, usart0, 0); + dma.setDMATrigger(DMA.UTXIFG0, usart0, 1); + dma.setDMATrigger(DMA.URXIFG1, usart1, 0); + dma.setDMATrigger(DMA.UTXIFG1, usart1, 1); ioUnits[passIO++] = dma; Modified: mspsim/se/sics/mspsim/core/USART.java =================================================================== --- mspsim/se/sics/mspsim/core/USART.java 2011-02-04 07:11:02 UTC (rev 781) +++ mspsim/se/sics/mspsim/core/USART.java 2011-02-04 16:08:18 UTC (rev 782) @@ -154,9 +154,8 @@ reset(0); } - public void setDMA(DMA dma, int index) { + public void setDMA(DMA dma) { this.dma = dma; - dmaIndex = index; } @@ -189,8 +188,8 @@ sfr.setBitIFG(uartID, bits); /* set bit first, then trigger DMA transfer - this should * be made via a 1 cycle or so delayed action */ - if ((bits & urxifg) > 0) dma.trigger(this, dmaIndex, 0); - if ((bits & utxifg) > 0) dma.trigger(this, dmaIndex, 1); + if ((bits & urxifg) > 0) dma.trigger(this, 0); + if ((bits & utxifg) > 0) dma.trigger(this, 1); } } @@ -434,6 +433,14 @@ "UTXIFG: " + ((getIFG() & utxifg) > 0) + " URXIFG:" + ((getIFG() & urxifg) > 0); } + public boolean getDMATriggerState(int index) { + if (index == 0) { + return (getIFG() & urxifg) > 0; + } else { + return (getIFG() & utxifg) > 0; + } + } + public void clearDMATrigger(int index) { System.out.println("UART clearing DMA " + index); if (index == 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2011-02-04 07:11:08
|
Revision: 781 http://mspsim.svn.sourceforge.net/mspsim/?rev=781&view=rev Author: joxe Date: 2011-02-04 07:11:02 +0000 (Fri, 04 Feb 2011) Log Message: ----------- removed one of statechange listeners on uart in serialmon Modified Paths: -------------- mspsim/se/sics/mspsim/ui/SerialMon.java Modified: mspsim/se/sics/mspsim/ui/SerialMon.java =================================================================== --- mspsim/se/sics/mspsim/ui/SerialMon.java 2011-02-04 07:07:07 UTC (rev 780) +++ mspsim/se/sics/mspsim/ui/SerialMon.java 2011-02-04 07:11:02 UTC (rev 781) @@ -98,7 +98,6 @@ usart.addStateChangeListener(this); textArea.addKeyListener(this); - usart.addStateChangeListener(this); } public void saveWindowBounds() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2011-02-04 07:07:13
|
Revision: 780 http://mspsim.svn.sourceforge.net/mspsim/?rev=780&view=rev Author: joxe Date: 2011-02-04 07:07:07 +0000 (Fri, 04 Feb 2011) Log Message: ----------- bugfix for DMA Modified Paths: -------------- mspsim/se/sics/mspsim/core/DMA.java Modified: mspsim/se/sics/mspsim/core/DMA.java =================================================================== --- mspsim/se/sics/mspsim/core/DMA.java 2011-02-04 07:06:13 UTC (rev 779) +++ mspsim/se/sics/mspsim/core/DMA.java 2011-02-04 07:07:07 UTC (rev 780) @@ -106,7 +106,7 @@ currentSourceAddress + " => " + data + " " + (char) data + " size:" + size + " index:" + index); trigger.clearDMATrigger(index); - DMA.this.cpu.write(destinationAddress, data, false); + DMA.this.cpu.write(currentDestinationAddress, data, false); currentSourceAddress += srcIncr; currentDestinationAddress += dstIncr; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2011-02-04 07:06:20
|
Revision: 779 http://mspsim.svn.sourceforge.net/mspsim/?rev=779&view=rev Author: joxe Date: 2011-02-04 07:06:13 +0000 (Fri, 04 Feb 2011) Log Message: ----------- initial hack on DMA for mspsim - not working good yet Modified Paths: -------------- mspsim/se/sics/mspsim/core/MSP430Core.java mspsim/se/sics/mspsim/core/USART.java mspsim/se/sics/mspsim/ui/SerialMon.java Added Paths: ----------- mspsim/se/sics/mspsim/core/DMA.java mspsim/se/sics/mspsim/core/DMATrigger.java Added: mspsim/se/sics/mspsim/core/DMA.java =================================================================== --- mspsim/se/sics/mspsim/core/DMA.java (rev 0) +++ mspsim/se/sics/mspsim/core/DMA.java 2011-02-04 07:06:13 UTC (rev 779) @@ -0,0 +1,189 @@ +package se.sics.mspsim.core; + +import se.sics.mspsim.util.Utils; + +public class DMA extends IOUnit { + + /* global DMA configuration */ + public static final int DMACTL0 = 0x122; + public static final int DMACTL1 = 0x124; + + /* per channel configuration */ + public static final int DMAxCTL = 0x1e0; + public static final int DMAxSA = 0x1e2; + public static final int DMAxDA = 0x1e4; + public static final int DMAxSZ = 0x1e6; + + /* DMA TSELx - from msp430x1xxx devices */ + /* new devices has more channels and more triggers */ + public static final int DMAREQ = 0; + public static final int TACCR2 = 1; + public static final int TBCCR2 = 2; + public static final int URXIFG0 = 3; /* UART 0 */ + public static final int UTXIFG0 = 4; /* UART 0 */ + public static final int DAC12_0 = 5; + public static final int ADC12_0 = 6; + public static final int TACCR0 = 7; + public static final int TBCCR0 = 8; + public static final int URXIFG1 = 9; /* UART 1 */ + public static final int UTXIFG1 = 10; /* UART 1 */ + public static final int MULTIPLIER = 11; + + private static final int[] INCR = {0,0,-1,1}; + + class Channel { + /* public registers */ + int ctl; + int sourceAddress; + int destinationAddress; + int size; + + /* internal registers */ + int currentSourceAddress; + int currentDestinationAddress; + int storedSize; + + int srcIncr = 0; + int dstIncr = 0; + boolean dstByteMode = false; + boolean srcByteMode = false; + int trigger; + + boolean enable = false; + + public void setTrigger(int t) { + System.out.println("Setting trigger to " + t); + trigger = t; + } + + public void write(int address, int data) { + switch(address) { + case 0: + ctl = data; + dstIncr = INCR[(data >> 10) & 3]; + srcIncr = INCR[(data >> 8) & 3]; + dstByteMode = (data & 0x80) > 0; /* bit 7 */ + srcByteMode = (data & 0x40) > 0; /* bit 6 */ + enable = (data & 0x10) > 0; /* bit 4 */ + System.out.println("DMA: config srcIncr: " + srcIncr + " dstIncr:" + dstIncr); + break; + case 2: + sourceAddress = data; + currentSourceAddress = data; + break; + case 4: + destinationAddress = data; + currentDestinationAddress = data; + break; + case 6: + size = data; + storedSize = data; + break; + } + } + + public int read(int address) { + switch(address) { + case 0: + return ctl; + case 2: + return sourceAddress; + case 4: + return destinationAddress; + case 6: + return size; + } + System.out.println("Illegal read of DMA Channel register"); + return 0; + } + + public void trigger(DMATrigger trigger, int index) { + /* perform memory move and possibly clear triggering flag!!! */ + /* NOTE: show config byte/word also !!! */ + if (enable) { + int data = cpu.read(currentSourceAddress, false); + System.out.println("DMA Triggered reading from: " + + currentSourceAddress + " => " + data + " " + (char) data + + " size:" + size + " index:" + index); + trigger.clearDMATrigger(index); + DMA.this.cpu.write(destinationAddress, data, false); + + currentSourceAddress += srcIncr; + currentDestinationAddress += dstIncr; + size--; + if (size == 0) { + currentSourceAddress = sourceAddress; + currentDestinationAddress = destinationAddress; + size = storedSize; + /* flag interrupt!!!! */ + } + + } + } + } + + private Channel channels[] = new Channel[3]; + private int dmactl0; + private int dmactl1; + + MSP430Core cpu; + + public DMA(String id, int[] memory, int offset, MSP430Core msp430Core) { + super(id, memory, offset); + channels[0] = new Channel(); + channels[1] = new Channel(); + channels[2] = new Channel(); + this.cpu = msp430Core; + } + + public void trigger(DMATrigger trigger, int startIndex, int index) { + /* could make this a bit and have a bit-pattern if more dma channels but + * with 3 channels it does not make sense. Optimize later - maybe with + * flag in DMA triggers so that they now if a channel listens at all. + */ + int totIndex = startIndex + index; + for (int i = 0; i < channels.length; i++) { + System.out.println("DMA Channel:" + channels[i].trigger + " index " + totIndex); + if (channels[i].trigger == totIndex) channels[i].trigger(trigger, index); + } + } + + public void interruptServiced(int vector) { + } + + public void write(int address, int value, boolean word, long cycles) { + System.out.println("DMA write to: " + Utils.hex16(address) + ": " + value); + switch (address) { + case DMACTL0: + /* DMA Control 0 */ + dmactl0 = value; + channels[0].setTrigger(value & 0xf); + channels[1].setTrigger((value >> 4) & 0xf); + channels[2].setTrigger((value >> 8) & 0xf); + break; + case DMACTL1: + /* DMA Control 1 */ + dmactl1 = value; + break; + default: + /* must be word ??? */ + Channel c = channels[(address - DMAxCTL) / 8]; + c.write(address & 0x07, value); + } + } + + public int read(int address, boolean word, long cycles) { + switch (address) { + case DMACTL0: + /* DMA Control 0 */ + return dmactl0; + case DMACTL1: + /* DMA Control 1 */ + return dmactl1; + default: + /* must be word ??? */ + Channel c = channels[(address - DMAxCTL) / 8]; + return c.read(address & 7); + } + } +} Added: mspsim/se/sics/mspsim/core/DMATrigger.java =================================================================== --- mspsim/se/sics/mspsim/core/DMATrigger.java (rev 0) +++ mspsim/se/sics/mspsim/core/DMATrigger.java 2011-02-04 07:06:13 UTC (rev 779) @@ -0,0 +1,6 @@ +package se.sics.mspsim.core; + +public interface DMATrigger { + public void setDMA(DMA dma, int startIndex); + public void clearDMATrigger(int index); +} Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2011-01-31 22:35:42 UTC (rev 778) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2011-02-04 07:06:13 UTC (rev 779) @@ -148,7 +148,7 @@ int passIO = 0; // IOUnits should likely be placed in a hashtable? // Maybe for debugging purposes... - ioUnits = new IOUnit[PORTS + 7 + 1]; + ioUnits = new IOUnit[PORTS + 9]; Timer ta = new Timer(this, "A", Timer.TIMER_Ax149, memory, 0x160); Timer tb = new Timer(this, "B", Timer.TIMER_Bx149, memory, 0x180); @@ -261,6 +261,23 @@ memOut[0x1A0 + i] = adc12; memIn[0x1A0 + i] = adc12; } + + + DMA dma = new DMA("dma", memory, 0, this); + for (int i = 0, n = 24; i < n; i++) { + memOut[0x1E0 + i] = dma; + memIn[0x1E0 + i] = dma; + } + /* DMA Ctl */ + memOut[0x122] = dma; + memIn[0x124] = dma; + + /* configure the DMA */ + usart0.setDMA(dma, DMA.URXIFG0); + usart1.setDMA(dma, DMA.URXIFG1); + + ioUnits[passIO++] = dma; + if (DEBUG) System.out.println("Number of passive: " + passIO); } Modified: mspsim/se/sics/mspsim/core/USART.java =================================================================== --- mspsim/se/sics/mspsim/core/USART.java 2011-01-31 22:35:42 UTC (rev 778) +++ mspsim/se/sics/mspsim/core/USART.java 2011-02-04 07:06:13 UTC (rev 779) @@ -41,7 +41,7 @@ package se.sics.mspsim.core; -public class USART extends IOUnit implements SFRModule { +public class USART extends IOUnit implements SFRModule, DMATrigger { // USART 0/1 register offset (0x70 / 0x78) public static final int UCTL = 0; @@ -113,6 +113,10 @@ private boolean rxEnabled = false; private boolean spiMode = false; + /* DMA controller that needs to be called at certain times */ + private DMA dma; + private int dmaIndex; + private TimeEvent txTrigger = new TimeEvent(0) { public void execute(long t) { // Ready to transmit new byte! @@ -150,6 +154,12 @@ reset(0); } + public void setDMA(DMA dma, int index) { + this.dma = dma; + dmaIndex = index; + } + + public void reset(int type) { nextTXReady = cpu.cycles + 100; txShiftReg = nextTXByte = -1; @@ -175,7 +185,13 @@ // if ((bits & utxifg) > 0) { // System.out.println(getName() + " Set utxifg"); // } - sfr.setBitIFG(uartID, bits); + if (dma != null) { + sfr.setBitIFG(uartID, bits); + /* set bit first, then trigger DMA transfer - this should + * be made via a 1 cycle or so delayed action */ + if ((bits & urxifg) > 0) dma.trigger(this, dmaIndex, 0); + if ((bits & utxifg) > 0) dma.trigger(this, dmaIndex, 1); + } } private void clrBitIFG(int bits) { @@ -417,5 +433,17 @@ return "UTXIE: " + isIEBitsSet(utxifg) + " URXIE:" + isIEBitsSet(urxifg) + "\n" + "UTXIFG: " + ((getIFG() & utxifg) > 0) + " URXIFG:" + ((getIFG() & urxifg) > 0); } - + + public void clearDMATrigger(int index) { + System.out.println("UART clearing DMA " + index); + if (index == 0) { + /* clear RX - might be different in different modes... */ + System.out.println("UART clearing read bit!"); + clrBitIFG(urxifg); + stateChanged(USARTListener.RXFLAG_CLEARED, true); + } else { + /* clear TX - might be different in different modes... */ + clrBitIFG(utxifg); + } + } } \ No newline at end of file Modified: mspsim/se/sics/mspsim/ui/SerialMon.java =================================================================== --- mspsim/se/sics/mspsim/ui/SerialMon.java 2011-01-31 22:35:42 UTC (rev 778) +++ mspsim/se/sics/mspsim/ui/SerialMon.java 2011-02-04 07:06:13 UTC (rev 779) @@ -98,6 +98,7 @@ usart.addStateChangeListener(this); textArea.addKeyListener(this); + usart.addStateChangeListener(this); } public void saveWindowBounds() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2011-01-31 22:35:48
|
Revision: 778 http://mspsim.svn.sourceforge.net/mspsim/?rev=778&view=rev Author: joxe Date: 2011-01-31 22:35:42 +0000 (Mon, 31 Jan 2011) Log Message: ----------- fixed bug with frame rejection Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2011-01-28 14:04:26 UTC (rev 777) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2011-01-31 22:35:42 UTC (rev 778) @@ -374,6 +374,7 @@ private boolean currentSFD; private boolean currentFIFO; private boolean overflow = false; + private boolean frameRejected = false; public interface StateListener { public void newState(RadioState state); @@ -445,7 +446,6 @@ setSymbolEvent(12); setMode(MODE_RX_ON); break; - case RX_SFD_SEARCH: zeroSymbols = 0; /* eight symbols after first SFD search RSSI will be valid */ @@ -516,6 +516,7 @@ /* mark position of frame start - for rejecting when address is wrong */ rxFIFO.mark(); rxread = 0; + frameRejected = false; break; } @@ -534,7 +535,7 @@ rxFIFO.restore(); setSFD(false); setFIFO(rxFIFO.length() > 0); - setState(RadioState.RX_SFD_SEARCH); + frameRejected = true; } /* variables for the address recognigion */ @@ -573,66 +574,73 @@ } else if(rxFIFO.isFull()) { setRxOverflow(); } else { - rxFIFO.write(data); - - if (rxread == 0) { - rxCrc.setCRC(0); - rxlen = data & 0xff; - //System.out.println("Starting to get packet at: " + rxfifoWritePos + " len = " + rxlen); - decodeAddress = false; - if (DEBUG) log("RX: Start frame length " + rxlen); - // FIFO pin goes high after length byte is written to RXFIFO - setFIFO(true); - } else if (rxread < rxlen - 1) { - /* As long as we are not in the length or FCF (CRC) we count CRC */ - rxCrc.addBitrev(data & 0xff); - if (rxread == 1) { - fcf0 = data & 0xff; - frameType = fcf0 & FRAME_TYPE; - } else if (rxread == 2) { - fcf1 = data & 0xff; - decodeAddress = addressDecode; - if (frameType == TYPE_DATA_FRAME) { - ackRequest = (fcf0 & ACK_REQUEST) > 0; - destinationAddressMode = (fcf1 >> 2) & 3; - /* check this !!! */ - if (addressDecode && destinationAddressMode != LONG_ADDRESS && - destinationAddressMode != SHORT_ADDRESS) { + if (!frameRejected) { + rxFIFO.write(data); + if (rxread == 0) { + rxCrc.setCRC(0); + rxlen = data & 0xff; + //System.out.println("Starting to get packet at: " + rxfifoWritePos + " len = " + rxlen); + decodeAddress = false; + if (DEBUG) log("RX: Start frame length " + rxlen); + // FIFO pin goes high after length byte is written to RXFIFO + setFIFO(true); + } else if (rxread < rxlen - 1) { + /* As long as we are not in the length or FCF (CRC) we count CRC */ + rxCrc.addBitrev(data & 0xff); + if (rxread == 1) { + fcf0 = data & 0xff; + frameType = fcf0 & FRAME_TYPE; + } else if (rxread == 2) { + fcf1 = data & 0xff; + decodeAddress = addressDecode; + if (frameType == TYPE_DATA_FRAME) { + ackRequest = (fcf0 & ACK_REQUEST) > 0; + destinationAddressMode = (fcf1 >> 2) & 3; + /* check this !!! */ + if (addressDecode && destinationAddressMode != LONG_ADDRESS && + destinationAddressMode != SHORT_ADDRESS) { + rejectFrame(); + } + } else if (frameType == TYPE_BEACON_FRAME || + frameType == TYPE_ACK_FRAME){ + decodeAddress = false; + ackRequest = false; + } else if (addressDecode) { + /* illegal frame when decoding address... */ rejectFrame(); } - } else if (frameType == TYPE_BEACON_FRAME || - frameType == TYPE_ACK_FRAME){ - decodeAddress = false; - ackRequest = false; - } else if (addressDecode) { - /* illegal frame when decoding address... */ - rejectFrame(); + } else if (rxread == 3) { + // save data sequence number + dsn = data & 0xff; + } else if (decodeAddress) { + boolean flushPacket = false; + /* here we decode the address !!! */ + if (destinationAddressMode == LONG_ADDRESS && rxread == 8 + 5) { + /* here we need to check that this address is correct compared to the stored address */ + flushPacket = !rxFIFO.tailEquals(memory, RAM_IEEEADDR, 8); + flushPacket |= !rxFIFO.tailEquals(memory, RAM_PANID, 2, 8); + decodeAddress = false; + } else if (destinationAddressMode == SHORT_ADDRESS && rxread == 2 + 5){ + /* should check short address */ + flushPacket = !rxFIFO.tailEquals(BC_ADDRESS, 0, 2) && + !rxFIFO.tailEquals(memory, RAM_SHORTADDR, 2); + flushPacket |= !rxFIFO.tailEquals(memory, RAM_PANID, 2, 2); + decodeAddress = false; + } + if (flushPacket) { + rejectFrame(); + } } - } else if (rxread == 3) { - // save data sequence number - dsn = data & 0xff; - } else if (decodeAddress) { - boolean flushPacket = false; - /* here we decode the address !!! */ - if (destinationAddressMode == LONG_ADDRESS && rxread == 8 + 5) { - /* here we need to check that this address is correct compared to the stored address */ - flushPacket = !rxFIFO.tailEquals(memory, RAM_IEEEADDR, 8); - flushPacket |= !rxFIFO.tailEquals(memory, RAM_PANID, 2, 8); - decodeAddress = false; - } else if (destinationAddressMode == SHORT_ADDRESS && rxread == 2 + 5){ - /* should check short address */ - flushPacket = !rxFIFO.tailEquals(BC_ADDRESS, 0, 2) && - !rxFIFO.tailEquals(memory, RAM_SHORTADDR, 2); - flushPacket |= !rxFIFO.tailEquals(memory, RAM_PANID, 2, 2); - decodeAddress = false; - } - if (flushPacket) { - rejectFrame(); - } } } - + if(rxread++ == rxlen) { + if (frameRejected) { + log("Frame rejected - setting SFD to false and RXWAIT\n"); + setSFD(false); + setState(RadioState.RX_WAIT); + return; + } // In RX mode, FIFOP goes high, if threshold is higher than frame length.... // Here we check the CRC of the packet! @@ -1344,7 +1352,7 @@ "\n RSSI Valid: " + ((status & STATUS_RSSI_VALID) > 0) + " CCA: " + cca + "\n FIFOP Polarity: " + ((registers[REG_IOCFG0] & FIFOP_POLARITY) == FIFOP_POLARITY) + " FIFOP: " + fifoP + " FIFO: " + currentFIFO + " SFD: " + currentSFD + - "\n " + rxFIFO.stateToString() + + "\n " + rxFIFO.stateToString() + " expPacketLen: " + rxlen + "\n Radio State: " + stateMachine + " SPI State: " + state + "\n AutoACK: " + autoAck + " AddrDecode: " + addressDecode + " AutoCRC: " + autoCRC + "\n PanID: 0x" + Utils.hex8(memory[RAM_PANID + 1]) + Utils.hex8(memory[RAM_PANID]) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2011-01-28 14:04:33
|
Revision: 777 http://mspsim.svn.sourceforge.net/mspsim/?rev=777&view=rev Author: joxe Date: 2011-01-28 14:04:26 +0000 (Fri, 28 Jan 2011) Log Message: ----------- fixed uart callback and serial monitor window Modified Paths: -------------- mspsim/se/sics/mspsim/core/IOUnit.java mspsim/se/sics/mspsim/core/USART.java mspsim/se/sics/mspsim/ui/SerialMon.java Modified: mspsim/se/sics/mspsim/core/IOUnit.java =================================================================== --- mspsim/se/sics/mspsim/core/IOUnit.java 2011-01-20 18:36:35 UTC (rev 776) +++ mspsim/se/sics/mspsim/core/IOUnit.java 2011-01-28 14:04:26 UTC (rev 777) @@ -79,9 +79,13 @@ scListeners = (StateChangeListener[]) ArrayUtils.remove(scListeners, listener); } + + protected void stateChanged(int newState) { + stateChanged(newState, false); + } /* Called by subclasses to inform about changes of state */ - protected void stateChanged(int newState) { - if (ioState != newState) { + protected void stateChanged(int newState, boolean forceCallback) { + if (forceCallback || ioState != newState) { int oldState = ioState; ioState = newState; /* inform listeners */ Modified: mspsim/se/sics/mspsim/core/USART.java =================================================================== --- mspsim/se/sics/mspsim/core/USART.java 2011-01-20 18:36:35 UTC (rev 776) +++ mspsim/se/sics/mspsim/core/USART.java 2011-01-28 14:04:26 UTC (rev 777) @@ -311,7 +311,8 @@ } clrBitIFG(urxifg); /* This should be changed to a state rather than an "event" */ - stateChanged(USARTListener.RXFLAG_CLEARED); + /* Force callback since this is not used as a state */ + stateChanged(USARTListener.RXFLAG_CLEARED, true); return tmp; } return 0; Modified: mspsim/se/sics/mspsim/ui/SerialMon.java =================================================================== --- mspsim/se/sics/mspsim/ui/SerialMon.java 2011-01-20 18:36:35 UTC (rev 776) +++ mspsim/se/sics/mspsim/ui/SerialMon.java 2011-01-28 14:04:26 UTC (rev 777) @@ -53,7 +53,8 @@ import se.sics.mspsim.core.*; -public class SerialMon implements KeyListener, USARTListener { +public class SerialMon implements KeyListener, USARTListener, + StateChangeListener { private static final String PREFIX = " > "; private static final int MAX_LINES = 200; @@ -95,6 +96,7 @@ WindowUtils.addSaveOnShutdown(key, window); window.setVisible(true); + usart.addStateChangeListener(this); textArea.addKeyListener(this); } @@ -168,7 +170,7 @@ } } - public void stateChanged(int state) { + public void stateChanged(Object source, int old, int state) { if (state == USARTListener.RXFLAG_CLEARED && bsize > 0) { if (usart.isReceiveFlagCleared()) { usart.byteReceived(buffer[rPos]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2011-01-20 18:36:41
|
Revision: 776 http://mspsim.svn.sourceforge.net/mspsim/?rev=776&view=rev Author: nifi Date: 2011-01-20 18:36:35 +0000 (Thu, 20 Jan 2011) Log Message: ----------- Only reset counter when needed Modified Paths: -------------- mspsim/se/sics/mspsim/core/Timer.java Modified: mspsim/se/sics/mspsim/core/Timer.java =================================================================== --- mspsim/se/sics/mspsim/core/Timer.java 2011-01-17 17:18:33 UTC (rev 775) +++ mspsim/se/sics/mspsim/core/Timer.java 2011-01-20 18:36:35 UTC (rev 776) @@ -748,8 +748,8 @@ // Check if up or updwn and reset if counter too high... if (counter > data && (mode == UPDWN || mode == UP)) { counter = 0; + resetCounter(cycles); } - resetCounter(cycles); } ccr[index].tccr = data; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2011-01-17 17:18:41
|
Revision: 775 http://mspsim.svn.sourceforge.net/mspsim/?rev=775&view=rev Author: nifi Date: 2011-01-17 17:18:33 +0000 (Mon, 17 Jan 2011) Log Message: ----------- * Added interrupt vector and elapsed time to stacktrace * Replaced Integer with CallCounter (minor optimization) Modified Paths: -------------- mspsim/se/sics/mspsim/util/SimpleProfiler.java Modified: mspsim/se/sics/mspsim/util/SimpleProfiler.java =================================================================== --- mspsim/se/sics/mspsim/util/SimpleProfiler.java 2011-01-17 17:17:09 UTC (rev 774) +++ mspsim/se/sics/mspsim/util/SimpleProfiler.java 2011-01-17 17:18:33 UTC (rev 775) @@ -40,24 +40,23 @@ */ package se.sics.mspsim.util; -import se.sics.mspsim.core.Chip; -import se.sics.mspsim.core.EventListener; -import se.sics.mspsim.core.EventSource; -import se.sics.mspsim.core.MSP430Core; -import se.sics.mspsim.core.Profiler; -import se.sics.mspsim.profiler.CallListener; - import java.io.PrintStream; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; +import java.util.Map.Entry; import java.util.Properties; -import java.util.Map.Entry; import java.util.regex.Pattern; +import se.sics.mspsim.core.Chip; +import se.sics.mspsim.core.EventListener; +import se.sics.mspsim.core.EventSource; +import se.sics.mspsim.core.MSP430Core; +import se.sics.mspsim.core.Profiler; +import se.sics.mspsim.profiler.CallListener; public class SimpleProfiler implements Profiler, EventListener { @@ -80,6 +79,7 @@ private long[] interruptCount = new long[16]; private int servicedInterrupt; private int interruptLevel; + private int interruptFrom; private boolean newIRQ; public SimpleProfiler() { @@ -101,7 +101,7 @@ } public void addIgnoreFunction(String function) { - ignoreFunctions.put(function, function); + ignoreFunctions.put(function, function); } public void profileCall(MapEntry entry, long cycles, int from) { @@ -113,7 +113,9 @@ if (callStack[cSP] == null) { callStack[cSP] = new CallEntry(); } + int hide = 0; + PrintStream logger = this.logger; if (logger != null) { /* hide this if last call was to be hidden */ hide = (cSP == 0 || newIRQ) ? 0 : callStack[cSP - 1].hide; @@ -121,7 +123,7 @@ if (hide > 0) hide++; if ((!hideIRQ || servicedInterrupt == -1) && hide == 0) { if (servicedInterrupt >= 0) logger.printf("[%2d] ", servicedInterrupt); - printSpace(logger, cSP * 2 - interruptLevel); + printSpace(logger, (cSP - interruptLevel) * 2); logger.println("Call to $" + Utils.hex16(entry.getAddress()) + ": " + entry.getInfo()); if (ignoreFunctions.get(entry.getName()) != null) { @@ -151,7 +153,12 @@ public void profileReturn(long cycles) { if (cSP <= 0) { /* the stack pointer might have been messed with? */ - logger.println("SimpleProfiler: Too many returns?"); + PrintStream logger = this.logger; + if (logger != null) { + logger.println("SimpleProfiler: Too many returns?"); + } else { + System.err.println("SimpleProfiler: Too many returns?"); + } return; } CallEntry cspEntry = callStack[--cSP]; @@ -174,19 +181,20 @@ ce.calls++; if (cSP != 0) { MapEntry caller = callStack[cSP-1].function; - HashMap<MapEntry,Integer> callers = ce.callers; - Integer numCalls = callers.get(caller); + HashMap<MapEntry,CallCounter> callers = ce.callers; + CallCounter numCalls = callers.get(caller); if (numCalls == null) { - callers.put(caller, 1); - } else { - callers.put(caller, numCalls + 1); + numCalls = new CallCounter(); + callers.put(caller, numCalls); } + numCalls.count++; } + PrintStream logger = this.logger; if (logger != null) { if ((cspEntry.hide <= 1) && (!hideIRQ || servicedInterrupt == -1)) { if (servicedInterrupt >= 0) logger.printf("[%2d] ",servicedInterrupt); - printSpace(logger, cSP * 2 - interruptLevel); + printSpace(logger, (cSP - interruptLevel) * 2); logger.println("return from " + ce.function.getInfo() + " elapsed: " + elapsed); } } @@ -203,9 +211,12 @@ public void profileInterrupt(int vector, long cycles) { servicedInterrupt = vector; + interruptFrom = cpu.getPC(); lastInterruptTime[servicedInterrupt] = cycles; - interruptLevel = cSP * 2; + interruptLevel = cSP; newIRQ = true; + + PrintStream logger = this.logger; if (logger != null && !hideIRQ) { logger.println("----- Interrupt vector " + vector + " start execution -----"); } @@ -217,6 +228,8 @@ interruptCount[servicedInterrupt]++; } newIRQ = false; + + PrintStream logger = this.logger; if (logger != null && !hideIRQ) { logger.println("----- Interrupt vector " + servicedInterrupt + " returned - elapsed: " + (cycles - lastInterruptTime[servicedInterrupt])); @@ -230,6 +243,7 @@ public void resetProfile() { clearProfile(); cSP = 0; + servicedInterrupt = -1; } public void clearProfile() { @@ -305,16 +319,16 @@ } private void printCallers(CallEntry callEntry, PrintStream out) { - HashMap<MapEntry,Integer> callers = callEntry.callers; - List<Entry<MapEntry, Integer>> list = new LinkedList<Entry<MapEntry, Integer>>(callers.entrySet()); - Collections.sort(list, new Comparator<Entry<MapEntry, Integer>>() { - public int compare(Entry<MapEntry, Integer> o1, Entry<MapEntry, Integer> o2) { + HashMap<MapEntry,CallCounter> callers = callEntry.callers; + List<Entry<MapEntry,CallCounter>> list = new ArrayList<Entry<MapEntry,CallCounter>>(callers.entrySet()); + Collections.sort(list, new Comparator<Entry<MapEntry,CallCounter>>() { + public int compare(Entry<MapEntry,CallCounter> o1, Entry<MapEntry,CallCounter> o2) { return o2.getValue().compareTo(o1.getValue()); } }); - for (Entry<MapEntry, Integer> entry : list) { + for (Entry<MapEntry,CallCounter> entry : list) { String functionName = entry.getKey().getName(); - String callS = "" + entry.getValue(); + String callS = "" + entry.getValue().count; printSpace(out, 12 - callS.length()); out.print(callS); printSpace(out, 2); @@ -331,13 +345,19 @@ public void printStackTrace(PrintStream out) { int stackCount = cSP; - out.println("Stack Trace: number of calls: " + stackCount); + out.println("Stack Trace: number of calls: " + stackCount + + " PC: $" + Utils.hex16(cpu.getPC())); for (int i = 0; i < stackCount; i++) { - out.println(" " + callStack[stackCount - i - 1].function.getInfo() + " called from PC: " + - callStack[stackCount - i - 1].fromPC); + CallEntry call = callStack[stackCount - i - 1]; + out.println(" " + call.function.getInfo() + + " called from PC: $" + Utils.hex16(call.fromPC) + + " (elapsed: " + (cpu.cpuCycles - call.cycles) + ')'); + if (stackCount - i - 1 == interruptLevel && servicedInterrupt != -1) { + out.println(" *** Interrupt " + servicedInterrupt + " from PC: $" + Utils.hex16(interruptFrom)); + } } } - + private static class CallEntryComparator implements Comparator<CallEntry> { private int mode; @@ -386,13 +406,21 @@ long exclusiveCycles; int calls; int hide; - HashMap<MapEntry, Integer> callers; + HashMap<MapEntry,CallCounter> callers; public CallEntry() { - callers = new HashMap<MapEntry, Integer>(); + callers = new HashMap<MapEntry,CallCounter>(); } } + private static class CallCounter implements Comparable<CallCounter> { + public int count = 0; + + public int compareTo(CallCounter o) { + return (count < o.count ? -1 : (count == o.count ? 0 : 1)); + } + } + private static class TagEntry implements Comparable<TagEntry> { String tag; long cycles; @@ -483,7 +511,7 @@ ArrayUtils.add(CallListener.class, callListeners, listener); } - public void removeCallListener(CallListener listener) { + public synchronized void removeCallListener(CallListener listener) { callListeners = (CallListener[]) ArrayUtils.remove(callListeners, listener); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2011-01-17 17:17:15
|
Revision: 774 http://mspsim.svn.sourceforge.net/mspsim/?rev=774&view=rev Author: joxe Date: 2011-01-17 17:17:09 +0000 (Mon, 17 Jan 2011) Log Message: ----------- increased speed of flash erase for m25p80 so that it match tmote sky better Modified Paths: -------------- mspsim/se/sics/mspsim/chip/M25P80.java Modified: mspsim/se/sics/mspsim/chip/M25P80.java =================================================================== --- mspsim/se/sics/mspsim/chip/M25P80.java 2011-01-17 17:07:58 UTC (rev 773) +++ mspsim/se/sics/mspsim/chip/M25P80.java 2011-01-17 17:17:09 UTC (rev 774) @@ -66,7 +66,7 @@ public static final int CHIP_SELECT = 0x10; private static final double PROGRAM_PAGE_MILLIS = 1.0; // 0.8 - 5 ms - private static final double SECTOR_ERASE_MILLIS = 1400; // 800 - 3 000 ms + private static final double SECTOR_ERASE_MILLIS = 800; // 800 - 3 000 ms private int state = 0; private boolean chipSelect; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2011-01-17 17:08:04
|
Revision: 773 http://mspsim.svn.sourceforge.net/mspsim/?rev=773&view=rev Author: nifi Date: 2011-01-17 17:07:58 +0000 (Mon, 17 Jan 2011) Log Message: ----------- Added Watchdog as an IO unit Modified Paths: -------------- mspsim/se/sics/mspsim/core/MSP430Core.java mspsim/se/sics/mspsim/core/Watchdog.java Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2011-01-17 16:53:16 UTC (rev 772) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2011-01-17 17:07:58 UTC (rev 773) @@ -91,6 +91,7 @@ private IOUnit[] ioUnits; private SFR sfr; + private Watchdog watchdog; // From the possible interrupt sources - to be able to indicate is serviced. private InterruptHandler interruptSource[] = new IOUnit[16]; @@ -147,7 +148,7 @@ int passIO = 0; // IOUnits should likely be placed in a hashtable? // Maybe for debugging purposes... - ioUnits = new IOUnit[PORTS + 7]; + ioUnits = new IOUnit[PORTS + 7 + 1]; Timer ta = new Timer(this, "A", Timer.TIMER_Ax149, memory, 0x160); Timer tb = new Timer(this, "B", Timer.TIMER_Bx149, memory, 0x180); @@ -172,9 +173,9 @@ memOut[i] = sfr; memIn[i] = sfr; } - Watchdog wdt = new Watchdog(this); - memOut[0x120] = wdt; - memIn[0x120] = wdt; + watchdog = new Watchdog(this); + memOut[0x120] = watchdog; + memIn[0x120] = watchdog; memIn[Timer.TAIV] = ta; memOut[Timer.TAIV] = ta; @@ -246,6 +247,7 @@ ADC12 adc12 = new ADC12(this); ioUnits[passIO++] = adc12; + ioUnits[passIO++] = watchdog; for (int i = 0, n = 16; i < n; i++) { memOut[0x80 + i] = adc12; Modified: mspsim/se/sics/mspsim/core/Watchdog.java =================================================================== --- mspsim/se/sics/mspsim/core/Watchdog.java 2011-01-17 16:53:16 UTC (rev 772) +++ mspsim/se/sics/mspsim/core/Watchdog.java 2011-01-17 17:07:58 UTC (rev 773) @@ -47,7 +47,6 @@ * */ public class Watchdog extends IOUnit implements SFRModule { - private static final boolean DEBUG = false; private static final int WDTCTL = 0x120; @@ -122,11 +121,11 @@ if (address == WDTCTL) { if ((value >> 8) == 0x5a) { wdtctl = value & 0xff; - if (DEBUG) System.out.println(getName() + " Wrote to WDTCTL: " + Utils.hex8(wdtctl) + " from " + cpu.getPC()); + if (DEBUG) log("Wrote to WDTCTL: " + Utils.hex8(wdtctl) + " from " + cpu.getPC()); // Is it on? wdtOn = (value & 0x80) == 0; - boolean lastACLK = sourceACLK; +// boolean lastACLK = sourceACLK; sourceACLK = (value & WDTSSEL) != 0; if ((value & WDTCNTCL) != 0) { // Clear timer => reset the delay @@ -135,7 +134,7 @@ timerMode = (value & WDTMSEL) != 0; // Start it if it should be started! if (wdtOn) { - if (DEBUG) System.out.println("Setting WDTCNT to count: " + delay); + if (DEBUG) log("Setting WDTCNT to count: " + delay); scheduleTimer(); } else { // Stop it and remember current "delay" left! @@ -143,23 +142,24 @@ } } else { // Trigger reset!! -// System.out.println("WDTCTL: illegal write - should reset!!!! " + value); + logw("illegal write to WDTCTL (" + value + ") from $" + Utils.hex16(cpu.getPC()) + + " - reset!!!!"); cpu.flagInterrupt(RESET_VECTOR, this, true); } } } - + private void scheduleTimer() { if (sourceACLK) { - if (DEBUG) System.out.println("setting delay in ms (ACLK): " + 1000.0 * delay / cpu.aclkFrq); + if (DEBUG) log("setting delay in ms (ACLK): " + 1000.0 * delay / cpu.aclkFrq); targetTime = cpu.scheduleTimeEventMillis(wdtTrigger, 1000.0 * delay / cpu.aclkFrq); } else { - if (DEBUG) System.out.println("setting delay in cycles"); + if (DEBUG) log("setting delay in cycles"); cpu.scheduleCycleEvent(wdtTrigger, targetTime = cpu.cycles + delay); } } public void enableChanged(int reg, int bit, boolean enabled) { - System.out.println("*** Watchdog module enabled: " + enabled); + if (DEBUG) log("*** Watchdog module enabled: " + enabled); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2011-01-17 16:53:22
|
Revision: 772 http://mspsim.svn.sourceforge.net/mspsim/?rev=772&view=rev Author: joxe Date: 2011-01-17 16:53:16 +0000 (Mon, 17 Jan 2011) Log Message: ----------- fixed so that packets are only dropped on illegal address mode when address decode is active Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2011-01-17 14:51:17 UTC (rev 771) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2011-01-17 16:53:16 UTC (rev 772) @@ -596,7 +596,7 @@ ackRequest = (fcf0 & ACK_REQUEST) > 0; destinationAddressMode = (fcf1 >> 2) & 3; /* check this !!! */ - if (destinationAddressMode != LONG_ADDRESS && + if (addressDecode && destinationAddressMode != LONG_ADDRESS && destinationAddressMode != SHORT_ADDRESS) { rejectFrame(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2011-01-17 14:51:23
|
Revision: 771 http://mspsim.svn.sourceforge.net/mspsim/?rev=771&view=rev Author: nifi Date: 2011-01-17 14:51:17 +0000 (Mon, 17 Jan 2011) Log Message: ----------- * Changed command 'log' to both list and handle multiple loggables * Removed now obsolete command 'loggable' (replaced by 'log') * Minor cleanup of command output Modified Paths: -------------- mspsim/se/sics/mspsim/cli/DebugCommands.java Modified: mspsim/se/sics/mspsim/cli/DebugCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/DebugCommands.java 2011-01-17 12:14:18 UTC (rev 770) +++ mspsim/se/sics/mspsim/cli/DebugCommands.java 2011-01-17 14:51:17 UTC (rev 771) @@ -40,7 +40,6 @@ */ package se.sics.mspsim.cli; import se.sics.mspsim.core.CPUMonitor; -import se.sics.mspsim.core.Chip; import se.sics.mspsim.core.DbgInstruction; import se.sics.mspsim.core.DisAsm; import se.sics.mspsim.core.EmulationException; @@ -86,7 +85,7 @@ cpu.stop(); } }); - context.out.println("Breakpoint set at $" + Utils.hex16(baddr)); + context.err.println("Breakpoint set at $" + Utils.hex16(baddr)); return 0; } public void stopCommand(CommandContext context) { @@ -196,7 +195,7 @@ } } }); - context.out.println("Watch set for register " + getRegisterName(register)); + context.err.println("Watch set for register " + getRegisterName(register)); return 0; } @@ -521,32 +520,48 @@ } }); - ch.registerCommand("loggable", new BasicCommand("list loggable objects", "") { - @Override - public int executeCommand(CommandContext context) { - Loggable[] chips = cpu.getLoggables(); - for (int i = 0; i < chips.length; i++) { - context.out.println(chips[i].getName()); + ch.registerCommand("log", new BasicAsyncCommand("log a loggable object", "[loggable...]" ) { + private Loggable[] loggables = null; + + @Override + public int executeCommand(CommandContext context) { + if (context.getArgumentCount() == 0) { + Loggable[] loggable = cpu.getLoggables(); + for (Loggable unit : loggable) { + String id = unit.getID(); + String name = unit.getName(); + if (id == name) { + context.out.println(" " + id); + } else { + context.out.println(" " + id + " (" + name + ')'); + } + } + context.exit(0); + return 0; + } + + Loggable[] logs = new Loggable[context.getArgumentCount()]; + for(int i = 0, n = context.getArgumentCount(); i < n; i++) { + logs[i] = cpu.getLoggable(context.getArgument(i)); + if (logs[i] == null) { + context.err.println("Can not find loggable '" + context.getArgument(i) + '\''); + return 1; + } + } + for(Loggable l : logs) { + l.setLogStream(context.out); + } + this.loggables = logs; + return 0; } - return 0; - } - }); - - ch.registerCommand("log", new BasicAsyncCommand("log a loggable object", "<loggable>" ) { - Loggable chip = null; - @Override - public int executeCommand(CommandContext context) { - chip = cpu.getLoggable(context.getArgument(0)); - if (chip == null) { - context.err.println("Can not find loggable: " + context.getArgument(0)); + + public void stopCommand(CommandContext context) { + if (loggables != null) { + for(Loggable l : loggables) { + l.clearLogStream(); + } + } } - chip.setLogStream(context.out); - return 0; - } - - public void stopCommand(CommandContext context) { - chip.clearLogStream(); - } }); ch.registerCommand("trace", new BasicCommand("store a trace of execution positions.", "<trace size | show>") { @@ -583,25 +598,22 @@ MapEntry me = context.getMapTable().getEntry(adr); if (me != null) { return me.getName(); - } else { - return Utils.hex16(adr); } + return '$' + Utils.hex16(adr); } private static String getSymOrAddrELF(ELF elf, int adr) { DebugInfo me = elf.getDebugInfo(adr); if (me != null) { return me.toString(); - } else { - return Utils.hex16(adr); } + return '$' + Utils.hex16(adr); } private static String getRegisterName(int register) { if (register >= 0 && register < MSP430Constants.REGISTER_NAMES.length) { return MSP430Constants.REGISTER_NAMES[register]; - } else { - return "R" + register; } + return "R" + register; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2011-01-17 12:14:25
|
Revision: 770 http://mspsim.svn.sourceforge.net/mspsim/?rev=770&view=rev Author: joxe Date: 2011-01-17 12:14:18 +0000 (Mon, 17 Jan 2011) Log Message: ----------- improved CC2420 address filtering Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java mspsim/se/sics/mspsim/plugin/ContikiChecker.java mspsim/se/sics/mspsim/util/ArrayFIFO.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2011-01-15 00:11:40 UTC (rev 769) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2011-01-17 12:14:18 UTC (rev 770) @@ -269,7 +269,7 @@ private int dsn = 0; private int fcf0 = 0; private int fcf1 = 0; - + private int frameType = 0; private int activeFrequency = 0; private int activeChannel = 0; @@ -528,6 +528,15 @@ return true; } + private void rejectFrame() { + // Immediately jump to SFD Search again... something more??? + /* reset state */ + rxFIFO.restore(); + setSFD(false); + setFIFO(rxFIFO.length() > 0); + setState(RadioState.RX_SFD_SEARCH); + } + /* variables for the address recognigion */ int destinationAddressMode = 0; boolean decodeAddress = false; @@ -579,15 +588,25 @@ rxCrc.addBitrev(data & 0xff); if (rxread == 1) { fcf0 = data & 0xff; + frameType = fcf0 & FRAME_TYPE; } else if (rxread == 2) { fcf1 = data & 0xff; - if (TYPE_DATA_FRAME == (fcf0 & FRAME_TYPE)) { - decodeAddress = addressDecode; + decodeAddress = addressDecode; + if (frameType == TYPE_DATA_FRAME) { ackRequest = (fcf0 & ACK_REQUEST) > 0; destinationAddressMode = (fcf1 >> 2) & 3; - } else { + /* check this !!! */ + if (destinationAddressMode != LONG_ADDRESS && + destinationAddressMode != SHORT_ADDRESS) { + rejectFrame(); + } + } else if (frameType == TYPE_BEACON_FRAME || + frameType == TYPE_ACK_FRAME){ decodeAddress = false; ackRequest = false; + } else if (addressDecode) { + /* illegal frame when decoding address... */ + rejectFrame(); } } else if (rxread == 3) { // save data sequence number @@ -598,22 +617,17 @@ if (destinationAddressMode == LONG_ADDRESS && rxread == 8 + 5) { /* here we need to check that this address is correct compared to the stored address */ flushPacket = !rxFIFO.tailEquals(memory, RAM_IEEEADDR, 8); + flushPacket |= !rxFIFO.tailEquals(memory, RAM_PANID, 2, 8); decodeAddress = false; } else if (destinationAddressMode == SHORT_ADDRESS && rxread == 2 + 5){ /* should check short address */ flushPacket = !rxFIFO.tailEquals(BC_ADDRESS, 0, 2) && !rxFIFO.tailEquals(memory, RAM_SHORTADDR, 2); + flushPacket |= !rxFIFO.tailEquals(memory, RAM_PANID, 2, 2); decodeAddress = false; } if (flushPacket) { - // Immediately jump to SFD Search again... something more??? - /* reset state */ - rxFIFO.restore(); - // System.out.("Packet rejected by autoaddress Reverting to: " + rxfifoWritePos + - // " len:" + rxfifoLen); - setSFD(false); - setFIFO(rxFIFO.length() > 0); - setState(RadioState.RX_SFD_SEARCH); + rejectFrame(); } } } @@ -649,8 +663,9 @@ if (DEBUG) log("RX: Complete: packetStart: " + rxFIFO.stateToString()); /* if either manual ack request (shouldAck) or autoack + ACK_REQ on package do ack! */ + /* Autoack-mode + good CRC => autoack */ // System.out.println("Autoack " + autoAck + " checkAutoack " + checkAutoack() + " shouldAck " + shouldAck); - if ((autoAck && ackRequest) || shouldAck) { + if ((autoAck && ackRequest && (crc == rxCrc.getCRCBitrev())) || shouldAck) { setState(RadioState.TX_ACK_CALIBRATE); } else { setState(RadioState.RX_WAIT); Modified: mspsim/se/sics/mspsim/plugin/ContikiChecker.java =================================================================== --- mspsim/se/sics/mspsim/plugin/ContikiChecker.java 2011-01-15 00:11:40 UTC (rev 769) +++ mspsim/se/sics/mspsim/plugin/ContikiChecker.java 2011-01-17 12:14:18 UTC (rev 770) @@ -99,10 +99,8 @@ } }; for (int i = 0; i < 0x100; i++) { - cpu.setBreakPoint(i, mon); + cpu.setBreakPoint(i, mon); } - - return 0; } Modified: mspsim/se/sics/mspsim/util/ArrayFIFO.java =================================================================== --- mspsim/se/sics/mspsim/util/ArrayFIFO.java 2011-01-15 00:11:40 UTC (rev 769) +++ mspsim/se/sics/mspsim/util/ArrayFIFO.java 2011-01-17 12:14:18 UTC (rev 770) @@ -123,8 +123,13 @@ public boolean tailEquals(int[] data, int offset, int len) { + return tailEquals(data, offset, len, 0); + } + + + public boolean tailEquals(int[] data, int offset, int len, int ignore) { for (int i = 0; i < len; i++) { - if ((data[offset + i] & 0xff) != get(i - len)) { + if ((data[offset + i] & 0xff) != get(i - len - ignore)) { return false; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2011-01-15 00:11:46
|
Revision: 769 http://mspsim.svn.sourceforge.net/mspsim/?rev=769&view=rev Author: nifi Date: 2011-01-15 00:11:40 +0000 (Sat, 15 Jan 2011) Log Message: ----------- * Clear state after CPU reset (all pending time events have been removed) * Update status value before each read because it is possible to read the status register continuously Modified Paths: -------------- mspsim/se/sics/mspsim/chip/M25P80.java Modified: mspsim/se/sics/mspsim/chip/M25P80.java =================================================================== --- mspsim/se/sics/mspsim/chip/M25P80.java 2011-01-14 23:31:10 UTC (rev 768) +++ mspsim/se/sics/mspsim/chip/M25P80.java 2011-01-15 00:11:40 UTC (rev 769) @@ -42,6 +42,7 @@ package se.sics.mspsim.chip; import java.io.IOException; import se.sics.mspsim.core.*; +import se.sics.mspsim.util.Utils; public abstract class M25P80 extends Chip implements USARTListener, PortListener, Memory { @@ -57,15 +58,17 @@ public static final int BULK_ERASE = 0xc7; public static final int DEEP_POWER_DOWN = 0xb9; public static final int WAKE_UP = 0xab; - + + public static final int STATUS_MASK = 0x9C; + public static final int MEMORY_SIZE = 1024 * 1024; - private int state = 0; public static final int CHIP_SELECT = 0x10; private static final double PROGRAM_PAGE_MILLIS = 1.0; // 0.8 - 5 ms private static final double SECTOR_ERASE_MILLIS = 1400; // 800 - 3 000 ms + private int state = 0; private boolean chipSelect; private int pos; @@ -85,7 +88,7 @@ private byte[] readMemory = new byte[256]; private byte[] buffer = new byte[256]; - private TimeEvent writeEvent = new TimeEvent(0) { + private TimeEvent writeEvent = new TimeEvent(0, "M25P80 Writing") { public void execute(long t) { writing = false; }}; @@ -94,6 +97,15 @@ super("M25P80", "External Flash", cpu); } + @Override + public void notifyReset() { + writing = false; + } + + public int getStatus() { + return status | (writeEnable ? 0x02 : 0x00) | (writing ? 0x01 : 0x00); + } + public void stateChanged(int state) { } @@ -104,7 +116,10 @@ } switch(state) { case READ_STATUS: - source.byteReceived(status); + if (DEBUG) { + log("Read status => " + getStatus() + " from $" + Utils.hex16(cpu.getPC())); + } + source.byteReceived(getStatus()); return; case READ_IDENT: source.byteReceived(identity[pos]); @@ -114,7 +129,7 @@ } return; case WRITE_STATUS: - status = data; + status = data & STATUS_MASK; source.byteReceived(0); return; case READ_DATA: @@ -123,7 +138,7 @@ source.byteReceived(0); pos++; if (DEBUG && pos == 3) { - log("reading from " + Integer.toHexString(readAddress)); + log("reading from $" + Integer.toHexString(readAddress)); } } else { source.byteReceived(readMemory(readAddress++)); @@ -155,7 +170,7 @@ } blockWriteAddress = readAddress & 0xfff00; if (DEBUG) { - log("programming at " + Integer.toHexString(readAddress)); + log("programming at $" + Integer.toHexString(readAddress)); } } } else { @@ -190,13 +205,8 @@ source.byteReceived(0); return; case READ_STATUS: - status = (status & (0xff - 1 - 2)) | (writeEnable ? 0x02 : 0x00) | - (writing ? 0x01 : 0x00); state = READ_STATUS; source.byteReceived(0); - if (DEBUG) { - log("Read status => " + status + " " + cpu.getPC()); - } return; case WRITE_STATUS: if (DEBUG) { @@ -328,7 +338,7 @@ } private void programPage() { - if (writing) logw("Can not set program page while already writing... " + cpu.getPC()); + if (writing) logw("Can not set program page while already writing... from $" + Utils.hex16(cpu.getPC())); writeStatus(PROGRAM_PAGE_MILLIS); ensureLoaded(blockWriteAddress); for (int i = 0; i < readMemory.length; i++) { @@ -348,7 +358,7 @@ blockWriteAddress = sectorAddress; for (int i = 0; i < 0x100; i++) { if (DEBUG) { - log("erasing at " + Integer.toHexString(blockWriteAddress)); + log("erasing at $" + Integer.toHexString(blockWriteAddress)); } writeBack(blockWriteAddress, buffer); blockWriteAddress += 0x100; @@ -360,7 +370,7 @@ try { byte[] tmp = new byte[data.length]; if (DEBUG) { - log("Writing data to disk at " + Integer.toHexString(address)); + log("Writing data to disk at $" + Integer.toHexString(address)); } seek(address & 0xfff00); for (int i = 0; i < data.length; i++) { @@ -380,9 +390,14 @@ public abstract int readFully(byte[] b) throws IOException; public abstract void write(byte[] b) throws IOException; - /* by default - there is not configuratin to return for m25p80 */ + /* by default - there is not configuration to return for m25p80 */ public int getConfiguration(int param) { return 0; } - -} // ExtFlash + + public String info() { + return " Status: " + getStatus() + " Write Enabled: " + writeEnable + + " Write in Progress: " + writing + '\n' + " Chip Select: " + chipSelect; + } + +} // M25P80 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2011-01-14 23:31:16
|
Revision: 768 http://mspsim.svn.sourceforge.net/mspsim/?rev=768&view=rev Author: nifi Date: 2011-01-14 23:31:10 +0000 (Fri, 14 Jan 2011) Log Message: ----------- Added reset notification for chips Modified Paths: -------------- mspsim/se/sics/mspsim/core/Chip.java mspsim/se/sics/mspsim/core/MSP430Core.java Modified: mspsim/se/sics/mspsim/core/Chip.java =================================================================== --- mspsim/se/sics/mspsim/core/Chip.java 2010-12-17 10:26:09 UTC (rev 767) +++ mspsim/se/sics/mspsim/core/Chip.java 2011-01-14 23:31:10 UTC (rev 768) @@ -82,6 +82,9 @@ } } + public void notifyReset() { + } + public void addOperatingModeListener(OperatingModeListener listener) { omListeners = (OperatingModeListener[]) ArrayUtils.add(OperatingModeListener.class, omListeners, listener); } Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2010-12-17 10:26:09 UTC (rev 767) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2011-01-14 23:31:10 UTC (rev 768) @@ -612,6 +612,9 @@ vTimeEventQueue.removeAll(); bcs.reset(); + for (Chip chip : chips) { + chip.notifyReset(); + } // Needs to be last since these can add events... resetIOUnits(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2010-12-17 10:26:16
|
Revision: 767 http://mspsim.svn.sourceforge.net/mspsim/?rev=767&view=rev Author: joxe Date: 2010-12-17 10:26:09 +0000 (Fri, 17 Dec 2010) Log Message: ----------- fixed crc calculation to be done when sending last byte - patch by A.Dunkels Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2010-10-10 21:30:54 UTC (rev 766) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2010-12-17 10:26:09 UTC (rev 767) @@ -990,9 +990,9 @@ private void txNext() { if(txfifoPos <= memory[RAM_TXFIFO]) { - if (txfifoPos == 0) { + int len = memory[RAM_TXFIFO] & 0xff; + if (txfifoPos == len - 1) { txCrc.setCRC(0); - int len = memory[RAM_TXFIFO] & 0xff; for (int i = 1; i < len - 1; i++) { txCrc.addBitrev(memory[RAM_TXFIFO + i] & 0xff); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2010-10-10 21:31:00
|
Revision: 766 http://mspsim.svn.sourceforge.net/mspsim/?rev=766&view=rev Author: joxe Date: 2010-10-10 21:30:54 +0000 (Sun, 10 Oct 2010) Log Message: ----------- added throw command that throws an exception and stops the emulation - useful for stopping COOJA, etc. Modified Paths: -------------- mspsim/se/sics/mspsim/cli/CommandHandler.java mspsim/se/sics/mspsim/cli/DebugCommands.java mspsim/se/sics/mspsim/core/Profiler.java mspsim/se/sics/mspsim/plugin/ContikiChecker.java mspsim/se/sics/mspsim/util/SimpleProfiler.java Modified: mspsim/se/sics/mspsim/cli/CommandHandler.java =================================================================== --- mspsim/se/sics/mspsim/cli/CommandHandler.java 2010-10-07 18:59:56 UTC (rev 765) +++ mspsim/se/sics/mspsim/cli/CommandHandler.java 2010-10-10 21:30:54 UTC (rev 766) @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Hashtable; + +import se.sics.mspsim.core.EmulationException; import se.sics.mspsim.util.ActiveComponent; import se.sics.mspsim.util.ComponentRegistry; import se.sics.mspsim.util.MapTable; @@ -94,6 +96,9 @@ err.println("Error: Command failed: " + e.getMessage()); e.printStackTrace(err); error = true; + if (e instanceof EmulationException) { + throw (EmulationException) e; + } } if (error) { // Stop any commands that have been started Modified: mspsim/se/sics/mspsim/cli/DebugCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/DebugCommands.java 2010-10-07 18:59:56 UTC (rev 765) +++ mspsim/se/sics/mspsim/cli/DebugCommands.java 2010-10-10 21:30:54 UTC (rev 766) @@ -266,6 +266,12 @@ return 0; } }); + ch.registerCommand("throw", new BasicCommand("throw an Emulation Exception", "") { + public int executeCommand(CommandContext context) { + throw new EmulationException(context.getArgument(0)); + } + }); + ch.registerCommand("step", new BasicCommand("single step the CPU", "[number of instructions]") { public int executeCommand(CommandContext context) { int nr = context.getArgumentCount() > 0 ? context.getArgumentAsInt(0) : 1; Modified: mspsim/se/sics/mspsim/core/Profiler.java =================================================================== --- mspsim/se/sics/mspsim/core/Profiler.java 2010-10-07 18:59:56 UTC (rev 765) +++ mspsim/se/sics/mspsim/core/Profiler.java 2010-10-10 21:30:54 UTC (rev 766) @@ -74,4 +74,6 @@ /* function call logging */ public void setLogger(PrintStream out); + public String getCall(int i); + } Modified: mspsim/se/sics/mspsim/plugin/ContikiChecker.java =================================================================== --- mspsim/se/sics/mspsim/plugin/ContikiChecker.java 2010-10-07 18:59:56 UTC (rev 765) +++ mspsim/se/sics/mspsim/plugin/ContikiChecker.java 2010-10-10 21:30:54 UTC (rev 766) @@ -43,6 +43,7 @@ import se.sics.mspsim.cli.BasicAsyncCommand; import se.sics.mspsim.cli.CommandContext; import se.sics.mspsim.cli.CommandHandler; +import se.sics.mspsim.core.CPUMonitor; import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.Profiler; import se.sics.mspsim.profiler.CallListener; @@ -73,12 +74,12 @@ commandHandler.registerCommand("contikichecker", new BasicAsyncCommand("enable the Contiki checker", "") { @Override - public int executeCommand(CommandContext context) { + public int executeCommand(final CommandContext context) { if (profiler != null) { context.err.println("already running"); return 1; } - MSP430 cpu = (MSP430) registry.getComponent(MSP430.class); + final MSP430 cpu = (MSP430) registry.getComponent(MSP430.class); profiler = cpu.getProfiler(); if (profiler == null) { context.err.println("no profiler available"); @@ -86,6 +87,22 @@ } ContikiChecker.this.context = context; profiler.addCallListener(ContikiChecker.this); + + context.out.println("Installing watchpoints..."); + CPUMonitor mon = new CPUMonitor() { + public void cpuAction(int type, int adr, int data) { + if (type == CPUMonitor.MEMORY_WRITE) { + context.out.println("Warning: write to " + adr + + " from " + profiler.getCall(0)); + //profiler.printStackTrace(context.out); + } + } + }; + for (int i = 0; i < 0x100; i++) { + cpu.setBreakPoint(i, mon); + } + + return 0; } @@ -112,12 +129,12 @@ if (callTable.get(init1) == null && (init2 == null || callTable.get(init2) == null)) { // Warning, lookup in case an init function exists if (context.getMapTable().getFunctionAddress(init1) > 0) { - context.err.println("ContikiChecker: warning, " + name + " is called before " + init1); - profiler.printStackTrace(context.err); + //context.err.println("ContikiChecker: warning, " + name + " is called before " + init1); + //profiler.printStackTrace(context.err); addEntry = false; } else if (init2 != null && context.getMapTable().getFunctionAddress(init2) > 0) { - context.err.println("ContikiChecker: warning, " + name + " is called before " + init2); - profiler.printStackTrace(context.err); + //context.err.println("ContikiChecker: warning, " + name + " is called before " + init2); + //profiler.printStackTrace(context.err); addEntry = false; } } Modified: mspsim/se/sics/mspsim/util/SimpleProfiler.java =================================================================== --- mspsim/se/sics/mspsim/util/SimpleProfiler.java 2010-10-07 18:59:56 UTC (rev 765) +++ mspsim/se/sics/mspsim/util/SimpleProfiler.java 2010-10-10 21:30:54 UTC (rev 766) @@ -487,4 +487,8 @@ callListeners = (CallListener[]) ArrayUtils.remove(callListeners, listener); } + + public String getCall(int i) { + return callStack[cSP - i].function.getInfo(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-10-07 19:00:03
|
Revision: 765 http://mspsim.svn.sourceforge.net/mspsim/?rev=765&view=rev Author: nifi Date: 2010-10-07 18:59:56 +0000 (Thu, 07 Oct 2010) Log Message: ----------- Fixed Makefile to include all platforms Modified Paths: -------------- mspsim/Makefile Modified: mspsim/Makefile =================================================================== --- mspsim/Makefile 2010-10-04 13:43:10 UTC (rev 764) +++ mspsim/Makefile 2010-10-07 18:59:56 UTC (rev 765) @@ -71,7 +71,7 @@ SCRIPTS := ${addprefix scripts/,autorun.sc duty.sc} BINARY := README.txt license.txt CHANGE_LOG.txt images/*.jpg firmware/*/*.firmware ${SCRIPTS} -PACKAGES := se/sics/mspsim ${addprefix se/sics/mspsim/,core chip cli debug platform platform/esb platform/sky plugin profiler net ui util extutil/highlight extutil/jfreechart} +PACKAGES := se/sics/mspsim ${addprefix se/sics/mspsim/,core chip cli debug platform ${addprefix platform/,esb sky jcreate sentillausb} plugin profiler net ui util extutil/highlight extutil/jfreechart} SOURCES := ${wildcard *.java $(addsuffix /*.java,$(PACKAGES))} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2010-10-04 13:43:16
|
Revision: 764 http://mspsim.svn.sourceforge.net/mspsim/?rev=764&view=rev Author: joxe Date: 2010-10-04 13:43:10 +0000 (Mon, 04 Oct 2010) Log Message: ----------- optimizations - mainly of flash read checks Modified Paths: -------------- mspsim/se/sics/mspsim/core/Flash.java mspsim/se/sics/mspsim/core/MSP430.java mspsim/se/sics/mspsim/core/MSP430Core.java Modified: mspsim/se/sics/mspsim/core/Flash.java =================================================================== --- mspsim/se/sics/mspsim/core/Flash.java 2010-09-27 20:23:35 UTC (rev 763) +++ mspsim/se/sics/mspsim/core/Flash.java 2010-10-04 13:43:10 UTC (rev 764) @@ -108,7 +108,6 @@ private int statusreg; /* FCTL3 */ private boolean locked; - private boolean busy; private boolean wait; private boolean blocked_cpu; @@ -129,14 +128,12 @@ // Erase flags are automatically cleared after each erase mode = 0; currentWriteMode = WriteMode.NONE; - busy = false; + cpu.isFlashBusy = false; break; case WRITE_SINGLE: - busy = false; + cpu.isFlashBusy = false; // WRT flags are NOT automatically cleared -// mode = 0; -// current_write_mode = WriteMode.WRITE_NONE; break; case WRITE_BLOCK: @@ -158,9 +155,9 @@ log("Programming voltage dropped, write mode disabled."); } currentWriteMode = WriteMode.NONE; - busy = false; + cpu.isFlashBusy = false; wait = true; -// mode = 0; + mode = 0; break; } } @@ -210,7 +207,7 @@ int myfreq; double finish_msec; - busy = true; + cpu.isFlashBusy = true; if (addressInFlash(instr_addr)) { blocked_cpu = true; } @@ -256,7 +253,7 @@ return; } - if (busy || wait == false) { + if (cpu.isFlashBusy || wait == false) { if (!((mode & BLKWRT) != 0 && wait)) { triggerAccessViolation("Flash write prohbited while BUSY=1 or WAIT=0"); return; @@ -335,7 +332,7 @@ } public void notifyRead(int address) { - if (busy) { + if (cpu.isFlashBusy) { triggerAccessViolation("Flash read not allowed while BUSY flag set"); return; } @@ -386,7 +383,7 @@ if (address == FCTL3) { int retval = statusreg | FRKEY; - if (busy) + if (cpu.isFlashBusy) retval |= BUSY; if (locked) @@ -426,7 +423,7 @@ private void triggerEmergencyExit() { mode = 0; - busy = false; + cpu.isFlashBusy = false; wait = true; locked = true; currentWriteMode = WriteMode.NONE; @@ -507,7 +504,7 @@ // access violation while erase/write in progress // exception: block write mode and WAIT==1 // if ((mode & ERASE_MASK) != 0 || (mode & WRT) != 0) { - if (busy && ((mode & BLKWRT) == 0 || wait == false)) { + if (cpu.isFlashBusy && ((mode & BLKWRT) == 0 || wait == false)) { // if (!((mode & BLKWRT) != 0 && wait)) { triggerAccessViolation("FCTL1 write not allowed while erase/write active"); return; @@ -542,7 +539,7 @@ case FCTL2: // access violation if BUSY==1 - if (busy) { + if (cpu.isFlashBusy) { triggerAccessViolation( "Register write to FCTL2 not allowed when busy"); return; @@ -584,7 +581,7 @@ mode = 0; clockcfg = 0x42; - busy = false; + cpu.isFlashBusy = false; wait = true; locked = true; currentWriteMode = WriteMode.NONE; Modified: mspsim/se/sics/mspsim/core/MSP430.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430.java 2010-09-27 20:23:35 UTC (rev 763) +++ mspsim/se/sics/mspsim/core/MSP430.java 2010-10-04 13:43:10 UTC (rev 764) @@ -261,9 +261,8 @@ } - boolean emuOP = false; while (cycles < maxCycles || (cpuOff && (nextEventCycles < cycles))) { - if (emuOP = emulateOP(maxCycles)) { + if (emulateOP(maxCycles)) { if (execCounter != null) { execCounter[reg[PC]]++; } Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2010-09-27 20:23:35 UTC (rev 763) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2010-10-04 13:43:10 UTC (rev 764) @@ -132,6 +132,8 @@ ComponentRegistry registry; Profiler profiler; private Flash flash; + + boolean isFlashBusy; public MSP430Core(int type, ComponentRegistry registry) { super("MSP430", "MSP430 Core", null); @@ -695,7 +697,7 @@ } else { address &= 0xffff; - if (flash.addressInFlash(address)) { + if (isFlashBusy && flash.addressInFlash(address)) { flash.notifyRead(address); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2010-09-27 20:23:41
|
Revision: 763 http://mspsim.svn.sourceforge.net/mspsim/?rev=763&view=rev Author: joxe Date: 2010-09-27 20:23:35 +0000 (Mon, 27 Sep 2010) Log Message: ----------- added emulation exception when writing to PxIN - typically a bug so exception is default - and only - behavior currently Modified Paths: -------------- mspsim/se/sics/mspsim/core/IOPort.java Modified: mspsim/se/sics/mspsim/core/IOPort.java =================================================================== --- mspsim/se/sics/mspsim/core/IOPort.java 2010-09-23 09:13:04 UTC (rev 762) +++ mspsim/se/sics/mspsim/core/IOPort.java 2010-09-27 20:23:35 UTC (rev 763) @@ -134,6 +134,7 @@ if (iAddress == IN) { logw("WARNING: writing to read-only " + getID() + "IN"); + throw new EmulationException("Writing to read-only " + getID() + "IN"); } else { memory[address] = data & 0xff; if (word) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |