Search in sources :

Example 6 with Signal

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()));
    }
}
Also used : Signal(net.sourceforge.usbdm.deviceEditor.information.Signal) Pin(net.sourceforge.usbdm.deviceEditor.information.Pin)

Example 7 with Signal

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();
}
Also used : Signal(net.sourceforge.usbdm.deviceEditor.information.Signal)

Example 8 with Signal

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);
}
Also used : Signal(net.sourceforge.usbdm.deviceEditor.information.Signal)

Example 9 with Signal

use of net.sourceforge.usbdm.deviceEditor.information.Signal in project usbdm-eclipse-plugins by podonoghue.

the class ParseFamilyXML method parsePin.

/**
 * Parse &lt;pin&gt;
 *
 * @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() + "\'");
        }
    }
}
Also used : MuxSelection(net.sourceforge.usbdm.deviceEditor.information.MuxSelection) Signal(net.sourceforge.usbdm.deviceEditor.information.Signal) Pin(net.sourceforge.usbdm.deviceEditor.information.Pin) Node(org.w3c.dom.Node) Element(org.w3c.dom.Element)

Example 10 with Signal

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;
    }
}
Also used : PinListVariable(net.sourceforge.usbdm.deviceEditor.information.PinListVariable) Status(net.sourceforge.usbdm.deviceEditor.model.Status) Signal(net.sourceforge.usbdm.deviceEditor.information.Signal) LongVariable(net.sourceforge.usbdm.deviceEditor.information.LongVariable) BooleanVariable(net.sourceforge.usbdm.deviceEditor.information.BooleanVariable) DoubleVariable(net.sourceforge.usbdm.deviceEditor.information.DoubleVariable) ChoiceVariable(net.sourceforge.usbdm.deviceEditor.information.ChoiceVariable)

Aggregations

Signal (net.sourceforge.usbdm.deviceEditor.information.Signal)12 Pin (net.sourceforge.usbdm.deviceEditor.information.Pin)5 MappingInfo (net.sourceforge.usbdm.deviceEditor.information.MappingInfo)4 MuxSelection (net.sourceforge.usbdm.deviceEditor.information.MuxSelection)4 BooleanVariable (net.sourceforge.usbdm.deviceEditor.information.BooleanVariable)2 ChoiceVariable (net.sourceforge.usbdm.deviceEditor.information.ChoiceVariable)2 Peripheral (net.sourceforge.usbdm.deviceEditor.information.Peripheral)2 Status (net.sourceforge.usbdm.deviceEditor.model.Status)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 DevicePackage (net.sourceforge.usbdm.deviceEditor.information.DevicePackage)1 DoubleVariable (net.sourceforge.usbdm.deviceEditor.information.DoubleVariable)1 LongVariable (net.sourceforge.usbdm.deviceEditor.information.LongVariable)1 InfoTable (net.sourceforge.usbdm.deviceEditor.information.Peripheral.InfoTable)1 PinListVariable (net.sourceforge.usbdm.deviceEditor.information.PinListVariable)1 StringVariable (net.sourceforge.usbdm.deviceEditor.information.StringVariable)1 CategoryModel (net.sourceforge.usbdm.deviceEditor.model.CategoryModel)1 UsbdmException (net.sourceforge.usbdm.jni.UsbdmException)1