comparison loadtools/sercomm.c @ 50:f1df95eed62c

loadtools: -b option works in fc-iram
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 23 Jun 2013 03:32:04 +0000
parents 54392d1ea474
children
comparison
equal deleted inserted replaced
49:54392d1ea474 50:f1df95eed62c
7 #include <sys/file.h> 7 #include <sys/file.h>
8 #include <sys/ioctl.h> 8 #include <sys/ioctl.h>
9 #include <termios.h> 9 #include <termios.h>
10 #include <stdio.h> 10 #include <stdio.h>
11 #include <stdlib.h> 11 #include <stdlib.h>
12 #include <string.h>
13 #include <strings.h>
12 #include <unistd.h> 14 #include <unistd.h>
13 #include "baudrate.h" 15 #include "baudrate.h"
14 16
15 char *target_ttydev; 17 char *target_ttydev;
16 int target_fd; 18 int target_fd;
52 exit(1); 54 exit(1);
53 } 55 }
54 return 0; 56 return 0;
55 } 57 }
56 58
59 struct baudrate *
60 find_baudrate_by_name(srch_name)
61 char *srch_name;
62 {
63 struct baudrate *br;
64
65 for (br = baud_rate_table; br->name; br++)
66 if (!strcmp(br->name, srch_name))
67 break;
68 if (br->name)
69 return(br);
70 else {
71 fprintf(stderr, "error: baud rate \"%s\" not known\n",
72 srch_name);
73 return(NULL);
74 }
75 }
76
57 switch_baud_rate(br) 77 switch_baud_rate(br)
58 struct baudrate *br; 78 struct baudrate *br;
59 { 79 {
60 cfsetispeed(&target_termios, br->termios_code); 80 cfsetispeed(&target_termios, br->termios_code);
61 cfsetospeed(&target_termios, br->termios_code); 81 cfsetospeed(&target_termios, br->termios_code);