vidc.h revision 1.2.6.5 1 1.2.6.5 jdolecek /* $NetBSD: vidc.h,v 1.2.6.5 2002/10/10 18:31:51 jdolecek Exp $ */
2 1.2.6.2 thorpej
3 1.2.6.2 thorpej /*
4 1.2.6.2 thorpej * Copyright (c) 1994,1995 Mark Brinicombe.
5 1.2.6.2 thorpej * Copyright (c) 1994,1995 Brini.
6 1.2.6.2 thorpej * All rights reserved.
7 1.2.6.2 thorpej *
8 1.2.6.2 thorpej * This code is derived from software written for Brini by Mark Brinicombe
9 1.2.6.2 thorpej *
10 1.2.6.2 thorpej * Redistribution and use in source and binary forms, with or without
11 1.2.6.2 thorpej * modification, are permitted provided that the following conditions
12 1.2.6.2 thorpej * are met:
13 1.2.6.2 thorpej * 1. Redistributions of source code must retain the above copyright
14 1.2.6.2 thorpej * notice, this list of conditions and the following disclaimer.
15 1.2.6.2 thorpej * 2. Redistributions in binary form must reproduce the above copyright
16 1.2.6.2 thorpej * notice, this list of conditions and the following disclaimer in the
17 1.2.6.2 thorpej * documentation and/or other materials provided with the distribution.
18 1.2.6.2 thorpej * 3. All advertising materials mentioning features or use of this software
19 1.2.6.2 thorpej * must display the following acknowledgement:
20 1.2.6.2 thorpej * This product includes software developed by Brini.
21 1.2.6.2 thorpej * 4. The name of the company nor the name of the author may be used to
22 1.2.6.2 thorpej * endorse or promote products derived from this software without specific
23 1.2.6.2 thorpej * prior written permission.
24 1.2.6.2 thorpej *
25 1.2.6.2 thorpej * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
26 1.2.6.2 thorpej * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27 1.2.6.2 thorpej * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28 1.2.6.2 thorpej * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29 1.2.6.2 thorpej * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 1.2.6.2 thorpej * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 1.2.6.2 thorpej * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 1.2.6.2 thorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 1.2.6.2 thorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 1.2.6.2 thorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 1.2.6.2 thorpej * SUCH DAMAGE.
36 1.2.6.2 thorpej *
37 1.2.6.2 thorpej * RiscBSD kernel project
38 1.2.6.2 thorpej *
39 1.2.6.2 thorpej * vidc.h
40 1.2.6.2 thorpej *
41 1.2.6.2 thorpej * VIDC20 registers
42 1.2.6.2 thorpej *
43 1.2.6.2 thorpej * Created : 18/09/94
44 1.2.6.2 thorpej *
45 1.2.6.2 thorpej * Based on kate/display/vidc.h
46 1.2.6.2 thorpej */
47 1.2.6.2 thorpej
48 1.2.6.2 thorpej /*
49 1.2.6.2 thorpej * This should be private to the vidc directory but there are still dependancies
50 1.2.6.2 thorpej * between the vidc and the riscpc virtual console (struct vidc_mode) that
51 1.2.6.2 thorpej * means this file must be exported to userland.
52 1.2.6.2 thorpej * With the import of the new console code this will go away.
53 1.2.6.2 thorpej */
54 1.2.6.2 thorpej
55 1.2.6.2 thorpej #ifndef _ARM32_VIDC_H_
56 1.2.6.2 thorpej #define _ARM32_VIDC_H_
57 1.2.6.2 thorpej
58 1.2.6.3 jdolecek
59 1.2.6.3 jdolecek #ifdef _KERNEL
60 1.2.6.2 thorpej #include <machine/vidc_machdep.h>
61 1.2.6.3 jdolecek #endif
62 1.2.6.2 thorpej
63 1.2.6.2 thorpej
64 1.2.6.2 thorpej /*
65 1.2.6.2 thorpej * Current VIDC base set in initarm()
66 1.2.6.2 thorpej * since the current code isnt busspaceified, we need to set it manually ...
67 1.2.6.2 thorpej * this is to allow the VIDC to be moved.
68 1.2.6.2 thorpej */
69 1.2.6.2 thorpej extern int *vidc_base;
70 1.2.6.2 thorpej
71 1.2.6.2 thorpej
72 1.2.6.2 thorpej /* Video registers */
73 1.2.6.2 thorpej
74 1.2.6.2 thorpej #define VIDC_PALETTE 0x00000000
75 1.2.6.2 thorpej #define VIDC_PALREG 0x10000000
76 1.2.6.2 thorpej
77 1.2.6.2 thorpej #define VIDC_BCOL 0x40000000
78 1.2.6.2 thorpej #define VIDC_CP0 0x40000000
79 1.2.6.2 thorpej #define VIDC_CP1 0x50000000
80 1.2.6.2 thorpej #define VIDC_CP2 0x60000000
81 1.2.6.2 thorpej #define VIDC_CP3 0x70000000
82 1.2.6.2 thorpej
83 1.2.6.2 thorpej #define VIDC_HCR 0x80000000
84 1.2.6.2 thorpej #define VIDC_HSWR 0x81000000
85 1.2.6.2 thorpej #define VIDC_HBSR 0x82000000
86 1.2.6.2 thorpej #define VIDC_HDSR 0x83000000
87 1.2.6.2 thorpej #define VIDC_HDER 0x84000000
88 1.2.6.2 thorpej #define VIDC_HBER 0x85000000
89 1.2.6.2 thorpej #define VIDC_HCSR 0x86000000
90 1.2.6.2 thorpej #define VIDC_HIR 0x87000000
91 1.2.6.2 thorpej
92 1.2.6.2 thorpej #define VIDC_VCR 0x90000000
93 1.2.6.2 thorpej #define VIDC_VSWR 0x91000000
94 1.2.6.2 thorpej #define VIDC_VBSR 0x92000000
95 1.2.6.2 thorpej #define VIDC_VDSR 0x93000000
96 1.2.6.2 thorpej #define VIDC_VDER 0x94000000
97 1.2.6.2 thorpej #define VIDC_VBER 0x95000000
98 1.2.6.2 thorpej #define VIDC_VCSR 0x96000000
99 1.2.6.2 thorpej #define VIDC_VCER 0x97000000
100 1.2.6.2 thorpej
101 1.2.6.2 thorpej #define VIDC_EREG 0xc0000000
102 1.2.6.2 thorpej #define VIDC_FSYNREG 0xd0000000
103 1.2.6.2 thorpej #define VIDC_CONREG 0xe0000000
104 1.2.6.2 thorpej #define VIDC_DCTL 0xf0000000
105 1.2.6.2 thorpej
106 1.2.6.2 thorpej /* VIDC palette macros */
107 1.2.6.2 thorpej
108 1.2.6.2 thorpej #define VIDC_RED(r) (r)
109 1.2.6.4 jdolecek #define VIDC_GREEN(g) ((g) << 8)
110 1.2.6.4 jdolecek #define VIDC_BLUE(b) ((b) << 16)
111 1.2.6.2 thorpej #define VIDC_COL(r, g, b) (VIDC_RED(r) | VIDC_GREEN(g) | VIDC_BLUE(b))
112 1.2.6.2 thorpej
113 1.2.6.2 thorpej
114 1.2.6.2 thorpej /* Sound registers */
115 1.2.6.2 thorpej
116 1.2.6.2 thorpej #define VIDC_SIR0 0xa0000000
117 1.2.6.2 thorpej #define VIDC_SIR1 0xa1000000
118 1.2.6.2 thorpej #define VIDC_SIR2 0xa2000000
119 1.2.6.2 thorpej #define VIDC_SIR3 0xa3000000
120 1.2.6.2 thorpej #define VIDC_SIR4 0xa4000000
121 1.2.6.2 thorpej #define VIDC_SIR5 0xa5000000
122 1.2.6.2 thorpej #define VIDC_SIR6 0xa6000000
123 1.2.6.2 thorpej #define VIDC_SIR7 0xa7000000
124 1.2.6.2 thorpej
125 1.2.6.2 thorpej #define VIDC_SFR 0xb0000000
126 1.2.6.2 thorpej #define VIDC_SCR 0xb1000000
127 1.2.6.2 thorpej
128 1.2.6.2 thorpej #define SIR_LEFT_100 0x01
129 1.2.6.2 thorpej #define SIR_LEFT_83 0x02
130 1.2.6.2 thorpej #define SIR_LEFT_67 0x03
131 1.2.6.2 thorpej #define SIR_CENTRE 0x04
132 1.2.6.2 thorpej #define SIR_RIGHT_67 0x05
133 1.2.6.2 thorpej #define SIR_RIGHT_83 0x06
134 1.2.6.2 thorpej #define SIR_RIGHT_100 0x07
135 1.2.6.2 thorpej
136 1.2.6.2 thorpej /* Video display addresses */
137 1.2.6.2 thorpej
138 1.2.6.2 thorpej /* Where the display memory is mapped */
139 1.2.6.2 thorpej /* note that there's not normally more than 2MB */
140 1.2.6.2 thorpej #define VMEM_VBASE 0xf7000000
141 1.2.6.2 thorpej
142 1.2.6.2 thorpej /* Where the VRAM will be found */
143 1.2.6.2 thorpej
144 1.2.6.2 thorpej #define VRAM_BASE 0x02000000
145 1.2.6.2 thorpej
146 1.2.6.2 thorpej #ifndef _LOCORE
147 1.2.6.2 thorpej
148 1.2.6.2 thorpej /* Video memory descriptor */
149 1.2.6.2 thorpej
150 1.2.6.2 thorpej typedef struct
151 1.2.6.2 thorpej {
152 1.2.6.2 thorpej u_int vidm_vbase; /* virtual base of video memory */
153 1.2.6.2 thorpej u_int vidm_pbase; /* physical base of video memory */
154 1.2.6.2 thorpej u_int vidm_size; /* video memory size */
155 1.2.6.2 thorpej int vidm_type; /* video memory type */
156 1.2.6.2 thorpej } videomemory_t;
157 1.2.6.2 thorpej
158 1.2.6.2 thorpej #define VIDEOMEM_TYPE_VRAM 0x01
159 1.2.6.2 thorpej #define VIDEOMEM_TYPE_DRAM 0x02
160 1.2.6.2 thorpej
161 1.2.6.2 thorpej /* Structures and prototypes for vidc handling functions */
162 1.2.6.2 thorpej
163 1.2.6.2 thorpej struct vidc_state {
164 1.2.6.2 thorpej int palette[256];
165 1.2.6.2 thorpej int palreg;
166 1.2.6.2 thorpej int bcol;
167 1.2.6.2 thorpej int cp1;
168 1.2.6.2 thorpej int cp2;
169 1.2.6.2 thorpej int cp3;
170 1.2.6.2 thorpej int hcr, hswr, hbsr, hdsr, hder, hber, hcsr;
171 1.2.6.2 thorpej int hir;
172 1.2.6.2 thorpej int vcr, vswr, vbsr, vdsr, vder, vber, vcsr, vcer;
173 1.2.6.2 thorpej int ereg;
174 1.2.6.2 thorpej int fsynreg;
175 1.2.6.2 thorpej int conreg;
176 1.2.6.2 thorpej int dctl;
177 1.2.6.2 thorpej };
178 1.2.6.2 thorpej
179 1.2.6.2 thorpej extern int vidc_fref; /* reference frequency of detected VIDC */
180 1.2.6.2 thorpej
181 1.2.6.2 thorpej #ifdef _KERNEL
182 1.2.6.2 thorpej extern int vidc_write __P((u_int /*reg*/, int /*value*/));
183 1.2.6.5 jdolecek extern void vidc_setstate __P((struct vidc_state * /*vidc*/));
184 1.2.6.5 jdolecek extern void vidc_getstate __P((struct vidc_state * /*vidc*/));
185 1.2.6.5 jdolecek extern void vidc_setpalette __P((struct vidc_state * /*vidc*/));
186 1.2.6.2 thorpej extern void vidc_stdpalette __P((void));
187 1.2.6.2 thorpej extern int vidc_col __P((int /*red*/, int /*green*/, int /*blue*/));
188 1.2.6.2 thorpej extern struct vidc_state vidc_current[];
189 1.2.6.2 thorpej #endif /* _KERNEL */
190 1.2.6.2 thorpej
191 1.2.6.2 thorpej struct vidc_mode {
192 1.2.6.2 thorpej int pixel_rate;
193 1.2.6.2 thorpej int hswr, hbsr, hdsr, hder, hber, hcr;
194 1.2.6.2 thorpej int vswr, vbsr, vdsr, vder, vber, vcr;
195 1.2.6.2 thorpej int log2_bpp;
196 1.2.6.2 thorpej int sync_pol;
197 1.2.6.2 thorpej int frame_rate;
198 1.2.6.2 thorpej };
199 1.2.6.2 thorpej
200 1.2.6.2 thorpej typedef struct
201 1.2.6.2 thorpej {
202 1.2.6.2 thorpej int chars; /* Number of characters defined in font */
203 1.2.6.2 thorpej int width; /* Defined width of characters in bytes */
204 1.2.6.2 thorpej int height; /* Defined height of characters in lines */
205 1.2.6.2 thorpej int pixel_width; /* Width of characters in pixels */
206 1.2.6.2 thorpej int pixel_height; /* Height of characters in pixels */
207 1.2.6.2 thorpej int x_spacing; /* Spacing in pixels between chars */
208 1.2.6.2 thorpej int y_spacing; /* Spacing in pixels between lines */
209 1.2.6.2 thorpej int data_size; /* Allocated data size */
210 1.2.6.2 thorpej unsigned char *data; /* Font data */
211 1.2.6.2 thorpej } font_struct;
212 1.2.6.2 thorpej
213 1.2.6.2 thorpej #define XRES mode.hder
214 1.2.6.2 thorpej #define YRES mode.vder
215 1.2.6.2 thorpej #define NUMCOLOURS (1 << mode.log2_bpp)
216 1.2.6.2 thorpej
217 1.2.6.2 thorpej struct vidc_info
218 1.2.6.2 thorpej {
219 1.2.6.2 thorpej struct vidc_mode mode;
220 1.2.6.2 thorpej struct vidc_state vidc;
221 1.2.6.2 thorpej font_struct *font; /* pointer to current font_struct */
222 1.2.6.2 thorpej font_struct *normalfont; /* pointer to normal font struct */
223 1.2.6.2 thorpej font_struct *italicfont; /* pointer to italic font struct */
224 1.2.6.2 thorpej font_struct *boldfont; /* pointer to bold font struct */
225 1.2.6.2 thorpej int xfontsize, yfontsize;
226 1.2.6.2 thorpej int text_width, text_height;
227 1.2.6.2 thorpej int bytes_per_line;
228 1.2.6.2 thorpej int bytes_per_scroll;
229 1.2.6.2 thorpej int pixelsperbyte;
230 1.2.6.2 thorpej int screensize;
231 1.2.6.2 thorpej int fast_render;
232 1.2.6.2 thorpej int forecolour, forefillcolour;
233 1.2.6.2 thorpej int backcolour, backfillcolour;
234 1.2.6.2 thorpej int text_colours;
235 1.2.6.2 thorpej int frontporch;
236 1.2.6.2 thorpej int topporch; /* ;) */
237 1.2.6.2 thorpej int bold;
238 1.2.6.2 thorpej int reverse;
239 1.2.6.2 thorpej int n_forecolour;
240 1.2.6.2 thorpej int n_backcolour;
241 1.2.6.2 thorpej int blanked;
242 1.2.6.2 thorpej int scrollback_end;
243 1.2.6.2 thorpej int flash;
244 1.2.6.2 thorpej int cursor_flash;
245 1.2.6.2 thorpej };
246 1.2.6.2 thorpej
247 1.2.6.2 thorpej #endif /* !_LOCORE */
248 1.2.6.2 thorpej
249 1.2.6.2 thorpej #define COLOUR_BLACK_1 0x00
250 1.2.6.2 thorpej #define COLOUR_WHITE_1 0x01
251 1.2.6.2 thorpej
252 1.2.6.2 thorpej #define COLOUR_BLACK_2 0x00
253 1.2.6.2 thorpej #define COLOUR_WHITE_2 0x03
254 1.2.6.2 thorpej
255 1.2.6.2 thorpej #define COLOUR_BLACK_4 0x00
256 1.2.6.2 thorpej #define COLOUR_WHITE_4 0x07
257 1.2.6.2 thorpej
258 1.2.6.2 thorpej #define COLOUR_BLACK_8 0x00
259 1.2.6.2 thorpej #define COLOUR_WHITE_8 0x07
260 1.2.6.2 thorpej
261 1.2.6.2 thorpej #endif /* !_ARM32_VIDC_H */
262 1.2.6.2 thorpej
263 1.2.6.2 thorpej /* End of vidc.h */
264 1.2.6.2 thorpej
265