- Refactor keyboard support to match serial. Now reading a key and waiting for a...
[reactos.git] / reactos / boot / armllb / fw.c
1 /*
2 * PROJECT: ReactOS Boot Loader
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: boot/armllb/fw.c
5 * PURPOSE: LLB Firmware Routines (accessible by OS Loader)
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9 #include "precomp.h"
10
11 VOID
12 LlbFwPutChar(INT Ch)
13 {
14 /* Just call directly the video function */
15 LlbVideoPutChar(Ch);
16
17 /* DEBUG ONLY */
18 LlbSerialPutChar(Ch);
19 }
20
21 BOOLEAN
22 LlbFwKbHit(VOID)
23 {
24 /* Check RX buffer */
25 return LlbHwKbdReady();
26 }
27
28 INT
29 LlbFwGetCh(VOID)
30 {
31 /* Return the key pressed */
32 return LlbKeyboardGetChar();
33 }
34
35 ULONG
36 LlbFwVideoSetDisplayMode(IN PCHAR DisplayModeName,
37 IN BOOLEAN Init)
38 {
39 /* Return text mode */
40 return 0;
41 }
42
43 VOID
44 LlbFwVideoGetDisplaySize(OUT PULONG Width,
45 OUT PULONG Height,
46 OUT PULONG Depth)
47 {
48 /* Query static settings */
49 *Width = LlbHwGetScreenWidth() / 8;
50 *Height = LlbHwGetScreenHeight() / 13;
51
52 /* Depth is always 16 bpp */
53 *Depth = 16;
54 }
55
56 ULONG
57 LlbFwVideoGetBufferSize(VOID)
58 {
59 /* X * Y * BPP */
60 return LlbHwGetScreenWidth() * LlbHwGetScreenHeight() * 2;
61 }
62
63 VOID
64 LlbFwVideoSetTextCursorPosition(IN ULONG X,
65 IN ULONG Y)
66 {
67 printf("%s is UNIMPLEMENTED", __FUNCTION__);
68 while (TRUE);
69 }
70
71 VOID
72 LlbFwVideoHideShowTextCursor(IN BOOLEAN Show)
73 {
74 /* Nothing to do */
75 return;
76 }
77
78 USHORT ColorPalette[16][3] =
79 {
80 {0x00, 0x00, 0x00},
81 {0x00, 0x00, 0xAA},
82 {0x00, 0xAA, 0x00},
83 {0x00, 0xAA, 0xAA},
84 {0xAA, 0x00, 0x00},
85 {0xAA, 0x00, 0xAA},
86 {0xAA, 0x55, 0x00},
87 {0xAA, 0xAA, 0xAA},
88 {0x55, 0x55, 0x55},
89 {0x55, 0x55, 0xFF},
90 {0x55, 0xFF, 0x55},
91 {0x55, 0xFF, 0xFF},
92 {0xFF, 0x55, 0x55},
93 {0xFF, 0x55, 0xFF},
94 {0xFF, 0xFF, 0x55},
95 {0xFF, 0xFF, 0xFF},
96 };
97
98 VOID
99 LlbFwVideoCopyOffScreenBufferToVRAM(IN PVOID Buffer)
100 {
101 /* No double-buffer is used on ARM */
102 return;
103 }
104
105 VOID
106 LlbFwVideoClearScreen(IN UCHAR Attr)
107 {
108 /* Clear the screen */
109 LlbVideoClearScreen(TRUE);
110 }
111
112 VOID
113 LlbFwVideoPutChar(IN INT c,
114 IN UCHAR Attr,
115 IN ULONG X,
116 IN ULONG Y)
117 {
118 ULONG Color, BackColor;
119 PUSHORT Buffer;
120
121 /* Convert EGA index to color used by hardware */
122 Color = LlbHwVideoCreateColor(ColorPalette[Attr & 0xF][0],
123 ColorPalette[Attr & 0xF][1],
124 ColorPalette[Attr & 0xF][2]);
125 BackColor = LlbHwVideoCreateColor(ColorPalette[Attr >> 4][0],
126 ColorPalette[Attr >> 4][1],
127 ColorPalette[Attr >> 4][2]);
128
129 /* Compute buffer address */
130 Buffer = (PUSHORT)LlbHwGetFrameBuffer() + (LlbHwGetScreenWidth() * (Y * 13)) + (X * 8);
131
132 /* Draw it */
133 LlbVideoDrawChar(c, Buffer, Color, BackColor);
134 }
135
136 BOOLEAN
137 LlbFwVideoIsPaletteFixed(VOID)
138 {
139 printf("%s is UNIMPLEMENTED", __FUNCTION__);
140 while (TRUE);
141 return TRUE;
142 }
143
144 VOID
145 LlbFwVideoSetPaletteColor(IN UCHAR Color,
146 IN UCHAR Red,
147 IN UCHAR Green,
148 IN UCHAR Blue)
149 {
150 printf("%s is UNIMPLEMENTED", __FUNCTION__);
151 while (TRUE);
152 return;
153 }
154
155 VOID
156 LlbFwVideoGetPaletteColor(IN UCHAR Color,
157 OUT PUCHAR Red,
158 OUT PUCHAR Green,
159 OUT PUCHAR Blue)
160 {
161 printf("%s is UNIMPLEMENTED", __FUNCTION__);
162 while (TRUE);
163 return;
164 }
165
166 VOID
167 LlbFwVideoSync(VOID)
168 {
169 printf("%s is UNIMPLEMENTED", __FUNCTION__);
170 while (TRUE);
171 return;
172 }
173
174 TIMEINFO*
175 LlbFwGetTime(VOID)
176 {
177 /* Call existing function */
178 return LlbGetTime();
179 }
180
181 /* EOF */