Publish the UART/USCI used for serial output by the platform in the registry as 'serialio'

This commit is contained in:
Niclas Finne 2012-05-31 01:23:34 +02:00
parent 3ddcfefe04
commit e2e1fba86d
6 changed files with 34 additions and 2 deletions

View File

@ -161,6 +161,11 @@ public class ESBNode extends GenericNode implements PortListener {
leds = new Leds(cpu, LEDS);
button = new Button("Button", cpu, port2, BUTTON_PIN, true);
beeper = new Beeper(cpu);
USART usart = cpu.getIOUnit(USART.class, "USART1");
if (usart != null) {
registry.registerComponent("serialio", usart);
}
}
public void setupNode() {

View File

@ -92,6 +92,11 @@ public abstract class CC2420Node extends GenericNode implements PortListener, US
usart0.addUSARTListener(this);
radio.setSFDPort(port4, CC2420_SFD);
USART usart = cpu.getIOUnit(USART.class, "USART1");
if (usart != null) {
registry.registerComponent("serialio", usart);
}
}
public void setupNode() {

View File

@ -8,6 +8,7 @@ import se.sics.mspsim.core.EmulationException;
import se.sics.mspsim.core.IOPort;
import se.sics.mspsim.core.IOUnit;
import se.sics.mspsim.core.PortListener;
import se.sics.mspsim.core.USART;
import se.sics.mspsim.core.USARTListener;
import se.sics.mspsim.core.USARTSource;
import se.sics.mspsim.platform.GenericNode;
@ -91,6 +92,11 @@ public class Exp5438Node extends GenericNode implements PortListener, USARTListe
} else {
throw new EmulationException("Could not setup exp5438 mote - missing USCI B0");
}
IOUnit usart = cpu.getIOUnit("USCI A1");
if (usart instanceof USARTSource) {
registry.registerComponent("serialio", usart);
}
}
public void setupNode() {

View File

@ -117,6 +117,11 @@ public class TyndallNode extends GenericNode implements PortListener, USARTListe
} else {
throw new EmulationException("Could not setup tyndall mote - missing USCI B0");
}
IOUnit usart = cpu.getIOUnit("USCI A0");
if (usart instanceof USARTSource) {
registry.registerComponent("serialio", usart);
}
}
public void setupNode() {

View File

@ -174,6 +174,11 @@ public class WismoteNode extends GenericNode implements PortListener, USARTListe
}
leds = new Leds(cpu, LEDS);
button = new Button("Button", cpu, port2, BUTTON_PIN, true);
IOUnit usart = cpu.getIOUnit("USCI A1");
if (usart instanceof USARTSource) {
registry.registerComponent("serialio", usart);
}
}
public void setupNode() {
@ -202,7 +207,7 @@ public class WismoteNode extends GenericNode implements PortListener, USARTListe
// Add some windows for listening to serial output
IOUnit usart = cpu.getIOUnit("USCI A1");
if (usart instanceof USARTSource) {
SerialMon serial = new SerialMon((USARTSource)usart, "USCI A0 Port Output");
SerialMon serial = new SerialMon((USARTSource)usart, "USCI A1 Port Output");
registry.registerComponent("serialgui", serial);
}
}

View File

@ -173,6 +173,12 @@ public class Z1Node extends GenericNode implements PortListener, USARTListener {
leds = new Leds(cpu, LEDS);
button = new Button("Button", cpu, port2, BUTTON_PIN, true);
IOUnit usart = cpu.getIOUnit("USCI A0");
if (usart instanceof USARTSource) {
registry.registerComponent("serialio", usart);
}
if (getFlash() == null) {
setFlash(new M25P80(cpu));
}
@ -207,7 +213,7 @@ public class Z1Node extends GenericNode implements PortListener, USARTListener {
// Add some windows for listening to serial output
IOUnit usart = cpu.getIOUnit("USCI A0");
if (usart instanceof USARTSource) {
SerialMon serial = new SerialMon((USARTSource)usart, "USART1 Port Output");
SerialMon serial = new SerialMon((USARTSource)usart, "USCI A0 Port Output");
registry.registerComponent("serialgui", serial);
}
}