Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / zaurus / stand / zboot / termios.c
blob20d58d853a6a171ca022f4c630902fdd28f6932b
1 /* $NetBSD$ */
2 /* $OpenBSD: termios.c,v 1.2 2005/05/24 20:38:20 uwe Exp $ */
4 /*-
5 * Copyright (c) 1989, 1993
6 * The Regents of the University of California. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
33 #include "boot.h"
34 #include "unixdev.h"
36 #include "compat_linux.h"
37 #include "termios.h"
39 int
40 linux_cfsetspeed(struct linux_termios *t, linux_speed_t speed)
42 int mask;
43 int i;
45 mask = LINUX_B9600; /* XXX default value should this be 0? */
46 for (i = 0; i < __arraycount(linux_speeds); i++) {
47 if (speed == linux_speeds[i]) {
48 mask = linux_spmasks[i];
49 break;
52 if (i == __arraycount(linux_speeds))
53 return -1;
55 t->c_cflag &= ~LINUX_CBAUD;
56 t->c_cflag |= mask;
57 return 0;
60 void
61 linux_cfmakeraw(struct linux_termios *t)
64 t->c_iflag &= ~(LINUX_IMAXBEL
65 |LINUX_IGNBRK
66 |LINUX_BRKINT
67 |LINUX_PARMRK
68 |LINUX_ISTRIP
69 |LINUX_INLCR
70 |LINUX_IGNCR
71 |LINUX_ICRNL
72 |LINUX_IXON);
73 t->c_oflag &= ~LINUX_OPOST;
74 t->c_lflag &= ~(LINUX_ECHO
75 |LINUX_ECHONL
76 |LINUX_ICANON
77 |LINUX_ISIG
78 |LINUX_IEXTEN);
79 t->c_cflag &= ~(LINUX_CSIZE|LINUX_PARENB);
80 t->c_cflag |= LINUX_CS8;
83 int
84 linux_tcgetattr(int fd, struct linux_termios *t)
87 return uioctl(fd, LINUX_TCGETS, t);
90 /* This function differs slightly from tcsetattr() in libc. */
91 int
92 linux_tcsetattr(int fd, int action, struct linux_termios *t)
95 switch (action) {
96 case LINUX_TCSETS:
97 case LINUX_TCSETSW:
98 case LINUX_TCSETSF:
99 break;
101 default:
102 errno = EINVAL;
103 return -1;
105 return uioctl(fd, action, t);
108 void dummycall(void);
109 void
110 dummycall(void)
113 (void)linux_termio_to_bsd_termios;
114 (void)bsd_termios_to_linux_termio;
115 (void)linux_termios_to_bsd_termios;
116 (void)bsd_termios_to_linux_termios;