Annotation of sys/arch/mac68k/mac68k/wscons_machdep.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: wscons_machdep.c,v 1.5 2006/01/18 23:21:17 miod Exp $ */
2: /* $NetBSD: maccons.c,v 1.5 2005/01/15 16:00:59 chs Exp $ */
3:
4: /*
5: * Copyright (C) 1999 Scott Reynolds. 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. The name of the author may not be used to endorse or promote products
16: * derived from this software without specific prior written permission.
17: *
18: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28: */
29:
30: #include <sys/param.h>
31: #include <sys/systm.h>
32: #include <sys/device.h>
33: #include <sys/conf.h>
34: #include <sys/timeout.h>
35:
36: #include <machine/autoconf.h>
37: #include <machine/bus.h>
38: #include <machine/cpu.h>
39:
40: #include <dev/cons.h>
41:
42: #include <dev/wscons/wskbdvar.h>
43: #include <dev/wscons/wsdisplayvar.h>
44: #include <dev/rasops/rasops.h>
45:
46: #include <mac68k/dev/nubus.h>
47: #include <mac68k/dev/macfbvar.h>
48: #include <dev/adb/akbdvar.h>
49:
50: #include "wsdisplay.h"
51: #include "wskbd.h"
52:
53: cons_decl(ws);
54:
55: int maccons_initted = (-1);
56:
57: void
58: wscnprobe(struct consdev *cp)
59: {
60: #if NWSDISPLAY > 0
61: int maj, unit;
62: #endif
63:
64: cp->cn_dev = NODEV;
65: cp->cn_pri = CN_NORMAL;
66:
67: #if NWSDISPLAY > 0
68: unit = 0;
69: for (maj = 0; maj < nchrdev; maj++)
70: if (cdevsw[maj].d_open == wsdisplayopen)
71: break;
72:
73: if (maj != nchrdev) {
74: cp->cn_pri = CN_INTERNAL;
75: cp->cn_dev = makedev(maj, unit);
76: }
77: #endif
78: }
79:
80: void
81: wscninit(struct consdev *cp)
82: {
83: /*
84: * XXX evil hack; see consinit() for an explanation.
85: * note: maccons_initted is initialized to (-1).
86: */
87: if (++maccons_initted > 0) {
88: macfb_cnattach();
89: akbd_cnattach();
90: }
91: }
92:
93: int
94: wscngetc(dev_t dev)
95: {
96: #if NWSKBD > 0
97: return wskbd_cngetc(dev);
98: #else
99: return 0;
100: #endif
101: }
102:
103: void
104: wscnputc(dev_t dev, int c)
105: {
106: #if NWSDISPLAY > 0
107: wsdisplay_cnputc(dev,c);
108: #endif
109: }
110:
111: void
112: wscnpollc(dev_t dev, int on)
113: {
114: #if NWSKBD > 0
115: wskbd_cnpollc(dev,on);
116: #endif
117: }
CVSweb