xref: /netbsd-src/sys/arch/next68k/dev/nextcons.c (revision 8b0f9554ff8762542c4defc4f70e1eb76fb508fa)
1 /*	$NetBSD: nextcons.c,v 1.9 2007/01/24 13:08:14 hubertf 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  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *      This product includes software developed by Darrin B. Jewell
18  * 4. The name of the author may not be used to endorse or promote products
19  *    derived from this software without specific prior written permission
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #include <sys/cdefs.h>
34 __KERNEL_RCSID(0, "$NetBSD: nextcons.c,v 1.9 2007/01/24 13:08:14 hubertf Exp $");
35 
36 #include <sys/param.h>
37 #include <sys/systm.h>
38 #include <sys/kernel.h>
39 #include <sys/proc.h>
40 #include <sys/device.h>
41 #include <sys/malloc.h>
42 #include <sys/errno.h>
43 #include <sys/queue.h>
44 #include <sys/lock.h>
45 
46 #include <machine/autoconf.h>
47 #include <machine/bus.h>
48 #include <machine/cpu.h>
49 #include <machine/intr.h>
50 
51 #include <dev/cons.h>
52 #include <dev/wscons/wskbdvar.h>
53 #include <dev/wscons/wsdisplayvar.h>
54 
55 #include <next68k/dev/intiovar.h>
56 #include <next68k/dev/nextdisplayvar.h>
57 #include <next68k/dev/nextkbdvar.h>
58 
59 #include <next68k/next68k/nextrom.h>
60 
61 void nextcnprobe(struct consdev *);
62 void nextcninit(struct consdev *);
63 int nextcngetc(dev_t);
64 void nextcnputc(dev_t, int);
65 void nextcnpollc(dev_t, int);
66 
67 
68 void
69 nextcnprobe(struct consdev *cp)
70 {
71 
72 	if ((rom_machine_type == NeXT_WARP9)
73 	    || (rom_machine_type == NeXT_X15)
74 	    || (rom_machine_type == NeXT_WARP9C)
75 	    || (rom_machine_type == NeXT_TURBO_MONO)
76 	    || (rom_machine_type == NeXT_TURBO_COLOR))
77 		cp->cn_pri = CN_INTERNAL;
78 	else
79 		cp->cn_pri = CN_DEAD;
80 
81 	cp->cn_dev = NODEV;
82 }
83 
84 void
85 nextcninit(struct consdev *cp)
86 {
87 	nextkbd_cnattach(NEXT68K_INTIO_BUS_SPACE);
88 	nextdisplay_cnattach();
89 }
90 
91 int
92 nextcngetc (dev_t dev)
93 {
94 	return wskbd_cngetc(dev);
95 }
96 
97 void
98 nextcnputc(dev_t dev, int c)
99 {
100 	wsdisplay_cnputc(dev,c);
101 }
102 
103 void
104 nextcnpollc(dev_t dev, int on)
105 {
106 	wskbd_cnpollc(dev,on);
107 }
108