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