Deleted Added
sdiff udiff text old ( 109921 ) new ( 110509 )
full compact
1/*
2 * Copyright (C) 2001 Benno Rice.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef lint
27static const char rcsid[] =
28 "$FreeBSD: head/sys/dev/ofw/ofw_console.c 109921 2003-01-27 04:42:17Z jake $";
29#endif /* not lint */
30
31#include <sys/param.h>
32#include <sys/kernel.h>
33#include <sys/systm.h>
34#include <sys/types.h>
35#include <sys/conf.h>
36#include <sys/cons.h>
37#include <sys/consio.h>
38#include <sys/tty.h>
39
40#include <dev/ofw/openfirm.h>
41
42#define OFW_POLL_HZ 4
43
44static d_open_t ofw_dev_open;
45static d_close_t ofw_dev_close;
46static d_ioctl_t ofw_dev_ioctl;
47
48#define CDEV_MAJOR 97
49

--- 13 unchanged lines hidden (view full) ---

63 /* flags */ 0,
64};
65
66static struct tty *ofw_tp = NULL;
67static int polltime;
68static struct callout_handle ofw_timeouthandle
69 = CALLOUT_HANDLE_INITIALIZER(&ofw_timeouthandle);
70
71static void ofw_tty_start(struct tty *);
72static int ofw_tty_param(struct tty *, struct termios *);
73static void ofw_tty_stop(struct tty *, int);
74static void ofw_timeout(void *);
75
76static cn_probe_t ofw_cons_probe;
77static cn_init_t ofw_cons_init;
78static cn_getc_t ofw_cons_getc;

--- 212 unchanged lines hidden (view full) ---

291 ch = '\0';
292
293 while ((l = OF_read(stdin, &ch, 1)) != 1) {
294 if (l != -2 && l != 0) {
295 return (-1);
296 }
297 }
298
299 return (ch);
300}
301
302static int
303ofw_cons_checkc(dev_t dev)
304{
305 unsigned char ch;
306
307 if (OF_read(stdin, &ch, 1) > 0) {
308 return (ch);
309 }
310
311 return (-1);
312}
313
314static void
315ofw_cons_putc(dev_t dev, int c)
316{
317 char cbuf;
318
319 if (c == '\n') {
320 cbuf = '\r';
321 OF_write(stdout, &cbuf, 1);
322 }
323
324 cbuf = c;
325 OF_write(stdout, &cbuf, 1);
326}