]> sigrok.org Git - libserialport.git/blobdiff - libserialport.h.in
Minor cosmetics.
[libserialport.git] / libserialport.h.in
index 12e9cba3a5556ae468f1957d4f36e2aff0304b31..c24550e8b9c231c550c2531584e04a51df678a44 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 /**
- * 
  * @mainpage libserialport API
  *
  * Introduction
@@ -64,8 +63,8 @@
  * or where otherwise documented a positive value.
  */
 
-#ifndef LIBSERIALPORT_H
-#define LIBSERIALPORT_H
+#ifndef LIBSERIALPORT_LIBSERIALPORT_H
+#define LIBSERIALPORT_LIBSERIALPORT_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -201,6 +200,18 @@ enum sp_flowcontrol {
        SP_FLOWCONTROL_DTRDSR = 3,
 };
 
+/** Input signals. */
+enum sp_signal {
+       /** Clear to send. */
+       SP_SIG_CTS = 1,
+       /** Data set ready. */
+       SP_SIG_DSR = 2,
+       /** Data carrier detect. */
+       SP_SIG_DCD = 4,
+       /** Ring indicator. */
+       SP_SIG_RI = 8,
+};
+
 /** A serial port. */
 struct sp_port {
        /** Name used to open the port. */
@@ -518,6 +529,7 @@ enum sp_return sp_write(struct sp_port *port, const void *buf, size_t count);
 /**
  * Flush serial port buffers. Data in the selected buffer(s) is discarded.
  *
+ * @param port Pointer to port structure.
  * @param buffers Which buffer(s) to flush.
  *
  * @return SP_OK on success, SP_ERR_FAIL on failure, or SP_ERR_ARG
@@ -525,6 +537,58 @@ enum sp_return sp_write(struct sp_port *port, const void *buf, size_t count);
  */
 enum sp_return sp_flush(struct sp_port *port, enum sp_buffer buffers);
 
+/**
+ * Wait for buffered data to be transmitted.
+ *
+ * @param port Pointer to port structure.
+ *
+ * @return SP_OK on success, SP_ERR_FAIL on failure, or SP_ERR_ARG
+ *         if an invalid port is passed.
+ */
+enum sp_return sp_drain(struct sp_port *port);
+
+/**
+ * @}
+ * @defgroup Signal Port signalling operations
+ * @{
+ */
+
+/**
+ * Gets the status of the control signals for the specified port.
+ *
+ * The user should allocate a variable of type "enum sp_signal" and pass a
+ * pointer to this variable to receive the result. The result is a bitmask
+ * in which individual signals can be checked by bitwise OR with values of
+ * the sp_signal enum.
+ *
+ * @param port Pointer to port structure.
+ * @param signals Pointer to variable to receive result.
+ *
+ * @return SP_OK on success, SP_ERR_FAIL on failure, or SP_ERR_ARG
+ *         if an an invalid port or pointer is passed.
+ */
+enum sp_return sp_get_signals(struct sp_port *port, enum sp_signal *signals);
+
+/**
+ * Put the port transmit line into the break state.
+ *
+ * @param port Pointer to port structure.
+ *
+ * @return SP_OK on success, SP_ERR_FAIL on failure, or SP_ERR_ARG
+ *         if an invalid port is passed.
+ */
+enum sp_return sp_start_break(struct sp_port *port);
+
+/**
+ * Take the port transmit line out of the break state.
+ *
+ * @param port Pointer to port structure.
+ *
+ * @return SP_OK on success, SP_ERR_FAIL on failure, or SP_ERR_ARG
+ *         if an invalid port is passed.
+ */
+enum sp_return sp_end_break(struct sp_port *port);
+
 /**
  * @}
  * @defgroup Errors Obtaining error information
@@ -565,4 +629,4 @@ void sp_free_error_message(char *message);
 }
 #endif
 
-#endif /* LIBSERIALPORT_H */
+#endif