Add digi driver to simplify testing. This should replace dgb.
[dragonfly.git] / sys / dev / serial / digi / digireg.h
1 /*-
2  * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org>
3  *   based on work by Slawa Olhovchenkov
4  *                    John Prince <johnp@knight-trosoft.com>
5  *                    Eric Hernes
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * $FreeBSD: src/sys/dev/digi/digireg.h,v 1.3 2003/08/07 15:04:24 jhb Exp $
30  * $DragonFly: src/sys/dev/serial/digi/digireg.h,v 1.1 2004/12/22 08:42:47 joerg Exp $
31  */
32
33 struct global_data {
34         volatile u_short cin;
35         volatile u_short cout;
36         volatile u_short cstart;
37         volatile u_short cmax;
38         volatile u_short ein;
39         volatile u_short eout;
40         volatile u_short istart;
41         volatile u_short imax;
42 };
43
44
45 struct board_chan {
46         volatile u_short tpjmp;
47         volatile u_short tcjmp;
48         volatile u_short fil1;
49         volatile u_short rpjmp;
50         
51         volatile u_short tseg;
52         volatile u_short tin;
53         volatile u_short tout;
54         volatile u_short tmax;
55         
56         volatile u_short rseg;
57         volatile u_short rin;
58         volatile u_short rout;
59         volatile u_short rmax;
60         
61         volatile u_short tlow;
62         volatile u_short rlow;
63         volatile u_short rhigh;
64         volatile u_short incr;
65         
66         volatile u_short dev;
67         volatile u_short edelay;
68         volatile u_short blen;
69         volatile u_short btime;
70         
71         volatile u_short iflag;
72         volatile u_short oflag;
73         volatile u_short cflag;
74         volatile u_short gmask;
75         
76         volatile u_short col;
77         volatile u_short delay;
78         volatile u_short imask;
79         volatile u_short tflush;
80
81         volatile u_char _1[16];
82         
83         volatile u_char num;
84         volatile u_char ract;
85         volatile u_char bstat;
86         volatile u_char tbusy;
87         volatile u_char iempty;
88         volatile u_char ilow;
89         volatile u_char idata;
90         volatile u_char eflag;
91         
92         volatile u_char tflag;
93         volatile u_char rflag;
94         volatile u_char xmask;
95         volatile u_char xval;
96         volatile u_char mstat;
97         volatile u_char mchange;
98         volatile u_char mint;
99         volatile u_char lstat;
100
101         volatile u_char mtran;
102         volatile u_char orun;
103         volatile u_char startca;
104         volatile u_char stopca;
105         volatile u_char startc;
106         volatile u_char stopc;
107         volatile u_char vnext;
108         volatile u_char hflow;
109
110         volatile u_char fillc;
111         volatile u_char ochar;
112         volatile u_char omask;
113         volatile u_char _2;
114
115         volatile u_char _3[28];
116 }; 
117
118 #define SRXLWATER      0xe0
119 #define SRXHWATER      0xe1
120 #define STPTR          0xe2
121 #define PAUSETX        0xe3
122 #define RESUMETX       0xe4
123 #define SAUXONOFFC     0xe6
124 #define SENDBREAK      0xe8
125 #define SETMODEM       0xe9
126 #define SETIFLAGS      0xeA
127 #define SONOFFC        0xeB
128 #define STXLWATER      0xeC
129 #define PAUSERX        0xeE
130 #define RESUMERX       0xeF
131 #define RESETCHAN      0xf0
132 #define SETBUFFER      0xf2
133 #define SETCOOKED      0xf3
134 #define SETHFLOW       0xf4
135 #define SETCFLAGS      0xf5
136 #define SETVNEXT       0xf6
137 #define SETBSLICE      0xf7
138 #define SETRSMODE      0xfd
139 #define SETCMDACK      0xfe
140 #define RESERV         0xff
141
142 #define BREAK_IND        0x01
143 #define LOWTX_IND        0x02
144 #define EMPTYTX_IND      0x04
145 #define DATA_IND         0x08
146 #define MODEMCHG_IND     0x20
147 #define RECV_OVR_IND     0x40
148 #define CMD_ACK_IND      0x40
149 #define UART_OVR_IND     0x80
150
151 #define ALL_IND (BREAK_IND|LOWTX_IND|EMPTYTX_IND|DATA_IND|MODEMCHG_IND)
152
153 #define FEPTIMEOUT 2000
154
155 #define FEPCLR  0x0
156 #define FEPMEM  0x2
157 #define FEPRST  0x4
158 #define FEPREQ  0x8
159 #define FEPWIN  0x80
160 #define FEPMASK 0xe
161 /* #define FEPMASK 0x4 */
162
163 #define BOTWIN          0x100L
164 #define TOPWIN          0xFF00L
165 #define MISCGLOBAL      0x0C00L
166 #define FEPCODESEG      0x0200L
167
168 /* #define BIOSCODE   0xff800 */        /* Window 15, offset 7800h */
169 #define FEPCODE    0x0d000
170
171 #define FEP_CSTART      0x400L
172 #define FEP_CMAX        0x800L
173 #define FEP_ISTART      0x800L
174 #define FEP_IMAX        0xC00L
175 #define MBOX            0xC40L
176 #define FEP_CIN         0xD10L
177 #define FEP_GLOBAL      0xD10L
178 #define FEP_EIN         0xD18L
179 #define FEPSTAT         0xD20L
180 #define CHANSTRUCT      0x1000L
181 #define RXTXBUF         0x4000L
182
183 #define BIOSOFFSET      0x1000L
184 #define BIOSCODE        0xf800L
185 #define FEPOFFSET       0x2000L
186
187 /* c_cflag bits */
188 #define FEP_CSIZE       0x000030
189 #define FEP_CS5         0x000000
190 #define FEP_CS6         0x000010
191 #define FEP_CS7         0x000020
192 #define FEP_CS8         0x000030
193 #define FEP_CSTOPB      0x000040
194 #define FEP_CREAD       0x000080
195 #define FEP_PARENB      0x000100
196 #define FEP_PARODD      0x000200
197 #define FEP_CLOCAL      0x000800
198 #define FEP_FASTBAUD    0x000400
199
200 /* c_iflag bits */
201 #define FEP_IGNBRK      0000001
202 #define FEP_BRKINT      0000002
203 #define FEP_IGNPAR      0000004
204 #define FEP_PARMRK      0000010
205 #define FEP_INPCK       0000020
206 #define FEP_ISTRIP      0000040
207 #define FEP_IXON        0002000
208 #define FEP_IXANY       0004000
209 #define FEP_IXOFF       0010000