feat: capability list to enable greater flexibility of devices
[lunaix-os.git] / lunaix-os / usr / libc / includes / termios.h
1 #ifndef __LUNAIX_TERMIOS_H
2 #define __LUNAIX_TERMIOS_H
3
4 #include <lunaix/term.h>
5
6 #define BRKINT _BRKINT
7 #define ICRNL _ICRNL
8 #define IGNBRK _IGNBRK
9 #define IGNCR _IGNCR
10 #define IGNPAR _IGNPAR
11 #define INLCR _INLCR
12 #define INPCK _INPCK
13 #define ISTRIP _ISTRIP
14 #define IUCLC _IUCLC
15 #define IXANY _IXANY
16 #define IXOFF _IXOFF
17 #define IXON _IXON
18 #define PARMRK _PARMRK
19
20 #define OPOST _OPOST
21 #define OCRNL _OCRNL
22
23 // 2
24 // 3
25 // 4
26
27 #define ONLRET _ONLRET
28 #define ONLCR _ONLCR
29
30 // 7
31
32 #define OLCUC _OLCUC
33
34 #define ECHO _ECHO
35 #define ECHOE _ECHOE
36 #define ECHOK _ECHOK
37 #define ECHONL _ECHONL
38 #define ICANON _ICANON
39 #define ISIG _ISIG
40 #define IEXTEN _IEXTEN
41 #define NOFLSH _NOFLSH
42
43 #define VEOF _VEOF
44 #define VEOL _VEOL
45 #define VERASE _VERASE
46 #define VINTR _VINTR
47 #define VKILL _VKILL
48 #define VQUIT _VQUIT
49 #define VSUSP _VSUSP
50 #define VSTART _VSTART
51 #define VSTOP _VSTOP
52 #define VMIN _VMIN
53 #define VTIME _VTIME
54 #define NCCS _NCCS
55
56 #define B50 _B50
57 #define B75 _B75
58 #define B110 _B110
59 #define B134 _B134
60 #define B150 _B150
61 #define B200 _B200
62 #define B300 _B300
63 #define B600 _B600
64 #define B1200 _B1200
65 #define B1800 _B1800
66 #define B2400 _B2400
67 #define B4800 _B4800
68 #define B9600 _B9600
69 #define B19200 _B19200
70 #define B38400 _B38400
71
72 #define CLOCAL _CLOCAL
73 #define CREAD _CREAD
74 #define CS5 _CS5
75 #define CS6 _CS6
76 #define CS7 _CS7
77 #define CS8 _CS8
78 #define CSTOPB _CSTOPB
79 #define CHUPCL _CHUPCL
80 #define CPARENB _CPARENB
81 #define CPARODD _CPARODD
82
83 #define TCSANOW _TCSANOW
84 #define TCSADRAIN _TCSADRAIN
85 #define TCSAFLUSH _TCSAFLUSH
86
87 static inline speed_t cfgetispeed(const struct termios* termios) { return termios->c_baud; }
88 static inline speed_t cfgetospeed(const struct termios* termios) { return termios->c_baud; }
89
90 static inline int cfsetispeed(struct termios* termios, speed_t baud)
91 {
92     termios->c_baud = baud;
93     return 0;
94 }
95
96 static inline int cfsetospeed(struct termios* termios, speed_t baud)
97 {
98     termios->c_baud = baud;
99     return 0;
100 }
101
102
103 // TODO
104 //int     tcdrain(int);
105 //int     tcflow(int, int);
106 //int     tcflush(int, int);
107 // pid_t   tcgetsid(int);
108
109 int     tcgetattr(int, struct termios *);
110 int     tcsendbreak(int, int);
111 int     tcsetattr(int, int, const struct termios *);
112
113
114 #endif /* __LUNAIX_TERMIOS_H */