1 /* console.c: Routines that deal with sending and receiving IO
2 * to/from the current console device using the PROM.
4 * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
8 #include <linux/types.h>
9 #include <linux/kernel.h>
10 #include <linux/sched.h>
11 #include <asm/openprom.h>
12 #include <asm/oplib.h>
13 #include <asm/system.h>
14 #include <linux/string.h>
16 extern int prom_stdin, prom_stdout;
18 /* Non blocking get character from console input device, returns -1
19 * if no input was taken. This can be used for polling.
26 if (p1275_cmd("read", P1275_ARG(1,P1275_ARG_OUT_BUF)|
28 prom_stdin, &inc, P1275_SIZE(1)) == 1)
34 /* Non blocking put character to console device, returns -1 if
38 prom_nbputchar(char c)
43 if (p1275_cmd("write", P1275_ARG(1,P1275_ARG_IN_BUF)|
45 prom_stdout, &outc, P1275_SIZE(1)) == 1)
51 /* Blocking version of get character routine above. */
56 while((character = prom_nbgetchar()) == -1) ;
57 return (char) character;
60 /* Blocking version of put character routine above. */
69 prom_puts(const char *s, int len)
71 p1275_cmd("write", P1275_ARG(1,P1275_ARG_IN_BUF)|
73 prom_stdout, s, P1275_SIZE(len));