]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Constants and declarations for the Interactive IO library.\r | |
3 | \r | |
4 | Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials are licensed and made available\r | |
6 | under the terms and conditions of the BSD License which accompanies this\r | |
7 | distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php.\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | **/\r | |
13 | #ifndef _INTERACTIVE_IO_H\r | |
14 | #define _INTERACTIVE_IO_H\r | |
15 | \r | |
16 | #include <sys/EfiSysCall.h>\r | |
17 | #include <sys/termios.h>\r | |
18 | #include <Containers/Fifo.h>\r | |
19 | #include <kfile.h>\r | |
20 | \r | |
21 | __BEGIN_DECLS\r | |
22 | \r | |
23 | typedef struct _IIO_Instance cIIO;\r | |
24 | \r | |
25 | cIIO * EFIAPI New_cIIO(void); // Creates a new cIIO structure\r | |
26 | \r | |
27 | /* Types of Member functions of the TTY I/O "class". */\r | |
28 | typedef void (EFIAPI *cIIO_Delete) (cIIO *This);\r | |
29 | \r | |
30 | typedef ssize_t (EFIAPI *cIIO_Read) (struct __filedes *filp, size_t BufferSize, VOID *Buffer);\r | |
31 | \r | |
32 | typedef ssize_t (EFIAPI *cIIO_Write) (struct __filedes *filp, const char *buf, ssize_t n);\r | |
33 | \r | |
34 | typedef ssize_t (EFIAPI *cIIO_Echo) (struct __filedes *filp, wchar_t EChar, BOOLEAN EchoIsOK);\r | |
35 | \r | |
36 | /** Structure defining an instance of the Interactive I/O "class". **/\r | |
37 | struct _IIO_Instance {\r | |
38 | /* ######## Public Functions ######## */\r | |
39 | cIIO_Delete Delete;\r | |
40 | cIIO_Read Read;\r | |
41 | cIIO_Write Write;\r | |
42 | cIIO_Echo Echo;\r | |
43 | \r | |
44 | /* ######## PRIVATE Data ######## */\r | |
45 | \r | |
46 | // Wide input buffer -- stdin\r | |
47 | cFIFO *InBuf;\r | |
48 | \r | |
49 | // Wide output buffer -- stdout\r | |
50 | cFIFO *OutBuf;\r | |
51 | \r | |
52 | // Attributes for characters in the output buffer\r | |
53 | UINT8 *AttrBuf;\r | |
54 | \r | |
55 | // Wide output buffer -- stderr\r | |
56 | cFIFO *ErrBuf;\r | |
57 | \r | |
58 | // Character conversion states for the buffers\r | |
59 | mbstate_t OutState;\r | |
60 | mbstate_t ErrState;\r | |
61 | \r | |
62 | // Cursor position at beginning of operation\r | |
63 | // and at each character thereafter.\r | |
64 | CURSOR_XY InitialXY;\r | |
65 | CURSOR_XY CurrentXY;\r | |
66 | \r | |
67 | UINTN MaxColumn; // Width of the output device\r | |
68 | UINTN MaxRow; // Height of the output device\r | |
69 | \r | |
70 | // termios structure\r | |
71 | struct termios Termio;\r | |
72 | };\r | |
73 | \r | |
74 | // Helper Functions\r | |
75 | ssize_t IIO_CanonRead (struct __filedes *filp);\r | |
76 | ssize_t IIO_NonCanonRead (struct __filedes *filp);\r | |
77 | ssize_t IIO_WriteOne (struct __filedes *filp, cFIFO *Buf, wchar_t InCh);\r | |
78 | ssize_t IIO_EchoOne (struct __filedes *filp, wchar_t InCh, BOOLEAN EchoIsOK);\r | |
79 | \r | |
80 | __END_DECLS\r | |
81 | #endif /* _INTERACTIVE_IO_H */\r |