hd64461video.c revision 1.1 1 /* $NetBSD: hd64461video.c,v 1.1 2001/06/04 17:08:36 uch Exp $ */
2
3 /*-
4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by UCHIYAMA Yasushi.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38 // #define HD64461VIDEO_DEBUG
39 // #define HD64461VIDEO_HWACCEL
40
41 #include <sys/param.h>
42 #include <sys/systm.h>
43 #include <sys/device.h>
44 #include <sys/malloc.h>
45
46 #include <sys/conf.h> /* cdev_decl */
47 #include <dev/cons.h> /* consdev */
48
49 /* ioctl */
50 #include <sys/ioctl.h>
51 #include <sys/buf.h>
52 #include <uvm/uvm_extern.h>
53
54 #include <machine/bus.h>
55 #include <machine/intr.h>
56
57 #include <hpcsh/dev/hd64461/hd64461var.h>
58 #include <hpcsh/dev/hd64461/hd64461reg.h>
59 #include <hpcsh/dev/hd64461/hd64461videoreg.h>
60
61 #include <dev/wscons/wsdisplayvar.h>
62 #include <dev/rasops/rasops.h>
63
64 #include <dev/wscons/wsconsio.h>
65 #include <dev/hpc/hpcfbvar.h>
66 #include <dev/hpc/hpcfbio.h>
67 #include <dev/hpc/video_subr.h>
68
69 #include <machine/bootinfo.h>
70
71 #ifdef HD64461VIDEO_DEBUG
72 #include <hpcsh/hpcsh/debug.h>
73 #endif
74
75 #ifdef HD64461VIDEO_DEBUG
76 int hd64461video_debug = 1;
77 #define DPRINTF(fmt, args...) \
78 if (hd64461video_debug) \
79 printf("%s: " fmt, __FUNCTION__ , ##args)
80 #define DPRINTFN(n, arg) \
81 if (hd64461video_debug > (n)) \
82 printf("%s: " fmt, __FUNCTION__ , ##args)
83 #else
84 #define DPRINTF(arg...) ((void)0)
85 #define DPRINTFN(n, arg...) ((void)0)
86 #endif
87
88 struct hd64461video_chip;
89 struct hd64461video_font {
90 struct wsdisplay_font wsfont;
91 int c, cw, cstep;
92 int loaded;
93 };
94
95 struct hd64461video_softc {
96 struct device sc_dev;
97 enum hd64461_module_id sc_module_id;
98 struct hd64461video_chip *sc_vc;
99
100 struct hd64461video_font sc_font;
101 };
102
103 static struct hd64461video_chip {
104 struct video_chip vc;
105 enum hd64461video_display_mode {
106 LCD256_C,
107 LCD64K_C,
108 LCD64_MONO,
109 LCD16_MONO,
110 LCD4_MONO,
111 LCD2_MONO,
112 CRT256_C,
113 LCDCRT
114 };
115 enum hd64461video_display_mode mode;
116 struct hpcfb_dspconf hd;
117 struct hpcfb_fbconf hf;
118 u_int8_t *off_screen_addr;
119 size_t off_screen_size;
120
121 int console;
122 } hd64461video_chip;
123
124 static int hd64461video_match(struct device *, struct cfdata *, void *);
125 static void hd64461video_attach(struct device *, struct device *, void *);
126 void hd64461video_cnprobe(struct consdev *);
127 void hd64461video_cninit(struct consdev *);
128
129 static void setup_hpcfbif(struct hd64461video_chip *);
130 static void update_videochip_status(struct hd64461video_chip *);
131 static size_t frame_buffer_size(struct hd64461video_chip *);
132 static void hwaccel_init(struct hd64461video_chip *);
133
134 static void set_clut(struct hd64461video_chip *, int, int, u_int8_t *,
135 u_int8_t *, u_int8_t *);
136 static void get_clut(struct hd64461video_chip *, int, int, u_int8_t *,
137 u_int8_t *, u_int8_t *);
138 static void set_display_mode(struct hd64461video_chip *) __attribute__((__unused__));
139 static void set_display_mode_lcdc(struct hd64461video_chip *);
140 static void set_display_mode_crtc(struct hd64461video_chip *);
141
142 #ifdef HD64461VIDEO_DEBUG
143 static void _info(struct hd64461video_softc *) __attribute__((__unused__));
144 static void _dump(void) __attribute__((__unused__));
145 #endif
146
147 struct cfattach hd64461video_ca = {
148 sizeof(struct hd64461video_softc), hd64461video_match,
149 hd64461video_attach
150 };
151
152 int hd64461video_ioctl(void *, u_long, caddr_t, int, struct proc *);
153 paddr_t hd64461video_mmap(void *, off_t, int);
154 void hd64461video_cursor(void *, int, int, int, int, int);
155 void hd64461video_bitblit(void *, int, int, int, int, int, int);
156 void hd64461video_erase(void *, int, int, int, int, int);
157 void hd64461video_putchar(void *, int, int, struct wsdisplay_font *, int, int,
158 u_int, int);
159 void hd64461video_setclut(void *, struct rasops_info *);
160 void hd64461video_font(void *, struct wsdisplay_font *);
161 void hd64461video_iodone(void *);
162
163 struct hpcfb_accessops hd64461video_ha = {
164 .ioctl = hd64461video_ioctl,
165 .mmap = hd64461video_mmap,
166 #ifdef HD64461VIDEO_HWACCEL
167 .cursor = hd64461video_cursor,
168 .bitblit= hd64461video_bitblit,
169 .erase = hd64461video_erase,
170 .putchar= hd64461video_putchar,
171 .setclut= hd64461video_setclut,
172 .font = hd64461video_font,
173 .iodone = hd64461video_iodone
174 #endif /* HD64461VIDEO_HWACCEL */
175 };
176
177 /* font */
178 static void font_load_16bpp(u_int16_t *, u_int8_t *, int, int, int);
179 static void font_load_8bpp(u_int8_t *, u_int8_t *, int, int, int);
180 static void font_set_attr(struct hd64461video_softc *, struct wsdisplay_font *);
181 static void font_load(struct hd64461video_softc *);
182 static vaddr_t font_start_addr(struct hd64461video_softc *, int);
183
184 static int
185 hd64461video_match(struct device *parent, struct cfdata *cf, void *aux)
186 {
187 struct hd64461_attach_args *ha = aux;
188
189 return (ha->ha_module_id == HD64461_MODULE_VIDEO);
190 }
191
192 static void
193 hd64461video_attach(struct device *parent, struct device *self, void *aux)
194 {
195 struct hd64461_attach_args *ha = aux;
196 struct hd64461video_softc *sc = (struct hd64461video_softc *)self;
197 struct hpcfb_attach_args hfa;
198 struct video_chip *vc = &hd64461video_chip.vc;
199 char pbuf[9];
200 size_t fbsize, on_screen_size;
201
202 sc->sc_module_id = ha->ha_module_id;
203 sc->sc_vc = &hd64461video_chip;
204 printf(": ");
205
206 /* detect frame buffer size */
207 fbsize = frame_buffer_size(&hd64461video_chip);
208 format_bytes(pbuf, sizeof(pbuf), fbsize);
209 printf("frame buffer = %s ", pbuf);
210
211 /* update chip status */
212 update_videochip_status(&hd64461video_chip);
213 // set_display_mode(&hd64461video_chip);
214
215 if (hd64461video_chip.console)
216 printf(", console");
217
218 printf("\n");
219 #ifdef HD64461VIDEO_DEBUG
220 _info(sc);
221 _dump();
222 #endif
223
224
225 /* setup hpcfb interface */
226 setup_hpcfbif(&hd64461video_chip);
227
228 /* setup off-screen buffer */
229 on_screen_size = (vc->vc_fbwidth * vc->vc_fbheight * vc->vc_fbdepth) /
230 NBBY;
231 hd64461video_chip.off_screen_addr = (u_int8_t *)vc->vc_fbvaddr +
232 on_screen_size;
233 hd64461video_chip.off_screen_size = fbsize - on_screen_size;
234 /* clean up off-screen area */
235 {
236 u_int8_t *p = hd64461video_chip.off_screen_addr;
237 u_int8_t *end = p + hd64461video_chip.off_screen_size;
238 while (p < end)
239 *p++ = 0xff;
240 }
241
242 /* initialize hardware acceralation */
243 hwaccel_init(&hd64461video_chip);
244
245 /* register interface to hpcfb */
246 hfa.ha_console = hd64461video_chip.console;
247 hfa.ha_accessops = &hd64461video_ha;
248 hfa.ha_accessctx = sc;
249 hfa.ha_curfbconf = 0;
250 hfa.ha_nfbconf = 1;
251 hfa.ha_fbconflist = &hd64461video_chip.hf;
252 hfa.ha_curdspconf = 0;
253 hfa.ha_ndspconf = 1;
254 hfa.ha_dspconflist = &hd64461video_chip.hd;
255
256 config_found(self, &hfa, hpcfbprint);
257 }
258
259 /* console support */
260 void
261 hd64461video_cninit(struct consdev *cndev)
262 {
263 hd64461video_chip.console = 1;
264 hd64461video_chip.vc.vc_reverse = video_reverse_color();
265
266 update_videochip_status(&hd64461video_chip);
267 setup_hpcfbif(&hd64461video_chip);
268 hpcfb_cnattach(&hd64461video_chip.hf);
269
270 cn_tab->cn_pri = CN_INTERNAL;
271 }
272
273 void
274 hd64461video_cnprobe(struct consdev *cndev)
275 {
276 #if NWSDISPLAY > 0
277 int maj, unit;
278 #endif
279 cndev->cn_dev = NODEV;
280 cndev->cn_pri = CN_NORMAL;
281
282 #if NWSDISPLAY > 0
283 unit = 0;
284 for (maj = 0; maj < nchrdev; maj++) {
285 if (cdevsw[maj].d_open == wsdisplayopen)
286 break;
287 }
288
289 if (maj != nchrdev) {
290 cndev->cn_pri = CN_INTERNAL;
291 cndev->cn_dev = makedev(maj, unit);
292 }
293 #endif /* NWSDISPLAY > 0 */
294 }
295
296 /* hpcfb support */
297 static void
298 setup_hpcfbif(struct hd64461video_chip *hvc)
299 {
300 struct video_chip *vc = &hvc->vc;
301 struct hpcfb_fbconf *fb = &hvc->hf;
302 vaddr_t fbvaddr = vc->vc_fbvaddr;
303 int height = vc->vc_fbheight;
304 int width = vc->vc_fbwidth;
305 int depth = vc->vc_fbdepth;
306
307 memset(fb, 0, sizeof(struct hpcfb_fbconf));
308
309 fb->hf_conf_index = 0; /* configuration index */
310 fb->hf_nconfs = 1; /* how many configurations */
311 strncpy(fb->hf_name, "HD64461 video module", HPCFB_MAXNAMELEN);
312 /* frame buffer name */
313 strncpy(fb->hf_conf_name, "LCD", HPCFB_MAXNAMELEN);
314 /* configuration name */
315 fb->hf_height = height;
316 fb->hf_width = width;
317 fb->hf_baseaddr = (u_long)fbvaddr;
318 fb->hf_offset = (u_long)fbvaddr -
319 sh3_ptob(sh3_btop(fbvaddr));
320 /* frame buffer start offset */
321 fb->hf_bytes_per_line = (width * depth) / NBBY;
322 fb->hf_nplanes = 1;
323 fb->hf_bytes_per_plane = height * fb->hf_bytes_per_line;
324
325 fb->hf_access_flags |= HPCFB_ACCESS_BYTE;
326 fb->hf_access_flags |= HPCFB_ACCESS_WORD;
327 fb->hf_access_flags |= HPCFB_ACCESS_DWORD;
328 if (vc->vc_reverse)
329 fb->hf_access_flags |= HPCFB_ACCESS_REVERSE;
330
331 switch (depth) {
332 default:
333 panic("%s: not supported color depth\n", __FUNCTION__);
334 /* NOTREACHED */
335 case 16:
336 fb->hf_class = HPCFB_CLASS_RGBCOLOR;
337 fb->hf_access_flags |= HPCFB_ACCESS_STATIC;
338 fb->hf_pack_width = 16;
339 fb->hf_pixels_per_pack = 1;
340 fb->hf_pixel_width = 16;
341
342 fb->hf_class_data_length = sizeof(struct hf_rgb_tag);
343 /* reserved for future use */
344 fb->hf_u.hf_rgb.hf_flags = 0;
345
346 fb->hf_u.hf_rgb.hf_red_width = 5;
347 fb->hf_u.hf_rgb.hf_red_shift = 11;
348 fb->hf_u.hf_rgb.hf_green_width = 6;
349 fb->hf_u.hf_rgb.hf_green_shift = 5;
350 fb->hf_u.hf_rgb.hf_blue_width = 5;
351 fb->hf_u.hf_rgb.hf_blue_shift = 0;
352 fb->hf_u.hf_rgb.hf_alpha_width = 0;
353 fb->hf_u.hf_rgb.hf_alpha_shift = 0;
354 break;
355
356 case 8:
357 fb->hf_class = HPCFB_CLASS_INDEXCOLOR;
358 fb->hf_access_flags |= HPCFB_ACCESS_STATIC;
359 fb->hf_pack_width = 8;
360 fb->hf_pixels_per_pack = 1;
361 fb->hf_pixel_width = 8;
362 fb->hf_class_data_length = sizeof(struct hf_indexed_tag);
363 /* reserved for future use */
364 fb->hf_u.hf_indexed.hf_flags = 0;
365 break;
366 }
367 }
368
369 static void
370 hwaccel_init(struct hd64461video_chip *hvc)
371 {
372 u_int16_t r;
373
374 r = HD64461_LCDGRCFGR_ACCRESET;
375 switch (hvc->vc.vc_fbdepth) {
376 default:
377 panic("no bitblit acceralation.");
378 case 16:
379 break;
380 case 8:
381 r |= HD64461_LCDGRCFGR_COLORDEPTH_8BPP;
382 break;
383 }
384 hd64461_reg_write_2(HD64461_LCDGRCFGR_REG16, r);
385
386 while ((hd64461_reg_read_2(HD64461_LCDGRCFGR_REG16) &
387 HD64461_LCDGRCFGR_ACCSTATUS) != 0)
388 /* busy loop */;
389 r &= ~HD64461_LCDGRCFGR_ACCRESET;
390 hd64461_reg_write_2(HD64461_LCDGRCFGR_REG16, r);
391
392 while ((hd64461_reg_read_2(HD64461_LCDGRCFGR_REG16) &
393 HD64461_LCDGRCFGR_ACCSTATUS) != 0)
394 /* busy loop */;
395
396 hd64461_reg_write_2(HD64461_LCDGRDOR_REG16,
397 (hvc->vc.vc_fbwidth - 1) & HD64461_LCDGRDOR_MASK);
398 }
399
400 /* hpcfb ops */
401 int
402 hd64461video_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
403 {
404 struct hd64461video_softc *sc = (struct hd64461video_softc *)v;
405 struct hpcfb_fbconf *hf = &sc->sc_vc->hf;
406 struct hpcfb_fbconf *fbconf;
407 struct hpcfb_dspconf *dspconf;
408 struct wsdisplay_cmap *cmap;
409 u_int8_t *r, *g, *b;
410 int idx, cnt, error;
411
412 switch (cmd) {
413 case WSDISPLAYIO_GETCMAP:
414 cmap = (struct wsdisplay_cmap*)data;
415 cnt = cmap->count;
416 idx = cmap->index;
417
418 if (hf->hf_class != HPCFB_CLASS_INDEXCOLOR ||
419 hf->hf_pack_width != 8 ||
420 !LEGAL_CLUT_INDEX(idx) ||
421 !LEGAL_CLUT_INDEX(idx + cnt -1)) {
422 return (EINVAL);
423 }
424
425 if (!uvm_useracc(cmap->red, cnt, B_WRITE) ||
426 !uvm_useracc(cmap->green, cnt, B_WRITE) ||
427 !uvm_useracc(cmap->blue, cnt, B_WRITE)) {
428 return (EFAULT);
429 }
430
431 error = cmap_work_alloc(&r, &g, &b, 0, cnt);
432 if (error != 0) {
433 cmap_work_free(r, g, b, 0);
434 return (ENOMEM);
435 }
436
437 get_clut(sc->sc_vc, idx, cnt, r, g, b);
438 copyout(r, cmap->red, cnt);
439 copyout(g, cmap->green,cnt);
440 copyout(b, cmap->blue, cnt);
441 cmap_work_free(r, g, b, 0);
442
443 return (0);
444
445 case WSDISPLAYIO_PUTCMAP:
446 cmap = (struct wsdisplay_cmap *)data;
447 cnt = cmap->count;
448 idx = cmap->index;
449
450 if (hf->hf_class != HPCFB_CLASS_INDEXCOLOR ||
451 hf->hf_pack_width != 8 ||
452 !LEGAL_CLUT_INDEX(idx) ||
453 !LEGAL_CLUT_INDEX(idx + cnt -1)) {
454 return (EINVAL);
455 }
456
457 if (!uvm_useracc(cmap->red, cnt, B_WRITE) ||
458 !uvm_useracc(cmap->green, cnt, B_WRITE) ||
459 !uvm_useracc(cmap->blue, cnt, B_WRITE)) {
460 return (EFAULT);
461 }
462
463 error = cmap_work_alloc(&r, &g, &b, 0, cnt);
464 if (error != 0) {
465 cmap_work_free(r, g, b, 0);
466 return (ENOMEM);
467 }
468
469 copyin(cmap->red, r, cnt);
470 copyin(cmap->green,g, cnt);
471 copyin(cmap->blue, b, cnt);
472 set_clut(sc->sc_vc, idx, cnt, r, g, b);
473 cmap_work_free(r, g, b, 0);
474
475 return (0);
476
477 case HPCFBIO_GCONF:
478 fbconf = (struct hpcfb_fbconf *)data;
479 if (fbconf->hf_conf_index != 0 &&
480 fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
481 return (EINVAL);
482 }
483 *fbconf = *hf; /* structure assignment */
484 return (0);
485
486 case HPCFBIO_SCONF:
487 fbconf = (struct hpcfb_fbconf *)data;
488 if (fbconf->hf_conf_index != 0 &&
489 fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
490 return (EINVAL);
491 }
492 /*
493 * nothing to do because we have only one configration
494 */
495 return (0);
496
497 case HPCFBIO_GDSPCONF:
498 dspconf = (struct hpcfb_dspconf *)data;
499 if ((dspconf->hd_unit_index != 0 &&
500 dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
501 (dspconf->hd_conf_index != 0 &&
502 dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
503 return (EINVAL);
504 }
505 *dspconf = sc->sc_vc->hd; /* structure assignment */
506 return (0);
507
508 case HPCFBIO_SDSPCONF:
509 dspconf = (struct hpcfb_dspconf *)data;
510 if ((dspconf->hd_unit_index != 0 &&
511 dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
512 (dspconf->hd_conf_index != 0 &&
513 dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
514 return (EINVAL);
515 }
516 /*
517 * nothing to do
518 * because we have only one unit and one configration
519 */
520 return (0);
521
522 case HPCFBIO_GOP:
523 case HPCFBIO_SOP:
524 /* XXX not implemented yet */
525 return (EINVAL);
526 }
527
528 return (ENOTTY);
529 }
530
531 paddr_t
532 hd64461video_mmap(void *ctx, off_t offset, int prot)
533 {
534 struct hd64461video_softc *sc = (struct hd64461video_softc *)ctx;
535 struct hpcfb_fbconf *hf = &sc->sc_vc->hf;
536
537 if (offset < 0 || (hf->hf_bytes_per_plane + hf->hf_offset) < offset)
538 return (-1);
539
540 return (sh3_btop(HD64461_FBBASE + offset));
541 }
542
543 void
544 hd64461video_cursor(void *ctx, int on, int xd, int yd, int w, int h)
545 {
546 struct hd64461video_softc *sc = (struct hd64461video_softc *)ctx;
547 int xw, yh, width, bpp, adr;
548 u_int16_t r;
549
550 width = sc->sc_vc->vc.vc_fbwidth;
551 bpp = sc->sc_vc->vc.vc_fbdepth;
552 xw = w - 1;
553 yh = h - 1;
554
555 /* Wait until previous command done. */
556 hd64461video_iodone(ctx);
557
558 /* Destination addr */
559 adr = width * yd + xd;
560 if (bpp == 16)
561 adr *= 2;
562 hd64461_reg_write_2(HD64461_LCDBBTDSARH_REG16,
563 HD64461_LCDBBTDSARH(adr));
564 hd64461_reg_write_2(HD64461_LCDBBTDSARL_REG16,
565 HD64461_LCDBBTDSARL(adr));
566
567 // Width
568 hd64461_reg_write_2(HD64461_LCDBBTDWR_REG16,
569 xw & HD64461_LCDBBTDWR_MASK);
570
571 // Height
572 hd64461_reg_write_2(HD64461_LCDBBTDHR_REG16,
573 yh & HD64461_LCDBBTDHR_MASK);
574
575 // Operation (Destination Invert)
576 hd64461_reg_write_2(HD64461_LCDBBTROPR_REG16,
577 HD64461_LCDC_BITBLT_DSTINVERT);
578
579 // BitBLT mode (Destination Invert)
580 hd64461_reg_write_2(HD64461_LCDBBTMDR_REG16, 0);
581
582 // Kick.
583 r = hd64461_reg_read_2(HD64461_LCDGRCFGR_REG16);
584 r &= ~HD64461_LCDGRCFGR_ACCSTART_MASK;
585 r |= HD64461_LCDGRCFGR_ACCSTART_BITBLT;
586 hd64461_reg_write_2(HD64461_LCDGRCFGR_REG16, r);
587 }
588
589 void
590 hd64461video_bitblit(void *ctx, int xs, int ys, int xd, int yd, int h, int w)
591 {
592 struct hd64461video_softc *sc = (struct hd64461video_softc *)ctx;
593 int xw, yh, width, bpp, condition_a, adr;
594 u_int16_t r;
595
596 xw = w - 1;
597 yh = h - 1;
598 width = sc->sc_vc->vc.vc_fbwidth;
599 bpp = sc->sc_vc->vc.vc_fbdepth;
600 condition_a = ((ys == yd) && (xs <= xd)) || (ys < yd);
601
602 hd64461video_iodone(ctx);
603
604 // Source addr
605 if (condition_a)
606 adr = (width * (ys + yh)) + (xs + xw);
607 else
608 adr = width * ys + xs;
609 if (bpp == 16)
610 adr *= 2;
611
612 hd64461_reg_write_2(HD64461_LCDBBTSSARH_REG16,
613 HD64461_LCDBBTSSARH(adr));
614 hd64461_reg_write_2(HD64461_LCDBBTSSARL_REG16,
615 HD64461_LCDBBTSSARL(adr));
616
617 // Destination addr
618 if (condition_a)
619 adr = (width * (yd + yh)) + (xd + xw);
620 else
621 adr = width * yd + xd;
622 if (bpp == 16)
623 adr *= 2;
624
625 hd64461_reg_write_2(HD64461_LCDBBTDSARH_REG16,
626 HD64461_LCDBBTDSARH(adr));
627 hd64461_reg_write_2(HD64461_LCDBBTDSARL_REG16,
628 HD64461_LCDBBTDSARL(adr));
629
630 // Width
631 hd64461_reg_write_2(HD64461_LCDBBTDWR_REG16,
632 xw & HD64461_LCDBBTDWR_MASK);
633
634 // Height
635 hd64461_reg_write_2(HD64461_LCDBBTDHR_REG16,
636 yh & HD64461_LCDBBTDHR_MASK);
637
638 // Operation (source copy)
639 hd64461_reg_write_2(HD64461_LCDBBTROPR_REG16,
640 HD64461_LCDC_BITBLT_SRCCOPY);
641
642 // BitBLT mode (on screen to on screen)
643 r = HD64461_LCDBBTMDR_SET(0,
644 HD64461_LCDBBTMDR_ON_SCREEN_TO_ON_SCREEN);
645 hd64461_reg_write_2(HD64461_LCDBBTMDR_REG16, r);
646
647 // Kick.
648 r = hd64461_reg_read_2(HD64461_LCDGRCFGR_REG16);
649 r &= ~HD64461_LCDGRCFGR_ACCSTART_MASK;
650 r |= HD64461_LCDGRCFGR_ACCSTART_BITBLT;
651 hd64461_reg_write_2(HD64461_LCDGRCFGR_REG16, r);
652 }
653
654 void
655 hd64461video_erase(void *ctx, int xd, int yd, int h, int w, int attr)
656 {
657 struct hd64461video_softc *sc = (struct hd64461video_softc *)ctx;
658 int xw, yh, width, bpp, adr;
659 u_int16_t r;
660
661 width = sc->sc_vc->vc.vc_fbwidth;
662 bpp = sc->sc_vc->vc.vc_fbdepth;
663 xw = w - 1;
664 yh = h - 1;
665
666 /* Wait until previous command done. */
667 hd64461video_iodone(ctx);
668
669 /* Destination addr */
670 adr = width * yd + xd;
671 if (bpp == 16)
672 adr *= 2;
673 hd64461_reg_write_2(HD64461_LCDBBTDSARH_REG16,
674 HD64461_LCDBBTDSARH(adr));
675 hd64461_reg_write_2(HD64461_LCDBBTDSARL_REG16,
676 HD64461_LCDBBTDSARL(adr));
677
678 // Width
679 hd64461_reg_write_2(HD64461_LCDBBTDWR_REG16,
680 xw & HD64461_LCDBBTDWR_MASK);
681
682 // Height
683 hd64461_reg_write_2(HD64461_LCDBBTDHR_REG16,
684 yh & HD64461_LCDBBTDHR_MASK);
685
686 // Color
687 hd64461_reg_write_2(HD64461_LCDGRSCR_REG16, 0); //XXX black only
688
689 // Operation (Solid Color Fill)
690 hd64461_reg_write_2(HD64461_LCDBBTROPR_REG16,
691 HD64461_LCDC_BITBLT_PATCOPY);
692
693 // BitBLT mode (Solid Color)
694 hd64461_reg_write_2(HD64461_LCDBBTMDR_REG16,
695 HD64461_LCDBBTMDR_PATSELECT_SOLIDCOLOR);
696
697 // Kick.
698 r = hd64461_reg_read_2(HD64461_LCDGRCFGR_REG16);
699 r &= ~HD64461_LCDGRCFGR_ACCSTART_MASK;
700 r |= HD64461_LCDGRCFGR_ACCSTART_BITBLT;
701 hd64461_reg_write_2(HD64461_LCDGRCFGR_REG16, r);
702 }
703
704 void
705 hd64461video_putchar(void *ctx, int row, int col, struct wsdisplay_font *font,
706 int fclr, int uclr, u_int uc, int attr)
707 {
708 struct hd64461video_softc *sc = (struct hd64461video_softc *)ctx;
709 int w, h, cw;
710
711 w = font->fontwidth;
712 h = font->fontheight;
713 cw = sc->sc_font.cw;
714 hd64461video_bitblit(ctx, (uc % cw) * w,
715 sc->sc_vc->vc.vc_fbheight + (uc / cw) * h, row, col, h, w);
716 }
717
718 void
719 hd64461video_setclut(void *ctx, struct rasops_info *info)
720 {
721 struct hd64461video_softc *sc = (struct hd64461video_softc *)ctx;
722
723 if (sc->sc_vc->vc.vc_fbdepth != 8)
724 return;
725 }
726
727 void
728 hd64461video_font(void *ctx, struct wsdisplay_font *font)
729 {
730 struct hd64461video_softc *sc = (struct hd64461video_softc *)ctx;
731
732 font_set_attr(sc, font);
733 font_load(sc);
734 }
735
736 void
737 hd64461video_iodone(void *ctx)
738 {
739 while ((hd64461_reg_read_2(HD64461_LCDGRCFGR_REG16) &
740 HD64461_LCDGRCFGR_ACCSTATUS) != 0)
741 /* busy loop */;
742 }
743
744 /* internal */
745 static void
746 font_load_16bpp(u_int16_t *d, u_int8_t *s, int w, int h, int step)
747 {
748 int i, j, n;
749 n = step / sizeof(u_int16_t);
750
751 for (i = 0; i < h; i++, d += n) {
752 for (j = 0; j < w; j++) {
753 d[j] = *s & (1 << w - j - 1) ? 0xffff : 0x0000;
754 }
755 s++;
756 }
757 }
758
759 static void
760 font_load_8bpp(u_int8_t *d, u_int8_t *s, int w, int h, int step)
761 {
762 int i, j, n;
763 n = step / sizeof(u_int8_t);
764
765 for (i = 0; i < h; i++, d += n) {
766 for (j = 0; j < w; j++) {
767 d[j] = *s & (1 << w - j - 1) ? 0xff : 0x00;
768 }
769 s++;
770 }
771 }
772
773 static void
774 font_set_attr(struct hd64461video_softc *sc, struct wsdisplay_font *f)
775 {
776 struct hd64461video_chip *hvc = sc->sc_vc;
777 struct wsdisplay_font *font = (struct wsdisplay_font *)&sc->sc_font;
778 int w, h, bpp;
779
780 w = f->fontwidth;
781 h = f->fontheight;
782 bpp = hvc->vc.vc_fbdepth;
783
784 *font = *f;
785 sc->sc_font.c = (w * bpp) / NBBY;
786 sc->sc_font.cw = hvc->hf.hf_width / w;
787 sc->sc_font.cstep = ((w * h * bpp) / NBBY) * sc->sc_font.cw;
788
789 DPRINTF("c = %d cw = %d cstep = %d\n", sc->sc_font.c,
790 sc->sc_font.cw, sc->sc_font.cstep);
791
792 }
793
794 /* return frame buffer virtual address of charcter #n */
795 static vaddr_t
796 font_start_addr(struct hd64461video_softc *sc, int n)
797 {
798 struct hd64461video_chip *hvc = sc->sc_vc;
799 struct hd64461video_font *font = &sc->sc_font;
800 vaddr_t base;
801
802 base = (vaddr_t)hvc->off_screen_addr;
803 base += (n / font->cw) * font->cstep + font->c * (n % font->cw);
804
805 return base;
806 }
807
808 static void
809 font_load(struct hd64461video_softc *sc)
810 {
811 struct hd64461video_chip *hvc = sc->sc_vc;
812 struct wsdisplay_font *font = (struct wsdisplay_font *)&sc->sc_font;
813 u_int8_t *q;
814 int w, h, step, i, n;
815
816 if (sc->sc_font.loaded) {
817 printf("reload font\n");
818 }
819
820 w = font->fontwidth;
821 h = font->fontheight;
822 step = sc->sc_font.cw * sc->sc_font.c;
823 n = (w * h) / NBBY;
824 q = font->data;
825
826 DPRINTF("%s (%dx%d) %d+%d\n", font->name, w, h, font->firstchar,
827 font->numchars);
828 DPRINTF("bitorder %d byteorder %d stride %d\n", font->bitorder,
829 font->byteorder, font->stride);
830
831 switch (hvc->vc.vc_fbdepth) {
832 case 8:
833 for (i = font->firstchar; i < font->numchars; i++) {
834 font_load_8bpp((u_int8_t *)font_start_addr(sc, i),
835 q, w, h, step);
836 q += n;
837 }
838 break;
839 case 16:
840 for (i = font->firstchar; i < font->numchars; i++) {
841 font_load_16bpp((u_int16_t *)font_start_addr(sc, i),
842 q, w, h, step);
843 q += n;
844 }
845 break;
846 }
847
848 sc->sc_font.loaded = TRUE;
849 }
850
851 static void
852 update_videochip_status(struct hd64461video_chip *hvc)
853 {
854 struct video_chip *vc = &hvc->vc;
855 u_int16_t r;
856 int i;
857 int depth, width, height;
858
859 /* display mode */
860 r = hd64461_reg_read_2(HD64461_LCDLDR3_REG16);
861 i = HD64461_LCDLDR3_CG(r);
862 switch (i) {
863 case HD64461_LCDLDR3_CG_COLOR16:
864 depth = 16;
865 hvc->mode = LCD64K_C;
866 break;
867 case HD64461_LCDLDR3_CG_COLOR8:
868 depth = 8;
869 hvc->mode = LCD256_C;
870 break;
871 case HD64461_LCDLDR3_CG_GRAY6:
872 depth = 6;
873 hvc->mode = LCD64_MONO;
874 break;
875 case HD64461_LCDLDR3_CG_GRAY4:
876 depth = 4;
877 hvc->mode = LCD16_MONO;
878 break;
879 case HD64461_LCDLDR3_CG_GRAY2:
880 depth = 2;
881 hvc->mode = LCD4_MONO;
882 break;
883 case HD64461_LCDLDR3_CG_GRAY1:
884 depth = 1;
885 hvc->mode = LCD2_MONO;
886 break;
887 }
888
889 r = hd64461_reg_read_2(HD64461_LCDCCR_REG16);
890 i = HD64461_LCDCCR_DSPSEL(i);
891 switch (i) {
892 case HD64461_LCDCCR_DSPSEL_LCD_CRT:
893 depth = 8;
894 hvc->mode = LCDCRT;
895 break;
896 case HD64461_LCDCCR_DSPSEL_CRT:
897 depth = 8;
898 hvc->mode = CRT256_C;
899 break;
900 case HD64461_LCDCCR_DSPSEL_LCD:
901 /* nothing to do */
902 break;
903 }
904
905 width = bootinfo->fb_width;
906 height = bootinfo->fb_height;
907
908 vc->vc_fbvaddr = HD64461_FBBASE;
909 vc->vc_fbpaddr = HD64461_FBBASE;
910 vc->vc_fbdepth = depth;
911 vc->vc_fbsize = (width * height * depth) / NBBY;
912 vc->vc_fbwidth = width;
913 vc->vc_fbheight = height;
914 }
915
916 static void
917 set_display_mode(struct hd64461video_chip *hvc)
918 {
919
920 if (hvc->mode == LCDCRT || hvc->mode == CRT256_C)
921 set_display_mode_crtc(hvc);
922
923 set_display_mode_lcdc(hvc);
924 }
925
926 static void
927 set_display_mode_lcdc(struct hd64461video_chip *hvc)
928 {
929 static struct {
930 u_int16_t clor; /* display size 640 x 240 */
931 u_int16_t ldr3;
932 const char *name;
933 } disp_conf[] = {
934 [LCD256_C] = { 0x280 , HD64461_LCDLDR3_CG_COLOR8 ,
935 "8bit color" },
936 [LCD64K_C] = { 0x500 , HD64461_LCDLDR3_CG_COLOR16 ,
937 "16bit color" },
938 [LCD64_MONO] = { 0x280 , HD64461_LCDLDR3_CG_GRAY6 ,
939 "6bit gray scale" },
940 [LCD16_MONO] = { 0x140 , HD64461_LCDLDR3_CG_GRAY4 ,
941 "4bit gray scale" },
942 [LCD4_MONO] = { 0x0a0 , HD64461_LCDLDR3_CG_GRAY2 ,
943 "2bit gray scale" },
944 [LCD2_MONO] = { 0x050 , HD64461_LCDLDR3_CG_GRAY1 ,
945 "mono chrome" },
946 }, *conf;
947 u_int16_t r;
948 int omode;
949
950 conf = &disp_conf[hvc->mode];
951
952 hd64461_reg_write_2(HD64461_LCDCLOR_REG16, conf->clor);
953 r = hd64461_reg_read_2(HD64461_LCDLDR3_REG16);
954 omode = HD64461_LCDLDR3_CG(r);
955 r = HD64461_LCDLDR3_CG_CLR(r);
956 r = HD64461_LCDLDR3_CG_SET(r, conf->ldr3);
957 hd64461_reg_write_2(HD64461_LCDLDR3_REG16, r);
958
959 printf("%s ", conf->name);
960 }
961
962 static void
963 set_display_mode_crtc(struct hd64461video_chip *hvc)
964 {
965 /* not yet */
966 }
967
968 static size_t
969 frame_buffer_size(struct hd64461video_chip *hvc)
970 {
971 vaddr_t page, startaddr, endaddr;
972 int x;
973
974 startaddr = HD64461_FBBASE;
975 endaddr = startaddr + HD64461_FBSIZE - 1;
976
977 page = startaddr;
978
979 x = random();
980 *(volatile int *)(page + 0) = x;
981 *(volatile int *)(page + 4) = ~x;
982
983 if (*(volatile int *)(page + 0) != x ||
984 *(volatile int *)(page + 4) != ~x)
985 return (0);
986
987 for (page += HD64461_FBPAGESIZE; page < endaddr;
988 page += HD64461_FBPAGESIZE) {
989 if (*(volatile int *)(page + 0) == x &&
990 *(volatile int *)(page + 4) == ~x)
991 goto fbend_found;
992 }
993
994 page -= HD64461_FBPAGESIZE;
995 *(volatile int *)(page + 0) = x;
996 *(volatile int *)(page + 4) = ~x;
997
998 if (*(volatile int *)(page + 0) != x ||
999 *(volatile int *)(page + 4) != ~x)
1000 return (0);
1001
1002 fbend_found:
1003 return (page - startaddr);
1004 }
1005
1006 static void
1007 set_clut(struct hd64461video_chip *vc, int idx, int cnt,
1008 u_int8_t *r, u_int8_t *g, u_int8_t *b)
1009 {
1010 KASSERT(r && g && b);
1011
1012 /* index pallete */
1013 hd64461_reg_write_2(HD64461_LCDCPTWAR_REG16,
1014 HD64461_LCDCPTWAR_SET(0, idx));
1015 /* set data */
1016 while (cnt && LEGAL_CLUT_INDEX(idx)) {
1017 u_int16_t v;
1018 #define SET_CLUT(x) \
1019 v = (x >> 2) & 0x3f; \
1020 hd64461_reg_write_2(HD64461_LCDCPTWDR_REG16, v)
1021 SET_CLUT(*r);
1022 SET_CLUT(*g);
1023 SET_CLUT(*b);
1024 #undef SET_CLUT
1025 r++, g++, b++;
1026 idx++, cnt--;
1027 }
1028 }
1029
1030 static void
1031 get_clut(struct hd64461video_chip *vc, int idx, int cnt,
1032 u_int8_t *r, u_int8_t *g, u_int8_t *b)
1033 {
1034 KASSERT(r && g && b);
1035
1036 /* index pallete */
1037 hd64461_reg_write_2(HD64461_LCDCPTRAR_REG16,
1038 HD64461_LCDCPTRAR_SET(0, idx));
1039
1040 /* get data */
1041 while (cnt && LEGAL_CLUT_INDEX(idx)) {
1042 u_int16_t v;
1043 #define GET_CLUT(x) \
1044 v = hd64461_reg_read_2(HD64461_LCDCPTWDR_REG16); \
1045 x = HD64461_LCDCPTRDR(v); \
1046 x <<= 2
1047 GET_CLUT(*r);
1048 GET_CLUT(*g);
1049 GET_CLUT(*b);
1050 #undef GET_CLUT
1051 r++, g++, b++;
1052 idx++, cnt--;
1053 }
1054 }
1055
1056 #ifdef HD64461VIDEO_DEBUG
1057 static void
1058 _info(struct hd64461video_softc *sc)
1059 {
1060 const char name[] = __FUNCTION__;
1061 u_int16_t r;
1062 int color;
1063 int i;
1064
1065 dbg_banner_start(name, sizeof name);
1066 printf("---[LCD]---\n");
1067 /* Base Address Register */
1068 r = hd64461_reg_read_2(HD64461_LCDCBAR_REG16);
1069 printf("LCDCBAR Frame buffer base address (4k Byte align): 0x%08x\n",
1070 HD64461_LCDCBAR_BASEADDR(r));
1071
1072 /* Line Address Offset Register */
1073 r = hd64461_reg_read_2(HD64461_LCDCLOR_REG16);
1074 printf("LCDCLOR Line address offset: %d\n", HD64461_LCDCLOR(r));
1075
1076 /* LCDC Control Register */
1077 r = hd64461_reg_read_2(HD64461_LCDCCR_REG16);
1078 i = HD64461_LCDCCR_DSPSEL(r);
1079 #define DBG_BIT_PRINT(r, m) dbg_bit_print(r, HD64461_LCDCCR_##m, #m)
1080 printf("LCDCCR (LCD Control Register)\n");
1081 DBG_BIT_PRINT(r, STBAK);
1082 DBG_BIT_PRINT(r, STREQ);
1083 DBG_BIT_PRINT(r, MOFF);
1084 DBG_BIT_PRINT(r, REFSEL);
1085 DBG_BIT_PRINT(r, EPON);
1086 DBG_BIT_PRINT(r, SPON);
1087 printf("\n");
1088 #undef DBG_BIT_PRINT
1089 printf("LCDCCR Display selct LCD[%c] CRT[%c]\n",
1090 i == HD64461_LCDCCR_DSPSEL_LCD_CRT ||
1091 i == HD64461_LCDCCR_DSPSEL_LCD ? 'x' : '_',
1092 i == HD64461_LCDCCR_DSPSEL_LCD_CRT ||
1093 i == HD64461_LCDCCR_DSPSEL_CRT ? 'x' : '_');
1094
1095 /* LCD Display Register */
1096 /* 1 */
1097 r = hd64461_reg_read_2(HD64461_LCDLDR1_REG16);
1098 printf("(LCD Display Register)\n");
1099 #define DBG_BIT_PRINT(r, m) dbg_bit_print(r, HD64461_LCDLDR1_##m, #m)
1100 printf("LCDLDR1: ");
1101 DBG_BIT_PRINT(r, DINV);
1102 DBG_BIT_PRINT(r, DON);
1103 printf("\n");
1104 #undef DBG_BIT_PRINT
1105 /* 2 */
1106 r = hd64461_reg_read_2(HD64461_LCDLDR2_REG16);
1107 i = HD64461_LCDLDR2_LM(r);
1108 #define DBG_BIT_PRINT(r, m) dbg_bit_print(r, HD64461_LCDLDR2_##m, #m)
1109 printf("LCDLDR2: ");
1110 DBG_BIT_PRINT(r, CC1);
1111 DBG_BIT_PRINT(r, CC2);
1112 #undef DBG_BIT_PRINT
1113 color = 0;
1114 switch (i) {
1115 default:
1116 panic("unknown unknown LCD interface.");
1117 break;
1118 case HD64461_LCDLDR2_LM_COLOR:
1119 color = 1;
1120 printf("Color");
1121 break;
1122 case HD64461_LCDLDR2_LM_GRAY8:
1123 printf("8-bit grayscale");
1124 break;
1125 case HD64461_LCDLDR2_LM_GRAY4:
1126 printf("8-bit grayscale");
1127 break;
1128 }
1129 printf(" LCD interface\n");
1130 /* 3 */
1131 printf("LCDLDR3: ");
1132 r = hd64461_reg_read_2(HD64461_LCDLDR3_REG16);
1133 i = HD64461_LCDLDR3_CS(r);
1134 printf("CS ");
1135 switch (i) {
1136 case 0:
1137 printf("15");
1138 break;
1139 case 1:
1140 printf("2.5");
1141 break;
1142 case 2:
1143 printf("3.75");
1144 break;
1145 case 4:
1146 printf("5");
1147 break;
1148 case 8:
1149 printf("7.5");
1150 break;
1151 case 16:
1152 printf("10");
1153 break;
1154 }
1155 printf("%s MHz ", color ? "" : "/2");
1156 i = HD64461_LCDLDR3_CG(r);
1157 switch (i) {
1158 case HD64461_LCDLDR3_CG_COLOR16:
1159 printf("Color 64K colors\n");
1160 break;
1161 case HD64461_LCDLDR3_CG_COLOR8:
1162 printf("Color 256 colors\n");
1163 break;
1164 case HD64461_LCDLDR3_CG_GRAY6:
1165 printf("6-bit Grayscale\n");
1166 break;
1167 case HD64461_LCDLDR3_CG_GRAY4:
1168 printf("4-bit Grayscale\n");
1169 break;
1170 case HD64461_LCDLDR3_CG_GRAY2:
1171 printf("2-bit Grayscale\n");
1172 break;
1173 case HD64461_LCDLDR3_CG_GRAY1:
1174 printf("1-bit Grayscale\n");
1175 break;
1176 }
1177
1178 /* LCD Number of Characters in Horizontal Register */
1179 r = hd64461_reg_read_2(HD64461_LCDLDHNCR_REG16);
1180 printf("LDHNCR: NHD %d NHT %d (# of horizontal characters)\n",
1181 HD64461_LCDLDHNCR_NHD(r), HD64461_LCDLDHNCR_NHT(r));
1182
1183 /* Start Position of Horizontal Register */
1184 r = hd64461_reg_read_2(HD64461_LCDLDHNSR_REG16);
1185 printf("LDHNSR: HSW %d HSP %d (start position of horizontal)\n",
1186 HD64461_LCDLDHNSR_HSW(r), HD64461_LCDLDHNSR_HSP(r));
1187
1188 /* Total Vertical Lines Register */
1189 r = hd64461_reg_read_2(HD64461_LCDLDVNTR_REG16);
1190 printf("LDVNTR: %d (total vertical lines)\n",
1191 HD64461_LCDLDVNTR_VTL(r));
1192
1193 /* Display Vertical Lines Register */
1194 r = hd64461_reg_read_2(HD64461_LCDLDVNDR_REG16);
1195 printf("LDVNDR: %d (display vertical lines)\n",
1196 HD64461_LCDLDVSPR_VSP(r));
1197
1198 /* Vertical Synchronization Position Register */
1199 r = hd64461_reg_read_2(HD64461_LCDLDVSPR_REG16);
1200 printf("LDVSPR: %d (vertical synchronization position)\n",
1201 HD64461_LCDLDVSPR_VSP(r));
1202
1203 /*
1204 * CRT Control Register
1205 */
1206 printf("---[CRT]---\n");
1207 r = hd64461_reg_read_2(HD64461_LCDCRTVTR_REG16);
1208 printf("CRTVTR: %d (CRTC total vertical lines)\n",
1209 HD64461_LCDCRTVTR(r));
1210 r = hd64461_reg_read_2(HD64461_LCDCRTVRSR_REG16);
1211 printf("CRTVRSR: %d (CRTC vertical retrace start line)\n",
1212 HD64461_LCDCRTVRSR(r));
1213 r = hd64461_reg_read_2(HD64461_LCDCRTVRER_REG16);
1214 printf("CRTVRER: %d (CRTC vertical retrace end line)\n",
1215 HD64461_LCDCRTVRER(r));
1216
1217 dbg_banner_end();
1218 }
1219
1220 static void
1221 _dump()
1222 {
1223 u_int16_t r;
1224 printf("---Display Mode Setting---\n");
1225 #define DUMPREG(x) \
1226 r = hd64461_reg_read_2(HD64461_LCD ## x ## _REG16); \
1227 printf("%-10s 0x%04x ", #x, r); \
1228 bitdisp(r)
1229 DUMPREG(CBAR);
1230 DUMPREG(CLOR);
1231 DUMPREG(CCR);
1232 DUMPREG(LDR1);
1233 DUMPREG(LDR2);
1234 DUMPREG(LDHNCR);
1235 DUMPREG(LDHNSR);
1236 DUMPREG(LDVNTR);
1237 DUMPREG(LDVNDR);
1238 DUMPREG(LDVSPR);
1239 DUMPREG(LDR3);
1240 DUMPREG(CRTVTR);
1241 DUMPREG(CRTVRSR);
1242 DUMPREG(CRTVRER);
1243 #undef DUMPREG
1244 }
1245
1246 #endif /* HD64461VIDEO_DEBUG */
1247