ReactOS 0.4.16-dev-2104-gb84fa49
bootvid.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for bootvid.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define LCDTIMING0_PPL(x)   ((((x) / 16 - 1) & 0x3f) << 2)
 
#define LCDTIMING1_LPP(x)   (((x) & 0x3ff) - 1)
 
#define LCDCONTROL_LCDPWR   (1 << 11)
 
#define LCDCONTROL_LCDEN   (1)
 
#define LCDCONTROL_LCDBPP(x)   (((x) & 7) << 1)
 
#define LCDCONTROL_LCDTFT   (1 << 5)
 
#define PL110_LCDTIMING0   (PVOID)0xE0020000
 
#define PL110_LCDTIMING1   (PVOID)0xE0020004
 
#define PL110_LCDTIMING2   (PVOID)0xE0020008
 
#define PL110_LCDUPBASE   (PVOID)0xE0020010
 
#define PL110_LCDLPBASE   (PVOID)0xE0020014
 
#define PL110_LCDCONTROL   (PVOID)0xE0020018
 

Functions

FORCEINLINE USHORT VidpBuildColor (_In_ UCHAR Color)
 
FORCEINLINE VOID SetPixel (_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
 
VOID DisplayCharacter (_In_ CHAR Character, _In_ ULONG Left, _In_ ULONG Top, _In_ ULONG TextColor, _In_ ULONG BackColor)
 
VOID DoScroll (_In_ ULONG Scroll)
 
VOID PreserveRow (_In_ ULONG CurrentTop, _In_ ULONG TopDelta, _In_ BOOLEAN Restore)
 
VOID VidpInitializeDisplay (VOID)
 
VOID InitPaletteWithTable (_In_reads_(Count) const ULONG *Table, _In_ ULONG Count)
 
BOOLEAN NTAPI VidInitialize (_In_ BOOLEAN SetMode)
 
VOID ResetDisplay (_In_ BOOLEAN SetMode)
 
VOID NTAPI VidCleanUp (VOID)
 
VOID NTAPI VidScreenToBufferBlt (_Out_writes_bytes_all_(Delta *Height) PUCHAR Buffer, _In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_ ULONG Delta)
 
VOID NTAPI VidSolidColorFill (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ UCHAR Color)
 

Variables

static PUSHORT VgaArmBase
 
static PHYSICAL_ADDRESS VgaPhysical
 

Macro Definition Documentation

◆ LCDCONTROL_LCDBPP

#define LCDCONTROL_LCDBPP (   x)    (((x) & 7) << 1)

Definition at line 19 of file bootvid.c.

◆ LCDCONTROL_LCDEN

#define LCDCONTROL_LCDEN   (1)

Definition at line 18 of file bootvid.c.

◆ LCDCONTROL_LCDPWR

#define LCDCONTROL_LCDPWR   (1 << 11)

Definition at line 17 of file bootvid.c.

◆ LCDCONTROL_LCDTFT

#define LCDCONTROL_LCDTFT   (1 << 5)

Definition at line 20 of file bootvid.c.

◆ LCDTIMING0_PPL

#define LCDTIMING0_PPL (   x)    ((((x) / 16 - 1) & 0x3f) << 2)

Definition at line 15 of file bootvid.c.

◆ LCDTIMING1_LPP

#define LCDTIMING1_LPP (   x)    (((x) & 0x3ff) - 1)

Definition at line 16 of file bootvid.c.

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file bootvid.c.

◆ PL110_LCDCONTROL

#define PL110_LCDCONTROL   (PVOID)0xE0020018

Definition at line 27 of file bootvid.c.

◆ PL110_LCDLPBASE

#define PL110_LCDLPBASE   (PVOID)0xE0020014

Definition at line 26 of file bootvid.c.

◆ PL110_LCDTIMING0

#define PL110_LCDTIMING0   (PVOID)0xE0020000

Definition at line 22 of file bootvid.c.

◆ PL110_LCDTIMING1

#define PL110_LCDTIMING1   (PVOID)0xE0020004

Definition at line 23 of file bootvid.c.

◆ PL110_LCDTIMING2

#define PL110_LCDTIMING2   (PVOID)0xE0020008

Definition at line 24 of file bootvid.c.

◆ PL110_LCDUPBASE

#define PL110_LCDUPBASE   (PVOID)0xE0020010

Definition at line 25 of file bootvid.c.

Function Documentation

◆ DisplayCharacter()

VOID DisplayCharacter ( _In_ CHAR  Character,
_In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  TextColor,
_In_ ULONG  BackColor 
)

Definition at line 67 of file bootvid.c.

73{
74 const UCHAR* FontChar;
75 ULONG i, j, XOffset;
76
77 /* Get the font line for this character */
78 FontChar = &VidpFontData[Character * BOOTCHAR_HEIGHT - Top];
79
80 /* Loop each pixel height */
81 for (i = BOOTCHAR_HEIGHT; i > 0; --i)
82 {
83 /* Loop each pixel width */
84 XOffset = Left;
85 for (j = (1 << 7); j > 0; j >>= 1)
86 {
87 /* Check if we should draw this pixel */
88 if (FontChar[Top] & (UCHAR)j)
89 {
90 /* We do, use the given Text Color */
91 SetPixel(XOffset, Top, (UCHAR)TextColor);
92 }
93 else if (BackColor < BV_COLOR_NONE)
94 {
95 /*
96 * This is a background pixel. We're drawing it
97 * unless it's transparent.
98 */
99 SetPixel(XOffset, Top, (UCHAR)BackColor);
100 }
101
102 /* Increase X Offset */
103 XOffset++;
104 }
105
106 /* Move to the next Y ordinate */
107 Top++;
108 }
109}
FORCEINLINE VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
Definition: bootvid.c:52
static LPHIST_ENTRY Top
Definition: history.c:53
#define BOOTCHAR_HEIGHT
Definition: precomp.h:35
const UCHAR VidpFontData[256 *BOOTCHAR_HEIGHT]
Definition: fontdata.c:16
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
#define BV_COLOR_NONE
Definition: display.h:31
uint32_t ULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by VidDisplayString(), and VidDisplayStringXY().

◆ DoScroll()

VOID DoScroll ( _In_ ULONG  Scroll)

Definition at line 112 of file bootvid.c.

114{
116 PUSHORT SourceOffset, DestOffset;
117 PUSHORT i, j;
118
119 /* Set memory positions of the scroll */
121 DestOffset = &SourceOffset[Scroll * (SCREEN_WIDTH / 8)];
122
123 /* Start loop */
125 {
126 /* Set number of bytes to loop and start offset */
128 j = SourceOffset;
129
130 /* Check if this is part of the scroll region */
131 if (Offset <= (VidpScrollRegion.Right >> 3))
132 {
133 /* Update position */
134 i = (PUSHORT)(DestOffset - SourceOffset);
135
136 /* Loop the X axis */
137 do
138 {
139 /* Write value in the new position so that we can do the scroll */
141
142 /* Move to the next memory location to write to */
143 j++;
144
145 /* Move to the next byte in the region */
146 Offset++;
147
148 /* Make sure we don't go past the scroll region */
149 } while (Offset <= (VidpScrollRegion.Right >> 3));
150 }
151
152 /* Move to the next line */
153 SourceOffset += (SCREEN_WIDTH / 8);
154 DestOffset += (SCREEN_WIDTH / 8);
155 }
156}
static PUSHORT VgaArmBase
Definition: bootvid.c:29
#define WRITE_REGISTER_USHORT(r, v)
Definition: arm.h:14
#define READ_REGISTER_USHORT(r)
Definition: arm.h:13
URECT VidpScrollRegion
Definition: console.c:17
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define SCREEN_WIDTH
Definition: pc98video.c:24
ULONG Right
Definition: precomp.h:64
ULONG Top
Definition: precomp.h:63
ULONG Bottom
Definition: precomp.h:65
ULONG Left
Definition: precomp.h:62
uint16_t * PUSHORT
Definition: typedefs.h:56
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Must_inspect_result_ _In_ WDFMEMORY _In_ size_t SourceOffset
Definition: wdfmemory.h:320

Referenced by VidDisplayString().

◆ InitPaletteWithTable()

VOID InitPaletteWithTable ( _In_reads_(Count) const ULONG Table,
_In_ ULONG  Count 
)

Definition at line 220 of file bootvid.c.

223{
225}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15

◆ PreserveRow()

VOID PreserveRow ( _In_ ULONG  CurrentTop,
_In_ ULONG  TopDelta,
_In_ BOOLEAN  Restore 
)

Definition at line 159 of file bootvid.c.

163{
164 PUSHORT Position1, Position2;
165 ULONG Count;
166
167 /* Calculate the position in memory for the row */
168 if (Restore)
169 {
170 /* Restore the row by copying back the contents saved off-screen */
171 Position1 = &VgaArmBase[CurrentTop * (SCREEN_WIDTH / 8)];
172 Position2 = &VgaArmBase[SCREEN_HEIGHT * (SCREEN_WIDTH / 8)];
173 }
174 else
175 {
176 /* Preserve the row by saving its contents off-screen */
177 Position1 = &VgaArmBase[SCREEN_HEIGHT * (SCREEN_WIDTH / 8)];
178 Position2 = &VgaArmBase[CurrentTop * (SCREEN_WIDTH / 8)];
179 }
180
181 /* Set the count and loop every pixel */
182 Count = TopDelta * (SCREEN_WIDTH / 8);
183 while (Count--)
184 {
185 /* Write the data back on the other position */
186 WRITE_REGISTER_USHORT(Position1, READ_REGISTER_USHORT(Position2));
187
188 /* Increase both positions */
189 Position1++;
190 Position2++;
191 }
192}
int Count
Definition: noreturn.cpp:7
#define SCREEN_HEIGHT
Definition: pc98video.c:25

Referenced by VidDisplayString().

◆ ResetDisplay()

VOID ResetDisplay ( _In_ BOOLEAN  SetMode)

Definition at line 263 of file bootvid.c.

265{
266 /* Re-initialize the display */
268
269 /* Re-initialize the palette and fill the screen black */
272}
VOID NTAPI VidSolidColorFill(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ UCHAR Color)
Definition: bootvid.c:298
VOID VidpInitializeDisplay(VOID)
Definition: bootvid.c:195
#define InitializePalette()
Definition: precomp.h:84
#define BV_COLOR_BLACK
Definition: display.h:15

Referenced by VidResetDisplay().

◆ SetPixel()

FORCEINLINE VOID SetPixel ( _In_ ULONG  Left,
_In_ ULONG  Top,
_In_ UCHAR  Color 
)

Definition at line 52 of file bootvid.c.

56{
57 PUSHORT PixelPosition;
58
59 /* Calculate the pixel position */
60 PixelPosition = &VgaArmBase[Left + (Top * SCREEN_WIDTH)];
61
62 /* Set our color */
64}
FORCEINLINE USHORT VidpBuildColor(_In_ UCHAR Color)
Definition: bootvid.c:36

Referenced by DisplayCharacter(), and VidSolidColorFill().

◆ VidCleanUp()

VOID NTAPI VidCleanUp ( VOID  )

Definition at line 276 of file bootvid.c.

277{
279 while (TRUE);
280}
#define TRUE
Definition: types.h:120

Referenced by InbvEnableBootDriver(), and InbvNotifyDisplayOwnershipLost().

◆ VidInitialize()

BOOLEAN NTAPI VidInitialize ( _In_ BOOLEAN  SetMode)

Definition at line 231 of file bootvid.c.

233{
234 DPRINT1("bv-arm v0.1\n");
235
236 //
237 // Allocate framebuffer
238 // 600kb works out to 640x480@16bpp
239 //
242 if (!VgaArmBase) return FALSE;
243
244 //
245 // Get physical address
246 //
248 if (!VgaPhysical.QuadPart) return FALSE;
249 DPRINT1("[BV-ARM] Frame Buffer @ 0x%p 0p%p\n", VgaArmBase, VgaPhysical.LowPart);
250
251 //
252 // Setup the display
253 //
255
256 //
257 // We are done!
258 //
259 return TRUE;
260}
static PHYSICAL_ADDRESS VgaPhysical
Definition: bootvid.c:30
#define DPRINT1
Definition: precomp.h:8
PVOID NTAPI MmAllocateContiguousMemory(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: contmem.c:626
#define FALSE
Definition: types.h:117
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
Definition: stubs.c:685
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106

Referenced by InbvDriverInitialize().

◆ VidpBuildColor()

FORCEINLINE USHORT VidpBuildColor ( _In_ UCHAR  Color)

Definition at line 36 of file bootvid.c.

38{
40
41 /* Extract color components */
45
46 /* Build the 16-bit color mask */
47 return ((Red & 0x1F) << 11) | ((Green & 0x1F) << 6) | ((Blue & 0x1F));
48}
@ Green
Definition: bl.h:199
@ Red
Definition: bl.h:201
@ Blue
Definition: bl.h:198
const RGBQUAD VidpDefaultPalette[BV_MAX_COLORS]
Definition: common.c:19
#define GetBValue(quad)
Definition: precomp.h:82
#define GetGValue(quad)
Definition: precomp.h:81
#define GetRValue(quad)
Definition: precomp.h:80

Referenced by SetPixel().

◆ VidpInitializeDisplay()

VOID VidpInitializeDisplay ( VOID  )

Definition at line 195 of file bootvid.c.

196{
197 //
198 // Set framebuffer address
199 //
202
203 //
204 // Initialize timings to 640x480
205 //
208
209 //
210 // Enable the LCD Display
211 //
217}
#define PL110_LCDCONTROL
Definition: bootvid.c:27
#define LCDCONTROL_LCDBPP(x)
Definition: bootvid.c:19
#define PL110_LCDTIMING1
Definition: bootvid.c:23
#define PL110_LCDUPBASE
Definition: bootvid.c:25
#define PL110_LCDTIMING0
Definition: bootvid.c:22
#define LCDTIMING0_PPL(x)
Definition: bootvid.c:15
#define LCDCONTROL_LCDPWR
Definition: bootvid.c:17
#define LCDCONTROL_LCDEN
Definition: bootvid.c:18
#define LCDCONTROL_LCDTFT
Definition: bootvid.c:20
#define LCDTIMING1_LPP(x)
Definition: bootvid.c:16
#define PL110_LCDLPBASE
Definition: bootvid.c:26
#define WRITE_REGISTER_ULONG(r, v)
Definition: arm.h:11

Referenced by ResetDisplay(), and VidInitialize().

◆ VidScreenToBufferBlt()

VOID NTAPI VidScreenToBufferBlt ( _Out_writes_bytes_all_(Delta *Height) PUCHAR  Buffer,
_In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  Width,
_In_ ULONG  Height,
_In_ ULONG  Delta 
)

Definition at line 284 of file bootvid.c.

291{
293 while (TRUE);
294}

Referenced by InbvScreenToBufferBlt().

◆ VidSolidColorFill()

VOID NTAPI VidSolidColorFill ( _In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  Right,
_In_ ULONG  Bottom,
_In_ UCHAR  Color 
)

Definition at line 298 of file bootvid.c.

304{
305 int y, x;
306
307 //
308 // Loop along the Y-axis
309 //
310 for (y = Top; y <= Bottom; y++)
311 {
312 //
313 // Loop along the X-axis
314 //
315 for (x = Left; x <= Right; x++)
316 {
317 //
318 // Draw the pixel
319 //
320 SetPixel(x, y, Color);
321 }
322 }
323}
static LPHIST_ENTRY Bottom
Definition: history.c:54
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by BootAnimTickProgressBar(), FinalizeBootLogo(), InbvRotationThread(), InbvSolidColorFill(), ResetDisplay(), RleBitBlt(), and VidCleanUp().

Variable Documentation

◆ VgaArmBase

PUSHORT VgaArmBase
static

Definition at line 29 of file bootvid.c.

Referenced by DoScroll(), PreserveRow(), SetPixel(), and VidInitialize().

◆ VgaPhysical

PHYSICAL_ADDRESS VgaPhysical
static

Definition at line 30 of file bootvid.c.

Referenced by VidInitialize(), and VidpInitializeDisplay().