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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1632 jcastillo
#ifndef _ALPHA_TERMIOS_H
2
#define _ALPHA_TERMIOS_H
3
 
4
#include <asm/ioctls.h>
5
#include <asm/termbits.h>
6
 
7
struct sgttyb {
8
        char    sg_ispeed;
9
        char    sg_ospeed;
10
        char    sg_erase;
11
        char    sg_kill;
12
        short   sg_flags;
13
};
14
 
15
struct tchars {
16
        char    t_intrc;
17
        char    t_quitc;
18
        char    t_startc;
19
        char    t_stopc;
20
        char    t_eofc;
21
        char    t_brkc;
22
};
23
 
24
struct ltchars {
25
        char    t_suspc;
26
        char    t_dsuspc;
27
        char    t_rprntc;
28
        char    t_flushc;
29
        char    t_werasc;
30
        char    t_lnextc;
31
};
32
 
33
struct winsize {
34
        unsigned short ws_row;
35
        unsigned short ws_col;
36
        unsigned short ws_xpixel;
37
        unsigned short ws_ypixel;
38
};
39
 
40
#define NCC 8
41
struct termio {
42
        unsigned short c_iflag;         /* input mode flags */
43
        unsigned short c_oflag;         /* output mode flags */
44
        unsigned short c_cflag;         /* control mode flags */
45
        unsigned short c_lflag;         /* local mode flags */
46
        unsigned char c_line;           /* line discipline */
47
        unsigned char c_cc[NCC];        /* control characters */
48
};
49
 
50
/*
51
 * c_cc characters in the termio structure.  Oh, how I love being
52
 * backwardly compatible.  Notice that character 4 and 5 are
53
 * interpreted differently depending on whether ICANON is set in
54
 * c_lflag.  If it's set, they are used as _VEOF and _VEOL, otherwise
55
 * as _VMIN and V_TIME.  This is for compatibility with OSF/1 (which
56
 * is compatible with sysV)...
57
 */
58
#define _VINTR  0
59
#define _VQUIT  1
60
#define _VERASE 2
61
#define _VKILL  3
62
#define _VEOF   4
63
#define _VMIN   4
64
#define _VEOL   5
65
#define _VTIME  5
66
#define _VEOL2  6
67
#define _VSWTC  7
68
 
69
/* line disciplines */
70
#define N_TTY           0
71
#define N_SLIP          1
72
#define N_MOUSE         2
73
#define N_PPP           3
74
#define N_AX25          5
75
 
76
#ifdef __KERNEL__
77
/*      eof=^D          eol=\0          eol2=\0         erase=del
78
        werase=^W       kill=^U         reprint=^R      sxtc=\0
79
        intr=^C         quit=^\         susp=^Z         <OSF/1 VDSUSP>
80
        start=^Q        stop=^S         lnext=^V        discard=^U
81
        vmin=\1         vtime=\0
82
*/
83
#define INIT_C_CC "\004\000\000\177\027\025\022\000\003\034\032\000\021\023\026\025\001\000"
84
 
85
/*
86
 * Translate a "termio" structure into a "termios". Ugh.
87
 */
88
extern inline void trans_from_termio(struct termio * termio,
89
        struct termios * termios)
90
{
91
#define SET_LOW_BITS(x,y)       ((x) = (0xffff0000 & (x)) | (y))
92
        SET_LOW_BITS(termios->c_iflag, termio->c_iflag);
93
        SET_LOW_BITS(termios->c_oflag, termio->c_oflag);
94
        SET_LOW_BITS(termios->c_cflag, termio->c_cflag);
95
        SET_LOW_BITS(termios->c_lflag, termio->c_lflag);
96
#undef SET_LOW_BITS
97
        termios->c_cc[VINTR] = termio->c_cc[_VINTR];
98
        termios->c_cc[VQUIT] = termio->c_cc[_VQUIT];
99
        termios->c_cc[VERASE]= termio->c_cc[_VERASE];
100
        termios->c_cc[VKILL] = termio->c_cc[_VKILL];
101
        termios->c_cc[VEOF]  = termio->c_cc[_VEOF];
102
        termios->c_cc[VMIN]  = termio->c_cc[_VMIN];
103
        termios->c_cc[VEOL]  = termio->c_cc[_VEOL];
104
        termios->c_cc[VTIME] = termio->c_cc[_VTIME];
105
        termios->c_cc[VEOL2] = termio->c_cc[_VEOL2];
106
        termios->c_cc[VSWTC] = termio->c_cc[_VSWTC];
107
}
108
 
109
/*
110
 * Translate a "termios" structure into a "termio". Ugh.
111
 *
112
 * Note the "fun" _VMIN overloading.
113
 */
114
extern inline void trans_to_termio(struct termios * termios,
115
        struct termio * termio)
116
{
117
        termio->c_iflag = termios->c_iflag;
118
        termio->c_oflag = termios->c_oflag;
119
        termio->c_cflag = termios->c_cflag;
120
        termio->c_lflag = termios->c_lflag;
121
        termio->c_line  = termios->c_line;
122
        termio->c_cc[_VINTR] = termios->c_cc[VINTR];
123
        termio->c_cc[_VQUIT] = termios->c_cc[VQUIT];
124
        termio->c_cc[_VERASE]= termios->c_cc[VERASE];
125
        termio->c_cc[_VKILL] = termios->c_cc[VKILL];
126
        termio->c_cc[_VEOF]  = termios->c_cc[VEOF];
127
        termio->c_cc[_VEOL]  = termios->c_cc[VEOL];
128
        termio->c_cc[_VEOL2] = termios->c_cc[VEOL2];
129
        termio->c_cc[_VSWTC] = termios->c_cc[VSWTC];
130
        if (!(termios->c_lflag & ICANON)) {
131
                termio->c_cc[_VMIN]  = termios->c_cc[VMIN];
132
                termio->c_cc[_VTIME] = termios->c_cc[VTIME];
133
        }
134
}
135
 
136
#endif  /* __KERNEL__ */
137
 
138
#endif  /* _ALPHA_TERMIOS_H */

powered by: WebSVN 2.1.0

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