1 /*
2  * fbreg.h - Register and other definitions for Grinnell FB.
3  *
4  * Author:	Spencer W. Thomas
5  * 		Computer Science Dept.
6  * 		University of Utah
7  * Date:	Tue Dec 20 1983
8  * Copyright (c) 1983 Spencer W. Thomas
9  *
10  * $Header: fbreg.h,v 1.1 84/01/05 15:58:56 thomas Exp $
11  * $Log:	fbreg.h,v $
12  * Revision 1.1  84/01/05  15:58:56  thomas
13  * Initial revision
14  *
15  */
16 
17 
18 #ifndef GRINNELL_H                            /* only once */
19 #define GRINNELL_H
20 
21 #ifdef KERNEL
22 struct fbdevice
23 {
24     short   drwc;			/* DR11 word count */
25     u_short drba;			/* DR11 buffer address */
26     short   drst;			/* DR11 status register */
27     short   drdb;			/* not used */
28 };
29 
30 
31 /* various defines */
32 
33 #define FBPRI		(NZERO + 1)	/* sleep priority */
34 #define FBTOUT		600		/* 10 sec timeout */
35 
36 /* DR11 control bits */
37 
38 #define	GO	             01
39 #define	FNCT1		     02
40 #define	INT_ENAB	   0100
41 #define	READY		   0200
42 #define	ATTN		 020000
43 #define	NEX		 040000
44 #define	ERROR		0100000
45 
46 /* Frame buffer status register interpretation string */
47 
48 #define	FBSTAT	"\020\020ERROR\017NEX\016ATTN\010READY\07IE\02F1\01GO"
49 
50 #define	FBADDR(unit)	((struct fbdevice *)fbinfo[unit]->ui_addr)
51 
52 /* transmission modes */
53 
54 #define	READ		INT_ENAB | FNCT1 | GO	/* cpu <- fb */
55 #define WRITE		INT_ENAB | GO	/* cpu -> fb */
56 
57 #endif KERNEL
58 
59 /*
60 	definitions of basic frame buffer instructions
61 */
62 
63 #define	WriteImageData		(short)0000000
64 #define	LoadSubchannelMask	(short)0010000
65 #define	WriteGraphicData	(short)0020000
66 #define	Text			(short)0022000
67 #define	LoadWriteMode		(short)0024000
68 #define	Background		(short)0200	/* Reverse Background Bit */
69 #define	Additive		(short)0100	/* Additive Characters/Graphic Data */
70 #define	ZBit			(short)040	/* the "Z-Bit" */
71 #define	VectorMode		(short)020	/* Vector Mode Bit */
72 #define	ModeHeight		(short)010
73 #define	ModeWidth		(short)04
74 #define	CursPos			(short)02	/* if on, position at A+B, else at A */
75 #define	CursOn			(short)01	/* Cursor visible or not */
76 #define	LoadUpdateMode		(short)0026000
77 #define	ElementUpdate		(short)0/* shift for E1E0 bits */
78 #define	LineUpdate		2	/* shift for L1L0 bits */
79 #define	ScrUpdate		4	/* shift for S1S0 bits */
80 #define	A_no_change		(short)0/* Ea or La remains unchanged */
81 #define	A_C			1	/* Ea or La gets Ec or Lc */
82 #define	A_AB			2	/* Ea (La) gets Ea+Eb (La+Lb) */
83 #define	A_AC			3	/* Ea (La) gets Ea+Ec (La+Lc) */
84 #define	NoScroll		(short)0/* no scrolling */
85 #define	ScrollHome		1	/* scroll to home position */
86 #define	ScrollDown		2
87 #define	ScrollUp		3
88 #define	Erase			(short)0030000
89 #define	EraseLine		(short)0032000
90 #define	SpecialLocationUpdate	(short)0034000
91 #define	ExecuteGraphicWrite	(short)0036000
92 #define	GoWrite			(short)0002000
93 #define	LoadElement		(short)0040000
94 #define	LoadLine		(short)0060000
95 #define	LoadRelative		(short)0000000
96 #define	LoadARegisters		(short)0004000
97 #define	LoadBRegisters		(short)0010000
98 #define	LoadCregisters		(short)0014000
99 #define	LoadEaRelative		(short)0040000
100 #define	LoadEA			(short)0044000
101 #define	LoadEB			(short)0050000
102 #define	LoadEC			(short)0054000
103 #define	LoadLaRelative		(short)0060000
104 #define	LoadLA			(short)0064000
105 #define	LoadLB			(short)0070000
106 #define	LoadLC			(short)0074000
107 #define	LoadDisplayChannels	(short)0100000
108 #define	SelectPeripheralDevice	(short)0120000
109 #define	Digitizer		(short)01
110 #define	VideoControl		(short)020	/* Video Configuration */
111 #define	ColorMap		(short)040	/* Bit 5 */
112 #define SelectRedMap		(short)0
113 #define SelectGreenMap		(short)02000
114 #define	SelectBlueMap		(short)04000
115 #define SelectWriteAll		(short)06000
116 #define Zoom			(short)0200	/* Zoom and Pan card (Bit 7) */
117 #define ZoomOn			(short)010	/* Enable Zoom and Pan */
118 #define ZcursOn			(short)040	/* Zoom cursor visible or not */
119 #define ZcBlink			(short)020	/* Blink Zoom cursor or not */
120 #define Zwrap			(short)04	/* Wrap or Clip */
121 #define Zfactor1		(short)0/* times one */
122 #define Zfactor2		(short)1/* times two */
123 #define Zfactor4		(short)2/* times four */
124 #define Zfactor8		(short)3/* times eight */
125 #define	MemReadback		(short)0400	/* Memory Readback */
126 #define	ByteUnpacker		(short)01000
127 #define UnpackText		(short)07000	/* Text and bit 9. */
128 #define UnpackGraphicData	(short)05000	/* Graphic Data and bit 9. */
129 #define UnpackImageData		(short)03000	/* Image Data and bit 9. */
130 #define	IntTest			(short)04000	/* Internal Tests */
131 #define	LoadPAddress		(short)0130000
132 #define	LoadPRegister		(short)0140000
133 #define	PRegShift		9	/* shift to Peripheral
134 					   Register Field */
135 #define	LoadPData		(short)0150000
136 #define	ReadbackPData		(short)0160000
137 #define	NoOperation		(short)0170000
138 #define	BUG			1
139 					/* bug exists which eats 2nd
140 					   word of some transfers */
141 #define ZBUGy			4
142 					/* bug exists where Zoom Cursor
143 					   is 4 pixels above mark. */
144 #ifndef KERNEL
145 
146 /* TAG( fd_file )
147  *
148  * Display file structure as used by Fdstart, Fddraw, etc.
149  */
150 
151 struct	fd_file	{	/* definition of display file structure */
152 	int	fd_len;		/* length used */
153 	int	fd_abs_rel;	/* absolute/relative flag */
154 	int	fd_x;		/* final x position */
155 	int	fd_y;		/* final y position */
156 	short	fd_list[1];	/* actual display file */
157 };
158 
159 #endif KERNEL
160 
161 /* Definition of IOCTL codes */
162 #define	FBGETBOX	_IOW(F,0,struct fb_getbox)
163 
164 /* Structure used by FBGETBOX ioctl */
165 struct fb_getbox {
166     short xmin, xmax,
167 	  ymin, ymax,
168 	  xfreq, yfreq;
169     short *buf;
170     int n;
171 };
172 
173 #endif GRINNELL_H
174