os/ossrv/genericopenlibs/openenvcore/include/sys/serial.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/sys/serial.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,153 @@
     1.4 +/*-
     1.5 + * Copyright (c) 2004 Poul-Henning Kamp
     1.6 + * All rights reserved.
     1.7 + *
     1.8 + * Redistribution and use in source and binary forms, with or without
     1.9 + * modification, are permitted provided that the following conditions
    1.10 + * are met:
    1.11 + * 1. Redistributions of source code must retain the above copyright
    1.12 + *    notice, this list of conditions and the following disclaimer.
    1.13 + * 2. Redistributions in binary form must reproduce the above copyright
    1.14 + *    notice, this list of conditions and the following disclaimer in the
    1.15 + *    documentation and/or other materials provided with the distribution.
    1.16 + *
    1.17 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
    1.18 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.20 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
    1.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    1.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    1.23 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.24 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    1.25 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    1.26 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.27 + * SUCH DAMAGE.
    1.28 + *
    1.29 + * This file contains definitions which pertain to serial ports as such,
    1.30 + * (both async and sync), but which do not necessarily have anything to
    1.31 + * do with tty processing.
    1.32 + *
    1.33 + * $FreeBSD: src/sys/sys/serial.h,v 1.2 2004/06/25 10:56:43 phk Exp $
    1.34 + */
    1.35 +
    1.36 +#ifndef _SYS_SERIAL_H_
    1.37 +#define	_SYS_SERIAL_H_
    1.38 +
    1.39 +#ifndef __SYMBIAN32__
    1.40 +
    1.41 +/*
    1.42 + * Indentification of modem control signals.  These definitions match
    1.43 + * the TIOCMGET definitions in <sys/ttycom.h> shifted a bit down, and
    1.44 + * that identity is enforced with CTASSERT at the bottom of kern/tty.c
    1.45 + * Both the modem bits and delta bits must fit in 16 bit.
    1.46 + */
    1.47 +#define		SER_DTR	0x0001		/* data terminal ready */
    1.48 +#define		SER_RTS	0x0002		/* request to send */
    1.49 +#define		SER_STX	0x0004		/* secondary transmit */
    1.50 +#define		SER_SRX	0x0008		/* secondary receive */
    1.51 +#define		SER_CTS	0x0010		/* clear to send */
    1.52 +#define		SER_DCD	0x0020		/* data carrier detect */
    1.53 +#define		SER_RI 	0x0040		/* ring indicate */
    1.54 +#define		SER_DSR	0x0080		/* data set ready */
    1.55 +
    1.56 +/* Delta bits, used to indicate which signals should/was affected */
    1.57 +#define		SER_DELTA(x)	((x) << 8)
    1.58 +
    1.59 +#define		SER_DDTR SER_DELTA(SER_DTR)
    1.60 +#define		SER_DRTS SER_DELTA(SER_RTS)
    1.61 +#define		SER_DSTX SER_DELTA(SER_STX)
    1.62 +#define		SER_DSRX SER_DELTA(SER_SRX)
    1.63 +#define		SER_DCTS SER_DELTA(SER_CTS)
    1.64 +#define		SER_DDCD SER_DELTA(SER_DCD)
    1.65 +#define		SER_DRI  SER_DELTA(SER_RI)
    1.66 +#define		SER_DDSR SER_DELTA(SER_DSR)
    1.67 +
    1.68 +#else
    1.69 +/**
    1.70 +notifications
    1.71 +*/
    1.72 +#define	KNotifyBreakInt				0x01
    1.73 +#define	KNotifyCD					0x02
    1.74 +#define	KNotifyCTS					0x04
    1.75 +#define	KNotifyDataAvailable		0x08
    1.76 +#define	KNotifyDSR					0x10
    1.77 +#define	KNotifyFramingError			0x20
    1.78 +#define	KNotifyOutputEmpty			0x40
    1.79 +#define	KNotifyOverrunError			0x80
    1.80 +#define	KNotifyParityError			0x100
    1.81 +#define	KNotifyRI					0x200
    1.82 +
    1.83 +/**
    1.84 +enums, #defines and struct for serial port settings
    1.85 +*/
    1.86 +enum DataBits {DBits5,DBits6,DBits7,DBits8};
    1.87 +
    1.88 +enum StopBits {Stop1,Stop2};
    1.89 +
    1.90 +enum Parity {ParityNone,ParityEven,ParityOdd,ParityMark,ParitySpace};
    1.91 +
    1.92 +enum Bps
    1.93 +	{
    1.94 +	Bps50,Bps75,Bps110,Bps134,Bps150,Bps300,Bps600,Bps1200,
    1.95 +	Bps1800,Bps2000,Bps2400,Bps3600,Bps4800,Bps7200,Bps9600,
    1.96 +	Bps19200,Bps38400,Bps57600,Bps115200,Bps230400,Bps460800,
    1.97 +	Bps576000,Bps1152000,Bps4000000,
    1.98 +	BpsSpecial=0x80000000
    1.99 +	};
   1.100 +
   1.101 +enum Fifo {FifoEnable,FifoDisable};
   1.102 +
   1.103 +enum Sir {SIREnable,SIRDisable};
   1.104 +//
   1.105 +#define ConfigMaxTerminators 4
   1.106 +//
   1.107 +#define ConfigObeyXoff 0x01
   1.108 +#define ConfigSendXoff 0x02
   1.109 +#define ConfigObeyCTS 0x04
   1.110 +#define ConfigFailCTS 0x08
   1.111 +#define ConfigObeyDSR 0x10
   1.112 +#define ConfigFailDSR 0x20
   1.113 +#define ConfigObeyDCD 0x40
   1.114 +#define ConfigFailDCD 0x80
   1.115 +#define ConfigFreeRTS 0x100
   1.116 +#define ConfigFreeDTR 0x200
   1.117 +#define ConfigWriteBufferedComplete 0x80000000
   1.118 +//
   1.119 +#define ConfigParityErrorFail 0
   1.120 +#define ConfigParityErrorIgnore 0x01
   1.121 +#define ConfigParityErrorReplaceChar 0x02
   1.122 +#define ConfigXonXoffDebug 0x80000000
   1.123 +//
   1.124 +#define SignalCTS 0x01
   1.125 +#define SignalDSR 0x02
   1.126 +#define SignalDCD 0x04
   1.127 +#define SignalRNG 0x08
   1.128 +#define SignalRTS 0x10
   1.129 +#define SignalDTR 0x20
   1.130 +
   1.131 +#define ConfigSIRPulseWidthMaximum 0x01
   1.132 +#define ConfigSIRPulseWidthMinimum 0x02
   1.133 +//
   1.134 +
   1.135 +typedef struct
   1.136 +	{
   1.137 +	enum Bps iRate;
   1.138 +	enum DataBits iDataBits;
   1.139 +	enum StopBits iStopBits;
   1.140 +	enum Parity iParity;
   1.141 +	unsigned int iHandshake;
   1.142 +	unsigned int iParityError;
   1.143 +	unsigned int iFifo;
   1.144 +	int iSpecialRate;
   1.145 +	int iTerminatorCount;
   1.146 +	char iTerminator[ConfigMaxTerminators];
   1.147 +	char iXonChar;
   1.148 +	char iXoffChar;
   1.149 +	char iParityErrorChar;
   1.150 +	enum Sir iSIREnable;
   1.151 +	unsigned int iSIRSettings;
   1.152 +	} SerialConfig;
   1.153 +
   1.154 +#endif //__SYMBIAN32__
   1.155 +
   1.156 +#endif /* !_SYS_SERIAL_H_ */