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...> - 2008-06-02 10:38:35
|
Revision: 286 http://mspsim.svn.sourceforge.net/mspsim/?rev=286&view=rev Author: joxe Date: 2008-06-02 03:38:12 -0700 (Mon, 02 Jun 2008) Log Message: ----------- bufix on instruction addressing Modified Paths: -------------- mspsim/CHANGE_LOG.txt mspsim/se/sics/mspsim/core/MSP430Core.java Modified: mspsim/CHANGE_LOG.txt =================================================================== --- mspsim/CHANGE_LOG.txt 2008-05-15 19:22:06 UTC (rev 285) +++ mspsim/CHANGE_LOG.txt 2008-06-02 10:38:12 UTC (rev 286) @@ -13,6 +13,8 @@ - added support for file based scripts to the CLI - added configuration system - added connectivity between multiple running mspsim's +- bugfix in instruction emulation thanks to Matt Thompson + (addressing mode - autoincrement byte wrong on PC). 0.90 Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2008-05-15 19:22:06 UTC (rev 285) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2008-06-02 10:38:12 UTC (rev 286) @@ -52,6 +52,7 @@ // Try it out with 64 k memory public static final int MAX_MEM = 64*1024; + public static final int MAX_MEM_IO = 0x200; public static final int INTERNAL_IO_SIZE = 3; public static final int PORTS = 6; @@ -73,9 +74,9 @@ // Most HW needs only notify write and clocking, others need also read... // For notify write... - public IOUnit[] memOut = new IOUnit[MAX_MEM]; + public IOUnit[] memOut = new IOUnit[MAX_MEM_IO]; // For notify read... -> which will happen before actual read! - public IOUnit[] memIn = new IOUnit[MAX_MEM]; + public IOUnit[] memIn = new IOUnit[MAX_MEM_IO]; private IOUnit[] ioUnits; private IOUnit[] passiveIOUnits; @@ -86,7 +87,7 @@ private int lastIOUnitPos = INTERNAL_IO_SIZE; - // From the possible interrupt sources - to be able to indicate iserviced. + // From the possible interrupt sources - to be able to indicate is serviced. private IOUnit interruptSource[] = new IOUnit[16]; private int interruptMax = -1; @@ -613,10 +614,11 @@ breakPoints[dstAddress].cpuAction(CPUMonitor.MEMORY_WRITE, dstAddress, dst); } - if (memOut[dstAddress] != null) { + if (dstAddress <= 0x200 && memOut[dstAddress] != null) { if (!word) dst &= 0xff; memOut[dstAddress].write(dstAddress, dst, word, cycles); } else { + // TODO: add check for Flash / RAM! memory[dstAddress] = dst & 0xff; if (word) { memory[dstAddress + 1] = (dst >> 8) & 0xff; @@ -797,12 +799,26 @@ dstAddress = readRegister(dstRegister); cycles += 3; break; - case AM_IND_AUTOINC: - dstAddress = readRegister(dstRegister); - writeRegister(dstRegister, dstAddress + (word ? 2 : 1)); - cycles += 3; - break; + // Bugfix suggested by Matt Thompson + case AM_IND_AUTOINC: + if(dstRegister == PC) { + dstAddress = readRegister(PC); + pc += 2; + writeRegister(PC, pc); + cycles += 5; + } else { + dstAddress = readRegister(dstRegister); + writeRegister(dstRegister, dstAddress + (word ? 2 : 1)); + cycles += 3; + } + break; } +// case AM_IND_AUTOINC: +// dstAddress = readRegister(dstRegister); +// writeRegister(dstRegister, dstAddress + (word ? 2 : 1)); +// cycles += 3; +// break; +// } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-05-15 19:24:01
|
Revision: 285 http://mspsim.svn.sourceforge.net/mspsim/?rev=285&view=rev Author: nifi Date: 2008-05-15 12:22:06 -0700 (Thu, 15 May 2008) Log Message: ----------- fixed symbol lookup to not require complete match Modified Paths: -------------- mspsim/se/sics/mspsim/util/MapTable.java Modified: mspsim/se/sics/mspsim/util/MapTable.java =================================================================== --- mspsim/se/sics/mspsim/util/MapTable.java 2008-05-13 22:49:19 UTC (rev 284) +++ mspsim/se/sics/mspsim/util/MapTable.java 2008-05-15 19:22:06 UTC (rev 285) @@ -157,7 +157,7 @@ ArrayList<MapEntry> allEntries = new ArrayList<MapEntry>(); for (int address=0; address < entries.length; address++) { MapEntry entry = getEntry(address); - if (entry != null && pattern.matcher(entry.getName()).matches()) { + if (entry != null && pattern.matcher(entry.getName()).find()) { allEntries.add(entry); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-05-13 22:49:21
|
Revision: 284 http://mspsim.svn.sourceforge.net/mspsim/?rev=284&view=rev Author: nifi Date: 2008-05-13 15:49:19 -0700 (Tue, 13 May 2008) Log Message: ----------- increased default window size Modified Paths: -------------- mspsim/se/sics/mspsim/cli/WindowTarget.java Modified: mspsim/se/sics/mspsim/cli/WindowTarget.java =================================================================== --- mspsim/se/sics/mspsim/cli/WindowTarget.java 2008-05-13 22:12:06 UTC (rev 283) +++ mspsim/se/sics/mspsim/cli/WindowTarget.java 2008-05-13 22:49:19 UTC (rev 284) @@ -14,7 +14,7 @@ private JFrame window; private String targetName; // Default in the current version - TODO: replace with better - private JTextArea jta = new JTextArea(40,40); + private JTextArea jta = new JTextArea(40,80); private WindowDataHandler dataHandler = null; public WindowTarget(String name) { @@ -28,7 +28,7 @@ } @Override - public void lineRead(final String line) { + public void lineRead(final String line) { if (line != null && window != null) { SwingUtilities.invokeLater(new Runnable() { public void run() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-05-13 22:12:26
|
Revision: 283 http://mspsim.svn.sourceforge.net/mspsim/?rev=283&view=rev Author: nifi Date: 2008-05-13 15:12:06 -0700 (Tue, 13 May 2008) Log Message: ----------- fixed size font as default Modified Paths: -------------- mspsim/se/sics/mspsim/cli/WindowTarget.java Modified: mspsim/se/sics/mspsim/cli/WindowTarget.java =================================================================== --- mspsim/se/sics/mspsim/cli/WindowTarget.java 2008-05-13 15:21:57 UTC (rev 282) +++ mspsim/se/sics/mspsim/cli/WindowTarget.java 2008-05-13 22:12:06 UTC (rev 283) @@ -18,7 +18,7 @@ private WindowDataHandler dataHandler = null; public WindowTarget(String name) { -// jta.setFont(Font.decode("Courier")); + jta.setFont(Font.decode("Courier")); jta.setEditable(false); window = new JFrame(name); window.getContentPane().add(new JScrollPane(jta, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-05-13 15:22:00
|
Revision: 282 http://mspsim.svn.sourceforge.net/mspsim/?rev=282&view=rev Author: nifi Date: 2008-05-13 08:21:57 -0700 (Tue, 13 May 2008) Log Message: ----------- changed to use separate thread for I/O Modified Paths: -------------- mspsim/se/sics/mspsim/util/NetworkConnection.java Modified: mspsim/se/sics/mspsim/util/NetworkConnection.java =================================================================== --- mspsim/se/sics/mspsim/util/NetworkConnection.java 2008-05-13 15:18:14 UTC (rev 281) +++ mspsim/se/sics/mspsim/util/NetworkConnection.java 2008-05-13 15:21:57 UTC (rev 282) @@ -60,7 +60,8 @@ private final static int DEFAULT_PORT = 4711; private ServerSocket serverSocket = null; - private ArrayList<ConnectionThread> connections = new ArrayList<ConnectionThread>(); + private SendThread sendThread = null; + private ConnectionThread[] connections = null; private PacketListener listener; public NetworkConnection() { @@ -70,6 +71,7 @@ setupServer(DEFAULT_PORT); System.out.println("NetworkConnection: Setup network server..."); } + sendThread = new SendThread(); } // TODO: this should handle several listeners!!! @@ -86,16 +88,15 @@ e.printStackTrace(); } } - + public void run() { System.out.println("NetworkConnection: Accepting new connections..."); while (true) { try { Socket s = serverSocket.accept(); - if (DEBUG) System.out.println("NetworkConnection: New connection accepted..."); - connections.add(new ConnectionThread(s)); + if (DEBUG) System.out.println("NetworkConnection: New connection from " + s.getRemoteSocketAddress()); + connections = (ConnectionThread[]) Utils.add(ConnectionThread.class, connections, new ConnectionThread(s)); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -115,44 +116,25 @@ dataSent(data, source); } } - // Data was sent from the radio in the node (or other node) and should // be sent out to other nodes!!! public void dataSent(byte[] receivedData) { dataSent(receivedData, null); } - + // Data was sent either from radio, or came from another "radio" - // and if so it should be propagated to all others. public void dataSent(byte[] receivedData, ConnectionThread source) { - if (connections.size() > 0) { - ConnectionThread[] cthr = connections.toArray(new ConnectionThread[connections.size()]); - for (int i = 0; i < cthr.length; i++) { - if (cthr[i].isClosed()) { - connections.remove(cthr); - // Do not write back to the source - } else if (cthr[i] != source){ - try { - cthr[i].output.write(receivedData, 0, receivedData.length); - cthr[i].output.flush(); - if (DEBUG) { -// System.out.println("NetworkConnection: wrote " + receivedData.length + " bytes"); - printPacket(receivedData); - } - } catch (IOException e) { - e.printStackTrace(); - cthr[i].close(); - } - } - } + if (connections != null && sendThread != null) { + sendThread.send(receivedData, source); } } - private void printPacket(byte[] data) { - System.out.print("NetworkConnection: "); + private void printPacket(String prefix, byte[] data) { + System.out.print("NetworkConnection: " + prefix); for (int i = 0, len = data.length; i < len; i++) { - System.out.print(Utils.hex8(data[i]) + " "); + System.out.print(' ' + Utils.hex8(data[i])); } System.out.println(); } @@ -160,7 +142,7 @@ private boolean connect(int port) { try { Socket socket = new Socket("127.0.0.1", port); - connections.add(new ConnectionThread(socket)); + connections = (ConnectionThread[]) Utils.add(ConnectionThread.class, connections, new ConnectionThread(socket)); } catch (UnknownHostException e) { return false; } catch (IOException e) { @@ -168,7 +150,75 @@ } return true; } - + + private static class SendEvent { + public final byte[] data; + public final ConnectionThread source; + public SendEvent(byte[] data, ConnectionThread source) { + this.data = data; + this.source = source; + } + } + + class SendThread implements Runnable { + + private ArrayList<SendEvent> queue = new ArrayList<SendEvent>(); + + public SendThread() { + new Thread(this).start(); + } + + public synchronized void send(byte[] receivedData, ConnectionThread source) { + queue.add(new SendEvent(receivedData, source)); + notifyAll(); + } + + public synchronized SendEvent getNext() throws InterruptedException { + while (queue.isEmpty()) { + wait(); + } + return queue.remove(0); + } + + private void sendPacket(SendEvent event) { + ConnectionThread[] cthr = connections; + if (cthr != null) { + for (int i = 0; i < cthr.length; i++) { + if (cthr[i].isClosed()) { + connections = (ConnectionThread[]) Utils.remove(connections, cthr[i]); + // Do not write back to the source + } else if (cthr[i] != event.source){ + try { + cthr[i].output.write(event.data, 0, event.data.length); + cthr[i].output.flush(); + } catch (IOException e) { + e.printStackTrace(); + cthr[i].close(); + } + } + } + if (DEBUG) { +// System.out.println("NetworkConnection: wrote " + receivedData.length + " bytes"); + printPacket("sent", event.data); + } + } + } + + public void run() { + try { + SendEvent event; + do { + event = getNext(); + if (event != null) { + sendPacket(event); + } + } while (event != null); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + class ConnectionThread implements Runnable { Socket socket; DataInputStream input; @@ -207,7 +257,7 @@ input.readFully(buffer, 1, len); if (DEBUG) { // System.out.println("NetworkConnection: Read packet with " + len + " bytes"); - printPacket(buffer); + printPacket("read", buffer); } dataReceived(buffer, this); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-05-13 15:18:29
|
Revision: 281 http://mspsim.svn.sourceforge.net/mspsim/?rev=281&view=rev Author: nifi Date: 2008-05-13 08:18:14 -0700 (Tue, 13 May 2008) Log Message: ----------- changed to restore listening mode before calling the packet listener Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-05-12 18:10:17 UTC (rev 280) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-05-13 15:18:14 UTC (rev 281) @@ -187,6 +187,11 @@ if (DEBUG) { System.out.println(getName() + ": **** Transmitting package to listener (if any)"); } + status &= ~STATUS_TX_ACTIVE; + updateSFDPin(); + if (getMode() == MODE_TXRX_ON) { + setMode(MODE_RX_ON); + } if (packetListener != null) { // First byte is length and is not included in the data buffer (and its length) int len = memory[RAM_TXFIFO]; @@ -196,11 +201,6 @@ } packetListener.transmissionEnded(data); } - status &= ~STATUS_TX_ACTIVE; - updateSFDPin(); - if (getMode() == MODE_TXRX_ON) { - setMode(MODE_RX_ON); - } } }; @@ -218,7 +218,7 @@ if (on && chipSelect) { if (DEBUG) { System.out.println("CC2420 byte received: " + Utils.hex8(data) + - '\'' + (char) data + '\'' + + " (" + ((data >= ' ' && data <= 'Z') ? (char) data : '.') + ')' + " CS: " + chipSelect + " state: " + state); } switch(state) { @@ -328,6 +328,8 @@ } switch (data) { + case REG_SNOP: + break; case REG_SRXON: updateActiveFrequency(); @@ -370,7 +372,7 @@ if (DEBUG) { System.out.println("Unknown strobe command: " + data); } - + break; } } @@ -500,7 +502,7 @@ public void setIncomingPacket(byte[] receivedData) { if (getMode() != MODE_RX_ON) { -// System.out.println(cpu.getTimeMillis() + ": DROPPING"); + if (DEBUG) System.out.println(getName() + ": dropping due to not in listening mode"); } else if (rxPacket) { // Already have a waiting packet if (DEBUG) System.out.println(getName() + ": dropping due to unread packet"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-05-12 18:10:22
|
Revision: 280 http://mspsim.svn.sourceforge.net/mspsim/?rev=280&view=rev Author: nifi Date: 2008-05-12 11:10:17 -0700 (Mon, 12 May 2008) Log Message: ----------- fixed filename matcher to handle several '.' Modified Paths: -------------- mspsim/se/sics/mspsim/chip/FileM25P80.java Modified: mspsim/se/sics/mspsim/chip/FileM25P80.java =================================================================== --- mspsim/se/sics/mspsim/chip/FileM25P80.java 2008-05-12 17:23:29 UTC (rev 279) +++ mspsim/se/sics/mspsim/chip/FileM25P80.java 2008-05-12 18:10:17 UTC (rev 280) @@ -65,7 +65,7 @@ // Open flash file for R/W if (!openFile(filename)) { // Failed to open/lock the specified file. Add a counter and try with next filename. - Matcher m = Pattern.compile("^(.+?)(\\d*)(\\..+)$").matcher(filename); + Matcher m = Pattern.compile("(.+?)(\\d*)(\\.[^.]+)").matcher(filename); if (m.matches()) { String baseName = m.group(1); String c = m.group(2); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-05-12 17:23:47
|
Revision: 279 http://mspsim.svn.sourceforge.net/mspsim/?rev=279&view=rev Author: nifi Date: 2008-05-12 10:23:29 -0700 (Mon, 12 May 2008) Log Message: ----------- Added profiler commands to access profiler data from CLI. Modified Paths: -------------- mspsim/se/sics/mspsim/core/Profiler.java mspsim/se/sics/mspsim/platform/GenericNode.java mspsim/se/sics/mspsim/ui/ControlUI.java mspsim/se/sics/mspsim/util/SimpleProfiler.java mspsim/se/sics/mspsim/util/Test.java Added Paths: ----------- mspsim/se/sics/mspsim/cli/ProfilerCommands.java Added: mspsim/se/sics/mspsim/cli/ProfilerCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/ProfilerCommands.java (rev 0) +++ mspsim/se/sics/mspsim/cli/ProfilerCommands.java 2008-05-12 17:23:29 UTC (rev 279) @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2008, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + * + * ----------------------------------------------------------------- + * + * ProfilerCommands + * + * Authors : Joakim Eriksson, Niclas Finne + * Created : 12 maj 2008 + * Updated : $Date$ + * $Revision$ + */ + +package se.sics.mspsim.cli; +import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.core.Profiler; +import se.sics.mspsim.util.ComponentRegistry; + +/** + * + */ +public class ProfilerCommands implements CommandBundle { + + public void setupCommands(ComponentRegistry registry, CommandHandler ch) { + final MSP430 cpu = (MSP430) registry.getComponent(MSP430.class); + if (cpu != null) { + ch.registerCommand("profiler", new BasicCommand("show profile information", + "[-clear] [regexp]") { + + @Override + public int executeCommand(final CommandContext context) { + Profiler profiler = cpu.getProfiler(); + if (profiler == null) { + context.err.println("No profiler found."); + return 1; + } + if (context.getArgumentCount() > 1) { + context.err.println("Too many arguments. Either clear or show profile information."); + return 1; + } + String namematch = null; + if (context.getArgumentCount() > 0) { + namematch = context.getArgument(0); + if ("-clear".equals(namematch)) { + profiler.clearProfile(); + context.out.println("Cleared profile information."); + return 0; + } + } + profiler.printProfile(context.out, namematch); + return 0; + } + + }); + ch.registerCommand("stacktrace", new BasicCommand("show stack trace", "") { + + @Override + public int executeCommand(CommandContext context) { + Profiler profiler = cpu.getProfiler(); + if (profiler == null) { + context.err.println("No profiler found."); + return 1; + } + profiler.printStackTrace(context.out); + return 0; + } + + }); + } + } + +} Property changes on: mspsim/se/sics/mspsim/cli/ProfilerCommands.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + LF Modified: mspsim/se/sics/mspsim/core/Profiler.java =================================================================== --- mspsim/se/sics/mspsim/core/Profiler.java 2008-05-12 17:19:50 UTC (rev 278) +++ mspsim/se/sics/mspsim/core/Profiler.java 2008-05-12 17:23:29 UTC (rev 279) @@ -40,19 +40,22 @@ */ package se.sics.mspsim.core; +import java.io.PrintStream; import se.sics.mspsim.util.MapEntry; public interface Profiler { public void setCPU(MSP430Core cpu); - + public void profileCall(MapEntry entry, long cycles); public void profileReturn(long cycles); public void clearProfile(); - public void printProfile(); + public void printProfile(PrintStream out); - public void printStackTrace(); - + public void printProfile(PrintStream out, String functionNameRegexp); + + public void printStackTrace(PrintStream out); + } Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2008-05-12 17:19:50 UTC (rev 278) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2008-05-12 17:23:29 UTC (rev 279) @@ -43,6 +43,7 @@ import se.sics.mspsim.cli.CommandHandler; import se.sics.mspsim.cli.DebugCommands; import se.sics.mspsim.cli.MiscCommands; +import se.sics.mspsim.cli.ProfilerCommands; import se.sics.mspsim.cli.WindowCommands; import se.sics.mspsim.core.Chip; import se.sics.mspsim.core.MSP430; @@ -88,9 +89,10 @@ registry.registerComponent("misccmd", new MiscCommands()); registry.registerComponent("statcmd", new StatCommands(cpu, stats)); registry.registerComponent("wincmd", new WindowCommands()); + registry.registerComponent("profilecmd", new ProfilerCommands()); registry.registerComponent("node", this); registry.registerComponent("config", config); - + // Monitor execution cpu.setMonitorExec(true); //cpu.setDebug(true); Modified: mspsim/se/sics/mspsim/ui/ControlUI.java =================================================================== --- mspsim/se/sics/mspsim/ui/ControlUI.java 2008-05-12 17:19:50 UTC (rev 278) +++ mspsim/se/sics/mspsim/ui/ControlUI.java 2008-05-12 17:23:29 UTC (rev 279) @@ -188,7 +188,7 @@ } else if ("Profile Dump".equals(cmd)) { if (cpu.getProfiler() != null) { - cpu.getProfiler().printProfile(); + cpu.getProfiler().printProfile(System.out); } else { System.out.println("*** No profiler available"); } @@ -214,7 +214,7 @@ } } } else if ("Stack Trace".equals(cmd)) { - cpu.getProfiler().printStackTrace(); + cpu.getProfiler().printStackTrace(System.out); } dui.updateRegs(); } Modified: mspsim/se/sics/mspsim/util/SimpleProfiler.java =================================================================== --- mspsim/se/sics/mspsim/util/SimpleProfiler.java 2008-05-12 17:19:50 UTC (rev 278) +++ mspsim/se/sics/mspsim/util/SimpleProfiler.java 2008-05-12 17:23:29 UTC (rev 279) @@ -42,8 +42,10 @@ package se.sics.mspsim.util; import se.sics.mspsim.core.MSP430Core; import se.sics.mspsim.core.Profiler; +import java.io.PrintStream; import java.util.Arrays; import java.util.Hashtable; +import java.util.regex.Pattern; public class SimpleProfiler implements Profiler { @@ -61,7 +63,7 @@ public void setCPU(MSP430Core cpu) { this.cpu = cpu; } - + public void profileCall(MapEntry entry, long cycles) { // System.out.println("Call at: " + Utils.hex16(reg[PC])); if (callStack[cSP] == null) { @@ -91,7 +93,7 @@ public void clearProfile() { if (profileData != null) { CallEntry[] entries = - profileData.values().toArray(new CallEntry[0]); + profileData.values().toArray(new CallEntry[profileData.size()]); for (int i = 0, n = entries.length; i < n; i++) { entries[i].cycles = 0; entries[i].calls = 0; @@ -105,47 +107,56 @@ } } - public void printProfile() { - CallEntry[] entries = - profileData.values().toArray(new CallEntry[0]); + public void printProfile(PrintStream out) { + printProfile(out, null); + } + + public void printProfile(PrintStream out, String functionNameRegexp) { + Pattern pattern = null; + CallEntry[] entries = profileData.values().toArray(new CallEntry[profileData.size()]); Arrays.sort(entries); - System.out.println("************************* Profile Data **************************************"); - System.out.println("Function Average Calls Tot.Cycles"); + out.println("************************* Profile Data **************************************"); + out.println("Function Average Calls Tot.Cycles"); - + if (functionNameRegexp != null && functionNameRegexp.length() > 0) { + pattern = Pattern.compile(functionNameRegexp); + } for (int i = 0, n = entries.length; i < n; i++) { int c = entries[i].calls; if (c > 0) { - String cyclesS = "" + entries[i].cycles; - String callS = "" + c; - String avgS = "" + (c > 0 ? (entries[i].cycles / c) : 0); - System.out.print(entries[i].function.getName()); - printSpace(56 - entries[i].function.getName().length() - avgS.length()); - System.out.print(avgS); - System.out.print(' '); - printSpace(8 - callS.length()); - System.out.print(callS); - System.out.print(' '); - printSpace(10 - cyclesS.length()); - System.out.println(cyclesS); + String functionName = entries[i].function.getName(); + if (pattern == null || pattern.matcher(functionName).find()) { + String cyclesS = "" + entries[i].cycles; + String callS = "" + c; + String avgS = "" + (c > 0 ? (entries[i].cycles / c) : 0); + out.print(functionName); + printSpace(out, 56 - functionName.length() - avgS.length()); + out.print(avgS); + out.print(' '); + printSpace(out, 8 - callS.length()); + out.print(callS); + out.print(' '); + printSpace(out, 10 - cyclesS.length()); + out.println(cyclesS); + } } } } - private void printSpace(int len) { + private void printSpace(PrintStream out, int len) { for (int i = 0; i < len; i++) { - System.out.print(' '); + out.print(' '); } } - public void printStackTrace() { - System.out.println("Stack Trace: number of calls: " + cSP); + public void printStackTrace(PrintStream out) { + out.println("Stack Trace: number of calls: " + cSP); for (int i = 0; i < cSP; i++) { - System.out.println(" " + callStack[cSP - i - 1].function.getInfo()); + out.println(" " + callStack[cSP - i - 1].function.getInfo()); } } - + private static class CallEntry implements Comparable<CallEntry> { MapEntry function; long cycles; Modified: mspsim/se/sics/mspsim/util/Test.java =================================================================== --- mspsim/se/sics/mspsim/util/Test.java 2008-05-12 17:19:50 UTC (rev 278) +++ mspsim/se/sics/mspsim/util/Test.java 2008-05-12 17:23:29 UTC (rev 279) @@ -73,7 +73,7 @@ } else if (line.startsWith("DEBUG")) { cpu.setDebug(true); } else if (line.startsWith("PROFILE")) { - cpu.getProfiler().printProfile(); + cpu.getProfiler().printProfile(System.out); } else if (line.startsWith("CLEARPROFILE")) { cpu.getProfiler().clearProfile(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-05-12 17:20:42
|
Revision: 278 http://mspsim.svn.sourceforge.net/mspsim/?rev=278&view=rev Author: nifi Date: 2008-05-12 10:19:50 -0700 (Mon, 12 May 2008) Log Message: ----------- sort commands by name when showing help Modified Paths: -------------- mspsim/se/sics/mspsim/cli/CommandHandler.java Modified: mspsim/se/sics/mspsim/cli/CommandHandler.java =================================================================== --- mspsim/se/sics/mspsim/cli/CommandHandler.java 2008-05-12 17:11:03 UTC (rev 277) +++ mspsim/se/sics/mspsim/cli/CommandHandler.java 2008-05-12 17:19:50 UTC (rev 278) @@ -7,6 +7,7 @@ import java.io.InterruptedIOException; import java.io.PrintStream; import java.util.ArrayList; +import java.util.Arrays; import java.util.Hashtable; import java.util.Map; @@ -236,9 +237,10 @@ public int executeCommand(CommandContext context) { if (context.getArgumentCount() == 0) { context.out.println("Available commands:"); - for(Map.Entry<String,Command> entry: commands.entrySet()) { - String name = entry.getKey(); - Command command = entry.getValue(); + String[] names = commands.keySet().toArray(new String[commands.size()]); + Arrays.sort(names); + for(String name : names) { + Command command = commands.get(name); String helpText = command.getCommandHelp(name); if (helpText != null) { String argHelp = command.getArgumentHelp(name); @@ -249,13 +251,19 @@ helpText = helpText.substring(0, n); } context.out.print(prefix); - if (prefix.length() < 8) { + + int prefixLen = prefix.length(); + if (prefixLen < 8) { + context.out.print("\t\t\t\t"); + } else if (prefixLen < 16) { + context.out.print("\t\t\t"); + } else if (prefixLen < 24) { + context.out.print("\t\t"); + } else if (prefixLen < 32) { context.out.print('\t'); } - if (prefix.length() < 16) { - context.out.print('\t'); - } - context.out.println("\t " + helpText); + context.out.print(' '); + context.out.println(helpText); } } return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-05-12 17:12:14
|
Revision: 277 http://mspsim.svn.sourceforge.net/mspsim/?rev=277&view=rev Author: nifi Date: 2008-05-12 10:11:03 -0700 (Mon, 12 May 2008) Log Message: ----------- added commands to set font and clear default text area Modified Paths: -------------- mspsim/se/sics/mspsim/cli/WindowTarget.java Modified: mspsim/se/sics/mspsim/cli/WindowTarget.java =================================================================== --- mspsim/se/sics/mspsim/cli/WindowTarget.java 2008-05-12 16:29:30 UTC (rev 276) +++ mspsim/se/sics/mspsim/cli/WindowTarget.java 2008-05-12 17:11:03 UTC (rev 277) @@ -1,5 +1,6 @@ package se.sics.mspsim.cli; +import java.awt.Font; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextArea; @@ -17,6 +18,8 @@ private WindowDataHandler dataHandler = null; public WindowTarget(String name) { +// jta.setFont(Font.decode("Courier")); + jta.setEditable(false); window = new JFrame(name); window.getContentPane().add(new JScrollPane(jta, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)); window.pack(); @@ -74,6 +77,16 @@ } } else if (dataHandler != null) { dataHandler.handleCommand(parts); + } else if ("clear".equals(cmd)) { + jta.setText(""); + } else if ("tabsize".equals(cmd)) { + try { + jta.setTabSize(Integer.parseInt(parts[1])); + } catch (Exception e) { + System.err.println("Could not set tab size: " + line); + } + } else if ("font".equals(cmd)) { + jta.setFont(Font.decode(parts[1])); } } else if (!line.startsWith("#")){ if (dataHandler != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-05-12 16:30:01
|
Revision: 276 http://mspsim.svn.sourceforge.net/mspsim/?rev=276&view=rev Author: nifi Date: 2008-05-12 09:29:30 -0700 (Mon, 12 May 2008) Log Message: ----------- added scrollpane around default text area Modified Paths: -------------- mspsim/se/sics/mspsim/cli/WindowTarget.java Modified: mspsim/se/sics/mspsim/cli/WindowTarget.java =================================================================== --- mspsim/se/sics/mspsim/cli/WindowTarget.java 2008-05-10 21:25:50 UTC (rev 275) +++ mspsim/se/sics/mspsim/cli/WindowTarget.java 2008-05-12 16:29:30 UTC (rev 276) @@ -1,6 +1,7 @@ package se.sics.mspsim.cli; import javax.swing.JFrame; +import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.SwingUtilities; @@ -17,7 +18,7 @@ public WindowTarget(String name) { window = new JFrame(name); - window.getContentPane().add(jta); + window.getContentPane().add(new JScrollPane(jta, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)); window.pack(); window.setVisible(true); targetName = name; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-05-10 21:26:37
|
Revision: 275 http://mspsim.svn.sourceforge.net/mspsim/?rev=275&view=rev Author: joxe Date: 2008-05-10 14:25:50 -0700 (Sat, 10 May 2008) Log Message: ----------- added print of version at start Modified Paths: -------------- mspsim/se/sics/mspsim/platform/GenericNode.java Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2008-05-10 21:23:16 UTC (rev 274) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2008-05-10 21:25:50 UTC (rev 275) @@ -46,6 +46,7 @@ import se.sics.mspsim.cli.WindowCommands; import se.sics.mspsim.core.Chip; import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.core.MSP430Constants; import se.sics.mspsim.extutil.highlight.HighlightSourceViewer; import se.sics.mspsim.ui.ControlUI; import se.sics.mspsim.util.ArgumentManager; @@ -127,6 +128,10 @@ } registry.start(); + + System.out.println("-----------------------------------------------"); + System.out.println("MSPSim " + MSP430Constants.VERSION + " starting firmware: " + firmwareFile); + System.out.println("-----------------------------------------------"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-05-10 21:24:05
|
Revision: 274 http://mspsim.svn.sourceforge.net/mspsim/?rev=274&view=rev Author: joxe Date: 2008-05-10 14:23:16 -0700 (Sat, 10 May 2008) Log Message: ----------- some cleanup Modified Paths: -------------- mspsim/se/sics/mspsim/core/DisAsm.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/util/NetworkConnection.java Modified: mspsim/se/sics/mspsim/core/DisAsm.java =================================================================== --- mspsim/se/sics/mspsim/core/DisAsm.java 2008-05-10 21:12:16 UTC (rev 273) +++ mspsim/se/sics/mspsim/core/DisAsm.java 2008-05-10 21:23:16 UTC (rev 274) @@ -384,10 +384,11 @@ opstr = "AND" + (word ? ".W" : ".B"); break; default: - System.out.println(output + " DoubleOperand not implemented: " + - op + " instruction: " + - Utils.binary16(instruction) + " = " + - Utils.hex16(instruction)); + if (startPC > 0x200) + System.out.println(output + " DoubleOperand not implemented: " + + op + " instruction: " + + Utils.binary16(instruction) + " = " + + Utils.hex16(instruction)); } Modified: mspsim/se/sics/mspsim/core/MSP430Constants.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Constants.java 2008-05-10 21:12:16 UTC (rev 273) +++ mspsim/se/sics/mspsim/core/MSP430Constants.java 2008-05-10 21:23:16 UTC (rev 274) @@ -43,7 +43,7 @@ public interface MSP430Constants { - public static final String VERSION = "0.90"; + public static final String VERSION = "0.91"; public static final int RESET_PUC = 0; public static final int RESET_POR = 1; Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2008-05-10 21:12:16 UTC (rev 273) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2008-05-10 21:23:16 UTC (rev 274) @@ -534,7 +534,6 @@ if (interrupt > interruptMax) { interruptMax = interrupt; if (interruptMax == 15) { - System.out.println("Triggering reset IRQ!!!!!"); // This can not be masked at all! interruptsEnabled = true; } @@ -662,7 +661,7 @@ interruptMax = -1; if (servicedInterrupt == 15) { - System.out.println("**** Servicing RESET! => " + Utils.hex16(pc)); +// System.out.println("**** Servicing RESET! => " + Utils.hex16(pc)); internalReset(); } Modified: mspsim/se/sics/mspsim/core/Timer.java =================================================================== --- mspsim/se/sics/mspsim/core/Timer.java 2008-05-10 21:12:16 UTC (rev 273) +++ mspsim/se/sics/mspsim/core/Timer.java 2008-05-10 21:23:16 UTC (rev 274) @@ -319,9 +319,6 @@ case TCCR6: i = (index - TCCR0) / 2; val = tccr[i]; - if (i == 2) { - System.out.println("Read CCR2: " + val); - } break; default: System.out.println("Not supported read, returning zero!!!"); @@ -441,7 +438,7 @@ triggerInterrupts(); - if (DEBUG || index == 2) { + if (DEBUG) { System.out.println(getName() + " Write: CCTL" + index + ": => " + Utils.hex16(data) + " CM: " + capNames[capMode[index]] + @@ -614,10 +611,6 @@ // Write the expected capture time to the register (counter could // differ slightly) tccr[i] = expCompare[i]; - if (i == 2) { - updateCounter(cycles); - System.out.println("CCR2 set to: " + tccr[i] + " should be " + counter); - } // Update capture times... for next capture expCompare[i] = (expCompare[i] + expCapInterval[i]) & 0xffff; expCaptureTime[i] += expCapInterval[i] * cyclesMultiplicator; Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2008-05-10 21:12:16 UTC (rev 273) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2008-05-10 21:23:16 UTC (rev 274) @@ -112,6 +112,12 @@ cpu.reset(); setupNode(); + if (args.length > 1) { + MapTable map = new MapTable(args[1]); + cpu.getDisAsm().setMap(map); + registry.registerComponent("mapTable", map); + } + if (!config.getPropertyAsBoolean("nogui", false)) { // Setup control and other UI components ControlUI control = new ControlUI(registry); @@ -119,11 +125,6 @@ // sourceViewer.addSearchPath(new File("../../contiki-2.x/examples/energest-demo/")); control.setSourceViewer(sourceViewer); } - if (args.length > 1) { - MapTable map = new MapTable(args[1]); - cpu.getDisAsm().setMap(map); - registry.registerComponent("mapTable", map); - } registry.start(); } Modified: mspsim/se/sics/mspsim/util/NetworkConnection.java =================================================================== --- mspsim/se/sics/mspsim/util/NetworkConnection.java 2008-05-10 21:12:16 UTC (rev 273) +++ mspsim/se/sics/mspsim/util/NetworkConnection.java 2008-05-10 21:23:16 UTC (rev 274) @@ -162,12 +162,8 @@ Socket socket = new Socket("127.0.0.1", port); connections.add(new ConnectionThread(socket)); } catch (UnknownHostException e) { - // TODO Auto-generated catch block - e.printStackTrace(); return false; } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); return false; } return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-05-10 21:12:45
|
Revision: 273 http://mspsim.svn.sourceforge.net/mspsim/?rev=273&view=rev Author: joxe Date: 2008-05-10 14:12:16 -0700 (Sat, 10 May 2008) Log Message: ----------- updated changelog Modified Paths: -------------- mspsim/CHANGE_LOG.txt Modified: mspsim/CHANGE_LOG.txt =================================================================== --- mspsim/CHANGE_LOG.txt 2008-05-08 21:28:40 UTC (rev 272) +++ mspsim/CHANGE_LOG.txt 2008-05-10 21:12:16 UTC (rev 273) @@ -1,3 +1,20 @@ +0.91 +Changes: +- added window system and support for it in the CLI +- added two chart types for the windows subsystem +- added redirect to windows in the CLI +- added memory dump for both std out and Windows +- improved CC2420 emulation +- added CLI commands +- reimplemented reset of the CPU +- improved support for Digital IO Ports +- added working ADC12 subsystem +- added watchdog WDT subsystem +- added support for file based scripts to the CLI +- added configuration system +- added connectivity between multiple running mspsim's + + 0.90 Changes: - fixed multiplier to handle the different modes better. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-05-08 21:29:02
|
Revision: 272 http://mspsim.svn.sourceforge.net/mspsim/?rev=272&view=rev Author: joxe Date: 2008-05-08 14:28:40 -0700 (Thu, 08 May 2008) Log Message: ----------- Basic version of Watchdog implemented. Modified Paths: -------------- mspsim/se/sics/mspsim/core/EventQueue.java mspsim/se/sics/mspsim/core/MSP430Core.java mspsim/se/sics/mspsim/core/TimeEvent.java mspsim/se/sics/mspsim/core/Timer.java mspsim/se/sics/mspsim/core/Watchdog.java Modified: mspsim/se/sics/mspsim/core/EventQueue.java =================================================================== --- mspsim/se/sics/mspsim/core/EventQueue.java 2008-05-07 16:52:26 UTC (rev 271) +++ mspsim/se/sics/mspsim/core/EventQueue.java 2008-05-08 21:28:40 UTC (rev 272) @@ -56,8 +56,8 @@ } public void addEvent(TimeEvent event) { - if (event.scheduled) { - removeEvent(event); + if (event.scheduledIn != null) { + event.remove(); } if (first == null) { first = event; @@ -84,7 +84,7 @@ } else { nextTime = 0; } - event.scheduled = true; + event.scheduledIn = this; eventCount++; } @@ -117,7 +117,7 @@ } // System.out.println("Removed =>"); // print(); - event.scheduled = false; + event.scheduledIn = null; eventCount--; return true; } @@ -135,7 +135,8 @@ } else { nextTime = 0; } - tmp.scheduled = false; + // No longer scheduled! + tmp.scheduledIn = null; eventCount--; return tmp; } @@ -147,7 +148,7 @@ t = t.nextEvent; clr.nextEvent = null; clr.time = 0; - clr.scheduled = false; + clr.scheduledIn = null; } first = null; eventCount = 0; Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2008-05-07 16:52:26 UTC (rev 271) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2008-05-08 21:28:40 UTC (rev 272) @@ -455,10 +455,11 @@ * @param event * @param time */ - public void scheduleTimeEventMillis(TimeEvent event, double msec) { + public long scheduleTimeEventMillis(TimeEvent event, double msec) { long time = (long) (getTime() + msec / 1000 * BasicClockModule.MAX_DCO_FRQ); // System.out.println("Scheduling at: " + time + " (" + msec + ") getTime: " + getTime()); scheduleTimeEvent(event, time); + return time; } Modified: mspsim/se/sics/mspsim/core/TimeEvent.java =================================================================== --- mspsim/se/sics/mspsim/core/TimeEvent.java 2008-05-07 16:52:26 UTC (rev 271) +++ mspsim/se/sics/mspsim/core/TimeEvent.java 2008-05-08 21:28:40 UTC (rev 272) @@ -45,7 +45,9 @@ // For linking events... TimeEvent nextEvent; TimeEvent prevEvent; - boolean scheduled = false; + + // Keeps track of where this is scheduled + EventQueue scheduledIn = null; String name; protected long time; @@ -63,6 +65,17 @@ return time; } + public boolean isScheduled() { + return scheduledIn != null; + } + + public boolean remove() { + if (scheduledIn != null) { + return scheduledIn.removeEvent(this); + } + return false; + } + public abstract void execute(long t); public String getShort() { Modified: mspsim/se/sics/mspsim/core/Timer.java =================================================================== --- mspsim/se/sics/mspsim/core/Timer.java 2008-05-07 16:52:26 UTC (rev 271) +++ mspsim/se/sics/mspsim/core/Timer.java 2008-05-08 21:28:40 UTC (rev 272) @@ -666,7 +666,7 @@ time = cycles + 1000; } - if (!timerTrigger.scheduled) { + if (timerTrigger.scheduledIn == null) { // System.out.println(getName() + " new trigger (nothing sch) ..." + time + " re:" + // smallest + " => " + (smallest > 0 ? expCaptureTime[smallest] + " > " + expCompare[smallest]: // nextTimerTrigger) + " C:"+ cycles); Modified: mspsim/se/sics/mspsim/core/Watchdog.java =================================================================== --- mspsim/se/sics/mspsim/core/Watchdog.java 2008-05-07 16:52:26 UTC (rev 271) +++ mspsim/se/sics/mspsim/core/Watchdog.java 2008-05-08 21:28:40 UTC (rev 272) @@ -40,12 +40,15 @@ */ package se.sics.mspsim.core; +import se.sics.mspsim.util.Utils; + /** * @author joakim * */ public class Watchdog extends IOUnit { - + private static final boolean DEBUG = false; + private static final int WDTCTL = 0x120; private static final int WDTHOLD = 0x80; @@ -55,10 +58,23 @@ private static final int RESET_VECTOR = 15; + private static final int[] DELAY = { + 32768, 8192, 512, 64 + }; + private int wdtctl; private boolean wdtOn = true; + private boolean hold = false; private MSP430Core cpu; + // The current "delay" when started/clered (or hold) + private int delay; + // The target time for this timer + private long targetTime; + // Timer ACLK + private boolean sourceACLK = false; + + private TimeEvent wdtTrigger = new TimeEvent(0) { public void execute(long t) { // System.out.println(getName() + " **** executing update timers at " + t + " cycles=" + core.cycles); @@ -83,7 +99,8 @@ private void triggerWDT(long time) { // Here the WDT triggered!!! -// System.out.println("WDT trigger - should reset?!?!"); + System.out.println("WDT trigger - should reset?!?!"); + cpu.flagInterrupt(RESET_VECTOR, this, true); } public int read(int address, boolean word, long cycles) { @@ -95,16 +112,33 @@ public void write(int address, int value, boolean word, long cycles) { if (address == WDTCTL) { if ((value >> 8) == 0x5a) { -// System.out.println("Wrote to WDTCTL: " + Utils.hex8(wdtctl)); wdtctl = value & 0xff; + if (DEBUG) System.out.println(getName() + " Wrote to WDTCTL: " + Utils.hex8(wdtctl)); // Is it on? wdtOn = (value & 0x80) == 0; + boolean lastACLK = sourceACLK; + sourceACLK = (value & WDTSSEL) != 0; if ((value & WDTCNTCL) != 0) { - // Clear timer - reschedule the event! + // Clear timer => reset the delay + delay = DELAY[value & WDTISx]; } + // Start it if it should be started! + if (wdtOn) { + if (DEBUG) System.out.println("Setting WDTCNT to count: " + delay); + if (sourceACLK) { + if (DEBUG) System.out.println("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"); + cpu.scheduleCycleEvent(wdtTrigger, targetTime = cpu.cycles + delay); + } + } else { + // Stop it and remember current "delay" left! + wdtTrigger.remove(); + } } else { // Trigger reset!! -// System.out.println("WDTCTL: illegal write - should reset!!!! " + value); +// System.out.println("WDTCTL: illegal write - should reset!!!! " + value); cpu.flagInterrupt(RESET_VECTOR, this, true); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-05-07 16:52:41
|
Revision: 271 http://mspsim.svn.sourceforge.net/mspsim/?rev=271&view=rev Author: nifi Date: 2008-05-07 09:52:26 -0700 (Wed, 07 May 2008) Log Message: ----------- Eclipse Added Paths: ----------- mspsim/.settings/ mspsim/.settings/org.eclipse.jdt.ui.prefs Added: mspsim/.settings/org.eclipse.jdt.ui.prefs =================================================================== --- mspsim/.settings/org.eclipse.jdt.ui.prefs (rev 0) +++ mspsim/.settings/org.eclipse.jdt.ui.prefs 2008-05-07 16:52:26 UTC (rev 271) @@ -0,0 +1,50 @@ +#Wed May 07 17:48:50 CEST 2008 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=false +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-05-07 16:25:49
|
Revision: 269 http://mspsim.svn.sourceforge.net/mspsim/?rev=269&view=rev Author: nifi Date: 2008-05-07 09:16:15 -0700 (Wed, 07 May 2008) Log Message: ----------- added add/remove util methods for arrays Modified Paths: -------------- mspsim/se/sics/mspsim/util/Utils.java Modified: mspsim/se/sics/mspsim/util/Utils.java =================================================================== --- mspsim/se/sics/mspsim/util/Utils.java 2008-04-28 18:01:55 UTC (rev 268) +++ mspsim/se/sics/mspsim/util/Utils.java 2008-05-07 16:16:15 UTC (rev 269) @@ -75,8 +75,41 @@ return s; } - public static void main(String[] args) { - System.out.println("Hex 47 = " + hex8(47)); + public static Object[] add(Class<?> componentType, Object[] array, Object value) { + Object[] tmp; + if (array == null) { + tmp = (Object[]) java.lang.reflect.Array.newInstance(componentType, 1); + } else { + tmp = (Object[]) java.lang.reflect.Array.newInstance(componentType, array.length + 1); + System.arraycopy(array, 0, tmp, 0, array.length); + } + tmp[tmp.length - 1] = value; + return tmp; } + public static Object[] remove(Object[] array, Object value) { + if (array != null) { + for (int index = 0, n = array.length; index < n; index++) { + if (value.equals(array[index])) { + if (n == 1) { + return null; + } + Object[] tmp = (Object[]) java.lang.reflect.Array.newInstance(array.getClass().getComponentType(), array.length - 1); + if (index > 0) { + System.arraycopy(array, 0, tmp, 0, index); + } + if (index < tmp.length) { + System.arraycopy(array, index + 1, tmp, index, tmp.length - index); + } + return tmp; + } + } + } + return array; + } + +// public static void main(String[] args) { +// System.out.println("Hex 47 = " + hex8(47)); +// } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-05-07 16:25:20
|
Revision: 270 http://mspsim.svn.sourceforge.net/mspsim/?rev=270&view=rev Author: nifi Date: 2008-05-07 09:20:07 -0700 (Wed, 07 May 2008) Log Message: ----------- moved the mode handling to Chip and added getMode() Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java mspsim/se/sics/mspsim/chip/TR1001.java mspsim/se/sics/mspsim/core/Chip.java mspsim/se/sics/mspsim/core/MSP430Core.java mspsim/se/sics/mspsim/platform/sky/SkyNode.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-05-07 16:16:15 UTC (rev 269) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-05-07 16:20:07 UTC (rev 270) @@ -124,7 +124,7 @@ public static final int MODE_RX_ON = 0x01; public static final int MODE_TXRX_ON = 0x02; public static final int MODE_MAX = MODE_TXRX_ON; - public static final String[] MODE_NAMES = new String[] { + private static final String[] MODE_NAMES = new String[] { "off", "listen", "transmit" }; @@ -155,8 +155,6 @@ private int status = STATUS_XOSC16M_STABLE | STATUS_RSSI_VALID; - private int mode = MODE_TXRX_OFF; - private int[] registers = new int[64]; // More than needed... private int[] memory = new int[512]; @@ -200,7 +198,7 @@ } status &= ~STATUS_TX_ACTIVE; updateSFDPin(); - if (mode == MODE_TXRX_ON) { + if (getMode() == MODE_TXRX_ON) { setMode(MODE_RX_ON); } } @@ -213,6 +211,7 @@ registers[REG_TXCTRL] = 0xa0ff; this.cpu = cpu; setModeNames(MODE_NAMES); + setMode(MODE_TXRX_OFF); } public void dataReceived(USART source, int data) { @@ -448,12 +447,6 @@ } } - private void setMode(int mode) { -// System.out.println(cpu.getTimeMillis() + ": MODE " + getModeName(mode)); - this.mode = mode; - modeChanged(mode); - } - public void setPacketListener(PacketListener listener) { packetListener = listener; } @@ -506,7 +499,7 @@ } public void setIncomingPacket(byte[] receivedData) { - if (mode != MODE_RX_ON) { + if (getMode() != MODE_RX_ON) { // System.out.println(cpu.getTimeMillis() + ": DROPPING"); } else if (rxPacket) { // Already have a waiting packet Modified: mspsim/se/sics/mspsim/chip/TR1001.java =================================================================== --- mspsim/se/sics/mspsim/chip/TR1001.java 2008-05-07 16:16:15 UTC (rev 269) +++ mspsim/se/sics/mspsim/chip/TR1001.java 2008-05-07 16:20:07 UTC (rev 270) @@ -54,7 +54,6 @@ public static final int MODE_MAX = MODE_TXRX_ON; private final USART usart; - private int mode; public TR1001(USART usart) { this.usart = usart; @@ -65,20 +64,17 @@ return "TR1001"; } + public void setMode(int mode) { + super.setMode(mode); + } + @Override public int getModeMax() { return MODE_MAX; } - public void setMode(int mode) { - if (this.mode != mode) { - this.mode = mode; - modeChanged(mode); - } - } - @Override public void dataReceived(USART source, int data) { } - + } Modified: mspsim/se/sics/mspsim/core/Chip.java =================================================================== --- mspsim/se/sics/mspsim/core/Chip.java 2008-05-07 16:16:15 UTC (rev 269) +++ mspsim/se/sics/mspsim/core/Chip.java 2008-05-07 16:20:07 UTC (rev 270) @@ -39,8 +39,7 @@ * $Revision$ */ package se.sics.mspsim.core; -import java.util.ArrayList; -import java.util.Iterator; +import se.sics.mspsim.util.Utils; /** * @author Joakim @@ -48,40 +47,45 @@ */ public abstract class Chip { - private ArrayList<OperatingModeListener> omListeners; + private OperatingModeListener[] omListeners; private String[] modeNames = null; + private int mode; public void addOperatingModeListener(OperatingModeListener listener) { - if (omListeners == null) - omListeners = new ArrayList<OperatingModeListener>(); - omListeners.add(listener); + omListeners = (OperatingModeListener[]) Utils.add(OperatingModeListener.class, omListeners, listener); } public void removeOperatingModeListener(OperatingModeListener listener) { - if (omListeners != null) - omListeners.remove(listener); + omListeners = (OperatingModeListener[]) Utils.remove(omListeners, listener); } - - protected void modeChanged(int mode) { - if (omListeners != null) { - for (Iterator<OperatingModeListener> iterator = omListeners.iterator(); iterator.hasNext();) { - OperatingModeListener type = iterator.next(); - type.modeChanged(this, mode); + + public int getMode() { + return mode; + } + + protected void setMode(int mode) { + if (mode != this.mode) { + this.mode = mode; + OperatingModeListener[] listeners = omListeners; + if (listeners != null) { + for (int i = 0, n = listeners.length; i < n; i++) { + listeners[i].modeChanged(this, mode); + } } } } - + protected void setModeNames(String[] names) { modeNames = names; } - + public String getModeName(int index) { if (modeNames == null) { return null; } return modeNames[index]; } - + public int getModeByName(String mode) { if (modeNames != null) { for (int i = 0; i < modeNames.length; i++) { @@ -90,14 +94,13 @@ } try { // If it is just an int it can be parsed! - System.out.println("Parsing as int: " + mode); int modei = Integer.parseInt(mode); return modei; } catch (Exception e) { } return -1; } - + public abstract String getName(); public abstract int getModeMax(); } Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2008-05-07 16:16:15 UTC (rev 269) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2008-05-07 16:20:07 UTC (rev 270) @@ -296,18 +296,18 @@ boolean scg1 = (value & SCG1) == SCG1; boolean oscoff = (value & OSCOFF) == OSCOFF; if (oscoff && scg1 && scg0) { - modeChanged(MODE_LPM4); + setMode(MODE_LPM4); } else if (scg1 && scg0){ - modeChanged(MODE_LPM3); + setMode(MODE_LPM3); } else if (scg1) { - modeChanged(MODE_LPM2); + setMode(MODE_LPM2); } else if (scg0) { - modeChanged(MODE_LPM1); + setMode(MODE_LPM1); } else { - modeChanged(MODE_LPM0); + setMode(MODE_LPM0); } } else { - modeChanged(MODE_ACTIVE); + setMode(MODE_ACTIVE); } } } Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-05-07 16:16:15 UTC (rev 269) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-05-07 16:20:07 UTC (rev 270) @@ -55,7 +55,6 @@ import se.sics.mspsim.extutil.jfreechart.DataChart; import se.sics.mspsim.extutil.jfreechart.DataSourceSampler; import se.sics.mspsim.platform.GenericNode; -//import se.sics.mspsim.util.ArgumentManager; import se.sics.mspsim.util.ArgumentManager; import se.sics.mspsim.util.ELF; import se.sics.mspsim.util.NetworkConnection; @@ -109,7 +108,6 @@ public boolean redLed; public boolean blueLed; public boolean greenLed; - private int mode = MODE_LEDS_OFF; public SkyGui gui; /** @@ -117,6 +115,7 @@ * */ public SkyNode() { + setMode(MODE_LEDS_OFF); } public void setButton(boolean hi) { @@ -153,10 +152,7 @@ blueLed = (data & BLUE_LED) == 0; greenLed = (data & GREEN_LED) == 0; int newMode = (redLed ? 1 : 0) + (greenLed ? 1 : 0) + (blueLed ? 1 : 0); - if (mode != newMode) { - mode = newMode; - modeChanged(mode); - } + setMode(newMode); if (gui != null) { gui.repaint(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-04-28 18:03:03
|
Revision: 268 http://mspsim.svn.sourceforge.net/mspsim/?rev=268&view=rev Author: nifi Date: 2008-04-28 11:01:55 -0700 (Mon, 28 Apr 2008) Log Message: ----------- added preamble to transmission time Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-04-25 15:02:17 UTC (rev 267) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-04-28 18:01:55 UTC (rev 268) @@ -434,7 +434,7 @@ private void transmitPacket() { int len = memory[RAM_TXFIFO]; int kBps = 250000 / 8; - double time = 1.0 * (len + 1) / kBps; + double time = 1.0 * (4 + 1 + 1 + len) / kBps; if (DEBUG) { System.out.println(getName() + " Transmitting " + len + " bytes => " + time + " sec"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-04-25 15:02:34
|
Revision: 267 http://mspsim.svn.sourceforge.net/mspsim/?rev=267&view=rev Author: nifi Date: 2008-04-25 08:02:17 -0700 (Fri, 25 Apr 2008) Log Message: ----------- removed debug output Modified Paths: -------------- mspsim/se/sics/mspsim/util/NetworkConnection.java Modified: mspsim/se/sics/mspsim/util/NetworkConnection.java =================================================================== --- mspsim/se/sics/mspsim/util/NetworkConnection.java 2008-04-25 14:54:01 UTC (rev 266) +++ mspsim/se/sics/mspsim/util/NetworkConnection.java 2008-04-25 15:02:17 UTC (rev 267) @@ -56,15 +56,13 @@ */ public class NetworkConnection implements Runnable { - private final static boolean DEBUG = true; + private final static boolean DEBUG = false; private final static int DEFAULT_PORT = 4711; - - ServerSocket serverSocket = null; - - ArrayList<ConnectionThread> connections = new ArrayList<ConnectionThread>(); - + + private ServerSocket serverSocket = null; + private ArrayList<ConnectionThread> connections = new ArrayList<ConnectionThread>(); private PacketListener listener; - + public NetworkConnection() { if (connect(DEFAULT_PORT)) { System.out.println("NetworkConnection: Connected to network..."); @@ -137,8 +135,9 @@ } else if (cthr[i] != source){ try { cthr[i].output.write(receivedData, 0, receivedData.length); + cthr[i].output.flush(); if (DEBUG) { - System.out.println("NetworkConnection: wrote " + receivedData.length + " bytes"); +// System.out.println("NetworkConnection: wrote " + receivedData.length + " bytes"); printPacket(receivedData); } } catch (IOException e) { @@ -151,6 +150,7 @@ } private void printPacket(byte[] data) { + System.out.print("NetworkConnection: "); for (int i = 0, len = data.length; i < len; i++) { System.out.print(Utils.hex8(data[i]) + " "); } @@ -210,7 +210,7 @@ buffer[0] = (byte) (len & 0xff); input.readFully(buffer, 1, len); if (DEBUG) { - System.out.println("NetworkConnection: Read packet with " + len + " bytes"); +// System.out.println("NetworkConnection: Read packet with " + len + " bytes"); printPacket(buffer); } dataReceived(buffer, this); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-04-25 14:54:10
|
Revision: 266 http://mspsim.svn.sourceforge.net/mspsim/?rev=266&view=rev Author: nifi Date: 2008-04-25 07:54:01 -0700 (Fri, 25 Apr 2008) Log Message: ----------- changed to set rx-mode after transmission + not to replace existing packet during reception Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-04-24 22:04:23 UTC (rev 265) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-04-25 14:54:01 UTC (rev 266) @@ -200,6 +200,9 @@ } status &= ~STATUS_TX_ACTIVE; updateSFDPin(); + if (mode == MODE_TXRX_ON) { + setMode(MODE_RX_ON); + } } }; @@ -431,7 +434,7 @@ private void transmitPacket() { int len = memory[RAM_TXFIFO]; int kBps = 250000 / 8; - double time = 1.0 * len / kBps; + double time = 1.0 * (len + 1) / kBps; if (DEBUG) { System.out.println(getName() + " Transmitting " + len + " bytes => " + time + " sec"); } @@ -446,6 +449,7 @@ } private void setMode(int mode) { +// System.out.println(cpu.getTimeMillis() + ": MODE " + getModeName(mode)); this.mode = mode; modeChanged(mode); } @@ -501,21 +505,27 @@ registers[register] = data; } - // Length is not assumed to be and no CRC?! public void setIncomingPacket(byte[] receivedData) { - int adr = RAM_RXFIFO; - // length of packet is data size + RSSI and CRC/Correlation! - for (byte element: receivedData) { - memory[adr++] = element & 0xff; + if (mode != MODE_RX_ON) { +// System.out.println(cpu.getTimeMillis() + ": DROPPING"); + } else if (rxPacket) { + // Already have a waiting packet + if (DEBUG) System.out.println(getName() + ": dropping due to unread packet"); + } else { + int adr = RAM_RXFIFO; + // length of packet is data size + RSSI and CRC/Correlation! + for (byte element: receivedData) { + memory[adr++] = element & 0xff; + } + // Should take a RSSI value as input or use a set-RSSI value... + memory[adr - 2] = (registers[REG_RSSI]) & 0xff; + // Set CRC ok and add a correlation + memory[adr - 1] = 37 | 0x80; + rxPacket = true; + rxCursor = 0; + rxLen = adr; + updateFifopPin(); } - // Should take a RSSI value as input or use a set-RSSI value... - memory[adr - 2] = (registers[REG_RSSI]) & 0xff; - // Set CRC ok and add a correlation - memory[adr - 1] = 37 | 0x80; - rxPacket = true; - rxCursor = 0; - rxLen = adr; - updateFifopPin(); } private void flushRX() { @@ -555,5 +565,4 @@ return MODE_MAX; } - } // CC2420 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-04-24 22:04:47
|
Revision: 265 http://mspsim.svn.sourceforge.net/mspsim/?rev=265&view=rev Author: nifi Date: 2008-04-24 15:04:23 -0700 (Thu, 24 Apr 2008) Log Message: ----------- CC2420 and packet radio API cleanup Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java mspsim/se/sics/mspsim/chip/PacketListener.java mspsim/se/sics/mspsim/platform/sky/SkyGui.java mspsim/se/sics/mspsim/platform/sky/SkyNode.java mspsim/se/sics/mspsim/util/NetworkConnection.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-04-24 15:29:13 UTC (rev 264) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-04-24 22:04:23 UTC (rev 265) @@ -192,8 +192,10 @@ if (packetListener != null) { // First byte is length and is not included in the data buffer (and its length) int len = memory[RAM_TXFIFO]; - int[] data = new int[len]; - System.arraycopy(memory, RAM_TXFIFO + 1, data, 0, len); + byte[] data = new byte[len + 1]; + for (int i = 0, n = data.length; i < n; i++) { + data[i] = (byte) (memory[RAM_TXFIFO + i] & 0xff); + } packetListener.transmissionEnded(data); } status &= ~STATUS_TX_ACTIVE; @@ -500,21 +502,16 @@ } // Length is not assumed to be and no CRC?! - public void setIncomingPacket(int[] packet) { - setIncomingPacket(packet, 0, packet.length); - } - - public void setIncomingPacket(int[] packet, int start, int end) { + public void setIncomingPacket(byte[] receivedData) { int adr = RAM_RXFIFO; // length of packet is data size + RSSI and CRC/Correlation! - memory[adr++] = end - start + 2; - for (int i = start; i < end; i++) { - memory[adr++] = packet[i] & 0xff; + for (byte element: receivedData) { + memory[adr++] = element & 0xff; } // Should take a RSSI value as input or use a set-RSSI value... - memory[adr++] = (registers[REG_RSSI]) & 0xff; + memory[adr - 2] = (registers[REG_RSSI]) & 0xff; // Set CRC ok and add a correlation - memory[adr++] = (37) | 0x80; + memory[adr - 1] = 37 | 0x80; rxPacket = true; rxCursor = 0; rxLen = adr; Modified: mspsim/se/sics/mspsim/chip/PacketListener.java =================================================================== --- mspsim/se/sics/mspsim/chip/PacketListener.java 2008-04-24 15:29:13 UTC (rev 264) +++ mspsim/se/sics/mspsim/chip/PacketListener.java 2008-04-24 22:04:23 UTC (rev 265) @@ -40,5 +40,5 @@ public interface PacketListener { public void transmissionStarted(); - public void transmissionEnded(int[] receivedData); + public void transmissionEnded(byte[] receivedData); } Modified: mspsim/se/sics/mspsim/platform/sky/SkyGui.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyGui.java 2008-04-24 15:29:13 UTC (rev 264) +++ mspsim/se/sics/mspsim/platform/sky/SkyGui.java 2008-04-24 22:04:23 UTC (rev 265) @@ -183,9 +183,6 @@ // System.out.println("Key Pressed: " + key.getKeyChar()); if (key.getKeyChar() == 'd') { node.setDebug(!node.getDebug()); - } else if (key.getKeyChar() == 'r') { - System.out.println("Setting incoming radio packet..."); - node.radioIncomingPacket(new int[] {11,0,42,0,'H','e','j','s','a','n'}); } } Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-04-24 15:29:13 UTC (rev 264) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-04-24 22:04:23 UTC (rev 265) @@ -176,11 +176,6 @@ flash.dataReceived(source, data); } - - public void radioIncomingPacket(int[] data) { - radio.setIncomingPacket(data); - } - public int getModeMax() { return MODE_MAX; } @@ -258,15 +253,15 @@ network = new NetworkConnection(); network.addPacketListener(new PacketListener() { - public void transmissionEnded(int[] receivedData) { - radio.setIncomingPacket(receivedData, 0, receivedData.length - 2); + public void transmissionEnded(byte[] receivedData) { + radio.setIncomingPacket(receivedData); } public void transmissionStarted() { } }); // TODO: remove this test... radio.setPacketListener(new PacketListener() { - public void transmissionEnded(int[] receivedData) { + public void transmissionEnded(byte[] receivedData) { // System.out.println(getName() + " got packet from radio " + SkyNode.this.cpu.getTimeMillis()); network.dataSent(receivedData); } Modified: mspsim/se/sics/mspsim/util/NetworkConnection.java =================================================================== --- mspsim/se/sics/mspsim/util/NetworkConnection.java 2008-04-24 15:29:13 UTC (rev 264) +++ mspsim/se/sics/mspsim/util/NetworkConnection.java 2008-04-24 22:04:23 UTC (rev 265) @@ -105,39 +105,30 @@ // Data incoming from the network!!! - forward to radio and if server, to // all other nodes - private void dataReceived(byte[] data, int len, ConnectionThread source) { - int[] buf = new int[len]; - for (int i = 0; i < buf.length; i++) { - buf[i] = data[i]; - } + private void dataReceived(byte[] data, ConnectionThread source) { if (listener != null) { // Send this data to the transmitter in this node! listener.transmissionStarted(); - listener.transmissionEnded(buf); + listener.transmissionEnded(data); } // And if this is the server, propagate to the others if (serverSocket != null) { - dataSent(buf, source); + dataSent(data, source); } } - private byte[] buf = new byte[256]; - // Data was sent from the radio in the node (or other node) and should // be sent out to other nodes!!! - public void dataSent(int[] data) { - dataSent(data, null); + public void dataSent(byte[] receivedData) { + dataSent(receivedData, null); } // Data was sent either from radio, or came from another "radio" - // and if so it should be propagated to all others. - public void dataSent(int[] data, ConnectionThread source) { + public void dataSent(byte[] receivedData, ConnectionThread source) { if (connections.size() > 0) { - for (int i = 0; i < data.length; i++) { - buf[i] = (byte) data[i]; - } ConnectionThread[] cthr = connections.toArray(new ConnectionThread[connections.size()]); for (int i = 0; i < cthr.length; i++) { if (cthr[i].isClosed()) { @@ -145,11 +136,10 @@ // Do not write back to the source } else if (cthr[i] != source){ try { - cthr[i].output.write((byte) data.length); - cthr[i].output.write(buf, 0, data.length); + cthr[i].output.write(receivedData, 0, receivedData.length); if (DEBUG) { - System.out.println("NetworkConnection: wrote " + data.length + " bytes"); - printPacket(buf, data.length); + System.out.println("NetworkConnection: wrote " + receivedData.length + " bytes"); + printPacket(receivedData); } } catch (IOException e) { e.printStackTrace(); @@ -160,8 +150,8 @@ } } - private void printPacket(byte[] data, int len) { - for (int i = 0; i < len; i++) { + private void printPacket(byte[] data) { + for (int i = 0, len = data.length; i < len; i++) { System.out.print(Utils.hex8(data[i]) + " "); } System.out.println(); @@ -184,8 +174,6 @@ } class ConnectionThread implements Runnable { - byte[] buffer = new byte[256]; - Socket socket; DataInputStream input; OutputStream output; @@ -216,15 +204,16 @@ if (DEBUG) System.out.println("NetworkConnection: Started connection thread..."); try { while (socket != null) { - int len; - len = input.read(); + int len = input.read(); if (len > 0) { - input.readFully(buffer, 0, len); + byte[] buffer = new byte[len + 1]; + buffer[0] = (byte) (len & 0xff); + input.readFully(buffer, 1, len); if (DEBUG) { System.out.println("NetworkConnection: Read packet with " + len + " bytes"); - printPacket(buffer, len); + printPacket(buffer); } - dataReceived(buffer, len, this); + dataReceived(buffer, this); } } } catch (IOException e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-04-24 15:31:09
|
Revision: 264 http://mspsim.svn.sourceforge.net/mspsim/?rev=264&view=rev Author: nifi Date: 2008-04-24 08:29:13 -0700 (Thu, 24 Apr 2008) Log Message: ----------- cleanup Modified Paths: -------------- mspsim/se/sics/mspsim/util/NetworkConnection.java Modified: mspsim/se/sics/mspsim/util/NetworkConnection.java =================================================================== --- mspsim/se/sics/mspsim/util/NetworkConnection.java 2008-04-24 15:18:03 UTC (rev 263) +++ mspsim/se/sics/mspsim/util/NetworkConnection.java 2008-04-24 15:29:13 UTC (rev 264) @@ -78,7 +78,7 @@ public void addPacketListener(PacketListener pl) { listener = pl; } - + private void setupServer(int port) { try { serverSocket = new ServerSocket(port); @@ -107,15 +107,15 @@ // all other nodes private void dataReceived(byte[] data, int len, ConnectionThread source) { int[] buf = new int[len]; + for (int i = 0; i < buf.length; i++) { + buf[i] = data[i]; + } if (listener != null) { - for (int i = 0; i < buf.length; i++) { - buf[i] = data[i]; - } // Send this data to the transmitter in this node! listener.transmissionStarted(); listener.transmissionEnded(buf); } - + // And if this is the server, propagate to the others if (serverSocket != null) { dataSent(buf, source); @@ -123,7 +123,7 @@ } - byte[] buf = new byte[256]; + private byte[] buf = new byte[256]; // Data was sent from the radio in the node (or other node) and should // be sent out to other nodes!!! @@ -137,7 +137,7 @@ if (connections.size() > 0) { for (int i = 0; i < data.length; i++) { buf[i] = (byte) data[i]; - } + } ConnectionThread[] cthr = connections.toArray(new ConnectionThread[connections.size()]); for (int i = 0; i < cthr.length; i++) { if (cthr[i].isClosed()) { @@ -159,10 +159,10 @@ } } } - + private void printPacket(byte[] data, int len) { for (int i = 0; i < len; i++) { - System.out.print("" + Utils.hex8(data[i]) + " "); + System.out.print(Utils.hex8(data[i]) + " "); } System.out.println(); } @@ -214,9 +214,9 @@ @Override public void run() { if (DEBUG) System.out.println("NetworkConnection: Started connection thread..."); - while (socket != null) { - int len; - try { + try { + while (socket != null) { + int len; len = input.read(); if (len > 0) { input.readFully(buffer, 0, len); @@ -226,11 +226,11 @@ } dataReceived(buffer, len, this); } - } catch (IOException e) { - e.printStackTrace(); - socket = null; } + } catch (IOException e) { + e.printStackTrace(); + close(); } - } + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-04-24 15:18:42
|
Revision: 263 http://mspsim.svn.sourceforge.net/mspsim/?rev=263&view=rev Author: nifi Date: 2008-04-24 08:18:03 -0700 (Thu, 24 Apr 2008) Log Message: ----------- added support for CC2420 TX_ACTIVE and SFD, remove CRC & RSSI from radio packets when using network connection Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java mspsim/se/sics/mspsim/platform/sky/SkyNode.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-04-24 15:14:09 UTC (rev 262) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-04-24 15:18:03 UTC (rev 263) @@ -172,6 +172,9 @@ private IOPort fifoPort = null; private int fifoPin; + private IOPort sfdPort = null; + private int sfdPin; + private boolean rxPacket; private int rxCursor; private int rxLen; @@ -193,6 +196,8 @@ System.arraycopy(memory, RAM_TXFIFO + 1, data, 0, len); packetListener.transmissionEnded(data); } + status &= ~STATUS_TX_ACTIVE; + updateSFDPin(); } }; @@ -428,9 +433,11 @@ if (DEBUG) { System.out.println(getName() + " Transmitting " + len + " bytes => " + time + " sec"); } + status |= STATUS_TX_ACTIVE; + cpu.scheduleTimeEventMillis(transmissionEvent, 1000 * time); + updateSFDPin(); if (packetListener != null) { packetListener.transmissionStarted(); - cpu.scheduleTimeEventMillis(transmissionEvent, 1000 * time); memory[RAM_TXFIFO + len - 1] = 1; memory[RAM_TXFIFO + len - 0] = 2; } @@ -474,7 +481,12 @@ fifoPin = pin; } + public void setSFDPort(IOPort port, int pin) { + sfdPort = port; + sfdPin = pin; + } + // ------------------------------------------------------------------- // Methods for accessing and writing to registers, etc from outside // ------------------------------------------------------------------- @@ -489,11 +501,15 @@ // Length is not assumed to be and no CRC?! public void setIncomingPacket(int[] packet) { + setIncomingPacket(packet, 0, packet.length); + } + + public void setIncomingPacket(int[] packet, int start, int end) { int adr = RAM_RXFIFO; // length of packet is data size + RSSI and CRC/Correlation! - memory[adr++] = packet.length + 2; - for (int element : packet) { - memory[adr++] = element & 0xff; + memory[adr++] = end - start + 2; + for (int i = start; i < end; i++) { + memory[adr++] = packet[i] & 0xff; } // Should take a RSSI value as input or use a set-RSSI value... memory[adr++] = (registers[REG_RSSI]) & 0xff; @@ -526,6 +542,10 @@ fifopPort.setPinState(fifopPin, rxPacket ? 1 : 0); } + private void updateSFDPin() { + sfdPort.setPinState(sfdPin, (status & STATUS_TX_ACTIVE) != 0 ? 1 : 0); + } + public void setCCA(boolean cca) { ccaPort.setPinState(ccaPin, cca ? 1 : 0); } Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-04-24 15:14:09 UTC (rev 262) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-04-24 15:18:03 UTC (rev 263) @@ -83,8 +83,10 @@ public static final int CC2420_FIFO = 3; public static final int CC2420_CCA = 4; + /* P4.1 - Input: SFD from CC2420 */ /* P4.5 - Output: VREG_EN to CC2420 */ /* P4.2 - Output: SPI Chip Select (CS_N) */ + public static final int CC2420_SFD = 1; public static final int CC2420_VREG = (1 << 5); public static final int CC2420_CHIP_SELECT = 0x04; @@ -95,8 +97,8 @@ public CC2420 radio; public NetworkConnection network; - - + + private M25P80 flash; private String flashFile; @@ -216,7 +218,8 @@ ((USART) usart0).setUSARTListener(this); port4 = (IOPort) cpu.getIOUnit("Port 4"); if (port4 != null && port4 instanceof IOPort) { - (port4).setPortListener(this); + port4.setPortListener(this); + radio.setSFDPort(port4, CC2420_SFD); } } } @@ -256,7 +259,7 @@ network = new NetworkConnection(); network.addPacketListener(new PacketListener() { public void transmissionEnded(int[] receivedData) { - radio.setIncomingPacket(receivedData); + radio.setIncomingPacket(receivedData, 0, receivedData.length - 2); } public void transmissionStarted() { } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-04-24 15:14:35
|
Revision: 262 http://mspsim.svn.sourceforge.net/mspsim/?rev=262&view=rev Author: nifi Date: 2008-04-24 08:14:09 -0700 (Thu, 24 Apr 2008) Log Message: ----------- added stack command to show stack information Modified Paths: -------------- mspsim/se/sics/mspsim/cli/DebugCommands.java Modified: mspsim/se/sics/mspsim/cli/DebugCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/DebugCommands.java 2008-04-24 15:13:20 UTC (rev 261) +++ mspsim/se/sics/mspsim/cli/DebugCommands.java 2008-04-24 15:14:09 UTC (rev 262) @@ -211,6 +211,15 @@ return 0; } }); + ch.registerCommand("stack", new BasicCommand("show stack info", "") { + public int executeCommand(CommandContext context) { + int stackEnd = context.getMapTable().heapStartAddress; + int stackStart = context.getMapTable().stackStartAddress; + int current = cpu.readRegister(MSP430Constants.SP); + context.out.println("Current stack: $" + Utils.hex16(current) + " (" + (stackStart - current) + " used of " + (stackStart - stackEnd) + ')'); + return 0; + } + }); ch.registerCommand("print", new BasicCommand("print value of an address or symbol", "<address or symbol>") { public int executeCommand(CommandContext context) { int adr = context.getArgumentAsAddress(0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |