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