epoc32/include/stdapis/sys/serial.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 /*-
     2  * Copyright (c) 2004 Poul-Henning Kamp
     3  * All rights reserved.
     4  *
     5  * Redistribution and use in source and binary forms, with or without
     6  * modification, are permitted provided that the following conditions
     7  * are met:
     8  * 1. Redistributions of source code must retain the above copyright
     9  *    notice, this list of conditions and the following disclaimer.
    10  * 2. Redistributions in binary form must reproduce the above copyright
    11  *    notice, this list of conditions and the following disclaimer in the
    12  *    documentation and/or other materials provided with the distribution.
    13  *
    14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
    15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
    18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    24  * SUCH DAMAGE.
    25  *
    26  * This file contains definitions which pertain to serial ports as such,
    27  * (both async and sync), but which do not necessarily have anything to
    28  * do with tty processing.
    29  *
    30  * $FreeBSD: src/sys/sys/serial.h,v 1.2 2004/06/25 10:56:43 phk Exp $
    31  */
    32 
    33 #ifndef _SYS_SERIAL_H_
    34 #define	_SYS_SERIAL_H_
    35 
    36 #ifndef __SYMBIAN32__
    37 
    38 /*
    39  * Indentification of modem control signals.  These definitions match
    40  * the TIOCMGET definitions in <sys/ttycom.h> shifted a bit down, and
    41  * that identity is enforced with CTASSERT at the bottom of kern/tty.c
    42  * Both the modem bits and delta bits must fit in 16 bit.
    43  */
    44 #define		SER_DTR	0x0001		/* data terminal ready */
    45 #define		SER_RTS	0x0002		/* request to send */
    46 #define		SER_STX	0x0004		/* secondary transmit */
    47 #define		SER_SRX	0x0008		/* secondary receive */
    48 #define		SER_CTS	0x0010		/* clear to send */
    49 #define		SER_DCD	0x0020		/* data carrier detect */
    50 #define		SER_RI 	0x0040		/* ring indicate */
    51 #define		SER_DSR	0x0080		/* data set ready */
    52 
    53 /* Delta bits, used to indicate which signals should/was affected */
    54 #define		SER_DELTA(x)	((x) << 8)
    55 
    56 #define		SER_DDTR SER_DELTA(SER_DTR)
    57 #define		SER_DRTS SER_DELTA(SER_RTS)
    58 #define		SER_DSTX SER_DELTA(SER_STX)
    59 #define		SER_DSRX SER_DELTA(SER_SRX)
    60 #define		SER_DCTS SER_DELTA(SER_CTS)
    61 #define		SER_DDCD SER_DELTA(SER_DCD)
    62 #define		SER_DRI  SER_DELTA(SER_RI)
    63 #define		SER_DDSR SER_DELTA(SER_DSR)
    64 
    65 #else
    66 /**
    67 notifications
    68 */
    69 #define	KNotifyBreakInt				0x01
    70 #define	KNotifyCD					0x02
    71 #define	KNotifyCTS					0x04
    72 #define	KNotifyDataAvailable		0x08
    73 #define	KNotifyDSR					0x10
    74 #define	KNotifyFramingError			0x20
    75 #define	KNotifyOutputEmpty			0x40
    76 #define	KNotifyOverrunError			0x80
    77 #define	KNotifyParityError			0x100
    78 #define	KNotifyRI					0x200
    79 
    80 /**
    81 enums, #defines and struct for serial port settings
    82 */
    83 enum DataBits {DBits5,DBits6,DBits7,DBits8};
    84 
    85 enum StopBits {Stop1,Stop2};
    86 
    87 enum Parity {ParityNone,ParityEven,ParityOdd,ParityMark,ParitySpace};
    88 
    89 enum Bps
    90 	{
    91 	Bps50,Bps75,Bps110,Bps134,Bps150,Bps300,Bps600,Bps1200,
    92 	Bps1800,Bps2000,Bps2400,Bps3600,Bps4800,Bps7200,Bps9600,
    93 	Bps19200,Bps38400,Bps57600,Bps115200,Bps230400,Bps460800,
    94 	Bps576000,Bps1152000,Bps4000000,
    95 	BpsSpecial=0x80000000
    96 	};
    97 
    98 enum Fifo {FifoEnable,FifoDisable};
    99 
   100 enum Sir {SIREnable,SIRDisable};
   101 //
   102 #define ConfigMaxTerminators 4
   103 //
   104 #define ConfigObeyXoff 0x01
   105 #define ConfigSendXoff 0x02
   106 #define ConfigObeyCTS 0x04
   107 #define ConfigFailCTS 0x08
   108 #define ConfigObeyDSR 0x10
   109 #define ConfigFailDSR 0x20
   110 #define ConfigObeyDCD 0x40
   111 #define ConfigFailDCD 0x80
   112 #define ConfigFreeRTS 0x100
   113 #define ConfigFreeDTR 0x200
   114 #define ConfigWriteBufferedComplete 0x80000000
   115 //
   116 #define ConfigParityErrorFail 0
   117 #define ConfigParityErrorIgnore 0x01
   118 #define ConfigParityErrorReplaceChar 0x02
   119 #define ConfigXonXoffDebug 0x80000000
   120 //
   121 #define SignalCTS 0x01
   122 #define SignalDSR 0x02
   123 #define SignalDCD 0x04
   124 #define SignalRNG 0x08
   125 #define SignalRTS 0x10
   126 #define SignalDTR 0x20
   127 
   128 #define ConfigSIRPulseWidthMaximum 0x01
   129 #define ConfigSIRPulseWidthMinimum 0x02
   130 //
   131 
   132 typedef struct
   133 	{
   134 	enum Bps iRate;
   135 	enum DataBits iDataBits;
   136 	enum StopBits iStopBits;
   137 	enum Parity iParity;
   138 	unsigned int iHandshake;
   139 	unsigned int iParityError;
   140 	unsigned int iFifo;
   141 	int iSpecialRate;
   142 	int iTerminatorCount;
   143 	char iTerminator[ConfigMaxTerminators];
   144 	char iXonChar;
   145 	char iXoffChar;
   146 	char iParityErrorChar;
   147 	enum Sir iSIREnable;
   148 	unsigned int iSIRSettings;
   149 	} SerialConfig;
   150 
   151 #endif //__SYMBIAN32__
   152 
   153 #endif /* !_SYS_SERIAL_H_ */