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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-ppc/] [termios.h] - Blame information for rev 1765

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

Line No. Rev Author Line
1 1633 jcastillo
#ifndef _PPC_TERMIOS_H
2
#define _PPC_TERMIOS_H
3
 
4
/*
5
 * Liberally adapted from alpha/termios.h.  In particular, the c_cc[]
6
 * fields have been reordered so that termio & termios share the
7
 * common subset in the same order (for brain dead programs that don't
8
 * know or care about the differences).
9
 */
10
 
11
#include <asm/ioctls.h>
12
#include <asm/termbits.h>
13
 
14
struct sgttyb {
15
        char    sg_ispeed;
16
        char    sg_ospeed;
17
        char    sg_erase;
18
        char    sg_kill;
19
        short   sg_flags;
20
};
21
 
22
struct tchars {
23
        char    t_intrc;
24
        char    t_quitc;
25
        char    t_startc;
26
        char    t_stopc;
27
        char    t_eofc;
28
        char    t_brkc;
29
};
30
 
31
struct ltchars {
32
        char    t_suspc;
33
        char    t_dsuspc;
34
        char    t_rprntc;
35
        char    t_flushc;
36
        char    t_werasc;
37
        char    t_lnextc;
38
};
39
 
40
#define FIOCLEX         _IO('f', 1)
41
#define FIONCLEX        _IO('f', 2)
42
#define FIOASYNC        _IOW('f', 125, int)
43
#define FIONBIO         _IOW('f', 126, int)
44
#define FIONREAD        _IOR('f', 127, int)
45
#define TIOCINQ         FIONREAD
46
 
47
#define TIOCGETP        _IOR('t', 8, struct sgttyb)
48
#define TIOCSETP        _IOW('t', 9, struct sgttyb)
49
#define TIOCSETN        _IOW('t', 10, struct sgttyb)    /* TIOCSETP wo flush */
50
 
51
#define TIOCSETC        _IOW('t', 17, struct tchars)
52
#define TIOCGETC        _IOR('t', 18, struct tchars)
53
#define TCGETS          _IOR('t', 19, struct termios)
54
#define TCSETS          _IOW('t', 20, struct termios)
55
#define TCSETSW         _IOW('t', 21, struct termios)
56
#define TCSETSF         _IOW('t', 22, struct termios)
57
 
58
#define TCGETA          _IOR('t', 23, struct termio)
59
#define TCSETA          _IOW('t', 24, struct termio)
60
#define TCSETAW         _IOW('t', 25, struct termio)
61
#define TCSETAF         _IOW('t', 28, struct termio)
62
 
63
#define TCSBRK          _IO('t', 29)
64
#define TCXONC          _IO('t', 30)
65
#define TCFLSH          _IO('t', 31)
66
 
67
#define TIOCSWINSZ      _IOW('t', 103, struct winsize)
68
#define TIOCGWINSZ      _IOR('t', 104, struct winsize)
69
#define TIOCSTART       _IO('t', 110)           /* start output, like ^Q */
70
#define TIOCSTOP        _IO('t', 111)           /* stop output, like ^S */
71
#define TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */
72
 
73
#define TIOCGLTC        _IOR('t', 116, struct ltchars)
74
#define TIOCSLTC        _IOW('t', 117, struct ltchars)
75
#define TIOCSPGRP       _IOW('t', 118, int)
76
#define TIOCGPGRP       _IOR('t', 119, int)
77
 
78
#define TIOCEXCL        0x540C
79
#define TIOCNXCL        0x540D
80
#define TIOCSCTTY       0x540E
81
 
82
#define TIOCSTI         0x5412
83
#define TIOCMGET        0x5415
84
#define TIOCMBIS        0x5416
85
#define TIOCMBIC        0x5417
86
#define TIOCMSET        0x5418
87
#define TIOCGSOFTCAR    0x5419
88
#define TIOCSSOFTCAR    0x541A
89
#define TIOCLINUX       0x541C
90
#define TIOCCONS        0x541D
91
#define TIOCGSERIAL     0x541E
92
#define TIOCSSERIAL     0x541F
93
#define TIOCPKT         0x5420
94
 
95
#define TIOCNOTTY       0x5422
96
#define TIOCSETD        0x5423
97
#define TIOCGETD        0x5424
98
#define TCSBRKP         0x5425  /* Needed for POSIX tcsendbreak() */
99
#define TIOCTTYGSTRUCT  0x5426  /* For debugging only */
100
 
101
#define TIOCSERCONFIG   0x5453
102
#define TIOCSERGWILD    0x5454
103
#define TIOCSERSWILD    0x5455
104
#define TIOCGLCKTRMIOS  0x5456
105
#define TIOCSLCKTRMIOS  0x5457
106
#define TIOCSERGSTRUCT  0x5458 /* For debugging only */
107
#define TIOCSERGETLSR   0x5459 /* Get line status register */
108
#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
109
#define TIOCSERSETMULTI 0x545B /* Set multiport config */
110
 
111
#define TIOCMIWAIT      0x545C  /* wait for a change on serial input line(s) */
112
#define TIOCGICOUNT     0x545D  /* read serial port inline interrupt counts */
113
 
114
/* Used for packet mode */
115
#define TIOCPKT_DATA             0
116
#define TIOCPKT_FLUSHREAD        1
117
#define TIOCPKT_FLUSHWRITE       2
118
#define TIOCPKT_STOP             4
119
#define TIOCPKT_START            8
120
#define TIOCPKT_NOSTOP          16
121
#define TIOCPKT_DOSTOP          32
122
 
123
struct winsize {
124
        unsigned short ws_row;
125
        unsigned short ws_col;
126
        unsigned short ws_xpixel;
127
        unsigned short ws_ypixel;
128
};
129
 
130
#define NCC 10
131
struct termio {
132
        unsigned short c_iflag;         /* input mode flags */
133
        unsigned short c_oflag;         /* output mode flags */
134
        unsigned short c_cflag;         /* control mode flags */
135
        unsigned short c_lflag;         /* local mode flags */
136
        unsigned char c_line;           /* line discipline */
137
        unsigned char c_cc[NCC];        /* control characters */
138
};
139
 
140
#define NCCS 19
141
struct termios {
142
        tcflag_t c_iflag;               /* input mode flags */
143
        tcflag_t c_oflag;               /* output mode flags */
144
        tcflag_t c_cflag;               /* control mode flags */
145
        tcflag_t c_lflag;               /* local mode flags */
146
        cc_t c_cc[NCCS];                /* control characters */
147
        cc_t c_line;                    /* line discipline (== c_cc[19]) */
148
        int c_ispeed;                   /* input speed */
149
        int c_ospeed;                   /* output speed */
150
};
151
 
152
/* c_cc characters */
153
#define _VINTR  0
154
#define _VQUIT  1
155
#define _VERASE 2
156
#define _VKILL  3
157
#define _VEOF   4
158
#define _VMIN   5
159
#define _VEOL   6
160
#define _VTIME  7
161
#define _VEOL2  8
162
#define _VSWTC  9
163
 
164
#define VINTR   0
165
#define VQUIT   1
166
#define VERASE  2
167
#define VKILL   3
168
#define VEOF    4
169
#define VMIN    5
170
#define VEOL    6
171
#define VTIME   7
172
#define VEOL2   8
173
#define VSWTC   9
174
 
175
#define VWERASE         10
176
#define VREPRINT        11
177
#define VSUSP           12
178
#define VSTART          13
179
#define VSTOP           14
180
#define VLNEXT          15
181
#define VDISCARD        16
182
 
183
 
184
#ifdef __KERNEL__
185
/*      eof=^D          eol=\0          eol2=\0         erase=del
186
        werase=^W       kill=^U         reprint=^R      sxtc=\0
187
        intr=^C         quit=^\         susp=^Z         <OSF/1 VDSUSP>
188
        start=^Q        stop=^S         lnext=^V        discard=^U
189
        vmin=\1         vtime=\0
190
#define INIT_C_CC "\004\000\000\177\027\025\022\000\003\034\032\000\021\023\026\025\001\000"
191
*/
192
 
193
/*                   ^C  ^\ del  ^U  ^D   1   0   0   0   0  ^W  ^R  ^Z  ^Q  ^S  ^V  ^U  */
194
#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" 
195
#endif
196
 
197
/* c_iflag bits */
198
#define IGNBRK  0000001
199
#define BRKINT  0000002
200
#define IGNPAR  0000004
201
#define PARMRK  0000010
202
#define INPCK   0000020
203
#define ISTRIP  0000040
204
#define INLCR   0000100
205
#define IGNCR   0000200
206
#define ICRNL   0000400
207
#define IXON    0001000
208
#define IXOFF   0002000
209
#define IXANY   0004000
210
#define IUCLC   0010000
211
#define IMAXBEL 0020000
212
 
213
/* c_oflag bits */
214
#define OPOST   0000001
215
#define ONLCR   0000002
216
#define OLCUC   0000004
217
 
218
#define OCRNL   0000010
219
#define ONOCR   0000020
220
#define ONLRET  0000040
221
 
222
#define OFILL   00000100
223
#define OFDEL   00000200
224
#define NLDLY   00001400
225
#define   NL0   00000000
226
#define   NL1   00000400
227
#define   NL2   00001000
228
#define   NL3   00001400
229
#define TABDLY  00006000
230
#define   TAB0  00000000
231
#define   TAB1  00002000
232
#define   TAB2  00004000
233
#define   TAB3  00006000
234
#define CRDLY   00030000
235
#define   CR0   00000000
236
#define   CR1   00010000
237
#define   CR2   00020000
238
#define   CR3   00030000
239
#define FFDLY   00040000
240
#define   FF0   00000000
241
#define   FF1   00040000
242
#define BSDLY   00100000
243
#define   BS0   00000000
244
#define   BS1   00100000
245
#define VTDLY   00200000
246
#define   VT0   00000000
247
#define   VT1   00200000
248
#define XTABS   01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
249
 
250
/* c_cflag bit meaning */
251
#define CBAUD   0000377
252
#define  B0     0000000         /* hang up */
253
#define  B50    0000001
254
#define  B75    0000002
255
#define  B110   0000003
256
#define  B134   0000004
257
#define  B150   0000005
258
#define  B200   0000006
259
#define  B300   0000007
260
#define  B600   0000010
261
#define  B1200  0000011
262
#define  B1800  0000012
263
#define  B2400  0000013
264
#define  B4800  0000014
265
#define  B9600  0000015
266
#define  B19200 0000016
267
#define  B38400 0000017
268
#define EXTA B19200
269
#define EXTB B38400
270
#define CBAUDEX 0000020
271
#define  B57600   00020
272
#define  B115200  00021
273
#define  B230400  00022
274
#define  B460800  00023
275
 
276
#define CSIZE   00001400
277
#define   CS5   00000000
278
#define   CS6   00000400
279
#define   CS7   00001000
280
#define   CS8   00001400
281
 
282
#define CSTOPB  00002000
283
#define CREAD   00004000
284
#define PARENB  00010000
285
#define PARODD  00020000
286
#define HUPCL   00040000
287
 
288
#define CLOCAL  00100000
289
#define CRTSCTS   020000000000          /* flow control */
290
 
291
/* c_lflag bits */
292
#define ISIG    0x00000080
293
#define ICANON  0x00000100
294
#define XCASE   0x00004000
295
#define ECHO    0x00000008
296
#define ECHOE   0x00000002
297
#define ECHOK   0x00000004
298
#define ECHONL  0x00000010
299
#define NOFLSH  0x80000000
300
#define TOSTOP  0x00400000
301
#define ECHOCTL 0x00000040
302
#define ECHOPRT 0x00000020
303
#define ECHOKE  0x00000001
304
#define FLUSHO  0x00800000
305
#define PENDIN  0x20000000
306
#define IEXTEN  0x00000400
307
 
308
/* modem lines */
309
#define TIOCM_LE        0x001
310
#define TIOCM_DTR       0x002
311
#define TIOCM_RTS       0x004
312
#define TIOCM_ST        0x008
313
#define TIOCM_SR        0x010
314
#define TIOCM_CTS       0x020
315
#define TIOCM_CAR       0x040
316
#define TIOCM_RNG       0x080
317
#define TIOCM_DSR       0x100
318
#define TIOCM_CD        TIOCM_CAR
319
#define TIOCM_RI        TIOCM_RNG
320
 
321
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
322
#define TIOCSER_TEMT    0x01    /* Transmitter physically empty */
323
 
324
 
325
/* tcflow() and TCXONC use these */
326
#define TCOOFF          0
327
#define TCOON           1
328
#define TCIOFF          2
329
#define TCION           3
330
 
331
/* tcflush() and TCFLSH use these */
332
#define TCIFLUSH        0
333
#define TCOFLUSH        1
334
#define TCIOFLUSH       2
335
 
336
/* tcsetattr uses these */
337
#define TCSANOW         0
338
#define TCSADRAIN       1
339
#define TCSAFLUSH       2
340
 
341
/* line disciplines */
342
#define N_TTY           0
343
#define N_SLIP          1
344
#define N_MOUSE         2
345
#define N_PPP           3
346
#define N_AX25          5
347
 
348
#ifdef __KERNEL__
349
 
350
/*
351
 * Translate a "termio" structure into a "termios". Ugh.
352
 */
353
extern inline void trans_from_termio(struct termio * termio,
354
        struct termios * termios)
355
{
356
#define SET_LOW_BITS(x,y)       ((x) = (0xffff0000 & (x)) | (y))
357
        SET_LOW_BITS(termios->c_iflag, termio->c_iflag);
358
        SET_LOW_BITS(termios->c_oflag, termio->c_oflag);
359
        SET_LOW_BITS(termios->c_cflag, termio->c_cflag);
360
        SET_LOW_BITS(termios->c_lflag, termio->c_lflag);
361
#undef SET_LOW_BITS
362
        termios->c_cc[VINTR] = termio->c_cc[_VINTR];
363
        termios->c_cc[VQUIT] = termio->c_cc[_VQUIT];
364
        termios->c_cc[VERASE]= termio->c_cc[_VERASE];
365
        termios->c_cc[VKILL] = termio->c_cc[_VKILL];
366
        termios->c_cc[VEOF]  = termio->c_cc[_VEOF];
367
        termios->c_cc[VMIN]  = termio->c_cc[_VMIN];
368
        termios->c_cc[VEOL]  = termio->c_cc[_VEOL];
369
        termios->c_cc[VTIME] = termio->c_cc[_VTIME];
370
        termios->c_cc[VEOL2] = termio->c_cc[_VEOL2];
371
        termios->c_cc[VSWTC] = termio->c_cc[_VSWTC];
372
}
373
 
374
/*
375
 * Translate a "termios" structure into a "termio". Ugh.
376
 *
377
 * Note the "fun" _VMIN overloading.
378
 */
379
extern inline void trans_to_termio(struct termios * termios,
380
        struct termio * termio)
381
{
382
        termio->c_iflag = termios->c_iflag;
383
        termio->c_oflag = termios->c_oflag;
384
        termio->c_cflag = termios->c_cflag;
385
        termio->c_lflag = termios->c_lflag;
386
        termio->c_line  = termios->c_line;
387
        termio->c_cc[_VINTR] = termios->c_cc[VINTR];
388
        termio->c_cc[_VQUIT] = termios->c_cc[VQUIT];
389
        termio->c_cc[_VERASE]= termios->c_cc[VERASE];
390
        termio->c_cc[_VKILL] = termios->c_cc[VKILL];
391
        termio->c_cc[_VEOF]  = termios->c_cc[VEOF];
392
        termio->c_cc[_VEOL]  = termios->c_cc[VEOL];
393
        termio->c_cc[_VEOL2] = termios->c_cc[VEOL2];
394
        termio->c_cc[_VSWTC] = termios->c_cc[VSWTC];
395
        if (1/*!(termios->c_lflag & ICANON)*/) {
396
                termio->c_cc[_VMIN]  = termios->c_cc[VMIN];
397
                termio->c_cc[_VTIME] = termios->c_cc[VTIME];
398
        }
399
}
400
 
401
#endif  /* __KERNEL__ */
402
 
403
#endif  /* _PPC_TERMIOS_H */

powered by: WebSVN 2.1.0

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