1 .\" $NetBSD: cons.9,v 1.15 2006/01/03 02:17:22 rumble Exp $
3 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
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.
15 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 .\" POSSIBILITY OF SUCH DAMAGE.
38 .Nd console access interface
42 .Fn cnbell "u_int pitch" "u_int period" "u_int volume"
48 .Fn cngetsn "char *cp" "int size"
56 These functions operate over the current console device.
57 The console must be initialized before these functions can be used.
59 Console input polling functions
64 are only to be used during initial system
65 boot, e.g., when asking for root and dump device or to get
66 necessary user input within mountroothooks.
67 Once the system boots, user input is read via standard
71 The following is a brief description of each function:
72 .Bl -tag -width "cngetsn()"
74 Ring a bell at appropriate
82 value is ignored commonly.
84 Waits for all pending output to finish.
86 Poll (busy wait) for an input and return the input key.
87 Returns 0 if there is no console input device.
94 should be used during kernel startup only.
96 Read one line of user input, stop reading once the newline
103 Number of read characters is
105 at maximum, user is notified by console bell when the end
106 of input buffer is reached.
107 \*[Lt]Backspace\*[Gt] key works as expected.
108 \*[Lt]@\*[Gt] or \*[Lt]CTRL\*[Gt]-u make
110 discard input read so far, print newline and
113 returns number of characters actually read, excluding
118 zero-ended before return.
120 should be used during kernel startup only.
122 Terminates the console device (i.e. cleanly shuts down the console hardware.)
124 Switch the console driver to polling mode if
126 is nonzero, or back to interrupt driven mode if
130 should be used during kernel startup only.
132 Console kernel output character routine.
133 Commonly, kernel code uses
135 rather than using this low-level interface.
138 This waits until a \*[Lt]Enter\*[Gt] key is pressed:
140 .Bd -literal -compact
146 if ((c == '\\r' || (c == '\\n')) {