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ů.

SimpleTextOut.h 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. /** @file
  2. Simple Text Out protocol from the UEFI 2.0 specification.
  3. Abstraction of a very simple text based output device like VGA text mode or
  4. a serial terminal. The Simple Text Out protocol instance can represent
  5. a single hardware device or a virtual device that is an aggregation
  6. of multiple physical devices.
  7. Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
  8. This program and the accompanying materials are licensed and made available under
  9. the terms and conditions of the BSD License that accompanies this distribution.
  10. The full text of the license may be found at
  11. http://opensource.org/licenses/bsd-license.php.
  12. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  13. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  14. **/
  15. #ifndef __SIMPLE_TEXT_OUT_H__
  16. #define __SIMPLE_TEXT_OUT_H__
  17. #define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
  18. { \
  19. 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
  20. }
  21. ///
  22. /// Protocol GUID defined in EFI1.1.
  23. ///
  24. #define SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID
  25. typedef struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
  26. ///
  27. /// Backward-compatible with EFI1.1.
  28. ///
  29. typedef EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SIMPLE_TEXT_OUTPUT_INTERFACE;
  30. //
  31. // Define's for required EFI Unicode Box Draw characters
  32. //
  33. #define BOXDRAW_HORIZONTAL 0x2500
  34. #define BOXDRAW_VERTICAL 0x2502
  35. #define BOXDRAW_DOWN_RIGHT 0x250c
  36. #define BOXDRAW_DOWN_LEFT 0x2510
  37. #define BOXDRAW_UP_RIGHT 0x2514
  38. #define BOXDRAW_UP_LEFT 0x2518
  39. #define BOXDRAW_VERTICAL_RIGHT 0x251c
  40. #define BOXDRAW_VERTICAL_LEFT 0x2524
  41. #define BOXDRAW_DOWN_HORIZONTAL 0x252c
  42. #define BOXDRAW_UP_HORIZONTAL 0x2534
  43. #define BOXDRAW_VERTICAL_HORIZONTAL 0x253c
  44. #define BOXDRAW_DOUBLE_HORIZONTAL 0x2550
  45. #define BOXDRAW_DOUBLE_VERTICAL 0x2551
  46. #define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552
  47. #define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553
  48. #define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554
  49. #define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555
  50. #define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556
  51. #define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557
  52. #define BOXDRAW_UP_RIGHT_DOUBLE 0x2558
  53. #define BOXDRAW_UP_DOUBLE_RIGHT 0x2559
  54. #define BOXDRAW_DOUBLE_UP_RIGHT 0x255a
  55. #define BOXDRAW_UP_LEFT_DOUBLE 0x255b
  56. #define BOXDRAW_UP_DOUBLE_LEFT 0x255c
  57. #define BOXDRAW_DOUBLE_UP_LEFT 0x255d
  58. #define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e
  59. #define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f
  60. #define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560
  61. #define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561
  62. #define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562
  63. #define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563
  64. #define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564
  65. #define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565
  66. #define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566
  67. #define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567
  68. #define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568
  69. #define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569
  70. #define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a
  71. #define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b
  72. #define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c
  73. //
  74. // EFI Required Block Elements Code Chart
  75. //
  76. #define BLOCKELEMENT_FULL_BLOCK 0x2588
  77. #define BLOCKELEMENT_LIGHT_SHADE 0x2591
  78. //
  79. // EFI Required Geometric Shapes Code Chart
  80. //
  81. #define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2
  82. #define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba
  83. #define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc
  84. #define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4
  85. //
  86. // EFI Required Arrow shapes
  87. //
  88. #define ARROW_LEFT 0x2190
  89. #define ARROW_UP 0x2191
  90. #define ARROW_RIGHT 0x2192
  91. #define ARROW_DOWN 0x2193
  92. //
  93. // EFI Console Colours
  94. //
  95. #define EFI_BLACK 0x00
  96. #define EFI_BLUE 0x01
  97. #define EFI_GREEN 0x02
  98. #define EFI_CYAN (EFI_BLUE | EFI_GREEN)
  99. #define EFI_RED 0x04
  100. #define EFI_MAGENTA (EFI_BLUE | EFI_RED)
  101. #define EFI_BROWN (EFI_GREEN | EFI_RED)
  102. #define EFI_LIGHTGRAY (EFI_BLUE | EFI_GREEN | EFI_RED)
  103. #define EFI_BRIGHT 0x08
  104. #define EFI_DARKGRAY (EFI_BRIGHT)
  105. #define EFI_LIGHTBLUE (EFI_BLUE | EFI_BRIGHT)
  106. #define EFI_LIGHTGREEN (EFI_GREEN | EFI_BRIGHT)
  107. #define EFI_LIGHTCYAN (EFI_CYAN | EFI_BRIGHT)
  108. #define EFI_LIGHTRED (EFI_RED | EFI_BRIGHT)
  109. #define EFI_LIGHTMAGENTA (EFI_MAGENTA | EFI_BRIGHT)
  110. #define EFI_YELLOW (EFI_BROWN | EFI_BRIGHT)
  111. #define EFI_WHITE (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)
  112. #define EFI_TEXT_ATTR(f, b) ((f) | ((b) << 4))
  113. #define EFI_BACKGROUND_BLACK 0x00
  114. #define EFI_BACKGROUND_BLUE 0x10
  115. #define EFI_BACKGROUND_GREEN 0x20
  116. #define EFI_BACKGROUND_CYAN (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)
  117. #define EFI_BACKGROUND_RED 0x40
  118. #define EFI_BACKGROUND_MAGENTA (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)
  119. #define EFI_BACKGROUND_BROWN (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
  120. #define EFI_BACKGROUND_LIGHTGRAY (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
  121. //
  122. // We currently define attributes from 0 - 7F for color manipulations
  123. // To internally handle the local display characteristics for a particular character,
  124. // Bit 7 signifies the local glyph representation for a character. If turned on, glyphs will be
  125. // pulled from the wide glyph database and will display locally as a wide character (16 X 19 versus 8 X 19)
  126. // If bit 7 is off, the narrow glyph database will be used. This does NOT affect information that is sent to
  127. // non-local displays, such as serial or LAN consoles.
  128. //
  129. #define EFI_WIDE_ATTRIBUTE 0x80
  130. /**
  131. Reset the text output device hardware and optionaly run diagnostics
  132. @param This The protocol instance pointer.
  133. @param ExtendedVerification Driver may perform more exhaustive verfication
  134. operation of the device during reset.
  135. @retval EFI_SUCCESS The text output device was reset.
  136. @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and
  137. could not be reset.
  138. **/
  139. typedef
  140. EFI_STATUS
  141. (EFIAPI *EFI_TEXT_RESET)(
  142. IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
  143. IN BOOLEAN ExtendedVerification
  144. );
  145. /**
  146. Write a string to the output device.
  147. @param This The protocol instance pointer.
  148. @param String The NULL-terminated string to be displayed on the output
  149. device(s). All output devices must also support the Unicode
  150. drawing character codes defined in this file.
  151. @retval EFI_SUCCESS The string was output to the device.
  152. @retval EFI_DEVICE_ERROR The device reported an error while attempting to output
  153. the text.
  154. @retval EFI_UNSUPPORTED The output device's mode is not currently in a
  155. defined text mode.
  156. @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the
  157. characters in the string could not be
  158. rendered and were skipped.
  159. **/
  160. typedef
  161. EFI_STATUS
  162. (EFIAPI *EFI_TEXT_STRING)(
  163. IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
  164. IN CHAR16 *String
  165. );
  166. /**
  167. Verifies that all characters in a string can be output to the
  168. target device.
  169. @param This The protocol instance pointer.
  170. @param String The NULL-terminated string to be examined for the output
  171. device(s).
  172. @retval EFI_SUCCESS The device(s) are capable of rendering the output string.
  173. @retval EFI_UNSUPPORTED Some of the characters in the string cannot be
  174. rendered by one or more of the output devices mapped
  175. by the EFI handle.
  176. **/
  177. typedef
  178. EFI_STATUS
  179. (EFIAPI *EFI_TEXT_TEST_STRING)(
  180. IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
  181. IN CHAR16 *String
  182. );
  183. /**
  184. Returns information for an available text mode that the output device(s)
  185. supports.
  186. @param This The protocol instance pointer.
  187. @param ModeNumber The mode number to return information on.
  188. @param Columns Returns the geometry of the text output device for the
  189. requested ModeNumber.
  190. @param Rows Returns the geometry of the text output device for the
  191. requested ModeNumber.
  192. @retval EFI_SUCCESS The requested mode information was returned.
  193. @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
  194. @retval EFI_UNSUPPORTED The mode number was not valid.
  195. **/
  196. typedef
  197. EFI_STATUS
  198. (EFIAPI *EFI_TEXT_QUERY_MODE)(
  199. IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
  200. IN UINTN ModeNumber,
  201. OUT UINTN *Columns,
  202. OUT UINTN *Rows
  203. );
  204. /**
  205. Sets the output device(s) to a specified mode.
  206. @param This The protocol instance pointer.
  207. @param ModeNumber The mode number to set.
  208. @retval EFI_SUCCESS The requested text mode was set.
  209. @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
  210. @retval EFI_UNSUPPORTED The mode number was not valid.
  211. **/
  212. typedef
  213. EFI_STATUS
  214. (EFIAPI *EFI_TEXT_SET_MODE)(
  215. IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
  216. IN UINTN ModeNumber
  217. );
  218. /**
  219. Sets the background and foreground colors for the OutputString () and
  220. ClearScreen () functions.
  221. @param This The protocol instance pointer.
  222. @param Attribute The attribute to set. Bits 0..3 are the foreground color, and
  223. bits 4..6 are the background color. All other bits are undefined
  224. and must be zero. The valid Attributes are defined in this file.
  225. @retval EFI_SUCCESS The attribute was set.
  226. @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
  227. @retval EFI_UNSUPPORTED The attribute requested is not defined.
  228. **/
  229. typedef
  230. EFI_STATUS
  231. (EFIAPI *EFI_TEXT_SET_ATTRIBUTE)(
  232. IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
  233. IN UINTN Attribute
  234. );
  235. /**
  236. Clears the output device(s) display to the currently selected background
  237. color.
  238. @param This The protocol instance pointer.
  239. @retval EFI_SUCCESS The operation completed successfully.
  240. @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
  241. @retval EFI_UNSUPPORTED The output device is not in a valid text mode.
  242. **/
  243. typedef
  244. EFI_STATUS
  245. (EFIAPI *EFI_TEXT_CLEAR_SCREEN)(
  246. IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
  247. );
  248. /**
  249. Sets the current coordinates of the cursor position
  250. @param This The protocol instance pointer.
  251. @param Column The position to set the cursor to. Must be greater than or
  252. equal to zero and less than the number of columns and rows
  253. by QueryMode ().
  254. @param Row The position to set the cursor to. Must be greater than or
  255. equal to zero and less than the number of columns and rows
  256. by QueryMode ().
  257. @retval EFI_SUCCESS The operation completed successfully.
  258. @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
  259. @retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the
  260. cursor position is invalid for the current mode.
  261. **/
  262. typedef
  263. EFI_STATUS
  264. (EFIAPI *EFI_TEXT_SET_CURSOR_POSITION)(
  265. IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
  266. IN UINTN Column,
  267. IN UINTN Row
  268. );
  269. /**
  270. Makes the cursor visible or invisible
  271. @param This The protocol instance pointer.
  272. @param Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is
  273. set to be invisible.
  274. @retval EFI_SUCCESS The operation completed successfully.
  275. @retval EFI_DEVICE_ERROR The device had an error and could not complete the
  276. request, or the device does not support changing
  277. the cursor mode.
  278. @retval EFI_UNSUPPORTED The output device is not in a valid text mode.
  279. **/
  280. typedef
  281. EFI_STATUS
  282. (EFIAPI *EFI_TEXT_ENABLE_CURSOR)(
  283. IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
  284. IN BOOLEAN Visible
  285. );
  286. /**
  287. @par Data Structure Description:
  288. Mode Structure pointed to by Simple Text Out protocol.
  289. **/
  290. typedef struct {
  291. ///
  292. /// The number of modes supported by QueryMode () and SetMode ().
  293. ///
  294. INT32 MaxMode;
  295. //
  296. // current settings
  297. //
  298. ///
  299. /// The text mode of the output device(s).
  300. ///
  301. INT32 Mode;
  302. ///
  303. /// The current character output attribute.
  304. ///
  305. INT32 Attribute;
  306. ///
  307. /// The cursor's column.
  308. ///
  309. INT32 CursorColumn;
  310. ///
  311. /// The cursor's row.
  312. ///
  313. INT32 CursorRow;
  314. ///
  315. /// The cursor is currently visbile or not.
  316. ///
  317. BOOLEAN CursorVisible;
  318. } EFI_SIMPLE_TEXT_OUTPUT_MODE;
  319. ///
  320. /// The SIMPLE_TEXT_OUTPUT protocol is used to control text-based output devices.
  321. /// It is the minimum required protocol for any handle supplied as the ConsoleOut
  322. /// or StandardError device. In addition, the minimum supported text mode of such
  323. /// devices is at least 80 x 25 characters.
  324. ///
  325. struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
  326. EFI_TEXT_RESET Reset;
  327. EFI_TEXT_STRING OutputString;
  328. EFI_TEXT_TEST_STRING TestString;
  329. EFI_TEXT_QUERY_MODE QueryMode;
  330. EFI_TEXT_SET_MODE SetMode;
  331. EFI_TEXT_SET_ATTRIBUTE SetAttribute;
  332. EFI_TEXT_CLEAR_SCREEN ClearScreen;
  333. EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition;
  334. EFI_TEXT_ENABLE_CURSOR EnableCursor;
  335. ///
  336. /// Pointer to SIMPLE_TEXT_OUTPUT_MODE data.
  337. ///
  338. EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;
  339. };
  340. extern EFI_GUID gEfiSimpleTextOutProtocolGuid;
  341. #endif