Merge pull request #46 from joakimeriksson/config_dco_speed

fixed configuration for maximum DCO clock speed
This commit is contained in:
Niclas Finne 2015-09-08 11:27:25 +02:00
commit 568c789f7e
3 changed files with 18 additions and 6 deletions

View File

@ -133,9 +133,14 @@ public class MSP430f2617Config extends MSP430Config {
return 4 + 6;
}
@Override
public int getMaxClockSpeed() {
return 9000000;
}
@Override
public String getAddressAsString(int addr) {
return Utils.hex20(addr);
}
}
}

View File

@ -57,9 +57,9 @@ public class BasicClockModule extends ClockSystem {
// Max speed is 8Mhz (CPU limits it) - is max DCO 8Mhz?
// Based on the scatterweb code it looks like less than
// 5Mhz is more correct...
private static final int MAX_DCO_FRQ = 4915200;
private static final int MIN_DCO_FRQ = 1000;
private static final int DCO_FACTOR = (MAX_DCO_FRQ - MIN_DCO_FRQ) / 2048;
private final int MAX_DCO_FRQ;
private final int MIN_DCO_FRQ = 1000;
private final int DCO_FACTOR;
private Timer[] timers;
@ -81,8 +81,11 @@ public class BasicClockModule extends ClockSystem {
* Creates a new <code>BasicClockModule</code> instance.
*
*/
public BasicClockModule(MSP430Core core, int[] memory, int offset, Timer[] timers) {
public BasicClockModule(MSP430Core core, int[] memory, int offset, Timer[] timers, int maxClockSpeed) {
super("BasicClockModule", core, memory, offset);
MAX_DCO_FRQ = maxClockSpeed;
DCO_FACTOR = (MAX_DCO_FRQ - MIN_DCO_FRQ) / 2048;
this.timers = timers;
// reset(0);
}

View File

@ -152,12 +152,16 @@ public abstract class MSP430Config {
ramMirrorAddress = address;
}
public int getMaxClockSpeed() {
return 4915200;
}
public void ioMemSize(int size) {
maxMemIO = size;
}
public ClockSystem createClockSystem(MSP430Core cpu, int[] memory, Timer[] timers) {
return new BasicClockModule(cpu, memory, 0, timers);
return new BasicClockModule(cpu, memory, 0, timers, getMaxClockSpeed());
}
}