source: rtems/cpukit/libcsupport/src/termios_baud2index.c @ 1c6926c1

Last change on this file since 1c6926c1 was 1c6926c1, checked in by Kevin Kirspel <kevin-kirspel@…>, on Mar 21, 2017 at 7:39:48 PM

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: 1.7 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Convert Bxxx Constant to Index
5 *  @ingroup TermiostypesSupport
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2008.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#ifdef HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <sys/termios.h>
22#include <rtems/termiostypes.h>
23
24int rtems_termios_baud_to_index(
25  rtems_termios_baud_t termios_baud
26)
27{
28  int baud_index;
29
30  switch (termios_baud) {
31    case B0:        baud_index =  0;  break;
32    case B50:       baud_index =  1;  break;
33    case B75:       baud_index =  2;  break;
34    case B110:      baud_index =  3;  break;
35    case B134:      baud_index =  4;  break;
36    case B150:      baud_index =  5;  break;
37    case B200:      baud_index =  6;  break;
38    case B300:      baud_index =  7;  break;
39    case B600:      baud_index =  8;  break;
40    case B1200:     baud_index =  9;  break;
41    case B1800:     baud_index = 10;  break;
42    case B2400:     baud_index = 11;  break;
43    case B4800:     baud_index = 12;  break;
44    case B9600:     baud_index = 13;  break;
45    case B19200:    baud_index = 14;  break;
46    case B38400:    baud_index = 15;  break;
47    case B7200:     baud_index = 16;  break;
48    case B14400:    baud_index = 17;  break;
49    case B28800:    baud_index = 18;  break;
50    case B57600:    baud_index = 19;  break;
51    case B76800:    baud_index = 20;  break;
52    case B115200:   baud_index = 21;  break;
53    case B230400:   baud_index = 22;  break;
54    case B460800:   baud_index = 23;  break;
55    case B921600:   baud_index = 24;  break;
56    default:        baud_index = -1;  break;
57  }
58
59  return baud_index;
60}
Note: See TracBrowser for help on using the repository browser.