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