:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / apps / utils / pice / module / hardware.h
1 /*++
2
3 Copyright (c) 1998-2001 Klaus P. Gerlicher
4
5 Module Name:
6
7     hardwar.h
8
9 Abstract:
10
11     HEADER for hardware.c
12
13 Environment:
14
15     LINUX 2.2.X
16     Kernel mode only
17
18 Author:
19
20     Klaus P. Gerlicher
21
22 Revision History:
23
24     15-Nov-2000:    general cleanup of source files
25
26 Copyright notice:
27
28   This file may be distributed under the terms of the GNU Public License.
29
30 --*/
31 typedef struct tagWindow
32 {
33         USHORT y,cy;
34         USHORT usCurX,usCurY;
35         BOOLEAN bScrollDisabled;
36 }WINDOW,*PWINDOW;
37
38 // pointer indirection table for output functions
39 typedef struct _OUTPUT_HANDLERS
40 {
41     void    (*CopyLineTo)               (USHORT dest,USHORT src);
42     void    (*PrintGraf)                (ULONG x,ULONG y,UCHAR c);
43     void    (*Flush)                    (void);
44     void    (*ClrLine)                  (ULONG line);
45     void    (*InvertLine)               (ULONG line);
46     void    (*HatchLine)                (ULONG line);
47     void    (*PrintLogo)                (BOOLEAN bShow);
48     void    (*PrintCursor)              (BOOLEAN bForce);
49     void    (*SaveGraphicsState)        (void);
50     void    (*RestoreGraphicsState)     (void);
51     void    (*ShowCursor)               (void);
52     void    (*HideCursor)               (void);
53     void    (*SetForegroundColor)       (ECOLORS);
54     void    (*SetBackgroundColor)       (ECOLORS);
55 }OUTPUT_HANDLERS,*POUTPUT_HANDLERS;
56
57 // pointer indirection table for input functions
58 typedef struct _INPUT_HANDLERS
59 {
60     UCHAR   (*GetKeyPolled)             (void);
61     void    (*FlushKeyboardQueue)       (void);
62 }INPUT_HANDLERS,*PINPUT_HANDLERS;
63
64 extern OUTPUT_HANDLERS ohandlers;
65 extern INPUT_HANDLERS ihandlers;
66
67 enum
68 {
69     REGISTER_WINDOW = 0 ,
70     DATA_WINDOW ,
71     SOURCE_WINDOW ,
72     OUTPUT_WINDOW ,
73     OUTPUT_WINDOW_UNBUFFERED
74 };
75
76 typedef enum _ETERMINALMODE
77 {
78     TERMINAL_MODE_HERCULES_GRAPHICS = 0 ,
79     TERMINAL_MODE_HERCULES_TEXT,
80     TERMINAL_MODE_VGA_TEXT,
81     TERMINAL_MODE_SERIAL,
82     TERMINAL_MODE_NONE
83 }ETERMINALMODE;
84
85 extern ETERMINALMODE eTerminalMode;
86
87 extern WINDOW wWindow[];
88 extern BOOLEAN bRev;
89 extern BOOLEAN bGrayed;
90 extern BOOLEAN bCursorEnabled;
91
92 // install and remove handler
93 BOOLEAN ConsoleInit(void);
94 void ConsoleShutdown(void);
95
96 // OUTPUT handler
97 void Print(USHORT Window,LPSTR p);
98 void SetBackgroundColor(ECOLORS c);
99 void SetForegroundColor(ECOLORS c);
100 void Clear(USHORT window);
101 void PutChar(LPSTR p,ULONG x,ULONG y);
102 void ClrLine(ULONG line);
103 void ShowCursor(void);
104 void HideCursor(void);
105 void EnableScroll(USHORT Window);
106 void DisableScroll(USHORT Window);
107 void CopyLineTo(USHORT dest,USHORT src);
108 void PrintLogo(BOOLEAN bShow);
109 void PrintCursor(BOOLEAN bForce);
110 void PrintGraf(ULONG x,ULONG y,UCHAR c);
111 void ScrollUp(USHORT Window);
112 void Home(USHORT Window);
113 void InvertLine(ULONG line);
114 void FillLine(ULONG line,UCHAR c);
115 void PrintTemplate(void);
116 void PrintCaption(void);
117 void ClrLineToEnd(USHORT Window,ULONG line,ULONG x);
118 void SuspendPrintRingBuffer(BOOLEAN bSuspend);
119 void HatchLine(ULONG line);
120 void SaveGraphicsState(void);
121 void RestoreGraphicsState(void);
122 void SetWindowGeometry(PVOID pWindow);
123
124 // INPUT handler
125 UCHAR GetKeyPolled(void);
126 void FlushKeyboardQueue(void);
127
128
129 BOOLEAN PrintRingBufferOffset(ULONG ulLines,ULONG ulOffset);
130 BOOLEAN PrintRingBufferHome(ULONG ulLines);
131 void PrintRingBuffer(ULONG ulLines);
132 ULONG LinesInRingBuffer(void);
133 void ReplaceRingBufferCurrent(LPSTR s);
134 void EmptyRingBuffer(void);
135 void CheckRingBuffer(void);
136 BOOLEAN AddToRingBuffer(LPSTR p);
137 void ResetColor(void);
138
139 extern ULONG GLOBAL_SCREEN_WIDTH;
140 extern ULONG GLOBAL_SCREEN_HEIGHT;
141
142 extern ULONG ulOutputLock;
143
144 #define Acquire_Output_Lock()       \
145 {                                   \
146     save_flags(ulOutputLock);       \
147     cli();                          \
148 }
149
150 #define Release_Output_Lock()       \
151     restore_flags(ulOutputLock);
152
153 #define NOT_IMPLEMENTED()
154
155 extern USHORT usCaptionColor;
156 #define COLOR_CAPTION usCaptionColor
157 extern USHORT usCaptionText;
158 #define COLOR_TEXT usCaptionText
159 extern USHORT usForegroundColor;
160 #define COLOR_FOREGROUND usForegroundColor
161 extern USHORT usBackgroundColor;
162
163 #undef COLOR_BACKGROUND
164 #define COLOR_BACKGROUND usBackgroundColor
165 extern USHORT usHiLiteColor;
166 #define COLOR_HILITE usHiLiteColor