blob: f682f4e4968041d41237e3b791d1421a544b9095 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
15struct kbd_data;
16
17typedef void (fn_handler_fn)(struct kbd_data *);
18
19/*
20 * FIXME: explain key_maps tricks.
21 */
22
23struct kbd_data {
Jiri Slabyba186e72012-04-02 13:54:18 +020024 struct tty_port *port;
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 unsigned short **key_maps;
26 char **func_table;
27 fn_handler_fn **fn_handler;
Samuel Thibault04c71972007-10-16 23:27:04 -070028 struct kbdiacruc *accent_table;
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 unsigned int accent_table_size;
Samuel Thibault04c71972007-10-16 23:27:04 -070030 unsigned int diacr;
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 unsigned short sysrq;
32};
33
34struct kbd_data *kbd_alloc(void);
35void kbd_free(struct kbd_data *);
36void kbd_ascebc(struct kbd_data *, unsigned char *);
37
38void kbd_keycode(struct kbd_data *, unsigned int);
Heiko Carstens65c56e02011-02-25 14:28:30 +010039int kbd_ioctl(struct kbd_data *, unsigned int, unsigned long);
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
41/*
42 * Helper Functions.
43 */
Adrian Bunk4448aaf2005-11-08 21:34:42 -080044static inline void
Jiri Slabyba186e72012-04-02 13:54:18 +020045kbd_put_queue(struct tty_port *port, int ch)
Linus Torvalds1da177e2005-04-16 15:20:36 -070046{
Jiri Slabyba186e72012-04-02 13:54:18 +020047 struct tty_struct *tty = tty_port_tty_get(port);
48 if (!tty)
49 return;
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 tty_insert_flip_char(tty, ch, 0);
51 tty_schedule_flip(tty);
Jiri Slabyba186e72012-04-02 13:54:18 +020052 tty_kref_put(tty);
Linus Torvalds1da177e2005-04-16 15:20:36 -070053}
54
Adrian Bunk4448aaf2005-11-08 21:34:42 -080055static inline void
Jiri Slabyba186e72012-04-02 13:54:18 +020056kbd_puts_queue(struct tty_port *port, char *cp)
Linus Torvalds1da177e2005-04-16 15:20:36 -070057{
Jiri Slabyba186e72012-04-02 13:54:18 +020058 struct tty_struct *tty = tty_port_tty_get(port);
59 if (!tty)
60 return;
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 while (*cp)
62 tty_insert_flip_char(tty, *cp++, 0);
63 tty_schedule_flip(tty);
Jiri Slabyba186e72012-04-02 13:54:18 +020064 tty_kref_put(tty);
Linus Torvalds1da177e2005-04-16 15:20:36 -070065}