Root/
Source at commit 2740 created 8 years 11 months ago. By ifabio, sync with trunk. | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * The contents of this file constitute Original Code as defined in and␊ |
7 | * are subject to the Apple Public Source License Version 1.1 (the␊ |
8 | * "License"). You may not use this file except in compliance with the␊ |
9 | * License. Please obtain a copy of the License at␊ |
10 | * http://www.apple.com/publicsource and read it before using this file.␊ |
11 | * ␊ |
12 | * This Original Code and all software distributed under the License are␊ |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the␊ |
17 | * License for the specific language governing rights and limitations␊ |
18 | * under the License.␊ |
19 | * ␊ |
20 | * @APPLE_LICENSE_HEADER_END@␊ |
21 | */␊ |
22 | ␊ |
23 | /*␊ |
24 | * IORS232SerialStreamSync.h␊ |
25 | * This file contains RS232 specific extensions to the IOSerialStreamSync class.␊ |
26 | *␊ |
27 | * 2000-10-21␉gvdl␉Initial real change to IOKit serial family.␊ |
28 | */ ␊ |
29 | ␊ |
30 | #ifndef _SERIAL_IORS232SERIALSTREAMSYNC_H␊ |
31 | #define _SERIAL_IORS232SERIALSTREAMSYNC_H␊ |
32 | ␊ |
33 | #include <sys/ioctl.h>␊ |
34 | #include <IOKit/serial/IOSerialStreamSync.h>␊ |
35 | ␊ |
36 | /*␊ |
37 | * Extra events for RS232 based PortDevices␊ |
38 | */ ␊ |
39 | ␊ |
40 | #define PD_RS232_E_RX_LINE_BREAK (PD_DATA_VOID|PD_OP(63)) // line break was received␊ |
41 | #define PD_RS232_E_LINE_BREAK (PD_DATA_BYTE|PD_OP(62)) // BOOL set/clear line break ␊ |
42 | ␊ |
43 | #define PD_RS232_E_RX_STOP_BITS (PD_DATA_LONG|PD_OP(61)) // half stop bits␊ |
44 | #define PD_RS232_E_STOP_BITS (PD_DATA_LONG|PD_OP(60)) // half stop bits␊ |
45 | ␊ |
46 | #define PD_RS232_E_XON_BYTE (PD_DATA_BYTE|PD_OP(59)) // The XON char for TX&RX␊ |
47 | #define PD_RS232_E_XOFF_BYTE (PD_DATA_BYTE|PD_OP(58)) // The XOFF char for TX&RX␊ |
48 | ␊ |
49 | #define PD_RS232_E_MIN_LATENCY (PD_DATA_BYTE|PD_OP(57)) // BOOL true if low latency req␊ |
50 | ␊ |
51 | /*␊ |
52 | * RS232 Parity stuff, used with the DATA_INTEGRITY event␊ |
53 | */ ␊ |
54 | #define PD_RS232_PARITY_DEFAULT␉0␉// Valid only for RX, means follow TX␊ |
55 | #define PD_RS232_PARITY_NONE␉1␉// No Parity bit inserted or expected␊ |
56 | #define PD_RS232_PARITY_ODD␉2␉// Odd Parity bit inserted or expected␊ |
57 | #define PD_RS232_PARITY_EVEN␉3␉// Even Parity bit inserted or expected␊ |
58 | #define PD_RS232_PARITY_MARK␉4␉// Mark inserted or expected␊ |
59 | #define PD_RS232_PARITY_SPACE␉5␉// Space inserted or expected␊ |
60 | #define PD_RS232_PARITY_ANY␉6␉// Valid only for RX, means discard parity␊ |
61 | ␊ |
62 | /*␊ |
63 | * RS232 Flow Control specifiers, used with the FLOW_CONTROL event␊ |
64 | * NB. The XON character is set with FLOW_START_DATA␊ |
65 | * and the XOFF character is set with FLOW_STOP_DATA.␊ |
66 | *␊ |
67 | * Signal Name Direction␊ |
68 | * RFR Ready For Receive Output generated by UART␊ |
69 | * RTS Ready To Send (alias of RFR) Output generated by UART␊ |
70 | * CTS Clear To Send␉␉ Input sensed by UART␊ |
71 | * DTR Data Terminal Ready Output generated by UART␊ |
72 | * DSR Data Set Ready Input sensed by UART␊ |
73 | * TXO XON/XOFF/XANY protocol Characters received by UART␊ |
74 | * RXO XON/XOFF protocol Characters transmitted by UART␊ |
75 | * DCD Data Carrier Detect Input sensed by UART␊ |
76 | */␊ |
77 | ␊ |
78 | /*␊ |
79 | * RS232 State Word extensions, based on <bsd/sys/ioctl.h>␊ |
80 | * Also the 'current state' bits for enq/deq of Flow Control event␊ |
81 | */ ␊ |
82 | #define PD_RS232_S_MASK 0x0000ffffUL␊ |
83 | #define PD_RS232_S_SHIFT 0␉// to align State bits for enq/deq event␊ |
84 | #define PD_RS232_D_MASK 0xffff0000UL␊ |
85 | #define PD_RS232_D_SHIFT 16␉// to align Delta bits for enq/deq event␊ |
86 | #define PD_RS232_A_MASK 0x0000ffffUL␊ |
87 | #define PD_RS232_A_SHIFT 0␉// to align Auto bits for req/exec event␊ |
88 | #define PD_RS232_N_MASK 0xffff0000UL␊ |
89 | #define PD_RS232_N_SHIFT 16␉// to align Notify bits for req/exec event␊ |
90 | ␊ |
91 | #define␉PD_RS232_S_LE␉TIOCM_LE␉// line enable␊ |
92 | #define␉PD_RS232_S_DTR␉TIOCM_DTR␉// data terminal ready␊ |
93 | #define␉PD_RS232_S_RTS␉TIOCM_RTS␉// request to send␊ |
94 | #define␉PD_RS232_S_RFR␉PD_RS232_S_RTS␉// ready for receive␊ |
95 | #define␉PD_RS232_S_TXO␉TIOCM_ST␉// TX XON/XOFF␊ |
96 | #define␉PD_RS232_S_RXO␉TIOCM_SR␉// RX XON/XOFF␊ |
97 | #define␉PD_RS232_S_CTS␉TIOCM_CTS␉// clear to send␊ |
98 | #define␉PD_RS232_S_CAR␉TIOCM_CAR␉// carrier detect␊ |
99 | #define␉PD_RS232_S_DCD␉PD_RS232_S_CAR␊ |
100 | #define␉PD_RS232_S_RNG␉TIOCM_RNG␉// ring␊ |
101 | #define␉PD_RS232_S_RI␉PD_RS232_S_RNG␊ |
102 | #define␉PD_RS232_S_DSR␉TIOCM_DSR␉// data set ready␊ |
103 | ␊ |
104 | #define␉PD_RS232_S_BRK␉0x00000800UL␉// break active Extension to TIOCM ␊ |
105 | #define␉PD_RS232_S_LOOP␉0x00001000UL␉// LOOP back Extension to TIOCM␊ |
106 | #define PD_RS232_S_TXQ␉0x00002000UL␉// User flowcontrol bit␊ |
107 | #define PD_RS232_S_RXQ␉0x00004000UL␉// User flowcontrol bit␊ |
108 | ␊ |
109 | // The 'delta' bits for enq/deq of Flow Control event␊ |
110 | #define␉PD_RS232_D_LE␉(PD_RS232_S_LE << PD_RS232_D_SHIFT)␊ |
111 | #define␉PD_RS232_D_DTR␉(PD_RS232_S_DTR << PD_RS232_D_SHIFT)␊ |
112 | #define␉PD_RS232_D_RTS␉(PD_RS232_S_RTS << PD_RS232_D_SHIFT)␊ |
113 | #define␉PD_RS232_D_RFR␉(PD_RS232_S_RFR << PD_RS232_D_SHIFT)␊ |
114 | #define␉PD_RS232_D_TXO␉(PD_RS232_S_TXO << PD_RS232_D_SHIFT)␊ |
115 | #define␉PD_RS232_D_RXO␉(PD_RS232_S_RXO << PD_RS232_D_SHIFT)␊ |
116 | #define␉PD_RS232_D_CTS␉(PD_RS232_S_CTS << PD_RS232_D_SHIFT)␊ |
117 | #define␉PD_RS232_D_CAR␉(PD_RS232_S_CAR << PD_RS232_D_SHIFT)␊ |
118 | #define␉PD_RS232_D_DCD␉(PD_RS232_S_DCD << PD_RS232_D_SHIFT)␊ |
119 | #define␉PD_RS232_D_RNG␉(PD_RS232_S_RNG << PD_RS232_D_SHIFT)␊ |
120 | #define␉PD_RS232_D_RI␉(PD_RS232_S_RI << PD_RS232_D_SHIFT)␊ |
121 | #define␉PD_RS232_D_DSR␉(PD_RS232_S_DSR << PD_RS232_D_SHIFT)␊ |
122 | ␊ |
123 | #define␉PD_RS232_D_BRK␉(PD_RS232_S_BRK << PD_RS232_D_SHIFT)␊ |
124 | #define␉PD_RS232_D_LOOP (PD_RS232_S_LOOP << PD_RS232_D_SHIFT)␊ |
125 | #define PD_RS232_D_TXQ␉(PD_RS232_S_TXQ << PD_RS232_D_SHIFT)␊ |
126 | #define PD_RS232_D_RXQ␉(PD_RS232_S_RXQ << PD_RS232_D_SHIFT)␊ |
127 | ␊ |
128 | // The 'auto' bits for exec/req of Flow Control event␊ |
129 | #define␉PD_RS232_A_LE␉PD_RS232_S_LE␊ |
130 | #define␉PD_RS232_A_DTR␉PD_RS232_S_DTR␊ |
131 | #define␉PD_RS232_A_RTS␉PD_RS232_S_RTS␊ |
132 | #define␉PD_RS232_A_RFR␉PD_RS232_S_RFR␊ |
133 | #define␉PD_RS232_A_TXO␉PD_RS232_S_TXO␊ |
134 | #define␉PD_RS232_A_RXO␉PD_RS232_S_RXO␊ |
135 | #define␉PD_RS232_A_CTS␉PD_RS232_S_CTS␊ |
136 | #define␉PD_RS232_A_CAR␉PD_RS232_S_CAR␊ |
137 | #define␉PD_RS232_A_DCD␉PD_RS232_S_DCD␊ |
138 | #define␉PD_RS232_A_RNG␉PD_RS232_S_RNG␊ |
139 | #define␉PD_RS232_A_RI␉PD_RS232_S_RI␊ |
140 | #define␉PD_RS232_A_DSR␉PD_RS232_S_DSR␊ |
141 | #define PD_RS232_A_XANY␉0x00000400␉// changes _A_TXO from XON/XOFF to XANY/XOFF␊ |
142 | #define␉PD_RS232_A_BRK␉PD_RS232_S_BRK ␊ |
143 | #define␉PD_RS232_A_LOOP PD_RS232_S_LOOP␊ |
144 | #define PD_RS232_A_TXQ␉PD_RS232_S_TXQ␊ |
145 | #define PD_RS232_A_RXQ␉PD_RS232_S_RXQ␊ |
146 | ␊ |
147 | // The 'notify' bits for exec/req of Flow Control event␊ |
148 | #define␉PD_RS232_N_LE␉(PD_RS232_S_LE << PD_RS232_N_SHIFT)␊ |
149 | #define␉PD_RS232_N_DTR␉(PD_RS232_S_DTR << PD_RS232_N_SHIFT)␊ |
150 | #define␉PD_RS232_N_RTS␉(PD_RS232_S_RTS << PD_RS232_N_SHIFT)␊ |
151 | #define␉PD_RS232_N_RFR␉(PD_RS232_S_RFR << PD_RS232_N_SHIFT)␊ |
152 | #define␉PD_RS232_N_TXO␉(PD_RS232_S_TXO << PD_RS232_N_SHIFT)␊ |
153 | #define␉PD_RS232_N_RXO␉(PD_RS232_S_RXO << PD_RS232_N_SHIFT)␊ |
154 | #define␉PD_RS232_N_CTS␉(PD_RS232_S_CTS << PD_RS232_N_SHIFT)␊ |
155 | #define␉PD_RS232_N_CAR␉(PD_RS232_S_CAR << PD_RS232_N_SHIFT)␊ |
156 | #define␉PD_RS232_N_DCD␉(PD_RS232_S_DCD << PD_RS232_N_SHIFT)␊ |
157 | #define␉PD_RS232_N_RNG␉(PD_RS232_S_RNG << PD_RS232_N_SHIFT)␊ |
158 | #define␉PD_RS232_N_RI␉(PD_RS232_S_RI << PD_RS232_N_SHIFT)␊ |
159 | #define␉PD_RS232_N_DSR␉(PD_RS232_S_DSR << PD_RS232_N_SHIFT)␊ |
160 | ␊ |
161 | #define␉PD_RS232_N_BRK␉(PD_RS232_S_BRK << PD_RS232_N_SHIFT)␊ |
162 | #define␉PD_RS232_N_LOOP (PD_RS232_S_LOOP << PD_RS232_N_SHIFT)␊ |
163 | #define PD_RS232_N_TXQ␉(PD_RS232_S_TXQ << PD_RS232_N_SHIFT)␊ |
164 | #define PD_RS232_N_RXQ␉(PD_RS232_S_RXQ << PD_RS232_N_SHIFT)␊ |
165 | ␊ |
166 | class IORS232SerialStreamSync : public IOSerialStreamSync␊ |
167 | {␊ |
168 | OSDeclareDefaultStructors(IORS232SerialStreamSync)␊ |
169 | };␊ |
170 | ␊ |
171 | #endif /* !_SERIAL_IORS232SERIALSTREAMSYNC_H */␊ |
172 | ␊ |
173 |