]> sigrok.org Git - libserialport.git/blobdiff - serialport.h
Add SP_ERR_MEM failure code.
[libserialport.git] / serialport.h
index ffe6350a719d743ccc6d57aaed05ded54e45718e..3d6410e071308e0816457ebfa28a95cfe3fa0b15 100644 (file)
@@ -17,6 +17,9 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef SERIALPORT_H
+#define SERIALPORT_H
+
 #include <stddef.h>
 #ifdef _WIN32
 #include <windows.h>
@@ -38,10 +41,12 @@ struct sp_port {
 enum {
        /* Operation completed successfully. */
        SP_OK = 0,
-       /* A system error occured while executing the operation. */
-       SP_ERR_FAIL = -1,
        /* Invalid arguments were passed to the function. */
-       SP_ERR_ARG = -2
+       SP_ERR_ARG = -1,
+       /* A system error occured while executing the operation. */
+       SP_ERR_FAIL = -2,
+       /* A memory allocation failed while executing the operation. */
+       SP_ERR_MEM = -3
 };
 
 /* Port access modes. */
@@ -64,6 +69,16 @@ enum {
        SP_PARITY_ODD = 2
 };
 
+/* Flow control settings. */
+enum {
+       /* No flow control. */
+       SP_FLOW_NONE = 0,
+       /* Hardware (RTS/CTS) flow control. */
+       SP_FLOW_HARDWARE = 1,
+       /* Software (XON/XOFF) flow control. */
+       SP_FLOW_SOFTWARE = 2
+};
+
 char **sp_list_ports(void);
 void sp_free_port_list(char **ports);
 int sp_open(struct sp_port *port, char *portname, int flags);
@@ -76,3 +91,5 @@ int sp_set_params(struct sp_port *port, int baudrate, int bits, int parity,
 int sp_last_error_code(void);
 char *sp_last_error_message(void);
 void sp_free_error_message(char *message);
+
+#endif /* SERIALPORT_H */