ReactOS  0.4.15-dev-439-g292f67a
bootvid.c
Go to the documentation of this file.
1 #include "precomp.h"
2 
3 #define NDEBUG
4 #include <debug.h>
5 
8 
9 /* PRIVATE FUNCTIONS *********************************************************/
10 
11 VOID
12 NTAPI
14  _In_ CHAR Character,
15  _In_ ULONG Left,
16  _In_ ULONG Top,
17  _In_ ULONG TextColor,
18  _In_ ULONG BackColor)
19 {
20  PUCHAR FontChar;
21  ULONG i, j, XOffset;
22 
23  /* Get the font line for this character */
24  FontChar = &VidpFontData[Character * BOOTCHAR_HEIGHT - Top];
25 
26  /* Loop each pixel height */
27  for (i = BOOTCHAR_HEIGHT; i > 0; --i)
28  {
29  /* Loop each pixel width */
30  XOffset = Left;
31  for (j = (1 << 7); j > 0; j >>= 1)
32  {
33  /* Check if we should draw this pixel */
34  if (FontChar[Top] & (UCHAR)j)
35  {
36  /* We do, use the given Text Color */
37  SetPixel(XOffset, Top, (UCHAR)TextColor);
38  }
39  else if (BackColor < BV_COLOR_NONE)
40  {
41  /*
42  * This is a background pixel. We're drawing it
43  * unless it's transparent.
44  */
45  SetPixel(XOffset, Top, (UCHAR)BackColor);
46  }
47 
48  /* Increase X Offset */
49  XOffset++;
50  }
51 
52  /* Move to the next Y ordinate */
53  Top++;
54  }
55 }
56 
57 VOID
58 NTAPI
60  _In_ ULONG Scroll)
61 {
62  ULONG Top, Offset;
63  PUSHORT SourceOffset, DestOffset;
64  PUSHORT i, j;
65 
66  /* Set memory positions of the scroll */
68  DestOffset = &SourceOffset[Scroll * (SCREEN_WIDTH / 8)];
69 
70  /* Start loop */
71  for (Top = VidpScrollRegion[1]; Top <= VidpScrollRegion[3]; ++Top)
72  {
73  /* Set number of bytes to loop and start offset */
74  Offset = VidpScrollRegion[0] >> 3;
75  j = SourceOffset;
76 
77  /* Check if this is part of the scroll region */
78  if (Offset <= (VidpScrollRegion[2] >> 3))
79  {
80  /* Update position */
81  i = (PUSHORT)(DestOffset - SourceOffset);
82 
83  /* Loop the X axis */
84  do
85  {
86  /* Write value in the new position so that we can do the scroll */
88 
89  /* Move to the next memory location to write to */
90  j++;
91 
92  /* Move to the next byte in the region */
93  Offset++;
94 
95  /* Make sure we don't go past the scroll region */
96  } while (Offset <= (VidpScrollRegion[2] >> 3));
97  }
98 
99  /* Move to the next line */
100  SourceOffset += (SCREEN_WIDTH / 8);
101  DestOffset += (SCREEN_WIDTH / 8);
102  }
103 }
104 
105 VOID
106 NTAPI
108  _In_ ULONG CurrentTop,
109  _In_ ULONG TopDelta,
110  _In_ BOOLEAN Restore)
111 {
112  PUSHORT Position1, Position2;
113  ULONG Count;
114 
115  /* Calculate the position in memory for the row */
116  if (Restore)
117  {
118  /* Restore the row by copying back the contents saved off-screen */
119  Position1 = &VgaArmBase[CurrentTop * (SCREEN_WIDTH / 8)];
120  Position2 = &VgaArmBase[SCREEN_HEIGHT * (SCREEN_WIDTH / 8)];
121  }
122  else
123  {
124  /* Preserve the row by saving its contents off-screen */
125  Position1 = &VgaArmBase[SCREEN_HEIGHT * (SCREEN_WIDTH / 8)];
126  Position2 = &VgaArmBase[CurrentTop * (SCREEN_WIDTH / 8)];
127  }
128 
129  /* Set the count and loop every pixel */
130  Count = TopDelta * (SCREEN_WIDTH / 8);
131  while (Count--)
132  {
133  /* Write the data back on the other position */
134  WRITE_REGISTER_USHORT(Position1, READ_REGISTER_USHORT(Position2));
135 
136  /* Increase both positions */
137  Position1++;
138  Position2++;
139  }
140 }
141 
142 VOID
143 NTAPI
145 {
146  //
147  // Set framebuffer address
148  //
151 
152  //
153  // Initialize timings to 640x480
154  //
157 
158  //
159  // Enable the LCD Display
160  //
165  LCDCONTROL_LCDBPP(4));
166 }
167 
168 VOID
169 NTAPI
171  _In_ PULONG Table,
172  _In_ ULONG Count)
173 {
175 }
176 
177 /* PUBLIC FUNCTIONS **********************************************************/
178 
179 /*
180  * @implemented
181  */
182 BOOLEAN
183 NTAPI
185  _In_ BOOLEAN SetMode)
186 {
187  DPRINT1("bv-arm v0.1\n");
188 
189  //
190  // Allocate framebuffer
191  // 600kb works out to 640x480@16bpp
192  //
193  VgaPhysical.QuadPart = -1;
195  if (!VgaArmBase) return FALSE;
196 
197  //
198  // Get physical address
199  //
201  if (!VgaPhysical.QuadPart) return FALSE;
202  DPRINT1("[BV-ARM] Frame Buffer @ 0x%p 0p%p\n", VgaArmBase, VgaPhysical.LowPart);
203 
204  //
205  // Setup the display
206  //
208 
209  //
210  // We are done!
211  //
212  return TRUE;
213 }
214 
215 /*
216  * @implemented
217  */
218 VOID
219 NTAPI
221  _In_ BOOLEAN HalReset)
222 {
223  //
224  // Clear the current position
225  //
226  VidpCurrentX = 0;
227  VidpCurrentY = 0;
228 
229  //
230  // Re-initialize the VGA Display
231  //
233 
234  //
235  // Re-initialize the palette and fill the screen black
236  //
239 }
240 
241 /*
242  * @implemented
243  */
244 VOID
245 NTAPI
247 {
249  while (TRUE);
250 }
251 
252 /*
253  * @implemented
254  */
255 VOID
256 NTAPI
259  _In_ ULONG Left,
260  _In_ ULONG Top,
261  _In_ ULONG Width,
262  _In_ ULONG Height,
263  _In_ ULONG Delta)
264 {
266  while (TRUE);
267 }
268 
269 /*
270  * @implemented
271  */
272 VOID
273 NTAPI
275  _In_ ULONG Left,
276  _In_ ULONG Top,
277  _In_ ULONG Right,
278  _In_ ULONG Bottom,
279  _In_ UCHAR Color)
280 {
281  int y, x;
282 
283  //
284  // Loop along the Y-axis
285  //
286  for (y = Top; y <= Bottom; y++)
287  {
288  //
289  // Loop along the X-axis
290  //
291  for (x = Left; x <= Right; x++)
292  {
293  //
294  // Draw the pixel
295  //
296  SetPixel(x, y, Color);
297  }
298  }
299 }
VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
Definition: bootvid.c:263
VOID NTAPI VidScreenToBufferBlt(_Out_ PUCHAR Buffer, _In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_ ULONG Delta)
Definition: bootvid.c:257
ASMGENDATA Table[]
Definition: genincdata.c:61
NTKERNELAPI VOID NTAPI WRITE_REGISTER_ULONG(IN PULONG Register, IN ULONG Value)
#define TRUE
Definition: types.h:120
#define LCDCONTROL_LCDEN
Definition: hwclcd.c:14
PUSHORT VgaArmBase
Definition: bootvid.c:6
unsigned char * PUCHAR
Definition: retypes.h:3
char CHAR
Definition: xmlstorage.h:175
#define SCREEN_WIDTH
Definition: pc98video.c:27
#define PL110_LCDTIMING1
Definition: hwclcd.c:19
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
NTKERNELAPI VOID NTAPI WRITE_REGISTER_USHORT(IN PUSHORT Register, IN USHORT Value)
VOID NTAPI DisplayCharacter(_In_ CHAR Character, _In_ ULONG Left, _In_ ULONG Top, _In_ ULONG TextColor, _In_ ULONG BackColor)
Definition: bootvid.c:13
VOID NTAPI VidResetDisplay(_In_ BOOLEAN HalReset)
Definition: bootvid.c:220
#define LCDTIMING1_LPP(x)
Definition: hwclcd.c:12
uint32_t ULONG_PTR
Definition: typedefs.h:64
ULONG VidpScrollRegion[4]
Definition: common.c:10
#define BOOTCHAR_HEIGHT
Definition: precomp.h:27
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
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
unsigned char BOOLEAN
#define PL110_LCDLPBASE
Definition: hwclcd.c:22
#define LCDCONTROL_LCDTFT
Definition: hwclcd.c:16
#define _Out_
Definition: no_sal2.h:323
VOID NTAPI VidpInitializeDisplay(VOID)
Definition: bootvid.c:144
#define PL110_LCDCONTROL
Definition: hwclcd.c:23
VOID NTAPI VidCleanUp(VOID)
Definition: bootvid.c:246
Definition: bufpool.h:45
PHYSICAL_ADDRESS VgaPhysical
Definition: bootvid.c:7
#define BV_COLOR_NONE
Definition: display.h:31
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 SCREEN_HEIGHT
Definition: pc98video.c:28
ULONG VidpCurrentY
Definition: common.c:8
#define LCDCONTROL_LCDBPP(x)
Definition: hwclcd.c:15
VOID NTAPI PreserveRow(_In_ ULONG CurrentTop, _In_ ULONG TopDelta, _In_ BOOLEAN Restore)
Definition: bootvid.c:107
#define LCDTIMING0_PPL(x)
Definition: hwclcd.c:11
#define LCDCONTROL_LCDPWR
Definition: hwclcd.c:13
#define PL110_LCDTIMING0
Definition: hwclcd.c:18
VOID NTAPI InitPaletteWithTable(_In_ PULONG Table, _In_ ULONG Count)
Definition: bootvid.c:170
VOID NTAPI VidSolidColorFill(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ UCHAR Color)
Definition: bootvid.c:274
unsigned char UCHAR
Definition: xmlstorage.h:181
_In_ UINT _In_ UINT _In_ PNDIS_PACKET _In_ UINT SourceOffset
Definition: ndis.h:3167
ULONG LowPart
Definition: typedefs.h:105
#define _In_
Definition: no_sal2.h:204
UCHAR VidpFontData[256 *BOOTCHAR_HEIGHT]
Definition: fontdata.c:9
static LPHIST_ENTRY Bottom
Definition: history.c:54
BOOLEAN NTAPI VidInitialize(_In_ BOOLEAN SetMode)
Definition: bootvid.c:184
static ULONG Delta
Definition: xboxvideo.c:32
unsigned int * PULONG
Definition: retypes.h:1
PVOID NTAPI MmAllocateContiguousMemory(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: contmem.c:626
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define BV_COLOR_BLACK
Definition: display.h:15
VOID NTAPI DoScroll(_In_ ULONG Scroll)
Definition: bootvid.c:59
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
NTKERNELAPI USHORT NTAPI READ_REGISTER_USHORT(IN PUSHORT Register)
#define UNIMPLEMENTED
Definition: debug.h:115
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
Definition: stubs.c:685
#define PL110_LCDUPBASE
Definition: hwclcd.c:21
static LPHIST_ENTRY Top
Definition: history.c:53
unsigned short * PUSHORT
Definition: retypes.h:2
ULONG VidpCurrentX
Definition: common.c:7
LONGLONG QuadPart
Definition: typedefs.h:113
#define InitializePalette()
Definition: precomp.h:68