5
Last change
on this file since 94a4865 was
1c6926c1,
checked in by Kevin Kirspel <kevin-kirspel@…>, on 03/21/17 at 19:39:48
|
termios: Synchronize with latest FreeBSD headers
Adding modified FreeBSD headers to synchronize RTEMS termios with
FreeBSD. Modify termios to support dedicated input and output baud for
termios structure. Updated BSPs to use dedicated input and output baud
in termios structure. Updated tools to use dedicated input and output
baud in termios structure. Updated termios testsuites to use dedicated
input and output baud in termios structure.
Close #2897.
|
-
Property mode set to
100644
|
File size:
1000 bytes
|
Line | |
---|
1 | /* |
---|
2 | * Copyright (c) 2014 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Dornierstr. 4 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <rtems@embedded-brains.de> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.org/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #if HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #include <rtems/termiostypes.h> |
---|
20 | |
---|
21 | void rtems_termios_set_best_baud( |
---|
22 | struct termios *term, |
---|
23 | uint32_t baud |
---|
24 | ) |
---|
25 | { |
---|
26 | const rtems_assoc_t *current = &rtems_termios_baud_table[ 0 ]; |
---|
27 | const rtems_assoc_t *last = current; |
---|
28 | speed_t spd; |
---|
29 | |
---|
30 | while ( current->name != NULL && current->local_value < baud ) { |
---|
31 | last = current; |
---|
32 | ++current; |
---|
33 | } |
---|
34 | |
---|
35 | if ( current->name != NULL ) { |
---|
36 | uint32_t mid = (last->local_value + current->local_value) / UINT32_C( 2 ); |
---|
37 | |
---|
38 | spd = baud <= mid ? last->remote_value : current->remote_value; |
---|
39 | } else { |
---|
40 | spd = B460800; |
---|
41 | } |
---|
42 | |
---|
43 | term->c_ispeed = spd; |
---|
44 | term->c_ospeed = spd; |
---|
45 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.