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