From: <jo...@us...> - 2010-03-26 14:26:45
|
Revision: 683 http://mspsim.svn.sourceforge.net/mspsim/?rev=683&view=rev Author: joxe Date: 2010-03-26 14:26:37 +0000 (Fri, 26 Mar 2010) Log Message: ----------- fixed bug in watchdog timer Modified Paths: -------------- mspsim/se/sics/mspsim/core/SFR.java mspsim/se/sics/mspsim/core/Watchdog.java Modified: mspsim/se/sics/mspsim/core/SFR.java =================================================================== --- mspsim/se/sics/mspsim/core/SFR.java 2010-03-26 13:13:57 UTC (rev 682) +++ mspsim/se/sics/mspsim/core/SFR.java 2010-03-26 14:26:37 UTC (rev 683) @@ -46,7 +46,7 @@ */ public class SFR extends IOUnit { - private boolean DEBUG = false;//true; + private boolean DEBUG = false; public static final int IE1 = 0; public static final int IE2 = 1; @@ -110,7 +110,7 @@ switch (address) { case IE1: case IE2: - updateIE(address - IE1, value); + updateIE(address - IE1, value); break; case IFG1: case IFG2: @@ -200,12 +200,12 @@ if (sfrModule[pos] != null && !irqTriggered[irqVector[pos]]) { /* interrupt goes directly to the module responsible */ if (DEBUG) System.out.println("SFR: flagging interrupt: " + - sfrModule[pos].getName() + " pos: " + pos + " " + (ie & ifg & 1) + " chg: " + change); + sfrModule[pos].getName() + " pos: " + pos + " ie: " + (ie & 1) + " ifg:" + (ifg & 1) + " chg: " + change); if ((ie & ifg & 1) > 0) { int vector = irqVector[pos]; irqTriggered[vector] = true; irqTriggeredPos[vector] = pos; - cpu.flagInterrupt(irqVector[pos], this, true); + cpu.flagInterrupt(vector, this, true); } // cpu.flagInterrupt(irqVector[pos], sfrModule[pos], (ie & ifg & 1) > 0); } @@ -261,6 +261,9 @@ } else { ifg2 &= ~(1 << bit); } + if (DEBUG) { + System.out.println("SFR: cleared interrupt for " + sfrModule[pos] + " vector: " + vector); + } } cpu.flagInterrupt(vector, this, false); if (sfrModule[pos] != null) { Modified: mspsim/se/sics/mspsim/core/Watchdog.java =================================================================== --- mspsim/se/sics/mspsim/core/Watchdog.java 2010-03-26 13:13:57 UTC (rev 682) +++ mspsim/se/sics/mspsim/core/Watchdog.java 2010-03-26 14:26:37 UTC (rev 683) @@ -59,6 +59,7 @@ private static final int WATCHDOG_VECTOR = 10; private static final int WATCHDOG_INTERRUPT_BIT = 0; + private static final int WATCHDOG_INTERRUPT_VALUE = 1 << WATCHDOG_INTERRUPT_BIT; private static final int RESET_VECTOR = 15; private static final int[] DELAY = { @@ -105,7 +106,7 @@ // Here the WDT triggered!!! if (timerMode) { SFR sfr = cpu.getSFR(); - sfr.setBitIFG(0, WATCHDOG_INTERRUPT_BIT); + sfr.setBitIFG(0, WATCHDOG_INTERRUPT_VALUE); scheduleTimer(); } else { System.out.println("WDT trigger - will reset node!"); @@ -148,6 +149,7 @@ } } } + private void scheduleTimer() { if (sourceACLK) { if (DEBUG) System.out.println("setting delay in ms (ACLK): " + 1000.0 * delay / cpu.aclkFrq); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |