| 1 | /* |
|---|
| 2 | * linux/include/linux/console.h |
|---|
| 3 | * |
|---|
| 4 | * Copyright (C) 1993 Hamish Macdonald |
|---|
| 5 | * |
|---|
| 6 | * This file is subject to the terms and conditions of the GNU General Public |
|---|
| 7 | * License. See the file COPYING in the main directory of this archive |
|---|
| 8 | * for more details. |
|---|
| 9 | * |
|---|
| 10 | * Changed: |
|---|
| 11 | * 10-Mar-94: Arno Griffioen: Conversion for vt100 emulator port from PC LINUX |
|---|
| 12 | */ |
|---|
| 13 | |
|---|
| 14 | #ifndef _LINUX_CONSOLE_H_ |
|---|
| 15 | #define _LINUX_CONSOLE_H_ 1 |
|---|
| 16 | |
|---|
| 17 | #include <linux/types.h> |
|---|
| 18 | |
|---|
| 19 | struct vc_data; |
|---|
| 20 | struct console_font_op; |
|---|
| 21 | struct console_font; |
|---|
| 22 | struct module; |
|---|
| 23 | |
|---|
| 24 | /* |
|---|
| 25 | * this is what the terminal answers to a ESC-Z or csi0c query. |
|---|
| 26 | */ |
|---|
| 27 | #define VT100ID "\033[?1;2c" |
|---|
| 28 | #define VT102ID "\033[?6c" |
|---|
| 29 | |
|---|
| 30 | struct consw { |
|---|
| 31 | struct module *owner; |
|---|
| 32 | const char *(*con_startup)(void); |
|---|
| 33 | void (*con_init)(struct vc_data *, int); |
|---|
| 34 | void (*con_deinit)(struct vc_data *); |
|---|
| 35 | void (*con_clear)(struct vc_data *, int, int, int, int); |
|---|
| 36 | void (*con_putc)(struct vc_data *, int, int, int); |
|---|
| 37 | void (*con_putcs)(struct vc_data *, const unsigned short *, int, int, int); |
|---|
| 38 | void (*con_cursor)(struct vc_data *, int); |
|---|
| 39 | int (*con_scroll)(struct vc_data *, int, int, int, int); |
|---|
| 40 | void (*con_bmove)(struct vc_data *, int, int, int, int, int, int); |
|---|
| 41 | int (*con_switch)(struct vc_data *); |
|---|
| 42 | int (*con_blank)(struct vc_data *, int, int); |
|---|
| 43 | int (*con_font_set)(struct vc_data *, struct console_font *, unsigned); |
|---|
| 44 | int (*con_font_get)(struct vc_data *, struct console_font *); |
|---|
| 45 | int (*con_font_default)(struct vc_data *, struct console_font *, char *); |
|---|
| 46 | int (*con_font_copy)(struct vc_data *, int); |
|---|
| 47 | int (*con_resize)(struct vc_data *, unsigned int, unsigned int); |
|---|
| 48 | int (*con_set_palette)(struct vc_data *, unsigned char *); |
|---|
| 49 | int (*con_scrolldelta)(struct vc_data *, int); |
|---|
| 50 | int (*con_set_origin)(struct vc_data *); |
|---|
| 51 | void (*con_save_screen)(struct vc_data *); |
|---|
| 52 | __u8 (*con_build_attr)(struct vc_data *, __u8, __u8, __u8, __u8, __u8); |
|---|
| 53 | void (*con_invert_region)(struct vc_data *, __u16 *, int); |
|---|
| 54 | __u16 *(*con_screen_pos)(struct vc_data *, int); |
|---|
| 55 | unsigned long (*con_getxy)(struct vc_data *, unsigned long, int *, int *); |
|---|
| 56 | }; |
|---|
| 57 | |
|---|
| 58 | extern const struct consw *conswitchp; |
|---|
| 59 | |
|---|
| 60 | extern const struct consw dummy_con; /* dummy console buffer */ |
|---|
| 61 | extern const struct consw vga_con; /* VGA text console */ |
|---|
| 62 | extern const struct consw newport_con; /* SGI Newport console */ |
|---|
| 63 | extern const struct consw prom_con; /* SPARC PROM console */ |
|---|
| 64 | |
|---|
| 65 | int take_over_console(const struct consw *sw, int first, int last, int deflt); |
|---|
| 66 | void give_up_console(const struct consw *sw); |
|---|
| 67 | |
|---|
| 68 | /* scroll */ |
|---|
| 69 | #define SM_UP (1) |
|---|
| 70 | #define SM_DOWN (2) |
|---|
| 71 | |
|---|
| 72 | /* cursor */ |
|---|
| 73 | #define CM_DRAW (1) |
|---|
| 74 | #define CM_ERASE (2) |
|---|
| 75 | #define CM_MOVE (3) |
|---|
| 76 | |
|---|
| 77 | /* |
|---|
| 78 | * The interface for a console, or any other device that wants to capture |
|---|
| 79 | * console messages (printer driver?) |
|---|
| 80 | * |
|---|
| 81 | * If a console driver is marked CON_BOOT then it will be auto-unregistered |
|---|
| 82 | * when the first real console is registered. This is for early-printk drivers. |
|---|
| 83 | */ |
|---|
| 84 | |
|---|
| 85 | #define CON_PRINTBUFFER (1) |
|---|
| 86 | #define CON_CONSDEV (2) /* Last on the command line */ |
|---|
| 87 | #define CON_ENABLED (4) |
|---|
| 88 | #define CON_BOOT (8) |
|---|
| 89 | |
|---|
| 90 | struct console |
|---|
| 91 | { |
|---|
| 92 | char name[8]; |
|---|
| 93 | void (*write)(struct console *, const char *, unsigned); |
|---|
| 94 | int (*read)(struct console *, char *, unsigned); |
|---|
| 95 | struct tty_driver *(*device)(struct console *, int *); |
|---|
| 96 | void (*unblank)(void); |
|---|
| 97 | int (*setup)(struct console *, char *); |
|---|
| 98 | short flags; |
|---|
| 99 | short index; |
|---|
| 100 | int cflag; |
|---|
| 101 | void *data; |
|---|
| 102 | struct console *next; |
|---|
| 103 | }; |
|---|
| 104 | |
|---|
| 105 | extern int add_preferred_console(char *name, int idx, char *options); |
|---|
| 106 | extern void register_console(struct console *); |
|---|
| 107 | extern int unregister_console(struct console *); |
|---|
| 108 | extern struct console *console_drivers; |
|---|
| 109 | extern void acquire_console_sem(void); |
|---|
| 110 | extern int try_acquire_console_sem(void); |
|---|
| 111 | extern void release_console_sem(void); |
|---|
| 112 | extern void console_conditional_schedule(void); |
|---|
| 113 | extern void console_unblank(void); |
|---|
| 114 | extern struct tty_driver *console_device(int *); |
|---|
| 115 | extern void console_stop(struct console *); |
|---|
| 116 | extern void console_start(struct console *); |
|---|
| 117 | extern int is_console_locked(void); |
|---|
| 118 | |
|---|
| 119 | /* Some debug stub to catch some of the obvious races in the VT code */ |
|---|
| 120 | #if 1 |
|---|
| 121 | #define WARN_CONSOLE_UNLOCKED() WARN_ON(!is_console_locked() && !oops_in_progress) |
|---|
| 122 | #else |
|---|
| 123 | #define WARN_CONSOLE_UNLOCKED() |
|---|
| 124 | #endif |
|---|
| 125 | |
|---|
| 126 | /* VESA Blanking Levels */ |
|---|
| 127 | #define VESA_NO_BLANKING 0 |
|---|
| 128 | #define VESA_VSYNC_SUSPEND 1 |
|---|
| 129 | #define VESA_HSYNC_SUSPEND 2 |
|---|
| 130 | #define VESA_POWERDOWN 3 |
|---|
| 131 | |
|---|
| 132 | #endif /* _LINUX_CONSOLE_H */ |
|---|