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