From fe28dedd4c25b5f0f3df39d5e33ce3639574406c Mon Sep 17 00:00:00 2001 From: Sylvain Munaut Date: Fri, 2 Sep 2011 22:18:24 +0200 Subject: core/serial: Add utilities to deal with serial ports Signed-off-by: Sylvain Munaut --- include/osmocom/core/Makefile.am | 4 ++++ include/osmocom/core/serial.h | 43 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 include/osmocom/core/serial.h (limited to 'include/osmocom/core') 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 + * + * 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 + +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__ */ -- cgit v1.2.3