44 lines
1.5 KiB
C
44 lines
1.5 KiB
C
|
/*
|
||
|
Copyright (C) 2006 AbsoluteValue Systems, Inc. All Rights Reserved.
|
||
|
|
||
|
Originally written and maintained by: Solomon Peachy <pizza@shaftnet.org>
|
||
|
Local redirection & Debugging code by: Mark Mathews <mark@linux-wlan.com>
|
||
|
|
||
|
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 3 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, see <http://www.gnu.org/licenses/>.
|
||
|
|
||
|
*/
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <stdint.h>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
#include <termios.h>
|
||
|
|
||
|
#define min_t(type,x,y) \
|
||
|
({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
|
||
|
#define max_t(type,x,y) \
|
||
|
({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
|
||
|
|
||
|
#define SERIAL_BAUD_CASE(__b__) case __b__: cfsetispeed(cfg, B ## __b__) ; \
|
||
|
cfsetospeed(cfg, B ## __b__) ; \
|
||
|
break
|
||
|
|
||
|
#define SERIAL_DATA_CASE(__b__) case __b__: cfg->c_cflag |= CS ## __b__ ; \
|
||
|
break
|
||
|
|
||
|
int setserial(struct termios *cfg, int ser_fd, int baud,
|
||
|
int databits, char parity, int stopbits,
|
||
|
int hw_flow, int sw_flow, int modemlines);
|