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