OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [libchip/] [serial/] [termios_baud2index.c] - Blame information for rev 587

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: termios_baud2index.c,v 1.2 2001-09-27 12:01:42 chris Exp $
3
 */
4
 
5
#include <sys/termios.h>
6
 
7
int termios_baud_to_index(
8
  int termios_baud
9
)
10
{
11
  int baud_index;
12
 
13
  switch (termios_baud) {
14
    case B0:        baud_index =  0;  break;
15
    case B50:       baud_index =  1;  break;
16
    case B75:       baud_index =  2;  break;
17
    case B110:      baud_index =  3;  break;
18
    case B134:      baud_index =  4;  break;
19
    case B150:      baud_index =  5;  break;
20
    case B200:      baud_index =  6;  break;
21
    case B300:      baud_index =  7;  break;
22
    case B600:      baud_index =  8;  break;
23
    case B1200:     baud_index =  9;  break;
24
    case B1800:     baud_index = 10;  break;
25
    case B2400:     baud_index = 11;  break;
26
    case B4800:     baud_index = 12;  break;
27
    case B9600:     baud_index = 13;  break;
28
    case B19200:    baud_index = 14;  break;
29
    case B38400:    baud_index = 15;  break;
30
    case B57600:    baud_index = 16;  break;
31
    case B115200:   baud_index = 17;  break;
32
    case B230400:   baud_index = 18;  break;
33
    case B460800:   baud_index = 19;  break;
34
    default:        baud_index = -1;  break;
35
  }
36
 
37
  return baud_index;
38
}
39
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.