qduser.h revision 1.3.2.2 1 1.3.2.2 thorpej /* $NetBSD: qduser.h,v 1.3.2.2 1999/07/01 23:35:35 thorpej Exp $ */
2 1.3.2.2 thorpej /*-
3 1.3.2.2 thorpej * Copyright (c) 1982, 1986 The Regents of the University of California.
4 1.3.2.2 thorpej * All rights reserved.
5 1.3.2.2 thorpej *
6 1.3.2.2 thorpej * Redistribution and use in source and binary forms, with or without
7 1.3.2.2 thorpej * modification, are permitted provided that the following conditions
8 1.3.2.2 thorpej * are met:
9 1.3.2.2 thorpej * 1. Redistributions of source code must retain the above copyright
10 1.3.2.2 thorpej * notice, this list of conditions and the following disclaimer.
11 1.3.2.2 thorpej * 2. Redistributions in binary form must reproduce the above copyright
12 1.3.2.2 thorpej * notice, this list of conditions and the following disclaimer in the
13 1.3.2.2 thorpej * documentation and/or other materials provided with the distribution.
14 1.3.2.2 thorpej * 3. All advertising materials mentioning features or use of this software
15 1.3.2.2 thorpej * must display the following acknowledgement:
16 1.3.2.2 thorpej * This product includes software developed by the University of
17 1.3.2.2 thorpej * California, Berkeley and its contributors.
18 1.3.2.2 thorpej * 4. Neither the name of the University nor the names of its contributors
19 1.3.2.2 thorpej * may be used to endorse or promote products derived from this software
20 1.3.2.2 thorpej * without specific prior written permission.
21 1.3.2.2 thorpej *
22 1.3.2.2 thorpej * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 1.3.2.2 thorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 1.3.2.2 thorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 1.3.2.2 thorpej * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 1.3.2.2 thorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 1.3.2.2 thorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 1.3.2.2 thorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 1.3.2.2 thorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 1.3.2.2 thorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 1.3.2.2 thorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 1.3.2.2 thorpej * SUCH DAMAGE.
33 1.3.2.2 thorpej *
34 1.3.2.2 thorpej * @(#)qduser.h 7.1 (Berkeley) 5/9/91
35 1.3.2.2 thorpej */
36 1.3.2.2 thorpej
37 1.3.2.2 thorpej /* derived from: @(#)qduser.h 6.1 (ULTRIX) 11/24/87 */
38 1.3.2.2 thorpej /************************************************************************
39 1.3.2.2 thorpej * *
40 1.3.2.2 thorpej * Copyright (c) 1986 by *
41 1.3.2.2 thorpej * Digital Equipment Corporation, Maynard, MA *
42 1.3.2.2 thorpej * All rights reserved. *
43 1.3.2.2 thorpej * *
44 1.3.2.2 thorpej * This software is furnished under a license and may be used and *
45 1.3.2.2 thorpej * copied only in accordance with the terms of such license and *
46 1.3.2.2 thorpej * with the inclusion of the above copyright notice. This *
47 1.3.2.2 thorpej * software or any other copies thereof may not be provided or *
48 1.3.2.2 thorpej * otherwise made available to any other person. No title to and *
49 1.3.2.2 thorpej * ownership of the software is hereby transferred. *
50 1.3.2.2 thorpej * *
51 1.3.2.2 thorpej * The information in this software is subject to change without *
52 1.3.2.2 thorpej * notice and should not be construed as a commitment by Digital *
53 1.3.2.2 thorpej * Equipment Corporation. *
54 1.3.2.2 thorpej * *
55 1.3.2.2 thorpej * Digital assumes no responsibility for the use or reliability *
56 1.3.2.2 thorpej * of its software on equipment which is not supplied by Digital. *
57 1.3.2.2 thorpej * *
58 1.3.2.2 thorpej ************************************************************************/
59 1.3.2.2 thorpej
60 1.3.2.2 thorpej /***************************************************************************
61 1.3.2.2 thorpej *
62 1.3.2.2 thorpej * QDUSER...
63 1.3.2.2 thorpej * This file defines values shared between the driver and a client
64 1.3.2.2 thorpej *
65 1.3.2.2 thorpej ***************************************************************************/
66 1.3.2.2 thorpej
67 1.3.2.2 thorpej /***************************************************************************
68 1.3.2.2 thorpej * revision history:
69 1.3.2.2 thorpej ****************************************************************************
70 1.3.2.2 thorpej *
71 1.3.2.2 thorpej * 21 jul 86 ram fixed define of CURSOR_MIN_Y
72 1.3.2.2 thorpej * 25 nov 85 longo added macro and bit defines for DMA error flags
73 1.3.2.2 thorpej * 11 nov 85 longo renamed _vs_eventqueue to "qdinput" struct
74 1.3.2.2 thorpej * 23 oct 85 longo added more defines to the DMA stuff
75 1.3.2.2 thorpej * 17 oct 85 longo changed "struct rgb" chars to be unsigned
76 1.3.2.2 thorpej * 16 oct 85 longo added new TABLET support definitions
77 1.3.2.2 thorpej * 15 oct 85 longo re-wrote DMA queue access macros
78 1.3.2.2 thorpej * 08 oct 85 longo added status flag manipulation macros to DMA stuff
79 1.3.2.2 thorpej * 02 oct 85 longo added support for color map write buffer loading
80 1.3.2.2 thorpej * 26 sep 85 longo removed adder sertup params from DMA request struct
81 1.3.2.2 thorpej * 23 sep 85 longo added DMA queue access macros
82 1.3.2.2 thorpej * 30 aug 85 longo fixed crock in "qdiobuf" struct compile-time sizing. Also
83 1.3.2.2 thorpej * removed DMAcontrol struct from DMA buffer for field test
84 1.3.2.2 thorpej * 26 aug 85 longo put in conditional include of "qevent.h" for user prg's
85 1.3.2.2 thorpej * 18 jul 85 longo changed semantics so that head is tail and tail is head
86 1.3.2.2 thorpej * 12 jul 85 longo moved "mouse_report" struct and defs over to qd_data.c
87 1.3.2.2 thorpej * 11 jul 85 longo added device coordinate to gate array cursor coordinate
88 1.3.2.2 thorpej * transformation macros
89 1.3.2.2 thorpej * 03 jul 85 longo changed kernel typdef's for data types to long-hand
90 1.3.2.2 thorpej * 10 may 85 longo created
91 1.3.2.2 thorpej *
92 1.3.2.2 thorpej ***************************************************************************/
93 1.3.2.2 thorpej
94 1.3.2.2 thorpej #include <dev/qbus/qevent.h>
95 1.3.2.2 thorpej
96 1.3.2.2 thorpej /*---------------------
97 1.3.2.2 thorpej * QDSS device map */
98 1.3.2.2 thorpej
99 1.3.2.2 thorpej struct qdmap { /* map of register blocks in QDSS */
100 1.3.2.2 thorpej
101 1.3.2.2 thorpej char *template;
102 1.3.2.2 thorpej char *adder;
103 1.3.2.2 thorpej char *dga;
104 1.3.2.2 thorpej char *duart;
105 1.3.2.2 thorpej char *memcsr;
106 1.3.2.2 thorpej char *red;
107 1.3.2.2 thorpej char *blue;
108 1.3.2.2 thorpej char *green;
109 1.3.2.2 thorpej };
110 1.3.2.2 thorpej
111 1.3.2.2 thorpej /*--------------------------------------------
112 1.3.2.2 thorpej * DGA CSR bit definitions and register map */
113 1.3.2.2 thorpej
114 1.3.2.2 thorpej #define DMADONE 0x8000 /* DMA done status */
115 1.3.2.2 thorpej #define SET_DONE_FIFO 0x4000 /* set DMADONE when FIFO empty.. */
116 1.3.2.2 thorpej /* ..AND count = 0 */
117 1.3.2.2 thorpej
118 1.3.2.2 thorpej #define PTOB_ENB 0x0600 /* host-to-bitmap DMA xfer */
119 1.3.2.2 thorpej #define BTOP_ENB 0x0400 /* bitmap-to-host DMA xfer */
120 1.3.2.2 thorpej #define DL_ENB 0x0200 /* display list DMA xfer */
121 1.3.2.2 thorpej #define HALT 0x0000 /* halt DGA */
122 1.3.2.2 thorpej
123 1.3.2.2 thorpej #define BYTE_DMA 0x0100 /* byte/word DMA xfer */
124 1.3.2.2 thorpej
125 1.3.2.2 thorpej #define DMA_ERR 0x0080 /* DMA error bits */
126 1.3.2.2 thorpej #define PARITY_ERR 0x0040 /* memory parity error in DMA */
127 1.3.2.2 thorpej #define BUS_ERR 0x0020 /* bus timeout error in DMA */
128 1.3.2.2 thorpej
129 1.3.2.2 thorpej #define GLOBAL_IE 0x0004 /* global interrupt enable */
130 1.3.2.2 thorpej #define DMA_IE 0x0002 /* DMA interrupt enable */
131 1.3.2.2 thorpej #define CURS_ENB 0x0001 /* cursor enable */
132 1.3.2.2 thorpej
133 1.3.2.2 thorpej /* QDSS memcsr bit definitions */
134 1.3.2.2 thorpej
135 1.3.2.2 thorpej #define UNBLANK 0x0020
136 1.3.2.2 thorpej #define SYNC_ON 0x0008
137 1.3.2.2 thorpej
138 1.3.2.2 thorpej struct dga {
139 1.3.2.2 thorpej
140 1.3.2.2 thorpej unsigned short csr;
141 1.3.2.2 thorpej unsigned short adrs_lo; /* destination address of bitmap to */
142 1.3.2.2 thorpej unsigned short adrs_hi; /* host DMA */
143 1.3.2.2 thorpej unsigned short bytcnt_lo; /* byte length of requested DMA */
144 1.3.2.2 thorpej unsigned short bytcnt_hi; /* (WO = bytcnt) (RO = fifo count) */
145 1.3.2.2 thorpej unsigned short fifo; /* FIFO register */
146 1.3.2.2 thorpej unsigned short x_cursor; /* cursor position registers */
147 1.3.2.2 thorpej unsigned short y_cursor;
148 1.3.2.2 thorpej unsigned short ivr; /* interrupt vector register */
149 1.3.2.2 thorpej unsigned short memadr; /* memory base address register */
150 1.3.2.2 thorpej };
151 1.3.2.2 thorpej
152 1.3.2.2 thorpej /*-------------------------------------------------------------------------
153 1.3.2.2 thorpej * macros to transform device coordinates to hardware cursor coordinates */
154 1.3.2.2 thorpej
155 1.3.2.2 thorpej #define CURS_MIN_X 232 /* device coordinate x = 0 */
156 1.3.2.2 thorpej #define CURS_MIN_Y 16 /* device coordinate y = 0 */
157 1.3.2.2 thorpej
158 1.3.2.2 thorpej #define TRANX(x) ( -(((int)(x)+CURS_MIN_X) & ~0x0003) | \
159 1.3.2.2 thorpej (((int)(x)+CURS_MIN_X) & 0x0003) )
160 1.3.2.2 thorpej
161 1.3.2.2 thorpej #define TRANY(y) ( -((y)+CURS_MIN_Y) )
162 1.3.2.2 thorpej
163 1.3.2.2 thorpej /*********************************************************************
164 1.3.2.2 thorpej *
165 1.3.2.2 thorpej * EVENT QUEUE DEFINITIONS
166 1.3.2.2 thorpej *
167 1.3.2.2 thorpej **********************************************************************
168 1.3.2.2 thorpej * most of the event queue definitions are found in "qevent.h". But a
169 1.3.2.2 thorpej * few things not found there are here. */
170 1.3.2.2 thorpej
171 1.3.2.2 thorpej /* The event queue header */
172 1.3.2.2 thorpej
173 1.3.2.2 thorpej struct qdinput {
174 1.3.2.2 thorpej
175 1.3.2.2 thorpej struct _vs_eventqueue header; /* event queue ring handling */
176 1.3.2.2 thorpej
177 1.3.2.2 thorpej /* for VS100 and QVSS compatability reasons, additions to this
178 1.3.2.2 thorpej * structure must be made below this point. */
179 1.3.2.2 thorpej
180 1.3.2.2 thorpej struct _vs_cursor curs_pos; /* current mouse position */
181 1.3.2.2 thorpej struct _vs_box curs_box; /* cursor reporting box */
182 1.3.2.2 thorpej
183 1.3.2.2 thorpej };
184 1.3.2.2 thorpej
185 1.3.2.2 thorpej /* vse_key field. definitions for mouse buttons */
186 1.3.2.2 thorpej
187 1.3.2.2 thorpej #define VSE_LEFT_BUTTON 0
188 1.3.2.2 thorpej #define VSE_MIDDLE_BUTTON 1
189 1.3.2.2 thorpej #define VSE_RIGHT_BUTTON 2
190 1.3.2.2 thorpej
191 1.3.2.2 thorpej /* vse_key field. definitions for mouse buttons */
192 1.3.2.2 thorpej
193 1.3.2.2 thorpej #define VSE_T_LEFT_BUTTON 0
194 1.3.2.2 thorpej #define VSE_T_FRONT_BUTTON 1
195 1.3.2.2 thorpej #define VSE_T_RIGHT_BUTTON 2
196 1.3.2.2 thorpej #define VSE_T_BACK_BUTTON 4
197 1.3.2.2 thorpej
198 1.3.2.2 thorpej #define VSE_T_BARREL_BUTTON VSE_T_LEFT_BUTTON
199 1.3.2.2 thorpej #define VSE_T_TIP_BUTTON VSE_T_FRONT_BUTTON
200 1.3.2.2 thorpej
201 1.3.2.2 thorpej /*--------------------------------------------------------------------------
202 1.3.2.2 thorpej * These are the macros to be used for loading and extracting from the event
203 1.3.2.2 thorpej * queue. It is presumed that the macro user will only use the access macros
204 1.3.2.2 thorpej * if the event queue is non-empty ( ISEMPTY(eq) == FALSE ), and that the
205 1.3.2.2 thorpej * driver will only load the event queue after checking that it is not full
206 1.3.2.2 thorpej * ( ISFULL(eq) == FALSE ). ("eq" is a pointer to the event queue header.)
207 1.3.2.2 thorpej *
208 1.3.2.2 thorpej * Before an event access session for a particular event, the macro users
209 1.3.2.2 thorpej * must use the xxxBEGIN macro, and the xxxEND macro after an event is through
210 1.3.2.2 thorpej * with. As seen below, the xxxBEGIN and xxxEND macros maintain the event
211 1.3.2.2 thorpej * queue access mechanism.
212 1.3.2.2 thorpej *
213 1.3.2.2 thorpej * First, the macros to be used by the event queue reader
214 1.3.2.2 thorpej */
215 1.3.2.2 thorpej
216 1.3.2.2 thorpej #define ISEMPTY(eq) ((eq)->header.head == (eq)->header.tail)
217 1.3.2.2 thorpej #define GETBEGIN(eq) (&(eq)->header.events[(eq)->header.head])
218 1.3.2.2 thorpej
219 1.3.2.2 thorpej #define GET_X(event) ((event)->vse_x) /* get x position */
220 1.3.2.2 thorpej #define GET_Y(event) ((event)->vse_y) /* get y position */
221 1.3.2.2 thorpej #define GET_TIME(event) ((event)->vse_time) /* get time */
222 1.3.2.2 thorpej #define GET_TYPE(event) ((event)->vse_type) /* get entry type */
223 1.3.2.2 thorpej #define GET_KEY(event) ((event)->vse_key) /* get keycode */
224 1.3.2.2 thorpej #define GET_DIR(event) ((event)->vse_direction) /* get direction */
225 1.3.2.2 thorpej #define GET_DEVICE(event) ((event)->vse_device) /* get device */
226 1.3.2.2 thorpej
227 1.3.2.2 thorpej #define GETEND(eq) (++(eq)->header.head >= (eq)->header.size ? \
228 1.3.2.2 thorpej (eq)->header.head = 0 : 0 )
229 1.3.2.2 thorpej
230 1.3.2.2 thorpej /*------------------------------------------------
231 1.3.2.2 thorpej * macros to be used by the event queue loader */
232 1.3.2.2 thorpej
233 1.3.2.2 thorpej /* ISFULL yields TRUE if queue is full */
234 1.3.2.2 thorpej
235 1.3.2.2 thorpej #define ISFULL(eq) ((eq)->header.tail+1 == (eq)->header.head || \
236 1.3.2.2 thorpej ((eq)->header.tail+1 == (eq)->header.size && \
237 1.3.2.2 thorpej (eq)->header.head == 0))
238 1.3.2.2 thorpej
239 1.3.2.2 thorpej /* get address of the billet for NEXT event */
240 1.3.2.2 thorpej
241 1.3.2.2 thorpej #define PUTBEGIN(eq) (&(eq)->header.events[(eq)->header.tail])
242 1.3.2.2 thorpej
243 1.3.2.2 thorpej #define PUT_X(event, value) ((event)->vse_x = value) /* put X pos */
244 1.3.2.2 thorpej #define PUT_Y(event, value) ((event)->vse_y = value) /* put Y pos */
245 1.3.2.2 thorpej #define PUT_TIME(event, value) ((event)->vse_time = value) /* put time */
246 1.3.2.2 thorpej #define PUT_TYPE(event, value) ((event)->vse_type = value) /* put type */
247 1.3.2.2 thorpej #define PUT_KEY(event, value) ((event)->vse_key = value) /* put input key */
248 1.3.2.2 thorpej #define PUT_DIR(event, value) ((event)->vse_direction = value) /* put dir */
249 1.3.2.2 thorpej #define PUT_DEVICE(event, value) ((event)->vse_device = value) /* put dev */
250 1.3.2.2 thorpej
251 1.3.2.2 thorpej #define PUTEND(eq) (++(eq)->header.tail >= (eq)->header.size ? \
252 1.3.2.2 thorpej (eq)->header.tail = 0 : 0)
253 1.3.2.2 thorpej
254 1.3.2.2 thorpej /******************************************************************
255 1.3.2.2 thorpej *
256 1.3.2.2 thorpej * DMA I/O DEFINITIONS
257 1.3.2.2 thorpej *
258 1.3.2.2 thorpej ******************************************************************/
259 1.3.2.2 thorpej
260 1.3.2.2 thorpej /*---------------------------------------------------------------------
261 1.3.2.2 thorpej * The DMA request queue is implemented as a ring buffer of "DMAreq"
262 1.3.2.2 thorpej structures. The queue is accessed using ring indices located in the
263 1.3.2.2 thorpej "DMAreq_header" structure. Access is implemented using access macros
264 1.3.2.2 thorpej similar to the event queue access macros above. */
265 1.3.2.2 thorpej
266 1.3.2.2 thorpej struct DMAreq {
267 1.3.2.2 thorpej
268 1.3.2.2 thorpej short DMAtype; /* DMA type code (for QDSS) */
269 1.3.2.2 thorpej short DMAdone; /* DMA done parameter */
270 1.3.2.2 thorpej char *bufp; /* virtual adrs of buffer */
271 1.3.2.2 thorpej int length; /* transfer buffer length */
272 1.3.2.2 thorpej };
273 1.3.2.2 thorpej
274 1.3.2.2 thorpej /* DMA type command codes */
275 1.3.2.2 thorpej
276 1.3.2.2 thorpej #define DISPLIST 1 /* display list DMA */
277 1.3.2.2 thorpej #define PTOB 2 /* 1 plane Qbus to bitmap DMA */
278 1.3.2.2 thorpej #define BTOP 3 /* 1 plane bitmap to Qbus DMA */
279 1.3.2.2 thorpej
280 1.3.2.2 thorpej /* DMA done notification code */
281 1.3.2.2 thorpej
282 1.3.2.2 thorpej #define FIFO_EMPTY 0x01 /* DONE when FIFO becomes empty */
283 1.3.2.2 thorpej #define COUNT_ZERO 0x02 /* DONE when count becomes zero */
284 1.3.2.2 thorpej #define WORD_PACK 0x04 /* program the gate array for word packing */
285 1.3.2.2 thorpej #define BYTE_PACK 0x08 /* program gate array for byte packing */
286 1.3.2.2 thorpej #define REQUEST_DONE 0x100 /* clear when driver has processed request */
287 1.3.2.2 thorpej #define HARD_ERROR 0x200 /* DMA hardware error occurred */
288 1.3.2.2 thorpej
289 1.3.2.2 thorpej /* DMA request queue is a ring buffer of request structures */
290 1.3.2.2 thorpej
291 1.3.2.2 thorpej struct DMAreq_header {
292 1.3.2.2 thorpej
293 1.3.2.2 thorpej int QBAreg; /* cookie Qbus map reg for this buffer */
294 1.3.2.2 thorpej short status; /* master DMA status word */
295 1.3.2.2 thorpej int shared_size; /* size of shared memory in bytes */
296 1.3.2.2 thorpej struct DMAreq *DMAreq; /* start address of request queue */
297 1.3.2.2 thorpej int used; /* # of queue entries currently used */
298 1.3.2.2 thorpej int size; /* # of "DMAreq"'s in the request queue */
299 1.3.2.2 thorpej int oldest; /* index to oldest queue'd request */
300 1.3.2.2 thorpej int newest; /* index to newest queue'd request */
301 1.3.2.2 thorpej };
302 1.3.2.2 thorpej
303 1.3.2.2 thorpej /* bit definitions for DMAstatus word in DMAreq_header */
304 1.3.2.2 thorpej
305 1.3.2.2 thorpej #define DMA_ACTIVE 0x0004 /* DMA in progress */
306 1.3.2.2 thorpej #define DMA_ERROR 0x0080 /* DMA hardware error */
307 1.3.2.2 thorpej #define DMA_IGNORE 0x0002 /* flag to ignore this interrupt */
308 1.3.2.2 thorpej
309 1.3.2.2 thorpej /*------------------------------------------
310 1.3.2.2 thorpej * macros for DMA request queue fiddling */
311 1.3.2.2 thorpej
312 1.3.2.2 thorpej /* DMA status set/check macros */
313 1.3.2.2 thorpej
314 1.3.2.2 thorpej #define DMA_SETACTIVE(header) ((header)->status |= DMA_ACTIVE)
315 1.3.2.2 thorpej #define DMA_CLRACTIVE(header) ((header)->status &= ~DMA_ACTIVE)
316 1.3.2.2 thorpej #define DMA_ISACTIVE(header) ((header)->status & DMA_ACTIVE)
317 1.3.2.2 thorpej
318 1.3.2.2 thorpej #define DMA_SETERROR(header) ((header)->status |= DMA_ERROR)
319 1.3.2.2 thorpej #define DMA_CLRERROR(header) ((header)->status &= ~DMA_ERROR)
320 1.3.2.2 thorpej #define DMA_ISERROR(header) ((header)->status & DMA_ERROR)
321 1.3.2.2 thorpej
322 1.3.2.2 thorpej #define DMA_SETIGNORE(header) ((header)->status |= DMA_IGNORE)
323 1.3.2.2 thorpej #define DMA_CLRIGNORE(header) ((header)->status &= ~DMA_IGNORE)
324 1.3.2.2 thorpej #define DMA_ISIGNORE(header) ((header)->status & DMA_IGNORE)
325 1.3.2.2 thorpej
326 1.3.2.2 thorpej /* yields TRUE if queue is empty (ISEMPTY) or full (ISFULL) */
327 1.3.2.2 thorpej
328 1.3.2.2 thorpej #define DMA_ISEMPTY(header) ((header)->used == 0)
329 1.3.2.2 thorpej #define DMA_ISFULL(header) ((header)->used >= (header)->size)
330 1.3.2.2 thorpej
331 1.3.2.2 thorpej /* returns address of the billet for next (PUT)
332 1.3.2.2 thorpej * or oldest (GET) request */
333 1.3.2.2 thorpej
334 1.3.2.2 thorpej #define DMA_PUTBEGIN(header) (&(header)->DMAreq[(header)->newest])
335 1.3.2.2 thorpej #define DMA_GETBEGIN(header) (&(header)->DMAreq[(header)->oldest])
336 1.3.2.2 thorpej
337 1.3.2.2 thorpej /* does queue access pointer maintenance */
338 1.3.2.2 thorpej
339 1.3.2.2 thorpej #define DMA_GETEND(header) (++(header)->oldest >= (header)->size \
340 1.3.2.2 thorpej ? (header)->oldest = 0 : 0); \
341 1.3.2.2 thorpej --(header)->used;
342 1.3.2.2 thorpej
343 1.3.2.2 thorpej #define DMA_PUTEND(header) (++(header)->newest >= (header)->size \
344 1.3.2.2 thorpej ? (header)->newest = 0 : 0); \
345 1.3.2.2 thorpej ++(header)->used;
346 1.3.2.2 thorpej
347 1.3.2.2 thorpej /******************************************************************
348 1.3.2.2 thorpej *
349 1.3.2.2 thorpej * COLOR MAP WRITE BUFFER DEFINITIONS
350 1.3.2.2 thorpej *
351 1.3.2.2 thorpej ******************************************************************/
352 1.3.2.2 thorpej
353 1.3.2.2 thorpej struct rgb {
354 1.3.2.2 thorpej
355 1.3.2.2 thorpej unsigned char offset; /* color map address for load */
356 1.3.2.2 thorpej unsigned char red; /* data for red map */
357 1.3.2.2 thorpej unsigned char green; /* data for green map */
358 1.3.2.2 thorpej unsigned char blue; /* data for blue map */
359 1.3.2.2 thorpej };
360 1.3.2.2 thorpej
361 1.3.2.2 thorpej struct color_buf {
362 1.3.2.2 thorpej
363 1.3.2.2 thorpej char status; /* load request/service status */
364 1.3.2.2 thorpej short count; /* number of entries to br loaded */
365 1.3.2.2 thorpej struct rgb rgb[256];
366 1.3.2.2 thorpej };
367 1.3.2.2 thorpej
368 1.3.2.2 thorpej #define LOAD_COLOR_MAP 0x0001
369 1.3.2.2 thorpej
370 1.3.2.2 thorpej /******************************************************************
371 1.3.2.2 thorpej *
372 1.3.2.2 thorpej * SCROLL ASSIST DEFINITIONS
373 1.3.2.2 thorpej *
374 1.3.2.2 thorpej ******************************************************************/
375 1.3.2.2 thorpej
376 1.3.2.2 thorpej struct scroll {
377 1.3.2.2 thorpej
378 1.3.2.2 thorpej short status;
379 1.3.2.2 thorpej short viper_constant;
380 1.3.2.2 thorpej short y_scroll_constant;
381 1.3.2.2 thorpej short y_offset;
382 1.3.2.2 thorpej short x_index_pending;
383 1.3.2.2 thorpej short y_index_pending;
384 1.3.2.2 thorpej };
385 1.3.2.2 thorpej
386 1.3.2.2 thorpej #define LOAD_REGS 0x0001
387 1.3.2.2 thorpej #define LOAD_INDEX 0x0002
388 1.3.2.2 thorpej
389 1.3.2.2 thorpej /******************************************************************
390 1.3.2.2 thorpej *
391 1.3.2.2 thorpej * MOUSE/TABLET/KBD PROGRAMMING DEFINITIONS
392 1.3.2.2 thorpej *
393 1.3.2.2 thorpej ******************************************************************/
394 1.3.2.2 thorpej
395 1.3.2.2 thorpej /*-----------------------------------
396 1.3.2.2 thorpej * LK201 programmming definitions */
397 1.3.2.2 thorpej
398 1.3.2.2 thorpej #define LK_UPDOWN 0x86 /* bits for setting lk201 modes */
399 1.3.2.2 thorpej #define LK_AUTODOWN 0x82
400 1.3.2.2 thorpej #define LK_DOWN 0x80
401 1.3.2.2 thorpej #define LK_DEFAULTS 0xD3 /* reset (some) default settings */
402 1.3.2.2 thorpej #define LK_AR_ENABLE 0xE3 /* global auto repeat enable */
403 1.3.2.2 thorpej #define LK_CL_ENABLE 0x1B /* keyclick enable */
404 1.3.2.2 thorpej #define LK_KBD_ENABLE 0x8B /* keyboard enable */
405 1.3.2.2 thorpej #define LK_BELL_ENABLE 0x23 /* the bell */
406 1.3.2.2 thorpej #define LK_RING_BELL 0xA7 /* ring keyboard bell */
407 1.3.2.2 thorpej
408 1.3.2.2 thorpej #define LK_LED_ENABLE 0x13 /* light led */
409 1.3.2.2 thorpej #define LK_LED_DISABLE 0x11 /* turn off led */
410 1.3.2.2 thorpej #define LED_1 0x81 /* led bits */
411 1.3.2.2 thorpej #define LED_2 0x82
412 1.3.2.2 thorpej #define LED_3 0x84
413 1.3.2.2 thorpej #define LED_4 0x88
414 1.3.2.2 thorpej #define LED_ALL 0x8F
415 1.3.2.2 thorpej #define LK_LED_HOLD LED_4
416 1.3.2.2 thorpej #define LK_LED_LOCK LED_3
417 1.3.2.2 thorpej #define LK_LED_COMPOSE LED_2
418 1.3.2.2 thorpej #define LK_LED_WAIT LED_1
419 1.3.2.2 thorpej
420 1.3.2.2 thorpej #define LK_KDOWN_ERROR 0x3D /* key down on powerup error */
421 1.3.2.2 thorpej #define LK_POWER_ERROR 0x3E /* keyboard failure on powerup test */
422 1.3.2.2 thorpej #define LK_OUTPUT_ERROR 0xB5 /* keystrokes lost during inhibit */
423 1.3.2.2 thorpej #define LK_INPUT_ERROR 0xB6 /* garbage command to keyboard */
424 1.3.2.2 thorpej #define LK_LOWEST 0x56 /* lowest significant keycode */
425 1.3.2.2 thorpej #define LK_DIV6_START 0xAD /* start of div 6 */
426 1.3.2.2 thorpej #define LK_DIV5_END 0xB2 /* end of div 5 */
427 1.3.2.2 thorpej
428 1.3.2.2 thorpej #define LAST_PARAM 0x80 /* "no more params" bit */
429 1.3.2.2 thorpej
430 1.3.2.2 thorpej struct prgkbd {
431 1.3.2.2 thorpej
432 1.3.2.2 thorpej short cmd; /* LK201 command opcode */
433 1.3.2.2 thorpej short param1; /* 1st cmd parameter (can be null) */
434 1.3.2.2 thorpej short param2; /* 2nd cmd parameter (can be null) */
435 1.3.2.2 thorpej };
436 1.3.2.2 thorpej
437 1.3.2.2 thorpej /*-------------------------
438 1.3.2.2 thorpej * "special" LK-201 keys */
439 1.3.2.2 thorpej
440 1.3.2.2 thorpej #define SHIFT 174
441 1.3.2.2 thorpej #define LOCK 176
442 1.3.2.2 thorpej #define REPEAT 180
443 1.3.2.2 thorpej #define CNTRL 175
444 1.3.2.2 thorpej #define ALLUP 179
445 1.3.2.2 thorpej
446 1.3.2.2 thorpej /*--------------------------------
447 1.3.2.2 thorpej * cursor programming structure */
448 1.3.2.2 thorpej
449 1.3.2.2 thorpej struct prg_cursor {
450 1.3.2.2 thorpej
451 1.3.2.2 thorpej unsigned short acc_factor; /* cursor aceleration factor */
452 1.3.2.2 thorpej unsigned short threshold; /* threshold to trigger acc at */
453 1.3.2.2 thorpej };
454 1.3.2.2 thorpej
455 1.3.2.2 thorpej /*---------------------
456 1.3.2.2 thorpej * mouse definitions */
457 1.3.2.2 thorpej
458 1.3.2.2 thorpej #define INC_STREAM_MODE 'R' /* stream mode reports (55 hz) */
459 1.3.2.2 thorpej #define PROMPT_MODE 'D' /* report when prompted */
460 1.3.2.2 thorpej #define REQUEST_POS 'P' /* request position report */
461 1.3.2.2 thorpej #define SELF_TEST 'T' /* request self test */
462 1.3.2.2 thorpej
463 1.3.2.2 thorpej #define MOUSE_ID 0x2 /* mouse ID in lo 4 bits */
464 1.3.2.2 thorpej
465 1.3.2.2 thorpej #define START_FRAME 0x80 /* start of report frame bit */
466 1.3.2.2 thorpej #define X_SIGN 0x10 /* position sign bits */
467 1.3.2.2 thorpej #define Y_SIGN 0x08
468 1.3.2.2 thorpej
469 1.3.2.2 thorpej #define RIGHT_BUTTON 0x01 /* mouse buttons */
470 1.3.2.2 thorpej #define MIDDLE_BUTTON 0x02
471 1.3.2.2 thorpej #define LEFT_BUTTON 0x04
472 1.3.2.2 thorpej
473 1.3.2.2 thorpej /* mouse report structure definition */
474 1.3.2.2 thorpej
475 1.3.2.2 thorpej struct mouse_report {
476 1.3.2.2 thorpej
477 1.3.2.2 thorpej char state; /* buttons and sign bits */
478 1.3.2.2 thorpej short dx; /* delta X since last change */
479 1.3.2.2 thorpej short dy; /* delta Y since last change */
480 1.3.2.2 thorpej char bytcnt; /* mouse report byte count */
481 1.3.2.2 thorpej };
482 1.3.2.2 thorpej
483 1.3.2.2 thorpej /*-----------------------------------------
484 1.3.2.2 thorpej * tablet command/interface definitions */
485 1.3.2.2 thorpej
486 1.3.2.2 thorpej #define T_STREAM 'R' /* continuous stream report mode */
487 1.3.2.2 thorpej #define T_POINT 'D' /* enter report-on-request mode */
488 1.3.2.2 thorpej #define T_REQUEST 'P' /* request position report */
489 1.3.2.2 thorpej
490 1.3.2.2 thorpej #define T_BAUD 'B' /* increase baud to 9600 from 4800 */
491 1.3.2.2 thorpej #define T_RATE_55 'K' /* report rate: 55/sec */
492 1.3.2.2 thorpej #define T_RATE_72 'L' /* report rate: 72/sec */
493 1.3.2.2 thorpej #define T_RATE_120 'M' /* report rate: 120/sec (9600 only) */
494 1.3.2.2 thorpej
495 1.3.2.2 thorpej #define T_TEST SELF_TEST /* do self test */
496 1.3.2.2 thorpej
497 1.3.2.2 thorpej #define TABLET_ID 0x4 /* tablet ID in lo 4 bits */
498 1.3.2.2 thorpej
499 1.3.2.2 thorpej #define T_START_FRAME 0x80 /* start of report frame bit */
500 1.3.2.2 thorpej #define T_PROXIMITY 0x01 /* state pointer in proximity */
501 1.3.2.2 thorpej
502 1.3.2.2 thorpej #define T_LEFT_BUTTON 0x02 /* puck buttons */
503 1.3.2.2 thorpej #define T_FRONT_BUTTON 0x04
504 1.3.2.2 thorpej #define T_RIGHT_BUTTON 0x08
505 1.3.2.2 thorpej #define T_BACK_BUTTON 0x10
506 1.3.2.2 thorpej
507 1.3.2.2 thorpej #define T_BARREL_BUTTON T_LEFT_BUTTON /* stylus buttons */
508 1.3.2.2 thorpej #define T_TIP_BUTTON T_FRONT_BUTTON
509 1.3.2.2 thorpej
510