aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2011-09-02 22:18:24 +0200
committerSylvain Munaut <tnt@246tNt.com>2011-09-02 22:21:09 +0200
commitfe28dedd4c25b5f0f3df39d5e33ce3639574406c (patch)
tree7e4bad715499c7d51e5e5ed3cc886c738514f10a /include
parentbf9d25039c770867d2761ef11ef700e21addffba (diff)
core/serial: Add utilities to deal with serial ports
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/core/Makefile.am4
-rw-r--r--include/osmocom/core/serial.h43
2 files changed, 47 insertions, 0 deletions
diff --git a/include/osmocom/core/Makefile.am b/include/osmocom/core/Makefile.am
index adf7220c..f131269d 100644
--- a/include/osmocom/core/Makefile.am
+++ b/include/osmocom/core/Makefile.am
@@ -17,4 +17,8 @@ if ENABLE_MSGFILE
osmocore_HEADERS += msgfile.h
endif
+if ENABLE_SERIAL
+osmocore_HEADERS += serial.h
+endif
+
osmocoredir = $(includedir)/osmocom/core
diff --git a/include/osmocom/core/serial.h b/include/osmocom/core/serial.h
new file mode 100644
index 00000000..73854251
--- /dev/null
+++ b/include/osmocom/core/serial.h
@@ -0,0 +1,43 @@
+/*
+ * serial.h
+ *
+ * Copyright (C) 2011 Sylvain Munaut <tnt@246tNt.com>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*! \defgroup serial Utility functions to deal with serial ports
+ * @{
+ */
+
+/*! \file serial.h
+ * \file Osmocom serial port helpers
+ */
+
+#ifndef __OSMO_SERIAL_H__
+#define __OSMO_SERIAL_H__
+
+#include <termios.h>
+
+int osmo_serial_init(const char *dev, speed_t baudrate);
+int osmo_serial_set_baudrate(int fd, speed_t baudrate);
+int osmo_serial_set_custom_baudrate(int fd, int baudrate);
+int osmo_serial_clear_custom_baudrate(int fd);
+
+/*! }@ */
+
+#endif /* __OSMO_SERIAL_H__ */