root / hw / blizzard.c @ e9396bde
History | View | Annotate | Download (28.6 kB)
1 | 7e7c5e4c | balrog | /*
|
---|---|---|---|
2 | 7e7c5e4c | balrog | * Epson S1D13744/S1D13745 (Blizzard/Hailstorm/Tornado) LCD/TV controller.
|
3 | 7e7c5e4c | balrog | *
|
4 | 7e7c5e4c | balrog | * Copyright (C) 2008 Nokia Corporation
|
5 | 7e7c5e4c | balrog | * Written by Andrzej Zaborowski <andrew@openedhand.com>
|
6 | 7e7c5e4c | balrog | *
|
7 | 7e7c5e4c | balrog | * This program is free software; you can redistribute it and/or
|
8 | 7e7c5e4c | balrog | * modify it under the terms of the GNU General Public License as
|
9 | 7e7c5e4c | balrog | * published by the Free Software Foundation; either version 2 or
|
10 | 7e7c5e4c | balrog | * (at your option) version 3 of the License.
|
11 | 7e7c5e4c | balrog | *
|
12 | 7e7c5e4c | balrog | * This program is distributed in the hope that it will be useful,
|
13 | 7e7c5e4c | balrog | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 | 7e7c5e4c | balrog | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 | 7e7c5e4c | balrog | * GNU General Public License for more details.
|
16 | 7e7c5e4c | balrog | *
|
17 | 7e7c5e4c | balrog | * You should have received a copy of the GNU General Public License
|
18 | 7e7c5e4c | balrog | * along with this program; if not, write to the Free Software
|
19 | 7e7c5e4c | balrog | * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
20 | 7e7c5e4c | balrog | * MA 02111-1307 USA
|
21 | 7e7c5e4c | balrog | */
|
22 | 7e7c5e4c | balrog | |
23 | 7e7c5e4c | balrog | #include "qemu-common.h" |
24 | 7e7c5e4c | balrog | #include "sysemu.h" |
25 | 7e7c5e4c | balrog | #include "console.h" |
26 | 7e7c5e4c | balrog | #include "devices.h" |
27 | 7e7c5e4c | balrog | #include "vga_int.h" |
28 | 7e7c5e4c | balrog | #include "pixel_ops.h" |
29 | 7e7c5e4c | balrog | |
30 | 7e7c5e4c | balrog | typedef void (*blizzard_fn_t)(uint8_t *, const uint8_t *, unsigned int); |
31 | 7e7c5e4c | balrog | |
32 | 7e7c5e4c | balrog | struct blizzard_s {
|
33 | 7e7c5e4c | balrog | uint8_t reg; |
34 | 7e7c5e4c | balrog | uint32_t addr; |
35 | 7e7c5e4c | balrog | int swallow;
|
36 | 7e7c5e4c | balrog | |
37 | 7e7c5e4c | balrog | int pll;
|
38 | 7e7c5e4c | balrog | int pll_range;
|
39 | 7e7c5e4c | balrog | int pll_ctrl;
|
40 | 7e7c5e4c | balrog | uint8_t pll_mode; |
41 | 7e7c5e4c | balrog | uint8_t clksel; |
42 | 7e7c5e4c | balrog | int memenable;
|
43 | 7e7c5e4c | balrog | int memrefresh;
|
44 | 7e7c5e4c | balrog | uint8_t timing[3];
|
45 | 7e7c5e4c | balrog | int priority;
|
46 | 7e7c5e4c | balrog | |
47 | 7e7c5e4c | balrog | uint8_t lcd_config; |
48 | 7e7c5e4c | balrog | int x;
|
49 | 7e7c5e4c | balrog | int y;
|
50 | 7e7c5e4c | balrog | int skipx;
|
51 | 7e7c5e4c | balrog | int skipy;
|
52 | 7e7c5e4c | balrog | uint8_t hndp; |
53 | 7e7c5e4c | balrog | uint8_t vndp; |
54 | 7e7c5e4c | balrog | uint8_t hsync; |
55 | 7e7c5e4c | balrog | uint8_t vsync; |
56 | 7e7c5e4c | balrog | uint8_t pclk; |
57 | 7e7c5e4c | balrog | uint8_t u; |
58 | 7e7c5e4c | balrog | uint8_t v; |
59 | 7e7c5e4c | balrog | uint8_t yrc[2];
|
60 | 7e7c5e4c | balrog | int ix[2]; |
61 | 7e7c5e4c | balrog | int iy[2]; |
62 | 7e7c5e4c | balrog | int ox[2]; |
63 | 7e7c5e4c | balrog | int oy[2]; |
64 | 7e7c5e4c | balrog | |
65 | 7e7c5e4c | balrog | int enable;
|
66 | 7e7c5e4c | balrog | int blank;
|
67 | 7e7c5e4c | balrog | int bpp;
|
68 | 7e7c5e4c | balrog | int invalidate;
|
69 | 7e7c5e4c | balrog | int mx[2]; |
70 | 7e7c5e4c | balrog | int my[2]; |
71 | 7e7c5e4c | balrog | uint8_t mode; |
72 | 7e7c5e4c | balrog | uint8_t effect; |
73 | 7e7c5e4c | balrog | uint8_t iformat; |
74 | 7e7c5e4c | balrog | uint8_t source; |
75 | 7e7c5e4c | balrog | DisplayState *state; |
76 | c60e08d9 | pbrook | QEMUConsole *console; |
77 | 7e7c5e4c | balrog | blizzard_fn_t *line_fn_tab[2];
|
78 | 7e7c5e4c | balrog | void *fb;
|
79 | 7e7c5e4c | balrog | |
80 | 7e7c5e4c | balrog | uint8_t hssi_config[3];
|
81 | 7e7c5e4c | balrog | uint8_t tv_config; |
82 | 7e7c5e4c | balrog | uint8_t tv_timing[4];
|
83 | 7e7c5e4c | balrog | uint8_t vbi; |
84 | 7e7c5e4c | balrog | uint8_t tv_x; |
85 | 7e7c5e4c | balrog | uint8_t tv_y; |
86 | 7e7c5e4c | balrog | uint8_t tv_test; |
87 | 7e7c5e4c | balrog | uint8_t tv_filter_config; |
88 | 7e7c5e4c | balrog | uint8_t tv_filter_idx; |
89 | 7e7c5e4c | balrog | uint8_t tv_filter_coeff[0x20];
|
90 | 7e7c5e4c | balrog | uint8_t border_r; |
91 | 7e7c5e4c | balrog | uint8_t border_g; |
92 | 7e7c5e4c | balrog | uint8_t border_b; |
93 | 7e7c5e4c | balrog | uint8_t gamma_config; |
94 | 7e7c5e4c | balrog | uint8_t gamma_idx; |
95 | 7e7c5e4c | balrog | uint8_t gamma_lut[0x100];
|
96 | 7e7c5e4c | balrog | uint8_t matrix_ena; |
97 | 7e7c5e4c | balrog | uint8_t matrix_coeff[0x12];
|
98 | 7e7c5e4c | balrog | uint8_t matrix_r; |
99 | 7e7c5e4c | balrog | uint8_t matrix_g; |
100 | 7e7c5e4c | balrog | uint8_t matrix_b; |
101 | 7e7c5e4c | balrog | uint8_t pm; |
102 | 7e7c5e4c | balrog | uint8_t status; |
103 | 7e7c5e4c | balrog | uint8_t rgbgpio_dir; |
104 | 7e7c5e4c | balrog | uint8_t rgbgpio; |
105 | 7e7c5e4c | balrog | uint8_t gpio_dir; |
106 | 7e7c5e4c | balrog | uint8_t gpio; |
107 | 7e7c5e4c | balrog | uint8_t gpio_edge[2];
|
108 | 7e7c5e4c | balrog | uint8_t gpio_irq; |
109 | 7e7c5e4c | balrog | uint8_t gpio_pdown; |
110 | 7e7c5e4c | balrog | |
111 | 7e7c5e4c | balrog | struct {
|
112 | 7e7c5e4c | balrog | int x;
|
113 | 7e7c5e4c | balrog | int y;
|
114 | 7e7c5e4c | balrog | int dx;
|
115 | 7e7c5e4c | balrog | int dy;
|
116 | 7e7c5e4c | balrog | int len;
|
117 | 7e7c5e4c | balrog | int buflen;
|
118 | 7e7c5e4c | balrog | void *buf;
|
119 | 7e7c5e4c | balrog | void *data;
|
120 | 7e7c5e4c | balrog | uint16_t *ptr; |
121 | 7e7c5e4c | balrog | int angle;
|
122 | 7e7c5e4c | balrog | int pitch;
|
123 | 7e7c5e4c | balrog | blizzard_fn_t line_fn; |
124 | 7e7c5e4c | balrog | } data; |
125 | 7e7c5e4c | balrog | }; |
126 | 7e7c5e4c | balrog | |
127 | 7e7c5e4c | balrog | /* Bytes(!) per pixel */
|
128 | 7e7c5e4c | balrog | static const int blizzard_iformat_bpp[0x10] = { |
129 | 7e7c5e4c | balrog | 0,
|
130 | 7e7c5e4c | balrog | 2, /* RGB 5:6:5*/ |
131 | 7e7c5e4c | balrog | 3, /* RGB 6:6:6 mode 1 */ |
132 | 7e7c5e4c | balrog | 3, /* RGB 8:8:8 mode 1 */ |
133 | 7e7c5e4c | balrog | 0, 0, |
134 | 7e7c5e4c | balrog | 4, /* RGB 6:6:6 mode 2 */ |
135 | 7e7c5e4c | balrog | 4, /* RGB 8:8:8 mode 2 */ |
136 | 7e7c5e4c | balrog | 0, /* YUV 4:2:2 */ |
137 | 7e7c5e4c | balrog | 0, /* YUV 4:2:0 */ |
138 | 7e7c5e4c | balrog | 0, 0, 0, 0, 0, 0, |
139 | 7e7c5e4c | balrog | }; |
140 | 7e7c5e4c | balrog | |
141 | 7e7c5e4c | balrog | static inline void blizzard_rgb2yuv(int r, int g, int b, |
142 | 7e7c5e4c | balrog | int *y, int *u, int *v) |
143 | 7e7c5e4c | balrog | { |
144 | 7e7c5e4c | balrog | *y = 0x10 + ((0x838 * r + 0x1022 * g + 0x322 * b) >> 13); |
145 | 7e7c5e4c | balrog | *u = 0x80 + ((0xe0e * b - 0x04c1 * r - 0x94e * g) >> 13); |
146 | 7e7c5e4c | balrog | *v = 0x80 + ((0xe0e * r - 0x0bc7 * g - 0x247 * b) >> 13); |
147 | 7e7c5e4c | balrog | } |
148 | 7e7c5e4c | balrog | |
149 | 7e7c5e4c | balrog | static void blizzard_window(struct blizzard_s *s) |
150 | 7e7c5e4c | balrog | { |
151 | 7e7c5e4c | balrog | uint8_t *src, *dst; |
152 | 7e7c5e4c | balrog | int bypp[2]; |
153 | 7e7c5e4c | balrog | int bypl[3]; |
154 | 7e7c5e4c | balrog | int y;
|
155 | 7e7c5e4c | balrog | blizzard_fn_t fn = s->data.line_fn; |
156 | 7e7c5e4c | balrog | |
157 | 7e7c5e4c | balrog | if (!fn)
|
158 | 7e7c5e4c | balrog | return;
|
159 | 7e7c5e4c | balrog | if (s->mx[0] > s->data.x) |
160 | 7e7c5e4c | balrog | s->mx[0] = s->data.x;
|
161 | 7e7c5e4c | balrog | if (s->my[0] > s->data.y) |
162 | 7e7c5e4c | balrog | s->my[0] = s->data.y;
|
163 | 7e7c5e4c | balrog | if (s->mx[1] < s->data.x + s->data.dx) |
164 | 7e7c5e4c | balrog | s->mx[1] = s->data.x + s->data.dx;
|
165 | 7e7c5e4c | balrog | if (s->my[1] < s->data.y + s->data.dy) |
166 | 7e7c5e4c | balrog | s->my[1] = s->data.y + s->data.dy;
|
167 | 7e7c5e4c | balrog | |
168 | 7e7c5e4c | balrog | bypp[0] = s->bpp;
|
169 | 7e7c5e4c | balrog | bypp[1] = (s->state->depth + 7) >> 3; |
170 | 7e7c5e4c | balrog | bypl[0] = bypp[0] * s->data.pitch; |
171 | 7e7c5e4c | balrog | bypl[1] = bypp[1] * s->x; |
172 | 7e7c5e4c | balrog | bypl[2] = bypp[0] * s->data.dx; |
173 | 7e7c5e4c | balrog | |
174 | 7e7c5e4c | balrog | src = s->data.data; |
175 | 7e7c5e4c | balrog | dst = s->fb + bypl[1] * s->data.y + bypp[1] * s->data.x; |
176 | 7e7c5e4c | balrog | for (y = s->data.dy; y > 0; y --, src += bypl[0], dst += bypl[1]) |
177 | 7e7c5e4c | balrog | fn(dst, src, bypl[2]);
|
178 | 7e7c5e4c | balrog | } |
179 | 7e7c5e4c | balrog | |
180 | 7e7c5e4c | balrog | static int blizzard_transfer_setup(struct blizzard_s *s) |
181 | 7e7c5e4c | balrog | { |
182 | 7e7c5e4c | balrog | if (s->source > 3 || !s->bpp || |
183 | 7e7c5e4c | balrog | s->ix[1] < s->ix[0] || s->iy[1] < s->iy[0]) |
184 | 7e7c5e4c | balrog | return 0; |
185 | 7e7c5e4c | balrog | |
186 | 7e7c5e4c | balrog | s->data.angle = s->effect & 3;
|
187 | 7e7c5e4c | balrog | s->data.line_fn = s->line_fn_tab[!!s->data.angle][s->iformat]; |
188 | 7e7c5e4c | balrog | s->data.x = s->ix[0];
|
189 | 7e7c5e4c | balrog | s->data.y = s->iy[0];
|
190 | 7e7c5e4c | balrog | s->data.dx = s->ix[1] - s->ix[0] + 1; |
191 | 7e7c5e4c | balrog | s->data.dy = s->iy[1] - s->iy[0] + 1; |
192 | 7e7c5e4c | balrog | s->data.len = s->bpp * s->data.dx * s->data.dy; |
193 | 7e7c5e4c | balrog | s->data.pitch = s->data.dx; |
194 | 7e7c5e4c | balrog | if (s->data.len > s->data.buflen) {
|
195 | 7e7c5e4c | balrog | s->data.buf = realloc(s->data.buf, s->data.len); |
196 | 7e7c5e4c | balrog | s->data.buflen = s->data.len; |
197 | 7e7c5e4c | balrog | } |
198 | 7e7c5e4c | balrog | s->data.ptr = s->data.buf; |
199 | 7e7c5e4c | balrog | s->data.data = s->data.buf; |
200 | 7e7c5e4c | balrog | s->data.len /= 2;
|
201 | 7e7c5e4c | balrog | return 1; |
202 | 7e7c5e4c | balrog | } |
203 | 7e7c5e4c | balrog | |
204 | 7e7c5e4c | balrog | static void blizzard_reset(struct blizzard_s *s) |
205 | 7e7c5e4c | balrog | { |
206 | 7e7c5e4c | balrog | s->reg = 0;
|
207 | 7e7c5e4c | balrog | s->swallow = 0;
|
208 | 7e7c5e4c | balrog | |
209 | 7e7c5e4c | balrog | s->pll = 9;
|
210 | 7e7c5e4c | balrog | s->pll_range = 1;
|
211 | 7e7c5e4c | balrog | s->pll_ctrl = 0x14;
|
212 | 7e7c5e4c | balrog | s->pll_mode = 0x32;
|
213 | 7e7c5e4c | balrog | s->clksel = 0x00;
|
214 | 7e7c5e4c | balrog | s->memenable = 0;
|
215 | 7e7c5e4c | balrog | s->memrefresh = 0x25c;
|
216 | 7e7c5e4c | balrog | s->timing[0] = 0x3f; |
217 | 7e7c5e4c | balrog | s->timing[1] = 0x13; |
218 | 7e7c5e4c | balrog | s->timing[2] = 0x21; |
219 | 7e7c5e4c | balrog | s->priority = 0;
|
220 | 7e7c5e4c | balrog | |
221 | 7e7c5e4c | balrog | s->lcd_config = 0x74;
|
222 | 7e7c5e4c | balrog | s->x = 8;
|
223 | 7e7c5e4c | balrog | s->y = 1;
|
224 | 7e7c5e4c | balrog | s->skipx = 0;
|
225 | 7e7c5e4c | balrog | s->skipy = 0;
|
226 | 7e7c5e4c | balrog | s->hndp = 3;
|
227 | 7e7c5e4c | balrog | s->vndp = 2;
|
228 | 7e7c5e4c | balrog | s->hsync = 1;
|
229 | 7e7c5e4c | balrog | s->vsync = 1;
|
230 | 7e7c5e4c | balrog | s->pclk = 0x80;
|
231 | 7e7c5e4c | balrog | |
232 | 7e7c5e4c | balrog | s->ix[0] = 0; |
233 | 7e7c5e4c | balrog | s->ix[1] = 0; |
234 | 7e7c5e4c | balrog | s->iy[0] = 0; |
235 | 7e7c5e4c | balrog | s->iy[1] = 0; |
236 | 7e7c5e4c | balrog | s->ox[0] = 0; |
237 | 7e7c5e4c | balrog | s->ox[1] = 0; |
238 | 7e7c5e4c | balrog | s->oy[0] = 0; |
239 | 7e7c5e4c | balrog | s->oy[1] = 0; |
240 | 7e7c5e4c | balrog | |
241 | 7e7c5e4c | balrog | s->yrc[0] = 0x00; |
242 | 7e7c5e4c | balrog | s->yrc[1] = 0x30; |
243 | 7e7c5e4c | balrog | s->u = 0;
|
244 | 7e7c5e4c | balrog | s->v = 0;
|
245 | 7e7c5e4c | balrog | |
246 | 7e7c5e4c | balrog | s->iformat = 3;
|
247 | 7e7c5e4c | balrog | s->source = 0;
|
248 | 7e7c5e4c | balrog | s->bpp = blizzard_iformat_bpp[s->iformat]; |
249 | 7e7c5e4c | balrog | |
250 | 7e7c5e4c | balrog | s->hssi_config[0] = 0x00; |
251 | 7e7c5e4c | balrog | s->hssi_config[1] = 0x00; |
252 | 7e7c5e4c | balrog | s->hssi_config[2] = 0x01; |
253 | 7e7c5e4c | balrog | s->tv_config = 0x00;
|
254 | 7e7c5e4c | balrog | s->tv_timing[0] = 0x00; |
255 | 7e7c5e4c | balrog | s->tv_timing[1] = 0x00; |
256 | 7e7c5e4c | balrog | s->tv_timing[2] = 0x00; |
257 | 7e7c5e4c | balrog | s->tv_timing[3] = 0x00; |
258 | 7e7c5e4c | balrog | s->vbi = 0x10;
|
259 | 7e7c5e4c | balrog | s->tv_x = 0x14;
|
260 | 7e7c5e4c | balrog | s->tv_y = 0x03;
|
261 | 7e7c5e4c | balrog | s->tv_test = 0x00;
|
262 | 7e7c5e4c | balrog | s->tv_filter_config = 0x80;
|
263 | 7e7c5e4c | balrog | s->tv_filter_idx = 0x00;
|
264 | 7e7c5e4c | balrog | s->border_r = 0x10;
|
265 | 7e7c5e4c | balrog | s->border_g = 0x80;
|
266 | 7e7c5e4c | balrog | s->border_b = 0x80;
|
267 | 7e7c5e4c | balrog | s->gamma_config = 0x00;
|
268 | 7e7c5e4c | balrog | s->gamma_idx = 0x00;
|
269 | 7e7c5e4c | balrog | s->matrix_ena = 0x00;
|
270 | 7e7c5e4c | balrog | memset(&s->matrix_coeff, 0, sizeof(s->matrix_coeff)); |
271 | 7e7c5e4c | balrog | s->matrix_r = 0x00;
|
272 | 7e7c5e4c | balrog | s->matrix_g = 0x00;
|
273 | 7e7c5e4c | balrog | s->matrix_b = 0x00;
|
274 | 7e7c5e4c | balrog | s->pm = 0x02;
|
275 | 7e7c5e4c | balrog | s->status = 0x00;
|
276 | 7e7c5e4c | balrog | s->rgbgpio_dir = 0x00;
|
277 | 7e7c5e4c | balrog | s->gpio_dir = 0x00;
|
278 | 7e7c5e4c | balrog | s->gpio_edge[0] = 0x00; |
279 | 7e7c5e4c | balrog | s->gpio_edge[1] = 0x00; |
280 | 7e7c5e4c | balrog | s->gpio_irq = 0x00;
|
281 | 7e7c5e4c | balrog | s->gpio_pdown = 0xff;
|
282 | 7e7c5e4c | balrog | } |
283 | 7e7c5e4c | balrog | |
284 | 7e7c5e4c | balrog | static inline void blizzard_invalidate_display(void *opaque) { |
285 | 7e7c5e4c | balrog | struct blizzard_s *s = (struct blizzard_s *) opaque; |
286 | 7e7c5e4c | balrog | |
287 | 7e7c5e4c | balrog | s->invalidate = 1;
|
288 | 7e7c5e4c | balrog | } |
289 | 7e7c5e4c | balrog | |
290 | 7e7c5e4c | balrog | static uint16_t blizzard_reg_read(void *opaque, uint8_t reg) |
291 | 7e7c5e4c | balrog | { |
292 | 7e7c5e4c | balrog | struct blizzard_s *s = (struct blizzard_s *) opaque; |
293 | 7e7c5e4c | balrog | |
294 | 7e7c5e4c | balrog | switch (reg) {
|
295 | 7e7c5e4c | balrog | case 0x00: /* Revision Code */ |
296 | 7e7c5e4c | balrog | return 0xa5; |
297 | 7e7c5e4c | balrog | |
298 | 7e7c5e4c | balrog | case 0x02: /* Configuration Readback */ |
299 | 7e7c5e4c | balrog | return 0x83; /* Macrovision OK, CNF[2:0] = 3 */ |
300 | 7e7c5e4c | balrog | |
301 | 7e7c5e4c | balrog | case 0x04: /* PLL M-Divider */ |
302 | 7e7c5e4c | balrog | return (s->pll - 1) | (1 << 7); |
303 | 7e7c5e4c | balrog | case 0x06: /* PLL Lock Range Control */ |
304 | 7e7c5e4c | balrog | return s->pll_range;
|
305 | 7e7c5e4c | balrog | case 0x08: /* PLL Lock Synthesis Control 0 */ |
306 | 7e7c5e4c | balrog | return s->pll_ctrl & 0xff; |
307 | 7e7c5e4c | balrog | case 0x0a: /* PLL Lock Synthesis Control 1 */ |
308 | 7e7c5e4c | balrog | return s->pll_ctrl >> 8; |
309 | 7e7c5e4c | balrog | case 0x0c: /* PLL Mode Control 0 */ |
310 | 7e7c5e4c | balrog | return s->pll_mode;
|
311 | 7e7c5e4c | balrog | |
312 | 7e7c5e4c | balrog | case 0x0e: /* Clock-Source Select */ |
313 | 7e7c5e4c | balrog | return s->clksel;
|
314 | 7e7c5e4c | balrog | |
315 | 7e7c5e4c | balrog | case 0x10: /* Memory Controller Activate */ |
316 | 7e7c5e4c | balrog | case 0x14: /* Memory Controller Bank 0 Status Flag */ |
317 | 7e7c5e4c | balrog | return s->memenable;
|
318 | 7e7c5e4c | balrog | |
319 | 7e7c5e4c | balrog | case 0x18: /* Auto-Refresh Interval Setting 0 */ |
320 | 7e7c5e4c | balrog | return s->memrefresh & 0xff; |
321 | 7e7c5e4c | balrog | case 0x1a: /* Auto-Refresh Interval Setting 1 */ |
322 | 7e7c5e4c | balrog | return s->memrefresh >> 8; |
323 | 7e7c5e4c | balrog | |
324 | 7e7c5e4c | balrog | case 0x1c: /* Power-On Sequence Timing Control */ |
325 | 7e7c5e4c | balrog | return s->timing[0]; |
326 | 7e7c5e4c | balrog | case 0x1e: /* Timing Control 0 */ |
327 | 7e7c5e4c | balrog | return s->timing[1]; |
328 | 7e7c5e4c | balrog | case 0x20: /* Timing Control 1 */ |
329 | 7e7c5e4c | balrog | return s->timing[2]; |
330 | 7e7c5e4c | balrog | |
331 | 7e7c5e4c | balrog | case 0x24: /* Arbitration Priority Control */ |
332 | 7e7c5e4c | balrog | return s->priority;
|
333 | 7e7c5e4c | balrog | |
334 | 7e7c5e4c | balrog | case 0x28: /* LCD Panel Configuration */ |
335 | 7e7c5e4c | balrog | return s->lcd_config;
|
336 | 7e7c5e4c | balrog | |
337 | 7e7c5e4c | balrog | case 0x2a: /* LCD Horizontal Display Width */ |
338 | 7e7c5e4c | balrog | return s->x >> 3; |
339 | 7e7c5e4c | balrog | case 0x2c: /* LCD Horizontal Non-display Period */ |
340 | 7e7c5e4c | balrog | return s->hndp;
|
341 | 7e7c5e4c | balrog | case 0x2e: /* LCD Vertical Display Height 0 */ |
342 | 7e7c5e4c | balrog | return s->y & 0xff; |
343 | 7e7c5e4c | balrog | case 0x30: /* LCD Vertical Display Height 1 */ |
344 | 7e7c5e4c | balrog | return s->y >> 8; |
345 | 7e7c5e4c | balrog | case 0x32: /* LCD Vertical Non-display Period */ |
346 | 7e7c5e4c | balrog | return s->vndp;
|
347 | 7e7c5e4c | balrog | case 0x34: /* LCD HS Pulse-width */ |
348 | 7e7c5e4c | balrog | return s->hsync;
|
349 | 7e7c5e4c | balrog | case 0x36: /* LCd HS Pulse Start Position */ |
350 | 7e7c5e4c | balrog | return s->skipx >> 3; |
351 | 7e7c5e4c | balrog | case 0x38: /* LCD VS Pulse-width */ |
352 | 7e7c5e4c | balrog | return s->vsync;
|
353 | 7e7c5e4c | balrog | case 0x3a: /* LCD VS Pulse Start Position */ |
354 | 7e7c5e4c | balrog | return s->skipy;
|
355 | 7e7c5e4c | balrog | |
356 | 7e7c5e4c | balrog | case 0x3c: /* PCLK Polarity */ |
357 | 7e7c5e4c | balrog | return s->pclk;
|
358 | 7e7c5e4c | balrog | |
359 | 7e7c5e4c | balrog | case 0x3e: /* High-speed Serial Interface Tx Configuration Port 0 */ |
360 | 7e7c5e4c | balrog | return s->hssi_config[0]; |
361 | 7e7c5e4c | balrog | case 0x40: /* High-speed Serial Interface Tx Configuration Port 1 */ |
362 | 7e7c5e4c | balrog | return s->hssi_config[1]; |
363 | 7e7c5e4c | balrog | case 0x42: /* High-speed Serial Interface Tx Mode */ |
364 | 7e7c5e4c | balrog | return s->hssi_config[2]; |
365 | 7e7c5e4c | balrog | case 0x44: /* TV Display Configuration */ |
366 | 7e7c5e4c | balrog | return s->tv_config;
|
367 | 7e7c5e4c | balrog | case 0x46 ... 0x4c: /* TV Vertical Blanking Interval Data bits */ |
368 | 7e7c5e4c | balrog | return s->tv_timing[(reg - 0x46) >> 1]; |
369 | 7e7c5e4c | balrog | case 0x4e: /* VBI: Closed Caption / XDS Control / Status */ |
370 | 7e7c5e4c | balrog | return s->vbi;
|
371 | 7e7c5e4c | balrog | case 0x50: /* TV Horizontal Start Position */ |
372 | 7e7c5e4c | balrog | return s->tv_x;
|
373 | 7e7c5e4c | balrog | case 0x52: /* TV Vertical Start Position */ |
374 | 7e7c5e4c | balrog | return s->tv_y;
|
375 | 7e7c5e4c | balrog | case 0x54: /* TV Test Pattern Setting */ |
376 | 7e7c5e4c | balrog | return s->tv_test;
|
377 | 7e7c5e4c | balrog | case 0x56: /* TV Filter Setting */ |
378 | 7e7c5e4c | balrog | return s->tv_filter_config;
|
379 | 7e7c5e4c | balrog | case 0x58: /* TV Filter Coefficient Index */ |
380 | 7e7c5e4c | balrog | return s->tv_filter_idx;
|
381 | 7e7c5e4c | balrog | case 0x5a: /* TV Filter Coefficient Data */ |
382 | 7e7c5e4c | balrog | if (s->tv_filter_idx < 0x20) |
383 | 7e7c5e4c | balrog | return s->tv_filter_coeff[s->tv_filter_idx ++];
|
384 | 7e7c5e4c | balrog | return 0; |
385 | 7e7c5e4c | balrog | |
386 | 7e7c5e4c | balrog | case 0x60: /* Input YUV/RGB Translate Mode 0 */ |
387 | 7e7c5e4c | balrog | return s->yrc[0]; |
388 | 7e7c5e4c | balrog | case 0x62: /* Input YUV/RGB Translate Mode 1 */ |
389 | 7e7c5e4c | balrog | return s->yrc[1]; |
390 | 7e7c5e4c | balrog | case 0x64: /* U Data Fix */ |
391 | 7e7c5e4c | balrog | return s->u;
|
392 | 7e7c5e4c | balrog | case 0x66: /* V Data Fix */ |
393 | 7e7c5e4c | balrog | return s->v;
|
394 | 7e7c5e4c | balrog | |
395 | 7e7c5e4c | balrog | case 0x68: /* Display Mode */ |
396 | 7e7c5e4c | balrog | return s->mode;
|
397 | 7e7c5e4c | balrog | |
398 | 7e7c5e4c | balrog | case 0x6a: /* Special Effects */ |
399 | 7e7c5e4c | balrog | return s->effect;
|
400 | 7e7c5e4c | balrog | |
401 | 7e7c5e4c | balrog | case 0x6c: /* Input Window X Start Position 0 */ |
402 | 7e7c5e4c | balrog | return s->ix[0] & 0xff; |
403 | 7e7c5e4c | balrog | case 0x6e: /* Input Window X Start Position 1 */ |
404 | 7e7c5e4c | balrog | return s->ix[0] >> 3; |
405 | 7e7c5e4c | balrog | case 0x70: /* Input Window Y Start Position 0 */ |
406 | 7e7c5e4c | balrog | return s->ix[0] & 0xff; |
407 | 7e7c5e4c | balrog | case 0x72: /* Input Window Y Start Position 1 */ |
408 | 7e7c5e4c | balrog | return s->ix[0] >> 3; |
409 | 7e7c5e4c | balrog | case 0x74: /* Input Window X End Position 0 */ |
410 | 7e7c5e4c | balrog | return s->ix[1] & 0xff; |
411 | 7e7c5e4c | balrog | case 0x76: /* Input Window X End Position 1 */ |
412 | 7e7c5e4c | balrog | return s->ix[1] >> 3; |
413 | 7e7c5e4c | balrog | case 0x78: /* Input Window Y End Position 0 */ |
414 | 7e7c5e4c | balrog | return s->ix[1] & 0xff; |
415 | 7e7c5e4c | balrog | case 0x7a: /* Input Window Y End Position 1 */ |
416 | 7e7c5e4c | balrog | return s->ix[1] >> 3; |
417 | 7e7c5e4c | balrog | case 0x7c: /* Output Window X Start Position 0 */ |
418 | 7e7c5e4c | balrog | return s->ox[0] & 0xff; |
419 | 7e7c5e4c | balrog | case 0x7e: /* Output Window X Start Position 1 */ |
420 | 7e7c5e4c | balrog | return s->ox[0] >> 3; |
421 | 7e7c5e4c | balrog | case 0x80: /* Output Window Y Start Position 0 */ |
422 | 7e7c5e4c | balrog | return s->oy[0] & 0xff; |
423 | 7e7c5e4c | balrog | case 0x82: /* Output Window Y Start Position 1 */ |
424 | 7e7c5e4c | balrog | return s->oy[0] >> 3; |
425 | 7e7c5e4c | balrog | case 0x84: /* Output Window X End Position 0 */ |
426 | 7e7c5e4c | balrog | return s->ox[1] & 0xff; |
427 | 7e7c5e4c | balrog | case 0x86: /* Output Window X End Position 1 */ |
428 | 7e7c5e4c | balrog | return s->ox[1] >> 3; |
429 | 7e7c5e4c | balrog | case 0x88: /* Output Window Y End Position 0 */ |
430 | 7e7c5e4c | balrog | return s->oy[1] & 0xff; |
431 | 7e7c5e4c | balrog | case 0x8a: /* Output Window Y End Position 1 */ |
432 | 7e7c5e4c | balrog | return s->oy[1] >> 3; |
433 | 7e7c5e4c | balrog | |
434 | 7e7c5e4c | balrog | case 0x8c: /* Input Data Format */ |
435 | 7e7c5e4c | balrog | return s->iformat;
|
436 | 7e7c5e4c | balrog | case 0x8e: /* Data Source Select */ |
437 | 7e7c5e4c | balrog | return s->source;
|
438 | 7e7c5e4c | balrog | case 0x90: /* Display Memory Data Port */ |
439 | 7e7c5e4c | balrog | return 0; |
440 | 7e7c5e4c | balrog | |
441 | 7e7c5e4c | balrog | case 0xa8: /* Border Color 0 */ |
442 | 7e7c5e4c | balrog | return s->border_r;
|
443 | 7e7c5e4c | balrog | case 0xaa: /* Border Color 1 */ |
444 | 7e7c5e4c | balrog | return s->border_g;
|
445 | 7e7c5e4c | balrog | case 0xac: /* Border Color 2 */ |
446 | 7e7c5e4c | balrog | return s->border_b;
|
447 | 7e7c5e4c | balrog | |
448 | 7e7c5e4c | balrog | case 0xb4: /* Gamma Correction Enable */ |
449 | 7e7c5e4c | balrog | return s->gamma_config;
|
450 | 7e7c5e4c | balrog | case 0xb6: /* Gamma Correction Table Index */ |
451 | 7e7c5e4c | balrog | return s->gamma_idx;
|
452 | 7e7c5e4c | balrog | case 0xb8: /* Gamma Correction Table Data */ |
453 | 7e7c5e4c | balrog | return s->gamma_lut[s->gamma_idx ++];
|
454 | 7e7c5e4c | balrog | |
455 | 7e7c5e4c | balrog | case 0xba: /* 3x3 Matrix Enable */ |
456 | 7e7c5e4c | balrog | return s->matrix_ena;
|
457 | 7e7c5e4c | balrog | case 0xbc ... 0xde: /* Coefficient Registers */ |
458 | 7e7c5e4c | balrog | return s->matrix_coeff[(reg - 0xbc) >> 1]; |
459 | 7e7c5e4c | balrog | case 0xe0: /* 3x3 Matrix Red Offset */ |
460 | 7e7c5e4c | balrog | return s->matrix_r;
|
461 | 7e7c5e4c | balrog | case 0xe2: /* 3x3 Matrix Green Offset */ |
462 | 7e7c5e4c | balrog | return s->matrix_g;
|
463 | 7e7c5e4c | balrog | case 0xe4: /* 3x3 Matrix Blue Offset */ |
464 | 7e7c5e4c | balrog | return s->matrix_b;
|
465 | 7e7c5e4c | balrog | |
466 | 7e7c5e4c | balrog | case 0xe6: /* Power-save */ |
467 | 7e7c5e4c | balrog | return s->pm;
|
468 | 7e7c5e4c | balrog | case 0xe8: /* Non-display Period Control / Status */ |
469 | 7e7c5e4c | balrog | return s->status | (1 << 5); |
470 | 7e7c5e4c | balrog | case 0xea: /* RGB Interface Control */ |
471 | 7e7c5e4c | balrog | return s->rgbgpio_dir;
|
472 | 7e7c5e4c | balrog | case 0xec: /* RGB Interface Status */ |
473 | 7e7c5e4c | balrog | return s->rgbgpio;
|
474 | 7e7c5e4c | balrog | case 0xee: /* General-purpose IO Pins Configuration */ |
475 | 7e7c5e4c | balrog | return s->gpio_dir;
|
476 | 7e7c5e4c | balrog | case 0xf0: /* General-purpose IO Pins Status / Control */ |
477 | 7e7c5e4c | balrog | return s->gpio;
|
478 | 7e7c5e4c | balrog | case 0xf2: /* GPIO Positive Edge Interrupt Trigger */ |
479 | 7e7c5e4c | balrog | return s->gpio_edge[0]; |
480 | 7e7c5e4c | balrog | case 0xf4: /* GPIO Negative Edge Interrupt Trigger */ |
481 | 7e7c5e4c | balrog | return s->gpio_edge[1]; |
482 | 7e7c5e4c | balrog | case 0xf6: /* GPIO Interrupt Status */ |
483 | 7e7c5e4c | balrog | return s->gpio_irq;
|
484 | 7e7c5e4c | balrog | case 0xf8: /* GPIO Pull-down Control */ |
485 | 7e7c5e4c | balrog | return s->gpio_pdown;
|
486 | 7e7c5e4c | balrog | |
487 | 7e7c5e4c | balrog | default:
|
488 | 7e7c5e4c | balrog | fprintf(stderr, "%s: unknown register %02x\n", __FUNCTION__, reg);
|
489 | 7e7c5e4c | balrog | return 0; |
490 | 7e7c5e4c | balrog | } |
491 | 7e7c5e4c | balrog | } |
492 | 7e7c5e4c | balrog | |
493 | 7e7c5e4c | balrog | static void blizzard_reg_write(void *opaque, uint8_t reg, uint16_t value) |
494 | 7e7c5e4c | balrog | { |
495 | 7e7c5e4c | balrog | struct blizzard_s *s = (struct blizzard_s *) opaque; |
496 | 7e7c5e4c | balrog | |
497 | 7e7c5e4c | balrog | switch (reg) {
|
498 | 7e7c5e4c | balrog | case 0x04: /* PLL M-Divider */ |
499 | 7e7c5e4c | balrog | s->pll = (value & 0x3f) + 1; |
500 | 7e7c5e4c | balrog | break;
|
501 | 7e7c5e4c | balrog | case 0x06: /* PLL Lock Range Control */ |
502 | 7e7c5e4c | balrog | s->pll_range = value & 3;
|
503 | 7e7c5e4c | balrog | break;
|
504 | 7e7c5e4c | balrog | case 0x08: /* PLL Lock Synthesis Control 0 */ |
505 | 7e7c5e4c | balrog | s->pll_ctrl &= 0xf00;
|
506 | 7e7c5e4c | balrog | s->pll_ctrl |= (value << 0) & 0x0ff; |
507 | 7e7c5e4c | balrog | break;
|
508 | 7e7c5e4c | balrog | case 0x0a: /* PLL Lock Synthesis Control 1 */ |
509 | 7e7c5e4c | balrog | s->pll_ctrl &= 0x0ff;
|
510 | 7e7c5e4c | balrog | s->pll_ctrl |= (value << 8) & 0xf00; |
511 | 7e7c5e4c | balrog | break;
|
512 | 7e7c5e4c | balrog | case 0x0c: /* PLL Mode Control 0 */ |
513 | 7e7c5e4c | balrog | s->pll_mode = value & 0x77;
|
514 | 7e7c5e4c | balrog | if ((value & 3) == 0 || (value & 3) == 3) |
515 | 7e7c5e4c | balrog | fprintf(stderr, "%s: wrong PLL Control bits (%i)\n",
|
516 | 7e7c5e4c | balrog | __FUNCTION__, value & 3);
|
517 | 7e7c5e4c | balrog | break;
|
518 | 7e7c5e4c | balrog | |
519 | 7e7c5e4c | balrog | case 0x0e: /* Clock-Source Select */ |
520 | 7e7c5e4c | balrog | s->clksel = value & 0xff;
|
521 | 7e7c5e4c | balrog | break;
|
522 | 7e7c5e4c | balrog | |
523 | 7e7c5e4c | balrog | case 0x10: /* Memory Controller Activate */ |
524 | 7e7c5e4c | balrog | s->memenable = value & 1;
|
525 | 7e7c5e4c | balrog | break;
|
526 | 7e7c5e4c | balrog | case 0x14: /* Memory Controller Bank 0 Status Flag */ |
527 | 7e7c5e4c | balrog | break;
|
528 | 7e7c5e4c | balrog | |
529 | 7e7c5e4c | balrog | case 0x18: /* Auto-Refresh Interval Setting 0 */ |
530 | 7e7c5e4c | balrog | s->memrefresh &= 0xf00;
|
531 | 7e7c5e4c | balrog | s->memrefresh |= (value << 0) & 0x0ff; |
532 | 7e7c5e4c | balrog | break;
|
533 | 7e7c5e4c | balrog | case 0x1a: /* Auto-Refresh Interval Setting 1 */ |
534 | 7e7c5e4c | balrog | s->memrefresh &= 0x0ff;
|
535 | 7e7c5e4c | balrog | s->memrefresh |= (value << 8) & 0xf00; |
536 | 7e7c5e4c | balrog | break;
|
537 | 7e7c5e4c | balrog | |
538 | 7e7c5e4c | balrog | case 0x1c: /* Power-On Sequence Timing Control */ |
539 | 7e7c5e4c | balrog | s->timing[0] = value & 0x7f; |
540 | 7e7c5e4c | balrog | break;
|
541 | 7e7c5e4c | balrog | case 0x1e: /* Timing Control 0 */ |
542 | 7e7c5e4c | balrog | s->timing[1] = value & 0x17; |
543 | 7e7c5e4c | balrog | break;
|
544 | 7e7c5e4c | balrog | case 0x20: /* Timing Control 1 */ |
545 | 7e7c5e4c | balrog | s->timing[2] = value & 0x35; |
546 | 7e7c5e4c | balrog | break;
|
547 | 7e7c5e4c | balrog | |
548 | 7e7c5e4c | balrog | case 0x24: /* Arbitration Priority Control */ |
549 | 7e7c5e4c | balrog | s->priority = value & 1;
|
550 | 7e7c5e4c | balrog | break;
|
551 | 7e7c5e4c | balrog | |
552 | 7e7c5e4c | balrog | case 0x28: /* LCD Panel Configuration */ |
553 | 7e7c5e4c | balrog | s->lcd_config = value & 0xff;
|
554 | 7e7c5e4c | balrog | if (value & (1 << 7)) |
555 | 7e7c5e4c | balrog | fprintf(stderr, "%s: data swap not supported!\n", __FUNCTION__);
|
556 | 7e7c5e4c | balrog | break;
|
557 | 7e7c5e4c | balrog | |
558 | 7e7c5e4c | balrog | case 0x2a: /* LCD Horizontal Display Width */ |
559 | 7e7c5e4c | balrog | s->x = value << 3;
|
560 | 7e7c5e4c | balrog | break;
|
561 | 7e7c5e4c | balrog | case 0x2c: /* LCD Horizontal Non-display Period */ |
562 | 7e7c5e4c | balrog | s->hndp = value & 0xff;
|
563 | 7e7c5e4c | balrog | break;
|
564 | 7e7c5e4c | balrog | case 0x2e: /* LCD Vertical Display Height 0 */ |
565 | 7e7c5e4c | balrog | s->y &= 0x300;
|
566 | 7e7c5e4c | balrog | s->y |= (value << 0) & 0x0ff; |
567 | 7e7c5e4c | balrog | break;
|
568 | 7e7c5e4c | balrog | case 0x30: /* LCD Vertical Display Height 1 */ |
569 | 7e7c5e4c | balrog | s->y &= 0x0ff;
|
570 | 7e7c5e4c | balrog | s->y |= (value << 8) & 0x300; |
571 | 7e7c5e4c | balrog | break;
|
572 | 7e7c5e4c | balrog | case 0x32: /* LCD Vertical Non-display Period */ |
573 | 7e7c5e4c | balrog | s->vndp = value & 0xff;
|
574 | 7e7c5e4c | balrog | break;
|
575 | 7e7c5e4c | balrog | case 0x34: /* LCD HS Pulse-width */ |
576 | 7e7c5e4c | balrog | s->hsync = value & 0xff;
|
577 | 7e7c5e4c | balrog | break;
|
578 | 7e7c5e4c | balrog | case 0x36: /* LCD HS Pulse Start Position */ |
579 | 7e7c5e4c | balrog | s->skipx = value & 0xff;
|
580 | 7e7c5e4c | balrog | break;
|
581 | 7e7c5e4c | balrog | case 0x38: /* LCD VS Pulse-width */ |
582 | 7e7c5e4c | balrog | s->vsync = value & 0xbf;
|
583 | 7e7c5e4c | balrog | break;
|
584 | 7e7c5e4c | balrog | case 0x3a: /* LCD VS Pulse Start Position */ |
585 | 7e7c5e4c | balrog | s->skipy = value & 0xff;
|
586 | 7e7c5e4c | balrog | break;
|
587 | 7e7c5e4c | balrog | |
588 | 7e7c5e4c | balrog | case 0x3c: /* PCLK Polarity */ |
589 | 7e7c5e4c | balrog | s->pclk = value & 0x82;
|
590 | 7e7c5e4c | balrog | /* Affects calculation of s->hndp, s->hsync and s->skipx. */
|
591 | 7e7c5e4c | balrog | break;
|
592 | 7e7c5e4c | balrog | |
593 | 7e7c5e4c | balrog | case 0x3e: /* High-speed Serial Interface Tx Configuration Port 0 */ |
594 | 7e7c5e4c | balrog | s->hssi_config[0] = value;
|
595 | 7e7c5e4c | balrog | break;
|
596 | 7e7c5e4c | balrog | case 0x40: /* High-speed Serial Interface Tx Configuration Port 1 */ |
597 | 7e7c5e4c | balrog | s->hssi_config[1] = value;
|
598 | 7e7c5e4c | balrog | if (((value >> 4) & 3) == 3) |
599 | 7e7c5e4c | balrog | fprintf(stderr, "%s: Illegal active-data-links value\n",
|
600 | 7e7c5e4c | balrog | __FUNCTION__); |
601 | 7e7c5e4c | balrog | break;
|
602 | 7e7c5e4c | balrog | case 0x42: /* High-speed Serial Interface Tx Mode */ |
603 | 7e7c5e4c | balrog | s->hssi_config[2] = value & 0xbd; |
604 | 7e7c5e4c | balrog | break;
|
605 | 7e7c5e4c | balrog | |
606 | 7e7c5e4c | balrog | case 0x44: /* TV Display Configuration */ |
607 | 7e7c5e4c | balrog | s->tv_config = value & 0xfe;
|
608 | 7e7c5e4c | balrog | break;
|
609 | 7e7c5e4c | balrog | case 0x46 ... 0x4c: /* TV Vertical Blanking Interval Data bits 0 */ |
610 | 7e7c5e4c | balrog | s->tv_timing[(reg - 0x46) >> 1] = value; |
611 | 7e7c5e4c | balrog | break;
|
612 | 7e7c5e4c | balrog | case 0x4e: /* VBI: Closed Caption / XDS Control / Status */ |
613 | 7e7c5e4c | balrog | s->vbi = value; |
614 | 7e7c5e4c | balrog | break;
|
615 | 7e7c5e4c | balrog | case 0x50: /* TV Horizontal Start Position */ |
616 | 7e7c5e4c | balrog | s->tv_x = value; |
617 | 7e7c5e4c | balrog | break;
|
618 | 7e7c5e4c | balrog | case 0x52: /* TV Vertical Start Position */ |
619 | 7e7c5e4c | balrog | s->tv_y = value & 0x7f;
|
620 | 7e7c5e4c | balrog | break;
|
621 | 7e7c5e4c | balrog | case 0x54: /* TV Test Pattern Setting */ |
622 | 7e7c5e4c | balrog | s->tv_test = value; |
623 | 7e7c5e4c | balrog | break;
|
624 | 7e7c5e4c | balrog | case 0x56: /* TV Filter Setting */ |
625 | 7e7c5e4c | balrog | s->tv_filter_config = value & 0xbf;
|
626 | 7e7c5e4c | balrog | break;
|
627 | 7e7c5e4c | balrog | case 0x58: /* TV Filter Coefficient Index */ |
628 | 7e7c5e4c | balrog | s->tv_filter_idx = value & 0x1f;
|
629 | 7e7c5e4c | balrog | break;
|
630 | 7e7c5e4c | balrog | case 0x5a: /* TV Filter Coefficient Data */ |
631 | 7e7c5e4c | balrog | if (s->tv_filter_idx < 0x20) |
632 | 7e7c5e4c | balrog | s->tv_filter_coeff[s->tv_filter_idx ++] = value; |
633 | 7e7c5e4c | balrog | break;
|
634 | 7e7c5e4c | balrog | |
635 | 7e7c5e4c | balrog | case 0x60: /* Input YUV/RGB Translate Mode 0 */ |
636 | 7e7c5e4c | balrog | s->yrc[0] = value & 0xb0; |
637 | 7e7c5e4c | balrog | break;
|
638 | 7e7c5e4c | balrog | case 0x62: /* Input YUV/RGB Translate Mode 1 */ |
639 | 7e7c5e4c | balrog | s->yrc[1] = value & 0x30; |
640 | 7e7c5e4c | balrog | break;
|
641 | 7e7c5e4c | balrog | case 0x64: /* U Data Fix */ |
642 | 7e7c5e4c | balrog | s->u = value & 0xff;
|
643 | 7e7c5e4c | balrog | break;
|
644 | 7e7c5e4c | balrog | case 0x66: /* V Data Fix */ |
645 | 7e7c5e4c | balrog | s->v = value & 0xff;
|
646 | 7e7c5e4c | balrog | break;
|
647 | 7e7c5e4c | balrog | |
648 | 7e7c5e4c | balrog | case 0x68: /* Display Mode */ |
649 | 7e7c5e4c | balrog | if ((s->mode ^ value) & 3) |
650 | 7e7c5e4c | balrog | s->invalidate = 1;
|
651 | 7e7c5e4c | balrog | s->mode = value & 0xb7;
|
652 | 7e7c5e4c | balrog | s->enable = value & 1;
|
653 | 7e7c5e4c | balrog | s->blank = (value >> 1) & 1; |
654 | 7e7c5e4c | balrog | if (value & (1 << 4)) |
655 | 7e7c5e4c | balrog | fprintf(stderr, "%s: Macrovision enable attempt!\n", __FUNCTION__);
|
656 | 7e7c5e4c | balrog | break;
|
657 | 7e7c5e4c | balrog | |
658 | 7e7c5e4c | balrog | case 0x6a: /* Special Effects */ |
659 | 7e7c5e4c | balrog | s->effect = value & 0xfb;
|
660 | 7e7c5e4c | balrog | break;
|
661 | 7e7c5e4c | balrog | |
662 | 7e7c5e4c | balrog | case 0x6c: /* Input Window X Start Position 0 */ |
663 | 7e7c5e4c | balrog | s->ix[0] &= 0x300; |
664 | 7e7c5e4c | balrog | s->ix[0] |= (value << 0) & 0x0ff; |
665 | 7e7c5e4c | balrog | break;
|
666 | 7e7c5e4c | balrog | case 0x6e: /* Input Window X Start Position 1 */ |
667 | 7e7c5e4c | balrog | s->ix[0] &= 0x0ff; |
668 | 7e7c5e4c | balrog | s->ix[0] |= (value << 8) & 0x300; |
669 | 7e7c5e4c | balrog | break;
|
670 | 7e7c5e4c | balrog | case 0x70: /* Input Window Y Start Position 0 */ |
671 | 7e7c5e4c | balrog | s->iy[0] &= 0x300; |
672 | 7e7c5e4c | balrog | s->iy[0] |= (value << 0) & 0x0ff; |
673 | 7e7c5e4c | balrog | break;
|
674 | 7e7c5e4c | balrog | case 0x72: /* Input Window Y Start Position 1 */ |
675 | 7e7c5e4c | balrog | s->iy[0] &= 0x0ff; |
676 | 7e7c5e4c | balrog | s->iy[0] |= (value << 8) & 0x300; |
677 | 7e7c5e4c | balrog | break;
|
678 | 7e7c5e4c | balrog | case 0x74: /* Input Window X End Position 0 */ |
679 | 7e7c5e4c | balrog | s->ix[1] &= 0x300; |
680 | 7e7c5e4c | balrog | s->ix[1] |= (value << 0) & 0x0ff; |
681 | 7e7c5e4c | balrog | break;
|
682 | 7e7c5e4c | balrog | case 0x76: /* Input Window X End Position 1 */ |
683 | 7e7c5e4c | balrog | s->ix[1] &= 0x0ff; |
684 | 7e7c5e4c | balrog | s->ix[1] |= (value << 8) & 0x300; |
685 | 7e7c5e4c | balrog | break;
|
686 | 7e7c5e4c | balrog | case 0x78: /* Input Window Y End Position 0 */ |
687 | 7e7c5e4c | balrog | s->iy[1] &= 0x300; |
688 | 7e7c5e4c | balrog | s->iy[1] |= (value << 0) & 0x0ff; |
689 | 7e7c5e4c | balrog | break;
|
690 | 7e7c5e4c | balrog | case 0x7a: /* Input Window Y End Position 1 */ |
691 | 7e7c5e4c | balrog | s->iy[1] &= 0x0ff; |
692 | 7e7c5e4c | balrog | s->iy[1] |= (value << 8) & 0x300; |
693 | 7e7c5e4c | balrog | break;
|
694 | 7e7c5e4c | balrog | case 0x7c: /* Output Window X Start Position 0 */ |
695 | 7e7c5e4c | balrog | s->ox[0] &= 0x300; |
696 | 7e7c5e4c | balrog | s->ox[0] |= (value << 0) & 0x0ff; |
697 | 7e7c5e4c | balrog | break;
|
698 | 7e7c5e4c | balrog | case 0x7e: /* Output Window X Start Position 1 */ |
699 | 7e7c5e4c | balrog | s->ox[0] &= 0x0ff; |
700 | 7e7c5e4c | balrog | s->ox[0] |= (value << 8) & 0x300; |
701 | 7e7c5e4c | balrog | break;
|
702 | 7e7c5e4c | balrog | case 0x80: /* Output Window Y Start Position 0 */ |
703 | 7e7c5e4c | balrog | s->oy[0] &= 0x300; |
704 | 7e7c5e4c | balrog | s->oy[0] |= (value << 0) & 0x0ff; |
705 | 7e7c5e4c | balrog | break;
|
706 | 7e7c5e4c | balrog | case 0x82: /* Output Window Y Start Position 1 */ |
707 | 7e7c5e4c | balrog | s->oy[0] &= 0x0ff; |
708 | 7e7c5e4c | balrog | s->oy[0] |= (value << 8) & 0x300; |
709 | 7e7c5e4c | balrog | break;
|
710 | 7e7c5e4c | balrog | case 0x84: /* Output Window X End Position 0 */ |
711 | 7e7c5e4c | balrog | s->ox[1] &= 0x300; |
712 | 7e7c5e4c | balrog | s->ox[1] |= (value << 0) & 0x0ff; |
713 | 7e7c5e4c | balrog | break;
|
714 | 7e7c5e4c | balrog | case 0x86: /* Output Window X End Position 1 */ |
715 | 7e7c5e4c | balrog | s->ox[1] &= 0x0ff; |
716 | 7e7c5e4c | balrog | s->ox[1] |= (value << 8) & 0x300; |
717 | 7e7c5e4c | balrog | break;
|
718 | 7e7c5e4c | balrog | case 0x88: /* Output Window Y End Position 0 */ |
719 | 7e7c5e4c | balrog | s->oy[1] &= 0x300; |
720 | 7e7c5e4c | balrog | s->oy[1] |= (value << 0) & 0x0ff; |
721 | 7e7c5e4c | balrog | break;
|
722 | 7e7c5e4c | balrog | case 0x8a: /* Output Window Y End Position 1 */ |
723 | 7e7c5e4c | balrog | s->oy[1] &= 0x0ff; |
724 | 7e7c5e4c | balrog | s->oy[1] |= (value << 8) & 0x300; |
725 | 7e7c5e4c | balrog | break;
|
726 | 7e7c5e4c | balrog | |
727 | 7e7c5e4c | balrog | case 0x8c: /* Input Data Format */ |
728 | 7e7c5e4c | balrog | s->iformat = value & 0xf;
|
729 | 7e7c5e4c | balrog | s->bpp = blizzard_iformat_bpp[s->iformat]; |
730 | 7e7c5e4c | balrog | if (!s->bpp)
|
731 | 7e7c5e4c | balrog | fprintf(stderr, "%s: Illegal or unsupported input format %x\n",
|
732 | 7e7c5e4c | balrog | __FUNCTION__, s->iformat); |
733 | 7e7c5e4c | balrog | break;
|
734 | 7e7c5e4c | balrog | case 0x8e: /* Data Source Select */ |
735 | 7e7c5e4c | balrog | s->source = value & 7;
|
736 | 7e7c5e4c | balrog | /* Currently all windows will be "destructive overlays". */
|
737 | 7e7c5e4c | balrog | if ((!(s->effect & (1 << 3)) && (s->ix[0] != s->ox[0] || |
738 | 7e7c5e4c | balrog | s->iy[0] != s->oy[0] || |
739 | 7e7c5e4c | balrog | s->ix[1] != s->ox[1] || |
740 | 7e7c5e4c | balrog | s->iy[1] != s->oy[1])) || |
741 | 7e7c5e4c | balrog | !((s->ix[1] - s->ix[0]) & (s->iy[1] - s->iy[0]) & |
742 | 7e7c5e4c | balrog | (s->ox[1] - s->ox[0]) & (s->oy[1] - s->oy[0]) & 1)) |
743 | 7e7c5e4c | balrog | fprintf(stderr, "%s: Illegal input/output window positions\n",
|
744 | 7e7c5e4c | balrog | __FUNCTION__); |
745 | 7e7c5e4c | balrog | |
746 | 7e7c5e4c | balrog | blizzard_transfer_setup(s); |
747 | 7e7c5e4c | balrog | break;
|
748 | 7e7c5e4c | balrog | |
749 | 7e7c5e4c | balrog | case 0x90: /* Display Memory Data Port */ |
750 | 7e7c5e4c | balrog | if (!s->data.len && !blizzard_transfer_setup(s))
|
751 | 7e7c5e4c | balrog | break;
|
752 | 7e7c5e4c | balrog | |
753 | 7e7c5e4c | balrog | *s->data.ptr ++ = value; |
754 | 7e7c5e4c | balrog | if (-- s->data.len == 0) |
755 | 7e7c5e4c | balrog | blizzard_window(s); |
756 | 7e7c5e4c | balrog | break;
|
757 | 7e7c5e4c | balrog | |
758 | 7e7c5e4c | balrog | case 0xa8: /* Border Color 0 */ |
759 | 7e7c5e4c | balrog | s->border_r = value; |
760 | 7e7c5e4c | balrog | break;
|
761 | 7e7c5e4c | balrog | case 0xaa: /* Border Color 1 */ |
762 | 7e7c5e4c | balrog | s->border_g = value; |
763 | 7e7c5e4c | balrog | break;
|
764 | 7e7c5e4c | balrog | case 0xac: /* Border Color 2 */ |
765 | 7e7c5e4c | balrog | s->border_b = value; |
766 | 7e7c5e4c | balrog | break;
|
767 | 7e7c5e4c | balrog | |
768 | 7e7c5e4c | balrog | case 0xb4: /* Gamma Correction Enable */ |
769 | 7e7c5e4c | balrog | s->gamma_config = value & 0x87;
|
770 | 7e7c5e4c | balrog | break;
|
771 | 7e7c5e4c | balrog | case 0xb6: /* Gamma Correction Table Index */ |
772 | 7e7c5e4c | balrog | s->gamma_idx = value; |
773 | 7e7c5e4c | balrog | break;
|
774 | 7e7c5e4c | balrog | case 0xb8: /* Gamma Correction Table Data */ |
775 | 7e7c5e4c | balrog | s->gamma_lut[s->gamma_idx ++] = value; |
776 | 7e7c5e4c | balrog | break;
|
777 | 7e7c5e4c | balrog | |
778 | 7e7c5e4c | balrog | case 0xba: /* 3x3 Matrix Enable */ |
779 | 7e7c5e4c | balrog | s->matrix_ena = value & 1;
|
780 | 7e7c5e4c | balrog | break;
|
781 | 7e7c5e4c | balrog | case 0xbc ... 0xde: /* Coefficient Registers */ |
782 | 7e7c5e4c | balrog | s->matrix_coeff[(reg - 0xbc) >> 1] = value & ((reg & 2) ? 0x80 : 0xff); |
783 | 7e7c5e4c | balrog | break;
|
784 | 7e7c5e4c | balrog | case 0xe0: /* 3x3 Matrix Red Offset */ |
785 | 7e7c5e4c | balrog | s->matrix_r = value; |
786 | 7e7c5e4c | balrog | break;
|
787 | 7e7c5e4c | balrog | case 0xe2: /* 3x3 Matrix Green Offset */ |
788 | 7e7c5e4c | balrog | s->matrix_g = value; |
789 | 7e7c5e4c | balrog | break;
|
790 | 7e7c5e4c | balrog | case 0xe4: /* 3x3 Matrix Blue Offset */ |
791 | 7e7c5e4c | balrog | s->matrix_b = value; |
792 | 7e7c5e4c | balrog | break;
|
793 | 7e7c5e4c | balrog | |
794 | 7e7c5e4c | balrog | case 0xe6: /* Power-save */ |
795 | 7e7c5e4c | balrog | s->pm = value & 0x83;
|
796 | 7e7c5e4c | balrog | if (value & s->mode & 1) |
797 | 7e7c5e4c | balrog | fprintf(stderr, "%s: The display must be disabled before entering "
|
798 | 7e7c5e4c | balrog | "Standby Mode\n", __FUNCTION__);
|
799 | 7e7c5e4c | balrog | break;
|
800 | 7e7c5e4c | balrog | case 0xe8: /* Non-display Period Control / Status */ |
801 | 7e7c5e4c | balrog | s->status = value & 0x1b;
|
802 | 7e7c5e4c | balrog | break;
|
803 | 7e7c5e4c | balrog | case 0xea: /* RGB Interface Control */ |
804 | 7e7c5e4c | balrog | s->rgbgpio_dir = value & 0x8f;
|
805 | 7e7c5e4c | balrog | break;
|
806 | 7e7c5e4c | balrog | case 0xec: /* RGB Interface Status */ |
807 | 7e7c5e4c | balrog | s->rgbgpio = value & 0xcf;
|
808 | 7e7c5e4c | balrog | break;
|
809 | 7e7c5e4c | balrog | case 0xee: /* General-purpose IO Pins Configuration */ |
810 | 7e7c5e4c | balrog | s->gpio_dir = value; |
811 | 7e7c5e4c | balrog | break;
|
812 | 7e7c5e4c | balrog | case 0xf0: /* General-purpose IO Pins Status / Control */ |
813 | 7e7c5e4c | balrog | s->gpio = value; |
814 | 7e7c5e4c | balrog | break;
|
815 | 7e7c5e4c | balrog | case 0xf2: /* GPIO Positive Edge Interrupt Trigger */ |
816 | 7e7c5e4c | balrog | s->gpio_edge[0] = value;
|
817 | 7e7c5e4c | balrog | break;
|
818 | 7e7c5e4c | balrog | case 0xf4: /* GPIO Negative Edge Interrupt Trigger */ |
819 | 7e7c5e4c | balrog | s->gpio_edge[1] = value;
|
820 | 7e7c5e4c | balrog | break;
|
821 | 7e7c5e4c | balrog | case 0xf6: /* GPIO Interrupt Status */ |
822 | 7e7c5e4c | balrog | s->gpio_irq &= value; |
823 | 7e7c5e4c | balrog | break;
|
824 | 7e7c5e4c | balrog | case 0xf8: /* GPIO Pull-down Control */ |
825 | 7e7c5e4c | balrog | s->gpio_pdown = value; |
826 | 7e7c5e4c | balrog | break;
|
827 | 7e7c5e4c | balrog | |
828 | 7e7c5e4c | balrog | default:
|
829 | 7e7c5e4c | balrog | fprintf(stderr, "%s: unknown register %02x\n", __FUNCTION__, reg);
|
830 | 7e7c5e4c | balrog | break;
|
831 | 7e7c5e4c | balrog | } |
832 | 7e7c5e4c | balrog | } |
833 | 7e7c5e4c | balrog | |
834 | 7e7c5e4c | balrog | uint16_t s1d13745_read(void *opaque, int dc) |
835 | 7e7c5e4c | balrog | { |
836 | 7e7c5e4c | balrog | struct blizzard_s *s = (struct blizzard_s *) opaque; |
837 | 7e7c5e4c | balrog | uint16_t value = blizzard_reg_read(s, s->reg); |
838 | 7e7c5e4c | balrog | |
839 | 7e7c5e4c | balrog | if (s->swallow -- > 0) |
840 | 7e7c5e4c | balrog | return 0; |
841 | 7e7c5e4c | balrog | if (dc)
|
842 | 7e7c5e4c | balrog | s->reg ++; |
843 | 7e7c5e4c | balrog | |
844 | 7e7c5e4c | balrog | return value;
|
845 | 7e7c5e4c | balrog | } |
846 | 7e7c5e4c | balrog | |
847 | 7e7c5e4c | balrog | void s1d13745_write(void *opaque, int dc, uint16_t value) |
848 | 7e7c5e4c | balrog | { |
849 | 7e7c5e4c | balrog | struct blizzard_s *s = (struct blizzard_s *) opaque; |
850 | 7e7c5e4c | balrog | |
851 | 7e7c5e4c | balrog | if (s->swallow -- > 0) |
852 | 7e7c5e4c | balrog | return;
|
853 | 7e7c5e4c | balrog | if (dc) {
|
854 | 7e7c5e4c | balrog | blizzard_reg_write(s, s->reg, value); |
855 | 7e7c5e4c | balrog | |
856 | 7e7c5e4c | balrog | if (s->reg != 0x90 && s->reg != 0x5a && s->reg != 0xb8) |
857 | 7e7c5e4c | balrog | s->reg += 2;
|
858 | 7e7c5e4c | balrog | } else
|
859 | 7e7c5e4c | balrog | s->reg = value & 0xff;
|
860 | 7e7c5e4c | balrog | } |
861 | 7e7c5e4c | balrog | |
862 | 7e7c5e4c | balrog | void s1d13745_write_block(void *opaque, int dc, |
863 | 7e7c5e4c | balrog | void *buf, size_t len, int pitch) |
864 | 7e7c5e4c | balrog | { |
865 | 7e7c5e4c | balrog | struct blizzard_s *s = (struct blizzard_s *) opaque; |
866 | 7e7c5e4c | balrog | |
867 | 7e7c5e4c | balrog | while (len > 0) { |
868 | 7e7c5e4c | balrog | if (s->reg == 0x90 && dc && |
869 | 7e7c5e4c | balrog | (s->data.len || blizzard_transfer_setup(s)) && |
870 | 7e7c5e4c | balrog | len >= (s->data.len << 1)) {
|
871 | 7e7c5e4c | balrog | len -= s->data.len << 1;
|
872 | 7e7c5e4c | balrog | s->data.len = 0;
|
873 | 7e7c5e4c | balrog | s->data.data = buf; |
874 | 7e7c5e4c | balrog | if (pitch)
|
875 | 7e7c5e4c | balrog | s->data.pitch = pitch; |
876 | 7e7c5e4c | balrog | blizzard_window(s); |
877 | 7e7c5e4c | balrog | s->data.data = s->data.buf; |
878 | 7e7c5e4c | balrog | continue;
|
879 | 7e7c5e4c | balrog | } |
880 | 7e7c5e4c | balrog | |
881 | 7e7c5e4c | balrog | s1d13745_write(opaque, dc, *(uint16_t *) buf); |
882 | 7e7c5e4c | balrog | len -= 2;
|
883 | 7e7c5e4c | balrog | buf += 2;
|
884 | 7e7c5e4c | balrog | } |
885 | 7e7c5e4c | balrog | |
886 | 7e7c5e4c | balrog | return;
|
887 | 7e7c5e4c | balrog | } |
888 | 7e7c5e4c | balrog | |
889 | 7e7c5e4c | balrog | static void blizzard_update_display(void *opaque) |
890 | 7e7c5e4c | balrog | { |
891 | 7e7c5e4c | balrog | struct blizzard_s *s = (struct blizzard_s *) opaque; |
892 | 7e7c5e4c | balrog | int y, bypp, bypl, bwidth;
|
893 | 7e7c5e4c | balrog | uint8_t *src, *dst; |
894 | 7e7c5e4c | balrog | |
895 | 7e7c5e4c | balrog | if (!s->enable)
|
896 | 7e7c5e4c | balrog | return;
|
897 | 7e7c5e4c | balrog | |
898 | 7e7c5e4c | balrog | if (s->x != s->state->width || s->y != s->state->height) {
|
899 | 7e7c5e4c | balrog | s->invalidate = 1;
|
900 | c60e08d9 | pbrook | qemu_console_resize(s->console, s->x, s->y); |
901 | 7e7c5e4c | balrog | } |
902 | 7e7c5e4c | balrog | |
903 | 7e7c5e4c | balrog | if (s->invalidate) {
|
904 | 7e7c5e4c | balrog | s->invalidate = 0;
|
905 | 7e7c5e4c | balrog | |
906 | 7e7c5e4c | balrog | if (s->blank) {
|
907 | 7e7c5e4c | balrog | bypp = (s->state->depth + 7) >> 3; |
908 | 7e7c5e4c | balrog | memset(s->state->data, 0, bypp * s->x * s->y);
|
909 | 7e7c5e4c | balrog | return;
|
910 | 7e7c5e4c | balrog | } |
911 | 7e7c5e4c | balrog | |
912 | 7e7c5e4c | balrog | s->mx[0] = 0; |
913 | 7e7c5e4c | balrog | s->mx[1] = s->x;
|
914 | 7e7c5e4c | balrog | s->my[0] = 0; |
915 | 7e7c5e4c | balrog | s->my[1] = s->y;
|
916 | 7e7c5e4c | balrog | } |
917 | 7e7c5e4c | balrog | |
918 | 7e7c5e4c | balrog | if (s->mx[1] <= s->mx[0]) |
919 | 7e7c5e4c | balrog | return;
|
920 | 7e7c5e4c | balrog | |
921 | 7e7c5e4c | balrog | bypp = (s->state->depth + 7) >> 3; |
922 | 7e7c5e4c | balrog | bypl = bypp * s->x; |
923 | 7e7c5e4c | balrog | bwidth = bypp * (s->mx[1] - s->mx[0]); |
924 | 7e7c5e4c | balrog | y = s->my[0];
|
925 | 7e7c5e4c | balrog | src = s->fb + bypl * y + bypp * s->mx[0];
|
926 | 7e7c5e4c | balrog | dst = s->state->data + bypl * y + bypp * s->mx[0];
|
927 | 7e7c5e4c | balrog | for (; y < s->my[1]; y ++, src += bypl, dst += bypl) |
928 | 7e7c5e4c | balrog | memcpy(dst, src, bwidth); |
929 | 7e7c5e4c | balrog | |
930 | 7e7c5e4c | balrog | dpy_update(s->state, s->mx[0], s->my[0], |
931 | 7e7c5e4c | balrog | s->mx[1] - s->mx[0], y - s->my[0]); |
932 | 7e7c5e4c | balrog | |
933 | 7e7c5e4c | balrog | s->mx[0] = s->x;
|
934 | 7e7c5e4c | balrog | s->mx[1] = 0; |
935 | 7e7c5e4c | balrog | s->my[0] = s->y;
|
936 | 7e7c5e4c | balrog | s->my[1] = 0; |
937 | 7e7c5e4c | balrog | } |
938 | 7e7c5e4c | balrog | |
939 | 7e7c5e4c | balrog | static void blizzard_screen_dump(void *opaque, const char *filename) { |
940 | 7e7c5e4c | balrog | struct blizzard_s *s = (struct blizzard_s *) opaque; |
941 | 7e7c5e4c | balrog | |
942 | 7e7c5e4c | balrog | blizzard_update_display(opaque); |
943 | 7e7c5e4c | balrog | if (s && s->state->data)
|
944 | 7e7c5e4c | balrog | ppm_save(filename, s->state->data, s->x, s->y, s->state->linesize); |
945 | 7e7c5e4c | balrog | } |
946 | 7e7c5e4c | balrog | |
947 | 7e7c5e4c | balrog | #define DEPTH 8 |
948 | 7e7c5e4c | balrog | #include "blizzard_template.h" |
949 | 7e7c5e4c | balrog | #define DEPTH 15 |
950 | 7e7c5e4c | balrog | #include "blizzard_template.h" |
951 | 7e7c5e4c | balrog | #define DEPTH 16 |
952 | 7e7c5e4c | balrog | #include "blizzard_template.h" |
953 | 7e7c5e4c | balrog | #define DEPTH 24 |
954 | 7e7c5e4c | balrog | #include "blizzard_template.h" |
955 | 7e7c5e4c | balrog | #define DEPTH 32 |
956 | 7e7c5e4c | balrog | #include "blizzard_template.h" |
957 | 7e7c5e4c | balrog | |
958 | 7e7c5e4c | balrog | void *s1d13745_init(qemu_irq gpio_int, DisplayState *ds)
|
959 | 7e7c5e4c | balrog | { |
960 | 7e7c5e4c | balrog | struct blizzard_s *s = (struct blizzard_s *) qemu_mallocz(sizeof(*s)); |
961 | 7e7c5e4c | balrog | |
962 | 7e7c5e4c | balrog | s->state = ds; |
963 | 7e7c5e4c | balrog | s->fb = qemu_malloc(0x180000);
|
964 | 7e7c5e4c | balrog | |
965 | 7e7c5e4c | balrog | switch (s->state->depth) {
|
966 | 7e7c5e4c | balrog | case 0: |
967 | 7e7c5e4c | balrog | s->line_fn_tab[0] = s->line_fn_tab[1] = |
968 | 7e7c5e4c | balrog | qemu_mallocz(sizeof(blizzard_fn_t) * 0x10); |
969 | 7e7c5e4c | balrog | break;
|
970 | 7e7c5e4c | balrog | case 8: |
971 | 7e7c5e4c | balrog | s->line_fn_tab[0] = blizzard_draw_fn_8;
|
972 | 7e7c5e4c | balrog | s->line_fn_tab[1] = blizzard_draw_fn_r_8;
|
973 | 7e7c5e4c | balrog | break;
|
974 | 7e7c5e4c | balrog | case 15: |
975 | 7e7c5e4c | balrog | s->line_fn_tab[0] = blizzard_draw_fn_15;
|
976 | 7e7c5e4c | balrog | s->line_fn_tab[1] = blizzard_draw_fn_r_15;
|
977 | 7e7c5e4c | balrog | break;
|
978 | 7e7c5e4c | balrog | case 16: |
979 | 7e7c5e4c | balrog | s->line_fn_tab[0] = blizzard_draw_fn_16;
|
980 | 7e7c5e4c | balrog | s->line_fn_tab[1] = blizzard_draw_fn_r_16;
|
981 | 7e7c5e4c | balrog | break;
|
982 | 7e7c5e4c | balrog | case 24: |
983 | 7e7c5e4c | balrog | s->line_fn_tab[0] = blizzard_draw_fn_24;
|
984 | 7e7c5e4c | balrog | s->line_fn_tab[1] = blizzard_draw_fn_r_24;
|
985 | 7e7c5e4c | balrog | break;
|
986 | 7e7c5e4c | balrog | case 32: |
987 | 7e7c5e4c | balrog | s->line_fn_tab[0] = blizzard_draw_fn_32;
|
988 | 7e7c5e4c | balrog | s->line_fn_tab[1] = blizzard_draw_fn_r_32;
|
989 | 7e7c5e4c | balrog | break;
|
990 | 7e7c5e4c | balrog | default:
|
991 | 7e7c5e4c | balrog | fprintf(stderr, "%s: Bad color depth\n", __FUNCTION__);
|
992 | 7e7c5e4c | balrog | exit(1);
|
993 | 7e7c5e4c | balrog | } |
994 | 7e7c5e4c | balrog | |
995 | 7e7c5e4c | balrog | blizzard_reset(s); |
996 | 7e7c5e4c | balrog | |
997 | c60e08d9 | pbrook | s->console = graphic_console_init(s->state, blizzard_update_display, |
998 | c60e08d9 | pbrook | blizzard_invalidate_display, |
999 | c60e08d9 | pbrook | blizzard_screen_dump, NULL, s);
|
1000 | 7e7c5e4c | balrog | |
1001 | 7e7c5e4c | balrog | return s;
|
1002 | 7e7c5e4c | balrog | } |