xref: /netbsd-src/sys/arch/sgimips/stand/common/getchar.c (revision 23347d39ed32835d3b56fee0427953d4f958b460)
1*23347d39Smatt /*	$NetBSD: getchar.c,v 1.8 2011/02/20 07:59:52 matt Exp $	 */
24e63f44fSthorpej 
34e63f44fSthorpej /*-
44e63f44fSthorpej  * Copyright (c) 1999 The NetBSD Foundation, Inc.
54e63f44fSthorpej  * All rights reserved.
64e63f44fSthorpej  *
74e63f44fSthorpej  * This code is derived from software contributed to The NetBSD Foundation
84e63f44fSthorpej  * by Jonathan Stone, Michael Hitch and Simon Burge.
94e63f44fSthorpej  *
104e63f44fSthorpej  * Redistribution and use in source and binary forms, with or without
114e63f44fSthorpej  * modification, are permitted provided that the following conditions
124e63f44fSthorpej  * are met:
134e63f44fSthorpej  * 1. Redistributions of source code must retain the above copyright
144e63f44fSthorpej  *    notice, this list of conditions and the following disclaimer.
154e63f44fSthorpej  * 2. Redistributions in binary form must reproduce the above copyright
164e63f44fSthorpej  *    notice, this list of conditions and the following disclaimer in the
174e63f44fSthorpej  *    documentation and/or other materials provided with the distribution.
184e63f44fSthorpej  *
194e63f44fSthorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
204e63f44fSthorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
214e63f44fSthorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
224e63f44fSthorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
234e63f44fSthorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
244e63f44fSthorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
254e63f44fSthorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
264e63f44fSthorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
274e63f44fSthorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
284e63f44fSthorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
294e63f44fSthorpej  * POSSIBILITY OF SUCH DAMAGE.
304e63f44fSthorpej  */
314e63f44fSthorpej 
324e63f44fSthorpej #include <lib/libsa/stand.h>
334e63f44fSthorpej #include <dev/arcbios/arcbios.h>
344e63f44fSthorpej 
354e63f44fSthorpej int
getchar(void)36fa657c9cStsutsui getchar(void)
374e63f44fSthorpej {
384e63f44fSthorpej 	char ch;
39d0112ff3Stsutsui 	u_long count;
404e63f44fSthorpej 
41*23347d39Smatt 	if (arcbios_Read(0, &ch, 1, &count) != ARCBIOS_ESUCCESS)
42fa657c9cStsutsui 		return -1;
43fa657c9cStsutsui 
44fa657c9cStsutsui 	return ch;
454e63f44fSthorpej }
46