2
$Id: termios.inc,v 1.2 2004/02/05 14:00:45 jonas Exp $
9
Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
11
@APPLE_LICENSE_HEADER_START@
13
The contents of this file constitute Original Code as defined in and
14
are subject to the Apple Public Source License Version 1.1 (the
15
"License"). You may not use this file except in compliance with the
16
License. Please obtain a copy of the License at
17
http://www.apple.com/publicsource and read it before using this file.
19
This Original Code and all software distributed under the License are
20
distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
21
EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
22
INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
23
FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
24
License for the specific language governing rights and limitations
27
@APPLE_LICENSE_HEADER_END@
29
{ Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved }
31
Copyright (c) 1988, 1989, 1993, 1994
32
The Regents of the University of California. All rights reserved.
34
Redistribution and use in source and binary forms, with or without
35
modification, are permitted provided that the following conditions
37
1. Redistributions of source code must retain the above copyright
38
notice, this list of conditions and the following disclaimer.
39
2. Redistributions in binary form must reproduce the above copyright
40
notice, this list of conditions and the following disclaimer in the
41
documentation and/or other materials provided with the distribution.
42
3. All advertising materials mentioning features or use of this software
43
must display the following acknowledgement:
44
This product includes software developed by the University of
45
California, Berkeley and its contributors.
46
4. Neither the name of the University nor the names of its contributors
47
may be used to endorse or promote products derived from this software
48
without specific prior written permission.
50
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62
@(#)termios.h 8.3 (Berkeley) 3/28/94
64
{$ifndef _SYS_TERMIOS_H_}
65
{$define _SYS_TERMIOS_H_}
67
Special Control Characters
69
Index into c_cc[] character array.
71
Name Subscript Enabled by
79
{$ifndef _POSIX_SOURCE}
80
{ ICANON together with IEXTEN }
89
{$ifndef _POSIX_SOURCE}
90
{ ICANON together with IEXTEN }
99
{$ifndef _POSIX_SOURCE}
100
{ ICANON together with IEXTEN }
114
{$ifndef _POSIX_SOURCE}
115
{ ISIG together with IEXTEN }
126
{$ifndef _POSIX_SOURCE}
140
{$ifndef _POSIX_SOURCE}
141
{ ICANON together with IEXTEN }
150
{$ifndef _POSIX_VDISABLE}
152
// as in linux freebsd netbsd and openbsd
155
winsize = packed record
165
_POSIX_VDISABLE = $ff;
167
{$ifndef _POSIX_SOURCE}
168
{ was #define dname(params) para_def_expr }
169
{ argument types are unknown }
170
{ return type might be wrong }
171
// function CCEQ(val,c : longint) : longint;
172
// as in freebsd netbsd and openbsd and in /usr/include/sys/termios.h
175
#define CCEQ(val, c) ((c) == (val) ? (val) != _POSIX_VDISABLE : 0)
179
Input flags - software input processing
181
{ ignore BREAK condition }
185
{ map BREAK to SIGINTR }
187
{ ignore (discard) parity errors }
189
{ mark parity and framing errors }
191
{ enable checking of parity errors }
193
{ strip 8th bit off chars }
199
{ map CR to NL (ala CRMOD) }
201
{ enable output flow control }
203
{ enable input flow control }
205
{$ifndef _POSIX_SOURCE}
206
{ any char will restart after stop }
210
{ ring bell on input queue full }
215
Output flags - software output processing
217
{ enable following output processing }
221
{$ifndef _POSIX_SOURCE}
222
{ map NL to CR-NL (ala CRMOD) }
226
{ expand tabs to spaces }
228
{ discard EOT's (^D) on output) }
233
Control flags - hardware control of terminal
235
{$ifndef _POSIX_SOURCE}
236
{ ignore control flags }
241
{ character size mask }
259
{ odd parity, else even }
261
{ hang up on last close }
263
{ ignore modem status lines }
265
{$ifndef _POSIX_SOURCE}
266
{ CTS flow control of output }
269
CCTS_OFLOW = $00010000;
270
{ RTS flow control of input }
271
CRTS_IFLOW = $00020000;
272
CRTSCTS = CCTS_OFLOW or CRTS_IFLOW;
273
{ DTR flow control of input }
274
CDTR_IFLOW = $00040000;
275
{ DSR flow control of output }
276
CDSR_OFLOW = $00080000;
277
{ DCD flow control of output }
278
CCAR_OFLOW = $00100000;
279
{ old name for CCAR_OFLOW }
283
"Local" flags - dumping ground for other state
285
Warning: some flags in this structure begin with
286
the letter "I" and look like they belong in the
289
{$ifndef _POSIX_SOURCE}
290
{ visual erase for line kill }
296
{ visually erase chars }
300
{ echo NL after line kill }
304
{ echo NL even if ECHO is off }
306
{$ifndef _POSIX_SOURCE}
307
{ visual erase mode for hardcopy }
311
{ echo control chars as ^(Char) }
315
{ enable signals INTR, QUIT, [D]SUSP }
319
{ canonicalize input lines }
321
{$ifndef _POSIX_SOURCE}
322
{ use alternate WERASE algorithm }
325
ALTWERASE = $00000200;
328
{ enable DISCARD and LNEXT }
332
{ external processing }
334
{ stop background jobs from output }
336
{$ifndef _POSIX_SOURCE}
337
{ output being flushed (state) }
341
{ no kernel output from VSTATUS }
342
NOKERNINFO = $02000000;
343
{ XXX retype pending input (state) }
347
{ don't flush after interrupt }
359
{ XXX should be unsigned long }
372
c_cc : array[0..(NCCS)-1] of cc_t;
378
Commands passed to tcsetattr() for setting the termios structure.
380
{ make change immediate }
384
{ drain output, then change }
386
{ drain output, flush input }
388
{$ifndef _POSIX_SOURCE}
389
{ flag - don't alter h.w. state }
415
{$ifndef _POSIX_SOURCE}
439
// as in freebsd netbsd and openbsd and in
440
// /usr/include/sys/ttycom.h und ioccom.h
442
IOCTLREAD = $40000000;
443
IOCTLWRITE = $80000000;
444
IOCTLVOID = $20000000;
446
TIOCMODG = IOCTLREAD+$47400+ 3; { get modem control state }
447
TIOCMODS = IOCTLWRITE+$47400+ 4; { set modem control state }
448
TIOCM_LE =$0001; { line enable }
449
TIOCM_DTR =$0002; { data terminal ready }
450
TIOCM_RTS =$0004; { request to send }
451
TIOCM_ST =$0010; { secondary transmit }
452
TIOCM_SR =$0020; { secondary receive }
453
TIOCM_CTS =$0040; { clear to send }
454
TIOCM_CAR =$0100; { carrier detect }
456
TIOCM_RNG =$0200; { ring }
458
TIOCM_DSR =$0400; { data set ready }
460
TIOCEXCL =IOCTLVOID+$7400+ 13; { set exclusive use of tty }
461
TIOCNXCL =IOCTLVOID+$7400+ 14; { reset exclusive use of tty }
463
TIOCFLUSH =IOCTLWRITE+$47400+ 16; { flush buffers }
465
TIOCGETA =IOCTLREAD+$2C7400+ 19; { get termios struct }
466
TIOCSETA =IOCTLWRITE+$2C7400+ 20; { set termios struct }
467
TIOCSETAW =IOCTLWRITE+$2C7400+ 21; { drain output, set }
468
TIOCSETAF =IOCTLWRITE+$2C7400+ 22; { drn out, fls in, set }
469
TIOCGETD =IOCTLREAD+$47400+ 26; { get line discipline }
470
TIOCSETD =IOCTLWRITE+$47400+ 27; { set line discipline }
472
TIOCSBRK =IOCTLVOID+$7400+ 123; { set break bit }
473
TIOCCBRK =IOCTLVOID+$7400+ 122; { clear break bit }
474
TIOCSDTR =IOCTLVOID+$7400+ 121; { set data terminal ready }
475
TIOCCDTR =IOCTLVOID+$7400+ 120; { clear data terminal ready }
476
TIOCGPGRP =IOCTLREAD+$47400+ 119; { get pgrp of tty }
477
TIOCSPGRP =IOCTLWRITE+$47400+ 118; { set pgrp of tty }
479
TIOCOUTQ =IOCTLREAD+$47400+ 115; { output queue size }
480
TIOCSTI =IOCTLWRITE+$17400+ 114; { simulate terminal input }
481
TIOCNOTTY =IOCTLVOID+$7400+ 113; { void tty association }
482
TIOCPKT =IOCTLWRITE+$47400+ 112; { pty: set/clear packet mode }
483
TIOCPKT_DATA =$00; { data packet }
484
TIOCPKT_FLUSHREAD =$01; { flush packet }
485
TIOCPKT_FLUSHWRITE =$02; { flush packet }
486
TIOCPKT_STOP =$04; { stop output }
487
TIOCPKT_START =$08; { start output }
488
TIOCPKT_NOSTOP =$10; { no more ^S, ^Q }
489
TIOCPKT_DOSTOP =$20; { now do ^S ^Q }
490
TIOCPKT_IOCTL =$40; { state change of pty driver }
491
TIOCSTOP =IOCTLVOID+$7400+ 111; { stop output, like ^S }
492
TIOCSTART =IOCTLVOID+$7400+ 110; { start output, like ^Q }
493
TIOCMSET =IOCTLWRITE+$47400+ 109; { set all modem bits }
494
TIOCMBIS =IOCTLWRITE+$47400+ 108; { bis modem bits }
495
TIOCMBIC =IOCTLWRITE+$47400+ 107; { bic modem bits }
496
TIOCMGET =IOCTLREAD+$47400+ 106; { get all modem bits }
497
TIOCREMOTE =IOCTLWRITE+$47400+ 105; { remote input editing }
498
TIOCGWINSZ =IOCTLREAD+$87400+ 104; { get window size }
499
TIOCSWINSZ =IOCTLWRITE+$87400+ 103; { set window size }
500
TIOCUCNTL =IOCTLWRITE+$47400+ 102; { pty: set/clr usr cntl mode }
501
TIOCSTAT =IOCTLVOID+$7400+ 101; { simulate ^T status message }
502
// UIOCCMD(n) _IO('u', n) { usr cntl op "n" }
503
TIOCSCONS =IOCTLWRITE+$47400+ 99; { 4.2 compatibility } // added from ttycom.h
504
TIOCCONS =IOCTLWRITE+$47400+ 98; { become virtual console }
505
TIOCSCTTY =IOCTLVOID+$7400+ 97; { become controlling tty }
506
TIOCEXT =IOCTLWRITE+$47400+ 96; { pty: external processing }
507
TIOCSIG =IOCTLVOID+$7400+ 95; { pty: generate signal }
508
TIOCDRAIN =IOCTLVOID+$7400+ 94; { wait till output drained }
509
TIOCMSDTRWAIT =IOCTLWRITE+$47400+ 91; { modem: set wait on close }
510
TIOCMGDTRWAIT =IOCTLREAD+$47400+ 90; { modem: get wait on close }
511
TIOCTIMESTAMP =IOCTLREAD+$87400+ 89; { enable/get timestamp
512
* of last input event }
513
TIOCDCDTIMESTAMP =IOCTLREAD+$87400+ 88; { enable/get timestamp
515
TIOCSDRAINWAIT =IOCTLWRITE+$47400+ 87; { set ttywait timeout }
516
TIOCGDRAINWAIT =IOCTLREAD+$47400+ 86; { get ttywait timeout }
517
TIOCDSIMICROCODE =IOCTLREAD+$47400+ 85; { download microcode to DSI Softmodem } // added from ttycom.h
519
TTYDISC =0; { termios tty line discipline }
520
TABLDISC =3; { tablet discipline } // added from ttycom.h
521
SLIPDISC =4; { serial IP discipline }
522
PPPDISC =5; { PPP discipline }
523
NETGRAPHDISC =6; { Netgraph tty node discipline }
527
* Defaults on "first" open.
529
TTYDEF_IFLAG =(BRKINT or ICRNL or IMAXBEL or IXON or IXANY);
530
TTYDEF_OFLAG =(OPOST or ONLCR);
531
TTYDEF_LFLAG =(ECHO or ICANON or ISIG or IEXTEN or ECHOE or ECHOKE or ECHOCTL);
532
TTYDEF_CFLAG =(CREAD or CS8 or HUPCL);
533
TTYDEF_SPEED =(B9600);
536
* Control Character Defaults
538
CtrlMask = $1f; {\037}
539
CEOF =chr( ORD('d') and CtrlMask);
540
CEOL =chr( $ff and CtrlMask);{ XXX avoid _POSIX_VDISABLE }
541
CERASE =chr( $7F and CtrlMask);
542
CINTR =chr(ORD('c') and CtrlMask);
543
CSTATUS =chr(ORD('t') and CtrlMask);
544
CKILL =chr(ORD('u') and CtrlMask);
546
CQUIT =chr(034 and CtrlMask); { FS, ^\ }
547
CSUSP =chr(ORD('z') and CtrlMask);
549
CDSUSP =chr(ORD('y') and CtrlMask);
550
CSTART =chr(ORD('q') and CtrlMask);
551
CSTOP =chr(ORD('s') and CtrlMask);
552
CLNEXT =chr(ORD('v') and CtrlMask);
553
CDISCARD =chr(ORD('o') and CtrlMask);
554
CWERASE =chr(ORD('w') and CtrlMask);
555
CREPRINT =chr(ORD('r') and CtrlMask);
564
* TTYDEFCHARS to include an array of default control characters.
566
ttydefchars : array[0..NCCS-1] OF char =(
567
CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT,
568
chr(_POSIX_VDISABLE), CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT,
569
CDISCARD, CMIN, CTIME, CSTATUS, chr(_POSIX_VDISABLE));
574
$Log: termios.inc,v $
575
Revision 1.2 2004/02/05 14:00:45 jonas
576
+ some declarations added from other bsds and /usr/include/sys/termios.h
577
to termios.inc and termiosproc.inc (by Karl-Michael Schindler)
578
+ added crt, mouse (because required by keyboard), keyboard, termio,
579
console to Darwin makefile (thanks to the above they now compile,
580
functionality untested)
581
* fixed wrong dependency for sysconst unit (it was always recompiled)
584
Revision 1.1 2004/01/04 20:05:38 jonas
585
* first working version of the Darwin/Mac OS X (for PowerPC) RTL
586
Several non-essential units are still missing, but make cycle works