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