keyboard.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * BK Id: %F% %I% %G% %U% %#%
  3.  */
  4. /*
  5.  *  linux/include/asm-ppc/keyboard.h
  6.  *
  7.  *  Created 3 Nov 1996 by Geert Uytterhoeven
  8.  *  Modified for Power Macintosh by Paul Mackerras
  9.  */
  10. /*
  11.  * This file contains the ppc architecture specific keyboard definitions -
  12.  * like the intel pc for prep systems, different for power macs.
  13.  */
  14. #ifndef __ASMPPC_KEYBOARD_H
  15. #define __ASMPPC_KEYBOARD_H
  16. #ifdef __KERNEL__
  17. #include <linux/adb.h>
  18. #include <asm/machdep.h>
  19. #include <linux/kernel.h>
  20. #include <linux/ioport.h>
  21. #include <linux/kd.h>
  22. #include <asm/io.h>
  23. /* IBM Spruce platform is different. */
  24. #ifdef CONFIG_SPRUCE
  25. #include <platforms/spruce.h>
  26. #endif
  27. #ifndef KEYBOARD_IRQ
  28. #define KEYBOARD_IRQ 1
  29. #endif
  30. #define DISABLE_KBD_DURING_INTERRUPTS 0
  31. #define INIT_KBD
  32. static inline int kbd_setkeycode(unsigned int scancode, unsigned int keycode)
  33. {
  34. if ( ppc_md.kbd_setkeycode )
  35. return ppc_md.kbd_setkeycode(scancode, keycode);
  36. else
  37. return 0;
  38. }
  39.   
  40. static inline int kbd_getkeycode(unsigned int scancode)
  41. {
  42. if ( ppc_md.kbd_getkeycode )
  43. return ppc_md.kbd_getkeycode(scancode);
  44. else
  45. return 0;
  46. }
  47.   
  48. static inline int kbd_translate(unsigned char keycode, unsigned char *keycodep,
  49. char raw_mode)
  50. {
  51. if ( ppc_md.kbd_translate )
  52. return ppc_md.kbd_translate(keycode, keycodep, raw_mode);
  53. else
  54. return 0;
  55. }
  56.   
  57. static inline int kbd_unexpected_up(unsigned char keycode)
  58. {
  59. if ( ppc_md.kbd_unexpected_up )
  60. return ppc_md.kbd_unexpected_up(keycode);
  61. else
  62. return 0;
  63. }
  64.   
  65. static inline void kbd_leds(unsigned char leds)
  66. {
  67. if ( ppc_md.kbd_leds )
  68. ppc_md.kbd_leds(leds);
  69. }
  70. static inline void kbd_init_hw(void)
  71. {
  72. if ( ppc_md.kbd_init_hw )
  73. ppc_md.kbd_init_hw();
  74. }
  75. #define kbd_sysrq_xlate (ppc_md.ppc_kbd_sysrq_xlate)
  76. extern unsigned long SYSRQ_KEY;
  77. /* resource allocation */
  78. #define kbd_request_region()
  79. #define kbd_request_irq(handler) request_irq(KEYBOARD_IRQ, handler, 0, 
  80.                                              "keyboard", NULL)
  81. /* How to access the keyboard macros on this platform.  */
  82. #ifndef kbd_read_input
  83. #define kbd_read_input() inb(KBD_DATA_REG)
  84. #define kbd_read_status() inb(KBD_STATUS_REG)
  85. #define kbd_write_output(val) outb(val, KBD_DATA_REG)
  86. #define kbd_write_command(val) outb(val, KBD_CNTL_REG)
  87. #endif
  88. /* Some stoneage hardware needs delays after some operations.  */
  89. #define kbd_pause() do { } while(0)
  90. /*
  91.  * Machine specific bits for the PS/2 driver
  92.  */
  93. #ifndef AUX_IRQ
  94. #define AUX_IRQ 12
  95. #endif
  96. #define aux_request_irq(hand, dev_id)
  97. request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS/2 Mouse", dev_id)
  98. #define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id)
  99. #endif /* __KERNEL__ */
  100. #endif /* __ASMPPC_KEYBOARD_H */