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: <fro...@us...> - 2008-09-18 04:19:34
|
Revision: 337 http://mspsim.svn.sourceforge.net/mspsim/?rev=337&view=rev Author: fros4943 Date: 2008-09-18 11:19:32 +0000 (Thu, 18 Sep 2008) Log Message: ----------- debug output (false) Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java mspsim/se/sics/mspsim/chip/SHT11.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-09-17 12:10:18 UTC (rev 336) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-09-18 11:19:32 UTC (rev 337) @@ -254,7 +254,7 @@ if( (registers[REG_IOCFG1] & CCAMUX) == CCA_XOSC16M_STABLE) { setCCA(true); } else { - System.out.println("CC2420: CCAMUX != CCA_XOSC16M_STABLE! Not raising CCA"); + if(DEBUG) System.out.println("CC2420: CCAMUX != CCA_XOSC16M_STABLE! Not raising CCA"); } } }; @@ -400,7 +400,7 @@ rxfifo_len++; if(rxfifo_write_pos == 128) { - System.out.println("Wrapped RXFIFO write pos"); + if (DEBUG) System.out.println("Wrapped RXFIFO write pos"); rxfifo_write_pos = 0; } @@ -515,7 +515,7 @@ case READ_RXFIFO: if(rxfifo_len == 0) break; - System.out.println("CC2420: RXFIFO READ " + rxfifo_read_pos + " => " + + if(DEBUG) System.out.println("CC2420: RXFIFO READ " + rxfifo_read_pos + " => " + (memory[RAM_RXFIFO + rxfifo_read_pos] & 0xFF) ); source.byteReceived( (memory[RAM_RXFIFO + rxfifo_read_pos] & 0xFF) ); rxfifo_read_pos++; @@ -603,7 +603,7 @@ //} setMode(MODE_RX_ON); }else{ - System.out.println("CC2420: WARNING: SRXON when not IDLE"); + if (DEBUG) System.out.println("CC2420: WARNING: SRXON when not IDLE"); } break; @@ -641,7 +641,7 @@ setState(STATE_TX_CALIBRATE); setMode(MODE_TXRX_ON); }else{ - System.out.println("CC2420: STXONCCA Ignored, CCA false"); + if (DEBUG) System.out.println("CC2420: STXONCCA Ignored, CCA false"); } } break; @@ -781,7 +781,7 @@ if(on) { // 0.6ms maximum vreg startup from datasheet pg 13 cpu.scheduleTimeEventMillis(vregEvent, 0.1); - System.out.println(getName() + ": Scheduling vregEvent at: cyc = " + cpu.cycles + + if (DEBUG) System.out.println(getName() + ": Scheduling vregEvent at: cyc = " + cpu.cycles + " target: " + vregEvent.getTime() + " current: " + cpu.getTime()); }else{ this.on = on; Modified: mspsim/se/sics/mspsim/chip/SHT11.java =================================================================== --- mspsim/se/sics/mspsim/chip/SHT11.java 2008-09-17 12:10:18 UTC (rev 336) +++ mspsim/se/sics/mspsim/chip/SHT11.java 2008-09-18 11:19:32 UTC (rev 337) @@ -51,6 +51,8 @@ private static final int COMMAND = 1; private static final int ACK_CMD = 2; + private final boolean DEBUG = false; + private final static char[] INIT_COMMAND = "CdcCD".toCharArray(); private int initPos = 0; @@ -87,7 +89,7 @@ public void clockPin(boolean high) { if (clockHi == high) return; char c = high ? 'C' : 'c'; - System.out.println(getName() + ": clock pin " + c); + if (DEBUG) System.out.println(getName() + ": clock pin " + c); switch (state) { case IDLE: if (checkInit(c)) { @@ -117,7 +119,7 @@ public void dataPin(boolean high) { if (dataHi == high) return; char c = high ? 'D' : 'd'; - System.out.println(getName() + ": data pin " + c); + if (DEBUG) System.out.println(getName() + ": data pin " + c); switch (state) { case IDLE: if (checkInit(c)) { @@ -132,7 +134,9 @@ initPos++; if (initPos == INIT_COMMAND.length) { initPos = 0; - System.out.println("SHT11: COMMAND signature detected!!!"); + if (DEBUG) { + System.out.println("SHT11: COMMAND signature detected!!!"); + } return true; } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-17 05:10:20
|
Revision: 336 http://mspsim.svn.sourceforge.net/mspsim/?rev=336&view=rev Author: joxe Date: 2008-09-17 12:10:18 +0000 (Wed, 17 Sep 2008) Log Message: ----------- fixed SHT11 to receive correct command - not yet responding Modified Paths: -------------- mspsim/CHANGE_LOG.txt mspsim/se/sics/mspsim/chip/SHT11.java mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java mspsim/se/sics/mspsim/platform/sky/SkyNode.java Modified: mspsim/CHANGE_LOG.txt =================================================================== --- mspsim/CHANGE_LOG.txt 2008-09-17 07:40:05 UTC (rev 335) +++ mspsim/CHANGE_LOG.txt 2008-09-17 12:10:18 UTC (rev 336) @@ -1,8 +1,9 @@ 0.94 Changes: - fixed so that IOPorts output 1 on pins that are configured as input - (with DIR) + (with DIR) - fixed notification of operating modes on the CC2420 for duty cycle calculation, etc. +- 0.93 Changes: Modified: mspsim/se/sics/mspsim/chip/SHT11.java =================================================================== --- mspsim/se/sics/mspsim/chip/SHT11.java 2008-09-17 07:40:05 UTC (rev 335) +++ mspsim/se/sics/mspsim/chip/SHT11.java 2008-09-17 12:10:18 UTC (rev 336) @@ -43,11 +43,13 @@ import se.sics.mspsim.core.Chip; import se.sics.mspsim.core.IOPort; +import se.sics.mspsim.util.Utils; public class SHT11 extends Chip { - public final static int IDLE = 0; - public final static int COMMAND = 1; + private static final int IDLE = 0; + private static final int COMMAND = 1; + private static final int ACK_CMD = 2; private final static char[] INIT_COMMAND = "CdcCD".toCharArray(); private int initPos = 0; @@ -63,21 +65,51 @@ boolean clockHi = false; boolean dataHi = false; + private int readData = 0; + private int readCnt = 0; + + public void setDataPort(IOPort port, int bit) { + sdataPort = port; + sdataPin = bit; + } + public void reset() { clockHi = true; dataHi = true; initPos = 0; + readCnt = 0; + readData = 0; + // Always set pin to high when not doing anything... + sdataPort.setPinState(sdataPin, IOPort.PIN_HI); } public void clockPin(boolean high) { if (clockHi == high) return; char c = high ? 'C' : 'c'; System.out.println(getName() + ": clock pin " + c); - if (state == IDLE) { + switch (state) { + case IDLE: if (checkInit(c)) { state = COMMAND; } + break; + case COMMAND: + if (c == 'C') { + readData = (readData << 1) | (dataHi ? 1 : 0); + readCnt++; + if (readCnt == 8) { + System.out.println("SHT11: read: " + Utils.hex8(readData)); + readCnt = 0; + state = ACK_CMD; + sdataPort.setPinState(sdataPin, IOPort.PIN_LOW); + } + } + break; + case ACK_CMD: + sdataPort.setPinState(sdataPin, IOPort.PIN_HI); + state = IDLE; + break; } clockHi = high; } @@ -86,7 +118,8 @@ if (dataHi == high) return; char c = high ? 'D' : 'd'; System.out.println(getName() + ": data pin " + c); - if (state == IDLE) { + switch (state) { + case IDLE: if (checkInit(c)) { state = COMMAND; } Modified: mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java 2008-09-17 07:40:05 UTC (rev 335) +++ mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java 2008-09-17 12:10:18 UTC (rev 336) @@ -3,12 +3,12 @@ import se.sics.mspsim.chip.CC2420; import se.sics.mspsim.chip.SHT11; import se.sics.mspsim.core.IOPort; +import se.sics.mspsim.core.IOUnit; import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.PortListener; import se.sics.mspsim.core.USARTListener; import se.sics.mspsim.platform.GenericNode; import se.sics.mspsim.util.ELF; -import se.sics.mspsim.util.Utils; public abstract class MoteIVNode extends GenericNode implements PortListener, USARTListener { @@ -78,6 +78,27 @@ public ELF getElfInfo() { return elf; } + + public void setupNodePorts(boolean loadFlash) { + IOUnit unit = cpu.getIOUnit("Port 5"); + if (unit instanceof IOPort) { + port5 = (IOPort) unit; + port5.setPortListener(this); + } + + unit = cpu.getIOUnit("Port 1"); + if (unit instanceof IOPort) { + port1 = (IOPort) unit; + port1.setPortListener(this); + sht11.setDataPort(port1, SHT11_DATA_PIN); + } + + unit = cpu.getIOUnit("Port 2"); + if (unit instanceof IOPort) { + port2 = (IOPort) unit; + } + } + public void portWrite(IOPort source, int data) { if (source == port5) { Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-09-17 07:40:05 UTC (rev 335) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-09-17 12:10:18 UTC (rev 336) @@ -102,23 +102,8 @@ } public void setupNodePorts(boolean loadFlash) { - IOUnit unit = cpu.getIOUnit("Port 5"); - if (unit instanceof IOPort) { - port5 = (IOPort) unit; - port5.setPortListener(this); - } + super.setupNodePorts(loadFlash); - unit = cpu.getIOUnit("Port 1"); - if (unit instanceof IOPort) { - port1 = (IOPort) unit; - port1.setPortListener(this); - } - - unit = cpu.getIOUnit("Port 2"); - if (unit instanceof IOPort) { - port2 = (IOPort) unit; - } - IOUnit usart0 = cpu.getIOUnit("USART 0"); if (usart0 instanceof USART) { radio = new CC2420(cpu); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-17 00:40:07
|
Revision: 335 http://mspsim.svn.sourceforge.net/mspsim/?rev=335&view=rev Author: joxe Date: 2008-09-17 07:40:05 +0000 (Wed, 17 Sep 2008) Log Message: ----------- bugfix to IOPort notification Modified Paths: -------------- mspsim/se/sics/mspsim/chip/SHT11.java mspsim/se/sics/mspsim/core/IOPort.java Modified: mspsim/se/sics/mspsim/chip/SHT11.java =================================================================== --- mspsim/se/sics/mspsim/chip/SHT11.java 2008-09-16 21:08:05 UTC (rev 334) +++ mspsim/se/sics/mspsim/chip/SHT11.java 2008-09-17 07:40:05 UTC (rev 335) @@ -64,6 +64,12 @@ boolean clockHi = false; boolean dataHi = false; + public void reset() { + clockHi = true; + dataHi = true; + initPos = 0; + } + public void clockPin(boolean high) { if (clockHi == high) return; char c = high ? 'C' : 'c'; @@ -98,6 +104,10 @@ } } else { initPos = 0; + // If this is a correct first char => ok! + if (c == INIT_COMMAND[0]) { + initPos = 1; + } } return false; } Modified: mspsim/se/sics/mspsim/core/IOPort.java =================================================================== --- mspsim/se/sics/mspsim/core/IOPort.java 2008-09-16 21:08:05 UTC (rev 334) +++ mspsim/se/sics/mspsim/core/IOPort.java 2008-09-17 07:40:05 UTC (rev 335) @@ -76,6 +76,7 @@ private PortListener listener; // represents the direction register private int dirReg; + private int out; /** * Creates a new <code>IOPort</code> instance. @@ -131,13 +132,22 @@ case IN: break; case OUT: + out = data; if (listener != null) { // Any output configured pin (pin-bit = 0) should have 1 here?! - listener.portWrite(this, data | (~dirReg)&0xff); +// if (name.equals("1")) +// System.out.println(getName() + " write to IOPort via OUT reg: " + Utils.hex8(data)); + listener.portWrite(this, out | (~dirReg)&0xff); } break; case DIR: dirReg = data; + if (listener != null) { + // Any output configured pin (pin-bit = 0) should have 1 here?! +// if (name.equals("1")) +// System.out.println(getName() + " write to IOPort via DIR reg: " + Utils.hex8(data)); + listener.portWrite(this, out | (~dirReg)&0xff); + } break; // SEL & IFG is the same but behaviour differs between p1,p2 and rest... case SEL: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-16 14:08:08
|
Revision: 334 http://mspsim.svn.sourceforge.net/mspsim/?rev=334&view=rev Author: joxe Date: 2008-09-16 21:08:05 +0000 (Tue, 16 Sep 2008) Log Message: ----------- updated changelog Modified Paths: -------------- mspsim/CHANGE_LOG.txt Modified: mspsim/CHANGE_LOG.txt =================================================================== --- mspsim/CHANGE_LOG.txt 2008-09-16 21:06:07 UTC (rev 333) +++ mspsim/CHANGE_LOG.txt 2008-09-16 21:08:05 UTC (rev 334) @@ -1,5 +1,7 @@ 0.94 Changes: +- fixed so that IOPorts output 1 on pins that are configured as input + (with DIR) - fixed notification of operating modes on the CC2420 for duty cycle calculation, etc. 0.93 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-16 14:06:09
|
Revision: 333 http://mspsim.svn.sourceforge.net/mspsim/?rev=333&view=rev Author: joxe Date: 2008-09-16 21:06:07 +0000 (Tue, 16 Sep 2008) Log Message: ----------- added SHT11 to sky node - not working Modified Paths: -------------- mspsim/se/sics/mspsim/chip/SHT11.java mspsim/se/sics/mspsim/core/IOPort.java mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java mspsim/se/sics/mspsim/platform/sky/SkyNode.java Modified: mspsim/se/sics/mspsim/chip/SHT11.java =================================================================== --- mspsim/se/sics/mspsim/chip/SHT11.java 2008-09-16 20:20:44 UTC (rev 332) +++ mspsim/se/sics/mspsim/chip/SHT11.java 2008-09-16 21:06:07 UTC (rev 333) @@ -48,6 +48,9 @@ public final static int IDLE = 0; public final static int COMMAND = 1; + + private final static char[] INIT_COMMAND = "CdcCD".toCharArray(); + private int initPos = 0; /* Serial data pins */ @@ -62,13 +65,44 @@ boolean dataHi = false; public void clockPin(boolean high) { + if (clockHi == high) return; + char c = high ? 'C' : 'c'; + System.out.println(getName() + ": clock pin " + c); + if (state == IDLE) { + if (checkInit(c)) { + state = COMMAND; + } + } clockHi = high; } public void dataPin(boolean high) { + if (dataHi == high) return; + char c = high ? 'D' : 'd'; + System.out.println(getName() + ": data pin " + c); + if (state == IDLE) { + if (checkInit(c)) { + state = COMMAND; + } + } dataHi = high; } + + private boolean checkInit(char c) { + if (INIT_COMMAND[initPos] == c) { + initPos++; + if (initPos == INIT_COMMAND.length) { + initPos = 0; + System.out.println("SHT11: COMMAND signature detected!!!"); + return true; + } + } else { + initPos = 0; + } + return false; + } + public int getModeMax() { return 0; } Modified: mspsim/se/sics/mspsim/core/IOPort.java =================================================================== --- mspsim/se/sics/mspsim/core/IOPort.java 2008-09-16 20:20:44 UTC (rev 332) +++ mspsim/se/sics/mspsim/core/IOPort.java 2008-09-16 21:06:07 UTC (rev 333) @@ -74,6 +74,8 @@ // One listener per port maximum (now at least) private PortListener listener; + // represents the direction register + private int dirReg; /** * Creates a new <code>IOPort</code> instance. @@ -130,10 +132,12 @@ break; case OUT: if (listener != null) { - listener.portWrite(this, data); + // Any output configured pin (pin-bit = 0) should have 1 here?! + listener.portWrite(this, data | (~dirReg)&0xff); } break; case DIR: + dirReg = data; break; // SEL & IFG is the same but behaviour differs between p1,p2 and rest... case SEL: Modified: mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java 2008-09-16 20:20:44 UTC (rev 332) +++ mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java 2008-09-16 21:06:07 UTC (rev 333) @@ -1,12 +1,14 @@ package se.sics.mspsim.platform.sky; import se.sics.mspsim.chip.CC2420; +import se.sics.mspsim.chip.SHT11; import se.sics.mspsim.core.IOPort; import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.PortListener; import se.sics.mspsim.core.USARTListener; import se.sics.mspsim.platform.GenericNode; import se.sics.mspsim.util.ELF; +import se.sics.mspsim.util.Utils; public abstract class MoteIVNode extends GenericNode implements PortListener, USARTListener { @@ -25,6 +27,13 @@ public static final int CC2420_FIFO = 3; public static final int CC2420_CCA = 4; + public static final int SHT11_CLK_PIN = 6; + public static final int SHT11_DATA_PIN = 5; + + public static final int SHT11_CLK = 1 << SHT11_CLK_PIN; + public static final int SHT11_DATA = 1 << SHT11_DATA_PIN; + + /* P4.1 - Input: SFD from CC2420 */ /* P4.5 - Output: VREG_EN to CC2420 */ /* P4.2 - Output: SPI Chip Select (CS_N) */ @@ -46,7 +55,7 @@ protected IOPort port5; public CC2420 radio; - + public SHT11 sht11 = new SHT11(); public SkyGui gui; @@ -87,6 +96,9 @@ radio.setVRegOn((data & CC2420_VREG) != 0); //radio.portWrite(source, data); flashWrite(source, data); + } else if (source == port1) { + sht11.clockPin((data & SHT11_CLK) != 0); + sht11.dataPin((data & SHT11_DATA) != 0); } } Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-09-16 20:20:44 UTC (rev 332) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-09-16 21:06:07 UTC (rev 333) @@ -111,6 +111,7 @@ unit = cpu.getIOUnit("Port 1"); if (unit instanceof IOPort) { port1 = (IOPort) unit; + port1.setPortListener(this); } unit = cpu.getIOUnit("Port 2"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-16 13:20:46
|
Revision: 332 http://mspsim.svn.sourceforge.net/mspsim/?rev=332&view=rev Author: joxe Date: 2008-09-16 20:20:44 +0000 (Tue, 16 Sep 2008) Log Message: ----------- Added Paths: ----------- mspsim/se/sics/mspsim/chip/SHT11.java Added: mspsim/se/sics/mspsim/chip/SHT11.java =================================================================== --- mspsim/se/sics/mspsim/chip/SHT11.java (rev 0) +++ mspsim/se/sics/mspsim/chip/SHT11.java 2008-09-16 20:20:44 UTC (rev 332) @@ -0,0 +1,80 @@ +/** + * Copyright (c) 2007, 2008, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of MSPSim. + * + * $Id: $ + * + * ----------------------------------------------------------------- + * + * SHT11 + * + * Author : Joakim Eriksson, jo...@si... + * Created : Sept 16 2008 + * Updated : $Date: $ + * $Revision: $ + */ + +package se.sics.mspsim.chip; + +import se.sics.mspsim.core.Chip; +import se.sics.mspsim.core.IOPort; + +public class SHT11 extends Chip { + + public final static int IDLE = 0; + public final static int COMMAND = 1; + + + /* Serial data pins */ + IOPort sclkPort; + int sclkPin; + IOPort sdataPort; + int sdataPin; + + int state = IDLE; + + boolean clockHi = false; + boolean dataHi = false; + + public void clockPin(boolean high) { + clockHi = high; + } + + public void dataPin(boolean high) { + dataHi = high; + } + + public int getModeMax() { + return 0; + } + + public String getName() { + return "SHT11"; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-16 07:36:27
|
Revision: 331 http://mspsim.svn.sourceforge.net/mspsim/?rev=331&view=rev Author: joxe Date: 2008-09-16 14:36:23 +0000 (Tue, 16 Sep 2008) Log Message: ----------- fixed MOV instruction to not read from memory of src address - and thus not notify read monitors Modified Paths: -------------- mspsim/se/sics/mspsim/core/MSP430Core.java Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2008-09-16 12:17:31 UTC (rev 330) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2008-09-16 14:36:23 UTC (rev 331) @@ -289,7 +289,7 @@ } else if (scg0) { setMode(MODE_LPM1); } else { - setMode(MODE_LPM0); + setMode(MODE_LPM0); } } else { setMode(MODE_ACTIVE); @@ -981,10 +981,12 @@ // Perform the read of destination! if (dstRegMode) { - dst = readRegister(dstRegister); - if (!word) { - dst &= 0xff; - } + if (op != MOV) { + dst = readRegister(dstRegister); + if (!word) { + dst &= 0xff; + } + } } else { // PC Could have changed above! pc = readRegister(PC); @@ -996,7 +998,8 @@ + memory[pc] + (memory[pc + 1] << 8); } - dst = read(dstAddress, word); + if (op != MOV) + dst = read(dstAddress, word); pc += 2; incRegister(PC, 2); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-16 05:17:34
|
Revision: 330 http://mspsim.svn.sourceforge.net/mspsim/?rev=330&view=rev Author: joxe Date: 2008-09-16 12:17:31 +0000 (Tue, 16 Sep 2008) Log Message: ----------- fixed lost CC2420 operation mode notifications Modified Paths: -------------- mspsim/CHANGE_LOG.txt mspsim/firmware/sky/blink.firmware mspsim/se/sics/mspsim/chip/CC2420.java Modified: mspsim/CHANGE_LOG.txt =================================================================== --- mspsim/CHANGE_LOG.txt 2008-09-16 09:29:03 UTC (rev 329) +++ mspsim/CHANGE_LOG.txt 2008-09-16 12:17:31 UTC (rev 330) @@ -1,3 +1,7 @@ +0.94 +Changes: +- fixed notification of operating modes on the CC2420 for duty cycle calculation, etc. + 0.93 Changes: - removed tick based component support from MSP430 core Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-09-16 09:29:03 UTC (rev 329) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-09-16 12:17:31 UTC (rev 330) @@ -601,7 +601,7 @@ //if (DEBUG) { // System.out.println("CC2420: Strobe RX-ON!!!"); //} - //setMode(MODE_RX_ON); + setMode(MODE_RX_ON); }else{ System.out.println("CC2420: WARNING: SRXON when not IDLE"); } @@ -612,7 +612,6 @@ System.out.println("CC2420: Strobe RXTX-OFF!!!"); } setState(STATE_IDLE); - setMode(MODE_TXRX_OFF); break; case REG_STXON: @@ -625,6 +624,8 @@ (stateMachine == STATE_RX_WAIT)) { status |= STATUS_TX_ACTIVE; setState(STATE_TX_CALIBRATE); + // Starting up TX subsystem - indicate that we are in TX mode! + setMode(MODE_TXRX_ON); } break; case REG_STXONCCA: @@ -638,6 +639,7 @@ if(cca) { status |= STATUS_TX_ACTIVE; setState(STATE_TX_CALIBRATE); + setMode(MODE_TXRX_ON); }else{ System.out.println("CC2420: STXONCCA Ignored, CCA false"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-09-16 02:29:07
|
Revision: 329 http://mspsim.svn.sourceforge.net/mspsim/?rev=329&view=rev Author: nifi Date: 2008-09-16 09:29:03 +0000 (Tue, 16 Sep 2008) Log Message: ----------- flush read cache after updating flash Modified Paths: -------------- mspsim/se/sics/mspsim/chip/M25P80.java Modified: mspsim/se/sics/mspsim/chip/M25P80.java =================================================================== --- mspsim/se/sics/mspsim/chip/M25P80.java 2008-09-16 06:50:52 UTC (rev 328) +++ mspsim/se/sics/mspsim/chip/M25P80.java 2008-09-16 09:29:03 UTC (rev 329) @@ -236,7 +236,7 @@ } catch (IOException e) { e.printStackTrace(); } - return ~(byte)data[address & 0xff]; + return ~data[address & 0xff]; } public void writeByte(int address, int data) { @@ -248,8 +248,12 @@ } catch (IOException e) { e.printStackTrace(); } + if (loadedAddress >= 0 + && ((loadedAddress & 0xfff00) == (address & 0xfff00))) { + loadedAddress = -1; + } } - + public int getSize() { return MEMORY_SIZE; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-15 23:50:54
|
Revision: 328 http://mspsim.svn.sourceforge.net/mspsim/?rev=328&view=rev Author: joxe Date: 2008-09-16 06:50:52 +0000 (Tue, 16 Sep 2008) Log Message: ----------- updated changelog before release Modified Paths: -------------- mspsim/CHANGE_LOG.txt Modified: mspsim/CHANGE_LOG.txt =================================================================== --- mspsim/CHANGE_LOG.txt 2008-09-15 21:16:47 UTC (rev 327) +++ mspsim/CHANGE_LOG.txt 2008-09-16 06:50:52 UTC (rev 328) @@ -7,7 +7,8 @@ delays on their events...) - fixed RadioWrapper for backward compatibility with PacketListener (for the CC2420). - +- fixed ADC12 to turn off event scheduling when ADC12 is not on anymore +- fixed xmem read/write for cli and added Memory API for flash memory. 0.92 Changes: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-15 14:16:53
|
Revision: 327 http://mspsim.svn.sourceforge.net/mspsim/?rev=327&view=rev Author: joxe Date: 2008-09-15 21:16:47 +0000 (Mon, 15 Sep 2008) Log Message: ----------- added xmem cli commands and implemented memory interface in Sky-node flash memory Modified Paths: -------------- mspsim/se/sics/mspsim/chip/FileM25P80.java mspsim/se/sics/mspsim/chip/M25P80.java mspsim/se/sics/mspsim/cli/DebugCommands.java mspsim/se/sics/mspsim/platform/sky/SkyNode.java Modified: mspsim/se/sics/mspsim/chip/FileM25P80.java =================================================================== --- mspsim/se/sics/mspsim/chip/FileM25P80.java 2008-09-15 21:11:08 UTC (rev 326) +++ mspsim/se/sics/mspsim/chip/FileM25P80.java 2008-09-15 21:16:47 UTC (rev 327) @@ -83,7 +83,7 @@ } // Set size of flash try { - file.setLength(1024 * 1024); + file.setLength(MEMORY_SIZE); } catch (IOException e) { e.printStackTrace(); } Modified: mspsim/se/sics/mspsim/chip/M25P80.java =================================================================== --- mspsim/se/sics/mspsim/chip/M25P80.java 2008-09-15 21:11:08 UTC (rev 326) +++ mspsim/se/sics/mspsim/chip/M25P80.java 2008-09-15 21:16:47 UTC (rev 327) @@ -43,7 +43,7 @@ import java.io.IOException; import se.sics.mspsim.core.*; -public abstract class M25P80 extends Chip implements USARTListener, PortListener { +public abstract class M25P80 extends Chip implements USARTListener, PortListener, Memory { public static final boolean DEBUG = false; @@ -59,7 +59,9 @@ 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 MEMORY_SIZE = 1024 * 1024; + private int state = 0; public static final int CHIP_SELECT = 0x10; private boolean chipSelect; @@ -224,6 +226,34 @@ } } + /*********************************************** + * Memory interface methods + ***********************************************/ + public int readByte(int address) { + byte[] data = new byte[256]; + try { + loadMemory(address, data); + } catch (IOException e) { + e.printStackTrace(); + } + return ~(byte)data[address & 0xff]; + } + + public void writeByte(int address, int data) { + byte[] mem = new byte[256]; + try { + loadMemory(address, mem); + mem[address & 0xff] = (byte) ~data; + writeBack(address, mem); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public int getSize() { + return MEMORY_SIZE; + } + // Should return correct data! private int readMemory(int address) { if (DEBUG) { @@ -244,11 +274,7 @@ if (DEBUG) { System.out.println("M25P80: Loading memory: " + (address & 0xfff00)); } - seek(address & 0xfff00); - readFully(readMemory); - for (int i = 0; i < readMemory.length; i++) { - readMemory[i] = (byte) (~readMemory[i] & 0xff); - } + loadMemory(address, readMemory); } catch (IOException e) { e.printStackTrace(); } @@ -256,6 +282,14 @@ } } + private void loadMemory(int address, byte[] readMemory) throws IOException { + seek(address & 0xfff00); + readFully(readMemory); + for (int i = 0; i < readMemory.length; i++) { + readMemory[i] = (byte) (~readMemory[i] & 0xff); + } + } + public void portWrite(IOPort source, int data) { // Chip select = active low... if (chipSelect && (data & CHIP_SELECT) != 0) { @@ -329,7 +363,7 @@ public String getName() { return "M25P80: external flash"; } - + public abstract void seek(long pos) throws IOException; public abstract int readFully(byte[] b) throws IOException; public abstract void write(byte[] b) throws IOException; Modified: mspsim/se/sics/mspsim/cli/DebugCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/DebugCommands.java 2008-09-15 21:11:08 UTC (rev 326) +++ mspsim/se/sics/mspsim/cli/DebugCommands.java 2008-09-15 21:16:47 UTC (rev 327) @@ -44,6 +44,7 @@ import se.sics.mspsim.core.CPUMonitor; import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.MSP430Constants; +import se.sics.mspsim.core.Memory; import se.sics.mspsim.platform.GenericNode; import se.sics.mspsim.util.ComponentRegistry; import se.sics.mspsim.util.DebugInfo; @@ -54,8 +55,10 @@ public class DebugCommands implements CommandBundle { private long lastCall = 0; private long lastWall = 0; - + private ComponentRegistry registry; + public void setupCommands(ComponentRegistry registry, CommandHandler ch) { + this.registry = registry; final MSP430 cpu = (MSP430) registry.getComponent(MSP430.class); final ELF elf = (ELF) registry.getComponent(ELF.class); final GenericNode node = (GenericNode) registry.getComponent("node"); @@ -303,7 +306,7 @@ return 0; } }); - + ch.registerCommand("set", new BasicCommand("set memory", "<address> <value> [type]") { public int executeCommand(final CommandContext context) { int adr = context.getArgumentAsAddress(0); @@ -313,8 +316,63 @@ return 0; }}); + /****************************************************** + * handle external memory (flash, etc). + ******************************************************/ + ch.registerCommand("xmem", new BasicCommand("dump flash memory", "<start address> <num_emtries> [type]") { + public int executeCommand(final CommandContext context) { + Memory xmem = (Memory) DebugCommands.this.registry.getComponent("xmem"); + if (xmem == null) { + context.err.print("No xmem component registered"); + return 0; + } + int start = context.getArgumentAsAddress(0); + int count = context.getArgumentAsInt(1); + int size = 1; // unsigned byte + boolean signed = false; + if (context.getArgumentCount() > 2) { + String tS = context.getArgument(2); + if ("byte".equals(tS)) { + signed = true; + } else if ("word".equals(tS)) { + signed = true; + size = 2; + } else if ("uword".equals(tS)) { + size = 2; + } + } + // Does not yet handle signed data... + for (int i = 0; i < count; i++) { + int data = 0; + data = xmem.readByte(start++); + if (size == 2) { + data = data + (xmem.readByte(start++) << 8); + } + context.out.print(" " + data); + } + context.out.println(); + return 0; + } + }); - + ch.registerCommand("xset", new BasicCommand("set memory", "<address> <value> [type]") { + public int executeCommand(final CommandContext context) { + Memory xmem = (Memory) DebugCommands.this.registry.getComponent("xmem"); + if (xmem == null) { + context.err.print("No xmem component registered"); + return 0; + } + int adr = context.getArgumentAsAddress(0); + int val = context.getArgumentAsInt(1); + boolean word = val > 0xff; + if (word) { + xmem.writeByte(adr, val >> 8); + val = val & 0xff; + adr++; + } + xmem.writeByte(adr, val & 0xff); + return 0; + }}); } } Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-09-15 21:11:08 UTC (rev 326) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-09-15 21:16:47 UTC (rev 327) @@ -199,6 +199,7 @@ dataChart.addDataSource(dss, "Transmit", stats.getDataSource("CC2420", CC2420.MODE_TXRX_ON)); dataChart.addDataSource(dss, "CPU", stats.getDataSource("MSP430 Core", MSP430.MODE_ACTIVE)); } + registry.registerComponent("xmem", flash); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-15 14:11:11
|
Revision: 326 http://mspsim.svn.sourceforge.net/mspsim/?rev=326&view=rev Author: joxe Date: 2008-09-15 21:11:08 +0000 (Mon, 15 Sep 2008) Log Message: ----------- Added memory interface. Added Paths: ----------- mspsim/se/sics/mspsim/core/Memory.java Added: mspsim/se/sics/mspsim/core/Memory.java =================================================================== --- mspsim/se/sics/mspsim/core/Memory.java (rev 0) +++ mspsim/se/sics/mspsim/core/Memory.java 2008-09-15 21:11:08 UTC (rev 326) @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2007, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of MSPSim. + * + * $Id: $ + * + * ----------------------------------------------------------------- + * + * Memory + * + * Author : Joakim Eriksson + * Created : Sept 15 22:00:00 2008 + * Updated : $Date: 2008-03-11 16:32:12 +0100 (ti, 11 mar 2008) $ + * $Revision: 177 $ + */ +package se.sics.mspsim.core; + +public interface Memory { + + public int readByte(int address); + public void writeByte(int address, int data); + + /** + * getSize returns the size of memory in bytes. + */ + public int getSize(); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-12 13:27:01
|
Revision: 324 http://mspsim.svn.sourceforge.net/mspsim/?rev=324&view=rev Author: joxe Date: 2008-09-12 13:26:59 +0000 (Fri, 12 Sep 2008) Log Message: ----------- clean before making jar Modified Paths: -------------- mspsim/Makefile Modified: mspsim/Makefile =================================================================== --- mspsim/Makefile 2008-09-12 13:20:53 UTC (rev 323) +++ mspsim/Makefile 2008-09-12 13:26:59 UTC (rev 324) @@ -86,7 +86,7 @@ compile: $(OBJECTS) -jar: compile JarManifest.txt +jar: clean compile JarManifest.txt $(JAR) cfm $(JARFILE) JarManifest.txt ${addsuffix /*.class,$(PACKAGES)} images/*.jpg -$(RM) JarManifest.txt This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-12 13:20:55
|
Revision: 323 http://mspsim.svn.sourceforge.net/mspsim/?rev=323&view=rev Author: joxe Date: 2008-09-12 13:20:53 +0000 (Fri, 12 Sep 2008) Log Message: ----------- added maxCycles limit to emulateOp Modified Paths: -------------- mspsim/se/sics/mspsim/core/MSP430.java mspsim/se/sics/mspsim/core/MSP430Core.java Modified: mspsim/se/sics/mspsim/core/MSP430.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430.java 2008-09-12 06:32:41 UTC (rev 322) +++ mspsim/se/sics/mspsim/core/MSP430.java 2008-09-12 13:20:53 UTC (rev 323) @@ -111,7 +111,7 @@ nextOut = cycles + 20000007; } - if (emulateOP()) { + if (emulateOP(-1)) { instCtr++; if (execCounter != null) { @@ -172,7 +172,7 @@ } } - boolean emuOP = emulateOP(); + boolean emuOP = emulateOP(-1); if (emuOP) { if (execCounter != null) { execCounter[reg[PC]]++; @@ -196,7 +196,10 @@ return cycles; } - public long step(long max_cycles) { + /* + * Perform a single step (even if in LPM) but no longer than to maxCycles + 1 instr + */ + public long step(long maxCycles) { if (isRunning()) { throw new IllegalStateException("step not possible when CPU is running"); } @@ -214,13 +217,12 @@ boolean emuOP = false; - if (max_cycles > 0) { - while (cycles < max_cycles && !(emuOP = emulateOP())) { - /* Stuck in LPM - hopefully not more than 10000 times*/ + if (maxCycles > 0) { + while (cycles < maxCycles && !(emuOP = emulateOP(maxCycles))) { } } else { int ctr = 0; - while (!(emuOP = emulateOP()) && ctr++ < 10000) { + while (!(emuOP = emulateOP(-1)) && ctr++ < 10000) { /* Stuck in LPM - hopefully not more than 10000 times*/ } } Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2008-09-12 06:32:41 UTC (rev 322) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2008-09-12 13:20:53 UTC (rev 323) @@ -646,7 +646,7 @@ } /* returns true if any instruction was emulated - false if CpuOff */ - public boolean emulateOP() { + public boolean emulateOP(long maxCycles) { //System.out.println("CYCLES BEFORE: " + cycles); int pc = readRegister(PC); long startCycles = cycles; @@ -669,7 +669,12 @@ if (cpuOff) { // System.out.println("Jumping: " + (nextIOTickCycles - cycles)); // nextEventCycles must exist, otherwise CPU can not wake up!? - cycles = nextEventCycles; + if (maxCycles >= 0 && maxCycles < nextEventCycles) { + // Should it just freeze or take on extra cycle step if cycles > max? + cycles = cycles < maxCycles ? maxCycles : cycles; + } else { + cycles = nextEventCycles; + } return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-12 06:32:43
|
Revision: 322 http://mspsim.svn.sourceforge.net/mspsim/?rev=322&view=rev Author: joxe Date: 2008-09-12 06:32:41 +0000 (Fri, 12 Sep 2008) Log Message: ----------- improved radiowrapper Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java mspsim/se/sics/mspsim/platform/sky/SkyNode.java mspsim/se/sics/mspsim/platform/sky/TelosNode.java Added Paths: ----------- mspsim/se/sics/mspsim/platform/sky/RadioWrapper.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-09-11 17:45:24 UTC (rev 321) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-09-12 06:32:41 UTC (rev 322) @@ -291,7 +291,7 @@ case STATE_TX_CALIBRATE: setState(STATE_TX_PREAMBLE); - break; + break; case STATE_RX_WAIT: setClear(true); @@ -850,14 +850,6 @@ private void flushTX() { txCursor = 0; } - - // For incoming packets... - mostly for backward compatibility... - public void setIncomingPacket(byte[] receivedData) { - for (byte element: receivedData) { - receivedByte((byte)(element & 0xff)); - } - } - public void setClear(boolean clear) { cca = clear; Added: mspsim/se/sics/mspsim/platform/sky/RadioWrapper.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/RadioWrapper.java (rev 0) +++ mspsim/se/sics/mspsim/platform/sky/RadioWrapper.java 2008-09-12 06:32:41 UTC (rev 322) @@ -0,0 +1,67 @@ +package se.sics.mspsim.platform.sky; + +import se.sics.mspsim.chip.CC2420; +import se.sics.mspsim.chip.PacketListener; +import se.sics.mspsim.chip.RFListener; +import se.sics.mspsim.util.Utils; + + +public class RadioWrapper implements RFListener { + + private CC2420 radio; + private PacketListener listener; + int len = 0; + int pos = 0; + byte[] buffer = new byte[128]; + + public RadioWrapper(CC2420 radio) { + this.radio = radio; + radio.setRFListener(this); + } + + public void setPacketListener(PacketListener list) { + listener = list; + } + + public void packetReceived(byte[] receivedData) { + // four zero bytes, 7a and then length... + radio.receivedByte((byte)0); + radio.receivedByte((byte)0); + radio.receivedByte((byte)0); + radio.receivedByte((byte)0); + radio.receivedByte((byte)0x7a); + // radio.receivedByte((byte) receivedData.length); + + for (int i = 0; i < receivedData.length; i++) { +// int data = receivedData[i]; +// System.out.println("*** RF (external) Data :" + data + " = $" + Utils.hex8(data) + " => " + +// (char) data); + + radio.receivedByte(receivedData[i]); + } + } + + + // NOTE: len is not in the packet for now... + public void receivedByte(byte data) { +// System.out.println("*** RF Data :" + data + " = $" + Utils.hex8(data) + " => " + +// (char) data); + if (pos == 5) { + // System.out.println("**** Setting length to:" + data); + len = data; + } + if (pos == 0) { + listener.transmissionStarted(); + } + buffer[pos++] = data; + // len + 1 = pos + 5 (preambles) + if (len > 0 && len + 1 == pos - 5) { +// System.out.println("***** SENDING DATA from CC2420 len = " + len); + byte[] packet = new byte[len + 1]; + System.arraycopy(buffer, 5, packet, 0, len + 1); + listener.transmissionEnded(packet); + pos = 0; + len = 0; + } + } +} Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-09-11 17:45:24 UTC (rev 321) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-09-12 06:32:41 UTC (rev 322) @@ -46,7 +46,6 @@ import se.sics.mspsim.chip.FileM25P80; import se.sics.mspsim.chip.M25P80; import se.sics.mspsim.chip.PacketListener; -import se.sics.mspsim.chip.RFListener; import se.sics.mspsim.core.IOPort; import se.sics.mspsim.core.IOUnit; import se.sics.mspsim.core.MSP430; @@ -56,6 +55,7 @@ import se.sics.mspsim.util.ArgumentManager; import se.sics.mspsim.util.NetworkConnection; import se.sics.mspsim.util.OperatingModeStatistics; +import se.sics.mspsim.util.Utils; /** * Emulation of Sky Mote @@ -159,38 +159,27 @@ stats.addMonitor(cpu); network = new NetworkConnection(); - network.addPacketListener(new PacketListener() { + final RadioWrapper radioWrapper = new RadioWrapper(radio); + radioWrapper.setPacketListener(new PacketListener() { + public void transmissionStarted() { + } public void transmissionEnded(byte[] receivedData) { - radio.setIncomingPacket(receivedData); +// System.out.println("**** Sending data len = " + receivedData.length); +// for (int i = 0; i < receivedData.length; i++) { +// System.out.println("Byte: " + Utils.hex8(receivedData[i])); +// } + network.dataSent(receivedData); } + }); + + network.addPacketListener(new PacketListener() { public void transmissionStarted() { } - }); - // TODO: remove this test... - radio.setRFListener(new RFListener() { - int len = 0; - int pos = 0; - byte[] buffer = new byte[128]; - // NOTE: len is not in the packet for now... - public void receivedByte(byte data) { -// System.out.println("*** RF Data :" + data); - if (pos == 5) { -// System.out.println("**** Setting length to:" + data); - len = data; - } - buffer[pos++] = data; - // len + 1 = pos + 5 (preambles) - if (len > 0 && len + 1 == pos - 5) { -// System.out.println("***** SENDING DATA!!!"); - byte[] packet = new byte[len]; - System.arraycopy(buffer, 5, packet, 0, len); - network.dataSent(packet); - pos = 0; - len = 0; - } + public void transmissionEnded(byte[] receivedData) { +// System.out.println("**** Receiveing data = " + receivedData.length); + radioWrapper.packetReceived(receivedData); } }); - // UART0 TXreg = 0x77? // cpu.setBreakPoint(0x77, new CPUMonitor() { // public void cpuAction(int type, int adr, int data) { Modified: mspsim/se/sics/mspsim/platform/sky/TelosNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/TelosNode.java 2008-09-11 17:45:24 UTC (rev 321) +++ mspsim/se/sics/mspsim/platform/sky/TelosNode.java 2008-09-12 06:32:41 UTC (rev 322) @@ -165,35 +165,20 @@ stats.addMonitor(cpu); network = new NetworkConnection(); - network.addPacketListener(new PacketListener() { + final RadioWrapper radioWrapper = new RadioWrapper(radio); + radioWrapper.setPacketListener(new PacketListener() { + public void transmissionStarted() { + } public void transmissionEnded(byte[] receivedData) { - radio.setIncomingPacket(receivedData); + network.dataSent(receivedData); } + }); + + network.addPacketListener(new PacketListener() { public void transmissionStarted() { } - }); - // TODO: remove this test... - radio.setRFListener(new RFListener() { - int len = 0; - int pos = 0; - byte[] buffer = new byte[128]; - // NOTE: len is not in the packet for now... - public void receivedByte(byte data) { -// System.out.println("*** RF Data :" + data); - if (pos == 5) { -// System.out.println("**** Setting length to:" + data); - len = data; - } - buffer[pos++] = data; - // len + 1 = pos + 5 (preambles) - if (len > 0 && len + 1 == pos - 5) { -// System.out.println("***** SENDING DATA!!!"); - byte[] packet = new byte[len]; - System.arraycopy(buffer, 5, packet, 0, len); - network.dataSent(packet); - pos = 0; - len = 0; - } + public void transmissionEnded(byte[] receivedData) { + radioWrapper.packetReceived(receivedData); } }); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-11 17:45:27
|
Revision: 321 http://mspsim.svn.sourceforge.net/mspsim/?rev=321&view=rev Author: joxe Date: 2008-09-11 17:45:24 +0000 (Thu, 11 Sep 2008) Log Message: ----------- updated changelog Modified Paths: -------------- mspsim/CHANGE_LOG.txt Modified: mspsim/CHANGE_LOG.txt =================================================================== --- mspsim/CHANGE_LOG.txt 2008-09-11 17:43:39 UTC (rev 320) +++ mspsim/CHANGE_LOG.txt 2008-09-11 17:45:24 UTC (rev 321) @@ -2,8 +2,11 @@ Changes: - removed tick based component support from MSP430 core - reimplemented USART to be event based instead of tick based -- ... +- fixed bug in ADC12 subsystem that caused lots of events to be + scheduled back in time (causing other subsystems to get + delays on their events...) + 0.92 Changes: - fixed bug with a write register which did not handle word/byte This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-11 17:43:42
|
Revision: 320 http://mspsim.svn.sourceforge.net/mspsim/?rev=320&view=rev Author: joxe Date: 2008-09-11 17:43:39 +0000 (Thu, 11 Sep 2008) Log Message: ----------- fixed bug that made ADC12 schedule very large amount of already late events Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java mspsim/se/sics/mspsim/core/ADC12.java mspsim/se/sics/mspsim/core/MSP430Core.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-09-11 12:19:18 UTC (rev 319) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-09-11 17:43:39 UTC (rev 320) @@ -208,7 +208,6 @@ private int rxread; private int zero_symbols; private boolean ramRead = false; - private boolean fifopState; private boolean cca; private int activeFrequency = 0; @@ -254,7 +253,7 @@ setState(STATE_IDLE); if( (registers[REG_IOCFG1] & CCAMUX) == CCA_XOSC16M_STABLE) { setCCA(true); - }else{ + } else { System.out.println("CC2420: CCAMUX != CCA_XOSC16M_STABLE! Not raising CCA"); } } @@ -262,7 +261,8 @@ private TimeEvent vregEvent = new TimeEvent(0) { public void execute(long t) { - if(DEBUG) System.out.println("CC2420: VREG Started."); + if(DEBUG) System.out.println("CC2420: VREG Started at: " + t + " cyc: " + + cpu.cycles + " " + getTime()); setCCA(false); on = true; setState(STATE_POWER_DOWN); @@ -779,6 +779,8 @@ if(on) { // 0.6ms maximum vreg startup from datasheet pg 13 cpu.scheduleTimeEventMillis(vregEvent, 0.1); + System.out.println(getName() + ": Scheduling vregEvent at: cyc = " + cpu.cycles + + " target: " + vregEvent.getTime() + " current: " + cpu.getTime()); }else{ this.on = on; setState(STATE_VREG_OFF); @@ -876,7 +878,6 @@ } public void setFIFOP(boolean fifop) { - fifopState = fifop; if( (registers[REG_IOCFG0] & FIFOP_POLARITY) == FIFOP_POLARITY) { fifopPort.setPinState(fifopPin, fifop ? 0 : 1); } else { Modified: mspsim/se/sics/mspsim/core/ADC12.java =================================================================== --- mspsim/se/sics/mspsim/core/ADC12.java 2008-09-11 12:19:18 UTC (rev 319) +++ mspsim/se/sics/mspsim/core/ADC12.java 2008-09-11 17:43:39 UTC (rev 320) @@ -156,6 +156,8 @@ if (DEBUG) System.out.println(getName() + ": Set SHTime0: " + shTime0 + " SHTime1: " + shTime1 + " ENC:" + enableConversion + " Start: " + startConversion + " ADC12ON: " + adc12On); if (adc12On && enableConversion && startConversion) { + // Set the start time to be now! + adcTrigger.time = core.getTime(); convert(); } break; Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2008-09-11 12:19:18 UTC (rev 319) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2008-09-11 17:43:39 UTC (rev 320) @@ -371,6 +371,10 @@ } else { TimeEvent te = vTimeEventQueue.popFirst(); long now = getTime(); +// if (now > te.time) { +// System.out.println("VTimeEvent got delayed by: " + (now - te.time) + " at " + +// cycles + " target Time: " + te.time + " class: " + te.getClass().getName()); +// } te.execute(now); if (vTimeEventQueue.eventCount > 0) { nextVTimeEventCycles = convertVTime(vTimeEventQueue.nextTime); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-09-11 12:19:21
|
Revision: 319 http://mspsim.svn.sourceforge.net/mspsim/?rev=319&view=rev Author: nifi Date: 2008-09-11 12:19:18 +0000 (Thu, 11 Sep 2008) Log Message: ----------- added start time assignment Modified Paths: -------------- mspsim/tests/cputest.c Modified: mspsim/tests/cputest.c =================================================================== --- mspsim/tests/cputest.c 2008-09-11 11:23:57 UTC (rev 318) +++ mspsim/tests/cputest.c 2008-09-11 12:19:18 UTC (rev 319) @@ -320,6 +320,7 @@ } printf("Start modulo\n"); + time = TBR; result = 47; for (i = 0; i < 1000; i++) { result = result + i % 27; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-11 11:23:59
|
Revision: 318 http://mspsim.svn.sourceforge.net/mspsim/?rev=318&view=rev Author: joxe Date: 2008-09-11 11:23:57 +0000 (Thu, 11 Sep 2008) Log Message: ----------- updated changelog Modified Paths: -------------- mspsim/CHANGE_LOG.txt Modified: mspsim/CHANGE_LOG.txt =================================================================== --- mspsim/CHANGE_LOG.txt 2008-09-10 21:50:22 UTC (rev 317) +++ mspsim/CHANGE_LOG.txt 2008-09-11 11:23:57 UTC (rev 318) @@ -1,3 +1,9 @@ +0.93 +Changes: +- removed tick based component support from MSP430 core +- reimplemented USART to be event based instead of tick based +- ... + 0.92 Changes: - fixed bug with a write register which did not handle word/byte @@ -5,7 +11,7 @@ - fixed bug in timer causing interrupts when timer was stopped - fixed bug in timer to handle start/stop better - fixed bug in MSP430 core that caused MOV instruction to change status flags -- added getDoubleValue in DataSource and made "duty" command print +- added getDoubleValue in DataSource and made "duty" command print duty cycle information as double instead of int - fixed windows to accept double input and not only int input - corrected cycle count on some instructions @@ -33,7 +39,7 @@ 0.90 -Changes: +Changes: - fixed multiplier to handle the different modes better. - refactored so that IOUnit is no longer a Chip - added statistics commands and an exec command to the CLI This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-10 21:50:25
|
Revision: 317 http://mspsim.svn.sourceforge.net/mspsim/?rev=317&view=rev Author: joxe Date: 2008-09-10 21:50:22 +0000 (Wed, 10 Sep 2008) Log Message: ----------- fixed bad printout in test case Modified Paths: -------------- mspsim/tests/cputest.c Modified: mspsim/tests/cputest.c =================================================================== --- mspsim/tests/cputest.c 2008-09-10 21:20:01 UTC (rev 316) +++ mspsim/tests/cputest.c 2008-09-10 21:50:22 UTC (rev 317) @@ -319,7 +319,7 @@ assertTrue(times[i] >= t && times[i] < t + 2); } - printf("Start modulo\n",time = TBR); + printf("Start modulo\n"); result = 47; for (i = 0; i < 1000; i++) { result = result + i % 27; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-10 21:20:04
|
Revision: 316 http://mspsim.svn.sourceforge.net/mspsim/?rev=316&view=rev Author: joxe Date: 2008-09-10 21:20:01 +0000 (Wed, 10 Sep 2008) Log Message: ----------- removed debug printouts from CC2420 and optimized CPU speed when in LPM Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java mspsim/se/sics/mspsim/core/MSP430Core.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-09-10 16:37:22 UTC (rev 315) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-09-10 21:20:01 UTC (rev 316) @@ -307,7 +307,7 @@ switch(stateMachine) { case STATE_VREG_OFF: - System.out.println("CC2420: VREG Off."); + if (DEBUG) System.out.println("CC2420: VREG Off."); break; case STATE_POWER_DOWN: @@ -384,7 +384,7 @@ if(data == 0x7A) { // In RX mode, SFD goes high when the SFD is received setSFD(true); - System.out.println("CC2420: RX: Preamble/SFD Synchronized."); + if (DEBUG) System.out.println("CC2420: RX: Preamble/SFD Synchronized."); rxread = 0; setState(STATE_RX_FRAME); }else{ @@ -406,7 +406,7 @@ if(rxread == 0) { rxlen = (int)data; - System.out.println("CC2420: RX: Start frame length " + rxlen); + if (DEBUG) System.out.println("CC2420: RX: Start frame length " + rxlen); // FIFO pin goes high after length byte is written to RXFIFO setFIFO(true); } @@ -420,7 +420,7 @@ memory[RAM_RXFIFO + (rxfifo_write_pos -1 )] = 37 | 0x80; setFIFOP(true); setSFD(false); - System.out.println("CC2420: RX: Complete."); + if (DEBUG) System.out.println("CC2420: RX: Complete."); setState(STATE_RX_WAIT); } } @@ -647,7 +647,7 @@ flushRX(); break; case REG_SFLUSHTX: - System.out.println("CC2420: Flushing TXFIFO"); + if (DEBUG) System.out.println("CC2420: Flushing TXFIFO"); flushTX(); break; case REG_SXOSCON: @@ -739,7 +739,7 @@ // Two symbol periods to send a byte.. cpu.scheduleTimeEventMillis(sendEvent, SYMBOL_PERIOD * 2); } else { - System.out.println("Completed Transmission."); + if (DEBUG) System.out.println("Completed Transmission."); status &= ~STATUS_TX_ACTIVE; setSFD(false); setState(STATE_RX_CALIBRATE); @@ -860,11 +860,11 @@ public void setClear(boolean clear) { cca = clear; setCCA(clear); - System.out.println("CC2420: CCA: " + clear); + if (DEBUG) System.out.println("CC2420: CCA: " + clear); } public void setSFD(boolean sfd) { - System.out.println("SFD: " + sfd); + if (DEBUG) System.out.println("SFD: " + sfd); sfdPort.setPinState(sfdPin, sfd ? 1 : 0); } Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2008-09-10 16:37:22 UTC (rev 315) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2008-09-10 21:20:01 UTC (rev 316) @@ -336,8 +336,8 @@ dcoFrq = frequency; this.smclkFrq = smclkFrq; // update last virtual time before updating DCOfactor - lastCyclesTime = cycles; lastVTime = getTime(); + lastCyclesTime = cycles; currentDCOFactor = 1.0 * BasicClockModule.MAX_DCO_FRQ / frequency; if (DEBUG) System.out.println("Set smclkFrq: " + smclkFrq); @@ -663,13 +663,9 @@ /* Did not execute any instructions */ if (cpuOff) { -// System.out.println("Jumping: " + (nextIOTickCycles - cycles)); - if (cycleEventQueue.eventCount > 0) - cycles = cycleEventQueue.nextTime; - if (vTimeEventQueue.eventCount > 0 && - cycles > vTimeEventQueue.nextTime) { - cycles = vTimeEventQueue.nextTime; - } + // System.out.println("Jumping: " + (nextIOTickCycles - cycles)); + // nextEventCycles must exist, otherwise CPU can not wake up!? + cycles = nextEventCycles; return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-10 16:37:24
|
Revision: 315 http://mspsim.svn.sourceforge.net/mspsim/?rev=315&view=rev Author: joxe Date: 2008-09-10 16:37:22 +0000 (Wed, 10 Sep 2008) Log Message: ----------- fixed compile error due to Core update Modified Paths: -------------- mspsim/se/sics/mspsim/platform/esb/ESBGui.java Modified: mspsim/se/sics/mspsim/platform/esb/ESBGui.java =================================================================== --- mspsim/se/sics/mspsim/platform/esb/ESBGui.java 2008-09-10 15:44:55 UTC (rev 314) +++ mspsim/se/sics/mspsim/platform/esb/ESBGui.java 2008-09-10 16:37:22 UTC (rev 315) @@ -134,7 +134,7 @@ } beeper = new Beeper(); - cpu.addIOUnit(-1,0,-1,0,beeper, true); + cpu.addIOUnit(-1,0,-1,0,beeper); // Just a test... TODO: remove!!! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-10 16:00:36
|
Revision: 314 http://mspsim.svn.sourceforge.net/mspsim/?rev=314&view=rev Author: joxe Date: 2008-09-10 15:44:55 +0000 (Wed, 10 Sep 2008) Log Message: ----------- removed all IOTick - active IO units and replaced with event based Modified Paths: -------------- mspsim/se/sics/mspsim/core/MSP430Core.java mspsim/se/sics/mspsim/core/USART.java Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2008-09-10 13:38:45 UTC (rev 313) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2008-09-10 15:44:55 UTC (rev 314) @@ -77,16 +77,10 @@ // For notify read... -> which will happen before actual read! public IOUnit[] memIn = new IOUnit[MAX_MEM_IO]; - private IOUnit[] ioUnits; private IOUnit[] passiveIOUnits; private SFR sfr; - private long[] ioCycles; - private long nextIOTickCycles; - private int nextIOTickIndex; - private int lastIOUnitPos = 0; - - // From the possible interrupt sources - to be able to indicate is serviced. + // From the possible interrupt sources - to be able to indicate is serviced. private IOUnit interruptSource[] = new IOUnit[16]; private int interruptMax = -1; @@ -122,15 +116,10 @@ public MSP430Core(int type) { // Ignore type for now... setModeNames(MODE_NAMES); - // Internal Active IOUnits int passIO = 0; - int actIO = 0; - ioUnits = new IOUnit[10]; - ioCycles = new long[10]; - // Passive IOUnits (no tick) - should likely be placed in a hashtable? // Maybe for debugging purposes... - passiveIOUnits = new IOUnit[PORTS + 4]; + passiveIOUnits = new IOUnit[PORTS + 6]; Timer ta = new Timer(this, Timer.TIMER_Ax149, memory, 0x160); Timer tb = new Timer(this, Timer.TIMER_Bx149, memory, 0x180); @@ -168,9 +157,6 @@ USART usart0 = new USART(this, memory, 0x70); USART usart1 = new USART(this, memory, 0x78); - - ioUnits[actIO++] = usart0; - ioUnits[actIO++] = usart1; for (int i = 0, n = 8; i < n; i++) { memOut[0x70 + i] = usart0; @@ -210,6 +196,11 @@ // Basic clock syst. passiveIOUnits[passIO++] = bcs; + + // Usarts + passiveIOUnits[passIO++] = usart0; + passiveIOUnits[passIO++] = usart1; + // Add the timers passiveIOUnits[passIO++] = ta; @@ -230,10 +221,7 @@ memOut[0x1A0 + i] = adc12; memIn[0x1A0 + i] = adc12; } - System.out.println("Number of active: " + actIO); System.out.println("Number of passive: " + passIO); - lastIOUnitPos = actIO; - initIOUnit(); } @@ -243,16 +231,12 @@ public void addIOUnit(int loReadMem, int hiReadMem, int loWriteMem, int hiWriteMem, - IOUnit unit, boolean active) { + IOUnit unit) { // Not implemented yet... IS it needed? // if (loReadMem != -1) { // for (int i = lo, n = hiMem; i < n; i++) { // } // } - - if (active) { - ioUnits[lastIOUnitPos++] = unit; - } } public void setBreakPoint(int address, CPUMonitor mon) { @@ -472,37 +456,16 @@ return passiveIOUnits[i]; } } - - for (int i = 0, n = ioUnits.length; i < n; i++) { - if (name.equals(ioUnits[i].getName())) { - return ioUnits[i]; - } - } - return null; } - private void initIOUnit() { - long smallestCyc = 10000000l; - for (int i = 0, n = lastIOUnitPos; i < n; i++) { - if ((ioCycles[i] = ioUnits[i].ioTick(0)) < smallestCyc) { - smallestCyc = ioCycles[i]; - nextIOTickIndex = i; - } - } - } - private void resetIOUnits() { - for (int i = 0, n = lastIOUnitPos; i < n; i++) { - ioUnits[i].reset(RESET_POR); - } for (int i = 0, n = passiveIOUnits.length; i < n; i++) { passiveIOUnits[i].reset(RESET_POR); } } private void internalReset() { - resetIOUnits(); for (int i = 0, n = 16; i < n; i++) { interruptSource[i] = null; } @@ -513,6 +476,10 @@ cycleEventQueue.removeAll(); vTimeEventQueue.removeAll(); + + // Needs to be last since these can add events... + resetIOUnits(); + } public void reset() { @@ -573,27 +540,6 @@ servicedInterrupt = -1; servicedInterruptUnit = null; } - - private void handleIO() { - // Call the IO unit! - // System.out.println("Calling: " + ioUnits[nextIOTickIndex].getName()); - ioCycles[nextIOTickIndex] = ioUnits[nextIOTickIndex].ioTick(cycles); - - // Find the next unit to call... - long smallestCyc = cycles + 1000000l; - int index = 0; - for (int i = 0, n = lastIOUnitPos; i < n; i++) { - if (ioCycles[i] < smallestCyc) { - smallestCyc = ioCycles[i]; - index = i; - } - } - nextIOTickCycles = smallestCyc; - nextIOTickIndex = index; -// System.out.println("Smallest IO cycles: " + smallestCyc + " => " + -// ioUnits[index].getName()); - } - // Read method that handles read from IO units! public int read(int address, boolean word) { @@ -709,14 +655,6 @@ } // ------------------------------------------------------------------- - // (old) I/O processing - // ------------------------------------------------------------------- - if (cycles >= nextIOTickCycles) { - handleIO(); - } - - - // ------------------------------------------------------------------- // Interrupt processing [after the last instruction was executed] // ------------------------------------------------------------------- if (interruptsEnabled && servicedInterrupt == -1 && interruptMax >= 0) { @@ -726,7 +664,12 @@ /* Did not execute any instructions */ if (cpuOff) { // System.out.println("Jumping: " + (nextIOTickCycles - cycles)); - cycles = nextIOTickCycles; + if (cycleEventQueue.eventCount > 0) + cycles = cycleEventQueue.nextTime; + if (vTimeEventQueue.eventCount > 0 && + cycles > vTimeEventQueue.nextTime) { + cycles = vTimeEventQueue.nextTime; + } return false; } Modified: mspsim/se/sics/mspsim/core/USART.java =================================================================== --- mspsim/se/sics/mspsim/core/USART.java 2008-09-10 13:38:45 UTC (rev 313) +++ mspsim/se/sics/mspsim/core/USART.java 2008-09-10 15:44:55 UTC (rev 314) @@ -87,7 +87,7 @@ private int clockSource = 0; private int baudRate = 0; - private int tickPerByte = 0; + private int tickPerByte = 1000; private long nextTXReady = -1; private MSP430Core cpu; @@ -102,6 +102,14 @@ private int urxbuf; private int utxbuf; + + private TimeEvent txTrigger = new TimeEvent(0) { + public void execute(long t) { + // Ready to transmit new byte! + handleTransmit(t); + } + }; + /** * Creates a new <code>USART</code> instance. * @@ -129,11 +137,14 @@ urxifg = URXIFG1; memory[IFG1 + 1] = 0x20; } + nextTXReady = cpu.cycles + 1000; + cpu.scheduleCycleEvent(txTrigger, nextTXReady); } public void reset(int type) { nextTXReady = cpu.cycles + 1000; + cpu.scheduleCycleEvent(txTrigger, nextTXReady); } private void setBitIFG(int bits) { @@ -204,8 +215,8 @@ updateBaudRate(); break; case UTXBUF: - if (DEBUG) System.out.print(getName() + ": USART_UTXBUF:" + (char) data + "\n"); - + if (DEBUG) System.out.print(getName() + ": USART_UTXBUF:" + (char) data + " = " + data + "\n"); + if (listener != null) { listener.dataReceived(this, data); } @@ -217,7 +228,9 @@ if (DEBUG) System.out.println(getName() + " flagging off transmit interrupt"); cpu.flagInterrupt(transmitInterrupt, this, false); + // Schedule on cycles here... nextTXReady = cycles + tickPerByte; + cpu.scheduleCycleEvent(txTrigger, nextTXReady); // We should set the "not-ready" flag here! // When should the reception interrupt be received!? @@ -296,31 +309,17 @@ cpu.flagInterrupt(vector, this, false); } + private void handleTransmit(long cycles) { + setBitIFG(utxifg); + utctl |= UTCTL_TXEMPTY; + cpu.flagInterrupt(transmitInterrupt, this, isIEBitsSet(utxifg)); - // This should be used to delay the output of the USART down to the - // baudrate! - public long ioTick(long cycles) { - if (nextTXReady != -1 && cycles >= nextTXReady) { - // Ready to transmit new byte! - - setBitIFG(utxifg); - utctl |= UTCTL_TXEMPTY; - cpu.flagInterrupt(transmitInterrupt, this, isIEBitsSet(utxifg)); - - if (DEBUG) { - if (isIEBitsSet(utxifg)) { - System.out.println(getName() + " flagging on transmit interrupt"); - } - System.out.println(getName() + " Ready to transmit next: " + cycles + " " + - tickPerByte); + if (DEBUG) { + if (isIEBitsSet(utxifg)) { + System.out.println(getName() + " flagging on transmit interrupt"); } - nextTXReady = -1; + System.out.println(getName() + " Ready to transmit next at: " + cycles); } - if (baudRate == 0) { - return cycles + 1000; - } else { - return cycles + tickPerByte; - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-10 13:39:03
|
Revision: 313 http://mspsim.svn.sourceforge.net/mspsim/?rev=313&view=rev Author: joxe Date: 2008-09-10 13:38:45 +0000 (Wed, 10 Sep 2008) Log Message: ----------- fixed usart to not wait two bytes before triggering txready Modified Paths: -------------- mspsim/se/sics/mspsim/core/USART.java mspsim/se/sics/mspsim/platform/esb/ESBGui.java mspsim/tests/cputest.c Modified: mspsim/se/sics/mspsim/core/USART.java =================================================================== --- mspsim/se/sics/mspsim/core/USART.java 2008-09-10 10:37:28 UTC (rev 312) +++ mspsim/se/sics/mspsim/core/USART.java 2008-09-10 13:38:45 UTC (rev 313) @@ -266,12 +266,14 @@ } if (clockSource == MSP430Constants.CLK_ACLK) { if (DEBUG) { - System.out.println(getName() + " Baud rate is: " + cpu.aclkFrq / div); + System.out.println(getName() + " Baud rate is (bps): " + cpu.aclkFrq / div + + " div = " + div); } baudRate = cpu.aclkFrq / div; } else { - if (DEBUG) { - System.out.println(getName() + " Baud rate is: " + cpu.smclkFrq / div); + if (DEBUG) { + System.out.println(getName() + " Baud rate is (bps): " + cpu.smclkFrq / div + + " div = " + div); } baudRate = cpu.smclkFrq / div; } @@ -298,7 +300,7 @@ // This should be used to delay the output of the USART down to the // baudrate! public long ioTick(long cycles) { - if (nextTXReady != -1 && cycles > nextTXReady) { + if (nextTXReady != -1 && cycles >= nextTXReady) { // Ready to transmit new byte! setBitIFG(utxifg); Modified: mspsim/se/sics/mspsim/platform/esb/ESBGui.java =================================================================== --- mspsim/se/sics/mspsim/platform/esb/ESBGui.java 2008-09-10 10:37:28 UTC (rev 312) +++ mspsim/se/sics/mspsim/platform/esb/ESBGui.java 2008-09-10 13:38:45 UTC (rev 313) @@ -248,7 +248,6 @@ } public void keyPressed(KeyEvent key) { -// System.out.println("Key Pressed: " + key.getKeyChar()); if (key.getKeyChar() == 'd') { node.setDebug(!node.getDebug()); } Modified: mspsim/tests/cputest.c =================================================================== --- mspsim/tests/cputest.c 2008-09-10 10:37:28 UTC (rev 312) +++ mspsim/tests/cputest.c 2008-09-10 13:38:45 UTC (rev 313) @@ -284,6 +284,8 @@ static void testTimer() { int i; + unsigned int time; + int result; pos = 0; dint(); /* Select SMCLK (2.4576MHz), clear TAR; This makes the rtimer count @@ -316,6 +318,15 @@ printf("Trigg time %d => %u\n", i + 1, times[i]); assertTrue(times[i] >= t && times[i] < t + 2); } + + printf("Start modulo\n",time = TBR); + result = 47; + for (i = 0; i < 1000; i++) { + result = result + i % 27; + } + printf("Elapsed %i %i\n",TBR - time, result); + + } /*--------------------------------------------------------------------------*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-09-10 10:37:31
|
Revision: 312 http://mspsim.svn.sourceforge.net/mspsim/?rev=312&view=rev Author: joxe Date: 2008-09-10 10:37:28 +0000 (Wed, 10 Sep 2008) Log Message: ----------- fixed potential error in testcase Modified Paths: -------------- mspsim/tests/cputest.c Modified: mspsim/tests/cputest.c =================================================================== --- mspsim/tests/cputest.c 2008-09-09 20:58:19 UTC (rev 311) +++ mspsim/tests/cputest.c 2008-09-10 10:37:28 UTC (rev 312) @@ -274,11 +274,11 @@ ME1 |= (UTXE0 | URXE0); /* Enable USART0 TXD/RXD */ IE1 |= UTXIE0; /* Enable USART0 TX interrupt */ TXBUF_0 = 'a'; - + while(flag == 0) { } while(delay-- > 0); - + printf("output finished...\n"); } @@ -292,30 +292,32 @@ /* Select ACLK 32768Hz clock, divide by 1 (was ID_3 / 8 previously) */ TBCTL = TBSSEL0 | TBCLR | ID_0; - /* CCR1 interrupt enabled, interrupt occurs when timer equals CCR1. */ - TBCCTL1 = CCIE; - /* Start Timer_B in continuous mode. */ TBCTL |= MC1; TBR = 0; TBCCR1 = 100; - + + /* CCR1 interrupt enabled, interrupt occurs when timer equals CCR1. */ + /* Should be set here, since setting TBR to zero can cause triggering */ + /* if CCR1 = 0 */ + TBCCTL1 = CCIE; + /* Enable interrupts. */ eint(); - + while (pos < 10) { printf("."); } printf("\n"); - + for (i = 0; i < pos; i++) { unsigned int t = 100 + i * 100; printf("Trigg time %d => %u\n", i + 1, times[i]); assertTrue(times[i] >= t && times[i] < t + 2); } } - + /*--------------------------------------------------------------------------*/ int This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |