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