]> sigrok.org Git - libsigrok.git/blobdiff - src/libsigrok-internal.h
serial: prepare for the absence of libserialport
[libsigrok.git] / src / libsigrok-internal.h
index 9384bbb68692dc8dfde720e333d9a50165b20169..6fbc1d245cb86c7a6c46660430beae03a81ad257 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef LIBSIGROK_LIBSIGROK_INTERNAL_H
 #define LIBSIGROK_LIBSIGROK_INTERNAL_H
 
+#include "config.h"
+
 #include <glib.h>
 #ifdef HAVE_LIBSERIALPORT
 #include <libserialport.h>
@@ -721,7 +723,8 @@ struct sr_usb_dev_inst {
 };
 #endif
 
-#ifdef HAVE_LIBSERIALPORT
+struct sr_serial_dev_inst;
+#ifdef HAVE_SERIAL_COMM
 struct ser_lib_functions;
 struct sr_serial_dev_inst {
        /** Port name, e.g. '/dev/tty42'. */
@@ -840,7 +843,31 @@ SR_PRIV struct sr_usb_dev_inst *sr_usb_dev_inst_new(uint8_t bus,
 SR_PRIV void sr_usb_dev_inst_free(struct sr_usb_dev_inst *usb);
 #endif
 
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
+#ifndef HAVE_LIBSERIALPORT
+/*
+ * Some identifiers which initially got provided by libserialport are
+ * used internally within the libsigrok serial layer's implementation,
+ * while libserialport no longer is the exclusive provider of serial
+ * communication support. Declare the identifiers here so they remain
+ * available across all build configurations.
+ */
+enum libsp_parity {
+       SP_PARITY_NONE = 0,
+       SP_PARITY_ODD = 1,
+       SP_PARITY_EVEN = 2,
+       SP_PARITY_MARK = 3,
+       SP_PARITY_SPACE = 4,
+};
+
+enum libsp_flowcontrol {
+       SP_FLOWCONTROL_NONE = 0,
+       SP_FLOWCONTROL_XONXOFF = 1,
+       SP_FLOWCONTROL_RTSCTS = 2,
+       SP_FLOWCONTROL_DTRDSR = 3,
+};
+#endif
+
 /* Serial-specific instances */
 SR_PRIV struct sr_serial_dev_inst *sr_serial_dev_inst_new(const char *port,
                const char *serialcomm);
@@ -957,7 +984,7 @@ SR_PRIV int std_dummy_dev_open(struct sr_dev_inst *sdi);
 SR_PRIV int std_dummy_dev_close(struct sr_dev_inst *sdi);
 SR_PRIV int std_dummy_dev_acquisition_start(const struct sr_dev_inst *sdi);
 SR_PRIV int std_dummy_dev_acquisition_stop(struct sr_dev_inst *sdi);
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
 SR_PRIV int std_serial_dev_open(struct sr_dev_inst *sdi);
 SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi);
 #endif
@@ -1067,7 +1094,7 @@ SR_PRIV int soft_trigger_logic_check(struct soft_trigger_logic *st, uint8_t *buf
 
 /*--- serial.c --------------------------------------------------------------*/
 
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
 enum {
        SERIAL_RDWR = 1,
        SERIAL_RDONLY = 2,
@@ -1385,7 +1412,7 @@ struct metex14_info {
        gboolean is_hfe, is_unitless, is_logic, is_min, is_max, is_avg;
 };
 
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
 SR_PRIV int sr_metex14_packet_request(struct sr_serial_dev_inst *serial);
 #endif
 SR_PRIV gboolean sr_metex14_packet_valid(const uint8_t *buf);
@@ -1516,7 +1543,7 @@ struct asycii_info {
        gboolean is_invalid;
 };
 
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
 SR_PRIV int sr_asycii_packet_request(struct sr_serial_dev_inst *serial);
 #endif
 SR_PRIV gboolean sr_asycii_packet_valid(const uint8_t *buf);