Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

SimpleTextInEx.h 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. /** @file
  2. Simple Text Input Ex protocol from the UEFI 2.0 specification.
  3. This protocol defines an extension to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL
  4. which exposes much more state and modifier information from the input device,
  5. also allows one to register a notification for a particular keystroke.
  6. Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
  7. This program and the accompanying materials
  8. are licensed and made available under the terms and conditions of the BSD License
  9. which accompanies this distribution. The full text of the license may be found at
  10. http://opensource.org/licenses/bsd-license.php
  11. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  13. **/
  14. #ifndef __SIMPLE_TEXT_IN_EX_H__
  15. #define __SIMPLE_TEXT_IN_EX_H__
  16. FILE_LICENCE ( BSD3 );
  17. #include <ipxe/efi/Protocol/SimpleTextIn.h>
  18. #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
  19. {0xdd9e7534, 0x7762, 0x4698, { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } }
  20. typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL;
  21. /**
  22. The Reset() function resets the input device hardware. As part
  23. of initialization process, the firmware/device will make a quick
  24. but reasonable attempt to verify that the device is functioning.
  25. If the ExtendedVerification flag is TRUE the firmware may take
  26. an extended amount of time to verify the device is operating on
  27. reset. Otherwise the reset operation is to occur as quickly as
  28. possible. The hardware verification process is not defined by
  29. this specification and is left up to the platform firmware or
  30. driver to implement.
  31. @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
  32. @param ExtendedVerification Indicates that the driver may
  33. perform a more exhaustive
  34. verification operation of the
  35. device during reset.
  36. @retval EFI_SUCCESS The device was reset.
  37. @retval EFI_DEVICE_ERROR The device is not functioning
  38. correctly and could not be reset.
  39. **/
  40. typedef
  41. EFI_STATUS
  42. (EFIAPI *EFI_INPUT_RESET_EX)(
  43. IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
  44. IN BOOLEAN ExtendedVerification
  45. );
  46. ///
  47. /// EFI_KEY_TOGGLE_STATE. The toggle states are defined.
  48. /// They are: EFI_TOGGLE_STATE_VALID, EFI_SCROLL_LOCK_ACTIVE
  49. /// EFI_NUM_LOCK_ACTIVE, EFI_CAPS_LOCK_ACTIVE
  50. ///
  51. typedef UINT8 EFI_KEY_TOGGLE_STATE;
  52. typedef struct _EFI_KEY_STATE {
  53. ///
  54. /// Reflects the currently pressed shift
  55. /// modifiers for the input device. The
  56. /// returned value is valid only if the high
  57. /// order bit has been set.
  58. ///
  59. UINT32 KeyShiftState;
  60. ///
  61. /// Reflects the current internal state of
  62. /// various toggled attributes. The returned
  63. /// value is valid only if the high order
  64. /// bit has been set.
  65. ///
  66. EFI_KEY_TOGGLE_STATE KeyToggleState;
  67. } EFI_KEY_STATE;
  68. typedef struct {
  69. ///
  70. /// The EFI scan code and Unicode value returned from the input device.
  71. ///
  72. EFI_INPUT_KEY Key;
  73. ///
  74. /// The current state of various toggled attributes as well as input modifier values.
  75. ///
  76. EFI_KEY_STATE KeyState;
  77. } EFI_KEY_DATA;
  78. //
  79. // Any Shift or Toggle State that is valid should have
  80. // high order bit set.
  81. //
  82. // Shift state
  83. //
  84. #define EFI_SHIFT_STATE_VALID 0x80000000
  85. #define EFI_RIGHT_SHIFT_PRESSED 0x00000001
  86. #define EFI_LEFT_SHIFT_PRESSED 0x00000002
  87. #define EFI_RIGHT_CONTROL_PRESSED 0x00000004
  88. #define EFI_LEFT_CONTROL_PRESSED 0x00000008
  89. #define EFI_RIGHT_ALT_PRESSED 0x00000010
  90. #define EFI_LEFT_ALT_PRESSED 0x00000020
  91. #define EFI_RIGHT_LOGO_PRESSED 0x00000040
  92. #define EFI_LEFT_LOGO_PRESSED 0x00000080
  93. #define EFI_MENU_KEY_PRESSED 0x00000100
  94. #define EFI_SYS_REQ_PRESSED 0x00000200
  95. //
  96. // Toggle state
  97. //
  98. #define EFI_TOGGLE_STATE_VALID 0x80
  99. #define EFI_KEY_STATE_EXPOSED 0x40
  100. #define EFI_SCROLL_LOCK_ACTIVE 0x01
  101. #define EFI_NUM_LOCK_ACTIVE 0x02
  102. #define EFI_CAPS_LOCK_ACTIVE 0x04
  103. //
  104. // EFI Scan codes
  105. //
  106. #define SCAN_F11 0x0015
  107. #define SCAN_F12 0x0016
  108. #define SCAN_PAUSE 0x0048
  109. #define SCAN_F13 0x0068
  110. #define SCAN_F14 0x0069
  111. #define SCAN_F15 0x006A
  112. #define SCAN_F16 0x006B
  113. #define SCAN_F17 0x006C
  114. #define SCAN_F18 0x006D
  115. #define SCAN_F19 0x006E
  116. #define SCAN_F20 0x006F
  117. #define SCAN_F21 0x0070
  118. #define SCAN_F22 0x0071
  119. #define SCAN_F23 0x0072
  120. #define SCAN_F24 0x0073
  121. #define SCAN_MUTE 0x007F
  122. #define SCAN_VOLUME_UP 0x0080
  123. #define SCAN_VOLUME_DOWN 0x0081
  124. #define SCAN_BRIGHTNESS_UP 0x0100
  125. #define SCAN_BRIGHTNESS_DOWN 0x0101
  126. #define SCAN_SUSPEND 0x0102
  127. #define SCAN_HIBERNATE 0x0103
  128. #define SCAN_TOGGLE_DISPLAY 0x0104
  129. #define SCAN_RECOVERY 0x0105
  130. #define SCAN_EJECT 0x0106
  131. /**
  132. The function reads the next keystroke from the input device. If
  133. there is no pending keystroke the function returns
  134. EFI_NOT_READY. If there is a pending keystroke, then
  135. KeyData.Key.ScanCode is the EFI scan code defined in Error!
  136. Reference source not found. The KeyData.Key.UnicodeChar is the
  137. actual printable character or is zero if the key does not
  138. represent a printable character (control key, function key,
  139. etc.). The KeyData.KeyState is shift state for the character
  140. reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .
  141. When interpreting the data from this function, it should be
  142. noted that if a class of printable characters that are
  143. normally adjusted by shift modifiers (e.g. Shift Key + "f"
  144. key) would be presented solely as a KeyData.Key.UnicodeChar
  145. without the associated shift state. So in the previous example
  146. of a Shift Key + "f" key being pressed, the only pertinent
  147. data returned would be KeyData.Key.UnicodeChar with the value
  148. of "F". This of course would not typically be the case for
  149. non-printable characters such as the pressing of the Right
  150. Shift Key + F10 key since the corresponding returned data
  151. would be reflected both in the KeyData.KeyState.KeyShiftState
  152. and KeyData.Key.ScanCode values. UEFI drivers which implement
  153. the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return
  154. KeyData.Key and KeyData.KeyState values. These drivers must
  155. always return the most current state of
  156. KeyData.KeyState.KeyShiftState and
  157. KeyData.KeyState.KeyToggleState. It should also be noted that
  158. certain input devices may not be able to produce shift or toggle
  159. state information, and in those cases the high order bit in the
  160. respective Toggle and Shift state fields should not be active.
  161. @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
  162. @param KeyData A pointer to a buffer that is filled in with
  163. the keystroke state data for the key that was
  164. pressed.
  165. @retval EFI_SUCCESS The keystroke information was
  166. returned.
  167. @retval EFI_NOT_READY There was no keystroke data available.
  168. EFI_DEVICE_ERROR The keystroke
  169. information was not returned due to
  170. hardware errors.
  171. **/
  172. typedef
  173. EFI_STATUS
  174. (EFIAPI *EFI_INPUT_READ_KEY_EX)(
  175. IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
  176. OUT EFI_KEY_DATA *KeyData
  177. );
  178. /**
  179. The SetState() function allows the input device hardware to
  180. have state settings adjusted.
  181. @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
  182. @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to
  183. set the state for the input device.
  184. @retval EFI_SUCCESS The device state was set appropriately.
  185. @retval EFI_DEVICE_ERROR The device is not functioning
  186. correctly and could not have the
  187. setting adjusted.
  188. @retval EFI_UNSUPPORTED The device does not support the
  189. ability to have its state set.
  190. **/
  191. typedef
  192. EFI_STATUS
  193. (EFIAPI *EFI_SET_STATE)(
  194. IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
  195. IN EFI_KEY_TOGGLE_STATE *KeyToggleState
  196. );
  197. ///
  198. /// The function will be called when the key sequence is typed specified by KeyData.
  199. ///
  200. typedef
  201. EFI_STATUS
  202. (EFIAPI *EFI_KEY_NOTIFY_FUNCTION)(
  203. IN EFI_KEY_DATA *KeyData
  204. );
  205. /**
  206. The RegisterKeystrokeNotify() function registers a function
  207. which will be called when a specified keystroke will occur.
  208. @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
  209. @param KeyData A pointer to a buffer that is filled in with
  210. the keystroke information for the key that was
  211. pressed.
  212. @param KeyNotificationFunction Points to the function to be
  213. called when the key sequence
  214. is typed specified by KeyData.
  215. @param NotifyHandle Points to the unique handle assigned to
  216. the registered notification.
  217. @retval EFI_SUCCESS The device state was set
  218. appropriately.
  219. @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
  220. data structures.
  221. **/
  222. typedef
  223. EFI_STATUS
  224. (EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY)(
  225. IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
  226. IN EFI_KEY_DATA *KeyData,
  227. IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
  228. OUT VOID **NotifyHandle
  229. );
  230. /**
  231. The UnregisterKeystrokeNotify() function removes the
  232. notification which was previously registered.
  233. @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
  234. @param NotificationHandle The handle of the notification
  235. function being unregistered.
  236. @retval EFI_SUCCESS The device state was set appropriately.
  237. @retval EFI_INVALID_PARAMETER The NotificationHandle is
  238. invalid.
  239. **/
  240. typedef
  241. EFI_STATUS
  242. (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY)(
  243. IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
  244. IN VOID *NotificationHandle
  245. );
  246. ///
  247. /// The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn
  248. /// device. It is an extension to the Simple Text Input protocol
  249. /// which allows a variety of extended shift state information to be
  250. /// returned.
  251. ///
  252. struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL{
  253. EFI_INPUT_RESET_EX Reset;
  254. EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx;
  255. ///
  256. /// Event to use with WaitForEvent() to wait for a key to be available.
  257. ///
  258. EFI_EVENT WaitForKeyEx;
  259. EFI_SET_STATE SetState;
  260. EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify;
  261. EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify;
  262. };
  263. extern EFI_GUID gEfiSimpleTextInputExProtocolGuid;
  264. #endif