blob: a31f339211d58966b83b0e7864a1db54347f8dc2 [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 Slaby92a19f92013-01-03 15:53:03 +010046 tty_insert_flip_char(port, ch, 0);
Jiri Slaby6732c8b2013-01-03 15:53:07 +010047 tty_schedule_flip(port);
Linus Torvalds1da177e2005-04-16 15:20:36 -070048}
49
Adrian Bunk4448aaf2005-11-08 21:34:42 -080050static inline void
Jiri Slabyba186e72012-04-02 13:54:18 +020051kbd_puts_queue(struct tty_port *port, char *cp)
Linus Torvalds1da177e2005-04-16 15:20:36 -070052{
53 while (*cp)
Jiri Slaby92a19f92013-01-03 15:53:03 +010054 tty_insert_flip_char(port, *cp++, 0);
Jiri Slaby6732c8b2013-01-03 15:53:07 +010055 tty_schedule_flip(port);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056}