Home | History | Annotate | Line # | Download | only in dev
nextcons.c revision 1.12
      1 /*	$NetBSD: nextcons.c,v 1.12 2023/02/03 23:13:00 tsutsui Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1999 Darrin B. Jewell
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26  */
     27 
     28 #include <sys/cdefs.h>
     29 __KERNEL_RCSID(0, "$NetBSD: nextcons.c,v 1.12 2023/02/03 23:13:00 tsutsui Exp $");
     30 
     31 #include <sys/param.h>
     32 #include <sys/systm.h>
     33 #include <sys/kernel.h>
     34 #include <sys/proc.h>
     35 #include <sys/device.h>
     36 #include <sys/malloc.h>
     37 #include <sys/errno.h>
     38 #include <sys/queue.h>
     39 #include <sys/bus.h>
     40 #include <sys/cpu.h>
     41 #include <sys/intr.h>
     42 
     43 #include <machine/autoconf.h>
     44 
     45 #include <dev/cons.h>
     46 #include <dev/wscons/wskbdvar.h>
     47 #include <dev/wscons/wsdisplayvar.h>
     48 
     49 #include <next68k/dev/intiovar.h>
     50 #include <next68k/dev/nextdisplayvar.h>
     51 #include <next68k/dev/nextkbdvar.h>
     52 
     53 #include <next68k/next68k/nextrom.h>
     54 
     55 void nextcnprobe(struct consdev *);
     56 void nextcninit(struct consdev *);
     57 int nextcngetc(dev_t);
     58 void nextcnputc(dev_t, int);
     59 void nextcnpollc(dev_t, int);
     60 
     61 
     62 void
     63 nextcnprobe(struct consdev *cp)
     64 {
     65 
     66 	if (rom_machine_type == NeXT_WARP9 ||
     67 	    rom_machine_type == NeXT_X15 ||
     68 	    rom_machine_type == NeXT_WARP9C ||
     69 	    rom_machine_type == NeXT_TURBO_MONO ||
     70 	    rom_machine_type == NeXT_TURBO_COLOR)
     71 		cp->cn_pri = CN_INTERNAL;
     72 	else
     73 		cp->cn_pri = CN_DEAD;
     74 
     75 	cp->cn_dev = NODEV;
     76 }
     77 
     78 void
     79 nextcninit(struct consdev *cp)
     80 {
     81 
     82 	nextkbd_cnattach(NEXT68K_INTIO_BUS_SPACE);
     83 	nextdisplay_cnattach();
     84 }
     85 
     86 int
     87 nextcngetc (dev_t dev)
     88 {
     89 
     90 	return wskbd_cngetc(dev);
     91 }
     92 
     93 void
     94 nextcnputc(dev_t dev, int c)
     95 {
     96 
     97 	wsdisplay_cnputc(dev,c);
     98 }
     99 
    100 void
    101 nextcnpollc(dev_t dev, int on)
    102 {
    103 
    104 	wskbd_cnpollc(dev,on);
    105 }
    106