Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * ebcdic keycode functions for s390 console drivers |
| 4 | * |
Heiko Carstens | a53c8fa | 2012-07-20 11:15:04 +0200 | [diff] [blame] | 5 | * Copyright IBM Corp. 2003 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), |
| 7 | */ |
| 8 | |
| 9 | #include <linux/tty.h> |
| 10 | #include <linux/tty_flip.h> |
| 11 | #include <linux/keyboard.h> |
| 12 | |
| 13 | #define NR_FN_HANDLER 20 |
| 14 | |
| 15 | struct kbd_data; |
| 16 | |
Farhan Ali | aa0f2dd | 2018-02-22 11:22:23 -0500 | [diff] [blame] | 17 | extern int ebc_funcbufsize, ebc_funcbufleft; |
| 18 | extern char *ebc_func_table[MAX_NR_FUNC]; |
| 19 | extern char ebc_func_buf[]; |
| 20 | extern char *ebc_funcbufptr; |
| 21 | extern unsigned int ebc_keymap_count; |
| 22 | |
| 23 | extern struct kbdiacruc ebc_accent_table[]; |
| 24 | extern unsigned int ebc_accent_table_size; |
| 25 | extern unsigned short *ebc_key_maps[MAX_NR_KEYMAPS]; |
| 26 | extern unsigned short ebc_plain_map[NR_KEYS]; |
| 27 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | typedef void (fn_handler_fn)(struct kbd_data *); |
| 29 | |
| 30 | /* |
| 31 | * FIXME: explain key_maps tricks. |
| 32 | */ |
| 33 | |
| 34 | struct kbd_data { |
Jiri Slaby | ba186e7 | 2012-04-02 13:54:18 +0200 | [diff] [blame] | 35 | struct tty_port *port; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | unsigned short **key_maps; |
| 37 | char **func_table; |
| 38 | fn_handler_fn **fn_handler; |
Samuel Thibault | 04c7197 | 2007-10-16 23:27:04 -0700 | [diff] [blame] | 39 | struct kbdiacruc *accent_table; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | unsigned int accent_table_size; |
Samuel Thibault | 04c7197 | 2007-10-16 23:27:04 -0700 | [diff] [blame] | 41 | unsigned int diacr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | unsigned short sysrq; |
| 43 | }; |
| 44 | |
| 45 | struct kbd_data *kbd_alloc(void); |
| 46 | void kbd_free(struct kbd_data *); |
| 47 | void kbd_ascebc(struct kbd_data *, unsigned char *); |
| 48 | |
| 49 | void kbd_keycode(struct kbd_data *, unsigned int); |
Heiko Carstens | 65c56e0 | 2011-02-25 14:28:30 +0100 | [diff] [blame] | 50 | int kbd_ioctl(struct kbd_data *, unsigned int, unsigned long); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
| 52 | /* |
| 53 | * Helper Functions. |
| 54 | */ |
Adrian Bunk | 4448aaf | 2005-11-08 21:34:42 -0800 | [diff] [blame] | 55 | static inline void |
Jiri Slaby | ba186e7 | 2012-04-02 13:54:18 +0200 | [diff] [blame] | 56 | kbd_put_queue(struct tty_port *port, int ch) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | { |
Jiri Slaby | 92a19f9 | 2013-01-03 15:53:03 +0100 | [diff] [blame] | 58 | tty_insert_flip_char(port, ch, 0); |
Jiri Slaby | 6732c8b | 2013-01-03 15:53:07 +0100 | [diff] [blame] | 59 | tty_schedule_flip(port); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | } |
| 61 | |
Adrian Bunk | 4448aaf | 2005-11-08 21:34:42 -0800 | [diff] [blame] | 62 | static inline void |
Jiri Slaby | ba186e7 | 2012-04-02 13:54:18 +0200 | [diff] [blame] | 63 | kbd_puts_queue(struct tty_port *port, char *cp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | { |
| 65 | while (*cp) |
Jiri Slaby | 92a19f9 | 2013-01-03 15:53:03 +0100 | [diff] [blame] | 66 | tty_insert_flip_char(port, *cp++, 0); |
Jiri Slaby | 6732c8b | 2013-01-03 15:53:07 +0100 | [diff] [blame] | 67 | tty_schedule_flip(port); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | } |