Search in sources :

Example 6 with UsbdmDevicePeripheralsModel

use of net.sourceforge.usbdm.peripherals.model.UsbdmDevicePeripheralsModel in project usbdm-eclipse-plugins by podonoghue.

the class GdbDsfSessionListener method handleDsfEvent.

/**
 */
@DsfServiceEventHandler
public void handleDsfEvent(ISuspendedDMEvent event) {
    String sessionId = event.getDMContext().getSessionId();
    UsbdmDevicePeripheralsModel devicePeripheralsModel = dsfSessions.get(sessionId);
    if (devicePeripheralsModel != null) {
        DeviceModel deviceModel = devicePeripheralsModel.getModel();
        if (deviceModel != null) {
            // Set current register values as the 'reference' for changed values
            deviceModel.setChangeReference();
            // Set all registers as stale
            deviceModel.setNeedsUpdate(true);
        }
    }
    for (GdbSessionListener sessionListener : gdbSessionListeners) {
        sessionListener.sessionSuspended(devicePeripheralsModel, GdbSessionListener.EventType.getEventFromDsfEvent(event.getReason()));
    }
}
Also used : DeviceModel(net.sourceforge.usbdm.peripherals.model.DeviceModel) UsbdmDevicePeripheralsModel(net.sourceforge.usbdm.peripherals.model.UsbdmDevicePeripheralsModel) DsfServiceEventHandler(org.eclipse.cdt.dsf.service.DsfServiceEventHandler)

Example 7 with UsbdmDevicePeripheralsModel

use of net.sourceforge.usbdm.peripherals.model.UsbdmDevicePeripheralsModel 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();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) UsbdmDevicePeripheralsModel(net.sourceforge.usbdm.peripherals.model.UsbdmDevicePeripheralsModel) DevicePeripherals(net.sourceforge.usbdm.peripheralDatabase.DevicePeripherals) DevicePeripheralSelectionDialogue(net.sourceforge.usbdm.peripherals.view.DevicePeripheralSelectionDialogue) SVDIdentifier(net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier) FillLayout(org.eclipse.swt.layout.FillLayout) Display(org.eclipse.swt.widgets.Display)

Example 8 with UsbdmDevicePeripheralsModel

use of net.sourceforge.usbdm.peripherals.model.UsbdmDevicePeripheralsModel 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();
    }
}
Also used : Path(java.nio.file.Path) Shell(org.eclipse.swt.widgets.Shell) UsbdmDevicePeripheralsModel(net.sourceforge.usbdm.peripherals.model.UsbdmDevicePeripheralsModel) Composite(org.eclipse.swt.widgets.Composite) Color(org.eclipse.swt.graphics.Color) UsbdmDevicePeripheralsView(net.sourceforge.usbdm.peripherals.view.UsbdmDevicePeripheralsView) SVDIdentifier(net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier) FillLayout(org.eclipse.swt.layout.FillLayout) Display(org.eclipse.swt.widgets.Display)

Aggregations

UsbdmDevicePeripheralsModel (net.sourceforge.usbdm.peripherals.model.UsbdmDevicePeripheralsModel)8 SVDIdentifier (net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier)3 DsfSession (org.eclipse.cdt.dsf.service.DsfSession)3 DsfServiceEventHandler (org.eclipse.cdt.dsf.service.DsfServiceEventHandler)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Display (org.eclipse.swt.widgets.Display)2 Shell (org.eclipse.swt.widgets.Shell)2 Path (java.nio.file.Path)1 DevicePeripherals (net.sourceforge.usbdm.peripheralDatabase.DevicePeripherals)1 DeviceModel (net.sourceforge.usbdm.peripherals.model.DeviceModel)1 DevicePeripheralSelectionDialogue (net.sourceforge.usbdm.peripherals.view.DevicePeripheralSelectionDialogue)1 UsbdmDevicePeripheralsView (net.sourceforge.usbdm.peripherals.view.UsbdmDevicePeripheralsView)1 Color (org.eclipse.swt.graphics.Color)1 Composite (org.eclipse.swt.widgets.Composite)1