4.104.114.84.95
Last change
on this file since 21bfd93 was
30ba752,
checked in by Joel Sherrill <joel.sherrill@…>, on 09/21/98 at 00:01:26
|
Patch from Eric Norum:
I fixed the problems noted by Victor Vengerov.
1) Fix typo in cfsetispeed().
2) In rtems_termios_open, ensure that args->iop->data1 is set before calling
device-specific open routine.
|
-
Property mode set to
100644
|
File size:
883 bytes
|
Line | |
---|
1 | /* |
---|
2 | * This file contains the RTEMS implementation of the POSIX API |
---|
3 | * routines cfgetispeed, cfgetospeed, cfsetispeed and cfsetospeed. |
---|
4 | * |
---|
5 | * $Id$ |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include <rtems.h> |
---|
10 | #if defined(RTEMS_NEWLIB) |
---|
11 | |
---|
12 | #include <sys/types.h> |
---|
13 | #include <sys/stat.h> |
---|
14 | #include <errno.h> |
---|
15 | #include <termios.h> |
---|
16 | |
---|
17 | #include "internal.h" |
---|
18 | #include "libio.h" |
---|
19 | |
---|
20 | speed_t |
---|
21 | cfgetospeed(const struct termios *tp) |
---|
22 | { |
---|
23 | return tp->c_cflag & CBAUD; |
---|
24 | } |
---|
25 | |
---|
26 | int |
---|
27 | cfsetospeed(struct termios *tp, speed_t speed) |
---|
28 | { |
---|
29 | if (speed & ~CBAUD) { |
---|
30 | errno = EINVAL; |
---|
31 | return -1; |
---|
32 | } |
---|
33 | tp->c_cflag = (tp->c_cflag & ~CBAUD) | speed; |
---|
34 | return 0; |
---|
35 | } |
---|
36 | |
---|
37 | speed_t |
---|
38 | cfgetispeed(const struct termios *tp) |
---|
39 | { |
---|
40 | return (tp->c_cflag / (CIBAUD / CBAUD)) & CBAUD; |
---|
41 | } |
---|
42 | |
---|
43 | int |
---|
44 | cfsetispeed(struct termios *tp, speed_t speed) |
---|
45 | { |
---|
46 | if (speed & ~CBAUD) { |
---|
47 | errno = EINVAL; |
---|
48 | return -1; |
---|
49 | } |
---|
50 | tp->c_cflag = (tp->c_cflag & ~CIBAUD) | (speed * (CIBAUD / CBAUD)); |
---|
51 | return 0; |
---|
52 | } |
---|
53 | |
---|
54 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.