green_saver.c revision 11857
16628Ssos/*- 26628Ssos * Copyright (c) 1995 S�ren Schmidt 36628Ssos * All rights reserved. 46628Ssos * 56628Ssos * Redistribution and use in source and binary forms, with or without 66628Ssos * modification, are permitted provided that the following conditions 76628Ssos * are met: 86628Ssos * 1. Redistributions of source code must retain the above copyright 98871Srgrimes * notice, this list of conditions and the following disclaimer 106628Ssos * in this position and unchanged. 116628Ssos * 2. Redistributions in binary form must reproduce the above copyright 126628Ssos * notice, this list of conditions and the following disclaimer in the 136628Ssos * documentation and/or other materials provided with the distribution. 146628Ssos * 3. The name of the author may not be used to endorse or promote products 156628Ssos * derived from this software withough specific prior written permission 166628Ssos * 176628Ssos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 186628Ssos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 196628Ssos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 206628Ssos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 216628Ssos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 226628Ssos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 236628Ssos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 246628Ssos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 256628Ssos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 266628Ssos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 276628Ssos * 2811857Speter * $Id: green_saver.c,v 1.2 1995/05/30 06:06:17 rgrimes Exp $ 296628Ssos */ 306628Ssos 316628Ssos#include <sys/param.h> 326628Ssos#include <sys/systm.h> 336628Ssos#include <sys/conf.h> 346628Ssos#include <sys/exec.h> 356628Ssos#include <sys/sysent.h> 366628Ssos#include <sys/lkm.h> 376628Ssos#include <sys/errno.h> 386628Ssos#include <saver.h> 396628Ssos 406628SsosMOD_MISC("green_saver") 416628Ssos 426628Ssosvoid (*current_saver)(); 436628Ssosvoid (*old_saver)(); 446628Ssos 458871Srgrimesstatic void 466628Ssosgreen_saver(int blank) 476628Ssos{ 486628Ssos u_char val; 496628Ssos if (blank) { 506628Ssos scrn_blanked = 1; 518871Srgrimes outb(TSIDX, 0x01); val = inb(TSREG); 526628Ssos outb(TSIDX, 0x01); outb(TSREG, val | 0x20); 536628Ssos outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); 546628Ssos outb(crtc_addr + 1, val & ~0x80); 556628Ssos } 566628Ssos else { 578871Srgrimes outb(TSIDX, 0x01); val = inb(TSREG); 586628Ssos outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); 596628Ssos outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); 606628Ssos outb(crtc_addr + 1, val | 0x80); 616628Ssos scrn_blanked = 0; 626628Ssos } 636628Ssos} 646628Ssos 6511857Spetergreen_saver_load(struct lkm_table *lkmtp, int cmd) 666628Ssos{ 676628Ssos (*current_saver)(0); 686628Ssos old_saver = current_saver; 696628Ssos current_saver = green_saver; 706628Ssos uprintf("green screen saver installed\n"); 716628Ssos return 0; 726628Ssos} 736628Ssos 7411857Spetergreen_saver_unload(struct lkm_table *lkmtp, int cmd) 756628Ssos{ 766628Ssos (*current_saver)(0); 776628Ssos current_saver = old_saver; 786628Ssos uprintf("green screen saver removed\n"); 796628Ssos return 0; 806628Ssos} 816628Ssos 8211857Spetergreen_saver_mod(struct lkm_table *lkmtp, int cmd, int ver) 836628Ssos{ 8411857Speter DISPATCH(lkmtp, cmd, ver, green_saver_load, green_saver_unload, nosys); 856628Ssos} 86