Skip to main content
summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorDoug Schaefer2017-11-13 15:25:52 -0500
committerDoug Schaefer2017-11-13 15:56:57 -0500
commit15c8bad95d394bef30dda8662e490e78b1afee33 (patch)
tree3d7485741085fcadeb78638fe04e34ebf4ea23bc /native
parentf1f9ddf0f70bdc5a4960803b47c6137a5d2486d4 (diff)
downloadorg.eclipse.cdt-15c8bad95d394bef30dda8662e490e78b1afee33.tar.gz
org.eclipse.cdt-15c8bad95d394bef30dda8662e490e78b1afee33.tar.xz
org.eclipse.cdt-15c8bad95d394bef30dda8662e490e78b1afee33.zip
Serial Flash Target and Launch. Clean up Generic Launch.
Adds target, launch classes, and launch bar support for targets intended to upload their code to flash using a Serial Port. The port is co-ordinated with the Serial Terminal so that the terminal is paused during the upload. Also cleaned up the Generic Launch so it's not using the External Tools launch which has a number of UX issues. This simplifies the settings and gives us more control. And it's made reusable for the Serial Flash launch. Change-Id: I31e9970243fbf1cf22d027bbdb892fde104dbefe
Diffstat (limited to 'native')
-rw-r--r--native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java b/native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java
index 9558c87b9b..62bea0f1ad 100644
--- a/native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java
+++ b/native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java
@@ -308,7 +308,7 @@ public class SerialPort {
return outputStream;
}
- public void open() throws IOException {
+ public synchronized void open() throws IOException {
handle = open0(portName, baudRate.getRate(), byteSize.getSize(), parity.ordinal(), stopBits.ordinal());
isOpen = true;
@@ -356,18 +356,26 @@ public class SerialPort {
}
public void pause() throws IOException {
- isPaused = true;
- close0(handle);
- try {
- // Sleep for a second since some serial ports take a while to actually close
- Thread.sleep(500);
- } catch (InterruptedException e) {
- // nothing to do
+ if (!isOpen) {
+ return;
+ }
+ synchronized (pauseMutex) {
+ isPaused = true;
+ close0(handle);
+ try {
+ // Sleep for a second since some serial ports take a while to actually close
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ // nothing to do
+ }
}
}
public void resume() throws IOException {
synchronized (pauseMutex) {
+ if (!isPaused) {
+ return;
+ }
isPaused = false;
handle = open0(portName, baudRate.getRate(), byteSize.getSize(), parity.ordinal(), stopBits.ordinal());
isOpen = true;

Back to the top