Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
termios.h
Go to the documentation of this file.
1 
6 #ifndef _TENOK_SYS_TERMIOS_H
7 #define _TENOK_SYS_TERMIOS_H
8 
9 #define NCCS 32
10 
11 /* Input flags */
12 #define IGNBRK 0000001
13 #define BRKINT 0000002
14 #define IGNPAR 0000004
15 #define INPCK 0000020
16 #define ISTRIP 0000040
17 #define INLCR 0000100
18 #define IGNCR 0000200
19 #define ICRNL 0000400
20 #define IXON 0002000
21 #define IXOFF 0010000
22 
23 /* Output flags */
24 #define OPOST 0000001 /* Output is processed at all */
25 #define ONLCR 0000004 /* A newline goes out as a return and a newline */
26 
27 /* Control flags */
28 #define CS8 0000060
29 #define CSIZE 0000060
30 #define PARENB 0000400
31 
32 /* Local flags */
33 #define ISIG 0000001
34 #define ICANON 0000002
35 #define ECHO 0000010
36 #define ECHOE 0000020
37 #define ECHOK 0000040
38 #define ECHONL 0000100
39 #define IEXTEN 0100000
40 
41 /* Indices into c_cc */
42 #define VINTR 0
43 #define VQUIT 1
44 #define VERASE 2
45 #define VKILL 3
46 #define VEOF 4
47 #define VTIME 5
48 #define VMIN 6
49 
50 /* Actions of tcsetattr(). Tenok does not buffer, all three are the same */
51 #define TCSANOW 0
52 #define TCSADRAIN 1
53 #define TCSAFLUSH 2
54 
55 #define B0 0
56 #define B9600 13
57 #define B115200 17
58 
59 /* Requests of ioctl(), with the numbers Linux gives them */
60 #define TCGETS 0x5401
61 #define TCSETS 0x5402
62 #define TIOCGWINSZ 0x5413
63 
64 typedef unsigned char cc_t;
65 typedef unsigned int speed_t;
66 typedef unsigned int tcflag_t;
67 
68 struct termios {
69  tcflag_t c_iflag;
70  tcflag_t c_oflag;
71  tcflag_t c_cflag;
72  tcflag_t c_lflag;
73  cc_t c_line;
74  cc_t c_cc[NCCS];
75  speed_t c_ispeed;
76  speed_t c_ospeed;
77 };
78 
79 struct winsize {
80  unsigned short ws_row;
81  unsigned short ws_col;
82  unsigned short ws_xpixel;
83  unsigned short ws_ypixel;
84 };
85 
92 int tcgetattr(int fd, struct termios *termios_p);
93 
102 int tcsetattr(int fd, int actions, const struct termios *termios_p);
103 
104 #endif
Definition: termios.h:68
Definition: termios.h:79
int tcgetattr(int fd, struct termios *termios_p)
Read the settings of the terminal a descriptor refers to.
Definition: termios.c:5
int tcsetattr(int fd, int actions, const struct termios *termios_p)
Replace the settings of the terminal a descriptor refers to.
Definition: termios.c:10