use of net.sourceforge.usbdm.deviceEditor.information.Signal in project usbdm-eclipse-plugins by podonoghue.
the class ModelFactory method report.
void report() {
for (String key : fDeviceInfo.getPins().keySet()) {
Pin pin = fDeviceInfo.getPins().get(key);
System.err.println(String.format("Pin:%-15s => %-15s %s", pin.getName(), pin.getMuxValue() + ",", pin.getMappableSignals().get(pin.getMuxValue())));
}
for (String key : fDeviceInfo.getSignals().keySet()) {
Signal signal = fDeviceInfo.getSignals().get(key);
System.err.println(String.format("Signal: %-15s => %-15s", signal.getName(), signal.getMappedPin()));
}
}
use of net.sourceforge.usbdm.deviceEditor.information.Signal in project usbdm-eclipse-plugins by podonoghue.
the class FamilyXmlWriter method writeSignals.
@SuppressWarnings("unused")
private void writeSignals(XmlDocumentUtilities documentUtilities) throws IOException {
documentUtilities.openTag("signals");
for (String signalName : fDeviceInfo.getSignals().keySet()) {
Signal signal = fDeviceInfo.getSignals().get(signalName);
documentUtilities.openTag("signal");
documentUtilities.writeAttribute("name", signal.getName());
documentUtilities.writeAttribute("peripheral", signal.getPeripheral().getName());
documentUtilities.closeTag();
}
documentUtilities.closeTag();
}
use of net.sourceforge.usbdm.deviceEditor.information.Signal in project usbdm-eclipse-plugins by podonoghue.
the class WriterForAdc method getDeclaration.
@Override
protected String getDeclaration(MappingInfo mappingInfo, int fnIndex) {
Signal signal = mappingInfo.getSignals().get(fnIndex);
if (!signal.getSignalName().matches("^(SE)(\\d+)(a|b)?$")) {
// Only single-ended channels can be declared
return null;
}
int signalIndex = getSignalIndex(mappingInfo.getSignals().get(fnIndex));
return String.format("const %s::%s<%d>", DeviceInfo.NAME_SPACE, getClassName() + "Channel", signalIndex);
}
use of net.sourceforge.usbdm.deviceEditor.information.Signal in project usbdm-eclipse-plugins by podonoghue.
the class ParseFamilyXML method parsePin.
/**
* Parse <pin>
*
* @param pinElement
* @throws Exception
*/
private void parsePin(Element pinElement) throws Exception {
Pin pin = fDeviceInfo.createPin(pinElement.getAttribute("name"));
for (Node node = pinElement.getFirstChild(); node != null; node = node.getNextSibling()) {
if (node.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
Element element = (Element) node;
if (element.getTagName() == "mux") {
// factory.createMapping(factory.findSignal(element.getAttribute("signal")), pin, MuxSelection.valueOf(element.getAttribute("sel")));
Signal signal = fDeviceInfo.findOrCreateSignal(element.getAttribute("signal"));
MuxSelection muxSelection = MuxSelection.valueOf(element.getAttribute("sel"));
fDeviceInfo.createMapping(signal, pin, muxSelection);
if (signal.getName().startsWith("GPIO")) {
pin.setPort(signal);
}
} else if (element.getTagName() == "reset") {
MuxSelection muxSelection = MuxSelection.valueOf(element.getAttribute("sel"));
pin.setResetValue(muxSelection);
} else {
throw new Exception("Unexpected field in PIN, value = \'" + element.getTagName() + "\'");
}
}
}
use of net.sourceforge.usbdm.deviceEditor.information.Signal in project usbdm-eclipse-plugins by podonoghue.
the class LcdValidate method validate.
/**
* Class to validate LCD settings
* @throws Exception
*/
@Override
public void validate(Variable variable) throws Exception {
super.validate(variable);
String osc0_peripheral = getStringVariable("/SIM/osc0_peripheral").getValueAsString();
LongVariable osc0_oscer_clockVar = getLongVariable(osc0_peripheral + "/oscer_clock");
LongVariable system_erclk32k_clockVar = getLongVariable("/SIM/system_erclk32k_clock");
LongVariable system_mcgirclk_clockVar = getLongVariable("/MCG/system_mcgirclk_clock");
ChoiceVariable lcd_gcr_clockVar = getChoiceVariable("lcd_gcr_clock");
ChoiceVariable lcd_gcr_altdivVar = getChoiceVariable("lcd_gcr_altdiv");
DoubleVariable lcdClockVar = getDoubleVariable("lcdClock");
BooleanVariable lcd_gcr_rvenVar = getBooleanVariable("lcd_gcr_rven");
ChoiceVariable lcd_gcr_rvtrimVar = getChoiceVariable("lcd_gcr_rvtrim");
lcd_gcr_rvtrimVar.enable(lcd_gcr_rvenVar.getValueAsBoolean());
ChoiceVariable lcd_gcr_dutyVar = getChoiceVariable("lcd_gcr_duty");
PinListVariable backplanesVar = (PinListVariable) getVariable("backplanes");
PinListVariable frontplanesVar = (PinListVariable) getVariable("frontplanes");
Vector<Signal> table = getPeripheral().getSignalTables().get(0).table;
Status unmappedBackplanesMessage = null;
int[] backPlaneValues = backplanesVar.getValues();
for (int pinNum : backPlaneValues) {
Signal entry = table.get(pinNum);
if ((entry == null) || (entry.getMappedPin().getPin() == Pin.UNASSIGNED_PIN)) {
unmappedBackplanesMessage = UNMAPPED_PIN_STATUS;
break;
}
}
backplanesVar.setStatus(unmappedBackplanesMessage);
Status unmappedFrontplanesMessage = null;
int[] frontPlaneValues = frontplanesVar.getValues();
for (int pinNum : frontPlaneValues) {
Signal entry = table.get(pinNum);
if ((entry == null) || (entry.getMappedPin().getPin() == Pin.UNASSIGNED_PIN)) {
unmappedFrontplanesMessage = UNMAPPED_PIN_STATUS;
break;
}
}
frontplanesVar.setStatus(unmappedFrontplanesMessage);
// Number of back-planes is determined by duty-cycle
backplanesVar.setMinListLength(0);
backplanesVar.setListLength((int) lcd_gcr_dutyVar.getValueAsLong() + 1);
// Number of front-planes is determined by pins left over from back-planes
frontplanesVar.setMinListLength(0);
frontplanesVar.setMaxListLength(63 - ((int) lcd_gcr_dutyVar.getValueAsLong() + 1));
double divider = 1 << (3 * lcd_gcr_altdivVar.getValueAsLong());
switch((int) lcd_gcr_clockVar.getValueAsLong()) {
default:
lcd_gcr_clockVar.setValue(0);
case 0:
lcd_gcr_altdivVar.enable(false);
lcdClockVar.setValue(system_erclk32k_clockVar.getValueAsLong());
lcdClockVar.setOrigin(system_erclk32k_clockVar.getOrigin());
lcdClockVar.setStatus(system_erclk32k_clockVar.getFilteredStatus());
break;
case 1:
lcd_gcr_altdivVar.enable(true);
lcdClockVar.setValue(system_mcgirclk_clockVar.getValueAsLong() / divider);
lcdClockVar.setOrigin(system_mcgirclk_clockVar.getOrigin() + " / ALTDIV");
lcdClockVar.setStatus(system_mcgirclk_clockVar.getFilteredStatus());
break;
case 2:
lcd_gcr_altdivVar.enable(true);
lcdClockVar.setValue(osc0_oscer_clockVar.getValueAsLong() / divider);
lcdClockVar.setOrigin(osc0_oscer_clockVar.getOrigin() + " / ALTDIV");
lcdClockVar.setStatus(osc0_oscer_clockVar.getFilteredStatus());
break;
}
}
Aggregations