]> sigrok.org Git - libsigrok.git/commitdiff
MinGW: Quickfix to make serial.c/ols.c compile.
authorUwe Hermann <redacted>
Tue, 11 Jan 2011 00:25:10 +0000 (01:25 +0100)
committerUwe Hermann <redacted>
Tue, 11 Jan 2011 00:27:16 +0000 (01:27 +0100)
Note: It does NOT actually work, yet, it only compiles!

hardware/common/serial.c
hardware/openbench-logic-sniffer/ols.c

index 18b62d0c048ba1ddff72ee4596c15a23d118fad0..0b9b1c8c390917bf7be44b13beaaf1467da49cc3 100644 (file)
@@ -95,10 +95,22 @@ int serial_close(int fd)
 #endif
 }
 
+/*
+ * Flush serial port buffers (if any).
+ * Returns 0 upon success, -1 upon failure.
+ */
 int serial_flush(int fd)
 {
-
+#ifdef _WIN32
+       /* Returns non-zero upon success, 0 upon failure. */
+       if (PurgeComm(hdl, PURGE_RXCLEAR | PURGE_TXCLEAR) == 0)
+               return -1;
+       else
+               return 0;
+#else
+       /* Returns 0 upon success, -1 upon failure. */
        return tcflush(fd, TCIOFLUSH);
+#endif
 }
 
 void *serial_backup_params(int fd)
@@ -140,6 +152,7 @@ int serial_set_params(int fd, int speed, int bits, int parity, int stopbits,
 
        /* TODO: Rename 'speed' to 'baudrate'. */
        switch(speed) {
+       /* TODO: Support for higher baud rates. */
        case 115200:
                dcb.BaudRate = CBR_115200;
                break;
index 7f44788e4a012d2a2742aaaaee894dffdc0f13c6..d95e0827bbc1fe6a0af283a131ffe1d70d535e62 100644 (file)
 #include <glib.h>
 #include <sigrok.h>
 
+#ifdef _WIN32
+#define O_NONBLOCK FIONBIO
+#endif
+
 #define NUM_PROBES                     32
 #define NUM_TRIGGER_STAGES             4
 #define TRIGGER_TYPES                  "01"