]> git.proxmox.com Git - mirror_edk2.git/blob - StdLibPrivateInternalFiles/Include/Device/IIO.h
BaseTools: Expression refactor function
[mirror_edk2.git] / StdLibPrivateInternalFiles / Include / Device / IIO.h
1 /** @file
2 Constants and declarations for the Interactive IO library.
3
4 Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available
6 under the terms and conditions of the BSD License which accompanies this
7 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 #ifndef _INTERACTIVE_IO_H
14 #define _INTERACTIVE_IO_H
15
16 #include <sys/EfiSysCall.h>
17 #include <sys/termios.h>
18 #include <Containers/Fifo.h>
19 #include <kfile.h>
20
21 __BEGIN_DECLS
22
23 typedef struct _IIO_Instance cIIO;
24
25 cIIO * EFIAPI New_cIIO(void); // Creates a new cIIO structure
26
27 /* Types of Member functions of the TTY I/O "class". */
28 typedef void (EFIAPI *cIIO_Delete) (cIIO *This);
29
30 typedef ssize_t (EFIAPI *cIIO_Read) (struct __filedes *filp, size_t BufferSize, VOID *Buffer);
31
32 typedef ssize_t (EFIAPI *cIIO_Write) (struct __filedes *filp, const char *buf, ssize_t n);
33
34 typedef ssize_t (EFIAPI *cIIO_Echo) (struct __filedes *filp, wchar_t EChar, BOOLEAN EchoIsOK);
35
36 /** Structure defining an instance of the Interactive I/O "class". **/
37 struct _IIO_Instance {
38 /* ######## Public Functions ######## */
39 cIIO_Delete Delete;
40 cIIO_Read Read;
41 cIIO_Write Write;
42 cIIO_Echo Echo;
43
44 /* ######## PRIVATE Data ######## */
45
46 // Wide input buffer -- stdin
47 cFIFO *InBuf;
48
49 // Wide output buffer -- stdout
50 cFIFO *OutBuf;
51
52 // Attributes for characters in the output buffer
53 UINT8 *AttrBuf;
54
55 // Wide output buffer -- stderr
56 cFIFO *ErrBuf;
57
58 // Character conversion states for the buffers
59 mbstate_t OutState;
60 mbstate_t ErrState;
61
62 // Cursor position at beginning of operation
63 // and at each character thereafter.
64 CURSOR_XY InitialXY;
65 CURSOR_XY CurrentXY;
66
67 UINTN MaxColumn; // Width of the output device
68 UINTN MaxRow; // Height of the output device
69
70 // termios structure
71 struct termios Termio;
72 };
73
74 // Helper Functions
75 ssize_t IIO_CanonRead (struct __filedes *filp);
76 ssize_t IIO_NonCanonRead (struct __filedes *filp);
77 ssize_t IIO_WriteOne (struct __filedes *filp, cFIFO *Buf, wchar_t InCh);
78 ssize_t IIO_EchoOne (struct __filedes *filp, wchar_t InCh, BOOLEAN EchoIsOK);
79
80 __END_DECLS
81 #endif /* _INTERACTIVE_IO_H */