usbkbd.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*++
  2. Copyright (c) 2013 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. usbkbd.h
  5. Abstract:
  6. This header contains internal definitions for the USB keyboard driver.
  7. Author:
  8. Evan Green 20-Mar-2013
  9. --*/
  10. //
  11. // ------------------------------------------------------------------- Includes
  12. //
  13. #include <minoca/kernel/driver.h>
  14. #include <minoca/usb/usb.h>
  15. #include <minoca/usrinput/usrinput.h>
  16. //
  17. // ---------------------------------------------------------------- Definitions
  18. //
  19. //
  20. // Define the allocation tag used throughout the USB keyboard driver.
  21. //
  22. #define USB_KEYBOARD_ALLOCATION_TAG 0x4B627355 // 'KbsU'
  23. //
  24. // Define the number of keys in the keycode array of the standard HID boot
  25. // keyboard report.
  26. //
  27. #define USB_KEYBOARD_REPORT_KEY_COUNT 6
  28. //
  29. // Define the minimum valid keycode and keycode count.
  30. //
  31. #define USB_KEYBOARD_INVALID_KEY_CODE 1
  32. #define USB_KEYBOARD_FIRST_VALID_KEY_CODE 4
  33. #define USB_KEYCOARD_KEY_CODE_COUNT 0xE8
  34. //
  35. // Define the modifier key bits.
  36. //
  37. #define USB_KEYBOARD_MODIFIER_LEFT_CONTROL 0x01
  38. #define USB_KEYBOARD_MODIFIER_LEFT_SHIFT 0x02
  39. #define USB_KEYBOARD_MODIFIER_LEFT_ALT 0x04
  40. #define USB_KEYBOARD_MODIFIER_LEFT_GUI 0x08
  41. #define USB_KEYBOARD_MODIFIER_RIGHT_CONTROL 0x10
  42. #define USB_KEYBOARD_MODIFIER_RIGHT_SHIFT 0x20
  43. #define USB_KEYBOARD_MODIFIER_RIGHT_ALT 0x40
  44. #define USB_KEYBOARD_MODIFIER_RIGHT_GUI 0x80
  45. //
  46. // Define the LED bits.
  47. //
  48. #define USB_KEYBOARD_LED_NUM_LOCK 0x01
  49. #define USB_KEYBOARD_LED_CAPS_LOCK 0x02
  50. #define USB_KEYBOARD_LED_SCROLL_LOCK 0x04
  51. #define USB_KEYBOARD_LED_COMPOSE 0x08
  52. #define USB_KEYBOARD_LED_KANA 0x10
  53. //
  54. // ------------------------------------------------------ Data Type Definitions
  55. //
  56. /*++
  57. Structure Description:
  58. This structure stores the standard report format for a USB HID keyboard
  59. that conforms to the boot protocol.
  60. Members:
  61. ModifierKeys - Stores a bitfield of modifier keys (control, shift, etc).
  62. Reserved - Stores an unused byte.
  63. Keycode - Stores the array of keys that are pressed down.
  64. --*/
  65. typedef struct _USB_KEYBOARD_REPORT {
  66. UCHAR ModifierKeys;
  67. UCHAR Reserved;
  68. UCHAR Keycode[USB_KEYBOARD_REPORT_KEY_COUNT];
  69. } PACKED USB_KEYBOARD_REPORT, *PUSB_KEYBOARD_REPORT;
  70. //
  71. // -------------------------------------------------------------------- Globals
  72. //
  73. //
  74. // Define the conversion tables that get between HID usages and OS keyboard key
  75. // codes.
  76. //
  77. extern KEYBOARD_KEY UsbKbdControlKeys[BITS_PER_BYTE];
  78. extern KEYBOARD_KEY UsbKbdKeys[USB_KEYCOARD_KEY_CODE_COUNT];
  79. //
  80. // -------------------------------------------------------- Function Prototypes
  81. //