]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Application/Shell/ConsoleLogger.h
ShellPkg/Application: Fix various typos
[mirror_edk2.git] / ShellPkg / Application / Shell / ConsoleLogger.h
CommitLineData
d42aab6e
HT
1/** @file\r
2 Provides interface to shell console logger.\r
3\r
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
56ba3746 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
d42aab6e
HT
6**/\r
7\r
8#ifndef _CONSOLE_LOGGER_HEADER_\r
9#define _CONSOLE_LOGGER_HEADER_\r
10\r
11#include "Shell.h"\r
12\r
13#define CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('c', 'o', 'P', 'D')\r
14\r
15typedef struct _CONSOLE_LOGGER_PRIVATE_DATA{\r
16 UINTN Signature;\r
17 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL OurConOut; ///< the protocol we installed onto the system table\r
18 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OldConOut; ///< old protocol to reinstall upon exiting\r
19 EFI_HANDLE OldConHandle; ///< old protocol handle\r
20 UINTN ScreenCount; ///< How many screens worth of data to save\r
21 CHAR16 *Buffer; ///< Buffer to save data\r
22 UINTN BufferSize; ///< size of buffer in bytes\r
23\r
24 // start row is the top of the screen\r
25 UINTN OriginalStartRow; ///< What the originally visible start row was\r
26 UINTN CurrentStartRow; ///< what the currently visible start row is\r
27\r
28 UINTN RowsPerScreen; ///< how many rows the screen can display\r
29 UINTN ColsPerScreen; ///< how many columns the screen can display\r
30\r
31 INT32 *Attributes; ///< Buffer for Attribute to be saved for each character\r
32 UINTN AttribSize; ///< Size of Attributes in bytes\r
33\r
34 EFI_SIMPLE_TEXT_OUTPUT_MODE HistoryMode; ///< mode of the history log\r
35 BOOLEAN Enabled; ///< Set to FALSE when a break is requested.\r
36 UINTN RowCounter; ///< Initial row of each print job.\r
37} CONSOLE_LOGGER_PRIVATE_DATA;\r
38\r
39#define CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(a) CR (a, CONSOLE_LOGGER_PRIVATE_DATA, OurConOut, CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE)\r
40\r
41/**\r
42 Install our intermediate ConOut into the system table to\r
43 keep a log of all the info that is displayed to the user.\r
44\r
45 @param[in] ScreensToSave Sets how many screen-worths of data to save.\r
46 @param[out] ConsoleInfo The object to pass into later functions.\r
47\r
48 @retval EFI_SUCCESS The operation was successful.\r
49 @return other The operation failed.\r
50\r
51 @sa ConsoleLoggerResetBuffers\r
52 @sa InstallProtocolInterface\r
53**/\r
54EFI_STATUS\r
d42aab6e
HT
55ConsoleLoggerInstall(\r
56 IN CONST UINTN ScreensToSave,\r
57 OUT CONSOLE_LOGGER_PRIVATE_DATA **ConsoleInfo\r
58 );\r
59\r
60/**\r
61 Return the system to the state it was before InstallConsoleLogger\r
62 was installed.\r
63\r
64 @param[in, out] ConsoleInfo The object from the install function.\r
65\r
66 @retval EFI_SUCCESS The operation was successful\r
67 @return other The operation failed. This was from UninstallProtocolInterface.\r
68**/\r
69EFI_STATUS\r
d42aab6e
HT
70ConsoleLoggerUninstall(\r
71 IN OUT CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo\r
72 );\r
73\r
74/**\r
75 Displays previously logged output back to the screen.\r
76\r
77 This will scroll the screen forwards and backwards through the log of previous\r
78 output. If Rows is 0 then the size of 1/2 the screen will be scrolled. If Rows\r
79 is (UINTN)(-1) then the size of the screen will be scrolled.\r
80\r
81 @param[in] Forward If TRUE then the log will be displayed forwards (scroll to newer).\r
82 If FALSE then the log will be displayed backwards (scroll to older).\r
83 @param[in] Rows Determines how many rows the log should scroll.\r
84 @param[in] ConsoleInfo The pointer to the instance of the console logger information.\r
85**/\r
86EFI_STATUS\r
d42aab6e
HT
87ConsoleLoggerDisplayHistory(\r
88 IN CONST BOOLEAN Forward,\r
89 IN CONST UINTN Rows,\r
90 IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo\r
91 );\r
92\r
93/**\r
94 Function to return to normal output whent he scrolling is complete.\r
95 @param[in] ConsoleInfo The pointer to the instance of the console logger information.\r
96\r
97 @retval EFI_SUCCESS The operation was successful.\r
98 @return other The operation failed. See UpdateDisplayFromHistory.\r
99\r
100 @sa UpdateDisplayFromHistory\r
101**/\r
102EFI_STATUS\r
d42aab6e
HT
103ConsoleLoggerStopHistory(\r
104 IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo\r
105 );\r
106\r
107/**\r
108 Updates the hidden ConOut to be displaying the correct stuff.\r
109 @param[in] ConsoleInfo The pointer to the instance of the console logger information.\r
110\r
111 @retval EFI_SUCCESS The operation was successful.\r
112 @return other The operation failed.\r
113**/\r
114EFI_STATUS\r
d42aab6e
HT
115UpdateDisplayFromHistory(\r
116 IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo\r
117 );\r
118\r
119/**\r
6a5033ca 120 Reset the text output device hardware and optionally run diagnostics\r
d42aab6e
HT
121\r
122 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL\r
123 @param ExtendedVerification Indicates that a more extensive test may be performed\r
124\r
125 @retval EFI_SUCCESS The text output device was reset.\r
126 @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and\r
127 could not be reset.\r
128**/\r
129EFI_STATUS\r
130EFIAPI\r
131ConsoleLoggerReset (\r
132 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
133 IN BOOLEAN ExtendedVerification\r
134 );\r
135\r
136/**\r
137 Write a Unicode string to the output device.\r
138\r
139 @param[in] This Protocol instance pointer.\r
140 @param[in] WString The NULL-terminated Unicode string to be displayed on the output\r
141 device(s). All output devices must also support the Unicode\r
142 drawing defined in this file.\r
143 @retval EFI_SUCCESS The string was output to the device.\r
144 @retval EFI_DEVICE_ERROR The device reported an error while attempting to output\r
145 the text.\r
146 @retval EFI_UNSUPPORTED The output device's mode is not currently in a\r
147 defined text mode.\r
148 @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the\r
149 characters in the Unicode string could not be\r
150 rendered and were skipped.\r
151**/\r
152EFI_STATUS\r
153EFIAPI\r
154ConsoleLoggerOutputString(\r
155 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
156 IN CHAR16 *WString\r
157 );\r
158\r
159/**\r
160 Verifies that all characters in a Unicode string can be output to the\r
161 target device.\r
162\r
163 @param[in] This Protocol instance pointer.\r
164 @param[in] WString The NULL-terminated Unicode string to be examined for the output\r
165 device(s).\r
166\r
167 @retval EFI_SUCCESS The device(s) are capable of rendering the output string.\r
168 @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be\r
169 rendered by one or more of the output devices mapped\r
170 by the EFI handle.\r
171\r
172**/\r
173EFI_STATUS\r
174EFIAPI\r
175ConsoleLoggerTestString (\r
176 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
177 IN CHAR16 *WString\r
178 );\r
179\r
180/**\r
181 Returns information for an available text mode that the output device(s)\r
182 supports.\r
183\r
184 @param[in] This Protocol instance pointer.\r
185 @param[in] ModeNumber The mode number to return information on.\r
186 @param[out] Columns Upon return, the number of columns in the selected geometry\r
187 @param[out] Rows Upon return, the number of rows in the selected geometry\r
188\r
189 @retval EFI_SUCCESS The requested mode information was returned.\r
190 @retval EFI_DEVICE_ERROR The device had an error and could not\r
191 complete the request.\r
192 @retval EFI_UNSUPPORTED The mode number was not valid.\r
193**/\r
194EFI_STATUS\r
195EFIAPI\r
196ConsoleLoggerQueryMode (\r
197 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
198 IN UINTN ModeNumber,\r
199 OUT UINTN *Columns,\r
200 OUT UINTN *Rows\r
201 );\r
202\r
203/**\r
204 Sets the output device(s) to a specified mode.\r
205\r
206 @param[in] This Protocol instance pointer.\r
207 @param[in] ModeNumber The mode number to set.\r
208\r
209\r
210 @retval EFI_SUCCESS The requested text mode was set.\r
211 @retval EFI_DEVICE_ERROR The device had an error and\r
212 could not complete the request.\r
213 @retval EFI_UNSUPPORTED The mode number was not valid.\r
214**/\r
215EFI_STATUS\r
216EFIAPI\r
217ConsoleLoggerSetMode (\r
218 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
219 IN UINTN ModeNumber\r
220 );\r
221\r
222/**\r
223 Sets the background and foreground colors for the OutputString () and\r
224 ClearScreen () functions.\r
225\r
226 @param[in] This Protocol instance pointer.\r
227 @param[in] Attribute The attribute to set. Bits 0..3 are the foreground color, and\r
228 bits 4..6 are the background color. All other bits are undefined\r
229 and must be zero. The valid Attributes are defined in this file.\r
230\r
231 @retval EFI_SUCCESS The attribute was set.\r
232 @retval EFI_DEVICE_ERROR The device had an error and\r
233 could not complete the request.\r
234 @retval EFI_UNSUPPORTED The attribute requested is not defined.\r
235\r
236**/\r
237EFI_STATUS\r
238EFIAPI\r
239ConsoleLoggerSetAttribute (\r
240 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
241 IN UINTN Attribute\r
242 );\r
243\r
244/**\r
245 Clears the output device(s) display to the currently selected background\r
246 color.\r
247\r
248 @param[in] This Protocol instance pointer.\r
249\r
250 @retval EFI_SUCCESS The operation completed successfully.\r
251 @retval EFI_DEVICE_ERROR The device had an error and\r
252 could not complete the request.\r
253 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
254**/\r
255EFI_STATUS\r
256EFIAPI\r
257ConsoleLoggerClearScreen (\r
258 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This\r
259 );\r
260\r
261/**\r
262 Sets the current coordinates of the cursor position.\r
263\r
264 @param[in] This Protocol instance pointer.\r
265 @param[in] Column Column to put the cursor in. Must be between zero and Column returned from QueryMode\r
266 @param[in] Row Row to put the cursor in. Must be between zero and Row returned from QueryMode\r
267\r
268 @retval EFI_SUCCESS The operation completed successfully.\r
269 @retval EFI_DEVICE_ERROR The device had an error and\r
270 could not complete the request.\r
271 @retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the\r
272 cursor position is invalid for the current mode.\r
273**/\r
274EFI_STATUS\r
275EFIAPI\r
276ConsoleLoggerSetCursorPosition (\r
277 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
278 IN UINTN Column,\r
279 IN UINTN Row\r
280 );\r
281\r
282/**\r
283 Makes the cursor visible or invisible\r
284\r
285 @param[in] This Protocol instance pointer.\r
286 @param[in] Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is\r
287 set to be invisible.\r
288\r
289 @retval EFI_SUCCESS The operation completed successfully.\r
290 @retval EFI_DEVICE_ERROR The device had an error and could not complete the\r
291 request, or the device does not support changing\r
292 the cursor mode.\r
293 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
294\r
295**/\r
296EFI_STATUS\r
297EFIAPI\r
298ConsoleLoggerEnableCursor (\r
299 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
300 IN BOOLEAN Visible\r
301 );\r
302\r
303/**\r
304 Function to update and verify that the current buffers are correct.\r
305\r
306 @param[in] ConsoleInfo The pointer to the instance of the console logger information.\r
307\r
6a5033ca 308 This will be used when a mode has changed or a reset occurred to verify all\r
d42aab6e
HT
309 history buffers.\r
310**/\r
311EFI_STATUS\r
d42aab6e
HT
312ConsoleLoggerResetBuffers(\r
313 IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo\r
314 );\r
315\r
316#endif //_CONSOLE_LOGGER_HEADER_\r
317\r