]> git.proxmox.com Git - mirror_edk2.git/blob - StdLibPrivateInternalFiles/Include/Efi/Console.h
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLibPrivateInternalFiles / Include / Efi / Console.h
1 /** @file
2 Declarations and macros for the console abstraction.
3
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 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 _LIBRARY_UEFI_CONSOLE_H
15 #define _LIBRARY_UEFI_CONSOLE_H
16 #include <Protocol/SimpleTextOut.h>
17 #include <Protocol/SimpleFileSystem.h>
18
19 /* The number of "special" character stream devices.
20 These include:
21 stdin, stdout, stderr
22 */
23 #define NUM_SPECIAL 3
24
25 typedef struct {
26 UINT32 Column;
27 UINT32 Row;
28 } CursorXY;
29
30 typedef union {
31 UINT64 Offset;
32 CursorXY XYpos;
33 } XYoffset;
34
35 /**
36 In support of the "everything is a file" paradigm of the Standard C Library,
37 the UEFI Console support is abstracted as an instance of EFI_FILE_PROTOCOL.
38 The member functions of the protocol translate as:
39 Open Associates a stream with one of the pseudo-devices: stdin,
40 stdout, or stderr; as defined by the UEFI System Table.
41 Close The stream is marked closed and released for use by a
42 subsequent Open().
43 Delete Returns RETURN_UNSUPPORTED. Does Nothing.
44 Read Blocks reading BufferSize characters using the
45 EFI_SIMPLE_TEXT_INPUT_PROTOCOL::ReadKeyStroke() function.
46 Write Sends BufferSize characters to the console for display. The
47 output is examined for new line characters, '\n', which are then
48 translated into a Return + New Line, '\r' '\n', sequence.
49 GetPosition Returns the number of characters input or output to this
50 stream. Return, '\r', characters inserted due to line ending
51 translation are not counted.
52 SetPosition Only valid for Stdout or Stderr. Offset is interpreted as a
53 CursorXY structure and is used to position the console cursor
54 using the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL::SetCursorPosition()
55 call.
56 GetInfo Populates an EFI_FILE_INFO Buffer with no useful information.
57 SetInfo Returns RETURN_UNSUPPORTED. Does Nothing.
58 Flush Returns RETURN_SUCCESS. Does Nothing.
59
60 **/
61 typedef struct {
62 UINT32 Cookie;
63 UINT32 ConOutMode; // Only valid for stdout & stderr
64 UINT64 NumRead;
65 UINT64 NumWritten;
66 XYoffset MaxConXY; // Only valid for stdout & stderr
67 EFI_HANDLE Dev; // Could be either Input or Output
68 EFI_FILE_PROTOCOL Abstraction;
69 } ConInstance;
70
71 EFI_STATUS
72 EFIAPI
73 ConOpen(
74 IN EFI_FILE_PROTOCOL *This,
75 OUT EFI_FILE_PROTOCOL **NewHandle,
76 IN CHAR16 *FileName,
77 IN UINT64 OpenMode,
78 IN UINT64 Attributes
79 );
80
81 #endif /* _LIBRARY_UEFI_CONSOLE_H */