1 /* $NetBSD: cons.h,v 1.25 2006/06/01 00:43:37 uwe Exp $ */
4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
8 * the Systems Programming Group of the University of Utah Computer
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * from: Utah $Hdr: cons.h 1.6 92/01/21$
37 * @(#)cons.h 8.1 (Berkeley) 6/10/93
41 * Copyright (c) 1988 University of Utah.
43 * This code is derived from software contributed to Berkeley by
44 * the Systems Programming Group of the University of Utah Computer
47 * Redistribution and use in source and binary forms, with or without
48 * modification, are permitted provided that the following conditions
50 * 1. Redistributions of source code must retain the above copyright
51 * notice, this list of conditions and the following disclaimer.
52 * 2. Redistributions in binary form must reproduce the above copyright
53 * notice, this list of conditions and the following disclaimer in the
54 * documentation and/or other materials provided with the distribution.
55 * 3. All advertising materials mentioning features or use of this software
56 * must display the following acknowledgement:
57 * This product includes software developed by the University of
58 * California, Berkeley and its contributors.
59 * 4. Neither the name of the University nor the names of its contributors
60 * may be used to endorse or promote products derived from this software
61 * without specific prior written permission.
63 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
64 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
65 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
66 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
67 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
68 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
69 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
70 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
71 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
72 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
75 * from: Utah $Hdr: cons.h 1.6 92/01/21$
77 * @(#)cons.h 8.1 (Berkeley) 6/10/93
80 #ifndef _SYS_DEV_CONS_H_
81 #define _SYS_DEV_CONS_H_
84 void (*cn_probe
) /* probe hardware and fill in consdev info */
86 void (*cn_init
) /* turn on as console */
88 int (*cn_getc
) /* kernel getchar interface */
90 void (*cn_putc
) /* kernel putchar interface */
92 void (*cn_pollc
) /* turn on and off polling */
94 void (*cn_bell
) /* ring bell */
95 (dev_t
, u_int
, u_int
, u_int
);
96 void (*cn_halt
) /* stop device */
98 void (*cn_flush
) /* flush output */
100 dev_t cn_dev
; /* major/minor of device */
101 int cn_pri
; /* pecking order; the higher the better */
104 /* values for cn_pri - reflect our policy for console selection */
105 #define CN_DEAD 0 /* device doesn't exist */
106 #define CN_NULL 1 /* noop console */
107 #define CN_NORMAL 2 /* device exists but is nothing special */
108 #define CN_INTERNAL 3 /* "internal" bit-mapped display */
109 #define CN_REMOTE 4 /* serial interface with remote bit set */
113 extern struct consdev constab
[];
114 extern struct consdev
*cn_tab
;
118 int cngetsn(char *, int);
121 void cnbell(u_int
, u_int
, u_int
);
125 void nullcnprobe(struct consdev
*);
126 void nullcninit(struct consdev
*);
127 void nullcnpollc(dev_t
, int);
128 void nullconsattach(int);
130 /* console-specific types */
131 #define dev_type_cnprobe(n) void n(struct consdev *)
132 #define dev_type_cninit(n) void n(struct consdev *)
133 #define dev_type_cngetc(n) int n(dev_t)
134 #define dev_type_cnputc(n) void n(dev_t, int)
135 #define dev_type_cnpollc(n) void n(dev_t, int)
136 #define dev_type_cnbell(n) void n(dev_t, u_int, u_int, u_int)
137 #define dev_type_cnhalt(n) void n(dev_t)
138 #define dev_type_cnflush(n) void n(dev_t)
140 #define dev_decl(n,t) __CONCAT(dev_type_,t)(__CONCAT(n,t))
141 #define dev_init(n,t) __CONCAT(n,t)
143 #define cons_decl(n) \
144 dev_decl(n,cnprobe); dev_decl(n,cninit); dev_decl(n,cngetc); \
145 dev_decl(n,cnputc); dev_decl(n,cnpollc); dev_decl(n,cnbell); \
146 dev_decl(n,cnflush); dev_decl(n,cnhalt);
148 #define cons_init(n) { \
149 dev_init(n,cnprobe), dev_init(n,cninit), dev_init(n,cngetc), \
150 dev_init(n,cnputc), dev_init(n,cnpollc), NULL, NULL, NULL, \
153 #define cons_init_bell(n) { \
154 dev_init(n,cnprobe), dev_init(n,cninit), dev_init(n,cngetc), \
155 dev_init(n,cnputc), dev_init(n,cnpollc), dev_init(n,cnbell) }
157 #define cons_init_halt(n) { \
158 dev_init(n,cnprobe), dev_init(n,cninit), dev_init(n,cngetc), \
159 dev_init(n,cnputc), dev_init(n,cnpollc), 0, \
164 #endif /* _SYS_DEV_CONS_H_ */