williamr@2: /*- williamr@2: * Copyright (c) 2004 Poul-Henning Kamp williamr@2: * All rights reserved. williamr@2: * williamr@2: * Redistribution and use in source and binary forms, with or without williamr@2: * modification, are permitted provided that the following conditions williamr@2: * are met: williamr@2: * 1. Redistributions of source code must retain the above copyright williamr@2: * notice, this list of conditions and the following disclaimer. williamr@2: * 2. Redistributions in binary form must reproduce the above copyright williamr@2: * notice, this list of conditions and the following disclaimer in the williamr@2: * documentation and/or other materials provided with the distribution. williamr@2: * williamr@2: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND williamr@2: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE williamr@2: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE williamr@2: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE williamr@2: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL williamr@2: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS williamr@2: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) williamr@2: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT williamr@2: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY williamr@2: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF williamr@2: * SUCH DAMAGE. williamr@2: * williamr@2: * This file contains definitions which pertain to serial ports as such, williamr@2: * (both async and sync), but which do not necessarily have anything to williamr@2: * do with tty processing. williamr@2: * williamr@2: * $FreeBSD: src/sys/sys/serial.h,v 1.2 2004/06/25 10:56:43 phk Exp $ williamr@2: */ williamr@2: williamr@2: #ifndef _SYS_SERIAL_H_ williamr@2: #define _SYS_SERIAL_H_ williamr@2: williamr@2: #ifndef __SYMBIAN32__ williamr@2: williamr@2: /* williamr@2: * Indentification of modem control signals. These definitions match williamr@2: * the TIOCMGET definitions in shifted a bit down, and williamr@2: * that identity is enforced with CTASSERT at the bottom of kern/tty.c williamr@2: * Both the modem bits and delta bits must fit in 16 bit. williamr@2: */ williamr@2: #define SER_DTR 0x0001 /* data terminal ready */ williamr@2: #define SER_RTS 0x0002 /* request to send */ williamr@2: #define SER_STX 0x0004 /* secondary transmit */ williamr@2: #define SER_SRX 0x0008 /* secondary receive */ williamr@2: #define SER_CTS 0x0010 /* clear to send */ williamr@2: #define SER_DCD 0x0020 /* data carrier detect */ williamr@2: #define SER_RI 0x0040 /* ring indicate */ williamr@2: #define SER_DSR 0x0080 /* data set ready */ williamr@2: williamr@2: /* Delta bits, used to indicate which signals should/was affected */ williamr@2: #define SER_DELTA(x) ((x) << 8) williamr@2: williamr@2: #define SER_DDTR SER_DELTA(SER_DTR) williamr@2: #define SER_DRTS SER_DELTA(SER_RTS) williamr@2: #define SER_DSTX SER_DELTA(SER_STX) williamr@2: #define SER_DSRX SER_DELTA(SER_SRX) williamr@2: #define SER_DCTS SER_DELTA(SER_CTS) williamr@2: #define SER_DDCD SER_DELTA(SER_DCD) williamr@2: #define SER_DRI SER_DELTA(SER_RI) williamr@2: #define SER_DDSR SER_DELTA(SER_DSR) williamr@2: williamr@2: #else williamr@2: /** williamr@2: notifications williamr@2: */ williamr@2: #define KNotifyBreakInt 0x01 williamr@2: #define KNotifyCD 0x02 williamr@2: #define KNotifyCTS 0x04 williamr@2: #define KNotifyDataAvailable 0x08 williamr@2: #define KNotifyDSR 0x10 williamr@2: #define KNotifyFramingError 0x20 williamr@2: #define KNotifyOutputEmpty 0x40 williamr@2: #define KNotifyOverrunError 0x80 williamr@2: #define KNotifyParityError 0x100 williamr@2: #define KNotifyRI 0x200 williamr@2: williamr@2: /** williamr@2: enums, #defines and struct for serial port settings williamr@2: */ williamr@2: enum DataBits {DBits5,DBits6,DBits7,DBits8}; williamr@2: williamr@2: enum StopBits {Stop1,Stop2}; williamr@2: williamr@2: enum Parity {ParityNone,ParityEven,ParityOdd,ParityMark,ParitySpace}; williamr@2: williamr@2: enum Bps williamr@2: { williamr@2: Bps50,Bps75,Bps110,Bps134,Bps150,Bps300,Bps600,Bps1200, williamr@2: Bps1800,Bps2000,Bps2400,Bps3600,Bps4800,Bps7200,Bps9600, williamr@2: Bps19200,Bps38400,Bps57600,Bps115200,Bps230400,Bps460800, williamr@2: Bps576000,Bps1152000,Bps4000000, williamr@2: BpsSpecial=0x80000000 williamr@2: }; williamr@2: williamr@2: enum Fifo {FifoEnable,FifoDisable}; williamr@2: williamr@2: enum Sir {SIREnable,SIRDisable}; williamr@2: // williamr@2: #define ConfigMaxTerminators 4 williamr@2: // williamr@2: #define ConfigObeyXoff 0x01 williamr@2: #define ConfigSendXoff 0x02 williamr@2: #define ConfigObeyCTS 0x04 williamr@2: #define ConfigFailCTS 0x08 williamr@2: #define ConfigObeyDSR 0x10 williamr@2: #define ConfigFailDSR 0x20 williamr@2: #define ConfigObeyDCD 0x40 williamr@2: #define ConfigFailDCD 0x80 williamr@2: #define ConfigFreeRTS 0x100 williamr@2: #define ConfigFreeDTR 0x200 williamr@2: #define ConfigWriteBufferedComplete 0x80000000 williamr@2: // williamr@2: #define ConfigParityErrorFail 0 williamr@2: #define ConfigParityErrorIgnore 0x01 williamr@2: #define ConfigParityErrorReplaceChar 0x02 williamr@2: #define ConfigXonXoffDebug 0x80000000 williamr@2: // williamr@2: #define SignalCTS 0x01 williamr@2: #define SignalDSR 0x02 williamr@2: #define SignalDCD 0x04 williamr@2: #define SignalRNG 0x08 williamr@2: #define SignalRTS 0x10 williamr@2: #define SignalDTR 0x20 williamr@2: williamr@2: #define ConfigSIRPulseWidthMaximum 0x01 williamr@2: #define ConfigSIRPulseWidthMinimum 0x02 williamr@2: // williamr@2: williamr@2: typedef struct williamr@2: { williamr@2: enum Bps iRate; williamr@2: enum DataBits iDataBits; williamr@2: enum StopBits iStopBits; williamr@2: enum Parity iParity; williamr@2: unsigned int iHandshake; williamr@2: unsigned int iParityError; williamr@2: unsigned int iFifo; williamr@2: int iSpecialRate; williamr@2: int iTerminatorCount; williamr@2: char iTerminator[ConfigMaxTerminators]; williamr@2: char iXonChar; williamr@2: char iXoffChar; williamr@2: char iParityErrorChar; williamr@2: enum Sir iSIREnable; williamr@2: unsigned int iSIRSettings; williamr@2: } SerialConfig; williamr@2: williamr@2: #endif //__SYMBIAN32__ williamr@2: williamr@2: #endif /* !_SYS_SERIAL_H_ */