ReactOS 0.4.16-dev-1515-g853b446
bootvid.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Boot Video Driver for ARM devices
3 * LICENSE: BSD - See COPYING.ARM in root directory
4 * PURPOSE: Main file
5 * COPYRIGHT: Copyright 2008 ReactOS Portable Systems Group <ros.arm@reactos.org>
6 */
7
8#include "precomp.h"
9
10#define NDEBUG
11#include <debug.h>
12
15
16/* PRIVATE FUNCTIONS *********************************************************/
17
22{
24
25 /* Extract color components */
29
30 /* Build the 16-bit color mask */
31 return ((Red & 0x1F) << 11) | ((Green & 0x1F) << 6) | ((Blue & 0x1F));
32}
33
34VOID
36{
37 /* Nothing to prepare */
38 NOTHING;
39}
40
42VOID
44 _In_ ULONG Left,
47{
48 PUSHORT PixelPosition;
49
50 /* Calculate the pixel position */
51 PixelPosition = &VgaArmBase[Left + (Top * SCREEN_WIDTH)];
52
53 /* Set our color */
55}
56
57VOID
59 _In_ CHAR Character,
60 _In_ ULONG Left,
62 _In_ ULONG TextColor,
63 _In_ ULONG BackColor)
64{
65 PUCHAR FontChar;
66 ULONG i, j, XOffset;
67
68 /* Get the font line for this character */
69 FontChar = &VidpFontData[Character * BOOTCHAR_HEIGHT - Top];
70
71 /* Loop each pixel height */
72 for (i = BOOTCHAR_HEIGHT; i > 0; --i)
73 {
74 /* Loop each pixel width */
75 XOffset = Left;
76 for (j = (1 << 7); j > 0; j >>= 1)
77 {
78 /* Check if we should draw this pixel */
79 if (FontChar[Top] & (UCHAR)j)
80 {
81 /* We do, use the given Text Color */
82 SetPixel(XOffset, Top, (UCHAR)TextColor);
83 }
84 else if (BackColor < BV_COLOR_NONE)
85 {
86 /*
87 * This is a background pixel. We're drawing it
88 * unless it's transparent.
89 */
90 SetPixel(XOffset, Top, (UCHAR)BackColor);
91 }
92
93 /* Increase X Offset */
94 XOffset++;
95 }
96
97 /* Move to the next Y ordinate */
98 Top++;
99 }
100}
101
102VOID
104 _In_ ULONG Scroll)
105{
107 PUSHORT SourceOffset, DestOffset;
108 PUSHORT i, j;
109
110 /* Set memory positions of the scroll */
112 DestOffset = &SourceOffset[Scroll * (SCREEN_WIDTH / 8)];
113
114 /* Start loop */
115 for (Top = VidpScrollRegion[1]; Top <= VidpScrollRegion[3]; ++Top)
116 {
117 /* Set number of bytes to loop and start offset */
118 Offset = VidpScrollRegion[0] >> 3;
119 j = SourceOffset;
120
121 /* Check if this is part of the scroll region */
122 if (Offset <= (VidpScrollRegion[2] >> 3))
123 {
124 /* Update position */
125 i = (PUSHORT)(DestOffset - SourceOffset);
126
127 /* Loop the X axis */
128 do
129 {
130 /* Write value in the new position so that we can do the scroll */
132
133 /* Move to the next memory location to write to */
134 j++;
135
136 /* Move to the next byte in the region */
137 Offset++;
138
139 /* Make sure we don't go past the scroll region */
140 } while (Offset <= (VidpScrollRegion[2] >> 3));
141 }
142
143 /* Move to the next line */
144 SourceOffset += (SCREEN_WIDTH / 8);
145 DestOffset += (SCREEN_WIDTH / 8);
146 }
147}
148
149VOID
151 _In_ ULONG CurrentTop,
152 _In_ ULONG TopDelta,
153 _In_ BOOLEAN Restore)
154{
155 PUSHORT Position1, Position2;
156 ULONG Count;
157
158 /* Calculate the position in memory for the row */
159 if (Restore)
160 {
161 /* Restore the row by copying back the contents saved off-screen */
162 Position1 = &VgaArmBase[CurrentTop * (SCREEN_WIDTH / 8)];
163 Position2 = &VgaArmBase[SCREEN_HEIGHT * (SCREEN_WIDTH / 8)];
164 }
165 else
166 {
167 /* Preserve the row by saving its contents off-screen */
168 Position1 = &VgaArmBase[SCREEN_HEIGHT * (SCREEN_WIDTH / 8)];
169 Position2 = &VgaArmBase[CurrentTop * (SCREEN_WIDTH / 8)];
170 }
171
172 /* Set the count and loop every pixel */
173 Count = TopDelta * (SCREEN_WIDTH / 8);
174 while (Count--)
175 {
176 /* Write the data back on the other position */
177 WRITE_REGISTER_USHORT(Position1, READ_REGISTER_USHORT(Position2));
178
179 /* Increase both positions */
180 Position1++;
181 Position2++;
182 }
183}
184
185VOID
187{
188 //
189 // Set framebuffer address
190 //
193
194 //
195 // Initialize timings to 640x480
196 //
199
200 //
201 // Enable the LCD Display
202 //
208}
209
210VOID
214{
216}
217
218/* PUBLIC FUNCTIONS **********************************************************/
219
221NTAPI
223 _In_ BOOLEAN SetMode)
224{
225 DPRINT1("bv-arm v0.1\n");
226
227 //
228 // Allocate framebuffer
229 // 600kb works out to 640x480@16bpp
230 //
233 if (!VgaArmBase) return FALSE;
234
235 //
236 // Get physical address
237 //
239 if (!VgaPhysical.QuadPart) return FALSE;
240 DPRINT1("[BV-ARM] Frame Buffer @ 0x%p 0p%p\n", VgaArmBase, VgaPhysical.LowPart);
241
242 //
243 // Setup the display
244 //
246
247 //
248 // We are done!
249 //
250 return TRUE;
251}
252
253VOID
254NTAPI
256 _In_ BOOLEAN HalReset)
257{
258 //
259 // Clear the current position
260 //
261 VidpCurrentX = 0;
262 VidpCurrentY = 0;
263
264 //
265 // Re-initialize the VGA Display
266 //
268
269 //
270 // Re-initialize the palette and fill the screen black
271 //
274}
275
276VOID
277NTAPI
279{
281 while (TRUE);
282}
283
284VOID
285NTAPI
288 _In_ ULONG Left,
289 _In_ ULONG Top,
293{
295 while (TRUE);
296}
297
298VOID
299NTAPI
301 _In_ ULONG Left,
302 _In_ ULONG Top,
303 _In_ ULONG Right,
306{
307 int y, x;
308
309 //
310 // Loop along the Y-axis
311 //
312 for (y = Top; y <= Bottom; y++)
313 {
314 //
315 // Loop along the X-axis
316 //
317 for (x = Left; x <= Right; x++)
318 {
319 //
320 // Draw the pixel
321 //
322 SetPixel(x, y, Color);
323 }
324 }
325}
unsigned char BOOLEAN
VOID PreserveRow(_In_ ULONG CurrentTop, _In_ ULONG TopDelta, _In_ BOOLEAN Restore)
Definition: bootvid.c:150
VOID NTAPI VidScreenToBufferBlt(_Out_writes_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_ ULONG Delta)
Definition: bootvid.c:286
VOID NTAPI VidSolidColorFill(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ UCHAR Color)
Definition: bootvid.c:300
VOID PrepareForSetPixel(VOID)
Definition: bootvid.c:35
VOID NTAPI VidCleanUp(VOID)
Definition: bootvid.c:278
VOID NTAPI VidResetDisplay(_In_ BOOLEAN HalReset)
Definition: bootvid.c:255
FORCEINLINE VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
Definition: bootvid.c:43
PHYSICAL_ADDRESS VgaPhysical
Definition: bootvid.c:14
VOID DisplayCharacter(_In_ CHAR Character, _In_ ULONG Left, _In_ ULONG Top, _In_ ULONG TextColor, _In_ ULONG BackColor)
Definition: bootvid.c:58
VOID DoScroll(_In_ ULONG Scroll)
Definition: bootvid.c:103
VOID InitPaletteWithTable(_In_ PULONG Table, _In_ ULONG Count)
Definition: bootvid.c:211
FORCEINLINE USHORT VidpBuildColor(_In_ UCHAR Color)
Definition: bootvid.c:20
VOID VidpInitializeDisplay(VOID)
Definition: bootvid.c:186
BOOLEAN NTAPI VidInitialize(_In_ BOOLEAN SetMode)
Definition: bootvid.c:222
PUSHORT VgaArmBase
Definition: bootvid.c:13
#define WRITE_REGISTER_USHORT(r, v)
Definition: arm.h:30
#define READ_REGISTER_USHORT(r)
Definition: arm.h:29
#define WRITE_REGISTER_ULONG(r, v)
Definition: arm.h:27
#define DPRINT1
Definition: precomp.h:8
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53
@ Green
Definition: bl.h:199
@ Red
Definition: bl.h:201
@ Blue
Definition: bl.h:198
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
Definition: bufpool.h:45
PVOID NTAPI MmAllocateContiguousMemory(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: contmem.c:626
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
const RGBQUAD VidpDefaultPalette[BV_MAX_COLORS]
Definition: common.c:32
ULONG VidpCurrentY
Definition: common.c:17
ULONG VidpCurrentX
Definition: common.c:16
ULONG VidpScrollRegion[4]
Definition: common.c:19
#define GetBValue(quad)
Definition: precomp.h:75
#define GetGValue(quad)
Definition: precomp.h:74
#define GetRValue(quad)
Definition: precomp.h:73
#define BOOTCHAR_HEIGHT
Definition: precomp.h:36
#define InitializePalette()
Definition: precomp.h:77
UCHAR VidpFontData[256 *BOOTCHAR_HEIGHT]
Definition: fontdata.c:16
ASMGENDATA Table[]
Definition: genincdata.c:61
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
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 PL110_LCDCONTROL
Definition: hwclcd.c:23
#define LCDCONTROL_LCDBPP(x)
Definition: hwclcd.c:15
#define PL110_LCDTIMING1
Definition: hwclcd.c:19
#define PL110_LCDUPBASE
Definition: hwclcd.c:21
#define PL110_LCDTIMING0
Definition: hwclcd.c:18
#define LCDTIMING0_PPL(x)
Definition: hwclcd.c:11
#define LCDCONTROL_LCDPWR
Definition: hwclcd.c:13
#define LCDCONTROL_LCDEN
Definition: hwclcd.c:14
#define LCDCONTROL_LCDTFT
Definition: hwclcd.c:16
#define LCDTIMING1_LPP(x)
Definition: hwclcd.c:12
#define PL110_LCDLPBASE
Definition: hwclcd.c:22
#define NOTHING
Definition: input_list.c:10
#define _In_
Definition: no_sal2.h:158
#define _Out_writes_bytes_(s)
Definition: no_sal2.h:178
int Count
Definition: noreturn.cpp:7
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
Definition: stubs.c:685
#define SCREEN_WIDTH
Definition: pc98video.c:27
#define SCREEN_HEIGHT
Definition: pc98video.c:28
unsigned short USHORT
Definition: pedump.c:61
#define BV_COLOR_NONE
Definition: display.h:31
#define BV_COLOR_BLACK
Definition: display.h:15
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
uint16_t * PUSHORT
Definition: typedefs.h:56
uint32_t ULONG_PTR
Definition: typedefs.h:65
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
_Must_inspect_result_ _In_ WDFMEMORY _In_ size_t SourceOffset
Definition: wdfmemory.h:320
#define FORCEINLINE
Definition: wdftypes.h:67
static ULONG Delta
Definition: xboxvideo.c:33
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175