ReactOS  0.4.14-dev-833-g5f692ed
display.c File Reference
#include <hal.h>
#include <ppcboot.h>
#include <ppcdebug.h>
#include <debug.h>
Include dependency graph for display.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define SCREEN_SYNCHRONIZATION
 

Functions

void SetPhys (ULONG Addr, ULONG Data)
 
ULONG GetPhys (ULONG Addr)
 
void SetPhysByte (ULONG Addr, ULONG Data)
 
VOID FASTCALL HalClearDisplay (UCHAR CharAttribute)
 
VOID STATIC HalScrollDisplay (VOID)
 
VOID STATIC FASTCALL HalPutCharacter (CHAR Character)
 
VOID FASTCALL HalInitializeDisplay (PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
 
VOID NTAPI HalReleaseDisplayOwnership (VOID)
 
VOID NTAPI HalAcquireDisplayOwnership (IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters)
 
VOID NTAPI HalDisplayString (IN PCH String)
 
VOID NTAPI HalQueryDisplayParameters (OUT PULONG DispSizeX, OUT PULONG DispSizeY, OUT PULONG CursorPosX, OUT PULONG CursorPosY)
 
VOID NTAPI HalSetDisplayParameters (IN ULONG CursorPosX, IN ULONG CursorPosY)
 
BOOLEAN NTAPI HalQueryDisplayOwnership (VOID)
 

Variables

boot_infos_t PpcEarlybootInfo
 
static ULONG CursorX = 0
 
static ULONG CursorY = 0
 
static ULONG SizeX = 80
 
static ULONG SizeY = 25
 
static BOOLEAN DisplayInitialized = FALSE
 
static BOOLEAN HalOwnsDisplay = TRUE
 
static ULONG GraphVideoBuffer = 0
 
static PHAL_RESET_DISPLAY_PARAMETERS HalResetDisplayParameters = NULL
 
UCHAR XboxFont8x16 []
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 127 of file display.c.

◆ SCREEN_SYNCHRONIZATION

#define SCREEN_SYNCHRONIZATION

Definition at line 132 of file display.c.

Function Documentation

◆ GetPhys()

◆ HalAcquireDisplayOwnership()

VOID NTAPI HalAcquireDisplayOwnership ( IN PHAL_RESET_DISPLAY_PARAMETERS  ResetDisplayParameters)

Definition at line 269 of file display.c.

276 {
278  HalResetDisplayParameters = ResetDisplayParameters;
279 }
static PHAL_RESET_DISPLAY_PARAMETERS HalResetDisplayParameters
Definition: display.c:144
static BOOLEAN HalOwnsDisplay
Definition: display.c:142

◆ HalClearDisplay()

VOID FASTCALL HalClearDisplay ( UCHAR  CharAttribute)

Definition at line 154 of file display.c.

155 {
156  ULONG i;
157  ULONG deviceSize =
158  PpcEarlybootInfo.dispDeviceRowBytes *
159  PpcEarlybootInfo.dispDeviceRect[3];
160  for(i = 0; i < deviceSize; i += sizeof(int) )
161  SetPhys(GraphVideoBuffer + i, CharAttribute);
162 
163  CursorX = 0;
164  CursorY = 0;
165 }
static ULONG CursorY
Definition: display.c:137
static ULONG GraphVideoBuffer
Definition: display.c:143
boot_infos_t PpcEarlybootInfo
Definition: display.c:130
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static ULONG CursorX
Definition: display.c:136
unsigned int ULONG
Definition: retypes.h:1
void SetPhys(ULONG Addr, ULONG Data)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by HalInitializeDisplay(), and HalReleaseDisplayOwnership().

◆ HalDisplayString()

VOID NTAPI HalDisplayString ( IN PCH  String)

Definition at line 282 of file display.c.

291 {
292  PCH pch;
293  //static KSPIN_LOCK Lock;
294  KIRQL OldIrql;
295  BOOLEAN InterruptsEnabled = __readmsr();
296 
297  /* See comment at top of file */
299  {
300  return;
301  }
302 
303  pch = String;
304 
306  //KiAcquireSpinLock(&Lock);
307 
308  _disable();
309 
310  while (*pch != 0)
311  {
312  if (*pch == '\n')
313  {
314  CursorY++;
315  CursorX = 0;
316  }
317  else if (*pch == '\b')
318  {
319  if (CursorX > 0)
320  {
321  CursorX--;
322  }
323  }
324  else if (*pch != '\r')
325  {
326  HalPutCharacter (*pch);
327  CursorX++;
328 
329  if (CursorX >= SizeX)
330  {
331  CursorY++;
332  CursorX = 0;
333  }
334  }
335 
336  if (CursorY >= SizeY)
337  {
338  HalScrollDisplay ();
339  CursorY = SizeY - 1;
340  }
341 
342  pch++;
343  }
344 
345  __writemsr(InterruptsEnabled);
346 
347  //KiReleaseSpinLock(&Lock);
349 }
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
static ULONG CursorY
Definition: display.c:137
static WCHAR String[]
Definition: stringtable.c:55
static ULONG SizeX
Definition: display.c:138
#define pch(ap)
Definition: match.c:418
UCHAR KIRQL
Definition: env_spec_w32.h:591
CHAR * PCH
Definition: ntbasedef.h:398
unsigned char BOOLEAN
PPC_QUAL unsigned long long __readmsr()
Definition: intrin_ppc.h:741
VOID STATIC HalScrollDisplay(VOID)
Definition: display.c:171
VOID STATIC FASTCALL HalPutCharacter(CHAR Character)
Definition: display.c:195
static ULONG CursorX
Definition: display.c:136
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
PPC_QUAL void __writemsr(const unsigned long Value)
Definition: intrin_ppc.h:748
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
static BOOLEAN HalOwnsDisplay
Definition: display.c:142
static BOOLEAN DisplayInitialized
Definition: display.c:141
void __cdecl _disable(void)
Definition: intrin_arm.h:365
static ULONG SizeY
Definition: display.c:139

◆ HalInitializeDisplay()

VOID FASTCALL HalInitializeDisplay ( PROS_LOADER_PARAMETER_BLOCK  LoaderBlock)

Definition at line 222 of file display.c.

228 {
229  if (! DisplayInitialized)
230  {
231  boot_infos_t *XBootInfo = (boot_infos_t *)LoaderBlock->ArchExtra;
232  GraphVideoBuffer = (ULONG)XBootInfo->dispDeviceBase;
233  memcpy(&PpcEarlybootInfo, XBootInfo, sizeof(*XBootInfo));
234 
235  /* Set cursor position */
236  CursorX = 0;
237  CursorY = 0;
238 
239  SizeX = XBootInfo->dispDeviceRowBytes / XBootInfo->dispDeviceDepth;
240  SizeY = XBootInfo->dispDeviceRect[3] / 16;
241 
242  HalClearDisplay(1);
243 
245  }
246 }
#define TRUE
Definition: types.h:120
static ULONG CursorY
Definition: display.c:137
static ULONG SizeX
Definition: display.c:138
static ULONG GraphVideoBuffer
Definition: display.c:143
boot_infos_t PpcEarlybootInfo
Definition: display.c:130
static ULONG CursorX
Definition: display.c:136
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
VOID FASTCALL HalClearDisplay(UCHAR CharAttribute)
Definition: display.c:154
static BOOLEAN DisplayInitialized
Definition: display.c:141
unsigned int ULONG
Definition: retypes.h:1
static ULONG SizeY
Definition: display.c:139

◆ HalPutCharacter()

VOID STATIC FASTCALL HalPutCharacter ( CHAR  Character)

Definition at line 195 of file display.c.

196 {
197  WRITE_PORT_UCHAR((PVOID)0x3f8, Character);
198 #if 0
199  int i,j,k;
200  ULONG Dest =
202  (16 * PpcEarlybootInfo.dispDeviceRowBytes * CursorY) +
203  (8 * (PpcEarlybootInfo.dispDeviceDepth / 8) * CursorX)), RowDest;
204  UCHAR ByteToPlace;
205 
206  for( i = 0; i < 16; i++ ) {
207  RowDest = Dest;
208  for( j = 0; j < 8; j++ ) {
209  ByteToPlace = ((128 >> j) & (XboxFont8x16[(16 * Character) + i])) ? 0xff : 1;
210  for( k = 0; k < PpcEarlybootInfo.dispDeviceDepth / 8; k++, RowDest++ ) {
211  SetPhysByte(RowDest, ByteToPlace);
212  }
213  }
214  Dest += PpcEarlybootInfo.dispDeviceRowBytes;
215  }
216 #endif
217 }
static ULONG CursorY
Definition: display.c:137
UCHAR XboxFont8x16[]
Definition: xboxfont.c:23
static ULONG GraphVideoBuffer
Definition: display.c:143
boot_infos_t PpcEarlybootInfo
Definition: display.c:130
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
unsigned char UCHAR
Definition: xmlstorage.h:181
static ULONG CursorX
Definition: display.c:136
unsigned int ULONG
Definition: retypes.h:1
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532
void SetPhysByte(ULONG Addr, ULONG Data)
int k
Definition: mpi.c:3369

Referenced by HalDisplayString().

◆ HalQueryDisplayOwnership()

BOOLEAN NTAPI HalQueryDisplayOwnership ( VOID  )

Definition at line 378 of file display.c.

379 {
380  return !HalOwnsDisplay;
381 }
static BOOLEAN HalOwnsDisplay
Definition: display.c:142

◆ HalQueryDisplayParameters()

VOID NTAPI HalQueryDisplayParameters ( OUT PULONG  DispSizeX,
OUT PULONG  DispSizeY,
OUT PULONG  CursorPosX,
OUT PULONG  CursorPosY 
)

Definition at line 352 of file display.c.

356 {
357  if (DispSizeX)
358  *DispSizeX = SizeX;
359  if (DispSizeY)
360  *DispSizeY = SizeY;
361  if (CursorPosX)
362  *CursorPosX = CursorX;
363  if (CursorPosY)
364  *CursorPosY = CursorY;
365 }
static ULONG CursorY
Definition: display.c:137
static ULONG SizeX
Definition: display.c:138
static ULONG CursorX
Definition: display.c:136
static ULONG SizeY
Definition: display.c:139

◆ HalReleaseDisplayOwnership()

VOID NTAPI HalReleaseDisplayOwnership ( VOID  )

Definition at line 252 of file display.c.

256 {
258  return;
259 
260  if (HalOwnsDisplay != FALSE)
261  return;
262 
264  HalClearDisplay(0);
265 }
#define TRUE
Definition: types.h:120
smooth NULL
Definition: ftsmooth.c:416
static PHAL_RESET_DISPLAY_PARAMETERS HalResetDisplayParameters
Definition: display.c:144
VOID FASTCALL HalClearDisplay(UCHAR CharAttribute)
Definition: display.c:154
static BOOLEAN HalOwnsDisplay
Definition: display.c:142

◆ HalScrollDisplay()

VOID STATIC HalScrollDisplay ( VOID  )

Definition at line 171 of file display.c.

172 {
173  ULONG i, deviceSize =
174  PpcEarlybootInfo.dispDeviceRowBytes *
175  PpcEarlybootInfo.dispDeviceRect[3];
176  ULONG Dest = (ULONG)GraphVideoBuffer,
177  Src = (ULONG)(GraphVideoBuffer + (16 * PpcEarlybootInfo.dispDeviceRowBytes));
178  ULONG End = (ULONG)
180  (PpcEarlybootInfo.dispDeviceRowBytes *
181  (PpcEarlybootInfo.dispDeviceRect[3]-16));
182 
183  while( Src < End )
184  {
185  SetPhys((ULONG)Dest, GetPhys(Src));
186  Src += 4; Dest += 4;
187  }
188 
189  /* Clear the bottom row */
190  for(i = End; i < deviceSize; i += sizeof(int) )
191  SetPhys(GraphVideoBuffer + i, 1);
192 }
static ULONG GraphVideoBuffer
Definition: display.c:143
boot_infos_t PpcEarlybootInfo
Definition: display.c:130
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG GetPhys(ULONG Addr)
unsigned int ULONG
Definition: retypes.h:1
void SetPhys(ULONG Addr, ULONG Data)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by HalDisplayString().

◆ HalSetDisplayParameters()

VOID NTAPI HalSetDisplayParameters ( IN ULONG  CursorPosX,
IN ULONG  CursorPosY 
)

Definition at line 369 of file display.c.

371 {
372  CursorX = (CursorPosX < SizeX) ? CursorPosX : SizeX - 1;
373  CursorY = (CursorPosY < SizeY) ? CursorPosY : SizeY - 1;
374 }
static ULONG CursorY
Definition: display.c:137
static ULONG SizeX
Definition: display.c:138
static ULONG CursorX
Definition: display.c:136
static ULONG SizeY
Definition: display.c:139

◆ SetPhys()

◆ SetPhysByte()

Variable Documentation

◆ CursorX

◆ CursorY

◆ DisplayInitialized

BOOLEAN DisplayInitialized = FALSE
static

Definition at line 141 of file display.c.

Referenced by HalDisplayString(), and HalInitializeDisplay().

◆ GraphVideoBuffer

ULONG GraphVideoBuffer = 0
static

◆ HalOwnsDisplay

BOOLEAN HalOwnsDisplay = TRUE
static

◆ HalResetDisplayParameters

PHAL_RESET_DISPLAY_PARAMETERS HalResetDisplayParameters = NULL
static

Definition at line 144 of file display.c.

Referenced by HalAcquireDisplayOwnership(), and HalReleaseDisplayOwnership().

◆ PpcEarlybootInfo

boot_infos_t PpcEarlybootInfo

◆ SizeX

◆ SizeY

◆ XboxFont8x16

UCHAR XboxFont8x16[]

Definition at line 23 of file xboxfont.c.

Referenced by HalPutCharacter(), and XboxVideoOutputChar().