10
10
#include "riscv.h"
11
11
#include "riscv_private.h"
12
12
13
+ /*
14
+ * The control mode flag for keyboard.
15
+ *
16
+ * ICANON: Enable canonical mode.
17
+ * ECHO: Echo input characters.
18
+ * ISIG: When any of the characters INTR, QUIT,
19
+ * SUSP, or DSUSP are received, generate the
20
+ * corresponding signal.
21
+ *
22
+ * It is essential to re-enable ISIG upon exit.
23
+ * Otherwise, the default signal handler will
24
+ * not catch the signal. E.g., SIGINT generated by
25
+ * CTRL + c.
26
+ *
27
+ */
28
+ #define TERMIOS_C_CFLAG (ICANON | ECHO | ISIG)
29
+
13
30
/* Emulate 8250 (plain, without loopback mode support) */
14
31
15
32
#define U8250_INT_THRE 1
@@ -19,7 +36,7 @@ static void reset_keyboard_input()
19
36
/* Re-enable echo, etc. on keyboard. */
20
37
struct termios term ;
21
38
tcgetattr (0 , & term );
22
- term .c_lflag |= ICANON | ECHO ;
39
+ term .c_lflag |= TERMIOS_C_CFLAG ;
23
40
tcsetattr (0 , TCSANOW , & term );
24
41
}
25
42
@@ -31,7 +48,7 @@ void capture_keyboard_input()
31
48
32
49
struct termios term ;
33
50
tcgetattr (0 , & term );
34
- term .c_lflag &= ~( ICANON | ECHO | ISIG ) ; /* Disable echo as well */
51
+ term .c_lflag &= ~TERMIOS_C_CFLAG ; /* Disable echo as well */
35
52
tcsetattr (0 , TCSANOW , & term );
36
53
}
37
54
0 commit comments