fixed so that ADC12 can be stopped and added multiplication command for CLI

git-svn-id: https://mspsim.svn.sourceforge.net/svnroot/mspsim/mspsim@325 23d1a52b-0c3c-0410-b72d-8f29ab48fe35
This commit is contained in:
joxe 2008-09-15 20:26:34 +00:00
parent 8fc6b0c483
commit 285167ddfd
4 changed files with 35 additions and 6 deletions

View File

@ -1,11 +1,13 @@
0.93
Changes:
- removed tick based component support from MSP430 core
- reimplemented USART to be event based instead of tick based
- re-implemented 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...)
- fixed RadioWrapper for backward compatibility with PacketListener
(for the CC2420).
0.92
Changes:

View File

@ -223,14 +223,16 @@ public class ADC12 extends IOUnit {
}
private void convert() {
// If either off or not enable conversion then just return...
if (!adc12On || !enableConversion) return;
// Some noice...
ADCInput input = adcInput[adc12mctl[adc12Pos] & 0x7];
adc12mem[adc12Pos] = input != null ? input.nextData() : 2048 + 100 - (int) Math.random() * 200;
if ((adc12ie & (1 << adc12Pos)) > 0) {
adc12ifg |= (1 << adc12Pos);
// This should check if there already is an hihger iv!
// This should check if there already is an higher iv!
adc12iv = adc12Pos * 2 + 6;
// System.out.println("** Trigger ADC12 IRQ for ADCMEM" + adc12Pos);
//System.out.println("** Trigger ADC12 IRQ for ADCMEM" + adc12Pos);
core.flagInterrupt(adc12Vector, this, true);
}
// Increase
@ -240,7 +242,6 @@ public class ADC12 extends IOUnit {
adc12Pos = (adc12Pos + 1) & 0x0f;
}
int delay = adcDiv * (shTime0 + 13);
//System.out.println("Sampling again after: " + delay + " => " + adc12Pos);
core.scheduleTimeEvent(adcTrigger, adcTrigger.time + delay);
}

View File

@ -43,7 +43,7 @@ package se.sics.mspsim.core;
public interface MSP430Constants {
public static final String VERSION = "0.92";
public static final String VERSION = "0.93";
public static final int RESET_PUC = 0;
public static final int RESET_POR = 1;

View File

@ -43,6 +43,7 @@ import java.io.PrintStream;
import se.sics.mspsim.cli.BasicAsyncCommand;
import se.sics.mspsim.cli.BasicCommand;
import se.sics.mspsim.cli.BasicLineCommand;
import se.sics.mspsim.cli.CommandBundle;
import se.sics.mspsim.cli.CommandContext;
import se.sics.mspsim.cli.CommandHandler;
@ -92,6 +93,31 @@ public class StatCommands implements CommandBundle {
});
handler.registerCommand("mult", new BasicLineCommand("multiply line of doubles",
"[m1...mn]") {
double[] multiplicator;
private PrintStream out;
public int executeCommand(CommandContext context) {
this.out = context.out;
int args = context.getArgumentCount();
multiplicator = new double[args];
for(int i = 0; i < args; i++) {
multiplicator[i] = context.getArgumentAsDouble(i);
}
return 0;
}
public void lineRead(String line) {
// Split & parse double on each + multiplicate...
String[] parts = line.split(" ");
for(int i = 0; i < parts.length; i++) {
out.print(multiplicator[i % multiplicator.length] * Double.parseDouble(parts[i]) + " ");
}
out.println();
}
public void stopCommand(CommandContext context) {
}
});
handler.registerCommand("duty", new BasicAsyncCommand("add a duty cycle sampler for operating modes to the specified chips",
"<frequency> <chip> [chips...]") {