ReactOS  0.4.13-dev-79-gcd489d8
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 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS ConsoleInputBaseConstruct(_In_ PBL_INPUT_CONSOLE Console)
Definition: textcons.c:204
LONG NTSTATUS
Definition: precomp.h:26
PBL_INPUT_CONSOLE_VTABLE Callbacks
Definition: bl.h:1132
NTSTATUS BlMmFreeHeap(_In_ PVOID Buffer)
Definition: heapalloc.c:663
PVOID BlMmAllocateHeap(_In_ SIZE_T Size)
Definition: heapalloc.c:569
BL_INPUT_CONSOLE_VTABLE ConsoleInputLocalVtbl
Definition: textcons.c:187
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
PVOID DspLocalInputConsole
Definition: display.c:38
return STATUS_SUCCESS
Definition: btrfs.c:2725

Referenced by DsppInitialize(), and DsppReinitialize().

◆ ConsoleInputBaseConstruct()

NTSTATUS ConsoleInputBaseConstruct ( _In_ PBL_INPUT_CONSOLE  Console)

Definition at line 204 of file textcons.c.

207 {
208  PULONG Buffer;
209 
210  /* Allocate a new 512 byte buffer */
211  Buffer = BlMmAllocateHeap(512);
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 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PVOID BlMmAllocateHeap(_In_ SIZE_T Size)
Definition: heapalloc.c:569
Definition: bufpool.h:45
unsigned int * PULONG
Definition: retypes.h:1
CConsole Console
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2725

Referenced by ConsoleCreateLocalInputConsole().

◆ ConsoleInputBaseReinitialize()

NTSTATUS ConsoleInputBaseReinitialize ( _In_ PBL_INPUT_CONSOLE  Console)

Definition at line 228 of file textcons.c.

231 {
232  PULONG Buffer;
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 }
Definition: bufpool.h:45
unsigned int * PULONG
Definition: retypes.h:1
CConsole Console
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2725

◆ 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 BlMmFreeHeap(_In_ PVOID Buffer)
Definition: heapalloc.c:663
NTSTATUS ConsoleInputLocalEraseBuffer(_In_ PBL_INPUT_CONSOLE Console, _In_opt_ PULONG FillValue)
Definition: textcons.c:527
smooth NULL
Definition: ftsmooth.c:416
CConsole Console

◆ 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
_In_ ULONG Mode
Definition: hubbusif.h:303
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY ListEnd
Definition: exfuncs.h:1015
LIST_ENTRY List
Definition: psmgr.c:57

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:225

◆ ConsoleTextBaseGetTextState()

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

Definition at line 47 of file textcons.c.

51 {
53 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225

◆ 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
CConsole Console

◆ 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 }
LONG NTSTATUS
Definition: precomp.h:26
Definition: bl.h:213
ULONG FgColor
Definition: bl.h:1072
NTSTATUS ConsoleFirmwareTextOpen(_In_ PBL_TEXT_CONSOLE TextConsole)
Definition: textcons.c:421
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS ConsoleFirmwareTextSetState(_In_ PBL_TEXT_CONSOLE TextConsole, _In_ UCHAR Mask, _In_ PBL_DISPLAY_STATE State)
Definition: textcons.c:198
VOID ConsoleFirmwareTextClose(_In_ PBL_TEXT_CONSOLE TextConsole)
Definition: textcons.c:398
ULONG BgColor
Definition: bl.h:1071
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
VOID EfiPrintf(_In_ PWCHAR Format,...)
Definition: firmware.c:126
ULONG XPos
Definition: bl.h:1073
ULONG YPos
Definition: bl.h:1074
return STATUS_SUCCESS
Definition: btrfs.c:2725
BL_TEXT_CONSOLE_VTABLE ConsoleTextLocalVtbl
Definition: textcons.c:15
ULONG CursorVisible
Definition: bl.h:1075

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 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
static const WCHAR L[]
Definition: oid.c:1250
VOID EfiPrintf(_In_ PWCHAR Format,...)
Definition: firmware.c:126

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 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225

◆ 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 }
NTSTATUS ConsoleFirmwareTextSetState(_In_ PBL_TEXT_CONSOLE TextConsole, _In_ UCHAR Mask, _In_ PBL_DISPLAY_STATE State)
Definition: textcons.c:198
CConsole Console

◆ ConsoleTextLocalWriteText()

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

Definition at line 94 of file textcons.c.

99 {
100  return STATUS_NOT_IMPLEMENTED;
101 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225

Variable Documentation

◆ ConsoleInputLocalVtbl

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

Definition at line 187 of file textcons.c.

Referenced by ConsoleCreateLocalInputConsole().

◆ ConsoleTextLocalVtbl

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

Definition at line 15 of file textcons.c.

Referenced by ConsoleTextLocalConstruct().