| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ttycons.c,v 1.5 2011/08/28 21:21:05 jmcneill Exp $ */ | | 1 | /* $NetBSD: ttycons.c,v 1.6 2011/12/09 09:27:13 reinoud Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca> | | 4 | * Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca> |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -17,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __KERNEL_RCSID(0, "$NetBSD: ttycons.c,v 1.5 2011/08/28 21:21:05 jmcneill Exp $"); | | 30 | __KERNEL_RCSID(0, "$NetBSD: ttycons.c,v 1.6 2011/12/09 09:27:13 reinoud Exp $"); |
31 | | | 31 | |
32 | #include <sys/param.h> | | 32 | #include <sys/param.h> |
33 | #include <sys/proc.h> | | 33 | #include <sys/proc.h> |
34 | #include <sys/systm.h> | | 34 | #include <sys/systm.h> |
35 | #include <sys/device.h> | | 35 | #include <sys/device.h> |
36 | #include <sys/termios.h> | | 36 | #include <sys/termios.h> |
37 | | | 37 | |
38 | #include <dev/cons.h> | | 38 | #include <dev/cons.h> |
39 | | | 39 | |
40 | #include <machine/mainbus.h> | | 40 | #include <machine/mainbus.h> |
41 | #include <machine/thunk.h> | | 41 | #include <machine/thunk.h> |
42 | | | 42 | |
43 | static int ttycons_match(device_t, cfdata_t, void *); | | 43 | static int ttycons_match(device_t, cfdata_t, void *); |
| @@ -89,28 +89,26 @@ void | | | @@ -89,28 +89,26 @@ void |
89 | ttycons_consinit(void) | | 89 | ttycons_consinit(void) |
90 | { | | 90 | { |
91 | struct thunk_termios t; | | 91 | struct thunk_termios t; |
92 | | | 92 | |
93 | thunk_tcgetattr(0, &t); | | 93 | thunk_tcgetattr(0, &t); |
94 | t.c_lflag &= ~(ECHO|ICANON); | | 94 | t.c_lflag &= ~(ECHO|ICANON); |
95 | t.c_cc[VTIME] = 0; | | 95 | t.c_cc[VTIME] = 0; |
96 | t.c_cc[VMIN] = 1; | | 96 | t.c_cc[VMIN] = 1; |
97 | thunk_tcsetattr(0, TCSANOW, &t); | | 97 | thunk_tcsetattr(0, TCSANOW, &t); |
98 | | | 98 | |
99 | cn_tab = &ttycons_consdev; | | 99 | cn_tab = &ttycons_consdev; |
100 | cn_init_magic(&ttycons_cnm_state); | | 100 | cn_init_magic(&ttycons_cnm_state); |
101 | cn_set_magic("\047\001"); | | 101 | cn_set_magic("\047\001"); |
102 | | | | |
103 | | | | |
104 | } | | 102 | } |
105 | | | 103 | |
106 | int | | 104 | int |
107 | ttycons_cngetc(dev_t dev) | | 105 | ttycons_cngetc(dev_t dev) |
108 | { | | 106 | { |
109 | return thunk_getchar(); | | 107 | return thunk_getchar(); |
110 | } | | 108 | } |
111 | | | 109 | |
112 | void | | 110 | void |
113 | ttycons_cnputc(dev_t dev, int c) | | 111 | ttycons_cnputc(dev_t dev, int c) |
114 | { | | 112 | { |
115 | thunk_putchar(c); | | 113 | thunk_putchar(c); |
116 | } | | 114 | } |