Search in sources :

Example 11 with UsbdmException

use of net.sourceforge.usbdm.jni.UsbdmException in project usbdm-eclipse-plugins by podonoghue.

the class DeviceDatabase method getXmlFilepath.

/*
   T_HCS12     (0),   //!< HC12 or HCS12 target
   T_HCS08     (1),   //!< HCS08 target
   T_RS08      (2),   //!< RS08 target
   T_CFV1      (3),   //!< Coldfire Version 1 target
   T_CFVx      (4),   //!< Coldfire Version 2,3,4 target
   T_JTAG      (5),   //!< JTAG target - TAP is set to \b RUN-TEST/IDLE
   T_EZFLASH   (6),   //!< EzPort Flash interface (SPI?)
   T_MC56F80xx (7),   //!< JTAG target with MC56F80xx optimised subroutines
   T_ARM_JTAG  (8),   //!< ARM target using JTAG
   T_ARM_SWD   (9),   //!< ARM target using SWD
   T_ARM       (10),  //!< ARM target using either SWD (preferred) or JTAG as supported
   T_OFF       (0xFF),
*/
Path getXmlFilepath(TargetType targetType) throws Exception {
    String filename;
    switch(targetType) {
        case T_ARM:
        case T_ARM_JTAG:
        case T_ARM_SWD:
            filename = UsbdmJniConstants.ARM_DEVICE_FILE;
            break;
        case T_CFV1:
            filename = UsbdmJniConstants.CFV1_DEVICE_FILE;
            break;
        case T_CFVx:
            filename = UsbdmJniConstants.CFVX_DEVICE_FILE;
            break;
        case T_MC56F80xx:
            filename = UsbdmJniConstants.MC56F_DEVICE_FILE;
            break;
        default:
            throw new UsbdmException("Unsupported target");
    }
    ;
    IPath usbdmResourcePath = Usbdm.getResourcePath();
    if (usbdmResourcePath == null) {
        return null;
    }
    usbdmResourcePath = usbdmResourcePath.append("/DeviceData/").append(filename);
    return (Path) usbdmResourcePath;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) UsbdmException(net.sourceforge.usbdm.jni.UsbdmException)

Aggregations

UsbdmException (net.sourceforge.usbdm.jni.UsbdmException)11 IPath (org.eclipse.core.runtime.IPath)3 Path (org.eclipse.core.runtime.Path)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 Peripheral (net.sourceforge.usbdm.deviceEditor.information.Peripheral)2 DevicePeripherals (net.sourceforge.usbdm.peripheralDatabase.DevicePeripherals)2 MessageBox (org.eclipse.swt.widgets.MessageBox)2 Element (org.w3c.dom.Element)2 Node (org.w3c.dom.Node)2 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 ZipEntry (java.util.zip.ZipEntry)1 ZipFile (java.util.zip.ZipFile)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1