Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Add support for WSCONS screenblank ioctls. From ...



details:   https://anonhg.NetBSD.org/src/rev/d95126b39163
branches:  trunk
changeset: 521095:d95126b39163
user:      lukem <lukem%NetBSD.org@localhost>
date:      Wed Jan 23 17:11:38 2002 +0000

description:
Add support for WSCONS screenblank ioctls.  From Phil Budne in [kern/15213].

diffstat:

 sys/dev/ic/vga.c |  47 +++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 43 insertions(+), 4 deletions(-)

diffs (77 lines):

diff -r 35300699c98f -r d95126b39163 sys/dev/ic/vga.c
--- a/sys/dev/ic/vga.c  Wed Jan 23 16:57:51 2002 +0000
+++ b/sys/dev/ic/vga.c  Wed Jan 23 17:11:38 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vga.c,v 1.45 2001/12/13 08:31:39 junyoung Exp $ */
+/* $NetBSD: vga.c,v 1.46 2002/01/23 17:11:38 lukem Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.45 2001/12/13 08:31:39 junyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.46 2002/01/23 17:11:38 lukem Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -662,6 +662,38 @@
        return (0);
 }
 
+#define        VGA_TS_BLANK    0x20
+
+static int
+vga_get_video(struct vga_config *vc)
+{
+       return (vga_ts_read(&vc->hdl, mode) & VGA_TS_BLANK) == 0;
+}
+
+static void
+vga_set_video(struct vga_config *vc, int state)
+{
+       int val;
+
+       vga_ts_write(&vc->hdl, syncreset, 0x01);
+       if (state) {                                    /* unblank screen */
+               val = vga_ts_read(&vc->hdl, mode);
+               vga_ts_write(&vc->hdl, mode, val & ~VGA_TS_BLANK);
+#ifndef VGA_NO_VBLANK
+               val = vga_6845_read(&vc->hdl, mode);
+               vga_6845_write(&vc->hdl, mode, val | 0x80);
+#endif
+       } else {                                        /* blank screen */
+               val = vga_ts_read(&vc->hdl, mode);
+               vga_ts_write(&vc->hdl, mode, val | VGA_TS_BLANK);
+#ifndef VGA_NO_VBLANK
+               val = vga_6845_read(&vc->hdl, mode);
+               vga_6845_write(&vc->hdl, mode, val & ~0x80);
+#endif
+       }
+       vga_ts_write(&vc->hdl, syncreset, 0x03);
+}
+
 int
 vga_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
 {
@@ -677,10 +709,17 @@
                /* XXX should get detailed hardware information here */
                return ENOTTY;
 
+       case WSDISPLAYIO_GVIDEO:
+               *(int *)data = (vga_get_video(vc) ? WSDISPLAYIO_VIDEO_ON :
+                               WSDISPLAYIO_VIDEO_OFF);
+               return 0;
+
+       case WSDISPLAYIO_SVIDEO:
+               vga_set_video(vc, *(int *)data == WSDISPLAYIO_VIDEO_ON);
+               return 0;
+
        case WSDISPLAYIO_GETCMAP:
        case WSDISPLAYIO_PUTCMAP:
-       case WSDISPLAYIO_GVIDEO:
-       case WSDISPLAYIO_SVIDEO:
        case WSDISPLAYIO_GCURPOS:
        case WSDISPLAYIO_SCURPOS:
        case WSDISPLAYIO_GCURMAX:



Home | Main Index | Thread Index | Old Index