Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / mac68k / dev / maccons.c
blob04a0d329aa2790bbbf095b2a0bbba69b532943ca
1 /* $NetBSD: maccons.c,v 1.6.38.1 2007/10/03 19:24:06 garbled Exp $ */
3 /*
4 * Copyright (C) 1999 Scott Reynolds. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include <sys/cdefs.h>
30 __KERNEL_RCSID(0, "$NetBSD: maccons.c,v 1.6.38.1 2007/10/03 19:24:06 garbled Exp $");
32 #include "wsdisplay.h"
33 #include "wskbd.h"
34 #include "zsc.h"
36 #include <sys/param.h>
37 #include <sys/systm.h>
38 #include <sys/conf.h>
40 #include <machine/autoconf.h>
41 #include <machine/cpu.h>
43 #include <machine/video.h>
44 #include <dev/cons.h>
45 #include <dev/wscons/wskbdvar.h>
46 #include <dev/wscons/wsdisplayvar.h>
47 #include <mac68k/dev/macfbvar.h>
48 #include <mac68k/dev/akbdvar.h>
50 void maccnprobe(struct consdev *);
51 void maccninit(struct consdev *);
52 int maccngetc(dev_t);
53 void maccnputc(dev_t, int);
54 void maccnpollc(dev_t, int);
56 static int maccons_initted = (-1);
58 void
59 maccnprobe(struct consdev *cp)
61 #if NWSDISPLAY > 0
62 extern const struct cdevsw wsdisplay_cdevsw;
63 int maj, unit;
64 #endif
66 cp->cn_dev = NODEV;
67 cp->cn_pri = CN_NORMAL;
69 #if NWSDISPLAY > 0
70 unit = 0;
71 maj = cdevsw_lookup_major(&wsdisplay_cdevsw);
72 if (maj != -1) {
73 cp->cn_pri = CN_INTERNAL;
74 cp->cn_dev = makedev(maj, unit);
76 #endif
79 void
80 maccninit(struct consdev *cp)
83 * XXX evil hack; see consinit() for an explanation.
84 * note: maccons_initted is initialized to (-1).
86 if (++maccons_initted > 0) {
87 macfb_cnattach(mac68k_video.mv_phys);
88 akbd_cnattach();
92 int
93 maccngetc (dev_t dev)
95 #if NWSKBD > 0
96 if (maccons_initted > 0)
97 return wskbd_cngetc(dev);
98 #endif
99 return 0;
102 void
103 maccnputc(dev_t dev, int c)
105 #if NZSC > 0
106 extern dev_t mac68k_zsdev;
107 extern int zscnputc(dev_t, int);
108 #endif
110 #if NWSDISPLAY > 0
111 if (maccons_initted > 0)
112 wsdisplay_cnputc(dev,c);
113 #endif
114 #if NZSC > 0
115 if (mac68k_machine.serial_boot_echo)
116 zscnputc(mac68k_zsdev, c);
117 #endif
120 void
121 maccnpollc(dev_t dev, int on)
123 #if NWSKBD > 0
124 if (maccons_initted > 0)
125 wskbd_cnpollc(dev,on);
126 #endif