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