blob: acab28d4f06b8fa31e0998a03598c990828ff5b7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * ebcdic keycode functions for s390 console drivers
3 *
Heiko Carstensa53c8fa2012-07-20 11:15:04 +02004 * Copyright IBM Corp. 2003
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * 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
14struct kbd_data;
15
16typedef void (fn_handler_fn)(struct kbd_data *);
17
18/*
19 * FIXME: explain key_maps tricks.
20 */
21
22struct kbd_data {
Jiri Slabyba186e72012-04-02 13:54:18 +020023 struct tty_port *port;
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 unsigned short **key_maps;
25 char **func_table;
26 fn_handler_fn **fn_handler;
Samuel Thibault04c71972007-10-16 23:27:04 -070027 struct kbdiacruc *accent_table;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 unsigned int accent_table_size;
Samuel Thibault04c71972007-10-16 23:27:04 -070029 unsigned int diacr;
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 unsigned short sysrq;
31};
32
33struct kbd_data *kbd_alloc(void);
34void kbd_free(struct kbd_data *);
35void kbd_ascebc(struct kbd_data *, unsigned char *);
36
37void kbd_keycode(struct kbd_data *, unsigned int);
Heiko Carstens65c56e02011-02-25 14:28:30 +010038int kbd_ioctl(struct kbd_data *, unsigned int, unsigned long);
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
40/*
41 * Helper Functions.
42 */
Adrian Bunk4448aaf2005-11-08 21:34:42 -080043static inline void
Jiri Slabyba186e72012-04-02 13:54:18 +020044kbd_put_queue(struct tty_port *port, int ch)
Linus Torvalds1da177e2005-04-16 15:20:36 -070045{
Jiri Slabyba186e72012-04-02 13:54:18 +020046 struct tty_struct *tty = tty_port_tty_get(port);
47 if (!tty)
48 return;
Jiri Slaby92a19f92013-01-03 15:53:03 +010049 tty_insert_flip_char(port, ch, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 tty_schedule_flip(tty);
Jiri Slabyba186e72012-04-02 13:54:18 +020051 tty_kref_put(tty);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052}
53
Adrian Bunk4448aaf2005-11-08 21:34:42 -080054static inline void
Jiri Slabyba186e72012-04-02 13:54:18 +020055kbd_puts_queue(struct tty_port *port, char *cp)
Linus Torvalds1da177e2005-04-16 15:20:36 -070056{
Jiri Slabyba186e72012-04-02 13:54:18 +020057 struct tty_struct *tty = tty_port_tty_get(port);
58 if (!tty)
59 return;
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 while (*cp)
Jiri Slaby92a19f92013-01-03 15:53:03 +010061 tty_insert_flip_char(port, *cp++, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 tty_schedule_flip(tty);
Jiri Slabyba186e72012-04-02 13:54:18 +020063 tty_kref_put(tty);
Linus Torvalds1da177e2005-04-16 15:20:36 -070064}