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