ReactOS 0.4.15-dev-8191-gbc6c731
textcons.c File Reference
#include "bl.h"
Include dependency graph for textcons.c:

Go to the source code of this file.

Functions

VOID ConsoleTextLocalDestruct (_In_ struct _BL_TEXT_CONSOLE *Console)
 
NTSTATUS ConsoleTextLocalReinitialize (_In_ struct _BL_TEXT_CONSOLE *Console)
 
NTSTATUS ConsoleTextBaseGetTextState (_In_ struct _BL_TEXT_CONSOLE *Console, _Out_ PBL_DISPLAY_STATE TextState)
 
NTSTATUS ConsoleTextLocalSetTextState (_In_ struct _BL_TEXT_CONSOLE *Console, _In_ ULONG Mask, _In_ PBL_DISPLAY_STATE TextState)
 
NTSTATUS ConsoleTextBaseGetTextResolution (_In_ struct _BL_TEXT_CONSOLE *Console, _Out_ PULONG TextResolution)
 
NTSTATUS ConsoleTextLocalSetTextResolution (_In_ struct _BL_TEXT_CONSOLE *Console, _In_ ULONG NewTextResolution, _Out_ PULONG OldTextResolution)
 
NTSTATUS ConsoleTextLocalClearText (_In_ struct _BL_TEXT_CONSOLE *Console, _In_ BOOLEAN LineOnly)
 
NTSTATUS ConsoleTextLocalWriteText (_In_ struct _BL_TEXT_CONSOLE *Console, _In_ PCHAR Text, _In_ ULONG Attribute)
 
NTSTATUS ConsoleTextLocalConstruct (_In_ PBL_TEXT_CONSOLE TextConsole, _In_ BOOLEAN Activate)
 
BOOLEAN ConsolepFindResolution (_In_ PBL_DISPLAY_MODE Mode, _In_ PBL_DISPLAY_MODE List, _In_ ULONG MaxIndex)
 
VOID ConsoleInputLocalDestruct (_In_ PBL_INPUT_CONSOLE Console)
 
NTSTATUS ConsoleInputBaseConstruct (_In_ PBL_INPUT_CONSOLE Console)
 
NTSTATUS ConsoleInputBaseReinitialize (_In_ PBL_INPUT_CONSOLE Console)
 
NTSTATUS ConsoleCreateLocalInputConsole (VOID)
 

Variables

BL_TEXT_CONSOLE_VTABLE ConsoleTextLocalVtbl
 
BL_INPUT_CONSOLE_VTABLE ConsoleInputLocalVtbl
 

Function Documentation

◆ ConsoleCreateLocalInputConsole()

NTSTATUS ConsoleCreateLocalInputConsole ( VOID  )

Definition at line 243 of file textcons.c.

246{
247 PBL_INPUT_CONSOLE InputConsole;
249
250 /* Allocate the input console */
251 InputConsole = BlMmAllocateHeap(sizeof(*InputConsole));
252 if (!InputConsole)
253 {
255 }
256
257 /* Construct it */
258 Status = ConsoleInputBaseConstruct(InputConsole);
259 if (!NT_SUCCESS(Status))
260 {
261 /* Tear down on failure */
262 BlMmFreeHeap(InputConsole);
263 return Status;
264 }
265
266 /* Set the callback table, and set us as the local input console */
267 InputConsole->Callbacks = &ConsoleInputLocalVtbl;
268 DspLocalInputConsole = InputConsole;
269 return STATUS_SUCCESS;
270}
LONG NTSTATUS
Definition: precomp.h:26
PVOID BlMmAllocateHeap(_In_ SIZE_T Size)
Definition: heapalloc.c:569
PVOID DspLocalInputConsole
Definition: display.c:38
NTSTATUS BlMmFreeHeap(_In_ PVOID Buffer)
Definition: heapalloc.c:663
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:25
#define STATUS_SUCCESS
Definition: shellext.h:65
PBL_INPUT_CONSOLE_VTABLE Callbacks
Definition: bl.h:1131
BL_INPUT_CONSOLE_VTABLE ConsoleInputLocalVtbl
Definition: textcons.c:187
NTSTATUS ConsoleInputBaseConstruct(_In_ PBL_INPUT_CONSOLE Console)
Definition: textcons.c:204
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

Referenced by DsppInitialize(), and DsppReinitialize().

◆ ConsoleInputBaseConstruct()

NTSTATUS ConsoleInputBaseConstruct ( _In_ PBL_INPUT_CONSOLE  Console)

Definition at line 204 of file textcons.c.

207{
209
210 /* Allocate a new 512 byte buffer */
212 Console->Buffer = Buffer;
213 if (!Buffer)
214 {
216 }
217
218 /* Set the current buffer pointers to it */
219 Console->DataStart = Buffer;
220 Console->DataEnd = Buffer;
221
222 /* Set the end 128 data entries into the buffer */
223 Console->EndBuffer = Buffer + 128;
224 return STATUS_SUCCESS;
225}
CConsole Console
Definition: bufpool.h:45
uint32_t * PULONG
Definition: typedefs.h:59

Referenced by ConsoleCreateLocalInputConsole().

◆ ConsoleInputBaseReinitialize()

NTSTATUS ConsoleInputBaseReinitialize ( _In_ PBL_INPUT_CONSOLE  Console)

Definition at line 228 of file textcons.c.

231{
233
234 /* Reset all the buffer pointers to the current buffer */
235 Buffer = Console->Buffer;
236 Console->DataStart = Buffer;
237 Console->DataEnd = Buffer;
238 Console->EndBuffer = Buffer + 128;
239 return STATUS_SUCCESS;
240}

◆ ConsoleInputLocalDestruct()

VOID ConsoleInputLocalDestruct ( _In_ PBL_INPUT_CONSOLE  Console)

Definition at line 194 of file textcons.c.

197{
198 /* Erase the current input buffer, and tear down the console */
200 BlMmFreeHeap(Console->Buffer);
201}
NTSTATUS ConsoleInputLocalEraseBuffer(_In_ PBL_INPUT_CONSOLE Console, _In_opt_ PULONG ValueToFill)
Definition: textcons.c:527
#define NULL
Definition: types.h:112

◆ ConsolepFindResolution()

BOOLEAN ConsolepFindResolution ( _In_ PBL_DISPLAY_MODE  Mode,
_In_ PBL_DISPLAY_MODE  List,
_In_ ULONG  MaxIndex 
)

Definition at line 159 of file textcons.c.

164{
166
167 /* Loop until we hit the maximum supported list index */
168 ListEnd = &List[MaxIndex];
169 while (List != ListEnd)
170 {
171 /* Does this resolution match? */
172 if ((Mode->HRes == List->HRes) && (Mode->VRes == List->VRes))
173 {
174 /* Yep -- we got a match */
175 return TRUE;
176
177 }
178
179 /* Try another one*/
180 List++;
181 }
182
183 /* No matches were found */
184 return FALSE;
185}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
_In_ ULONG Mode
Definition: hubbusif.h:303
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY ListEnd
Definition: exfuncs.h:1224

Referenced by ConsoleFirmwareTextOpen().

◆ ConsoleTextBaseGetTextResolution()

NTSTATUS ConsoleTextBaseGetTextResolution ( _In_ struct _BL_TEXT_CONSOLE Console,
_Out_ PULONG  TextResolution 
)

Definition at line 66 of file textcons.c.

70{
72}
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239

◆ ConsoleTextBaseGetTextState()

NTSTATUS ConsoleTextBaseGetTextState ( _In_ struct _BL_TEXT_CONSOLE Console,
_Out_ PBL_DISPLAY_STATE  TextState 
)

Definition at line 47 of file textcons.c.

51{
53}

◆ ConsoleTextLocalClearText()

NTSTATUS ConsoleTextLocalClearText ( _In_ struct _BL_TEXT_CONSOLE Console,
_In_ BOOLEAN  LineOnly 
)

Definition at line 85 of file textcons.c.

89{
90 return ConsoleFirmwareTextClear(Console, LineOnly);
91}
NTSTATUS ConsoleFirmwareTextClear(_In_ PBL_TEXT_CONSOLE Console, _In_ BOOLEAN LineOnly)
Definition: textcons.c:557

◆ ConsoleTextLocalConstruct()

NTSTATUS ConsoleTextLocalConstruct ( _In_ PBL_TEXT_CONSOLE  TextConsole,
_In_ BOOLEAN  Activate 
)

Definition at line 104 of file textcons.c.

108{
110 BL_DISPLAY_STATE TextState;
111
112 /* Set our callbacks */
113 TextConsole->Callbacks = &ConsoleTextLocalVtbl;
114
115 /* Are we activating this console? */
116 if (Activate)
117 {
118 /* Call firmware to activate it */
119 Status = ConsoleFirmwareTextOpen(TextConsole);
120 if (!NT_SUCCESS(Status))
121 {
122 EfiPrintf(L"Failed to activate console: %lx\r\n", Status);
123 return Status;
124 }
125 }
126
127 /* Set default text state */
128 TextState.BgColor = 0;
129 TextState.XPos = 0;
130 TextState.YPos = 0;
131 TextState.CursorVisible = FALSE;
132 TextState.FgColor = White;
133
134 /* Are we activating? */
135 if (Activate)
136 {
137 /* Call firmware to set it */
138 Status = ConsoleFirmwareTextSetState(TextConsole, 0xF, &TextState);
139 if (!NT_SUCCESS(Status))
140 {
141 /* We failed, back down */
142 EfiPrintf(L"Failed to set console state: %lx\r\n", Status);
143 ConsoleFirmwareTextClose(TextConsole);
144 return Status;
145 }
146 }
147 else
148 {
149 /* Just save the state for now, someone else can activate later */
150 TextConsole->State = TextState;
151 }
152
153 /* Remember if we activated it */
154 TextConsole->Active = Activate;
155 return STATUS_SUCCESS;
156}
VOID EfiPrintf(_In_ PWCHAR Format,...)
Definition: firmware.c:126
NTSTATUS ConsoleFirmwareTextOpen(_In_ PBL_TEXT_CONSOLE TextConsole)
Definition: textcons.c:421
VOID ConsoleFirmwareTextClose(_In_ PBL_TEXT_CONSOLE TextConsole)
Definition: textcons.c:398
@ White
Definition: bl.h:212
NTSTATUS ConsoleFirmwareTextSetState(_In_ PBL_TEXT_CONSOLE TextConsole, _In_ UCHAR Mask, _In_ PBL_DISPLAY_STATE State)
Definition: textcons.c:198
#define L(x)
Definition: ntvdm.h:50
ULONG YPos
Definition: bl.h:1073
ULONG FgColor
Definition: bl.h:1071
ULONG BgColor
Definition: bl.h:1070
ULONG CursorVisible
Definition: bl.h:1074
ULONG XPos
Definition: bl.h:1072
BL_TEXT_CONSOLE_VTABLE ConsoleTextLocalVtbl
Definition: textcons.c:15

Referenced by ConsoleGraphicalConstruct(), and DsppInitialize().

◆ ConsoleTextLocalDestruct()

VOID ConsoleTextLocalDestruct ( _In_ struct _BL_TEXT_CONSOLE Console)

Definition at line 30 of file textcons.c.

33{
34
35}

Referenced by ConsoleGraphicalConstruct(), and ConsoleGraphicalDestruct().

◆ ConsoleTextLocalReinitialize()

NTSTATUS ConsoleTextLocalReinitialize ( _In_ struct _BL_TEXT_CONSOLE Console)

Definition at line 38 of file textcons.c.

41{
42 EfiPrintf(L"Not active yet!\r\n");
44}

Referenced by ConsoleGraphicalReinitialize().

◆ ConsoleTextLocalSetTextResolution()

NTSTATUS ConsoleTextLocalSetTextResolution ( _In_ struct _BL_TEXT_CONSOLE Console,
_In_ ULONG  NewTextResolution,
_Out_ PULONG  OldTextResolution 
)

Definition at line 75 of file textcons.c.

80{
82}

◆ ConsoleTextLocalSetTextState()

NTSTATUS ConsoleTextLocalSetTextState ( _In_ struct _BL_TEXT_CONSOLE Console,
_In_ ULONG  Mask,
_In_ PBL_DISPLAY_STATE  TextState 
)

Definition at line 56 of file textcons.c.

61{
62 return ConsoleFirmwareTextSetState(Console, Mask, TextState);
63}
unsigned int Mask
Definition: fpcontrol.c:82

◆ ConsoleTextLocalWriteText()

NTSTATUS ConsoleTextLocalWriteText ( _In_ struct _BL_TEXT_CONSOLE Console,
_In_ PCHAR  Text,
_In_ ULONG  Attribute 
)

Definition at line 94 of file textcons.c.

99{
101}

Variable Documentation

◆ ConsoleInputLocalVtbl

BL_INPUT_CONSOLE_VTABLE ConsoleInputLocalVtbl
Initial value:
=
{
}
NTSTATUS(* PCONSOLE_REINITIALIZE)(_In_ struct _BL_TEXT_CONSOLE *Console)
Definition: bl.h:487
VOID(* PCONSOLE_DESTRUCT)(_In_ struct _BL_TEXT_CONSOLE *Console)
Definition: bl.h:481
NTSTATUS ConsoleInputBaseReinitialize(_In_ PBL_INPUT_CONSOLE Console)
Definition: textcons.c:228
VOID ConsoleInputLocalDestruct(_In_ PBL_INPUT_CONSOLE Console)
Definition: textcons.c:194

Definition at line 187 of file textcons.c.

Referenced by ConsoleCreateLocalInputConsole().

◆ ConsoleTextLocalVtbl

BL_TEXT_CONSOLE_VTABLE ConsoleTextLocalVtbl
Initial value:
=
{
}
VOID ConsoleTextLocalDestruct(_In_ struct _BL_TEXT_CONSOLE *Console)
Definition: textcons.c:30
NTSTATUS ConsoleTextLocalWriteText(_In_ struct _BL_TEXT_CONSOLE *Console, _In_ PCHAR Text, _In_ ULONG Attribute)
Definition: textcons.c:94
NTSTATUS ConsoleTextLocalSetTextResolution(_In_ struct _BL_TEXT_CONSOLE *Console, _In_ ULONG NewTextResolution, _Out_ PULONG OldTextResolution)
Definition: textcons.c:75
NTSTATUS ConsoleTextLocalSetTextState(_In_ struct _BL_TEXT_CONSOLE *Console, _In_ ULONG Mask, _In_ PBL_DISPLAY_STATE TextState)
Definition: textcons.c:56
NTSTATUS ConsoleTextBaseGetTextState(_In_ struct _BL_TEXT_CONSOLE *Console, _Out_ PBL_DISPLAY_STATE TextState)
Definition: textcons.c:47
NTSTATUS ConsoleTextLocalReinitialize(_In_ struct _BL_TEXT_CONSOLE *Console)
Definition: textcons.c:38
NTSTATUS ConsoleTextBaseGetTextResolution(_In_ struct _BL_TEXT_CONSOLE *Console, _Out_ PULONG TextResolution)
Definition: textcons.c:66
NTSTATUS ConsoleTextLocalClearText(_In_ struct _BL_TEXT_CONSOLE *Console, _In_ BOOLEAN LineOnly)
Definition: textcons.c:85

Definition at line 15 of file textcons.c.

Referenced by ConsoleTextLocalConstruct().