Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / sys / boot / arc / lib / arcconsole.c
1 /* $FreeBSD: src/sys/boot/arc/lib/arcconsole.c,v 1.2 1999/08/28 00:39:36 peter Exp $ */
2 /* $DragonFly: src/sys/boot/arc/lib/Attic/arcconsole.c,v 1.2 2003/06/17 04:28:16 dillon Exp $ */
3 /* $NetBSD: prom.c,v 1.3 1997/09/06 14:03:58 drochner Exp $ */
4
5 /*  
6  * Mach Operating System
7  * Copyright (c) 1992 Carnegie Mellon University
8  * All Rights Reserved.
9  * 
10  * Permission to use, copy, modify and distribute this software and its
11  * documentation is hereby granted, provided that both the copyright
12  * notice and this permission notice appear in all copies of the
13  * software, derivative works or modified versions, and any portions
14  * thereof, and that both notices appear in supporting documentation.
15  * 
16  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
18  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19  * 
20  * Carnegie Mellon requests users of this software to return to
21  * 
22  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
23  *  School of Computer Science
24  *  Carnegie Mellon University
25  *  Pittsburgh PA 15213-3890
26  * 
27  * any improvements or extensions that they make and grant Carnegie Mellon
28  * the rights to redistribute these changes.
29  */
30
31 #include <sys/types.h>
32
33 #include "bootstrap.h"
34 #include "arctypes.h"
35 #include "arcfuncs.h"
36
37 int console;
38
39 static void arc_probe(struct console *cp);
40 static int arc_init(int);
41 static void arc_putchar(int);
42 static int arc_getchar(void);
43 static int arc_poll(void);
44
45 struct console arcconsole = {
46     "arc",
47     "ARC firmware console",
48     0,
49     arc_probe,
50     arc_init,
51     arc_putchar,
52     arc_getchar,
53     arc_poll,
54 };
55
56 static void
57 arc_probe(struct console *cp)
58 {
59     cp->c_flags |= C_PRESENTIN|C_PRESENTOUT;
60 }
61
62 static int
63 arc_init(int arg)
64 {
65     return 0;
66 }
67
68 static void
69 arc_putchar(int c)
70 {
71     char cbuf = c;
72     u_int32_t count;
73
74     Write(StandardOut, &cbuf, 1, &count);
75 }
76
77 static int saved_char = -1;
78
79 int
80 arc_getchar()
81 {
82     char cbuf;
83     u_int32_t count;
84
85     arc_putchar('_');
86     arc_putchar('\b');
87     Read(StandardIn, &cbuf, 1, &count);
88     arc_putchar(' ');
89     arc_putchar('\b');
90     if (count == 1)
91         return cbuf;
92     else
93         return -1;
94 }
95
96 int
97 arc_poll()
98 {
99     return GetReadStatus(StandardIn) == ESUCCESS;
100 }
101
102 int
103 arc_open(dev, len)
104     char *dev;
105     int len;
106 {
107     return 0;
108 }