1 |
/* |
2 |
* serial_defs.h - Definitions for MacOS serial drivers |
3 |
* |
4 |
* Basilisk II (C) 1997-1999 Christian Bauer |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
8 |
* the Free Software Foundation; either version 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
*/ |
20 |
|
21 |
#ifndef SERIAL_DEFS_H |
22 |
#define SERIAL_DEFS_H |
23 |
|
24 |
// Error codes |
25 |
enum { |
26 |
rcvrErr = -89, |
27 |
breakRecd = -90 |
28 |
}; |
29 |
|
30 |
// Serial port configuration |
31 |
enum { |
32 |
baud150 = 763, |
33 |
baud300 = 380, |
34 |
baud600 = 189, |
35 |
baud1200 = 94, |
36 |
baud1800 = 62, |
37 |
baud2400 = 46, |
38 |
baud3600 = 30, |
39 |
baud4800 = 22, |
40 |
baud7200 = 14, |
41 |
baud9600 = 10, |
42 |
baud14400 = 6, |
43 |
baud19200 = 4, |
44 |
baud28800 = 2, |
45 |
baud38400 = 1, |
46 |
baud57600 = 0 |
47 |
}; |
48 |
|
49 |
enum { |
50 |
stop10 = 0x4000, |
51 |
stop15 = 0x8000, |
52 |
stop20 = 0xc000 |
53 |
}; |
54 |
|
55 |
enum { |
56 |
noParity = 0, |
57 |
oddParity = 0x1000, |
58 |
evenParity = 0x3000 |
59 |
}; |
60 |
|
61 |
enum { |
62 |
data5 = 0, |
63 |
data6 = 0x0800, |
64 |
data7 = 0x0400, |
65 |
data8 = 0x0c00 |
66 |
}; |
67 |
|
68 |
// Serial events |
69 |
enum { |
70 |
dsrEvent = 2, |
71 |
riEvent = 4, |
72 |
dcdEvent = 8, |
73 |
ctsEvent = 32, |
74 |
breakEvent = 128 |
75 |
}; |
76 |
|
77 |
// Flags for SerStaRec.xOffSent |
78 |
enum { |
79 |
xOffWasSent = 128, |
80 |
dtrNegated = 64, |
81 |
rtsNegated = 32 |
82 |
}; |
83 |
|
84 |
// Serial driver error masks |
85 |
enum { |
86 |
swOverrunErr = 1, |
87 |
breakErr = 8, |
88 |
parityErr = 16, |
89 |
hwOverrunErr = 32, |
90 |
framingErr = 64 |
91 |
}; |
92 |
|
93 |
// Option for kSERDMiscOptions |
94 |
enum { |
95 |
kOptionPreserveDTR = 128, |
96 |
kOptionClockX1CTS = 64 |
97 |
}; |
98 |
|
99 |
// Flags for SerShk.fCTS |
100 |
enum { |
101 |
kUseCTSOutputFlowControl = 128, |
102 |
kUseDSROutputFlowControl = 64, |
103 |
kUseRTSInputFlowControl = 128, |
104 |
kUseDTRInputFlowControl = 64 |
105 |
}; |
106 |
|
107 |
// Control codes |
108 |
enum { |
109 |
kSERDConfiguration = 8, |
110 |
kSERDInputBuffer = 9, |
111 |
kSERDSerHShake = 10, |
112 |
kSERDClearBreak = 11, |
113 |
kSERDSetBreak = 12, |
114 |
kSERDBaudRate = 13, |
115 |
kSERDHandshake = 14, |
116 |
kSERDClockMIDI = 15, |
117 |
kSERDMiscOptions = 16, |
118 |
kSERDAssertDTR = 17, |
119 |
kSERDNegateDTR = 18, |
120 |
kSERDSetPEChar = 19, |
121 |
kSERDSetPEAltChar = 20, |
122 |
kSERDSetXOffFlag = 21, |
123 |
kSERDClearXOffFlag = 22, |
124 |
kSERDSendXOn = 23, |
125 |
kSERDSendXOnOut = 24, |
126 |
kSERDSendXOff = 25, |
127 |
kSERDSendXOffOut = 26, |
128 |
kSERDResetChannel = 27, |
129 |
kSERDHandshakeRS232 = 28, |
130 |
kSERDStickParity = 29, |
131 |
kSERDAssertRTS = 30, |
132 |
kSERDNegateRTS = 31, |
133 |
kSERD115KBaud = 115, |
134 |
kSERD230KBaud = 230, |
135 |
kSERDSetHighSpeed = 'JF', |
136 |
kSERDSetPollWrite = 'jf' |
137 |
}; |
138 |
|
139 |
// Status codes |
140 |
enum { |
141 |
kSERDInputCount = 2, |
142 |
kSERDStatus = 8, |
143 |
kSERDVersion = 9, |
144 |
kSERDGetDCD = 256 |
145 |
}; |
146 |
|
147 |
enum { // SerShk struct |
148 |
shkFXOn = 0, |
149 |
shkFCTS = 1, |
150 |
shkXOn = 2, |
151 |
shkXOff = 3, |
152 |
shkErrs = 4, |
153 |
shkEvts = 5, |
154 |
shkFInX = 6, |
155 |
shkFDTR = 7 |
156 |
}; |
157 |
|
158 |
enum { // SerSta struct |
159 |
staCumErrs = 0, |
160 |
staXOffSent = 1, |
161 |
staRdPend = 2, |
162 |
staWrPend = 3, |
163 |
staCtsHold = 4, |
164 |
staXOffHold = 5, |
165 |
staDsrHold = 6, |
166 |
staModemStatus = 7 |
167 |
}; |
168 |
|
169 |
#endif |