Search in sources :

Example 6 with Pin

use of net.sourceforge.usbdm.deviceEditor.information.Pin 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 Pin

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

the class TestParseXML method report.

static void report(DeviceInfo deviceInfo) {
    for (String key : deviceInfo.getDeviceVariants().keySet()) {
        DeviceVariantInformation deviceInformation = deviceInfo.findVariant(key);
        System.err.println("deviceInformation = " + deviceInformation);
    }
    for (String packageName : deviceInfo.getDevicePackages().keySet()) {
        DevicePackage devicePackage = deviceInfo.findDevicePackage(packageName);
        System.err.println("Package = " + devicePackage);
        for (String pinName : devicePackage.getPins().keySet()) {
            String location = devicePackage.getLocation(pinName);
            System.err.print(pinName + " => " + location + ", ");
        }
        System.err.println();
    }
    for (String pinName : deviceInfo.getPins().keySet()) {
        Pin pin = deviceInfo.findPin(pinName);
        System.err.print("Pin = " + pin.getName() + ", ");
    }
    ;
    System.err.println();
    for (String peripheralName : deviceInfo.getPeripheralNames()) {
        System.err.print("Peripheral = " + peripheralName + ", ");
    }
    ;
    System.err.println();
    for (String signals : deviceInfo.getSignals().keySet()) {
        System.err.print("Signal = " + signals + ", ");
    }
    ;
    System.err.println();
}
Also used : Pin(net.sourceforge.usbdm.deviceEditor.information.Pin) DevicePackage(net.sourceforge.usbdm.deviceEditor.information.DevicePackage) DeviceVariantInformation(net.sourceforge.usbdm.deviceEditor.information.DeviceVariantInformation)

Example 8 with Pin

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

the class WriteFamilyCpp method writePinMappingFunction.

private void writePinMappingFunction(DocumentUtilities writer) throws Exception {
    PcrInitialiser pcrInitialiser = new PcrInitialiser();
    for (String pinName : fDeviceInfo.getPins().keySet()) {
        Pin pin = fDeviceInfo.getPins().get(pinName);
        pcrInitialiser.addPin(pin);
    }
    writer.write("/**\n" + " * Used to configure pin-mapping before 1st use of peripherals\n" + " */\n" + "void " + DO_PIN_MAPPING_FUNCTION + "() {\n");
    writer.write(pcrInitialiser.getInitPortClocksStatement(""));
    writer.write(pcrInitialiser.getPcrInitStatements(""));
    writer.write("}\n");
}
Also used : PcrInitialiser(net.sourceforge.usbdm.deviceEditor.information.PcrInitialiser) Pin(net.sourceforge.usbdm.deviceEditor.information.Pin)

Example 9 with Pin

use of net.sourceforge.usbdm.deviceEditor.information.Pin 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() + "\'");
        }
    }
}
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 Pin

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

the class ParseFamilyXML method parsePackage.

/**
 * Parse <package>
 *
 * @param packageElement
 * @throws Exception
 */
private void parsePackage(Element packageElement) throws Exception {
    String packageName = packageElement.getAttribute("name");
    for (Node node = packageElement.getFirstChild(); node != null; node = node.getNextSibling()) {
        if (node.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }
        Element element = (Element) node;
        if (element.getTagName() == "placement") {
            Pin pin = fDeviceInfo.findPin(element.getAttribute("pin"));
            String location = element.getAttribute("location");
            DevicePackage devicePackage = fDeviceInfo.findDevicePackage(packageName);
            devicePackage.addPin(pin, location);
        } else {
            throw new Exception("Unexpected field in PACKAGE, value = \'" + element.getTagName() + "\'");
        }
    }
}
Also used : Pin(net.sourceforge.usbdm.deviceEditor.information.Pin) Node(org.w3c.dom.Node) Element(org.w3c.dom.Element) DevicePackage(net.sourceforge.usbdm.deviceEditor.information.DevicePackage)

Aggregations

Pin (net.sourceforge.usbdm.deviceEditor.information.Pin)11 MappingInfo (net.sourceforge.usbdm.deviceEditor.information.MappingInfo)5 Signal (net.sourceforge.usbdm.deviceEditor.information.Signal)5 MuxSelection (net.sourceforge.usbdm.deviceEditor.information.MuxSelection)4 DevicePackage (net.sourceforge.usbdm.deviceEditor.information.DevicePackage)3 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 Element (org.w3c.dom.Element)2 Node (org.w3c.dom.Node)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 TreeMap (java.util.TreeMap)1 BooleanVariable (net.sourceforge.usbdm.deviceEditor.information.BooleanVariable)1 ChoiceVariable (net.sourceforge.usbdm.deviceEditor.information.ChoiceVariable)1 DeviceVariantInformation (net.sourceforge.usbdm.deviceEditor.information.DeviceVariantInformation)1 PcrInitialiser (net.sourceforge.usbdm.deviceEditor.information.PcrInitialiser)1 Peripheral (net.sourceforge.usbdm.deviceEditor.information.Peripheral)1 InfoTable (net.sourceforge.usbdm.deviceEditor.information.Peripheral.InfoTable)1 StringVariable (net.sourceforge.usbdm.deviceEditor.information.StringVariable)1