ofw_console.c (110509) | ofw_console.c (111194) |
---|---|
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[] = | 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 110509 2003-02-07 16:20:09Z harti $"; | 28 "$FreeBSD: head/sys/dev/ofw/ofw_console.c 111194 2003-02-20 20:54:45Z phk $"; |
29#endif /* not lint */ 30 31#include "opt_ddb.h" 32#include "opt_comconsole.h" 33 34#include <sys/param.h> 35#include <sys/kernel.h> 36#include <sys/systm.h> --- 182 unchanged lines hidden (view full) --- 219 220 if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) { 221 ttwwakeup(tp); 222 return; 223 } 224 225 tp->t_state |= TS_BUSY; 226 while (tp->t_outq.c_cc != 0) { | 29#endif /* not lint */ 30 31#include "opt_ddb.h" 32#include "opt_comconsole.h" 33 34#include <sys/param.h> 35#include <sys/kernel.h> 36#include <sys/systm.h> --- 182 unchanged lines hidden (view full) --- 219 220 if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) { 221 ttwwakeup(tp); 222 return; 223 } 224 225 tp->t_state |= TS_BUSY; 226 while (tp->t_outq.c_cc != 0) { |
227 ofw_cons_putc(tp->t_dev, getc(&tp->t_outq)); | 227 ofw_cons_putc(NULL, getc(&tp->t_outq)); |
228 } 229 tp->t_state &= ~TS_BUSY; 230 231 ttwwakeup(tp); 232} 233 234static void 235ofw_tty_stop(struct tty *tp, int flag) --- 9 unchanged lines hidden (view full) --- 245static void 246ofw_timeout(void *v) 247{ 248 struct tty *tp; 249 int c; 250 251 tp = (struct tty *)v; 252 | 228 } 229 tp->t_state &= ~TS_BUSY; 230 231 ttwwakeup(tp); 232} 233 234static void 235ofw_tty_stop(struct tty *tp, int flag) --- 9 unchanged lines hidden (view full) --- 245static void 246ofw_timeout(void *v) 247{ 248 struct tty *tp; 249 int c; 250 251 tp = (struct tty *)v; 252 |
253 while ((c = ofw_cons_checkc(tp->t_dev)) != -1) { | 253 while ((c = ofw_cons_checkc(NULL)) != -1) { |
254 if (tp->t_state & TS_ISOPEN) { 255 (*linesw[tp->t_line].l_rint)(c, tp); 256 } 257 } 258 259 ofw_timeouthandle = timeout(ofw_timeout, tp, polltime); 260} 261 --- 25 unchanged lines hidden (view full) --- 287ofw_cons_init(struct consdev *cp) 288{ 289 290 cp->cn_dev = makedev(CDEV_MAJOR, 0); 291 cp->cn_tp = ofw_tp; 292} 293 294static int | 254 if (tp->t_state & TS_ISOPEN) { 255 (*linesw[tp->t_line].l_rint)(c, tp); 256 } 257 } 258 259 ofw_timeouthandle = timeout(ofw_timeout, tp, polltime); 260} 261 --- 25 unchanged lines hidden (view full) --- 287ofw_cons_init(struct consdev *cp) 288{ 289 290 cp->cn_dev = makedev(CDEV_MAJOR, 0); 291 cp->cn_tp = ofw_tp; 292} 293 294static int |
295ofw_cons_getc(dev_t dev) | 295ofw_cons_getc(struct consdev *cp) |
296{ 297 unsigned char ch; 298 int l; 299 300 ch = '\0'; 301 302 while ((l = OF_read(stdin, &ch, 1)) != 1) { 303 if (l != -2 && l != 0) { --- 5 unchanged lines hidden (view full) --- 309 if (db_alt_break(ch, &alt_break_state)) 310 breakpoint(); 311#endif 312 313 return (ch); 314} 315 316static int | 296{ 297 unsigned char ch; 298 int l; 299 300 ch = '\0'; 301 302 while ((l = OF_read(stdin, &ch, 1)) != 1) { 303 if (l != -2 && l != 0) { --- 5 unchanged lines hidden (view full) --- 309 if (db_alt_break(ch, &alt_break_state)) 310 breakpoint(); 311#endif 312 313 return (ch); 314} 315 316static int |
317ofw_cons_checkc(dev_t dev) | 317ofw_cons_checkc(struct consdev *cp) |
318{ 319 unsigned char ch; 320 321 if (OF_read(stdin, &ch, 1) > 0) { 322#if defined(DDB) && defined(ALT_BREAK_TO_DEBUGGER) 323 if (db_alt_break(ch, &alt_break_state)) 324 breakpoint(); 325#endif 326 return (ch); 327 } 328 329 return (-1); 330} 331 332static void | 318{ 319 unsigned char ch; 320 321 if (OF_read(stdin, &ch, 1) > 0) { 322#if defined(DDB) && defined(ALT_BREAK_TO_DEBUGGER) 323 if (db_alt_break(ch, &alt_break_state)) 324 breakpoint(); 325#endif 326 return (ch); 327 } 328 329 return (-1); 330} 331 332static void |
333ofw_cons_putc(dev_t dev, int c) | 333ofw_cons_putc(struct consdev *cp, int c) |
334{ 335 char cbuf; 336 337 if (c == '\n') { 338 cbuf = '\r'; 339 OF_write(stdout, &cbuf, 1); 340 } 341 342 cbuf = c; 343 OF_write(stdout, &cbuf, 1); 344} | 334{ 335 char cbuf; 336 337 if (c == '\n') { 338 cbuf = '\r'; 339 OF_write(stdout, &cbuf, 1); 340 } 341 342 cbuf = c; 343 OF_write(stdout, &cbuf, 1); 344} |