summaryrefslogtreecommitdiff
path: root/ecos/packages/isoinfra/current/include/termios.h
blob: d2ab68ddedb2e42a1167ab573c67b8fdb94e51b6 (plain)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#ifndef CYGONCE_ISO_TERMIOS_H
#define CYGONCE_ISO_TERMIOS_H
/* ====================================================================
//
//      termios.h
//
//      POSIX termios
//
// ====================================================================
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
// -------------------------------------------                              
// This file is part of eCos, the Embedded Configurable Operating System.   
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under    
// the terms of the GNU General Public License as published by the Free     
// Software Foundation; either version 2 or (at your option) any later      
// version.                                                                 
//
// eCos is distributed in the hope that it will be useful, but WITHOUT      
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
// for more details.                                                        
//
// You should have received a copy of the GNU General Public License        
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
//
// As a special exception, if other files instantiate templates or use      
// macros or inline functions from this file, or you compile this file      
// and link it with other works to produce a work based on this file,       
// this file does not by itself cause the resulting work to be covered by   
// the GNU General Public License. However the source code for this file    
// must still be made available in accordance with section (3) of the GNU   
// General Public License v2.                                               
//
// This exception does not invalidate any other reasons why a work based    
// on this file might be covered by the GNU General Public License.         
// -------------------------------------------                              
// ####ECOSGPLCOPYRIGHTEND####                                              
// ====================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s):    jlarmour
// Contributors: 
// Date:         2000-07-22
// Purpose:      POSIX termios support
// Description:
//
//####DESCRIPTIONEND####
//
// ==================================================================*/

#include <pkgconf/isoinfra.h>

#if CYGINT_ISO_TERMIOS
# ifdef CYGBLD_ISO_TERMIOS_HEADER
#  include CYGBLD_ISO_TERMIOS_HEADER
# else

/* TYPES */

typedef unsigned int tcflag_t;  /* terminal flags type */
typedef unsigned char cc_t;     /* control chars type */
typedef unsigned int speed_t;   /* baud rate type */

#define NCCS 16    /* May as well hard-code - ASCII isn't that configurable! */

struct termios {
    tcflag_t c_iflag;    /* Input mode flags */
    tcflag_t c_oflag;    /* Output mode flags */
    tcflag_t c_cflag;    /* Control mode flags */
    tcflag_t c_lflag;    /* Local mode flags */
    cc_t c_cc[NCCS];     /* Control characters */
    speed_t c_ispeed;    /* input speed */
    speed_t c_ospeed;    /* output speed */
};

/* CONSTANTS */

/* Input mode flags */

#define BRKINT          (1<<0)
#define ICRNL           (1<<1)
#define IGNBRK          (1<<2)
#define IGNCR           (1<<3)
#define IGNPAR          (1<<4)
#define INLCR           (1<<5)
#define INPCK           (1<<6)
#define ISTRIP          (1<<7)
#define IXOFF           (1<<8)
#define IXON            (1<<9)
#define PARMRK          (1<<10)

/* Output mode flags */

#define OPOST           (1<<0)
#define ONLCR           (1<<1) /* Note: This isn't POSIX */

/* Control mode flags */

#define CLOCAL          (1<<0)
#define CREAD           (1<<1)
#define   CS5              (0)
#define   CS6           (1<<2)
#define   CS7           (1<<3)
#define   CS8           (CS6|CS7)
#define CSIZE           (CS8)
#define CSTOPB          (1<<4)
#define HUPCL           (1<<5)
#define PARENB          (1<<6)
#define PARODD          (1<<7)
#ifndef _POSIX_SOURCE_
# define CRTSCTS        (1<<8)
#endif

/* Local mode flags */

#define ECHO            (1<<0)
#define ECHOE           (1<<1)
#define ECHOK           (1<<2)
#define ECHONL          (1<<3)
#define ICANON          (1<<4)
#define IEXTEN          (1<<5)
#define ISIG            (1<<6)
#define NOFLSH          (1<<7)
#define TOSTOP          (1<<8)

/* Special control characters */

#define VEOF            0
#define VEOL            1
#define VERASE          2
#define VINTR           3
#define VKILL           4
#define VMIN            5
#define VQUIT           6
#define VSUSP           7
#define VTIME           8
#define VSTART          9
#define VSTOP           10

/* Baud rates */
/* There may be tables in the implementation that rely on the
 * values here, so only append to this table - do not insert values!
 */
#define B0              0
#define B50             1
#define B75             2
#define B110            3
#define B134            4
#define B150            5
#define B200            6
#define B300            7
#define B600            8
#define B1200           9
#define B1800           10
#define B2400           11
#define B3600           12
#define B4800           13
#define B7200           14
#define B9600           15
#define B14400          16
#define B19200          17
#define B38400          18
#define B57600          19
#define B115200         20
#define B230400         21
#define B460800         22
#define B500000         23
#define B576000         24
#define B921600         25
#define B1000000        26
#define B1152000        27
#define B1500000        28
#define B2000000        29
#define B2500000        30
#define B3000000        31
#define B3500000        32
#define B4000000        33


/* Optional actions to tcsetattr() */

#define TCSANOW         0
#define TCSADRAIN       1
#define TCSAFLUSH       2

/* Queue selectors for tcflush() */

#define TCIFLUSH        0
#define TCOFLUSH        1
#define TCIOFLUSH       2

/* Actions for tcflow() */

#define TCOOFF          0
#define TCOON           1
#define TCIOFF          2
#define TCION           3


/* FUNCTIONS */

#ifdef __cplusplus
extern "C" {
#endif

extern speed_t
cfgetospeed( const struct termios *__termios_p );

extern int
cfsetospeed( struct termios *__termios_p, speed_t __speed );

extern speed_t
cfgetispeed( const struct termios *__termios_p );

extern int
cfsetispeed( struct termios *__termios_p, speed_t __speed );

extern int
tcgetattr( int __fildes, struct termios *__termios_p );

extern int
tcsetattr( int __fildes, int __optact, const struct termios *__termios_p );

extern int
tcsendbreak( int __fildes, int __duration );

extern int
tcdrain( int __fildes );

extern int
tcflush( int __fildes, int __queue_sel );

extern int
tcflow( int __fildes, int __action );

/* tcgetpgrp() and tcsetpgrp() not included in the absence of job control */

#ifdef __cplusplus
} /* extern "C" */
#endif

# endif /* ifndef CYGBLD_ISO_TERMIOS_HEADER */
#endif /* if CYGINT_ISO_TERMIOS */


#endif /* ifndef CYGONCE_ISO_TERMIOS_H */

/* EOF termios.h */