19
19
#ifndef GRUB_TERM_HEADER
20
20
#define GRUB_TERM_HEADER 1
22
#define GRUB_TERM_NO_KEY 0
22
24
/* Internal codes used by GRUB to represent terminal input. */
23
#define GRUB_TERM_LEFT 2
24
#define GRUB_TERM_RIGHT 6
25
#define GRUB_TERM_UP 16
26
#define GRUB_TERM_DOWN 14
27
#define GRUB_TERM_HOME 1
28
#define GRUB_TERM_END 5
29
#define GRUB_TERM_DC 4
30
#define GRUB_TERM_PPAGE 7
31
#define GRUB_TERM_NPAGE 3
25
/* Only for keys otherwise not having shifted modification. */
26
#define GRUB_TERM_SHIFT 0x01000000
27
#define GRUB_TERM_CTRL 0x02000000
28
#define GRUB_TERM_ALT 0x04000000
30
/* Keys without associated character. */
31
#define GRUB_TERM_EXTENDED 0x00800000
32
#define GRUB_TERM_KEY_MASK 0x00ffffff
34
#define GRUB_TERM_KEY_LEFT (GRUB_TERM_EXTENDED | 0x4b)
35
#define GRUB_TERM_KEY_RIGHT (GRUB_TERM_EXTENDED | 0x4d)
36
#define GRUB_TERM_KEY_UP (GRUB_TERM_EXTENDED | 0x48)
37
#define GRUB_TERM_KEY_DOWN (GRUB_TERM_EXTENDED | 0x50)
38
#define GRUB_TERM_KEY_HOME (GRUB_TERM_EXTENDED | 0x47)
39
#define GRUB_TERM_KEY_END (GRUB_TERM_EXTENDED | 0x4f)
40
#define GRUB_TERM_KEY_DC (GRUB_TERM_EXTENDED | 0x53)
41
#define GRUB_TERM_KEY_PPAGE (GRUB_TERM_EXTENDED | 0x49)
42
#define GRUB_TERM_KEY_NPAGE (GRUB_TERM_EXTENDED | 0x51)
43
#define GRUB_TERM_KEY_F1 (GRUB_TERM_EXTENDED | 0x3b)
44
#define GRUB_TERM_KEY_F2 (GRUB_TERM_EXTENDED | 0x3c)
45
#define GRUB_TERM_KEY_F3 (GRUB_TERM_EXTENDED | 0x3d)
46
#define GRUB_TERM_KEY_F4 (GRUB_TERM_EXTENDED | 0x3e)
47
#define GRUB_TERM_KEY_F5 (GRUB_TERM_EXTENDED | 0x3f)
48
#define GRUB_TERM_KEY_F6 (GRUB_TERM_EXTENDED | 0x40)
49
#define GRUB_TERM_KEY_F7 (GRUB_TERM_EXTENDED | 0x41)
50
#define GRUB_TERM_KEY_F8 (GRUB_TERM_EXTENDED | 0x42)
51
#define GRUB_TERM_KEY_F9 (GRUB_TERM_EXTENDED | 0x43)
52
#define GRUB_TERM_KEY_F10 (GRUB_TERM_EXTENDED | 0x44)
53
#define GRUB_TERM_KEY_F11 (GRUB_TERM_EXTENDED | 0x57)
54
#define GRUB_TERM_KEY_F12 (GRUB_TERM_EXTENDED | 0x58)
55
#define GRUB_TERM_KEY_INSERT (GRUB_TERM_EXTENDED | 0x52)
56
#define GRUB_TERM_KEY_CENTER (GRUB_TERM_EXTENDED | 0x4c)
32
58
#define GRUB_TERM_ESC '\e'
33
59
#define GRUB_TERM_TAB '\t'
34
#define GRUB_TERM_BACKSPACE 8
60
#define GRUB_TERM_BACKSPACE '\b'
88
114
/* Bitmasks for modifier keys returned by grub_getkeystatus. */
89
#define GRUB_TERM_STATUS_SHIFT (1 << 0)
90
#define GRUB_TERM_STATUS_CTRL (1 << 1)
91
#define GRUB_TERM_STATUS_ALT (1 << 2)
115
#define GRUB_TERM_STATUS_RSHIFT (1 << 0)
116
#define GRUB_TERM_STATUS_LSHIFT (1 << 1)
117
#define GRUB_TERM_STATUS_RCTRL (1 << 2)
118
#define GRUB_TERM_STATUS_RALT (1 << 3)
119
#define GRUB_TERM_STATUS_SCROLL (1 << 4)
120
#define GRUB_TERM_STATUS_NUM (1 << 5)
121
#define GRUB_TERM_STATUS_CAPS (1 << 6)
122
#define GRUB_TERM_STATUS_LCTRL (1 << 8)
123
#define GRUB_TERM_STATUS_LALT (1 << 9)
93
125
/* Menu-related geometrical constants. */
128
160
/* Clean up the terminal. */
129
161
grub_err_t (*fini) (struct grub_term_input *term);
131
/* Check if any input character is available. */
132
int (*checkkey) (struct grub_term_input *term);
134
/* Get a character. */
163
/* Get a character if any input character is available. Otherwise return -1 */
135
164
int (*getkey) (struct grub_term_input *term);
137
166
/* Get keyboard modifier status. */
279
308
void grub_putcode (grub_uint32_t code, struct grub_term_output *term);
280
309
int EXPORT_FUNC(grub_getkey) (void);
281
310
int EXPORT_FUNC(grub_checkkey) (void);
282
int EXPORT_FUNC(grub_getkeystatus) (void);
283
311
void grub_cls (void);
284
312
void EXPORT_FUNC(grub_refresh) (void);
285
313
void grub_puts_terminal (const char *str, struct grub_term_output *term);
459
487
grub_putcode (' ', term);
490
extern void (*EXPORT_VAR (grub_term_poll_usb)) (void);
463
/* For convenience. */
464
#define GRUB_TERM_ASCII_CHAR(c) ((c) & 0xff)
492
#define GRUB_TERM_REPEAT_PRE_INTERVAL 400
493
#define GRUB_TERM_REPEAT_INTERVAL 50
466
495
#endif /* ! ASM_FILE */