summaryrefslogtreecommitdiff
path: root/emulators/x48/files/patch-src+serial.c
blob: bcc52d4d5c65b1d1fe3447026d25021973bc7636 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
--- src/serial.c.orig	Tue Sep  7 10:41:48 1999
+++ src/serial.c	Sat Jun 28 21:27:06 2003
@@ -69,7 +69,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/time.h>
-#if defined(LINUX) || defined(HPUX)
+#if defined(LINUX) || defined(HPUX) || defined(CSRG_BASED)
 #include <sys/ioctl.h>
 #endif
 #include <unistd.h>
@@ -77,6 +77,8 @@
 #ifdef SOLARIS
 #include <sys/stream.h>
 #include <sys/stropts.h>
+#endif
+#if defined(SOLARIS) || defined(CSRG_BASED)
 #include <sys/termios.h>
 #endif
 
@@ -238,7 +240,7 @@
 
   if (ttyp >= 0)
     {
-#if defined(SUNOS) || defined(HPUX)
+#if defined(SUNOS) || defined(HPUX) || defined (CSRG_BASED)
       if (tcgetattr(ttyp, &ttybuf) < 0)
 #else
       if (ioctl(ttyp, TCGETS, (char *)&ttybuf) < 0)
@@ -263,7 +265,7 @@
 
   if (ttyp >= 0)
     {
-#if defined(SUNOS) || defined (HPUX)
+#if defined(SUNOS) || defined (HPUX) || defined(CSRG_BASED)
       if (tcsetattr(ttyp, TCSANOW, &ttybuf) < 0)
 #else
       if (ioctl(ttyp, TCSETS, (char *)&ttybuf) < 0)
@@ -291,7 +293,7 @@
 
   if (ir_fd >= 0)
     {
-#if defined(SUNOS) || defined (HPUX)
+#if defined(SUNOS) || defined (HPUX) || defined (CSRG_BASED)
       if (tcgetattr(ir_fd, &ttybuf) < 0)
 #else
       if (ioctl(ir_fd, TCGETS, (char *)&ttybuf) < 0)
@@ -315,7 +317,7 @@
 
   if (ir_fd >= 0)
     {
-#if defined(SUNOS) || defined(HPUX)
+#if defined(SUNOS) || defined(HPUX) || defined (CSRG_BASED)
       if (tcsetattr(ir_fd, TCSANOW, &ttybuf) < 0)
 #else
       if (ioctl(ir_fd, TCSETS, (char *)&ttybuf) < 0)
@@ -344,7 +346,7 @@
 
   if (ir_fd >= 0)
     {
-#if defined(SUNOS) || defined (HPUX)
+#if defined(SUNOS) || defined (HPUX) || defined (CSRG_BASED)
       if (tcgetattr(ir_fd, &ttybuf) < 0)
 #else
       if (ioctl(ir_fd, TCGETS, (char *)&ttybuf) < 0)
@@ -358,6 +360,10 @@
         }
     }
 
+#if defined(CSRG_BASED)
+  cfsetspeed(&ttybuf, baud);
+#else
+
   ttybuf.c_cflag &= ~CBAUD;
 
   baud &= 0x7;
@@ -404,9 +410,11 @@
       ttybuf.c_cflag |= B9600;
     }
 
+#endif /* CSRG_BASED */
+
   if (ir_fd >= 0)
     {
-#if defined(SUNOS) || defined(HPUX)
+#if defined(SUNOS) || defined(HPUX) || defined (CSRG_BASED)
       if (tcsetattr(ir_fd, TCSANOW, &ttybuf) < 0)
 #else
       if (ioctl(ir_fd, TCSETS, (char *)&ttybuf) < 0)
@@ -422,7 +430,7 @@
 
   if (ttyp >= 0)
     {
-#if defined(SUNOS) || defined(HPUX)
+#if defined(SUNOS) || defined(HPUX) || defined (CSRG_BASED)
       if (tcgetattr(ttyp, &ttybuf) < 0)
 #else
       if (ioctl(ttyp, TCGETS, (char *)&ttybuf) < 0)
@@ -437,6 +445,9 @@
         }
     }
 
+#if defined(CSRG_BASED)
+  cfsetspeed(&ttybuf, baud);
+#else
   ttybuf.c_cflag &= ~CBAUD;
 
   baud &= 0x7;
@@ -482,10 +493,11 @@
         fprintf(stderr, "%s: can\'t set baud rate, using 9600\n", progname);
       ttybuf.c_cflag |= B9600;
     }
+#endif
 
   if (ttyp >= 0)
     {
-#if defined(SUNOS) || defined(HPUX)
+#if defined(SUNOS) || defined(HPUX) || defined (CSRG_BASED)
       if (tcsetattr(ttyp, TCSANOW, &ttybuf) < 0)
 #else
       if (ioctl(ttyp, TCSETS, (char *)&ttybuf) < 0)