keyboard.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include <linux/tty.h>
  9. #include <linux/tty_flip.h>
  10. #include <linux/keyboard.h>
  11. #define NR_FN_HANDLER 20
  12. struct kbd_data;
  13. typedef void (fn_handler_fn)(struct kbd_data *);
  14. /*
  15. * FIXME: explain key_maps tricks.
  16. */
  17. struct kbd_data {
  18. struct tty_port *port;
  19. unsigned short **key_maps;
  20. char **func_table;
  21. fn_handler_fn **fn_handler;
  22. struct kbdiacruc *accent_table;
  23. unsigned int accent_table_size;
  24. unsigned int diacr;
  25. unsigned short sysrq;
  26. };
  27. struct kbd_data *kbd_alloc(void);
  28. void kbd_free(struct kbd_data *);
  29. void kbd_ascebc(struct kbd_data *, unsigned char *);
  30. void kbd_keycode(struct kbd_data *, unsigned int);
  31. int kbd_ioctl(struct kbd_data *, unsigned int, unsigned long);
  32. /*
  33. * Helper Functions.
  34. */
  35. static inline void
  36. kbd_put_queue(struct tty_port *port, int ch)
  37. {
  38. struct tty_struct *tty = tty_port_tty_get(port);
  39. if (!tty)
  40. return;
  41. tty_insert_flip_char(tty, ch, 0);
  42. tty_schedule_flip(tty);
  43. tty_kref_put(tty);
  44. }
  45. static inline void
  46. kbd_puts_queue(struct tty_port *port, char *cp)
  47. {
  48. struct tty_struct *tty = tty_port_tty_get(port);
  49. if (!tty)
  50. return;
  51. while (*cp)
  52. tty_insert_flip_char(tty, *cp++, 0);
  53. tty_schedule_flip(tty);
  54. tty_kref_put(tty);
  55. }