blob: c467589c7f452fdfc2aeabd509aaddd6086d7713 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * ebcdic keycode functions for s390 console drivers
4 *
Heiko Carstensa53c8fa2012-07-20 11:15:04 +02005 * Copyright IBM Corp. 2003
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 * 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
15struct kbd_data;
16
Farhan Aliaa0f2dd2018-02-22 11:22:23 -050017extern int ebc_funcbufsize, ebc_funcbufleft;
18extern char *ebc_func_table[MAX_NR_FUNC];
19extern char ebc_func_buf[];
20extern char *ebc_funcbufptr;
21extern unsigned int ebc_keymap_count;
22
23extern struct kbdiacruc ebc_accent_table[];
24extern unsigned int ebc_accent_table_size;
25extern unsigned short *ebc_key_maps[MAX_NR_KEYMAPS];
26extern unsigned short ebc_plain_map[NR_KEYS];
27
Linus Torvalds1da177e2005-04-16 15:20:36 -070028typedef void (fn_handler_fn)(struct kbd_data *);
29
30/*
31 * FIXME: explain key_maps tricks.
32 */
33
34struct kbd_data {
Jiri Slabyba186e72012-04-02 13:54:18 +020035 struct tty_port *port;
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 unsigned short **key_maps;
37 char **func_table;
38 fn_handler_fn **fn_handler;
Samuel Thibault04c71972007-10-16 23:27:04 -070039 struct kbdiacruc *accent_table;
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 unsigned int accent_table_size;
Samuel Thibault04c71972007-10-16 23:27:04 -070041 unsigned int diacr;
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 unsigned short sysrq;
43};
44
45struct kbd_data *kbd_alloc(void);
46void kbd_free(struct kbd_data *);
47void kbd_ascebc(struct kbd_data *, unsigned char *);
48
49void kbd_keycode(struct kbd_data *, unsigned int);
Heiko Carstens65c56e02011-02-25 14:28:30 +010050int kbd_ioctl(struct kbd_data *, unsigned int, unsigned long);
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
52/*
53 * Helper Functions.
54 */
Adrian Bunk4448aaf2005-11-08 21:34:42 -080055static inline void
Jiri Slabyba186e72012-04-02 13:54:18 +020056kbd_put_queue(struct tty_port *port, int ch)
Linus Torvalds1da177e2005-04-16 15:20:36 -070057{
Jiri Slaby92a19f92013-01-03 15:53:03 +010058 tty_insert_flip_char(port, ch, 0);
Jiri Slaby6732c8b2013-01-03 15:53:07 +010059 tty_schedule_flip(port);
Linus Torvalds1da177e2005-04-16 15:20:36 -070060}
61
Adrian Bunk4448aaf2005-11-08 21:34:42 -080062static inline void
Jiri Slabyba186e72012-04-02 13:54:18 +020063kbd_puts_queue(struct tty_port *port, char *cp)
Linus Torvalds1da177e2005-04-16 15:20:36 -070064{
65 while (*cp)
Jiri Slaby92a19f92013-01-03 15:53:03 +010066 tty_insert_flip_char(port, *cp++, 0);
Jiri Slaby6732c8b2013-01-03 15:53:07 +010067 tty_schedule_flip(port);
Linus Torvalds1da177e2005-04-16 15:20:36 -070068}