Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch add LCD debug routines.
details: https://anonhg.NetBSD.org/src/rev/35d58f85c056
branches: trunk
changeset: 522243:35d58f85c056
user: uch <uch%NetBSD.org@localhost>
date: Wed Feb 13 16:25:32 2002 +0000
description:
add LCD debug routines.
diffstat:
sys/arch/hpc/conf/files.debug | 8 +
sys/arch/hpc/hpc/debug_subr.c | 388 +++++++++++++++++++++++++++++++++++-
sys/arch/hpc/include/debug.h | 14 +-
sys/arch/hpcmips/conf/files.hpcmips | 4 +-
sys/arch/hpcmips/hpcmips/machdep.c | 9 +-
sys/arch/hpcsh/conf/HPW650PA | 3 +-
sys/arch/hpcsh/conf/files.hpcsh | 7 +-
sys/arch/hpcsh/hpcsh/debug.c | 45 ++-
sys/arch/hpcsh/hpcsh/machdep.c | 44 ++-
sys/arch/hpcsh/include/debug.h | 15 +-
10 files changed, 477 insertions(+), 60 deletions(-)
diffs (truncated from 804 to 300 lines):
diff -r 8bc3806f7034 -r 35d58f85c056 sys/arch/hpc/conf/files.debug
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hpc/conf/files.debug Wed Feb 13 16:25:32 2002 +0000
@@ -0,0 +1,8 @@
+# $NetBSD: files.debug,v 1.1 2002/02/13 16:25:32 uch Exp $
+
+#
+# Debug utility
+#
+
+defflag debug_hpc.h HPC_DEBUG_LCD HPC_DEBUG_INTERRUPT_MONITOR
+file arch/hpc/hpc/debug_subr.c
diff -r 8bc3806f7034 -r 35d58f85c056 sys/arch/hpc/hpc/debug_subr.c
--- a/sys/arch/hpc/hpc/debug_subr.c Wed Feb 13 15:15:23 2002 +0000
+++ b/sys/arch/hpc/hpc/debug_subr.c Wed Feb 13 16:25:32 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: debug_subr.c,v 1.1 2002/01/29 18:53:07 uch Exp $ */
+/* $NetBSD: debug_subr.c,v 1.2 2002/02/13 16:25:33 uch Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -36,10 +36,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "debug_hpc.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <machine/debug.h>
+#include <machine/bootinfo.h>
#define BANNER_LENGTH 80
@@ -118,3 +121,386 @@
for (i = 0; i < n; i++)
printf("-");
}
+
+#ifdef HPC_DEBUG_LCD
+/*
+ * LCD test routines for 8bpp, 16bpp LCD.
+ */
+static const u_int8_t img[1024] = {
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xd5,0xff,0xc3,0xff,0xd5,0xff,0xc3,
+ 0xff,0xd5,0xff,0xc3,0xff,0xd5,0xff,0xc3,
+ 0xff,0xd5,0xff,0xc3,0xff,0xd5,0xc3,0xd5,
+ 0xff,0xc3,0xff,0xd5,0xff,0xc3,0xff,0xd5,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0x82,0x82,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc3,
+ 0xff,0xc3,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xb9,0x82,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb9,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xd5,0x82,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd5,
+ 0xff,0xb9,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xc3,0x82,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc3,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xd5,0x82,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd5,
+ 0xff,0xd5,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xb9,0xd5,0xc3,0xd5,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0x3d,0x82,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb9,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xd5,0x82,0x82,0x82,0x82,0x82,
+ 0x82,0x82,0xd5,0xff,0xff,0xff,0xd5,0x82,
+ 0xff,0xff,0xd5,0xc3,0xff,0xff,0xff,0xc3,
+ 0xff,0xc3,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0x82,0x82,0xff,0xff,0xff,0xff,
+ 0xd5,0x3e,0x82,0x82,0x82,0xc3,0x82,0x3d,
+ 0xff,0xc3,0x82,0x3d,0xff,0xff,0xff,0xd5,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xd5,0x82,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0x82,0x82,0x82,0x3d,
+ 0x82,0x82,0xd5,0xff,0xff,0xff,0xff,0xb9,
+ 0xff,0xb9,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0x82,0x82,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xd5,0x82,0x82,0x82,
+ 0x82,0x82,0xb9,0xff,0xff,0xff,0xff,0xc3,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0x82,0xd5,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0x82,0x82,0x82,
+ 0xd5,0xff,0x82,0xd5,0xff,0xff,0xff,0xd5,
+ 0xff,0xd5,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xd5,0x82,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0x82,0x82,0x3e,
+ 0xff,0xff,0xc3,0x82,0xff,0xff,0xff,0xb9,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x82,0x3e,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xd5,0x82,0xc3,
+ 0xff,0xff,0xff,0x82,0xf8,0xff,0xff,0xd5,
+ 0xff,0xc3,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x82,0xd5,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0x3e,0x82,0x82,0x82,
+ 0x80,0x3d,0xff,0x3d,0x82,0xff,0xff,0xc3,
+ 0xff,0xff,0xff,0xff,0xd5,0xc3,0xd5,0xb9,
+ 0x82,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0x82,0x82,0xd5,0xff,
+ 0x82,0xd5,0xff,0xd5,0x82,0xff,0xff,0xb9,
+ 0xff,0xb9,0xff,0x82,0x82,0x82,0x82,0x82,
+ 0x82,0xc3,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0x82,0x82,0x82,0x82,0x3d,
+ 0x82,0xb9,0xff,0xc3,0x82,0xff,0xff,0xd5,
+ 0xff,0xff,0xd5,0x82,0xd5,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0x82,0x82,0xd5,0x3e,0x82,
+ 0x82,0xc3,0xff,0xb9,0x82,0xff,0xff,0xc3,
+ 0xff,0xc3,0x3e,0x82,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xd5,0x82,0xff,0xff,0xb9,
+ 0xff,0xff,0x82,0x3d,0xff,0xff,0x3e,0xd5,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xc3,0x82,0xff,0xff,0xd5,
+ 0xff,0xd5,0x82,0xd5,0xff,0xc3,0x82,0xff,
+ 0xc3,0xd5,0xb9,0xd5,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xc3,0xd5,
+ 0xb9,0xff,0xff,0xb9,0x82,0xff,0xff,0xc3,
+ 0xff,0xb9,0x82,0xb9,0xff,0x82,0x3d,0xff,
+ 0x82,0x82,0x82,0x82,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xd5,0x82,0x82,
+ 0x82,0x82,0xff,0xd5,0x82,0xff,0xff,0xd5,
+ 0xff,0x82,0x82,0x82,0x82,0x82,0x82,0x82,
+ 0x82,0x82,0x82,0x82,0x82,0xc3,0xb9,0xd5,
+ 0xc3,0xd5,0xff,0xff,0xc3,0x82,0x82,0x82,
+ 0x82,0x82,0xb9,0xc3,0x82,0xff,0xff,0xb9,
+ 0xff,0xd5,0xc3,0xd5,0xb9,0x82,0x3d,0xd5,
+ 0x82,0x82,0x3e,0x82,0x82,0x82,0x82,0x82,
+ 0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x3d,
+ 0x82,0x82,0x82,0x82,0x3d,0xff,0xff,0xc3,
+ 0xff,0xff,0xff,0xff,0xff,0xd5,0x82,0xc3,
+ 0x82,0xd5,0xff,0x82,0xd5,0xff,0xff,0xff,
+ 0xff,0xd5,0xb9,0xd5,0x82,0x82,0x82,0xd5,
+ 0x82,0x82,0x82,0xff,0xd5,0xff,0xff,0xd5,
+ 0xff,0xb9,0xff,0xff,0xff,0xff,0x82,0x82,
+ 0x82,0xc3,0x82,0x82,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0x82,0x82,0x82,
+ 0x82,0x82,0x82,0xff,0xff,0xff,0xff,0xb9,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3d,
+ 0x82,0x82,0x3d,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xd5,0x82,0x82,
+ 0x82,0x82,0xd5,0xff,0xff,0xff,0xff,0xc3,
+ 0xff,0xc3,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc3,
+ 0xd5,0xff,0xff,0xff,0xff,0xff,0xff,0xd5,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb9,
+ 0xff,0xd5,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc3,
+ 0xff,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+ 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+ 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+ 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+};
+
+static const u_int16_t rgb565_clut[256] = {
+ 0x0000, 0x8000, 0x0400, 0x8400, 0x0080, 0x8080, 0x0480, 0x8480,
+ 0xc6e0, 0xa6f0, 0x29ea, 0x29ff, 0x2ae0, 0x2af5, 0x2aea, 0x2aff,
+ 0x2be0, 0x2bf5, 0x2bea, 0x2bff, 0x2ce0, 0x2cf5, 0x2cea, 0x2cff,
+ 0x2de0, 0x2df5, 0x2dea, 0x2dff, 0x2ee0, 0x2ef5, 0x2eea, 0x2eff,
+ 0x2fe0, 0x2ff5, 0x2fea, 0x2fff, 0x5000, 0x5055, 0x50aa, 0x50ff,
+ 0x50e0, 0x50f5, 0x50ea, 0x50ff, 0x51e0, 0x51f5, 0x51ea, 0x51ff,
+ 0x52e0, 0x52f5, 0x52ea, 0x52ff, 0x53e0, 0x53f5, 0x53ea, 0x53ff,
+ 0x54e0, 0x54f5, 0x54ea, 0x54ff, 0x55e0, 0x55f5, 0x55ea, 0x55ff,
+ 0x56e0, 0x56f5, 0x56ea, 0x56ff, 0x57e0, 0x57f5, 0x57ea, 0x57ff,
+ 0x7800, 0x7855, 0x78aa, 0x78ff, 0x78e0, 0x78f5, 0x78ea, 0x78ff,
+ 0x79e0, 0x79f5, 0x79ea, 0x79ff, 0x7ae0, 0x7af5, 0x7aea, 0x7aff,
+ 0x7be0, 0x7bf5, 0x7bea, 0x7bff, 0x7ce0, 0x7cf5, 0x7cea, 0x7cff,
+ 0x7de0, 0x7df5, 0x7dea, 0x7dff, 0x7ee0, 0x7ef5, 0x7eea, 0x7eff,
+ 0x7fe0, 0x7ff5, 0x7fea, 0x7fff, 0xa800, 0xa855, 0xa8aa, 0xa8ff,
+ 0xa8e0, 0xa8f5, 0xa8ea, 0xa8ff, 0xa9e0, 0xa9f5, 0xa9ea, 0xa9ff,
+ 0xaae0, 0xaaf5, 0xaaea, 0xaaff, 0xabe0, 0xabf5, 0xabea, 0xabff,
+ 0xace0, 0xacf5, 0xacea, 0xacff, 0xade0, 0xadf5, 0xadea, 0xadff,
+ 0xaee0, 0xaef5, 0xaeea, 0xaeff, 0xafe0, 0xaff5, 0xafea, 0xafff,
+ 0xd000, 0xd055, 0xd0aa, 0xd0ff, 0xd0e0, 0xd0f5, 0xd0ea, 0xd0ff,
+ 0xd1e0, 0xd1f5, 0xd1ea, 0xd1ff, 0xd2e0, 0xd2f5, 0xd2ea, 0xd2ff,
+ 0xd3e0, 0xd3f5, 0xd3ea, 0xd3ff, 0xd4e0, 0xd4f5, 0xd4ea, 0xd4ff,
+ 0xd5e0, 0xd5f5, 0xd5ea, 0xd5ff, 0xd6e0, 0xd6f5, 0xd6ea, 0xd6ff,
+ 0xd7e0, 0xd7f5, 0xd7ea, 0xd7ff, 0xf855, 0xf8aa, 0xf8e0, 0xf8f5,
+ 0xf8ea, 0xf8ff, 0xf9e0, 0xf9f5, 0xf9ea, 0xf9ff, 0xfae0, 0xfaf5,
+ 0xfaea, 0xfaff, 0xfbe0, 0xfbf5, 0xfbea, 0xfbff, 0xfce0, 0xfcf5,
+ 0xfcea, 0xfcff, 0xfde0, 0xfdf5, 0xfdea, 0xfdff, 0xfee0, 0xfef5,
+ 0xfeea, 0xfeff, 0xfff5, 0xffea, 0xceff, 0xfeff, 0x37ff, 0x67ff,
+ 0x9fff, 0xcfff, 0x03e0, 0x03f5, 0x03ea, 0x03ff, 0x04e0, 0x04f5,
+ 0x04ea, 0x04ff, 0x05e0, 0x05f5, 0x05ea, 0x05ff, 0x06e0, 0x06f5,
+ 0x06ea, 0x06ff, 0x07f5, 0x07ea, 0x2800, 0x2855, 0x28aa, 0x28ff,
+ 0x28e0, 0x28f5, 0x28ea, 0x28ff, 0x29e0, 0x29f5, 0xfff0, 0xa5a4,
+ 0x8480, 0xf800, 0x07e0, 0xffe0, 0x00ff, 0xf8ff, 0x07ff, 0xffff
+};
+
+static u_int16_t __color_tab16[] = {
+ RGB565_BLACK,
+ RGB565_RED,
+ RGB565_GREEN,
+ RGB565_YELLOW,
+ RGB565_BLUE,
+ RGB565_MAGENTA,
+ RGB565_CYAN,
+ RGB565_WHITE
+};
+
+static int bootinfo_fb_depth(void);
+static void __dbg_lcd_test8(vaddr_t, int, int);
+static void __dbg_lcd_test16(vaddr_t, int, int);
+
+void
+dbg_lcd_test()
+{
+ vaddr_t fbaddr;
+ int w, h;
+
+ if (bootinfo == NULL || bootinfo->fb_addr == NULL)
+ return;
+
+ fbaddr = (vaddr_t)bootinfo->fb_addr;
+ w = bootinfo->fb_width;
+ h = bootinfo->fb_height;
+
+ switch (bootinfo_fb_depth()) {
+ default:
+ break;
+ case 8:
+ __dbg_lcd_test8(fbaddr, w, h);
+ break;
+ case 16:
+ __dbg_lcd_test16(fbaddr, w, h);
+ break;
+ }
+}
+
+/*
+ * 8bpp LCD test routine.
+ * HP620LX, HPW50PAD are little-endian display.
+ */
+void
+__dbg_lcd_test8(vaddr_t fbaddr, int w, int h)
+{
+ u_int8_t *fb, *fb_start = (u_int8_t *)fbaddr;
+ int i, x, y, y_start, y_end, len, skip;
+ u_int16_t *fb16;
+ u_int32_t *fb32;
+
+ /*
+ * Clear screen (BLACK)
+ */
+ for (fb = fb_start, i = 0; i < w * h; i++)
+ *fb++ = 0;
+
+ /*
+ * Color bar (I assume palette index is ANSI)
+ * BLACK|RED|GREEN|YELLOW|BLUE|MAGENTA|CYAN|WHITE
+ */
+ len = w / 8;
+ y_start = 0;
+ y_end = h / 2;
+ skip = bootinfo->fb_line_bytes - w;
+ for (fb = fb_start, y = y_start; y < y_end; y++, fb += skip) {
+ for (i = 0; i < 8; i++) {
+ for (x = 0; x < len; x++)
+ *fb++ = i;
+ }
+ }
+
+ /*
+ * Byte order test. (display 32x32 bitmap)
+ */
+ /* 8-bit access (reference) */
+ y_start = y_end;
+ y_end = y_start + 32;
+ i = 0;
+ fb += w / 2 - 16; /* center */
+ skip = bootinfo->fb_line_bytes - 32;
+ for (y = y_start; y < y_end; y++, fb += skip)
+ for (x = 0; x < 32; x++)
+ *fb++ = img[i++];
+
+ /*
+ * 16-bit access (test)
+ * !HPCFB_REVORDER_BYTE test.
+ */
Home |
Main Index |
Thread Index |
Old Index