use of net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier in project usbdm-eclipse-plugins by podonoghue.
the class CreateDeviceEditorSkeleton method getPeripherals.
public static Map<String, String> getPeripherals(String name) {
final Path path = Paths.get("C:/Users/podonoghue/Documents/Development/USBDM/usbdm-eclipse-makefiles-build/PackageFiles/Stationery/Device.SVD/Internal/");
HashMap<String, String> map = new HashMap<String, String>();
SVDIdentifier svdId = new SVDIdentifier(path.resolve(name));
DevicePeripherals devicePeripherals;
try {
devicePeripherals = svdId.getDevicePeripherals();
for (Peripheral peripheral : devicePeripherals.getPeripherals()) {
String filename;
String pName = peripheral.getName();
while (peripheral.getDerivedFrom() != null) {
peripheral = peripheral.getDerivedFrom();
}
filename = peripheral.getSourceFilename();
// System.err.println(String.format("Peripheral %-20s %-20s", pName, filename));
map.put(pName, filename.toLowerCase());
}
} catch (Exception e) {
e.printStackTrace();
}
return map;
}
use of net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier in project usbdm-eclipse-plugins by podonoghue.
the class DevicePeripheralSelectionDialogue method updateSvdId.
/**
* Update SVD from dialogue information
*/
void updateSvdId() {
// System.err.println("updateSvdId()");
SVDIdentifier svdId = null;
try {
if (chkUseExternalSVDFile.getSelection()) {
// External file
svdId = new SVDIdentifier(Paths.get(txtFilePath.getText()));
} else {
// Internal file
svdId = new SVDIdentifier(getProviderId(), comboDeviceName.getText());
}
} catch (Exception e) {
System.err.println("DevicePeripheralSelectionDialogue.updateSvdId() " + e.getMessage());
}
if (svdId != null) {
fSvdIdentifier = svdId;
}
validate();
}
use of net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier in project usbdm-eclipse-plugins by podonoghue.
the class GdbDsfSessionListener method addSession.
/*
* ========================================================
* DSF Session handling
* ========================================================
*/
/**
* Adds a session and associated model to dsfSessions
*
* @param sessionId DSF Session id used to track session
*
* @return true => new session was added,
* <br>false => session already exists
*
* @note This can be time consuming as model is loaded from disk
*/
private boolean addSession(String sessionId) {
if (!dsfSessions.containsKey(sessionId)) {
// New session
DsfSession dsfSession = DsfSession.getSession(sessionId);
String deviceName = getDeviceName(dsfSession);
// System.err.println("GdbDsfSessionListener.addSession(), deviceName="+deviceName);
SVDIdentifier svdId = new SVDIdentifier(UsbdmPeripheralDescriptionProvider.ID, deviceName);
// System.err.println("GdbDsfSessionListener.addSession(), svdId="+svdId);
UsbdmDevicePeripheralsModel peripheralModel = UsbdmDevicePeripheralsModel.createModel(new GdbDsfInterface(dsfSession), svdId);
dsfSessions.put(sessionId, peripheralModel);
return true;
}
return false;
}
use of net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier in project usbdm-eclipse-plugins by podonoghue.
the class TestDevicePeripheralSelectionDialogue method main.
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Selection");
shell.setLayout(new FillLayout());
DevicePeripheralSelectionDialogue dialogue;
try {
// SVDIdentifier svdIdentifier = new SVDIdentifier(Paths.get("C:/Program Files (x86)/pgo/USBDM 4.11.1.70/DeviceData/Device.SVD/Freescale/MK10D7.svd.xml"));
// SVDIdentifier svdIdentifier = new SVDIdentifier("[SVDIdentifier:usbdm.arm.devices:FRDM_K64F]");
SVDIdentifier svdIdentifier = new SVDIdentifier("[SVDIdentifier:path=C:/Users/podonoghue/Documents/Development/USBDM/usbdm-eclipse-plugins/net.sourceforge.usbdm.peripherals.stmicro/data/STM32F40x.svd.xml]");
// SVDIdentifier svdIdentifier = new SVDIdentifier("[SVDIdentifier:usbdm.arm.devices:S9KEAZN8]");
svdIdentifier = new SVDIdentifier(svdIdentifier.toString());
dialogue = new DevicePeripheralSelectionDialogue(shell, svdIdentifier);
} catch (Exception e) {
e.printStackTrace();
return;
}
// DeviceSelectDialogue dialogue = new DeviceSelectDialogue(shell, "C:/Users/podonoghue/Development/USBDM/ARM_Devices/Generated/STMicro/STM32F40x.svd.xml");
int result = dialogue.open();
if (result != Window.OK) {
// Cancelled etc
System.err.println("**** Cancelled ****");
return;
}
SVDIdentifier svdID = dialogue.getSVDId();
System.err.println("svdID = " + svdID);
try {
System.err.println("svdID.getDeviceName() = " + svdID.getDeviceName());
DevicePeripherals devicePeripherals = svdID.getDevicePeripherals();
System.err.println("svdID.getDevicePeripherals() = " + devicePeripherals);
System.err.println("devicePeripherals.getName() = " + devicePeripherals.getName());
UsbdmDevicePeripheralsModel peripheralModel = UsbdmDevicePeripheralsModel.createModel(null, svdID);
System.err.println("peripheralModel = " + peripheralModel);
} catch (Exception e) {
e.printStackTrace();
}
display.dispose();
}
use of net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier in project usbdm-eclipse-plugins by podonoghue.
the class TestPeripheralView method main.
/**
* Test main
*
* @param args
*/
public static void main(String[] args) {
try {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Task List - TableViewer Example");
shell.setLayout(new FillLayout());
Composite composite = new Composite(shell, SWT.NONE);
composite.setBackground(new Color(display, 255, 0, 0));
composite.setLayout(new FillLayout());
UsbdmDevicePeripheralsView view = new UsbdmDevicePeripheralsView();
String os = System.getProperty("os.name");
System.err.println("os.name => " + os);
Path path = null;
if ((os != null) && os.toUpperCase().contains("LINUX")) {
path = Paths.get("/usr/share/usbdm/Stationery/Device.SVD/Internal/");
} else {
path = Paths.get("C:/Users/podonoghue/Documents/Development/USBDM/usbdm-eclipse-makefiles-build/PackageFiles/Stationery/Device.SVD/Internal/");
}
//
// DeviceFileList fileList = new DeviceFileList(path.resolve("DeviceList.xml"));
// Path name = fileList.getSvdFilename("LPC11U24_401");
// System.err.println("Name = " + name);
view.createPartControl(composite);
// SVDIdentifier svdId = new SVDIdentifier(path.resolve("MKM33Z5.svd.xml"));
SVDIdentifier svdId = new SVDIdentifier(path.resolve("MKL25Z4.svd.xml"));
// SVDIdentifier svdId = new SVDIdentifier(path.resolve("MKW41Z4.svd.xml"));
// SVDIdentifier svdId = new SVDIdentifier(path.resolve("LPC13xx.svd.xml"));
// SVDIdentifier svdId = new SVDIdentifier(path.resolve("MK22F51212.svd.xml"));
UsbdmDevicePeripheralsModel peripheralsModel = UsbdmDevicePeripheralsModel.createModel(null, svdId);
// peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MKL25Z4.svd.xml", null);
// peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MK20D5.svd.xml", null);
// peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MK10D10.svd.xml", null);
// peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MK11D5.svd.xml", null);
// peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MK64F12.svd.xml", null);
// peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MCF5225x.svd.xml", null);
// peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MCF51JF.svd.xml", null);
// Try illegal path/name
// peripheralsModel = new UsbdmDevicePeripheralsModel("xxxx", null);
view.sessionStarted(peripheralsModel);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations